diff --git a/src/components/shop-cloud/shop-cloud.vue b/src/components/shop-cloud/shop-cloud.vue index 2cb6c83df710a010a81fb0e5d4994d8e3ac25a66..be21b48159925afcd5cad5df861f191f04d102a6 100644 --- a/src/components/shop-cloud/shop-cloud.vue +++ b/src/components/shop-cloud/shop-cloud.vue @@ -1053,15 +1053,27 @@ export default { a_deductions = this.deductions; if (this.formNew.cpu == "8") { if (this.formNew.memory == "16") { - sumCM += 10880; + let priceObj = this.cpu_memory.find(item => { + return item.cpu == 8 && item.memory == 16; + }) + sumCM += priceObj.price; } else if (this.formNew.memory == "32") { - sumCM += 16310; + let priceObj = this.cpu_memory.find(item => { + return item.cpu == 8 && item.memory == 32; + }) + sumCM += priceObj.price; } } else if (this.formNew.cpu == "16") { if (this.formNew.memory == "32") { - sumCM += 21750; + let priceObj = this.cpu_memory.find(item => { + return item.cpu == 16 && item.memory == 32; + }) + sumCM += priceObj.price; } else if (this.formNew.memory == "64") { - sumCM += 32610; + let priceObj = this.cpu_memory.find(item => { + return item.cpu == 16 && item.memory == 64; + }) + sumCM += priceObj.price; } } if ( @@ -1073,7 +1085,7 @@ export default { this.formNew.dataDisk * this.formNew.perDataDisk * this.formNew.appDuration * - 4.2; + this.hard_disk[0].price; this.jifeiList1[2] = { name: "数据盘", num: `${this.formNew.dataDisk}个数据盘,每个数据盘${this.formNew.perDataDisk}GB`, @@ -1100,15 +1112,27 @@ export default { a_deductions = this.deductions; if (this.formOld.cpu == "8") { if (this.formOld.memory == "16") { - sumCM += 10880; + let priceObj = this.cpu_memory.find(item => { + return item.cpu == 8 && item.memory == 16; + }) + sumCM += priceObj.price; } else if (this.formOld.memory == "32") { - sumCM += 16310; + let priceObj = this.cpu_memory.find(item => { + return item.cpu == 8 && item.memory == 32; + }) + sumCM += priceObj.price; } } else if (this.formOld.cpu == "16") { if (this.formOld.memory == "32") { - sumCM += 21750; + let priceObj = this.cpu_memory.find(item => { + return item.cpu == 16 && item.memory == 32; + }) + sumCM += priceObj.price; } else if (this.formOld.memory == "64") { - sumCM += 32610; + let priceObj = this.cpu_memory.find(item => { + return item.cpu == 16 && item.memory == 64; + }) + sumCM += priceObj.price; } } if ( @@ -1120,7 +1144,7 @@ export default { this.formOld.dataDisk * this.formOld.perDataDisk * this.formOld.appDuration * - 4.2; + this.hard_disk[0].price; this.jifeiList1[2] = { name: "数据盘", num: `${this.formOld.dataDisk}个数据盘,每个数据盘${this.formOld.perDataDisk}GB`, @@ -1144,7 +1168,7 @@ export default { this.formOld.appDuration >= 1 ? this.formOld.appDuration : 0 }个月`; } - this.amounts_payable = sumCM + sumDisk; + this.amounts_payable = (sumCM + sumDisk).toFixed(2); // this.total_money = sumCM + sumDisk - a_deductions; return this.amounts_payable; }, @@ -1444,11 +1468,14 @@ export default { sum: "金币", }, ], + cpu_memory: [], + hard_disk: [], }; }, mounted() { this.getUser(); this.getNameSpaceList(); + this.getSpecifications(); }, methods: { getQueryId() { @@ -1505,8 +1532,8 @@ export default { getSpecifications() { this.$api.serviceShop.getSpecifications().then((response) => { if (response.data.success == 1) { - this.amounts_payable = 1000; - this.amounts_payable = 1000; + this.cpu_memory = response.data.data.cpu_memory; + this.hard_disk = response.data.data.hard_disk; } else { this.$message({ message: "获取资源规格失败,请刷新网页", @@ -1648,16 +1675,16 @@ export default { }, disks: [ { - disk_num: this.formNew.dataDisk, - disk_cap: this.formNew.perDataDisk, - store_type: this.formNew.store_type, + disk_num: this.formNew.dataDisk + "", + disk_cap: this.formNew.perDataDisk + "", + store_type: this.formNew.store_type + "", }, ], payment: { - total_money: this.total_money, + // total_money: this.total_money, disk_single_money: this.disk_single_money, eci_single_money: this.eci_single_money, - amounts_payable: this.amounts_payable, + total_money: this.amounts_payable, }, }; this.$api.serviceShop.applicationCloud(query).then((response) => { diff --git a/src/pages/user/order/order_detail.vue b/src/pages/user/order/order_detail.vue index fbacf654d4a96f536523622a626e4895c8156425..f74c14bea41d2758de1876548401fb91df022a24 100644 --- a/src/pages/user/order/order_detail.vue +++ b/src/pages/user/order/order_detail.vue @@ -323,7 +323,7 @@ {{ orderDetail.total_money }}金币 - { urls.push({ - name: item.one_input, + req_name: item.one_input, response_type: "JSON", req_auth_mthod: 0, req_auth_token: item.tokenVal, diff --git a/src/request/api/service-shop.js b/src/request/api/service-shop.js index 946e3ab0e79b098b958687a61fac60e06dfa2481..439ed0980937a54dd870e8f8dcaf31941c4e4dc5 100644 --- a/src/request/api/service-shop.js +++ b/src/request/api/service-shop.js @@ -47,7 +47,7 @@ businessArea=${params.businessArea}&developable=${params.developable}&orgSource= return axios.get(`/apaas/service/v3/resource/apply/checkNs?namespace=${params.id}`) }, getSpecifications() { - return axios.get(``) + return axios.get(`/apaas/serviceapp/v3/resource/price`) }, // shopping cart