From 0009b4f2ea91a6641674b67f8f25a45e9a766bfd Mon Sep 17 00:00:00 2001 From: wangfukang <15630117759@163.com> Date: Sat, 4 May 2024 20:44:28 +0800 Subject: [PATCH] 11 --- pages/index/shareStyle.vue | 6 +- pages/inventory/AIInventory.vue | 119 ++++++++++------- pages/inventory/addinventory.vue | 27 +--- pages/inventory/goodsList1.vue | 223 ++++++++++++++----------------- 4 files changed, 183 insertions(+), 192 deletions(-) diff --git a/pages/index/shareStyle.vue b/pages/index/shareStyle.vue index bc6ea63..128b511 100644 --- a/pages/index/shareStyle.vue +++ b/pages/index/shareStyle.vue @@ -277,7 +277,11 @@ }, //点击分享按钮 - clickShareBtn(e) { + clickShareBtn(e) { + if(e != 'all' && this.carList == ''){ + this.tui.toast("请勾选商品后再分享") + return + } if (e == 'all') { this.data = { shareType: '1', //1 分享全部 diff --git a/pages/inventory/AIInventory.vue b/pages/inventory/AIInventory.vue index 55d82b1..d7638d6 100644 --- a/pages/inventory/AIInventory.vue +++ b/pages/inventory/AIInventory.vue @@ -225,8 +225,18 @@ - + + + 修改规格值 + + + + + + 取消 + 确认 + + @@ -291,10 +301,19 @@ - - - + + + + 修改规格值 + + + + + + 取消 + 确认 + + @@ -334,7 +353,8 @@ goodsList: [], mergeId:'', newTemList: [], - pecsList: [], + pecsList: [], + categoryText:'', dataObj: new Map(), isPlusAndMinus:false, indexList:[], @@ -476,10 +496,8 @@ // that.carList.get(id).productCount; } this.carList1 = [] - } else { //当前页有数据 - console.log('回来1111') + } else { //当前页有数据 for (let i = 0; i < this.carList1.length; i++) { - console.log('回来2222') let id = this.carList1[i].isNew == true ? this.carList1[i].id : this.carList1[i].productId if (this.carList.has(this.carList1[i].id) == true) { //商品相同 for (let m = 0; m < this.carList1[i].saleDetailQueryDTO.length; m++) { @@ -685,6 +703,9 @@ this.$refs.getaPopup.close() }, 200) }, + handleBlur(e){ + this.categoryText = e.detail.value + }, inputDialogToggle(item) { this.inputVal = ''; this.isOpenId = item; @@ -709,10 +730,13 @@ return } this.tui.request("/app/productAttributeValue/save", "post", { - value: e, + value: this.categoryText, attributeId: this.isOpenId }, false, true).then((res) => { if (res.code == 200) { + + this.categoryText = '' + this.$refs.inputDialog.close() this.getGategoryLowList() this.$forceUpdate() uni.showToast({ @@ -726,12 +750,11 @@ }) } }).catch((res) => {}) - - this.$refs.inputClose.val = '' }, dialogClose() { this.inputVal = ''; - this.$refs.inputClose.val = '' + this.$refs.inputDialog.close() + this.categoryText = '' }, combination(arr) { let result = [ @@ -756,6 +779,7 @@ }, false, true).then((res) => { if (res.code == 200) { this.indexList = res.result; + this.categoryText = "" } else { this.tui.toast(res.message) } @@ -866,7 +890,7 @@ }] }] this.tui.request("/app/productCategory/batchSaveCategoryAndAttribute", "post", { - categoryName: e, + categoryName: this.categoryText, productAttributeOfAddVos:multipleList }, false, false).then((res) => { if (res.code == 200) { @@ -881,7 +905,7 @@ icon: 'none' }) } - + this.$refs.addGateDialog.close() }).catch((res) => {}) }, allChange(e){ @@ -1106,6 +1130,9 @@ this.$refs.mergePopup.open() } }, + shiqujiaodian(e){ + console.log("11111",e); + }, //合并已有 clickMerge(value,key){ let that = this; @@ -1147,7 +1174,6 @@ return } that.goodsDetail = res.result; - } else { this.tui.toast(res.message) } @@ -1172,7 +1198,6 @@ isChecked: false }) that.dataObj.set(newObj[val][i], val) - // isTrue = false } newArr.push({ name: val, @@ -1206,13 +1231,10 @@ } }).catch((res) => {}) }, 300) - - }) - + }) this.pageOldTemList = [] that.temporaryList = [] if (that.carList.size > 0) { - // let isTrue = false that.carList.forEach(function(value, key) { value.stockLogList.forEach(function(values, keys) { if(value.stockLogList1.length == 0){ @@ -1237,15 +1259,14 @@ } } } - } - - + } }) }) that.zNum = 0 + console.log('id',id) that.$nextTick(() => { that.carList.forEach(function(value, key) { - if (value.productId == id) { + if (value.productId == id || value.productId == id.productId) { that.zNum = value.productCount that.temporaryList = value.stockLogList1 that.pageOldTemList = value.stockLogList1 @@ -1254,12 +1275,10 @@ value.stockLogList1 = [] }) }) - } setTimeout(res => { this.getKCList(current == 1?id.id:id); - }, 300) - + }, 300) }, //库存商品详情 getKCList(id) { @@ -1290,8 +1309,7 @@ temporaryCheck() { uni.showLoading({ title: '加载中...' - }) - console.log('goodsDetail',this.goodsDetail); + }) let that = this, carList1 = [] let data = { @@ -1320,9 +1338,7 @@ for (let m = 0; m < this.goodsDetail.attributeList[i].value.length; m++) { this.goodsDetail.attributeList[i].value[m].isChecked = false } - } - console.log('测试',carList1); - console.log('carList',this.carList); + } if (this.carList.size == 0) { //当前页没有数据 for (let i = 0; i < carList1.length; i++) { let obj = { @@ -1360,21 +1376,28 @@ } else { //当前页有数据 for (let i = 0; i < carList1.length; i++) { - // if(this.carList.get(carList1[i].id)){ - // this.carList.get(carList1[i].id).productCount = 0 - // } + - if (this.carList.has(carList1[i].id) == true) { //商品相同 + if (this.carList.has(carList1[i].id) == true) { //商品相同 + if(this.carList.get(carList1[i].id)){ + this.carList.get(carList1[i].id).productCount = 0 + } for (let m = 0; m < carList1[i].saleDetailQueryDTO.length; m++) { if (this.carList.get(carList1[i].id).stockLogList.has(carList1[i] .saleDetailQueryDTO[ m].attributeList) == true) { //规格相同 - - this.carList.get(carList1[i].id).stockLogList.get(carList1[i] - .saleDetailQueryDTO[m].attributeList).productCount += carList1[i] - .saleDetailQueryDTO[m].productCount - this.carList.get(carList1[i].id).price1 = this.carList.get(carList1[i].id).productCount * this.goodsDetail.purchasePrice + var data1 = { + productCount: carList1[i].saleDetailQueryDTO[m].productCount, + name: carList1[i].saleDetailQueryDTO[m].name, + uuid:'A'+generateUUID() + } + + this.carList.get(carList1[i].id).stockLogList.set(carList1[i].saleDetailQueryDTO[m].attributeList, data1) + // this.carList.get(carList1[i].id).stockLogList.get(carList1[i] + // .saleDetailQueryDTO[m].attributeList).productCount += carList1[i] + // .saleDetailQueryDTO[m].productCount + // this.carList.get(carList1[i].id).price1 = this.carList.get(carList1[i].id).productCount * this.goodsDetail.purchasePrice } else { //规格不同 var data1 = { @@ -1396,7 +1419,8 @@ price:this.goodsDetail.price, price1: 0, productCount: 0, - productId: carList1[i].id, + productId: carList1[i].id, + categoryId:this.goodsDetail.categoryId, productName: carList1[i].productName, wholesalePrice: this.goodsDetail.wholesalePrice, lsprice: this.goodsDetail.price, @@ -1454,8 +1478,9 @@ }, //计算欠款 changePay(e) { - this.alreadyPay = e.target.value > this.shouldPay ? this.shouldPay : e.target.value - this.noPay = this.shouldPay - this.alreadyPay + this.alreadyPay = Number(e.target.value) > Number(this.shouldPay) ? this.shouldPay : e.target.value + this.noPay = this.shouldPay - this.alreadyPay + this.noPay = this.noPay.toFixed(2) }, //跳转选择供应商 goPopleList(popleType) { @@ -1491,7 +1516,7 @@ var that = this; uni.showModal({ title: "提示", - content: "确定删除此条商品吗?", + content: "确定删除此条规格吗?", success: function(res) { if (res.confirm) { if(that.carList.get(id).stockLogList.size == 1){ diff --git a/pages/inventory/addinventory.vue b/pages/inventory/addinventory.vue index b76df82..644aaa6 100644 --- a/pages/inventory/addinventory.vue +++ b/pages/inventory/addinventory.vue @@ -875,24 +875,10 @@ for (let m = 0; m < carList1[i].saleDetailQueryDTO.length; m++) { if (this.carList.get(carList1[i].id).stockLogList.has(carList1[i].saleDetailQueryDTO[m].attributeList) == true) { //规格相同 var data1 = { - productCount: this.carList.get(carList1[i].id).stockLogList.get(carList1[i].saleDetailQueryDTO[m].attributeList).productCount + carList1[i].saleDetailQueryDTO[m].productCount, + productCount: this.carList.get(carList1[i].id).stockLogList.get(carList1[i].saleDetailQueryDTO[m].attributeList).productCount, name: carList1[i].saleDetailQueryDTO[m].name } - - this.carList.get(carList1[i].id).stockLogList.set(carList1[i].saleDetailQueryDTO[m].attributeList, data1) - - // var data1 = { - // productCount: carList1[i].saleDetailQueryDTO[m].productCount, - // name: carList1[i].saleDetailQueryDTO[m].name - // } - // this.carList.get(carList1[i].id).stockLogList.set(carList1[i].saleDetailQueryDTO[ - // m].attributeList, data1) - // this.carList.get(carList1[i].id).stockLogList.set(carList1[i] - // .saleDetailQueryDTO[ - // m].attributeList, this.carList.get(carList1[i].id).stockLogList.get( - // carList1[i].saleDetailQueryDTO[m].attributeList) + carList1[i] - // .saleDetailQueryDTO[m].productCount) - + this.carList.get(carList1[i].id).stockLogList.set(carList1[i].saleDetailQueryDTO[m].attributeList, data1) } else { //规格不同 var data1 = { productCount: carList1[i].saleDetailQueryDTO[m].productCount, @@ -940,15 +926,16 @@ this.$refs.shopPopup.close() setTimeout(res => { uni.hideLoading(); - }, 2000) + }, 500) }, changessPrice() { this.noPay = this.shouldPay - this.alreadyPay; }, //计算欠款 - changePay(e) { - this.alreadyPay = e.target.value > this.shouldPay ? this.shouldPay : e.target.value - this.noPay = this.shouldPay - this.alreadyPay + changePay(e) { + this.alreadyPay = Number(e.target.value) > Number(this.shouldPay) ? this.shouldPay : e.target.value + this.noPay = this.shouldPay - this.alreadyPay + this.noPay = this.noPay.toFixed(2) }, //跳转选择供应商 goPopleList(popleType) { diff --git a/pages/inventory/goodsList1.vue b/pages/inventory/goodsList1.vue index 6f131eb..001fa0a 100644 --- a/pages/inventory/goodsList1.vue +++ b/pages/inventory/goodsList1.vue @@ -108,7 +108,9 @@ 库存 - 数量 + + 数量 + @@ -649,7 +651,7 @@ recordState:false, currentAnchor: '', temporaryNum:0, - isInventory:false, + isInventory:true, noList:[], aiNotRecognition:'', getMsg:'' @@ -913,7 +915,7 @@ disNoAmount:this.carList1[i].wholesalePrice || 0, //折前价,用于计算整体折扣 wholesalePrice: this.carList1[i].wholesalePrice, //批发价 lsprice: this.carList1[i].price, //零售价 - productCount: this.carList1[i].productCount, //总数量 + productCount: 0, //总数量 id: this.carList1[i].productId, productName: this.carList1[i].productName, productPicture: this.carList1[i].productPicture, @@ -971,11 +973,11 @@ categoryId:this.carList1[i].categoryId, productId:this.carList1[i].productId, unitPrice: this.carList1[i].price || 0, //单价 - discountAmount: this.carList1[i].unitPrice || 0, //折后价 - disNoAmount:this.carList1[i].unitPrice || 0, //折前价,用于计算整体折扣 + discountAmount: this.carList1[i].wholesalePrice || 0, //折后价 + disNoAmount:this.carList1[i].wholesalePrice || 0, //折前价,用于计算整体折扣 wholesalePrice: this.carList1[i].wholesalePrice, //批发价 lsprice: this.carList1[i].price, //零售价 - productCount: this.carList1[i].productCount, //总数量 + productCount: 0, //总数量 id: this.carList1[i].productId, productName: this.carList1[i].productName, productPicture: this.carList1[i].productPicture, @@ -1005,22 +1007,25 @@ } } - - this.carList1 = [] - this.carList.forEach(function(value, key) { - if (that.priceType == '') { - // value.unitPrice = value.unitPrice - } else if (that.priceType == 0) { //零售 - value.unitPrice = value.lsprice - } else if (that.priceType == 1) { //批发 - value.unitPrice = value.wholesalePrice - } - if (that.discountType == 1) { //整体折扣 - value.price = value.unitPrice * 10000 * value.productCount * that.discountNum / 10 / 10000 - } + console.log(that.priceType) + this.$nextTick(() =>{ + this.carList1 = [] + this.carList.forEach(function(value, key) { + if (that.priceType == '') { + // value.unitPrice = value.unitPrice + } else if (that.priceType == 0) { //零售 + value.unitPrice = value.lsprice + } else if (that.priceType == 1) { //批发 + value.unitPrice = value.wholesalePrice + } + if (that.discountType == 1) { //整体折扣 + value.price = value.unitPrice * 10000 * value.productCount * that.discountNum / 10 / 10000 + } + }) + this.getAllPrice() + this.getAmountAndWho() }) - this.getAllPrice() - this.getAmountAndWho() + // 2019002均色M码1件2019005黑色S码一件 }, //保存已选 saveCheck() { @@ -1385,12 +1390,17 @@ this.relPrice = e.target.value this.noPay = this.relPrice - this.priceOk; }, - changePrice(e) { - e.detail.value = e.detail.value > this.relPrice ? this.relPrice : e.detail.value - this.priceOk = e.detail.value + changePrice(e) { + console.log(this.relPrice) + console.log(e.detail.value) + if(Number(e.detail.value) > Number(this.relPrice)){ + this.priceOk = this.relPrice + }else{ + this.priceOk =e.detail.value + } this.$forceUpdate() this.noPay = this.relPrice - this.priceOk; - + this.noPay = this.noPay.toFixed(2) }, getImg(key) { return this.carList.get(key).productPicture @@ -1431,9 +1441,10 @@ convertChineseToArabic(str) { const chineseNumToArabic = { '零': 0, '一': 1, '二': 2, '两': 2, '三': 3, - '四': 4, '五': 5, '六': 6, '七': 7, '八': 8, '九': 9,'杠':'-','刚':'-' + '四': 4, '五': 5, '六': 6, '七': 7, '八': 8, + '九': 9,'杠':'-','刚':'-','军色':'均色' }; - const regex = /(零|一|二|两|三|四|五|六|七|八|九|杠|刚)/g; + const regex = /(零|一|二|两|三|四|五|六|七|八|九|杠|刚|军色)/g; return str.replace(regex, match => chineseNumToArabic[match]); }, //编辑挂单信息 @@ -1457,7 +1468,7 @@ for(let i=0;i { this.tui.toast(res) @@ -1573,18 +1584,17 @@ let that = this; this.priceType = e that.priceCurrent = index - this.carList.forEach(function(value, key) { - - - that.index = value.productId || value.id - - if (e == 0) { //零售 - that.checkPay(value.lsprice) - } else { //批发 - that.checkPay(value.wholesalePrice) + this.carList.forEach(function(value, key) { + that.index = value.productId || value.id + if (e == '0') { //零售 + value.discountAmount = value.lsprice + } else { //批发 + value.discountAmount = value.wholesalePrice } }) that.$nextTick(() => { + this.getAllPrice() + this.getAmountAndWho() setTimeout(res => { uni.hideLoading(); }, 500) @@ -1606,7 +1616,7 @@ num.price = price * num.productCount; this.$refs.inputDialog.close() this.$refs.historyPopup.close() - num.discountAmount = num.unitPrice * num.discount / 10 + // num.discountAmount = num.unitPrice * num.discount / 10 num.disNoAmount = num.discountAmount num.price = num.unitPrice * num.discount / 10 * num.productCount that.relPrice = that.shouldPay @@ -1632,24 +1642,25 @@ value.unitPrice = price; if (that.discountType == 1) { //整体折扣 - value.discountAmount = value.unitPrice * 10000 * that.discountNum / 10 / 10000 + value.discountAmount = value.unitPrice * (that.discountNum / 10) value.discountAmount = value.discountAmount.toFixed(2) - value.price = value.discountAmount * value.productCount + value.price = value.discountAmount * value.productCount + value.price = value.price.toFixed(2) } else if (that.discountType == 0) { //单品折扣 - value.discountAmount = value.unitPrice * value.discount / 10 + value.discountAmount = value.unitPrice * (value.discount / 10) value.discountAmount = value.discountAmount.toFixed(2) - value.price = value.unitPrice * value.discount / 10 * value.productCount + value.price = (value.unitPrice * (value.discount / 10)) * value.productCount value.price = value.price.toFixed(2) } }) this.getAllPrice(); - if (this.relPrice == '' || this.relPrice == 0) { - that.noPay = that.shouldPay - } else if (this.relPrice != '' && this.priceOk != '') { - that.noPay = this.relPrice - this.priceOk - } + // if (this.relPrice == '' || this.relPrice == 0) { + // that.noPay = that.shouldPay + // } else if (this.relPrice != '' && this.priceOk != '') { + // that.noPay = this.relPrice - this.priceOk + // } }, AiAddSpec(value){ this.getById(value.productId || value.id); @@ -1666,10 +1677,7 @@ } that.goodsDetail = res.result; that.temporaryList = [] - - if (that.carList.size > 0) { - // let isTrue = false that.carList.forEach(function(value, key) { value.stockLogList.forEach(function(values, keys) { if(value.stockLogList1.length == 0){ @@ -1694,9 +1702,7 @@ } } } - } - - + } }) }) that.zNum = 0 @@ -1711,14 +1717,12 @@ value.stockLogList1 = [] }) }) - } that.$nextTick(() => { console.log('temporaryList', that.temporaryList) console.log('pageOldTemList', that.pageOldTemList) }) - this.tui.request("/app/productAttribute/selectAttributeAndValueByCategoryId", "POST", { categoryId: this.goodsDetail.categoryId }, false, true).then((res1) => { @@ -1731,30 +1735,12 @@ let dataArr = [] for (let val in newObj) { let valueObj = []; - // let isTrue = false for (var i = 0; i < newObj[val].length; i++) { - // for (var m = 0; m < this.oldTemList.length; m++) { - // var data = this.oldTemList[m].name.split('/') - // for (var j = 0; j < data.length; j++) { - // if (data[j] == newObj[val][i]) { - // isTrue = true - // } - // } - // } - // for (var m = 0; m < this.pageOldTemList.length; m++) { - // var data = this.pageOldTemList[m].name.split('/') - // for (var j = 0; j < data.length; j++) { - // if (data[j] == newObj[val][i]) { - // isTrue = true - // } - // } - // } valueObj.push({ value: newObj[val][i], isChecked: false }) this.dataObj.set(newObj[val][i], val) - // isTrue = false } newArr.push({ name: val, @@ -1772,26 +1758,16 @@ oldValue.push(this.goodsDetail.attributeList[i].value[m].value) } } - // if (oldCheck) { - // let specs1 = { - // specs: [] - // } - - // specs1.specs = oldValue - // this.goodsList.push(specs1) - // } else { - let specs1 = { - specs: [] - } - this.goodsList.push(specs1) - // } + let specs1 = { + specs: [] + } + this.goodsList.push(specs1) oldCheck = false oldValue = [] } } else { this.tui.toast('失败了') } - } else { this.tui.toast(res1.message) } @@ -1836,9 +1812,9 @@ }) this.price = this.shouldPay this.relPrice = this.shouldPay - if(this.priceOk != ''){ - this.priceOk = this.relPrice - } + // if(this.priceOk != ''){ + // this.priceOk = this.relPrice + // } this.$forceUpdate() this.discountNum = 10 @@ -1942,7 +1918,6 @@ this.goodsDetail.attributeList[i].value[m].isChecked = false } } - if (this.carList.size == 0) { //当前页没有数据 for (let i = 0; i < carList1.length; i++) { let obj = { @@ -2316,7 +2291,7 @@ } value.stockLogList.forEach(function(value1, key1) { if (that.countPrint() < that.printTotal) { - strCmd += blesdk.addCPCLText('0', that.yNum, '24', '0', 0, (that.slicePrint( + strCmd += blesdk.addCPCLText('0', that.yNum, '24', '0', 0, '□ '+(that.slicePrint( key1)) + '*' + value1.productCount) strCmd += blesdk.addCPCLText('280', that.yNum, '24', '0', 0, '单价:' + value .discountAmount) @@ -2329,9 +2304,8 @@ strCmd = '' strCmd = blesdk.CreatCPCLPage(600, 1040, 1, 0); strCmd += blesdk.addCPCLLocation(0); - strCmd += blesdk.addCPCLText('0', (that.yNum += 30), '24', '0', 0, (that - .slicePrint( - key1)) + '*' + value1.productCount) + strCmd += blesdk.addCPCLText('0', (that.yNum += 30), '24', '0', 0, '□ '+(that + .slicePrint(key1)) + '*' + value1.productCount) strCmd += blesdk.addCPCLText('280', that.yNum, '24', '0', 0, '单价:' + value .discountAmount) strCmd += blesdk.addCPCLText('440', that.yNum, '24', '0', 0, '总价:' + (value @@ -2371,7 +2345,7 @@ } if (that.countPrint() < this.printTotal) { strCmd += blesdk.addCPCLText('0', this.countPrint(), '24', '0', 0, '实收:' + this.priceOk) - strCmd += blesdk.addCPCLText('200', this.yNum, '24', '0', 0, '欠款:' + (this.relPrice - this.priceOk)) + strCmd += blesdk.addCPCLText('200', this.yNum, '24', '0', 0, '欠款:' + (this.relPrice - this.priceOk).toFixed(2)) strCmd += blesdk.addCPCLText('400', this.yNum, '24', '0', 0, '其他费用:' + (this.otherExpense == '' ? 0 : this.otherExpense)) } else { @@ -2382,7 +2356,7 @@ strCmd = blesdk.CreatCPCLPage(600, 1040, 1, 0); strCmd += blesdk.addCPCLLocation(0); strCmd += blesdk.addCPCLText('0', (this.yNum += 30), '24', '0', 0, '实收:' + this.priceOk) - strCmd += blesdk.addCPCLText('200', this.yNum, '24', '0', 0, '欠款:' + (this.relPrice - this.priceOk)) + strCmd += blesdk.addCPCLText('200', this.yNum, '24', '0', 0, '欠款:' + (this.relPrice - this.priceOk).toFixed(2)) strCmd += blesdk.addCPCLText('400', this.yNum, '24', '0', 0, '其他费用:' + (this.otherExpense == '' ? 0 : this.otherExpense)) @@ -2506,15 +2480,15 @@ this.temporaryChange() }, //删除整条商品 - delShop(id) { - uni.showLoading({ - title: '加载中...' - }) + delShop(id) { var that = this; uni.showModal({ title: "提示", content: "确定删除此条商品吗?", - success: function(res) { + success: function(res) { + uni.showLoading({ + title: '加载中...' + }) if (res.confirm) { if (that.carList.has(id) == true) { that.carList.delete(id) @@ -2522,19 +2496,20 @@ that.$forceUpdate() that.getAllPrice() that.getAmountAndWho() - } + } + setTimeout(res => { + uni.hideLoading(); + }, 500) } }) - setTimeout(res => { - uni.hideLoading(); - }, 500) + }, //删除商品下的某一个规格 delShopSpec(id, name) { var that = this; uni.showModal({ title: "提示", - content: "确定删除此条商品吗?", + content: "确定删除此条规格吗?", success: function(res) { if (res.confirm) { that.carList.get(id).productCount -= that.carList.get(id).stockLogList.get(name).productCount; @@ -2559,13 +2534,15 @@ this.totalAmount = 0 this.carList.forEach(function(value, key) { - that.shouldPay = Number(that.shouldPay) + Number(value.price) + that.shouldPay = Number(that.shouldPay) + Number(value.price) + that.totalAmount = that.totalAmount + value.productCount }) - + that.shouldPay = that.shouldPay.toFixed(2) this.relPrice = this.shouldPay this.$forceUpdate() - that.noPay = this.relPrice - (this.priceOk == '' ? 0 : this.priceOk) + that.noPay = this.relPrice - (this.priceOk == '' ? 0 : this.priceOk) + that.noPay = that.noPay.toFixed(2) }, //修改已选规格的数量 GoodsNumChange(e, index, index1) { @@ -2580,9 +2557,7 @@ // that.carList.get(index[0]).price = that.carList.get(index[0]).price.toFixed(2) // console.log(that.carList.get(index[0]).price) } else { - that.carList.get(index[0]).price = that.carList.get(index[0]).productCount * that.carList.get( - index[0]) - .unitPrice + that.carList.get(index[0]).price = that.carList.get(index[0]).productCount * that.carList.get(index[0]).unitPrice } }) that.getAllPrice() @@ -2617,15 +2592,15 @@ that.$forceUpdate() }, //清空全部数据 - clearAll() { - uni.showLoading({ - title: '加载中...' - }) + clearAll() { let that = this; uni.showModal({ title: "提示", content: "确定清空全部已选商品吗?", - success: function(res) { + success: function(res) { + uni.showLoading({ + title: '加载中...' + }) if (res.confirm) { console.log(that.priceCurrent) that.carList.clear() @@ -2653,13 +2628,13 @@ that.totalAmount = 0 that.saleId = '' that.priceCurrent = null - that.$forceUpdate() + that.$forceUpdate() + setTimeout(res => { + uni.hideLoading(); + }, 500) } } - }) - setTimeout(res => { - uni.hideLoading(); - }, 500) + }) } } }