From f208f8fdb2bc3ed8b060006c13a228d4fb66ef19 Mon Sep 17 00:00:00 2001 From: woody Date: Mon, 28 Apr 2025 17:06:21 +0800 Subject: [PATCH] =?UTF-8?q?fix(addRechargeCard):=20bug-54=20=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E5=85=85=E5=80=BC=E6=8F=90=E8=B4=A7=E5=8D=A1=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=E6=97=A0=E6=B3=95=E9=80=89=E6=8B=A9=E5=95=86=E5=93=81?= =?UTF-8?q?=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../rechargeCard/addRechargeCard.vue | 217 ++++++++++-------- 1 file changed, 116 insertions(+), 101 deletions(-) diff --git a/src/views/marketing/rechargeCard/addRechargeCard.vue b/src/views/marketing/rechargeCard/addRechargeCard.vue index be09104..16e18e4 100644 --- a/src/views/marketing/rechargeCard/addRechargeCard.vue +++ b/src/views/marketing/rechargeCard/addRechargeCard.vue @@ -31,7 +31,7 @@ type="primary" size="mini" @click="addNewGoods" - >{{'添加'}} + >{{ '添加' }} {{ '会员编号' }} {{ '会员名称' }} - {{'产品名称'}} - {{'产品规格'}} - {{'提货基数'}} + {{ '产品名称' }} + {{ '产品规格' }} + {{ '提货基数' }} 可提数量 增加数量 {{ '截止日期' }} @@ -120,7 +120,7 @@ v-show="ctem.waresGiftConfigList.length==0" class="tableAddPro" > - {{'添加产品'}} + {{ '添加产品' }} - + - + - +
- - - - {{ '搜索' }} - - + + + + {{ '搜索' }} + +
- - + {{'选择规格'}}
+ >{{ '选择规格' }}
- {{'取消'}} + {{ '取消' }} {{'确认'}} + >{{ '确认' }} - {{'取消'}} + {{ '取消' }} {{'确认'}} + >{{ '确认' }}
@@ -366,14 +371,14 @@ @click="cancelCz" > {{ '取消' }} {{ '确认' }} { // console.error(res) - if(res.data.detailList){ + if (res.data.detailList) { that.allData = [{ 'consumeRuleConfigList': [{ - memberName: res.data.memberName, - memberCode: res.data.memberCode, - pkId: res.data.pkId, - baseQuantity: res.data.baseQuantity, - receiveTime: res.data.receiveTime, - usableQuantity: res.data.usableQuantity, - quantity: 0, - isFreeMail: res.data.isFreeMail, - waresGiftConfigList: [ - { - pkProduct: res.data.detailList[0].pkProduct, - productName: res.data.detailList[0].productName, - specsName: res.data.detailList[0].specsName, - specsNameId: res.data.detailList[0].specsNameId, - quantity: res.data.detailList[0].quantity - } - ] }], 'orderType': 1 }] - }else{ + memberName: res.data.memberName, + memberCode: res.data.memberCode, + pkId: res.data.pkId, + baseQuantity: res.data.baseQuantity, + receiveTime: res.data.receiveTime, + usableQuantity: res.data.usableQuantity, + quantity: 0, + isFreeMail: res.data.isFreeMail, + waresGiftConfigList: [ + { + pkProduct: res.data.detailList[0].pkProduct, + productName: res.data.detailList[0].productName, + specsName: res.data.detailList[0].specsName, + specsNameId: res.data.detailList[0].specsNameId, + quantity: res.data.detailList[0].quantity + } + ] }], 'orderType': 1 }] + } else { that.allData = [{ 'consumeRuleConfigList': [{ - memberName: res.data.memberName, - memberCode: res.data.memberCode, - pkId: res.data.pkId, - baseQuantity: res.data.baseQuantity, - receiveTime: res.data.receiveTime, - usableQuantity: res.data.usableQuantity, - quantity: 0, - isFreeMail: res.data.isFreeMail, - waresGiftConfigList: [ - { - pkProduct:'', - productName: '', - specsName: '', - specsNameId: '', - quantity: 0 - } - ] }], 'orderType': 1 }] + memberName: res.data.memberName, + memberCode: res.data.memberCode, + pkId: res.data.pkId, + baseQuantity: res.data.baseQuantity, + receiveTime: res.data.receiveTime, + usableQuantity: res.data.usableQuantity, + quantity: 0, + isFreeMail: res.data.isFreeMail, + waresGiftConfigList: [ + { + pkProduct: '', + productName: '', + specsName: '', + specsNameId: '', + quantity: 0 + } + ] }], 'orderType': 1 }] } - }) this.$forceUpdate() }, @@ -558,7 +562,7 @@ export default { 'receiveTime': res.receiveTime, 'specsName': res.waresGiftConfigList[0].specsName, 'specsNameId': res.waresGiftConfigList[0].specsNameId, 'baseQuantity': res.baseQuantity, 'quantity': res.quantity, 'isFreeMail': res.isFreeMail, 'pkPostage': res.pkPostage, - "pkId":res.pkId?res.pkId:'' + 'pkId': res.pkId ? res.pkId : '' } ) }) @@ -590,7 +594,7 @@ export default { } if (res.quantity === '' || res.quantity == undefined) { this.flags = 3 - + return false } else { this.flags = 2 @@ -619,20 +623,20 @@ export default { }) } else if (this.flags == 3) { this.$message({ - message: '请输入增加数量', - type: 'warning' - }) - }else { + message: '请输入增加数量', + type: 'warning' + }) + } else { this.$router.push({ path: 'rechargeQc', query: { data: JSON.stringify(dataList), - approvalBusiness: 700, + approvalBusiness: 700 } }) } }, - saveDate1(){ + saveDate1() { const dataList = [] this.allData[0].consumeRuleConfigList.forEach((res) => { dataList.push( @@ -641,18 +645,18 @@ export default { 'receiveTime': res.receiveTime, 'specsName': res.waresGiftConfigList[0].specsName, 'specsNameId': res.waresGiftConfigList[0].specsNameId, 'baseQuantity': res.baseQuantity, 'quantity': res.quantity, 'isFreeMail': res.isFreeMail, 'pkPostage': res.pkPostage, - "pkId":res.pkId?res.pkId:'' + 'pkId': res.pkId ? res.pkId : '' } ) }) this.$router.push({ - path: 'rechargeQc', - query: { - data: JSON.stringify(dataList), - approvalBusiness: 701, - type:this.deled - } - }) + path: 'rechargeQc', + query: { + data: JSON.stringify(dataList), + approvalBusiness: 701, + type: this.deled + } + }) }, getPage(allData) { this.allData = allData @@ -690,13 +694,19 @@ export default { this.ggVisible = false }, sureProduct() { - if (this.selectData.length == 0) { + if (!this.selectData) { this.$message({ message: '请选择产品', type: 'warning' }) - return false } else { + if (!this.selectData.selSkuNameList || this.selectData.selSkuNameList.length === 0) { + this.$message({ + message: '请选择产品规格', + type: 'warning' + }) + return + } this.allData.forEach((item) => { if (this.isArea == item.orderType) { item.consumeRuleConfigList[this.showCndex].waresGiftConfigList[ @@ -758,7 +768,7 @@ export default { this.isArea = val }, handleClose() { - this.selectData = [] + this.selectData = undefined this.dialogVisible = false }, handleCloseGg() { @@ -838,7 +848,7 @@ export default { }, getDataList() { api - .getProductAll(Object.assign({isPutOn:0}, this.queryParams, this.select,{isExistSpecs:1})) + .getProductAll(Object.assign({ isPutOn: 0 }, this.queryParams, this.select, { isExistSpecs: 1 })) .then((res) => { res.rows.forEach((item) => { item.quantity = 1 @@ -872,18 +882,23 @@ export default { }, selected(selection, row) { // 清除 所有勾选项 + if (selection.length === 0) { + this.selectData = undefined + } else { + this.selectData = row + } + this.$refs.multipleTable.clearSelection() - // 当表格数据都没有被勾选的时候 就返回 - // 主要用于将当前勾选的表格状态清除 - if (selection.length == 0) return this.$refs.multipleTable.toggleRowSelection(row, true) - this.selectData = row - }, - // 表格的选中 可以获得当前选中的数据 - selectionChange(val) { - // 将选中的数据存储起来 - this.selectData = val + // // 当表格数据都没有被勾选的时候 就返回 + // // 主要用于将当前勾选的表格状态清除 + // this.$nextTick(() => { + // if (selection.length == 0) return + // this.$refs.multipleTable.toggleRowSelection(row, true) + // this.selectData = row + // }) }, + tableRowClassName({ row, rowIndex }) { if (rowIndex % 2 == 1) { return 'warning-row'