diff --git a/src/components/shop-cloud/shop-cloud-new.vue b/src/components/shop-cloud/shop-cloud-new.vue index 4c8e5f689488489482eda57c593dd77eb6610e7a..1faef3ccd7d08b63a7db5f02019f2133d2f5e314 100644 --- a/src/components/shop-cloud/shop-cloud-new.vue +++ b/src/components/shop-cloud/shop-cloud-new.vue @@ -1072,11 +1072,12 @@ export default { ) { if (this.hard_disk && this.hard_disk.length != 0) { this.disk_single_money = Number(this.hard_disk[0].price); - sumDisk += + sumDisk += ( Number(this.formNew.dataDisk) * Number(this.formNew.perDataDisk) * Number(this.formNew.appDuration) * - Number(this.hard_disk[0].price); + Number(this.hard_disk[0].price) + ).toFixed(2); } arrJifei[2] = { name: "数据盘", @@ -1156,24 +1157,29 @@ export default { : "" }`; } else if ( - this.formOld.cpu != "" && - this.formOld.memory != "" && - (this.formOld.cpu < this.paramsOld.cpu || - this.formOld.memory < this.paramsOld.memory) + (this.formOld.cpu != "" && + this.formOld.memory != "" && + (this.formOld.cpu < this.paramsOld.cpu || + this.formOld.memory < this.paramsOld.memory)) || + this.formOld.cpu < this.paramsOld.cpu || + this.formOld.memory < this.paramsOld.memory ) { console.log("-CM"); // 减配置 if (this.formOld.appDuration != 0) { // 续期 - let cpu0 = this.formOld.cpu; - let memory0 = this.formOld.memory; + let cpu0 = this.formOld.cpu || this.paramsOld.cpu; + let memory0 = this.formOld.memory || this.paramsOld.memory; let priceObj = this.cpu_memory.find((item) => { return item.cpu == cpu0 && item.memory == memory0; }); + console.log(priceObj) this.eci_single_money = Number(priceObj.price); sumCM += Number(priceObj.price); - sumCM = - (sumCM * (Number(this.formOld.appDuration) * 30 + diffDay)) / 30; + sumCM = ( + (sumCM * (Number(this.formOld.appDuration) * 30 + diffDay)) / + 30 + ).toFixed(2); arrJifei[0].num = `${ this.formOld.cpu && this.formOld.cpu > 0 ? this.formOld.cpu @@ -1186,7 +1192,7 @@ export default { arrJifei[0].time = `${ this.formOld.appDuration >= 1 ? this.formOld.appDuration + "个月续期+剩余" - : "" + : "剩余" }${diffDay}天`; arrJifei[0].sum = `${sumCM}金币`; arrJifei[1].num = `${ @@ -1197,11 +1203,36 @@ export default { arrJifei[1].time = `${ this.formOld.appDuration >= 1 ? this.formOld.appDuration + "个月续期+剩余" - : "" + : "剩余" }${diffDay}天`; } else { // 不续期 sumCM = 0; + arrJifei[0].num = `${ + this.formOld.cpu && this.formOld.cpu > 0 + ? this.formOld.cpu + : this.paramsOld.cpu + }核+${ + this.formOld.memory && this.formOld.memory > 0 + ? this.formOld.memory + : this.paramsOld.memory + }G`; + arrJifei[0].time = `${ + this.formOld.appDuration >= 1 + ? this.formOld.appDuration + "个月续期+剩余" + : "剩余" + }${diffDay}天`; + arrJifei[0].sum = `${sumCM}金币`; + arrJifei[1].num = `${ + this.formOld.containerGroup && this.formOld.containerGroup > 0 + ? this.formOld.containerGroup + : this.paramsOld.containers + }个`; + arrJifei[1].time = `${ + this.formOld.appDuration >= 1 + ? this.formOld.appDuration + "个月续期+剩余" + : "剩余" + }${diffDay}天`; } } else { // 加配置 @@ -1230,7 +1261,7 @@ export default { arrJifei[0].time = `${ this.formOld.appDuration >= 1 ? this.formOld.appDuration + "个月续期+剩余" - : "" + : "剩余" }${diffDay}天`; arrJifei[0].sum = `${sumCM}金币`; arrJifei[1].num = `${ @@ -1241,7 +1272,7 @@ export default { arrJifei[1].time = `${ this.formOld.appDuration >= 1 ? this.formOld.appDuration + "个月续期+剩余" - : "" + : "剩余" }${diffDay}天`; } let nowHasCap = this.dataDiskList.reduce( @@ -1249,10 +1280,11 @@ export default { 0 ); if ( - this.formOld.dataDisk >= 0 && - this.formOld.perDataDisk >= 0 && - this.formOld.appDuration >= 0 + this.formOld.dataDisk > 0 && + this.formOld.perDataDisk > 0 && + this.formOld.appDuration > 0 ) { + console.log("j,xqd"); // 加D,续期 if (this.hard_disk && this.hard_disk.length != 0) { this.disk_single_money = Number(this.hard_disk[0].price); @@ -1277,21 +1309,25 @@ export default { time: `${ this.formOld.appDuration >= 1 ? this.formOld.appDuration + "个月续期+剩余" - : "" + : "剩余" }${diffDay}天`, sum: `${sumDisk}金币`, }; } else { + console.log("bjd"); // 不加D,续期 if (this.formOld.appDuration != 0) { - if (delCap != 0) { + console.log("bj,xqd"); + if (this.delDataDiskList.length != 0) { + console.log("bj,xq,scd"); if (this.hard_disk && this.hard_disk.length != 0) { this.disk_single_money = Number(this.hard_disk[0].price); sumDisk += Number( ( - nowHasCap * - Number(this.formOld.appDuration) * - Number(this.hard_disk[0].price) + (nowHasCap * + Number(Number(this.formOld.appDuration) * 30 + diffDay) * + Number(this.hard_disk[0].price)) / + 30 ).toFixed(2) ); } @@ -1301,11 +1337,12 @@ export default { time: `${ this.formOld.appDuration >= 1 ? this.formOld.appDuration + "个月续期+剩余" - : "" + : "剩余" }${diffDay}天`, sum: `${sumDisk}金币`, }; } else { + console.log("bj,xq,bscd"); // not Del if (this.hard_disk && this.hard_disk.length != 0) { this.disk_single_money = Number(this.hard_disk[0].price); @@ -1330,8 +1367,28 @@ export default { } } else { // 不加D,不续期 - sumDisk = 0; - arrJifei.splice(2); + if (this.delDataDiskList.length != 0) { + console.log("bj,bxq,scd"); + if (this.hard_disk && this.hard_disk.length != 0) { + this.disk_single_money = Number(this.hard_disk[0].price); + sumDisk += Number( + ( + (nowHasCap * diffDay * Number(this.hard_disk[0].price)) / + 30 + ).toFixed(2) + ); + } + arrJifei[2] = { + name: "数据盘", + num: `原有数据盘共计剩余${nowHasCap}GB`, + time: `剩余${diffDay}天`, + sum: `${sumDisk}金币`, + }; + } else { + console.log("bj,bxq,bscd"); + sumDisk = 0; + arrJifei.splice(2); + } } } if ( @@ -1894,7 +1951,8 @@ export default { this.formOld.perRAMs != this.paramsOld.one_memory_max) || (this.formOld.perRAM && this.formOld.perRAM != 0 && - this.formOld.perRAM != this.paramsOld.one_memory_min) + this.formOld.perRAM != this.paramsOld.one_memory_min) || + this.delDataDiskList.length != 0 ) { formParams = JSON.parse(JSON.stringify(this.formOld)); console.log(formParams); @@ -2146,11 +2204,15 @@ export default { { value: "32", label: "32" }, { value: "64", label: "64" }, ]; + this.formOld.memory = 32; + this.formNew.memory = 32; } else { this.optionsRAM = [ { value: "16", label: "16" }, { value: "32", label: "32" }, ]; + this.formOld.memory = 16; + this.formNew.memory = 16; } }, },