|
@@ -155,7 +155,7 @@
|
|
|
<el-input
|
|
<el-input
|
|
|
type="number"
|
|
type="number"
|
|
|
:min="0"
|
|
:min="0"
|
|
|
- :disabled="type=='view'"
|
|
|
|
|
|
|
+ disabled
|
|
|
v-model="scope.row.price"
|
|
v-model="scope.row.price"
|
|
|
style="width: 100%"
|
|
style="width: 100%"
|
|
|
placeholder="请输入"
|
|
placeholder="请输入"
|
|
@@ -259,8 +259,8 @@
|
|
|
datasource: []
|
|
datasource: []
|
|
|
},
|
|
},
|
|
|
paymentTypeOp,
|
|
paymentTypeOp,
|
|
|
-
|
|
|
|
|
- rules: {}
|
|
|
|
|
|
|
+ rules: {},
|
|
|
|
|
+ isLoadingFromApi: false
|
|
|
};
|
|
};
|
|
|
},
|
|
},
|
|
|
computed: {
|
|
computed: {
|
|
@@ -268,9 +268,9 @@
|
|
|
return this.form.datasource.length;
|
|
return this.form.datasource.length;
|
|
|
},
|
|
},
|
|
|
showAddBtn() {
|
|
showAddBtn() {
|
|
|
- // console.log('showAddBtn~~~~', this.type, this.info.settlementMode);
|
|
|
|
|
|
|
+ // console.log('showAddBtn~~~~', this.type, this.info);
|
|
|
// console.log('showAddBtn!!!!',!['1', '2'].includes(this.info.settlementMode) || this.type != 'view');
|
|
// console.log('showAddBtn!!!!',!['1', '2'].includes(this.info.settlementMode) || this.type != 'view');
|
|
|
- return !(['1', '2'].includes(this.info?.settlementMode)) && this.type != 'view'
|
|
|
|
|
|
|
+ return !(['1', '2'].includes(this.info?.settlementMode)) && this.type != 'view'
|
|
|
},
|
|
},
|
|
|
columns() {
|
|
columns() {
|
|
|
return [
|
|
return [
|
|
@@ -357,15 +357,23 @@
|
|
|
},
|
|
},
|
|
|
watch: {
|
|
watch: {
|
|
|
discountAmount(newval) {
|
|
discountAmount(newval) {
|
|
|
- if (newval) {
|
|
|
|
|
|
|
+ if (newval && !this.isLoadingFromApi) {
|
|
|
this.refreshprice();
|
|
this.refreshprice();
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
info: {
|
|
info: {
|
|
|
handler(newval) {
|
|
handler(newval) {
|
|
|
- if (newval) {
|
|
|
|
|
- // this.form = newval;
|
|
|
|
|
- console.log('111111', newval.settlementMode);
|
|
|
|
|
|
|
+ if (newval && newval.receiptPaymentList) {
|
|
|
|
|
+ // Directly assign API data to table without calculation
|
|
|
|
|
+ this.isLoadingFromApi = true;
|
|
|
|
|
+ this.form.datasource = newval.receiptPaymentList;
|
|
|
|
|
+ if (newval.payAmount) {
|
|
|
|
|
+ this.discountAmount = newval.payAmount;
|
|
|
|
|
+ }
|
|
|
|
|
+ // Reset flag after a short delay to avoid affecting subsequent user changes
|
|
|
|
|
+ setTimeout(() => {
|
|
|
|
|
+ this.isLoadingFromApi = false;
|
|
|
|
|
+ }, 100);
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
deep: true
|
|
deep: true
|
|
@@ -374,27 +382,33 @@
|
|
|
methods: {
|
|
methods: {
|
|
|
setDiscountAmount(val) {
|
|
setDiscountAmount(val) {
|
|
|
console.log(val, '000000');
|
|
console.log(val, '000000');
|
|
|
|
|
+ this.isLoadingFromApi = true;
|
|
|
this.discountAmount = val;
|
|
this.discountAmount = val;
|
|
|
|
|
+ setTimeout(() => {
|
|
|
|
|
+ this.isLoadingFromApi = false;
|
|
|
|
|
+ }, 100);
|
|
|
},
|
|
},
|
|
|
typeChange(val, index = null) {
|
|
typeChange(val, index = null) {
|
|
|
- console.log(val, index, '55555');
|
|
|
|
|
|
|
+ // console.log(val, index, '55555');
|
|
|
if (val) {
|
|
if (val) {
|
|
|
this.$set(this.form.datasource[index], 'typeName', this.paymentTypeOp.find(item => item.value === val).label);
|
|
this.$set(this.form.datasource[index], 'typeName', this.paymentTypeOp.find(item => item.value === val).label);
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
//输入比例更新金额
|
|
//输入比例更新金额
|
|
|
async ratioInput(val, index = null) {
|
|
async ratioInput(val, index = null) {
|
|
|
- console.log(this.discountAmount, '77777');
|
|
|
|
|
|
|
+ // console.log(this.discountAmount, '77777');
|
|
|
|
|
+ // console.log(val, '5555555');
|
|
|
val = Number(val);
|
|
val = Number(val);
|
|
|
try {
|
|
try {
|
|
|
if (index != null) {
|
|
if (index != null) {
|
|
|
await this.checkRatio();
|
|
await this.checkRatio();
|
|
|
}
|
|
}
|
|
|
let newval = (val / 100).toFixed(2);
|
|
let newval = (val / 100).toFixed(2);
|
|
|
|
|
+ // console.log('newval~~~', newval)
|
|
|
let price = (this.discountAmount * newval).toFixed(2);
|
|
let price = (this.discountAmount * newval).toFixed(2);
|
|
|
- console.log(newval, price, index, '88888');
|
|
|
|
|
|
|
+ // console.log(newval, price, index, '88888');
|
|
|
if (index != null) {
|
|
if (index != null) {
|
|
|
- console.log(newval, price, index, '999999');
|
|
|
|
|
|
|
+ // console.log(newval, price, index, '999999');
|
|
|
this.$set(this.form.datasource[index], 'price', price);
|
|
this.$set(this.form.datasource[index], 'price', price);
|
|
|
} else {
|
|
} else {
|
|
|
return price;
|
|
return price;
|
|
@@ -415,7 +429,7 @@
|
|
|
sum += Number(r.ratio);
|
|
sum += Number(r.ratio);
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
- console.log(sum, '3333333');
|
|
|
|
|
|
|
+ // console.log(sum, '3333333');
|
|
|
if (sum > 100) {
|
|
if (sum > 100) {
|
|
|
this.$message.error('总共比例不能超过100');
|
|
this.$message.error('总共比例不能超过100');
|
|
|
this.$set(
|
|
this.$set(
|
|
@@ -435,7 +449,7 @@
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|
|
|
refreshprice() {
|
|
refreshprice() {
|
|
|
- console.log(this.form, '666666');
|
|
|
|
|
|
|
+ // console.log(this.form, '666666');
|
|
|
let newData = this.form.datasource;
|
|
let newData = this.form.datasource;
|
|
|
newData.forEach(async (r, index) => {
|
|
newData.forEach(async (r, index) => {
|
|
|
if (r.ratio) {
|
|
if (r.ratio) {
|
|
@@ -450,7 +464,7 @@
|
|
|
},
|
|
},
|
|
|
//修改回显
|
|
//修改回显
|
|
|
putTableValue(data) {
|
|
putTableValue(data) {
|
|
|
- console.log('data~~~~', data);
|
|
|
|
|
|
|
+ console.log('data~~~~111', data);
|
|
|
if (data) {
|
|
if (data) {
|
|
|
this.form.datasource = data.receiptPaymentList;
|
|
this.form.datasource = data.receiptPaymentList;
|
|
|
this.setDiscountAmount(data.payAmount);
|
|
this.setDiscountAmount(data.payAmount);
|