"src/components/service-box.vue" did not exist on "fd4c3d70916a6ca982110015aee16d7aea842aac"
Commit 86931e8d authored by 刘殿昕's avatar 刘殿昕

优化算钱

parent a77eb65b
...@@ -1072,11 +1072,12 @@ export default { ...@@ -1072,11 +1072,12 @@ export default {
) { ) {
if (this.hard_disk && this.hard_disk.length != 0) { if (this.hard_disk && this.hard_disk.length != 0) {
this.disk_single_money = Number(this.hard_disk[0].price); this.disk_single_money = Number(this.hard_disk[0].price);
sumDisk += sumDisk += (
Number(this.formNew.dataDisk) * Number(this.formNew.dataDisk) *
Number(this.formNew.perDataDisk) * Number(this.formNew.perDataDisk) *
Number(this.formNew.appDuration) * Number(this.formNew.appDuration) *
Number(this.hard_disk[0].price); Number(this.hard_disk[0].price)
).toFixed(2);
} }
arrJifei[2] = { arrJifei[2] = {
name: "数据盘", name: "数据盘",
...@@ -1156,24 +1157,29 @@ export default { ...@@ -1156,24 +1157,29 @@ export default {
: "" : ""
}`; }`;
} else if ( } else if (
this.formOld.cpu != "" && (this.formOld.cpu != "" &&
this.formOld.memory != "" && this.formOld.memory != "" &&
(this.formOld.cpu < this.paramsOld.cpu || (this.formOld.cpu < this.paramsOld.cpu ||
this.formOld.memory < this.paramsOld.memory) this.formOld.memory < this.paramsOld.memory)) ||
this.formOld.cpu < this.paramsOld.cpu ||
this.formOld.memory < this.paramsOld.memory
) { ) {
console.log("-CM"); console.log("-CM");
// 减配置 // 减配置
if (this.formOld.appDuration != 0) { if (this.formOld.appDuration != 0) {
// 续期 // 续期
let cpu0 = this.formOld.cpu; let cpu0 = this.formOld.cpu || this.paramsOld.cpu;
let memory0 = this.formOld.memory; let memory0 = this.formOld.memory || this.paramsOld.memory;
let priceObj = this.cpu_memory.find((item) => { let priceObj = this.cpu_memory.find((item) => {
return item.cpu == cpu0 && item.memory == memory0; return item.cpu == cpu0 && item.memory == memory0;
}); });
console.log(priceObj)
this.eci_single_money = Number(priceObj.price); this.eci_single_money = Number(priceObj.price);
sumCM += Number(priceObj.price); sumCM += Number(priceObj.price);
sumCM = sumCM = (
(sumCM * (Number(this.formOld.appDuration) * 30 + diffDay)) / 30; (sumCM * (Number(this.formOld.appDuration) * 30 + diffDay)) /
30
).toFixed(2);
arrJifei[0].num = `${ arrJifei[0].num = `${
this.formOld.cpu && this.formOld.cpu > 0 this.formOld.cpu && this.formOld.cpu > 0
? this.formOld.cpu ? this.formOld.cpu
...@@ -1186,7 +1192,7 @@ export default { ...@@ -1186,7 +1192,7 @@ export default {
arrJifei[0].time = `${ arrJifei[0].time = `${
this.formOld.appDuration >= 1 this.formOld.appDuration >= 1
? this.formOld.appDuration + "个月续期+剩余" ? this.formOld.appDuration + "个月续期+剩余"
: "" : "剩余"
}${diffDay}天`; }${diffDay}天`;
arrJifei[0].sum = `${sumCM}金币`; arrJifei[0].sum = `${sumCM}金币`;
arrJifei[1].num = `${ arrJifei[1].num = `${
...@@ -1197,11 +1203,36 @@ export default { ...@@ -1197,11 +1203,36 @@ export default {
arrJifei[1].time = `${ arrJifei[1].time = `${
this.formOld.appDuration >= 1 this.formOld.appDuration >= 1
? this.formOld.appDuration + "个月续期+剩余" ? this.formOld.appDuration + "个月续期+剩余"
: "" : "剩余"
}${diffDay}天`; }${diffDay}天`;
} else { } else {
// 不续期 // 不续期
sumCM = 0; 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 { } else {
// 加配置 // 加配置
...@@ -1230,7 +1261,7 @@ export default { ...@@ -1230,7 +1261,7 @@ export default {
arrJifei[0].time = `${ arrJifei[0].time = `${
this.formOld.appDuration >= 1 this.formOld.appDuration >= 1
? this.formOld.appDuration + "个月续期+剩余" ? this.formOld.appDuration + "个月续期+剩余"
: "" : "剩余"
}${diffDay}天`; }${diffDay}天`;
arrJifei[0].sum = `${sumCM}金币`; arrJifei[0].sum = `${sumCM}金币`;
arrJifei[1].num = `${ arrJifei[1].num = `${
...@@ -1241,7 +1272,7 @@ export default { ...@@ -1241,7 +1272,7 @@ export default {
arrJifei[1].time = `${ arrJifei[1].time = `${
this.formOld.appDuration >= 1 this.formOld.appDuration >= 1
? this.formOld.appDuration + "个月续期+剩余" ? this.formOld.appDuration + "个月续期+剩余"
: "" : "剩余"
}${diffDay}天`; }${diffDay}天`;
} }
let nowHasCap = this.dataDiskList.reduce( let nowHasCap = this.dataDiskList.reduce(
...@@ -1249,10 +1280,11 @@ export default { ...@@ -1249,10 +1280,11 @@ export default {
0 0
); );
if ( if (
this.formOld.dataDisk >= 0 && this.formOld.dataDisk > 0 &&
this.formOld.perDataDisk >= 0 && this.formOld.perDataDisk > 0 &&
this.formOld.appDuration >= 0 this.formOld.appDuration > 0
) { ) {
console.log("j,xqd");
// 加D,续期 // 加D,续期
if (this.hard_disk && this.hard_disk.length != 0) { if (this.hard_disk && this.hard_disk.length != 0) {
this.disk_single_money = Number(this.hard_disk[0].price); this.disk_single_money = Number(this.hard_disk[0].price);
...@@ -1277,21 +1309,25 @@ export default { ...@@ -1277,21 +1309,25 @@ export default {
time: `${ time: `${
this.formOld.appDuration >= 1 this.formOld.appDuration >= 1
? this.formOld.appDuration + "个月续期+剩余" ? this.formOld.appDuration + "个月续期+剩余"
: "" : "剩余"
}${diffDay}天`, }${diffDay}天`,
sum: `${sumDisk}金币`, sum: `${sumDisk}金币`,
}; };
} else { } else {
console.log("bjd");
// 不加D,续期 // 不加D,续期
if (this.formOld.appDuration != 0) { 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) { if (this.hard_disk && this.hard_disk.length != 0) {
this.disk_single_money = Number(this.hard_disk[0].price); this.disk_single_money = Number(this.hard_disk[0].price);
sumDisk += Number( sumDisk += Number(
( (
nowHasCap * (nowHasCap *
Number(this.formOld.appDuration) * Number(Number(this.formOld.appDuration) * 30 + diffDay) *
Number(this.hard_disk[0].price) Number(this.hard_disk[0].price)) /
30
).toFixed(2) ).toFixed(2)
); );
} }
...@@ -1301,11 +1337,12 @@ export default { ...@@ -1301,11 +1337,12 @@ export default {
time: `${ time: `${
this.formOld.appDuration >= 1 this.formOld.appDuration >= 1
? this.formOld.appDuration + "个月续期+剩余" ? this.formOld.appDuration + "个月续期+剩余"
: "" : "剩余"
}${diffDay}天`, }${diffDay}天`,
sum: `${sumDisk}金币`, sum: `${sumDisk}金币`,
}; };
} else { } else {
console.log("bj,xq,bscd");
// not Del // not Del
if (this.hard_disk && this.hard_disk.length != 0) { if (this.hard_disk && this.hard_disk.length != 0) {
this.disk_single_money = Number(this.hard_disk[0].price); this.disk_single_money = Number(this.hard_disk[0].price);
...@@ -1330,8 +1367,28 @@ export default { ...@@ -1330,8 +1367,28 @@ export default {
} }
} else { } else {
// 不加D,不续期 // 不加D,不续期
sumDisk = 0; if (this.delDataDiskList.length != 0) {
arrJifei.splice(2); 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 ( if (
...@@ -1894,7 +1951,8 @@ export default { ...@@ -1894,7 +1951,8 @@ export default {
this.formOld.perRAMs != this.paramsOld.one_memory_max) || this.formOld.perRAMs != this.paramsOld.one_memory_max) ||
(this.formOld.perRAM && (this.formOld.perRAM &&
this.formOld.perRAM != 0 && 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)); formParams = JSON.parse(JSON.stringify(this.formOld));
console.log(formParams); console.log(formParams);
...@@ -2146,11 +2204,15 @@ export default { ...@@ -2146,11 +2204,15 @@ export default {
{ value: "32", label: "32" }, { value: "32", label: "32" },
{ value: "64", label: "64" }, { value: "64", label: "64" },
]; ];
this.formOld.memory = 32;
this.formNew.memory = 32;
} else { } else {
this.optionsRAM = [ this.optionsRAM = [
{ value: "16", label: "16" }, { value: "16", label: "16" },
{ value: "32", label: "32" }, { value: "32", label: "32" },
]; ];
this.formOld.memory = 16;
this.formNew.memory = 16;
} }
}, },
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment