master
wangxubin1999 3 years ago
parent b123386cb2
commit 79a4cafb87

@ -231,31 +231,31 @@ export default {
this.managerOptions.forEach((item, index) => {
if (item.id == data) {
item.ratio = 100;
form[text] = [];
form[text].push(item);
form.texts = item.label;
row[text] = [];
row[text].push(item);
row.texts = item.label;
}
});
} else if (text == "adminList") {
this.adminOptions.forEach((item, index) => {
if (item.id == data) {
item.ratio = 100;
form[text] = [];
form[text].push(item);
form.texts = item.label;
row[text] = [];
row[text].push(item);
row.texts = item.label;
}
});
} else {
this.options.forEach((item, index) => {
if (item.id == data) {
item.ratio = 100;
form[text] = [];
form[text].push(item);
form.texts = item.label;
row[text] = [];
row[text].push(item);
row.texts = item.label;
}
});
}
this.list.splice(row.index, 1, form);
// this.list.splice(row.index, 1, form);
},
staffratioData(v) {
console.log(v);
@ -267,9 +267,9 @@ export default {
},
clear(row, text) {
let form = { ...row };
form[text] = [];
row[text] = [];
console.log(form);
this.list.splice(row.index, 1, form);
// this.list.splice(row.index, 1, form);
},
//
openPro(row) {

@ -612,7 +612,7 @@
<span class=" ">现付金额:</span>
<span class="text-red text-price">
<!-- {{ form.collectionCashAmounts }} -->
{{ appearPrice }}
{{ appearPrices }}
</span>
</div>
</div>
@ -721,7 +721,6 @@ export default {
projectIndex: 0,
recListCopy: [], //
recForm: {},
projectList: [],
memberForm: {}, //
notMemberForm: {},
expand: [],
@ -751,11 +750,36 @@ export default {
money:0,
card1:0,
card2:0,
card3:0,
card4:0,
};
},
computed: {
//
appearPrices() {
/*
      现付金额 = 项目金额transactionPrice - 卡付抵扣金额collectionAmounts
      需要转换下number格式,不然是字符串拼接
      */
let num = this.list.reduce((pre, item) => {
item.transactionPrice = item.transactionPrice
?(item.transactionPrice*1).toFixed(2) * 1
: 0; // ,
if (item.collectionAmounts) {
item.collectionAmounts = (item.collectionAmounts*1).toFixed(2) * 1;
return pre + (item.transactionPrice - item.collectionAmounts);
} // ,
else if (!item.collectionAmounts && item.transactionPrice) {
return item.transactionPrice + pre; //
} else {
return pre + 0;
}
}, 0);
return num.toFixed(2);
},
appearPrice() {
/*
      现付金额 = 项目金额transactionPrice - 卡付抵扣金额collectionAmounts
@ -764,10 +788,13 @@ export default {
let num = this.list.reduce((pre, item) => {
item.transactionPrice = item.transactionPrice
? parseInt(item.transactionPrice)
?(item.transactionPrice*1).toFixed(2) * 1
: 0; // ,
if(item.isCardPay !== 0){
return pre
}
if (item.collectionAmounts) {
item.collectionAmounts = parseInt(item.collectionAmounts);
item.collectionAmounts = (item.collectionAmounts*1).toFixed(2) * 1;
return pre + (item.transactionPrice - item.collectionAmounts);
} // ,
else if (!item.collectionAmounts && item.transactionPrice) {
@ -787,20 +814,20 @@ export default {
let total = this.list.reduce((pre, item) => {
item.transactionPrice = item.transactionPrice
? parseInt(item.transactionPrice)
? (item.transactionPrice*1).toFixed(2) * 1
: 0; // /
if (item.transactionPrice && item.collectionAmounts) {
item.collectionRechargeAmount = item.collectionRechargeAmount
? parseInt(item.collectionRechargeAmount)
? (item.collectionRechargeAmount*1).toFixed(2) * 1
: 0;
item.collectionAmounts = item.collectionAmounts
? parseInt(item.collectionAmounts)
? (item.collectionAmounts*1).toFixed(2) * 1
: 0;
return (
pre +
(item.transactionPrice -
item.collectionAmounts +
item.collectionRechargeAmount)
item.collectionRechargeAmount*1).toFixed(2) * 1
); //
} else if (item.transactionPrice) {
return pre + item.transactionPrice; //
@ -816,6 +843,7 @@ export default {
this.projectIndex = index;
},
changeMember() {
console.log("-------------------------")
if (this.cashNumber == 1) {
Object.assign(this.$data, this.$options.data.call(this));
this.cashNumber = 0;
@ -842,7 +870,6 @@ export default {
"--------------------------------------------------------------------------------------"
)
console.log("🚀 ~ file: service.vue ~ line 843 ~ editcard ~ this.rowRecList[index].type", this.rowRecList[index].type)
if(this.rowRecList[index].type == 1){
if (this.list[this.projectIndex].noDiscount == 1) {
@ -891,12 +918,14 @@ 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;
} else {
@ -920,10 +949,15 @@ export default {
// }
}
}
this.card1=this.rowRecList[index].cardOvers;
this.card2=this.rowRecList[index].cardGiftOvers;
this.rowRecList[index].cardOvers=(this.rowRecList[index].cardOvers-this.rowRecList[index].spendMoney).toFixed(2) * 1
this.rowRecList[index].cardGiftOvers=(this.rowRecList[index].cardGiftOvers-this.rowRecList[index].giftSpendMoney).toFixed(2) * 1
this.card1=this.rowRecList[index].spendMoney;
this.card4=this.rowRecList[index].spendMoney;
this.card2=this.rowRecList[index].giftSpendMoney;
this.card3=this.rowRecList[index].spendMoney;
this.rowRecList[index].cardOvers=(this.rowRecList[index].cardOver-this.rowRecList[index].spendMoney).toFixed(2) * 1
this.rowRecList[index].cardOver=(this.rowRecList[index].cardOver-this.rowRecList[index].spendMoney).toFixed(2) * 1
this.rowRecList[index].cardGiftOvers=(this.rowRecList[index].giftConsumeMoney-this.rowRecList[index].giftSpendMoney).toFixed(2) * 1
this.rowRecList[index].giftConsumeMoney=(this.rowRecList[index].giftConsumeMoney-this.rowRecList[index].giftSpendMoney).toFixed(2) * 1
if(this.rowRecList[index].cardOvers<0){
this.$message.info({
message: "此卡可用余额不足。"
@ -941,6 +975,7 @@ export default {
this.rowRecList[index].cardGiftOvers=0
}
// }
// this.recIndex = -1;
},
endEditcard(row, index) {
this.recForm.cashAmount = 0;
@ -955,8 +990,19 @@ export default {
let debtMoney =
(this.recForm.amount * 1 - this.recForm.cashAmount * 1).toFixed(2) * 1; //
let form = { ...row }; //row
form.cardGiftOvers=this.card2
form.cardOvers=this.card1
if(form.spendMoney>this.card4){
this.$message.info({
message: "卡付金额大于项目金额"
});
form.spendMoney=this.card4
}
if(form.spendMoney<0){
this.$message.info({
message: "卡付金额不能小于0"
});
form.spendMoney=0
}
console.log("🚀 ~ file: service.vue ~ line 964 ~ endEditcard ~ form", form)
if (debtMoney > 0) {
//0
if (form.type == 2 || form.type == 0) {
@ -1009,20 +1055,17 @@ export default {
form.discoutMoney =
((form.spendMoney * 1) / (form.discount / 100)).toFixed(2) *
1; //
form.giftSpendMoney =(((form.spendMoney * 1) / recRatio) * recGiftRatio).toFixed(2) * 1; //
// form.giftSpendMoney =
// (((form.spendMoney * 1) / recRatio) * recGiftRatio).toFixed(
// 2
// ) * 1; //
// console.log("🚀 ~ file: service.vue ~ line 986 ~ endEditcard ~ form.giftSpendMoney", form.giftSpendMoney)
form.discoutGiftMoney =
(
form.giftSpendMoney /
(form.discountFreeAmount / 100)
).toFixed(2) * 1; //
if(this.card3==form.spendMoney){
form.giftSpendMoney =this.card2; //
form.discoutGiftMoney =
(this.appearPrice * 1-form.discoutMoney*1).toFixed(2) * 1;
}else{
form.giftSpendMoney =(((form.spendMoney * 1) / recRatio) * recGiftRatio).toFixed(2) * 1; //
form.discoutGiftMoney =
((form.giftSpendMoney * 1) / (form.discountFreeAmount / 100)).toFixed(2) *
1;
}
} else {
//
form.discoutMoney = (form.spendMoney*1).toFixed(2) * 1; //
@ -1055,23 +1098,12 @@ export default {
//
form.discoutMoney =
(form.spendMoney / (form.discount / 100)).toFixed(2) * 1;
this.projectMomey =
(this.projectMomey + form.discoutMoney).toFixed(2) * 1;
console.log(
"🚀 ~ file: service.vue ~ line 557 ~ endEditcard ~ form.spendMoney",
form.spendMoney
);
console.log(
"🚀 ~ file: service.vue ~ line 556 ~ endEditcard ~ form.discoutMoney",
form.discoutMoney
);
} else {
//
form.discoutMoney = form.spendMoney;
}
form.discoutGiftMoney = 0;
form.giftSpendMoney = 0;
}
if (
form.discoutGiftMoney + form.discoutMoney >
@ -1081,22 +1113,24 @@ export default {
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 (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.cardOvers-form.spendMoney).toFixed(2) * 1
console.log("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
form.cardGiftOvers=(form.cardGiftOvers-form.giftSpendMoney).toFixed(2) * 1
console.l
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
form.giftConsumeMoney=(form.giftConsumeMoney+(this.card2-form.giftSpendMoney)).toFixed(2) * 1
this.card1=form.spendMoney;
this.card2=form.giftSpendMoney
if(form.cardOvers<0){
this.$message.info({
message: "此卡可用余额不足。"
@ -1123,8 +1157,11 @@ export default {
this.list.forEach(item => {
num = (num + item.collectionCashAmounts).toFixed(2) * 1;
});
console.log("🚀 ~ file: service.vue ~ line 1161 ~ endEditcard ~ num", num)
this.form.collectionCashAmounts = num;
this.sumNum();
},
sumNum() {
@ -1136,7 +1173,12 @@ export default {
(
spendMoney +
(item.discoutMoney * 1 + item.discoutGiftMoney * 1) * 1
).toFixed(2) * 1;
console.log("🚀 ~ file: service.vue ~ line 1134 ~ sumNum ~ item.discoutMoney", item.discoutMoney)
console.log("🚀 ~ file: service.vue ~ line 1134 ~ sumNum ~ item.discoutGiftMoney", item.discoutGiftMoney)
spendNumber =
(
@ -1600,11 +1642,13 @@ export default {
).toFixed(2) * 1;
}
});
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.form.collectionCashAmounts - sumMoney).toFixed(2) * 1 ||
(this.form.collectionCashAmounts - sumMoney).toFixed(2) * 1 < 0
(this.appearPrices*1 - sumMoney).toFixed(2) * 1 ||
(this.appearPrices*1 - sumMoney).toFixed(2) * 1 < 0
) {
flag = false;
this.$alert("实付金额不等于项目金额", "提示", {
@ -1614,6 +1658,8 @@ export default {
center: true,
callback: action => {}
});
}
if (this.isAddition == 1 && !this.additionDate) {
flag = false;
@ -1652,8 +1698,10 @@ export default {
}
}
},
addCashConfirm() {
let list = [];
console.log("🚀 ~ file: service.vue ~ line 1728 ~ addCashConfirm ~ this.list", this.list)
this.list.forEach(item => {
if (item.courseAccountId == null) {
item.collectionCashAmount =
@ -1716,14 +1764,24 @@ export default {
list.push(item);
}
});
let collectionAmountsum=0
list.forEach(item => {
item.collectionAmount = item.collectionAmounts;
collectionAmountsum=item.collectionAmount*1+collectionAmountsum*1;
});
this.formData.append("cashListRequestList", JSON.stringify(list));
addCash(this.formData).then(res => {
// collectionAmount
if(collectionAmountsum==0){
this.$alert("还未进行支付", "提示", {
confirmButtonText: "确定",
confirmButtonClass: "confirmbtnFalses",
type: "warning",
center: true,
callback: action => {}
});
this.formData = new FormData();
}else{
addCash(this.formData).then(res => {
if (res.code == "000000") {
this.$message.success({
message: "验证成功 , 收银" + res.message
@ -1745,6 +1803,10 @@ export default {
this.formData = new FormData();
}
});
}
},
openStaffRatio(row, index, text) {
this.editIndex = index;
@ -1775,6 +1837,7 @@ export default {
collectionCashAmounts: 0
};
this.projectMomey = 0;
this.recIndex = -1;
this.list.push(list);
},
delPro(row) {
@ -1889,7 +1952,6 @@ export default {
// courseAccountId
couAccountList(memberIds).then(res => {
if (res.code == "000000") {
this.projectList = res.rows;
if (res.rows.length != 0) {
this.list.forEach(items1 => {
res.rows.forEach(items => {
@ -2283,7 +2345,7 @@ export default {
).toFixed(2) * 1;
money += debtMoney;
}
collectionRechargeAmountg +=
collectionRechargeAmountg =collectionRechargeAmountg+
item.collectionRechargeAmount.toFixed(2) * 1;
console.log(
"🚀 ~ file: service.vue ~ line 1764 ~ this.list.forEach ~ collectionRechargeAmountg",

Loading…
Cancel
Save