From ec1385e9d6be7d3fe68392eba4bf2e814683ae72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E6=AE=BF=E6=98=95?= Date: Tue, 3 Nov 2020 15:38:28 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E7=B1=BB=E5=9E=8B=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/shop-cloud/shop-cloud.vue | 78 ++++++++++--------- .../shopping-cart/shopping-cart-com.vue | 4 +- .../user/questions-answers/community.vue | 19 +++-- 3 files changed, 53 insertions(+), 48 deletions(-) diff --git a/src/components/shop-cloud/shop-cloud.vue b/src/components/shop-cloud/shop-cloud.vue index be21b48..b3dfa88 100644 --- a/src/components/shop-cloud/shop-cloud.vue +++ b/src/components/shop-cloud/shop-cloud.vue @@ -651,11 +651,15 @@ 查看费用明细 - 账户余额:{{ userInfo.account_balance }} 金币 + 账户余额:{{ userInfo.account_balance }} 金币

@@ -964,7 +968,9 @@

- 账户余额:{{ userInfo.account_balance }} 金币 + 账户余额:{{ userInfo.account_balance }} 金币

@@ -1053,27 +1059,27 @@ export default { a_deductions = this.deductions; if (this.formNew.cpu == "8") { if (this.formNew.memory == "16") { - let priceObj = this.cpu_memory.find(item => { + let priceObj = this.cpu_memory.find((item) => { return item.cpu == 8 && item.memory == 16; - }) - sumCM += priceObj.price; + }); + sumCM += Number(priceObj.price); } else if (this.formNew.memory == "32") { - let priceObj = this.cpu_memory.find(item => { + let priceObj = this.cpu_memory.find((item) => { return item.cpu == 8 && item.memory == 32; - }) - sumCM += priceObj.price; + }); + sumCM += Number(priceObj.price); } } else if (this.formNew.cpu == "16") { if (this.formNew.memory == "32") { - let priceObj = this.cpu_memory.find(item => { + let priceObj = this.cpu_memory.find((item) => { return item.cpu == 16 && item.memory == 32; - }) - sumCM += priceObj.price; + }); + sumCM += Number(priceObj.price); } else if (this.formNew.memory == "64") { - let priceObj = this.cpu_memory.find(item => { + let priceObj = this.cpu_memory.find((item) => { return item.cpu == 16 && item.memory == 64; - }) - sumCM += priceObj.price; + }); + sumCM += Number(priceObj.price); } } if ( @@ -1082,10 +1088,10 @@ export default { this.formNew.appDuration >= 1 ) { sumDisk += - this.formNew.dataDisk * - this.formNew.perDataDisk * - this.formNew.appDuration * - this.hard_disk[0].price; + Number(this.formNew.dataDisk) * + Number(this.formNew.perDataDisk) * + Number(this.formNew.appDuration) * + Number(this.hard_disk[0].price); this.jifeiList1[2] = { name: "数据盘", num: `${this.formNew.dataDisk}个数据盘,每个数据盘${this.formNew.perDataDisk}GB`, @@ -1112,27 +1118,27 @@ export default { a_deductions = this.deductions; if (this.formOld.cpu == "8") { if (this.formOld.memory == "16") { - let priceObj = this.cpu_memory.find(item => { + let priceObj = this.cpu_memory.find((item) => { return item.cpu == 8 && item.memory == 16; - }) - sumCM += priceObj.price; + }); + sumCM += Number(priceObj.price); } else if (this.formOld.memory == "32") { - let priceObj = this.cpu_memory.find(item => { + let priceObj = this.cpu_memory.find((item) => { return item.cpu == 8 && item.memory == 32; - }) - sumCM += priceObj.price; + }); + sumCM += Number(priceObj.price); } } else if (this.formOld.cpu == "16") { if (this.formOld.memory == "32") { - let priceObj = this.cpu_memory.find(item => { + let priceObj = this.cpu_memory.find((item) => { return item.cpu == 16 && item.memory == 32; - }) - sumCM += priceObj.price; + }); + sumCM += Number(priceObj.price); } else if (this.formOld.memory == "64") { - let priceObj = this.cpu_memory.find(item => { + let priceObj = this.cpu_memory.find((item) => { return item.cpu == 16 && item.memory == 64; - }) - sumCM += priceObj.price; + }); + sumCM += Number(priceObj.price); } } if ( @@ -1141,10 +1147,10 @@ export default { this.formOld.appDuration >= 1 ) { sumDisk += - this.formOld.dataDisk * - this.formOld.perDataDisk * - this.formOld.appDuration * - this.hard_disk[0].price; + Number(this.formOld.dataDisk) * + Number(this.formOld.perDataDisk) * + Number(this.formOld.appDuration) * + Number(this.hard_disk[0].price); this.jifeiList1[2] = { name: "数据盘", num: `${this.formOld.dataDisk}个数据盘,每个数据盘${this.formOld.perDataDisk}GB`, @@ -1168,7 +1174,7 @@ export default { this.formOld.appDuration >= 1 ? this.formOld.appDuration : 0 }个月`; } - this.amounts_payable = (sumCM + sumDisk).toFixed(2); + this.amounts_payable = Number((Number(sumCM) + Number(sumDisk)).toFixed(2)); // this.total_money = sumCM + sumDisk - a_deductions; return this.amounts_payable; }, diff --git a/src/components/shopping-cart/shopping-cart-com.vue b/src/components/shopping-cart/shopping-cart-com.vue index 7289292..2d3148c 100644 --- a/src/components/shopping-cart/shopping-cart-com.vue +++ b/src/components/shopping-cart/shopping-cart-com.vue @@ -132,9 +132,9 @@ export default { this.checkList.forEach((item, index) => { if (item) { if (this.list[index].service_id != 0) { - sum += (this.list[index].service.spcs_info.money * this.list[index].duration).toFixed(2); + sum += Number((this.list[index].service.spcs_info.money * this.list[index].duration).toFixed(2)); } else { - sum += (this.list[index].application.price * this.list[index].duration).toFixed(2); + sum += Number((this.list[index].application.price * this.list[index].duration).toFixed(2)); } } }); diff --git a/src/pages/user/questions-answers/community.vue b/src/pages/user/questions-answers/community.vue index c7619b1..d17b53b 100644 --- a/src/pages/user/questions-answers/community.vue +++ b/src/pages/user/questions-answers/community.vue @@ -202,16 +202,15 @@ export default { }, submitDel() { this.$refs.form1.validate((valid) => { - console.log(valid) - // if (valid) { - // this.diaDel = false; - // if (this.now_state == "/qa/questions") { - // this.delQ(); - // } else if (this.now_state == "/qa/answers") { - // this.delA(); - // } - // } else { - // } + if (valid) { + this.diaDel = false; + if (this.now_state == "/qa/questions") { + this.delQ(); + } else if (this.now_state == "/qa/answers") { + this.delA(); + } + } else { + } }); }, del_q(val) { -- 2.26.0