From dd7b2cff382af217d55093a0a4c7af4f1a16efb6 Mon Sep 17 00:00:00 2001 From: java110 <928255095@qq.com> Date: Fri, 6 Nov 2020 19:10:12 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/goodsConfirm/goodsConfirm.vue | 34 ++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/pages/goodsConfirm/goodsConfirm.vue b/pages/goodsConfirm/goodsConfirm.vue index 7734a7c..5b51357 100644 --- a/pages/goodsConfirm/goodsConfirm.vue +++ b/pages/goodsConfirm/goodsConfirm.vue @@ -25,7 +25,7 @@ - + @@ -76,7 +76,7 @@ - 共1件 + 共{{goodsCount}}件 合计: ¥{{ totalFee || '0.00' }} @@ -137,7 +137,8 @@ checkTimeId: 'c1', //锚点用 checkDayCur: 0, //默认日期 personId: '', - totalFee:0.0 + totalFee:0.0, + goodsCount:0 }; }, @@ -162,6 +163,10 @@ coverPhoto: decodeURIComponent(options.coverPhoto), storeId: options.storeId }); + + _that.totalFee = parseFloat(options.goodsNum) * parseFloat(options.price); + _that.totalFee = _that.totalFee.toFixed(2) + _that.goodsCount = 1; } await this.getOwner(); @@ -215,7 +220,12 @@ coverPhoto: item.coverPhoto, storeId: item.storeId }); + + that.totalFee = parseFloat(that.totalFee)+(parseFloat(item.cartNum) * parseFloat(item.price)); + that.goodsCount +=1; }) + + that.totalFee = that.totalFee.toFixed(2) } }); }, @@ -292,6 +302,24 @@ if (type == 'day') { this.checkDayCur = index; } + }, + onSel:function(index,gCheck){ + let that = this; + that.perGoodsList[index].checked = that.perGoodsList[index].checked?false:true; + + let totalFee = 0.0; + let goodsCount =0; + that.perGoodsList.forEach(item=>{ + if(item.checked == true){ + totalFee = parseFloat(totalFee)+(parseFloat(item.goodsNum) * parseFloat(item.price)); + goodsCount +=1; + } + }) + that.totalFee = totalFee.toFixed(2); + + that.goodsCount = goodsCount; + + console.log(that.totalFee,that.goodsCount) } } };