|
|
|
|
@ -534,6 +534,11 @@
|
|
|
|
|
prop="collectionAmounts"
|
|
|
|
|
label="卡付抵扣金额"
|
|
|
|
|
>
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<span>
|
|
|
|
|
{{ scope.row.collectionAmounts?scope.row.collectionAmounts:0 }}
|
|
|
|
|
</span>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column
|
|
|
|
|
show-overflow-tooltip
|
|
|
|
|
@ -652,10 +657,12 @@
|
|
|
|
|
<repayment ref="repayment" @repaymentData="inputMember"></repayment>
|
|
|
|
|
<addmember ref="addmember"></addmember>
|
|
|
|
|
<orders ref="orders"></orders>
|
|
|
|
|
<message :message="message" ref="message"></message>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
<script>
|
|
|
|
|
import addmember from "@/components/member/edit/index";
|
|
|
|
|
import message from './detail/message.vue'
|
|
|
|
|
import {
|
|
|
|
|
selectList,
|
|
|
|
|
selectListType,
|
|
|
|
|
@ -694,9 +701,11 @@ export default {
|
|
|
|
|
repayment,
|
|
|
|
|
recash,
|
|
|
|
|
orders,
|
|
|
|
|
message
|
|
|
|
|
},
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
message:"",
|
|
|
|
|
pickerOptions: {
|
|
|
|
|
disabledDate(time) {
|
|
|
|
|
return time.getTime() > Date.now();
|
|
|
|
|
@ -756,7 +765,6 @@ export default {
|
|
|
|
|
card4:0,
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
computed: {
|
|
|
|
|
// 现付金额
|
|
|
|
|
appearPrices() {
|
|
|
|
|
@ -764,9 +772,7 @@ export default {
|
|
|
|
|
现付金额 = 项目金额transactionPrice - 卡付抵扣金额collectionAmounts
|
|
|
|
|
需要转换下number格式,不然是字符串拼接
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
let num = this.list.reduce((pre, item) => {
|
|
|
|
|
console.log("🚀 ~ file: service.vue ~ line 804 ~ num ~ item.courseAccountId", item.collectionAmounts)
|
|
|
|
|
item.transactionPrice = item.transactionPrice
|
|
|
|
|
?(item.transactionPrice*1).toFixed(2) * 1
|
|
|
|
|
: 0; // 抵扣金额存在,项目金额存在
|
|
|
|
|
@ -784,38 +790,24 @@ export default {
|
|
|
|
|
return pre + 0;
|
|
|
|
|
}
|
|
|
|
|
}, 0);
|
|
|
|
|
return num.toFixed(2);
|
|
|
|
|
return num.toFixed(2)*1;
|
|
|
|
|
},
|
|
|
|
|
appearPrice() {
|
|
|
|
|
/*
|
|
|
|
|
现付金额 = 项目金额transactionPrice - 卡付抵扣金额collectionAmounts
|
|
|
|
|
需要转换下number格式,不然是字符串拼接
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
let num = this.list.reduce((pre, item) => {
|
|
|
|
|
console.log("🚀 ~ file: service.vue ~ line 804 ~ num ~ item.courseAccountId", item)
|
|
|
|
|
item.transactionPrice = item.transactionPrice
|
|
|
|
|
?(item.transactionPrice*1).toFixed(2) * 1
|
|
|
|
|
: 0; // 抵扣金额存在,项目金额存在
|
|
|
|
|
if(item.isCardPay !== 0){
|
|
|
|
|
return pre
|
|
|
|
|
}
|
|
|
|
|
if(item.courseAccountId == null){
|
|
|
|
|
item.collectionAmounts = (item.collectionAmounts*1).toFixed(2) * 1;
|
|
|
|
|
}else{
|
|
|
|
|
item.collectionAmounts =(item.transactionPrice*1).toFixed(2) * 1;
|
|
|
|
|
}
|
|
|
|
|
if (item.collectionAmounts) {
|
|
|
|
|
return pre + (item.transactionPrice - item.collectionAmounts);
|
|
|
|
|
} // 抵扣金额不存在,项目金额存在
|
|
|
|
|
else if (!item.collectionAmounts && item.transactionPrice) {
|
|
|
|
|
return item.transactionPrice + pre; // 项目金额不存在
|
|
|
|
|
} else {
|
|
|
|
|
return pre + 0;
|
|
|
|
|
// 计算现金总和跟项目列表卡付抵扣金额总和
|
|
|
|
|
// let num = (eval(this.$refs.payment.payLists.map(item=>{return item.payMoney}).join("+")) + eval(this.list.map(item=>{return item.collectionAmounts?item.collectionAmounts:0}).join("+")))
|
|
|
|
|
// // 当金额等于总价时不让执行(处理现金付完还能卡付bug)
|
|
|
|
|
// let total = eval(this.list.map(item=>item.transactionPrice?item.transactionPrice:0.).join("+"))
|
|
|
|
|
// if( num === total*1 )return 0
|
|
|
|
|
try{
|
|
|
|
|
if(this.list){
|
|
|
|
|
let collectionAmounts =this.list[this.projectIndex].collectionAmounts
|
|
|
|
|
return (this.list[this.projectIndex].amount-(collectionAmounts?collectionAmounts*1:0)).toFixed(2)*1;
|
|
|
|
|
}
|
|
|
|
|
}, 0);
|
|
|
|
|
return num.toFixed(2);
|
|
|
|
|
}, // 总价金额
|
|
|
|
|
}catch(err){
|
|
|
|
|
return 0
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
// 总价金额
|
|
|
|
|
total() {
|
|
|
|
|
/*
|
|
|
|
|
项目金额transactionPrice 卡付抵扣金额collectionAmounts 卡付金额collectionRechargeAmount
|
|
|
|
|
@ -846,7 +838,7 @@ export default {
|
|
|
|
|
return pre + 0;
|
|
|
|
|
}
|
|
|
|
|
}, 0);
|
|
|
|
|
return total.toFixed(2);
|
|
|
|
|
return total.toFixed(2)*1;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
@ -875,12 +867,8 @@ export default {
|
|
|
|
|
},
|
|
|
|
|
//修改卡付金额
|
|
|
|
|
editcard(row, index) {
|
|
|
|
|
//console.log("🚀 ~ file: service.vue ~ line 837 ~ editcard ~ row", row);
|
|
|
|
|
this.recIndex = index;
|
|
|
|
|
|
|
|
|
|
//console.log("🚀 ~ file: service.vue ~ line 843 ~ editcard ~ this.rowRecList[index].type", this.rowRecList[index].type)
|
|
|
|
|
this.recIndex = index
|
|
|
|
|
if(this.rowRecList[index].type == 1){
|
|
|
|
|
|
|
|
|
|
if (this.list[this.projectIndex].noDiscount == 1) {
|
|
|
|
|
this.rowRecList[index].spendMoney =this.appearPrice;
|
|
|
|
|
|
|
|
|
|
@ -928,12 +916,9 @@ export default {
|
|
|
|
|
this.rowRecList[index].discoutMoney =
|
|
|
|
|
((this.appearPrice * 1) * recRatio).toFixed(2) *1; //充值卡支付的钱
|
|
|
|
|
this.rowRecList[index].discoutMoney= Math.trunc(this.rowRecList[index].discoutMoney)
|
|
|
|
|
//console.log("🚀 ~ file: service.vue ~ line 899 ~ editcard ~ this.appearPrice", this.appearPrice)
|
|
|
|
|
this.rowRecList[index].discoutGiftMoney =
|
|
|
|
|
|
|
|
|
|
(this.appearPrice-this.rowRecList[index].discoutMoney ).toFixed(2) * 1; //赠送实际出的钱
|
|
|
|
|
this.rowRecList[index].discoutGiftMoney= Math.trunc(this.rowRecList[index].discoutGiftMoney)
|
|
|
|
|
//console.log("🚀 ~ file: service.vue ~ line 897 ~ editcard ~ this.rowRecList[index].discoutGiftMoney", this.rowRecList[index].discoutGiftMoney)
|
|
|
|
|
this.rowRecList[index].spendMoney =(this.rowRecList[index].discoutMoney *(this.rowRecList[index].discount / 100)).toFixed(2) * 1; //赠送卡抵扣支付的钱
|
|
|
|
|
this.rowRecList[index].giftSpendMoney =(this.rowRecList[index].discoutGiftMoney *(this.rowRecList[index].discountFreeAmount / 100)).toFixed(2) * 1;
|
|
|
|
|
|
|
|
|
|
@ -945,17 +930,6 @@ export default {
|
|
|
|
|
((this.appearPrice * 1) * recGiftRatio).toFixed(2) * 1; //赠送实际出的钱
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// else {
|
|
|
|
|
// form.spendMoney = form.cardOver;
|
|
|
|
|
// form.discoutMoney =
|
|
|
|
|
// (form.spendMoney * 1 * (form.discount / 100)).toFixed(2) * 1;
|
|
|
|
|
// form.giftSpendMoney =
|
|
|
|
|
// (((form.spendMoney * 1) / recRatio) * recGiftRatio).toFixed(2) *
|
|
|
|
|
// 1;
|
|
|
|
|
|
|
|
|
|
// form.discoutGiftMoney = //赠送卡支付的钱
|
|
|
|
|
// (form.giftSpendMoney * (form.discount / 100)).toFixed(2) * 1;
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
this.card1=this.rowRecList[index].spendMoney;
|
|
|
|
|
@ -983,19 +957,9 @@ export default {
|
|
|
|
|
this.rowRecList[index].gifSpendMoney =(this.rowRecList[index].cardGiftOvers).toFixed(2) * 1;
|
|
|
|
|
this.rowRecList[index].cardGiftOvers=0
|
|
|
|
|
}
|
|
|
|
|
// }
|
|
|
|
|
// this.recIndex = -1;
|
|
|
|
|
},
|
|
|
|
|
endEditcard(row, index) {
|
|
|
|
|
this.recForm.cashAmount = 0;
|
|
|
|
|
//console.log(this.recForm);
|
|
|
|
|
|
|
|
|
|
// if(this.projectMomey==this.recForm.amount){
|
|
|
|
|
// this.projectMomey=0
|
|
|
|
|
// }
|
|
|
|
|
// if(this.projectMomey<0){
|
|
|
|
|
// this.projectMomey=this.recForm.amount
|
|
|
|
|
// }
|
|
|
|
|
let debtMoney =
|
|
|
|
|
(this.recForm.amount * 1 - this.recForm.cashAmount * 1).toFixed(2) * 1; //获取成交价
|
|
|
|
|
let form = { ...row }; //复制row
|
|
|
|
|
@ -1012,9 +976,9 @@ export default {
|
|
|
|
|
});
|
|
|
|
|
form.spendMoney=0
|
|
|
|
|
}
|
|
|
|
|
//console.log("🚀 ~ file: service.vue ~ line 964 ~ endEditcard ~ form", form)
|
|
|
|
|
if (debtMoney > 0) {
|
|
|
|
|
//判断成交价是否大于0
|
|
|
|
|
console.log('成交额大于0--->>',debtMoney,form)
|
|
|
|
|
if (form.type == 2 || form.type == 0) {
|
|
|
|
|
//判断卡种2是活动卡,0是赠送卡,两者貌似都有赠送金额
|
|
|
|
|
if (this.useRecharge == 2) {
|
|
|
|
|
@ -1054,12 +1018,14 @@ export default {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
console.log('来到了按比例使用')
|
|
|
|
|
//按比例使用
|
|
|
|
|
let sunRatio =
|
|
|
|
|
(form.cardOver + form.giftConsumeMoney).toFixed(2) * 1; ///可用余额+赠送余额
|
|
|
|
|
let recRatio = (form.cardOver / sunRatio).toFixed(2) * 1; //可用余额比例
|
|
|
|
|
let recGiftRatio = (form.giftConsumeMoney / sunRatio).toFixed(2) * 1; //赠送余额比例
|
|
|
|
|
if (form.offsetMoney > debtMoney * recRatio) {
|
|
|
|
|
console.log('会到这里---|||---',this.recForm.noDiscount)
|
|
|
|
|
if (this.recForm.noDiscount == 0) {
|
|
|
|
|
//可以打折
|
|
|
|
|
form.discoutMoney =
|
|
|
|
|
@ -1123,22 +1089,9 @@ export default {
|
|
|
|
|
form.discoutGiftMoney + form.discoutMoney >
|
|
|
|
|
this.list[this.editProIndex].amount
|
|
|
|
|
) {
|
|
|
|
|
//卡付金额不能大于套餐的金额
|
|
|
|
|
//console.log("🚀 ~ file: service.vue ~ line 592 ~ endEditcard ~ this.list[this.editProIndex]", this.list[this.editProIndex])
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
// if (0 <= row.spendMoney * 1 > row.cardOver * 1) {
|
|
|
|
|
// this.$message.info({
|
|
|
|
|
// message: "支付金额不能大于可用金额!"
|
|
|
|
|
// });
|
|
|
|
|
// row.spendMoney = 0;
|
|
|
|
|
// row.giftSpendMoney = 0;
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|
// if (form.spendMoney > form.cardOver) {
|
|
|
|
|
// form.spendMoney = form.cardOver;
|
|
|
|
|
// form.giftSpendMoney = form.cardGiftOvers;
|
|
|
|
|
// }
|
|
|
|
|
form.cardOvers=(form.cardOver+(this.card1-form.spendMoney)).toFixed(2) * 1
|
|
|
|
|
form.cardGiftOvers=(form.giftConsumeMoney+(this.card2-form.giftSpendMoney)).toFixed(2) * 1
|
|
|
|
|
form.cardOver=(form.cardOver+(this.card1-form.spendMoney)).toFixed(2) * 1
|
|
|
|
|
@ -1171,15 +1124,14 @@ export default {
|
|
|
|
|
this.list.forEach(item => {
|
|
|
|
|
num = (num + item.collectionCashAmounts).toFixed(2) * 1;
|
|
|
|
|
});
|
|
|
|
|
console.log("🚀 ~ file: service.vue ~ line 1165 ~ endEditcard ~ form.spendMoney", form.spendMoney)
|
|
|
|
|
console.log("🚀 ~ file: service.vue ~ line 1165 ~ endEditcard ~ form.giftSpendMoney", form.giftSpendMoney)
|
|
|
|
|
console.log("🚀 ~ file: service.vue ~ line 1165 ~ endEditcard ~ form.discoutMoney", form.discoutMoney)
|
|
|
|
|
console.log("🚀 ~ file: service.vue ~ line 1165 ~ endEditcard ~ form.discoutGiftMoney", form.discoutGiftMoney)
|
|
|
|
|
// console.log("🚀 ~ file: service.vue ~ line 1165 ~ endEditcard ~ form.spendMoney", form.spendMoney)
|
|
|
|
|
// console.log("🚀 ~ file: service.vue ~ line 1165 ~ endEditcard ~ form.giftSpendMoney", form.giftSpendMoney)
|
|
|
|
|
// console.log("🚀 ~ file: service.vue ~ line 1165 ~ endEditcard ~ form.discoutMoney", form.discoutMoney)
|
|
|
|
|
// console.log("🚀 ~ file: service.vue ~ line 1165 ~ endEditcard ~ form.discoutGiftMoney", form.discoutGiftMoney)
|
|
|
|
|
this.form.collectionCashAmounts = num;
|
|
|
|
|
this.recIndex =-1
|
|
|
|
|
this.sumNum();
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
sumNum() {
|
|
|
|
|
let spendMoney = 0;
|
|
|
|
|
let spendNumber = 0;
|
|
|
|
|
@ -1220,10 +1172,7 @@ export default {
|
|
|
|
|
this.recForm.collectionIntegralAmount
|
|
|
|
|
).toFixed(2) * 1;
|
|
|
|
|
console.log("🚀 ~ file: service.vue ~ line 1213 ~ sumNum ~ this.recForm", this.recForm)
|
|
|
|
|
this.recForm.collectionAmounts =spendMoney?spendMoney.toFixed(2) * 1:0;;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.recForm.collectionAmounts =spendMoney?spendMoney.toFixed(2) * 1:0;;
|
|
|
|
|
this.recForm.rechargeAmount = spendNumber.toFixed(2) * 1;
|
|
|
|
|
this.list.splice(this.recForm.index, 1, this.recForm);
|
|
|
|
|
let rList = [];
|
|
|
|
|
@ -1408,8 +1357,8 @@ export default {
|
|
|
|
|
goPayDebt() {
|
|
|
|
|
this.$refs.repayment.show(this.memberForm);
|
|
|
|
|
},
|
|
|
|
|
// 待会处理
|
|
|
|
|
inputMember() {
|
|
|
|
|
console.log('为什么会触发这么多次')
|
|
|
|
|
if (partten.phoneNum.test(this.memberForm.mobilePhone)) {
|
|
|
|
|
storeMemberOne({
|
|
|
|
|
mobilePhone: this.memberForm.mobilePhone,
|
|
|
|
|
@ -1421,6 +1370,9 @@ export default {
|
|
|
|
|
this.cashNumber = 1;
|
|
|
|
|
this.list = [];
|
|
|
|
|
var this_ = this;
|
|
|
|
|
this.message = res.data.label
|
|
|
|
|
// 备注是否存在,存在让其显示,不存在不让显示
|
|
|
|
|
this.message?this.$refs.message.messageShow = true:""
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
this_.$refs.reccard.show(this_.memberForm);
|
|
|
|
|
this_.$refs.course.show(this_.memberForm);
|
|
|
|
|
@ -1478,7 +1430,7 @@ export default {
|
|
|
|
|
} else {
|
|
|
|
|
row.courseMoney = row.courseConsumePrice;
|
|
|
|
|
// row.collectionAmounts=row.transactionPrice
|
|
|
|
|
console.log("🚀 ~ file: service.vue ~ line 1466 ~ setProOne ~ row.transactionPrice", row)
|
|
|
|
|
console.log("----||-->>", row)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
@ -1653,7 +1605,6 @@ export default {
|
|
|
|
|
flag = false;
|
|
|
|
|
}
|
|
|
|
|
let sumMoney = 0;
|
|
|
|
|
|
|
|
|
|
this.list.forEach((item, index) => {
|
|
|
|
|
|
|
|
|
|
if (item.courseAccountId == null) {
|
|
|
|
|
@ -1665,14 +1616,9 @@ export default {
|
|
|
|
|
).toFixed(2) * 1;
|
|
|
|
|
}else{
|
|
|
|
|
item.transactionPrice*1;
|
|
|
|
|
console.log("🚀 ~ file: service.vue ~ line 1649 ~ this.list.forEach ~ item.transactionPrice", item.transactionPrice)
|
|
|
|
|
console.log("🚀 ~ file: service.vue ~ line 1649 ~ this.list.forEach ~ this.appearPrices", this.appearPrices)
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
console.log("🚀 ~ file: service.vue ~ line 1695 ~ confirm ~ sumMoney", sumMoney)
|
|
|
|
|
console.log("🚀 ~ file: service.vue ~ line 1695 ~ confirm ~ this.form.collectionCashAmounts", this.appearPrices)
|
|
|
|
|
|
|
|
|
|
if (
|
|
|
|
|
this.balance <=
|
|
|
|
|
(this.appearPrices*1 - sumMoney).toFixed(2) * 1 ||
|
|
|
|
|
@ -1809,7 +1755,28 @@ export default {
|
|
|
|
|
});
|
|
|
|
|
this.formData = new FormData();
|
|
|
|
|
}else{
|
|
|
|
|
addCash(this.formData).then(res => {
|
|
|
|
|
// 限制
|
|
|
|
|
let total = eval(this.$refs.payment.payLists.map(item=>{return item.payMoney?item.payMoney*1:0}).join("+"))
|
|
|
|
|
if(this.appearPrices*1 || total){
|
|
|
|
|
if(total>this.appearPrices*1){
|
|
|
|
|
return this.$alert(`现金金额多出${total-this.appearPrices*1}元`, "提示", {
|
|
|
|
|
confirmButtonText: "确定",
|
|
|
|
|
confirmButtonClass: "confirmbtnFalses",
|
|
|
|
|
type: "warning",
|
|
|
|
|
center: true,
|
|
|
|
|
callback: action => {}
|
|
|
|
|
});
|
|
|
|
|
}else if(total<this.appearPrices*1){
|
|
|
|
|
return this.$alert(`现金金额还需支付${this.appearPrices*1 - total}`, "提示", {
|
|
|
|
|
confirmButtonText: "确定",
|
|
|
|
|
confirmButtonClass: "confirmbtnFalses",
|
|
|
|
|
type: "warning",
|
|
|
|
|
center: true,
|
|
|
|
|
callback: action => {}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
addCash(this.formData).then(res => {
|
|
|
|
|
if (res.code == "000000") {
|
|
|
|
|
this.$message.success({
|
|
|
|
|
message: "验证成功 , 收银" + res.message
|
|
|
|
|
@ -2374,7 +2341,7 @@ export default {
|
|
|
|
|
money += debtMoney;
|
|
|
|
|
}
|
|
|
|
|
collectionRechargeAmountg =collectionRechargeAmountg+
|
|
|
|
|
item.collectionRechargeAmount.toFixed(2) * 1;
|
|
|
|
|
(item.collectionRechargeAmount.toFixed(2) * 1);
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|