Commit d04806d3 authored by 赵伟庚's avatar 赵伟庚

fix

parent 40a66d30
......@@ -6,7 +6,7 @@
<el-col :span="5">规格</el-col>
<el-col :span="5">申请使用期限</el-col>
<!-- <el-col :span="3">总价</el-col> -->
<el-col :span="5">申请状态</el-col>
<el-col :span="5">订单状态</el-col>
<el-col :span="3">操作</el-col>
</el-row>
</div>
......
......@@ -612,10 +612,7 @@
<block-radius :borRadius="8" v-if="!(activeName == 1 && !formShow)">
<div class="btn_footer fyzj_item">
<el-button
:class="
getSumCoin <= user_info.account_balance ? 'submit' : 'nosubmit'
"
:disabled="getSumCoin > user_info.account_balance"
class="submit"
@click="submitApp"
>
提交申请
......@@ -986,394 +983,7 @@ export default {
props: {
name: { type: String, default: "" },
},
computed: {
getSumCoin() {
let sumCM = 0;
let sumDisk = 0;
let a_deductions = 0;
let arrJifei = JSON.parse(JSON.stringify(this.jifeiList));
if (this.activeName == "0") {
a_deductions = this.deductions;
if (this.cpu_memory && this.cpu_memory.length != 0) {
if (this.formNew.cpu == "8") {
if (this.formNew.memory == "16") {
let priceObj = this.cpu_memory.find((item) => {
return item.cpu == 8 && item.memory == 16;
});
this.eci_single_money = Number(priceObj.price);
sumCM += Number(priceObj.price);
} else if (this.formNew.memory == "32") {
let priceObj = this.cpu_memory.find((item) => {
return item.cpu == 8 && item.memory == 32;
});
this.eci_single_money = Number(priceObj.price);
sumCM += Number(priceObj.price);
}
} else if (this.formNew.cpu == "16") {
if (this.formNew.memory == "32") {
let priceObj = this.cpu_memory.find((item) => {
return item.cpu == 16 && item.memory == 32;
});
this.eci_single_money = Number(priceObj.price);
sumCM += Number(priceObj.price);
} else if (this.formNew.memory == "64") {
let priceObj = this.cpu_memory.find((item) => {
return item.cpu == 16 && item.memory == 64;
});
this.eci_single_money = Number(priceObj.price);
sumCM += Number(priceObj.price);
}
}
}
sumCM = sumCM * Number(this.formNew.appDuration);
if (
this.formNew.dataDisk >= 0 &&
this.formNew.perDataDisk >= 0 &&
this.formNew.appDuration >= 0
) {
if (this.hard_disk && this.hard_disk.length != 0) {
this.disk_single_money = Number(this.hard_disk[0].price);
sumDisk += (
Number(this.formNew.dataDisk) *
Number(this.formNew.perDataDisk) *
Number(this.formNew.appDuration) *
Number(this.hard_disk[0].price)
).toFixed(2);
}
arrJifei[2] = {
name: "数据盘",
num: `${this.formNew.dataDisk}个数据盘,每个数据盘${this.formNew.perDataDisk}GB`,
time: `${this.formNew.appDuration}个月`,
sum: `${sumDisk}金币`,
};
} else {
arrJifei.splice(2);
}
arrJifei[0].num = `${this.formNew.cpu >= 1 ? this.formNew.cpu : 0}核+${
this.formNew.memory >= 1 ? this.formNew.memory : 0
}G`;
arrJifei[0].time = `${
this.formNew.appDuration >= 1 ? this.formNew.appDuration : 0
}个月`;
arrJifei[0].sum = `${sumCM}金币`;
arrJifei[1].num = `${
this.formNew.containerGroup >= 1 ? this.formNew.containerGroup : 0
}个`;
arrJifei[1].time = `${
this.formNew.appDuration >= 1 ? this.formNew.appDuration : 0
}个月`;
} else if (this.activeName == "1") {
let nochangeCM = false,
nochangeRQ = false;
let diffDay = helper.getTwoTimesDiff(this.paramsOld.cloud_end_time);
a_deductions = this.deductions;
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.paramsOld.memory) ||
(this.formOld.cpu == this.paramsOld.cpu && this.formOld.memory == "")
) {
console.log("noCMchange");
// 没变
nochangeCM = true;
if (this.formOld.appDuration != 0) {
// 续期
let cpu0 = this.paramsOld.cpu;
let memory0 = this.paramsOld.memory;
let priceObj = this.cpu_memory.find((item) => {
return item.cpu == cpu0 && item.memory == memory0;
});
this.eci_single_money = Number(priceObj.price);
sumCM += Number(priceObj.price);
sumCM = sumCM * this.formOld.appDuration;
} 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 + "个月"
: ""
}`;
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 + "个月"
: ""
}`;
} else if (
(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 || 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
).toFixed(2);
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 {
// 不续期
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 {
// 加配置
console.log("+CM");
if (this.cpu_memory && this.cpu_memory.length != 0) {
console.log(this.formOld.cpu, 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;
});
this.eci_single_money = Number(priceObj.price);
sumCM += Number(priceObj.price);
}
sumCM =
(sumCM * (Number(this.formOld.appDuration) * 30 + diffDay)) / 30;
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}天`;
}
let nowHasCap = this.dataDiskList.reduce(
(sum, e) => sum + e.disk_cap,
0
);
if (
this.formOld.dataDisk > 0 &&
this.formOld.perDataDisk > 0
) {
console.log("jd");
// 加D
if (this.hard_disk && this.hard_disk.length != 0) {
this.disk_single_money = Number(this.hard_disk[0].price);
sumDisk += Number(
(
((Number(this.formOld.dataDisk) *
Number(this.formOld.perDataDisk) +
nowHasCap) *
Number(Number(this.formOld.appDuration) * 30 + diffDay) *
Number(this.hard_disk[0].price)) /
30
).toFixed(2)
);
}
arrJifei[2] = {
name: "数据盘",
num: `增加${this.formOld.dataDisk}个数据盘,每个数据盘${
this.formOld.perDataDisk
}GB${
nowHasCap == 0 ? "" : ",原有数据盘共计剩余" + nowHasCap + "GB"
}`,
time: `${
this.formOld.appDuration >= 1
? this.formOld.appDuration + "个月续期+剩余"
: "剩余"
}${diffDay}天`,
sum: `${sumDisk}金币`,
};
} else {
console.log("bjd");
// 不加D,续期
if (this.formOld.appDuration != 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(Number(this.formOld.appDuration) * 30 + diffDay) *
Number(this.hard_disk[0].price)) /
30
).toFixed(2)
);
}
arrJifei[2] = {
name: "数据盘",
num: `原有数据盘共计剩余${nowHasCap}GB`,
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);
sumDisk += Number(
(
nowHasCap *
Number(this.formOld.appDuration) *
Number(this.hard_disk[0].price)
).toFixed(2)
);
}
arrJifei[2] = {
name: "数据盘",
num: `原有数据盘共计${nowHasCap}GB`,
time: `${
this.formOld.appDuration >= 1
? this.formOld.appDuration + "个月"
: ""
}`,
sum: `${sumDisk}金币`,
};
}
} else {
// 不加D,不续期
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 (
!this.formOld.containerGroup ||
this.formOld.containerGroup == "" ||
this.formOld.containerGroup == this.paramsOld.containers
) {
nochangeRQ = true;
}
if (nochangeRQ && this.formOld.appDuration == 0) {
arrJifei.splice(1, 1);
}
if (nochangeCM && this.formOld.appDuration == 0) {
arrJifei.splice(0, 1);
}
}
this.jifeiList1 = arrJifei;
console.log(sumCM, sumDisk);
this.amounts_payable = Number(
(Number(sumCM) + Number(sumDisk)).toFixed(2)
);
// this.total_money = sumCM + sumDisk - a_deductions;
return this.amounts_payable;
},
},
computed: {},
watch: {
formNew: {
handler() {
......
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