master
lion 3 months ago
parent cc90c924fb
commit 3a60f329b7

@ -518,6 +518,22 @@ export default {
.catch((error) => {});
},
methods: {
formatResult(num) {
// 1. 100100
if(!num){
return '0'
}
const processed = Math.round(num * 100) / 100;
// 2. 0
if (processed % 1 === 0) {
//
return processed.toString();
} else {
//
return processed.toFixed(2);
}
},
async getCarry () {
const res = await carry(this.carrySelect);
@ -592,11 +608,11 @@ export default {
// 0;
// });
let curPlan = res?.map(i => {
const { use_money_total,paid_plan_total,money_total_2,money_total_1 } = i
const { use_money_total,paid_plan_total,money_total_2,money_total_1,plan_rate } = i
let curPlan_total = Math.round(Number(paid_plan_total||0)) + Math.round(Number(use_money_total||0))
return {
value:plan_rate*100,
value:this.formatResult(plan_rate),
// value:Number(money_total_2) ? ((( curPlan_total / Number(money_total_2 ||0)) * 10000) / 100).toFixed(2) :
// ((( curPlan_total / Number(money_total_1 ||0)) * 10000) / 100).toFixed(2),
money:parseFloat(curPlan_total).toFixed(2)
@ -604,9 +620,9 @@ export default {
});
let curAct = res?.map(i => {
const { use_money_total,money_total_2,money_total_1 } = i
const { use_money_total,money_total_2,money_total_1,act_rate } = i
return {
value:act_rate*100,
value:this.formatResult(act_rate),
// value:Number(money_total_2) ?
// (Math.round((Number(use_money_total||0) / Number(money_total_2||0)) * 10000) / 100).toFixed(2) :
// (Math.round((Number(use_money_total||0) / Number(money_total_1||0)) * 10000) / 100).toFixed(2),
@ -615,13 +631,15 @@ export default {
});
let nextPlan = res?.map(i => {
const { use_money_total,use_money_total_next,paid_plan_total_next,money_total_2,money_total_1 } = i
const { plan_rate_next,use_money_total,use_money_total_next,paid_plan_total_next,money_total_2,money_total_1 } = i
// if(Number(paid_plan_total_next)===0){
// return 0
// }
let nextPlan_total = Math.round(Number(paid_plan_total_next||0)) + Math.round(Number(use_money_total||0))
return {
vaule:plan_rate_next*100,
value:this.formatResult(plan_rate_next),
// value:Number(money_total_2) ? (((nextPlan_total / Number(money_total_2||0)) * 10000) / 100).toFixed(2) :
// (((nextPlan_total / Number(money_total_1||0)) * 10000) / 100).toFixed(2),
money:parseFloat(nextPlan_total).toFixed(2)

Loading…
Cancel
Save