|
|
|
|
@ -1351,10 +1351,8 @@ export default {
|
|
|
|
|
collectionRechargeAmount += item.spendMoney*1
|
|
|
|
|
collectionAmounts += ( ( (item.spendMoney*1)/ ((item.discount?item.discount:100)/100) ) + ((item.giftSpendMoney?item.giftSpendMoney*1:0)/(item.discountFreeAmount?item.discountFreeAmount/100:1)))
|
|
|
|
|
})
|
|
|
|
|
collectionRechargeAmount = collectionRechargeAmount.toFixed(2)*1
|
|
|
|
|
collectionAmounts = collectionAmounts.toFixed(2)*1
|
|
|
|
|
this.$set(this.list[this.projectIndex],'collectionRechargeAmount',collectionRechargeAmount)
|
|
|
|
|
this.$set(this.list[this.projectIndex],'collectionAmounts',collectionAmounts)
|
|
|
|
|
this.$set(this.list[this.projectIndex],'collectionRechargeAmount',collectionRechargeAmount.toFixed(2)*1)
|
|
|
|
|
this.$set(this.list[this.projectIndex],'collectionAmounts', collectionAmounts.toFixed(2)*1)
|
|
|
|
|
// 误差
|
|
|
|
|
if((this.list[this.projectIndex].transactionPrice-this.list[this.projectIndex].collectionAmounts)<=this.balance*1 ){
|
|
|
|
|
this.list[this.projectIndex].collectionAmounts = (this.list[this.projectIndex].transactionPrice).toFixed(2)*1
|
|
|
|
|
@ -1365,10 +1363,8 @@ export default {
|
|
|
|
|
collectionRechargeAmount += item.spendMoney*1
|
|
|
|
|
collectionAmounts += ((item.spendMoney*1) + (item.giftSpendMoney?item.giftSpendMoney*1:0))
|
|
|
|
|
})
|
|
|
|
|
collectionRechargeAmount = collectionRechargeAmount.toFixed(2)*1
|
|
|
|
|
collectionAmounts = collectionAmounts.toFixed(2)*1
|
|
|
|
|
this.$set(this.list[this.projectIndex],'collectionRechargeAmount',collectionRechargeAmount)
|
|
|
|
|
this.$set(this.list[this.projectIndex],'collectionAmounts',collectionAmounts)
|
|
|
|
|
this.$set(this.list[this.projectIndex],'collectionRechargeAmount',(collectionRechargeAmount).toFixed(2)*1)
|
|
|
|
|
this.$set(this.list[this.projectIndex],'collectionAmounts', (collectionAmounts).toFixed(2)*1)
|
|
|
|
|
if((this.list[this.projectIndex].transactionPrice-this.list[this.projectIndex].collectionAmounts)<=this.balance*1 ){
|
|
|
|
|
this.list[this.projectIndex].collectionAmounts = (this.list[this.projectIndex].transactionPrice).toFixed(2)*1
|
|
|
|
|
} //误差
|
|
|
|
|
@ -1417,7 +1413,7 @@ export default {
|
|
|
|
|
}else{
|
|
|
|
|
// 当前金额大于当前值
|
|
|
|
|
console.log('当前剩余金额-->',appearPrice,'折扣是多少-->',row.discount)
|
|
|
|
|
row.spendMoney = appearPrice*(row.discount*1/100).toFixed(2)*1
|
|
|
|
|
row.spendMoney = (appearPrice*(row.discount*1/100)).toFixed(2)*1
|
|
|
|
|
// this.updataList()
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
@ -1425,15 +1421,16 @@ export default {
|
|
|
|
|
let total = (row.cardOvers/(row.discount*1)*100 + ( row.cardGiftOvers/( (row.discountFreeAmount?row.discountFreeAmount:100)*1 )*100 )).toFixed(2)*1
|
|
|
|
|
let balanceProportion = (row.cardConsumeMoney*1)/(row.cardConsumeMoney*1 + row.cardGiftOvers*1) //可用余额比例
|
|
|
|
|
let giveProportion = (row.cardGiftOvers*1)/(row.cardConsumeMoney*1 + row.cardGiftOvers*1) //赠送金额比例
|
|
|
|
|
balanceProportion = balanceProportion.toFixed(4)*1
|
|
|
|
|
giveProportion = giveProportion.toFixed(4)*1
|
|
|
|
|
let balanceConverted = balanceProportion/(row.discount?(row.discount*1/100):1) //可用折算 (比例除以折扣)
|
|
|
|
|
let giveConverted = giveProportion/(row.discountFreeAmount?(row.discountFreeAmount*1/100):1) //赠送折算
|
|
|
|
|
let convertedNum = appearPrice/(balanceConverted+giveConverted) //消费金额折算份数
|
|
|
|
|
console.log('可用比例-->',balanceProportion,'赠送比例--->',giveProportion)
|
|
|
|
|
if(appearPrice<total){
|
|
|
|
|
// 够用按比例扣除
|
|
|
|
|
row.spendMoney = (appearPrice*balanceProportion*((row.discount?row.discount*1:100)/100)).toFixed(2)*1
|
|
|
|
|
row.giftSpendMoney = (appearPrice*giveProportion*((row.discountFreeAmount?row.discountFreeAmount*1:100)/100)).toFixed(2)
|
|
|
|
|
row.spendMoney = (convertedNum*balanceProportion).toFixed(2)*1
|
|
|
|
|
row.giftSpendMoney = (convertedNum*giveProportion).toFixed(2)*1
|
|
|
|
|
row.cardGiftOvers = (row.cardGiftOvers - row.giftSpendMoney).toFixed(2)*1
|
|
|
|
|
console.log('来了这里--->')
|
|
|
|
|
console.log('剩了多少--->',row.cardGiftOvers)
|
|
|
|
|
// this.updataList()
|
|
|
|
|
}else{
|
|
|
|
|
// 如果总额不够付,扣掉所有的折扣可用余额并且把剩余金额也扣掉
|
|
|
|
|
@ -1453,11 +1450,11 @@ export default {
|
|
|
|
|
// 够付的情况按照比例扣除
|
|
|
|
|
let balanceProportion = (row.cardConsumeMoney*1)/(row.cardConsumeMoney*1 + row.cardGiftOvers*1) //可用余额比例
|
|
|
|
|
let giveProportion = (row.cardGiftOvers*1)/(row.cardConsumeMoney*1 + row.cardGiftOvers*1) //赠送金额比例
|
|
|
|
|
balanceProportion = balanceProportion.toFixed(2)*1
|
|
|
|
|
giveProportion = giveProportion.toFixed(2)*1
|
|
|
|
|
row.spendMoney = (appearPrice*balanceProportion).toFixed(2)*1
|
|
|
|
|
row.giftSpendMoney = (appearPrice*giveProportion).toFixed(2)*1
|
|
|
|
|
row.cardGiftOvers = row.cardGiftOvers - row.giftSpendMoney
|
|
|
|
|
// row.spendMoney = (appearPrice*balanceProportion).toFixed(2)*1
|
|
|
|
|
// row.giftSpendMoney = (appearPrice*giveProportion).toFixed(2)*1
|
|
|
|
|
row.spendMoney = (appearPrice*row.cardOvers/( row.cardGiftOvers+row.cardOvers )).toFixed(2)*1
|
|
|
|
|
row.giftSpendMoney = (appearPrice*row.cardGiftOvers/( row.cardGiftOvers+row.cardOvers )).toFixed(2)*1
|
|
|
|
|
row.cardGiftOvers = (row.cardGiftOvers - row.giftSpendMoney).toFixed(2)*1
|
|
|
|
|
}else{
|
|
|
|
|
row.spendMoney = row.cardOvers
|
|
|
|
|
row.giftSpendMoney = row.cardGiftOvers
|
|
|
|
|
@ -1465,6 +1462,7 @@ export default {
|
|
|
|
|
// this.updataList()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
this.spendMoney = row.spendMoney
|
|
|
|
|
}else{ //先用实冲,再用赠送
|
|
|
|
|
console.log('来到了门店参数2--->')
|
|
|
|
|
//做法 扣除本次支付/赠送支付/赠送剩余
|
|
|
|
|
@ -1535,7 +1533,7 @@ export default {
|
|
|
|
|
console.log('上一次的值是多少呢------>',this.spendMoney)
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
endEditcard(row, index) { //看不懂别乱改!!!!!!
|
|
|
|
|
endEditcard(row, index) { //计算比较复杂,仔细看每一步
|
|
|
|
|
// 卡付抵扣金额collectionAmounts 卡付金额collectionRechargeAmount
|
|
|
|
|
// 本次支付spendMoney 可用金额cardConsumeMoney 可用余额cardOvers 可用折扣discount 赠送折扣discountFreeAmount 赠送支付giftSpendMoney 赠送剩余cardGiftOvers
|
|
|
|
|
// type:0折扣卡 1赠送卡 2活动卡 noDiscount 0 能打折 1 不打折
|
|
|
|
|
@ -1549,7 +1547,8 @@ export default {
|
|
|
|
|
let appearPrice = this.list[this.projectIndex].transactionPrice - (this.list[this.projectIndex].collectionAmounts?this.list[this.projectIndex].collectionAmounts*1:0) //本次需要支付的钱
|
|
|
|
|
if(this.useRecharge == 1){ //门店参数 按比例支付
|
|
|
|
|
// 上一次输入的没变
|
|
|
|
|
if((this.spendMoney*1) === row.spendMoney*1){
|
|
|
|
|
console.log('上一次--->',this.spendMoney,'现在--->',row.spendMoney)
|
|
|
|
|
if(this.spendMoney === row.spendMoney){
|
|
|
|
|
console.log('我会到这里呀!!!!')
|
|
|
|
|
// 上一次没改变
|
|
|
|
|
row.cardOvers = (row.cardOvers - (row.spendMoney*1)).toFixed(2)*1
|
|
|
|
|
@ -1571,11 +1570,13 @@ export default {
|
|
|
|
|
// 够支付,按比例扣除,可能赠送存在或者不存在
|
|
|
|
|
let balanceProportion = row.cardOvers*1/(row.cardOvers*1+( (row.giftSpendMoney?row.giftSpendMoney*1:0) + row.cardGiftOvers*1 )) //可用余额比例
|
|
|
|
|
let giveProportion = (row.cardGiftOvers*1 + (row.giftSpendMoney?row.giftSpendMoney*1:0))/(row.cardOvers*1+( (row.giftSpendMoney?row.giftSpendMoney*1:0) + row.cardGiftOvers*1 ))//赠送金额比例
|
|
|
|
|
balanceProportion = balanceProportion.toFixed(4)*1
|
|
|
|
|
giveProportion = giveProportion.toFixed(4)*1
|
|
|
|
|
row.spendMoney = (appearPrice*balanceProportion*(row.discount/100)).toFixed(2)*1 //得到支付金额
|
|
|
|
|
console.log('--------->比例',balanceProportion,giveProportion)
|
|
|
|
|
let balanceConverted = balanceProportion/(row.discount?(row.discount*1/100):1) //可用折算 (比例除以折扣)
|
|
|
|
|
let giveConverted = giveProportion/(row.discountFreeAmount?(row.discountFreeAmount*1/100):1) //赠送折算
|
|
|
|
|
let convertedNum = appearPrice/(balanceConverted+giveConverted) //消费金额折算份数
|
|
|
|
|
row.spendMoney = ( convertedNum*balanceProportion ).toFixed(2)*1 //支付金额
|
|
|
|
|
row.cardGiftOvers = (row.giftSpendMoney?row.giftSpendMoney*1:0) + row.cardGiftOvers*1 //还原赠送支付
|
|
|
|
|
row.giftSpendMoney = ((appearPrice*giveProportion)*(row.discountFreeAmount/100)).toFixed(2)*1 //
|
|
|
|
|
row.giftSpendMoney =( convertedNum*giveProportion ).toFixed(2)*1 //赠送金额
|
|
|
|
|
row.cardGiftOvers = (row.cardGiftOvers*1 - row.giftSpendMoney*1).toFixed(2)*1 // 赠送剩余= 赠送剩余原始值-赠送支付
|
|
|
|
|
// 有误差
|
|
|
|
|
if(row.cardGiftOvers<0){
|
|
|
|
|
@ -1598,18 +1599,18 @@ export default {
|
|
|
|
|
row.giftSpendMoney = 0 //还原赠送支付
|
|
|
|
|
let balanceProportion = row.cardOvers/(row.cardOvers + (row.cardGiftOvers?row.cardGiftOvers*1:0)) // 可用金额比例
|
|
|
|
|
let giveProportion = (row.cardGiftOvers?row.cardGiftOvers*1:0)/(row.cardOvers + (row.cardGiftOvers?row.cardGiftOvers*1:0)) // 可用赠送比例
|
|
|
|
|
balanceProportion = balanceProportion.toFixed(4)*1
|
|
|
|
|
giveProportion = giveProportion.toFixed(4)*1
|
|
|
|
|
let balanceConverted = balanceProportion/(row.discount?(row.discount*1/100):1) //可用折算 (比例除以折扣)
|
|
|
|
|
let giveConverted = giveProportion/(row.discountFreeAmount?(row.discountFreeAmount*1/100):1) //赠送折算
|
|
|
|
|
let convertedNum = appearPrice/(balanceConverted+giveConverted) //消费金额折算份数
|
|
|
|
|
// 先要判断输入金额是否大于项目金额
|
|
|
|
|
if(row.spendMoney > appearPrice){ // 输入的金额大于项目金额
|
|
|
|
|
this.$message.warning({ message: "支付金额大于成交金额" });
|
|
|
|
|
// 当输入金额大于项目金额时(就是比如说输入400的时候,而这个项目总价是350),帮它自动计算(比例扣除)
|
|
|
|
|
console.log('瞅瞅比例','可用---',balanceProportion,'赠送---',giveProportion)
|
|
|
|
|
// 自动计算
|
|
|
|
|
row.spendMoney = (appearPrice*balanceProportion*(row.discount/100)).toFixed(2)*1
|
|
|
|
|
row.spendMoney = (convertedNum*balanceProportion).toFixed(2)*1
|
|
|
|
|
row.cardOvers = (row.cardOvers - row.spendMoney).toFixed(2)*1
|
|
|
|
|
console.log('可用余额为--->',row.cardOvers)
|
|
|
|
|
row.giftSpendMoney = ((appearPrice*giveProportion)*(row.discountFreeAmount?row.discountFreeAmount/100:1)).toFixed(2)*1
|
|
|
|
|
row.giftSpendMoney = (convertedNum*giveProportion).toFixed(2)*1
|
|
|
|
|
row.cardGiftOvers =( row.cardGiftOvers - row.giftSpendMoney).toFixed(2)*1
|
|
|
|
|
// 有误差
|
|
|
|
|
if(row.cardGiftOvers<0){
|
|
|
|
|
@ -1625,9 +1626,9 @@ export default {
|
|
|
|
|
console.log('总价--->',total)
|
|
|
|
|
if(total > appearPrice){ //当前输入值折扣大于支付金额
|
|
|
|
|
// 按比例自动计算
|
|
|
|
|
this.$message.warning({ message: "支付金额大于成交金额" });
|
|
|
|
|
row.spendMoney = ((appearPrice*balanceProportion)*((row.discount?row.discount*1:100)/100)).toFixed(2)*1 //支付金额
|
|
|
|
|
row.giftSpendMoney = ((appearPrice*giveProportion)*((row.discountFreeAmount?row.discountFreeAmount*1:100)/100)).toFixed(2)*1 //赠送支付
|
|
|
|
|
this.$message.warning({ message: "支付金额大于项目金额" });
|
|
|
|
|
row.spendMoney =( convertedNum*balanceProportion ).toFixed(2)*1 //支付金额
|
|
|
|
|
row.giftSpendMoney = ( convertedNum*giveProportion ).toFixed(2)*1 //赠送支付
|
|
|
|
|
row.cardOvers = ( row.cardOvers - row.spendMoney ).toFixed(2)*1 //可用余额
|
|
|
|
|
row.cardGiftOvers = (row.cardGiftOvers - row.giftSpendMoney).toFixed(2)*1 //赠送剩余
|
|
|
|
|
if(row.cardGiftOvers<0){
|
|
|
|
|
@ -1638,12 +1639,13 @@ export default {
|
|
|
|
|
// 判断比例支付是否大于支付金额,如果大于,提示它并且帮它自动计算,不大于则扣除相应比例金额
|
|
|
|
|
let giveCase = (((row.spendMoney/(row.discount?row.discount/100:1))/balanceProportion)*giveProportion).toFixed(2)*1 //按照比例算出赠送金额为多少
|
|
|
|
|
console.log('你是多少--->',giveCase,total)
|
|
|
|
|
if( (giveCase+total)>= appearPrice ){ //如果输入金额折扣跟赠送折扣之和大于待支付金额,重新按照比例计算
|
|
|
|
|
// giveCase+total)>= appearPrice
|
|
|
|
|
if( row.spendMoney>(convertedNum*balanceProportion) ){ //输入的值大于需要支付金额
|
|
|
|
|
console.log('误差是多少--->',giveCase+total,'待支付是多少--->',appearPrice)
|
|
|
|
|
if(((giveCase+total)-appearPrice)>= this.balance*1)this.$message.warning({ message: "输入金额金额跟赠送金额之和大于成交金额" });
|
|
|
|
|
// 重新帮忙计算
|
|
|
|
|
row.spendMoney = ((appearPrice*balanceProportion)*((row.discount?row.discount*1:100)/100)).toFixed(2)*1 //支付金额
|
|
|
|
|
row.giftSpendMoney = ((appearPrice*giveProportion)*((row.discountFreeAmount?row.discountFreeAmount*1:100)/100)).toFixed(2)*1 //赠送支付
|
|
|
|
|
this.$message.warning({ message: "支付金额大于项目金额" });
|
|
|
|
|
// 重新计算
|
|
|
|
|
row.spendMoney = (convertedNum*balanceProportion).toFixed(2)*1 //支付金额
|
|
|
|
|
row.giftSpendMoney = (convertedNum*giveProportion).toFixed(2)*1 //赠送支付
|
|
|
|
|
row.cardOvers = ( row.cardOvers - row.spendMoney ).toFixed(2)*1 //赠送支付
|
|
|
|
|
row.cardGiftOvers = (row.cardGiftOvers - row.giftSpendMoney).toFixed(2)*1 //赠送剩余
|
|
|
|
|
// 有误差
|
|
|
|
|
@ -1652,9 +1654,12 @@ export default {
|
|
|
|
|
}
|
|
|
|
|
this.updataList()
|
|
|
|
|
}else{ //按照输入扣除
|
|
|
|
|
console.log('我到了这里呀!!!',giveProportion,balanceProportion)
|
|
|
|
|
// console.log('我到了这里呀!!!',giveProportion,balanceProportion)
|
|
|
|
|
let zsbl = row.spendMoney/(convertedNum*balanceProportion)
|
|
|
|
|
console.log('比例是多少---->',zsbl,'这个呢--->',convertedNum)
|
|
|
|
|
row.cardOvers = ( row.cardOvers - row.spendMoney ).toFixed(2)*1 //可用余额
|
|
|
|
|
row.giftSpendMoney = ((((row.spendMoney/(row.discount?row.discount/100:1))/balanceProportion)*giveProportion)*((row.discountFreeAmount?row.discountFreeAmount*1:100)/100)).toFixed(2)*1 //赠送支付(按比例公式--- 支付金额/支付折扣/支付比例*赠送比例*赠送折扣 ---)
|
|
|
|
|
row.giftSpendMoney = (convertedNum*giveProportion*zsbl).toFixed(2)*1
|
|
|
|
|
// row.giftSpendMoney = ((((row.spendMoney/(row.discount?row.discount/100:1))/balanceProportion)*giveProportion)*((row.discountFreeAmount?row.discountFreeAmount*1:100)/100)).toFixed(2)*1 //赠送支付(按比例公式--- 支付金额/支付折扣/支付比例*赠送比例*赠送折扣 ---)
|
|
|
|
|
console.log('赠送支付为多少---->',row.giftSpendMoney)
|
|
|
|
|
row.cardGiftOvers = (row.cardGiftOvers - row.giftSpendMoney).toFixed(2)*1 //赠送剩余
|
|
|
|
|
// 有误差
|
|
|
|
|
@ -1681,9 +1686,12 @@ export default {
|
|
|
|
|
let total = row.cardOvers + row.cardGiftOvers
|
|
|
|
|
console.log('为多少--->',row.cardOvers,row.cardGiftOvers)
|
|
|
|
|
if(total>appearPrice){ //当(可用余额加上可用赠送)大于项目金额时,按比例自动扣除
|
|
|
|
|
row.spendMoney = (appearPrice*balanceProportion).toFixed(2)*1 //支付金额
|
|
|
|
|
// row.spendMoney = (appearPrice*balanceProportion).toFixed(2)*1 //支付金额
|
|
|
|
|
// row.cardOvers = row.cardOver - row.spendMoney //可用余额= 可用余额-支付金额
|
|
|
|
|
// row.giftSpendMoney = (appearPrice*giveProportion).toFixed(2)*1 //赠送支付金额
|
|
|
|
|
row.spendMoney = (appearPrice*row.cardOver/(row.cardOver+row.cardGiftOvers)).toFixed(2)*1
|
|
|
|
|
row.cardOvers = row.cardOver - row.spendMoney //可用余额= 可用余额-支付金额
|
|
|
|
|
row.giftSpendMoney = (appearPrice*giveProportion).toFixed(2)*1 //赠送支付金额
|
|
|
|
|
row.giftSpendMoney = (appearPrice*row.cardGiftOvers/(row.cardOver+row.cardGiftOvers)).toFixed(2)*1
|
|
|
|
|
row.cardGiftOvers =( row.cardGiftOvers - row.giftSpendMoney).toFixed(2)*1 //赠送剩余 = 赠送剩余-赠送支付
|
|
|
|
|
this.updataList()
|
|
|
|
|
}else{ //(可用余额跟赠送支付)小于项目金额,自动扣除全部
|
|
|
|
|
@ -1698,29 +1706,35 @@ export default {
|
|
|
|
|
if(row.spendMoney > appearPrice){ //如果支付金额大于项目金额
|
|
|
|
|
this.$message.warning({ message: "支付金额不能大于成交金额" });
|
|
|
|
|
// 大于的话自动计算
|
|
|
|
|
row.spendMoney = (appearPrice*balanceProportion).toFixed(2)*1 //支付金额
|
|
|
|
|
// row.spendMoney = (appearPrice*balanceProportion).toFixed(2)*1 //支付金额
|
|
|
|
|
// row.cardOvers = row.cardOvers - row.spendMoney //可用余额=可用余额-支付金额
|
|
|
|
|
// row.giftSpendMoney = (appearPrice*giveProportion).toFixed(2)*1 //赠送支付金额
|
|
|
|
|
row.spendMoney = (appearPrice*row.cardOvers/(row.cardOvers + row.cardGiftOvers)).toFixed(2)*1 //本次支付
|
|
|
|
|
row.giftSpendMoney = (appearPrice*row.cardGiftOvers/(row.cardGiftOvers + row.cardOvers)).toFixed(2)*1 //本次赠送支付
|
|
|
|
|
row.cardOvers = row.cardOvers - row.spendMoney //可用余额=可用余额-支付金额
|
|
|
|
|
row.giftSpendMoney = (appearPrice*giveProportion).toFixed(2)*1 //赠送支付金额
|
|
|
|
|
row.cardGiftOvers = (row.cardOvers - row.giftSpendMoney).toFixed(2)*1 //赠送剩余= 赠送剩余-赠送支付
|
|
|
|
|
this.updataList()
|
|
|
|
|
}else{ //输入的金额不大于项目金额
|
|
|
|
|
// 需要判断比例总和是否大于项目金额
|
|
|
|
|
let giveCase = ((row.spendMoney/balanceProportion)*giveProportion).toFixed(2)*1 //按比例算出的赠送支付
|
|
|
|
|
// let giveCase = ((row.spendMoney/balanceProportion)*giveProportion).toFixed(2)*1 //按比例算出的赠送支付
|
|
|
|
|
let giveCase = 0 //按照比例需要付赠送多少钱
|
|
|
|
|
let spendMoney= (appearPrice*row.cardOvers/(row.cardOvers + row.cardGiftOvers)).toFixed(2)*1
|
|
|
|
|
giveCase = ((row.spendMoney/spendMoney)*((appearPrice*row.cardGiftOvers/(row.cardGiftOvers + row.cardOvers))).toFixed(2)*1)
|
|
|
|
|
console.log('按比例是多少----->',row.spendMoney/spendMoney,'赠送呢--->',giveCase)
|
|
|
|
|
if(((row.spendMoney*1 + giveCase)*1) > appearPrice){
|
|
|
|
|
// 如果按比例之和大于项目金额,大于的情况一定是够支付的!!!
|
|
|
|
|
console.log((((row.spendMoney*1 + giveCase)*1) - appearPrice),'---<为多少')
|
|
|
|
|
if((((row.spendMoney*1 + giveCase)*1) - appearPrice)>=this.balance*1)this.$message.warning({ message: "按比例支付总和大于成交金额" }); //判断误差
|
|
|
|
|
this.$message.warning({ message: "支付金额大于项目金额" }); //判断误差
|
|
|
|
|
// 自动计算
|
|
|
|
|
console.log('是多少-->',row.spendMoney,'总额-->',row.cardOvers)
|
|
|
|
|
row.spendMoney = (appearPrice*balanceProportion).toFixed(2)*1 //支付金额
|
|
|
|
|
row.spendMoney = (appearPrice*row.cardOvers/(row.cardOvers + row.cardGiftOvers)).toFixed(2)*1 //支付金额
|
|
|
|
|
row.giftSpendMoney = (appearPrice*row.cardGiftOvers/(row.cardGiftOvers + row.cardOvers)).toFixed(2)*1 //赠送支付金额
|
|
|
|
|
row.cardOvers = row.cardOvers - row.spendMoney //可用余额=可用余额-支付金额
|
|
|
|
|
row.giftSpendMoney = (appearPrice*giveProportion).toFixed(2)*1 //赠送支付金额
|
|
|
|
|
row.cardGiftOvers = (row.cardGiftOvers - row.giftSpendMoney).toFixed(2)*1 //赠送剩余= 赠送剩余-赠送支付
|
|
|
|
|
this.updataList()
|
|
|
|
|
}else{ //按比例支付总和不大于项目金额
|
|
|
|
|
row.spendMoney = row.spendMoney*1
|
|
|
|
|
row.giftSpendMoney = ((appearPrice*row.cardGiftOvers/(row.cardGiftOvers + row.cardOvers))*(row.spendMoney/spendMoney)).toFixed(2)*1 //赠送支付
|
|
|
|
|
row.cardOvers = row.cardOvers - row.spendMoney //可用余额
|
|
|
|
|
row.giftSpendMoney = ((row.spendMoney/balanceProportion)*giveProportion).toFixed(2)*1 //赠送支付
|
|
|
|
|
row.cardGiftOvers = (row.cardGiftOvers - row.giftSpendMoney).toFixed(2)*1 //赠送剩余
|
|
|
|
|
this.updataList()
|
|
|
|
|
}
|
|
|
|
|
|