|
|
@@ -282,6 +282,8 @@
|
|
|
v-model="scope.row.taxRate"
|
|
|
placeholder="请输入"
|
|
|
type="number"
|
|
|
+ @input="getNotaxSinglePrice"
|
|
|
+
|
|
|
>
|
|
|
<template slot="append">%</template>
|
|
|
</el-input>
|
|
|
@@ -498,7 +500,7 @@
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
</template>
|
|
|
- <template v-slot:orderNo="{ row , $index}">
|
|
|
+ <template v-slot:orderNo="{ row, $index }">
|
|
|
<el-form-item :prop="'datasource.' + $index + '.orderNo'">
|
|
|
<el-select v-model="row.orderNo" style="width: 100%">
|
|
|
<el-option
|
|
|
@@ -514,6 +516,53 @@
|
|
|
<template v-slot:headerPricingWay="{ column }">
|
|
|
<span class="is-required">{{ column.label }}</span>
|
|
|
</template>
|
|
|
+
|
|
|
+ <template v-slot:saleCount="scope">
|
|
|
+ <el-form-item
|
|
|
+ style="margin-bottom: 20px"
|
|
|
+ :prop="'datasource.' + scope.$index + '.' + countObj.countKey"
|
|
|
+ :rules="{
|
|
|
+ required: isTotalCount ? true : false,
|
|
|
+ message: '请输入数量',
|
|
|
+ trigger: 'change'
|
|
|
+ }"
|
|
|
+ >
|
|
|
+ <el-input
|
|
|
+ v-model="scope.row[countObj.countKey]"
|
|
|
+ placeholder="请输入"
|
|
|
+ type="number"
|
|
|
+ :min="0"
|
|
|
+ @input="changeCount(scope.row, scope.$index)"
|
|
|
+ >
|
|
|
+ </el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </template>
|
|
|
+ <template v-slot:saleUnit="scope">
|
|
|
+ <el-form-item
|
|
|
+ style="margin-bottom: 20px"
|
|
|
+ :prop="'datasource.' + scope.$index + '.' + countObj.unitIdKey"
|
|
|
+ :rules="{
|
|
|
+ required: isTotalCount ? true : false,
|
|
|
+ message: '请选择单位',
|
|
|
+ trigger: 'change'
|
|
|
+ }"
|
|
|
+ >
|
|
|
+ <el-select
|
|
|
+ v-model="scope.row[countObj.unitIdKey]"
|
|
|
+ style="width: 100%"
|
|
|
+ @change="changeCount(scope.row, scope.$index)"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ :label="item.conversionUnit"
|
|
|
+ :value="item.id"
|
|
|
+ @click.native="packingChange(item, scope.$index)"
|
|
|
+ v-for="(item, index) in scope.row.packageDispositionList"
|
|
|
+ :key="index"
|
|
|
+ ></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </template>
|
|
|
+
|
|
|
<!-- 操作列 -->
|
|
|
<template v-slot:action="scope">
|
|
|
<el-popconfirm
|
|
|
@@ -558,7 +607,7 @@
|
|
|
import { getByCode } from '@/api/system/dictionary-data';
|
|
|
// import fileMain from '@/components/addDoc/index.vue';
|
|
|
import { pricingWayList, lbjtList } from '@/enum/dict.js';
|
|
|
- import { changeCount } from '@/BIZComponents/setProduct.js';
|
|
|
+ import { changeCount, getAllPrice } from '@/BIZComponents/setProduct.js';
|
|
|
import { getInventoryTotalAPI } from '@/api/bpm/components/wms/index.js';
|
|
|
// import taskinstanceDialog from '@/BIZComponents/procedure/taskinstanceDialog.vue';
|
|
|
|
|
|
@@ -652,6 +701,16 @@
|
|
|
default: () => {
|
|
|
return [];
|
|
|
}
|
|
|
+ },
|
|
|
+ countObj: {
|
|
|
+ type: Object,
|
|
|
+ default: () => {
|
|
|
+ return {
|
|
|
+ countKey: 'saleCount',
|
|
|
+ unitKey: 'saleUnit',
|
|
|
+ unitIdKey: 'saleUnitId'
|
|
|
+ };
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
data() {
|
|
|
@@ -802,12 +861,42 @@
|
|
|
},
|
|
|
{
|
|
|
width: 150,
|
|
|
- prop: 'totalCount',
|
|
|
+ prop: 'saleCount',
|
|
|
label: '数量',
|
|
|
- slot: 'totalCount',
|
|
|
+ slot: 'saleCount',
|
|
|
+ headerSlot: 'headerTotalCount',
|
|
|
+ align: 'center'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ width: 150,
|
|
|
+ prop: 'saleUnit',
|
|
|
+ label: '单位',
|
|
|
+ slot: 'saleUnit',
|
|
|
headerSlot: 'headerTotalCount',
|
|
|
align: 'center'
|
|
|
},
|
|
|
+ {
|
|
|
+ width: 150,
|
|
|
+ prop: 'totalCount',
|
|
|
+ label: '计量数量',
|
|
|
+ // slot: 'totalCount',
|
|
|
+ // headerSlot: 'headerTotalCount',
|
|
|
+ align: 'center'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ width: 120,
|
|
|
+ prop: 'measuringUnit',
|
|
|
+ label: '计量单位',
|
|
|
+ slot: 'measuringUnit',
|
|
|
+ align: 'center'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ width: 120,
|
|
|
+ prop: 'packingSpecification',
|
|
|
+ align: 'center',
|
|
|
+ label: '包装规格',
|
|
|
+ showOverflowTooltip: true
|
|
|
+ },
|
|
|
{
|
|
|
width: 110,
|
|
|
prop: 'batchNo',
|
|
|
@@ -830,13 +919,7 @@
|
|
|
showOverflowTooltip: true,
|
|
|
minWidth: 200
|
|
|
},
|
|
|
- {
|
|
|
- width: 120,
|
|
|
- prop: 'measuringUnit',
|
|
|
- label: '计量单位',
|
|
|
- slot: 'measuringUnit',
|
|
|
- align: 'center'
|
|
|
- },
|
|
|
+
|
|
|
{
|
|
|
width: 120,
|
|
|
prop: 'singleWeight',
|
|
|
@@ -860,14 +943,14 @@
|
|
|
align: 'center'
|
|
|
},
|
|
|
|
|
|
- {
|
|
|
- width: 160,
|
|
|
- prop: 'pricingWay',
|
|
|
- label: '计价方式',
|
|
|
- headerSlot: 'headerPricingWay',
|
|
|
- slot: 'pricingWay',
|
|
|
- align: 'center'
|
|
|
- },
|
|
|
+ // {
|
|
|
+ // width: 160,
|
|
|
+ // prop: 'pricingWay',
|
|
|
+ // label: '计价方式',
|
|
|
+ // headerSlot: 'headerPricingWay',
|
|
|
+ // slot: 'pricingWay',
|
|
|
+ // align: 'center'
|
|
|
+ // },
|
|
|
{
|
|
|
width: 200,
|
|
|
prop: 'singlePrice',
|
|
|
@@ -1031,10 +1114,14 @@
|
|
|
this.getDictList('productionType');
|
|
|
},
|
|
|
methods: {
|
|
|
- getDictV(code, val) {
|
|
|
- if (!this.dictList[code]) return '';
|
|
|
- return this.dictList[code].find((item) => item.value == val)?.label;
|
|
|
+ packingChange(item, index) {
|
|
|
+ this.$set(
|
|
|
+ this.form.datasource[index],
|
|
|
+ this.countObj.unitKey,
|
|
|
+ item.conversionUnit
|
|
|
+ );
|
|
|
},
|
|
|
+
|
|
|
async getDictList(code) {
|
|
|
let { data: res } = await getByCode(code);
|
|
|
this.dictList[code] = res.map((item) => {
|
|
|
@@ -1045,9 +1132,7 @@
|
|
|
};
|
|
|
});
|
|
|
},
|
|
|
- downloadFile(file) {
|
|
|
- getFile({ objectName: file.storePath }, file.name);
|
|
|
- },
|
|
|
+
|
|
|
openVersion(index) {
|
|
|
this.$refs.versionRefs.open(index);
|
|
|
},
|
|
|
@@ -1140,11 +1225,31 @@
|
|
|
},
|
|
|
//改变数量
|
|
|
changeCount(row, index) {
|
|
|
- const { allPrice, arr } = changeCount(row, index, this.form.datasource);
|
|
|
- this.form.datasource = arr;
|
|
|
- this.allPrice = allPrice || 0;
|
|
|
+ if (!row) {
|
|
|
+ this.form.datasource.forEach((item, index) => {
|
|
|
+ this.$set(
|
|
|
+ this.form,
|
|
|
+ 'datasource[' + index + ']',
|
|
|
+ changeCount(item, this.countObj)
|
|
|
+ );
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ this.$set(
|
|
|
+ this.form,
|
|
|
+ 'datasource[' + index + ']',
|
|
|
+ changeCount(row, this.countObj)
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ this.getNotaxSinglePrice();
|
|
|
+ this.changeAll();
|
|
|
+ this.$forceUpdate();
|
|
|
+ },
|
|
|
+ changeAll() {
|
|
|
+ this.allPrice = getAllPrice(this.form.datasource) || 0;
|
|
|
if (this.isDiscountTotalPrice) {
|
|
|
- this.form.discountTotalPrice = allPrice;
|
|
|
+ this.form.discountTotalPrice = this.allPrice;
|
|
|
+ this.$emit('setDiscountTotalPrice', this.allPrice);
|
|
|
}
|
|
|
this.$emit('setCountAmount', this.allPrice);
|
|
|
},
|
|
|
@@ -1154,7 +1259,22 @@
|
|
|
this.$forceUpdate();
|
|
|
});
|
|
|
},
|
|
|
-
|
|
|
+ //计算不含税单价
|
|
|
+ getNotaxSinglePrice() {
|
|
|
+ this.form.datasource.forEach((item, index) => {
|
|
|
+ if (item.singlePrice && item.taxRate) {
|
|
|
+ this.$set(
|
|
|
+ this.form.datasource[index],
|
|
|
+ 'notaxSinglePrice',
|
|
|
+ parseFloat(
|
|
|
+ (item.singlePrice / (1 + item.taxRate / 100)).toFixed(2)
|
|
|
+ )
|
|
|
+ );
|
|
|
+ } else {
|
|
|
+ this.$set(this.form.datasource[index], 'notaxSinglePrice', '');
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
//修改回显
|
|
|
async putTableValue(data) {
|
|
|
let productList =
|
|
|
@@ -1183,16 +1303,7 @@
|
|
|
}
|
|
|
});
|
|
|
this.form.datasource = productList;
|
|
|
- if (this.isChangeCount) {
|
|
|
- this.changeCount();
|
|
|
- } else {
|
|
|
- this.allPrice = data.totalAmount || data?.contractVO?.totalPrice;
|
|
|
- }
|
|
|
-
|
|
|
- if (this.isDiscountTotalPrice) {
|
|
|
- this.form.discountTotalPrice =
|
|
|
- data.payAmount || data?.contractVO?.discountTotalPrice;
|
|
|
- }
|
|
|
+
|
|
|
|
|
|
let codeList = this.form.datasource
|
|
|
.filter((item) => item.productCode)
|
|
|
@@ -1213,6 +1324,16 @@
|
|
|
find.availableCountBase
|
|
|
);
|
|
|
});
|
|
|
+ if (this.isChangeCount) {
|
|
|
+ this.changeCount();
|
|
|
+ } else {
|
|
|
+ this.allPrice = data.totalAmount || data?.contractVO?.totalPrice;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (this.isDiscountTotalPrice) {
|
|
|
+ this.form.discountTotalPrice =
|
|
|
+ data.payAmount || data?.contractVO?.discountTotalPrice;
|
|
|
+ }
|
|
|
this.$refs.table.reload();
|
|
|
}
|
|
|
},
|
|
|
@@ -1263,7 +1384,7 @@
|
|
|
this.$set(parasm, 'imgCode', item.imgCode);
|
|
|
this.$set(parasm, 'produceType', item.produceType);
|
|
|
this.$set(parasm, 'approvalNumber', item.extField.approvalNumber);
|
|
|
- if(this.isOrderNo){
|
|
|
+ if (this.isOrderNo) {
|
|
|
this.$set(parasm, 'orderNo', this.orderOption[0]?.orderNo);
|
|
|
this.$set(parasm, 'orderId', this.orderOption[0]?.orderId);
|
|
|
}
|
|
|
@@ -1272,6 +1393,19 @@
|
|
|
'packingSpecification',
|
|
|
item.extField.packingSpecification
|
|
|
);
|
|
|
+ this.$set(
|
|
|
+ parasm,
|
|
|
+ 'packageDispositionList',
|
|
|
+ item.packageDispositionList
|
|
|
+ );
|
|
|
+ if (item.packageDispositionList?.length) {
|
|
|
+ this.$set(parasm, 'saleUnitId', item.packageDispositionList[0].id);
|
|
|
+ this.$set(
|
|
|
+ parasm,
|
|
|
+ 'saleUnit',
|
|
|
+ item.packageDispositionList[0].conversionUnit
|
|
|
+ );
|
|
|
+ }
|
|
|
this.$set(parasm, 'customerMark', this.customerMark);
|
|
|
if (item.purchaseOrigins?.length > 0) {
|
|
|
item.purchaseOrigins = item.purchaseOrigins.map((val) => val + '');
|
|
|
@@ -1285,11 +1419,9 @@
|
|
|
remove(index) {
|
|
|
this.form.datasource.splice(index, 1);
|
|
|
this.setSort();
|
|
|
+ this.changeAll();
|
|
|
},
|
|
|
- // 清空表格
|
|
|
- restTable() {
|
|
|
- this.form.datasource = [];
|
|
|
- },
|
|
|
+
|
|
|
// 重新排序
|
|
|
setSort() {
|
|
|
this.form.datasource.forEach((n, index) => {
|
|
|
@@ -1304,18 +1436,18 @@
|
|
|
},
|
|
|
|
|
|
validateForm(callback) {
|
|
|
- let singleWeightData = {};
|
|
|
- this.form.datasource.forEach((item) => {
|
|
|
- if (item.pricingWay == 2 && !item.singleWeight) {
|
|
|
- singleWeightData['name'] = item.productName;
|
|
|
- }
|
|
|
- });
|
|
|
- if (singleWeightData.name) {
|
|
|
- this.$message.warning(
|
|
|
- singleWeightData.name + '计价方式为重量,单重不能为空'
|
|
|
- );
|
|
|
- callback(false);
|
|
|
- }
|
|
|
+ // let singleWeightData = {};
|
|
|
+ // this.form.datasource.forEach((item) => {
|
|
|
+ // if (item.pricingWay == 2 && !item.singleWeight) {
|
|
|
+ // singleWeightData['name'] = item.productName;
|
|
|
+ // }
|
|
|
+ // });
|
|
|
+ // if (singleWeightData.name) {
|
|
|
+ // this.$message.warning(
|
|
|
+ // singleWeightData.name + '计价方式为重量,单重不能为空'
|
|
|
+ // );
|
|
|
+ // callback(false);
|
|
|
+ // }
|
|
|
//开始表单校验
|
|
|
this.$refs.form.validate((valid, obj) => {
|
|
|
if (obj) {
|