|
|
@@ -626,7 +626,6 @@
|
|
|
placeholder="请输入"
|
|
|
type="number"
|
|
|
:min="0"
|
|
|
-
|
|
|
@input="handleCountChange(scope.row, scope.$index)"
|
|
|
>
|
|
|
<template slot="append">
|
|
|
@@ -759,9 +758,11 @@
|
|
|
</template>
|
|
|
|
|
|
<!-- 新增未税小记列模板 -->
|
|
|
- <template v-slot:untaxedSubtotal="{ row, $index }">
|
|
|
- <el-form-item :prop="'datasource.' + $index + '.untaxedSubtotal'">
|
|
|
- {{ (Number(row.untaxedSubtotal) || 0).toFixed(2) }}元
|
|
|
+ <template v-slot:quotationSubtotalBeforeTax="{ row, $index }">
|
|
|
+ <el-form-item
|
|
|
+ :prop="'datasource.' + $index + '.quotationSubtotalBeforeTax'"
|
|
|
+ >
|
|
|
+ {{ (Number(row.quotationSubtotalBeforeTax) || 0).toFixed(2) }}元
|
|
|
</el-form-item>
|
|
|
</template>
|
|
|
|
|
|
@@ -779,15 +780,16 @@
|
|
|
</template>
|
|
|
|
|
|
<!-- 含税单价改为含税小计 -->
|
|
|
- <template v-slot:includingTaxPrice="{ row, $index }">
|
|
|
- <el-form-item :prop="'datasource.' + $index + '.includingTaxPrice'">
|
|
|
- <el-input
|
|
|
- v-model="row.includingTaxPrice"
|
|
|
+ <template v-slot:quotationSubtotalTax="{ row, $index }">
|
|
|
+ <el-form-item :prop="'datasource.' + $index + '.quotationSubtotalTax'">
|
|
|
+ {{ (Number(row.quotationSubtotalTax) || 0).toFixed(2) }}元
|
|
|
+ <!-- <el-input
|
|
|
+ v-model="row.quotationSubtotalTax"
|
|
|
type="number"
|
|
|
placeholder="请输入"
|
|
|
>
|
|
|
<template slot="append">元</template>
|
|
|
- </el-input>
|
|
|
+ </el-input> -->
|
|
|
</el-form-item>
|
|
|
</template>
|
|
|
|
|
|
@@ -1032,9 +1034,9 @@
|
|
|
packagingFeeNotTaxed: '',
|
|
|
transportationFeeWithoutTax: '',
|
|
|
extraTax: '',
|
|
|
- includingTaxPrice: '',
|
|
|
+ quotationSubtotalTax: '',
|
|
|
// 新增未税小记字段
|
|
|
- untaxedSubtotal: ''
|
|
|
+ quotationSubtotalBeforeTax: ''
|
|
|
};
|
|
|
return {
|
|
|
levelList,
|
|
|
@@ -1180,7 +1182,7 @@
|
|
|
},
|
|
|
{
|
|
|
width: 150,
|
|
|
- prop: 'untaxedSubtotal',
|
|
|
+ prop: 'quotationSubtotalBeforeTax',
|
|
|
label: '未税小计',
|
|
|
slot: 'additionalTaxRate_untaxed',
|
|
|
align: 'center'
|
|
|
@@ -1194,9 +1196,9 @@
|
|
|
},
|
|
|
{
|
|
|
width: 150,
|
|
|
- prop: 'includingTaxPrice',
|
|
|
+ prop: 'quotationSubtotalTax',
|
|
|
label: '含税小计',
|
|
|
- slot: 'includingTaxPrice',
|
|
|
+ slot: 'quotationSubtotalTax',
|
|
|
align: 'center'
|
|
|
}
|
|
|
);
|
|
|
@@ -1593,36 +1595,6 @@
|
|
|
this.isDate = res.value;
|
|
|
}
|
|
|
});
|
|
|
-
|
|
|
- // 监听数据变化以重新计算含税单价
|
|
|
- let calculating = false;
|
|
|
- this.$watch(
|
|
|
- 'form.datasource',
|
|
|
- (newVal) => {
|
|
|
- newVal.forEach((row, index) => {
|
|
|
- // 为每个行项目添加监听器,但使用标志位避免循环
|
|
|
- this.$watch(
|
|
|
- () => [
|
|
|
- row.processingFeeBeforeTax,
|
|
|
- row.packagingFeeNotTaxed,
|
|
|
- row.transportationFeeWithoutTax,
|
|
|
- row.extraTax,
|
|
|
- row[this.countObj.countKey]
|
|
|
- ],
|
|
|
- () => {
|
|
|
- if (!calculating) {
|
|
|
- calculating = true;
|
|
|
- this.calculateIncludingTaxPrice(row, index);
|
|
|
- this.changeAll();
|
|
|
- calculating = false;
|
|
|
- }
|
|
|
- },
|
|
|
- { deep: true }
|
|
|
- );
|
|
|
- });
|
|
|
- },
|
|
|
- { immediate: true, deep: true }
|
|
|
- );
|
|
|
},
|
|
|
methods: {
|
|
|
handleCountChange(row, index) {
|
|
|
@@ -1778,15 +1750,10 @@
|
|
|
changeCount(row, index) {
|
|
|
if (!row) {
|
|
|
this.form.datasource = this.form.datasource.map((item, i) => {
|
|
|
- return changeCount(item, this.countObj, false, this.quoteType);
|
|
|
+ return changeCount(item, this.countObj, false);
|
|
|
});
|
|
|
} else {
|
|
|
- const updatedRow = changeCount(
|
|
|
- row,
|
|
|
- this.countObj,
|
|
|
- false,
|
|
|
- this.quoteType
|
|
|
- );
|
|
|
+ const updatedRow = changeCount(row, this.countObj, false);
|
|
|
this.$set(this.form.datasource, index, updatedRow);
|
|
|
}
|
|
|
|
|
|
@@ -1802,54 +1769,47 @@
|
|
|
}
|
|
|
} else {
|
|
|
this.getNotaxSinglePrice();
|
|
|
+ this.changeAll();
|
|
|
}
|
|
|
- this.changeAll();
|
|
|
});
|
|
|
},
|
|
|
|
|
|
// 计算含税小计(原含税单价逻辑)
|
|
|
calculateIncludingTaxPrice(row, index) {
|
|
|
+ console.log('row', row);
|
|
|
if (!row) return;
|
|
|
|
|
|
// 计算未税小记
|
|
|
- const untaxedSubtotal =
|
|
|
+ const quotationSubtotalBeforeTax =
|
|
|
(Number(row.processingFeeBeforeTax) || 0) +
|
|
|
(Number(row.packagingFeeNotTaxed) || 0) +
|
|
|
(Number(row.transportationFeeWithoutTax) || 0);
|
|
|
|
|
|
// 使用 $nextTick 确保响应式更新完成
|
|
|
this.$nextTick(() => {
|
|
|
- this.$set(row, 'untaxedSubtotal', untaxedSubtotal.toFixed(2));
|
|
|
+ this.$set(
|
|
|
+ row,
|
|
|
+ 'quotationSubtotalBeforeTax',
|
|
|
+ quotationSubtotalBeforeTax.toFixed(2)
|
|
|
+ );
|
|
|
|
|
|
// 计算含税小计
|
|
|
const taxRate = (Number(row.extraTax) || 0) / 100;
|
|
|
- const includingTaxPrice = untaxedSubtotal * (1 + taxRate);
|
|
|
- this.$set(row, 'includingTaxPrice', includingTaxPrice.toFixed(2));
|
|
|
-
|
|
|
- // 为生产加工类型计算totalPrice
|
|
|
- if (this.quoteType === 2) {
|
|
|
- const quantity = Number(row[this.countObj.countKey]) || 1;
|
|
|
- const totalPrice = includingTaxPrice * quantity;
|
|
|
- this.$set(row, 'totalPrice', totalPrice.toFixed(2));
|
|
|
-
|
|
|
- // 强制更新总计
|
|
|
- this.$nextTick(() => {
|
|
|
- this.changeAll();
|
|
|
- });
|
|
|
- }
|
|
|
+ const quotationSubtotalTax =
|
|
|
+ quotationSubtotalBeforeTax * (1 + taxRate);
|
|
|
+ this.$set(
|
|
|
+ row,
|
|
|
+ 'quotationSubtotalTax',
|
|
|
+ quotationSubtotalTax.toFixed(2)
|
|
|
+ );
|
|
|
+ const quantity = Number(row[this.countObj.countKey]) || 1;
|
|
|
+ const totalPrice = quotationSubtotalTax * quantity;
|
|
|
+ this.$set(row, 'totalPrice', totalPrice.toFixed(2));
|
|
|
+ this.changeAll();
|
|
|
});
|
|
|
},
|
|
|
|
|
|
changeAll() {
|
|
|
- // 确保生产加工类型的行都有正确的totalPrice
|
|
|
- // if (this.quoteType === 2) {
|
|
|
- // this.form.datasource.forEach((row, index) => {
|
|
|
- // if (!row.totalPrice || row.totalPrice === '0.00') {
|
|
|
- // this.calculateIncludingTaxPrice(row, index);
|
|
|
- // }
|
|
|
- // });
|
|
|
- // }
|
|
|
-
|
|
|
this.allPrice = getAllPrice(this.form.datasource) || 0;
|
|
|
if (this.isDiscountTotalPrice) {
|
|
|
this.form.discountTotalPrice = this.allPrice;
|
|
|
@@ -1944,10 +1904,6 @@
|
|
|
if (item.colorKey) {
|
|
|
item.colorKey = item.colorKey.split(',');
|
|
|
}
|
|
|
- item.pricingWay =
|
|
|
- item.pricingWay ||
|
|
|
- data.pricingWay ||
|
|
|
- data?.contractVO?.pricingWay;
|
|
|
|
|
|
item.guaranteePeriodUnitCode = item.guaranteePeriodUnitCode
|
|
|
? item.guaranteePeriodUnitCode + ''
|
|
|
@@ -1973,38 +1929,6 @@
|
|
|
// }
|
|
|
item['customerMark'] = item.customerMark || this.customerMark;
|
|
|
item['arrivalWay'] = item.arrivalWay || 1;
|
|
|
-
|
|
|
- // 当quoteType为2时,数量默认设置为1
|
|
|
- if (
|
|
|
- this.quoteType === 2 &&
|
|
|
- item[this.countObj.countKey] === undefined
|
|
|
- ) {
|
|
|
- item[this.countObj.countKey] = 1;
|
|
|
- }
|
|
|
-
|
|
|
- // 初始化生产加工特有字段及未税小记
|
|
|
- if (this.quoteType === 2) {
|
|
|
- item.thickNess = item.thickNess || '';
|
|
|
- item.squareNumber = item.squareNumber || '';
|
|
|
- item.processingFeeBeforeTax = item.processingFeeBeforeTax || '';
|
|
|
- item.packagingFeeNotTaxed = item.packagingFeeNotTaxed || '';
|
|
|
- item.transportationFeeWithoutTax =
|
|
|
- item.transportationFeeWithoutTax || '';
|
|
|
- item.extraTax = item.extraTax || '13'; // 设置默认税率
|
|
|
- // 强制计算一次
|
|
|
- const untaxedSubtotal =
|
|
|
- (Number(item.processingFeeBeforeTax) || 0) +
|
|
|
- (Number(item.packagingFeeNotTaxed) || 0) +
|
|
|
- (Number(item.transportationFeeWithoutTax) || 0);
|
|
|
- item.untaxedSubtotal = untaxedSubtotal.toFixed(2);
|
|
|
-
|
|
|
- const taxRate = (Number(item.extraTax) || 0) / 100;
|
|
|
- const includingTaxPrice = untaxedSubtotal * (1 + taxRate);
|
|
|
- item.includingTaxPrice = includingTaxPrice.toFixed(2);
|
|
|
-
|
|
|
- const quantity = Number(item[this.countObj.countKey]) || 1;
|
|
|
- item.totalPrice = (includingTaxPrice * quantity).toFixed(2);
|
|
|
- }
|
|
|
});
|
|
|
this.form.datasource = productList;
|
|
|
|
|
|
@@ -2038,11 +1962,6 @@
|
|
|
data.payAmount || data?.contractVO?.discountTotalPrice;
|
|
|
}
|
|
|
this.$refs.table.reload();
|
|
|
-
|
|
|
- // 额外确保计算一次
|
|
|
- this.$nextTick(() => {
|
|
|
- this.changeAll();
|
|
|
- });
|
|
|
}
|
|
|
},
|
|
|
|
|
|
@@ -2099,8 +2018,12 @@
|
|
|
this.$set(parasm, 'pricingWay', 1);
|
|
|
this.$set(parasm, 'goodsLevel', item.goodsLevel);
|
|
|
this.$set(parasm, 'guaranteePeriod', item.warrantyPeriod);
|
|
|
- this.$set(parasm, 'customerExpectDeliveryDeadline', dayjs(new Date()).format('YYYY-MM-DD'))
|
|
|
-
|
|
|
+ this.$set(
|
|
|
+ parasm,
|
|
|
+ 'customerExpectDeliveryDeadline',
|
|
|
+ dayjs(new Date()).format('YYYY-MM-DD')
|
|
|
+ );
|
|
|
+
|
|
|
if (item.modelKey) {
|
|
|
this.$set(parasm, 'modelKey', item.modelKey.split(','));
|
|
|
}
|
|
|
@@ -2126,7 +2049,7 @@
|
|
|
)
|
|
|
);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
this.$set(
|
|
|
parasm,
|
|
|
'packageDispositionList',
|
|
|
@@ -2166,9 +2089,10 @@
|
|
|
this.$set(parasm, 'singlePrice', parasm.singlePrice || 0);
|
|
|
}
|
|
|
|
|
|
+ // 初始化生产加工特有字段及未税小记
|
|
|
// 当quoteType为2时,数量默认设置为1
|
|
|
if (this.quoteType === 2) {
|
|
|
- this.$set(parasm, this.countObj.countKey, 1);
|
|
|
+ this.processSetValue(parasm);
|
|
|
}
|
|
|
|
|
|
if (this.isSupplier) {
|
|
|
@@ -2195,18 +2119,6 @@
|
|
|
}
|
|
|
this.$set(parasm, 'provenance', item.purchaseOrigins || []);
|
|
|
|
|
|
- // 初始化生产加工特有字段及未税小记
|
|
|
- if (this.quoteType === 2) {
|
|
|
- parasm.thickNess = '';
|
|
|
- parasm.squareNumber = '';
|
|
|
- parasm.processingFeeBeforeTax = '';
|
|
|
- parasm.packagingFeeNotTaxed = '';
|
|
|
- parasm.transportationFeeWithoutTax = '';
|
|
|
- parasm.extraTax = 13;
|
|
|
- parasm.untaxedSubtotal = '0.00';
|
|
|
- parasm.includingTaxPrice = '';
|
|
|
- }
|
|
|
-
|
|
|
if (idx == -1) {
|
|
|
this.form.datasource.push(row);
|
|
|
}
|
|
|
@@ -2307,23 +2219,11 @@
|
|
|
}
|
|
|
this.$set(parasm, 'provenance', item.purchaseOrigins || []);
|
|
|
|
|
|
- // 当quoteType为2时,数量默认设置为1
|
|
|
- if (this.quoteType === 2) {
|
|
|
- this.$set(parasm, this.countObj.countKey, 1);
|
|
|
- }
|
|
|
-
|
|
|
// 初始化生产加工特有字段及未税小记
|
|
|
+ // 当quoteType为2时,数量默认设置为1
|
|
|
if (this.quoteType === 2) {
|
|
|
- parasm.thickNess = '';
|
|
|
- parasm.squareNumber = '';
|
|
|
- parasm.processingFeeBeforeTax = '';
|
|
|
- parasm.packagingFeeNotTaxed = '';
|
|
|
- parasm.transportationFeeWithoutTax = '';
|
|
|
- parasm.extraTax = '';
|
|
|
- parasm.untaxedSubtotal = '0.00';
|
|
|
- parasm.includingTaxPrice = '';
|
|
|
+ this.processSetValue(parasm);
|
|
|
}
|
|
|
-
|
|
|
if (idx == -1) {
|
|
|
this.form.datasource.push(row);
|
|
|
}
|
|
|
@@ -2347,25 +2247,25 @@
|
|
|
item.key = this.form.datasource.length + 1;
|
|
|
item.customerMark = this.customerMark;
|
|
|
|
|
|
- // 当quoteType为2时,数量默认设置为1
|
|
|
- if (this.quoteType === 2) {
|
|
|
- item[this.countObj.countKey] = 1;
|
|
|
- }
|
|
|
-
|
|
|
// 初始化生产加工特有字段及未税小记
|
|
|
+ // 当quoteType为2时,数量默认设置为1
|
|
|
if (this.quoteType === 2) {
|
|
|
- item.thickNess = '';
|
|
|
- item.squareNumber = '';
|
|
|
- item.processingFeeBeforeTax = '';
|
|
|
- item.packagingFeeNotTaxed = '';
|
|
|
- item.transportationFeeWithoutTax = '';
|
|
|
- item.extraTax = '';
|
|
|
- item.untaxedSubtotal = '0.00';
|
|
|
- item.includingTaxPrice = '';
|
|
|
+ this.processSetValue(item);
|
|
|
}
|
|
|
|
|
|
this.form.datasource.push(item);
|
|
|
},
|
|
|
+ processSetValue(parasm) {
|
|
|
+ this.$set(parasm, this.countObj.countKey, 1);
|
|
|
+ this.$set(parasm, 'thickNess', '');
|
|
|
+ this.$set(parasm, 'squareNumber', '');
|
|
|
+ this.$set(parasm, 'processingFeeBeforeTax', '');
|
|
|
+ this.$set(parasm, 'packagingFeeNotTaxed', '');
|
|
|
+ this.$set(parasm, 'transportationFeeWithoutTax', '');
|
|
|
+ this.$set(parasm, 'extraTax', 13);
|
|
|
+ this.$set(parasm, 'quotationSubtotalBeforeTax', '0.00');
|
|
|
+ this.$set(parasm, 'quotationSubtotalTax', '');
|
|
|
+ },
|
|
|
|
|
|
validateForm(callback) {
|
|
|
this.$refs.form.validate((valid, obj) => {
|