fixbug:收银调整
parent
a3b6a641f6
commit
c7ee670242
@ -0,0 +1,109 @@
|
||||
<template>
|
||||
<div class="flex">
|
||||
<div style="width:100%">
|
||||
<el-table :data="payLists" style="width:280px" class='border' show-summary
|
||||
:header-cell-style="{ background: 'linear-gradient(#6cb3ff, #1873d4)', color: '#eeeeee' }">
|
||||
<el-table-column align="center" prop="payName" min-width="100" label="支付方式"></el-table-column>
|
||||
<el-table-column align="center" prop="payMoney" min-width="80" label="本次支付 ">
|
||||
<template slot-scope="scope">
|
||||
<div v-if="payIndex != scope.$index" @click="editPay(scope.row, scope.$index)">
|
||||
{{ scope.row.payMoney }}
|
||||
<i class="text-cyan el-icon-edit"></i>
|
||||
</div>
|
||||
<el-input class="form-input-xs" v-else v-focus type="number" @blur="endEdit(scope.row, scope.$index,)"
|
||||
v-model="scope.row.payMoney" size="samll"></el-input>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
props:{
|
||||
form:{
|
||||
type:Object,
|
||||
default:{}
|
||||
},
|
||||
payLists:{
|
||||
type:Array,
|
||||
default:()=>[]
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
list: [], //主数组
|
||||
rechargeAccountList: [], //卡付列表
|
||||
recIndex: -1,
|
||||
giftIndex: -1,
|
||||
payIndex: -1,
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
//组件传值
|
||||
show(form, list) {
|
||||
},
|
||||
//选择金额.
|
||||
editPay(row, index) {
|
||||
this.payIndex = index;
|
||||
console.log(this.form)
|
||||
if (index = 0) {
|
||||
row.payMoney = (this.form.collectionCashAmounts + row.payMoney).toFixed(2) * 1;
|
||||
}
|
||||
else {
|
||||
let money = 0;
|
||||
var that = this;
|
||||
this.payLists.forEach((item) => {
|
||||
money += item.payMoney * 1;
|
||||
});
|
||||
row.payMoney = (this.form.collectionCashAmounts - money).toFixed(2) * 1;
|
||||
}
|
||||
|
||||
},
|
||||
endEdit(row, index) {
|
||||
this.payIndex = -1;
|
||||
let money = 0;
|
||||
var that = this;
|
||||
this.payLists.forEach((item) => {
|
||||
money += item.payMoney * 1;
|
||||
});
|
||||
if (!row.payMoney) {
|
||||
row.payMoney = 0;
|
||||
} else if (money > this.form.collectionCashAmounts) {
|
||||
this.$alert("输入之和不能大于现付金额", "提示", {
|
||||
confirmButtonText: "确定",
|
||||
confirmButtonClass: "confirmbtnFalses",
|
||||
type: "warning",
|
||||
center: true,
|
||||
callback: (action) => { },
|
||||
});
|
||||
row.payMoney = 0;
|
||||
} else if (row.payMoney < 0) {
|
||||
this.$alert("输入值不能小于0", "提示", {
|
||||
confirmButtonText: "确定",
|
||||
confirmButtonClass: "confirmbtnFalses",
|
||||
type: "warning",
|
||||
center: true,
|
||||
callback: (action) => { },
|
||||
});
|
||||
row.payMoney = 0;
|
||||
} else {
|
||||
row.payMoney = row.payMoney * 1;
|
||||
}
|
||||
this.sumNum();
|
||||
},
|
||||
sumNum() {
|
||||
let payMoney = 0;
|
||||
this.payLists.forEach((item) => {
|
||||
payMoney += item.payMoney * 1;
|
||||
});
|
||||
this.form.collectionCashAmount = payMoney;
|
||||
let form = { form: this.form, list: this.payLists };
|
||||
this.$emit("paymentData", form);
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
@ -0,0 +1,32 @@
|
||||
export const Mixins = {
|
||||
methods:{
|
||||
handleData(row){
|
||||
if(row){
|
||||
row.rechargeAccountList.forEach(firstItem=>{
|
||||
let list = []
|
||||
this.list.forEach(secondItem=>{
|
||||
secondItem.rechargeAccountList.forEach(thirdItem=>{
|
||||
if(thirdItem.id === firstItem.id){
|
||||
list.push(thirdItem)
|
||||
}
|
||||
})
|
||||
})
|
||||
// 本单使用总和
|
||||
this.$set(firstItem,'cardSum',eval(list.map(item=>item.spendMoney*1).join("+")))
|
||||
// 当前行可用
|
||||
this.$set(firstItem,'CardCurrentUse',firstItem.cardConsumeMoney*1 - firstItem.cardSum*1 + firstItem.spendMoney*1)
|
||||
// 可用余额
|
||||
this.$set(firstItem,'cardOvers',firstItem.CardCurrentUse*1 - firstItem.spendMoney*1)
|
||||
try{
|
||||
firstItem.cardSum = firstItem.cardSum.toFixed(2) * 1
|
||||
firstItem.CardCurrentUse = firstItem.CardCurrentUse.toFixed(2) * 1
|
||||
firstItem.cardOvers = firstItem.cardOvers.toFixed(2) * 1
|
||||
}catch(err){
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
return row
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue