|
|
@@ -111,7 +111,7 @@
|
|
|
style="margin-bottom: 20px"
|
|
|
:prop="'datasource.' + scope.$index + '.totalCount'"
|
|
|
:rules="{
|
|
|
- required: pageName == 'businessOpportunity' ? false : true,
|
|
|
+ required: false,
|
|
|
pattern: numberReg,
|
|
|
message: '请输入数字',
|
|
|
trigger: 'blur'
|
|
|
@@ -129,7 +129,8 @@
|
|
|
v-slot:headerTotalCount="{ column }"
|
|
|
v-if="pageName != 'businessOpportunity'"
|
|
|
>
|
|
|
- <span class="is-required">{{ column.label }}</span>
|
|
|
+ <!-- class="is-required" -->
|
|
|
+ <span>{{ column.label }}</span>
|
|
|
</template>
|
|
|
<template
|
|
|
v-slot:headerSingleWeight="{ column }"
|
|
|
@@ -470,13 +471,14 @@
|
|
|
<template v-slot:singleWeight="scope">
|
|
|
<el-form-item
|
|
|
style="margin-bottom: 20px"
|
|
|
- :rules="{
|
|
|
- required: pricingWay==2,
|
|
|
- pattern: numberReg,
|
|
|
- trigger: ['change','blur']
|
|
|
- }"
|
|
|
- :prop="'datasource.' + scope.$index + '.singleWeight'"
|
|
|
+
|
|
|
>
|
|
|
+ <!-- :rules="{
|
|
|
+ required: pricingWay==2,
|
|
|
+ pattern: numberReg,
|
|
|
+ trigger: ['change','blur']
|
|
|
+ }"
|
|
|
+ :prop="'datasource.' + scope.$index + '.singleWeight'"-->
|
|
|
<el-input
|
|
|
:disabled="isContractId"
|
|
|
v-model="scope.row.singleWeight"
|
|
|
@@ -682,7 +684,7 @@ export default {
|
|
|
prop: 'singleWeight',
|
|
|
label: '单重',
|
|
|
slot: 'singleWeight',
|
|
|
- headerSlot: 'headerSingleWeight',
|
|
|
+ // headerSlot: 'headerSingleWeight',
|
|
|
align: "center"
|
|
|
},
|
|
|
{
|
|
|
@@ -1002,15 +1004,16 @@ export default {
|
|
|
getNumTotalPrice(sum = 0) {
|
|
|
this.form.datasource.forEach((r, index) => {
|
|
|
this.$set(r, 'discountSinglePrice', r.singlePrice ? Number(r.singlePrice) : '')
|
|
|
- if (r.singlePrice && r.totalCount) {
|
|
|
+ if (r.singlePrice) {
|
|
|
+ //&& r.totalCount
|
|
|
r.totalPrice = this.getAllPrice(r);
|
|
|
r.discountTotalPrice = this.getDiscountTotalPrice(r);
|
|
|
this.$set(this.form.datasource[index], 'totalPrice', Number(r.totalPrice))
|
|
|
this.$set(this.form.datasource[index], 'discountTotalPrice', Number(r.discountTotalPrice))
|
|
|
sum += Number(r.totalPrice);
|
|
|
} else {
|
|
|
- this.$set(r, 'totalPrice', '')
|
|
|
- this.$set(r, 'discountTotalPrice', '')
|
|
|
+ this.$set(r, 'totalPrice', 0)
|
|
|
+ this.$set(r, 'discountTotalPrice', 0)
|
|
|
}
|
|
|
});
|
|
|
return isNaN(sum) ? 0 : sum
|
|
|
@@ -1021,7 +1024,12 @@ export default {
|
|
|
},
|
|
|
//设置优惠总金额修改产品单价
|
|
|
discountInputByOrder(val) {
|
|
|
- this.form.discountTotalPrice = val
|
|
|
+ if (val > this.allPrice) {
|
|
|
+ this.form.discountTotalPrice = this.allPrice
|
|
|
+ this.$message.warning('优惠金额不能大于总计金额')
|
|
|
+ } else {
|
|
|
+ this.form.discountTotalPrice = val
|
|
|
+ }
|
|
|
//获取优惠金额和总计的差价
|
|
|
this.form.datasource.forEach((item) => {
|
|
|
if (val === 0) {
|
|
|
@@ -1044,7 +1052,7 @@ export default {
|
|
|
//获取折让单价
|
|
|
getDiscountSinglePrice(row) {
|
|
|
let num = Number(this.form.discountTotalPrice) / Number(this.allPrice) * Number(row.singlePrice)
|
|
|
- return isNaN(num) ? '' : num
|
|
|
+ return isNaN(num) ? 0 : num
|
|
|
},
|
|
|
//获取合计
|
|
|
getAllPrice(row) {
|
|
|
@@ -1064,13 +1072,13 @@ export default {
|
|
|
let num = 0
|
|
|
switch (this.pricingWay) {
|
|
|
case 1: //按数量计价计算折让合计
|
|
|
- num = Number(row.discountSinglePrice) * Number(row.totalCount)
|
|
|
+ num = Number(row.discountSinglePrice) * (Number(row.totalCount) || 0)
|
|
|
break;
|
|
|
case 2 ://按重量计价计算折让合计
|
|
|
- num = Number(row.discountSinglePrice) * Number(row.totalCount) * Number(row.singleWeight)
|
|
|
+ num = Number(row.discountSinglePrice) * (Number(row.totalCount) || 0) * (Number(row.singleWeight) || 0)
|
|
|
break;
|
|
|
}
|
|
|
- return isNaN(num) ? '' : num.toFixed(2)
|
|
|
+ return isNaN(num) ? 0 : num.toFixed(2)
|
|
|
},
|
|
|
//修改回显
|
|
|
putTableValue(data) {
|