This commit is contained in:
@@ -593,52 +593,55 @@
|
||||
return;
|
||||
}
|
||||
|
||||
uni.showLoading({
|
||||
title: '同步中...',
|
||||
mask: true
|
||||
uni.showModal({
|
||||
title: '确认同步',
|
||||
content: '确定要同步运营商数据吗?',
|
||||
success: (res) => {
|
||||
if (!res.confirm) return;
|
||||
uni.showLoading({
|
||||
title: '同步中...',
|
||||
mask: true
|
||||
});
|
||||
|
||||
assetApi.refresh(identifier).then((data) => {
|
||||
uni.hideLoading();
|
||||
|
||||
if (data.accepted) {
|
||||
const refreshTypeText = data.refresh_type === 'device' ? '设备' : '卡';
|
||||
uni.showToast({
|
||||
title: `${refreshTypeText}数据同步成功`,
|
||||
icon: 'success',
|
||||
duration: 2000
|
||||
});
|
||||
|
||||
setTimeout(() => {
|
||||
loadAssetInfo();
|
||||
}, 2000);
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: '同步失败,请稍后重试',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
}).catch((e) => {
|
||||
uni.hideLoading();
|
||||
console.error('同步数据失败', e);
|
||||
|
||||
if (e.msg && e.msg.includes('冷却')) {
|
||||
uni.showToast({
|
||||
title: e.msg,
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
});
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: '同步失败',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
try {
|
||||
const data = await assetApi.refresh(identifier);
|
||||
|
||||
uni.hideLoading();
|
||||
|
||||
if (data.accepted) {
|
||||
const refreshTypeText = data.refresh_type === 'device' ? '设备' : '卡';
|
||||
uni.showToast({
|
||||
title: `${refreshTypeText}数据同步成功`,
|
||||
icon: 'success',
|
||||
duration: 2000
|
||||
});
|
||||
|
||||
// 同步成功后,延迟重新加载资产信息
|
||||
setTimeout(() => {
|
||||
loadAssetInfo();
|
||||
}, 2000);
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: '同步失败,请稍后重试',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
} catch (e) {
|
||||
uni.hideLoading();
|
||||
console.error('同步数据失败', e);
|
||||
|
||||
// 如果是冷却时间错误,显示提示
|
||||
if (e.msg && e.msg.includes('冷却')) {
|
||||
uni.showToast({
|
||||
title: e.msg,
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
});
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: '同步失败',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const enterDetail = (name) => {
|
||||
|
||||
Reference in New Issue
Block a user