Commit d41c75b0 by chenwq

fix(validReferralCount): 修复编辑页参数传递与数据初始化问题

- 修改导航参数传递方式,使用 JSON.stringify 传递完整对象而非仅 merchantId
- 修复编辑页面数据初始化逻辑,确保组件正确接收更新后的数据
- 修复有效引荐数空值判断逻辑,使用严格相等运算符
- 优化图片上传状态管理,添加加载状态防止重复上传
- 根据提交状态动态设置页面标题(编辑/查看)
1 parent 991ddfcc
......@@ -10,7 +10,7 @@ Component({
value: {},
observer(newVal) {
if (newVal) {
this.initData(newVal)
this.initData(this.data.item)
}
}
}
......@@ -25,7 +25,7 @@ Component({
3: '单延保'
},
isRemarkRequired: false,
fileList: [], // For uploader
fileList: [],
fileMaxLen: 15
},
......@@ -111,7 +111,7 @@ Component({
let { fileList, fileMaxLen } = _this.data
getApp().globalData.isChoosingMedia = true
wx.chooseMedia({
count: fileMaxLen - fileList.length,
count: fileMaxLen - fileList?.length,
sizeType: ['original'],
mediaType: ['image'],
complete() {
......@@ -121,6 +121,9 @@ Component({
},
success(res) {
wx.showLoading({ title: '上传中' })
_this.setData({
loadingFlag: true
})
const uploadImages = async tempFiles => {
try {
for (const item of tempFiles) {
......@@ -150,9 +153,12 @@ Component({
}
}
} catch (error) {
wx.showToast({ title: '上传失败,请重试', icon: 'none' })
wx.$util.showToast("上传失败,请重试")
} finally {
wx.hideLoading()
_this.setData({
loadingFlag: false
})
}
}
uploadImages(res?.tempFiles)
......@@ -181,7 +187,6 @@ Component({
this.updateImageUrls(fileList)
},
// Sync fileList to item.imageUrls
updateImageUrls(fileList) {
const urls = fileList.map(file => file.fileUrl).join(',')
this.setData({
......@@ -197,7 +202,7 @@ Component({
if (effectiveReferralCountDTOS && effectiveReferralCountDTOS.length > 0) {
for (const dto of effectiveReferralCountDTOS) {
const val = dto.effectiveReferralCount
if (val == null || val == undefined || val == '') {
if (val == null || val == undefined || val === '') {
wx.showToast({
title: `${dto.brandName}交车数有效引荐数未填`,
icon: 'none'
......
......@@ -16,9 +16,12 @@ Page({
*/
onLoad(options) {
this.setData({
routerParams: options
routerParams: JSON.parse(options.info)
});
console.log(options, 'options----')
// 提交状态:0-未提交 1-已提交
wx.setNavigationBarTitle({
title: this.data.routerParams.submitStatus ? '查看门店引荐数' : '编辑门店引荐数'
})
this.getDetail();
},
......@@ -28,7 +31,7 @@ Page({
if (item.status == 0) {
if (item.effectiveReferralCountDTOS && item.effectiveReferralCountDTOS.length) {
item.effectiveReferralCountDTOS.forEach(k => {
k.effectiveReferralCount = k.deliveryCount || '0'
k.effectiveReferralCount = (k.deliveryCount || 0) + ''
})
}
}
......
......@@ -168,8 +168,8 @@ Page({
console.log(target)
wx.navigateTo({
url:
"/packageWorkspace/pages/validReferralCount/referraCountEdit/referraCountEdit?merchantId=" +
target.merchantId,
"/packageWorkspace/pages/validReferralCount/referraCountEdit/referraCountEdit?info=" +
JSON.stringify(target),
});
},
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!