|
|
@@ -121,7 +121,7 @@
|
|
|
</el-input>
|
|
|
</el-form-item>
|
|
|
</template>
|
|
|
- <template v-slot:totalCount="scope">
|
|
|
+ <!-- <template v-slot:totalCount="scope">
|
|
|
<el-form-item
|
|
|
style="margin-bottom: 20px"
|
|
|
:prop="'datasource.' + scope.$index + '.totalCount'"
|
|
|
@@ -138,7 +138,7 @@
|
|
|
type="number"
|
|
|
></el-input>
|
|
|
</el-form-item>
|
|
|
- </template>
|
|
|
+ </template> -->
|
|
|
<template v-slot:totalPrice="scope">
|
|
|
<el-form-item
|
|
|
style="margin-bottom: 20px"
|
|
|
@@ -170,7 +170,7 @@
|
|
|
style="margin-bottom: 20px"
|
|
|
:prop="'datasource.' + scope.$index + '.specification'"
|
|
|
>
|
|
|
- <el-input v-model="scope.row.specification" ></el-input>
|
|
|
+ <el-input v-model="scope.row.specification"></el-input>
|
|
|
</el-form-item>
|
|
|
</template>
|
|
|
<template v-slot:deliveryDays="scope">
|
|
|
@@ -263,7 +263,7 @@
|
|
|
<el-input
|
|
|
v-model="scope.row.singlePrice"
|
|
|
placeholder="请输入"
|
|
|
- @input="getTotalPrice"
|
|
|
+ @input="changeCount(scope.row, scope.$index)"
|
|
|
>
|
|
|
<template slot="append">元</template>
|
|
|
</el-input>
|
|
|
@@ -304,7 +304,7 @@
|
|
|
>
|
|
|
<el-input
|
|
|
v-model="scope.row.singleWeight"
|
|
|
- @input="singleWeightChange(scope.row, scope.$index)"
|
|
|
+ @input="changeCount(scope.row, scope.$index)"
|
|
|
placeholder="请输入"
|
|
|
></el-input>
|
|
|
</el-form-item>
|
|
|
@@ -434,7 +434,7 @@
|
|
|
</template>
|
|
|
</el-popconfirm>
|
|
|
</template>
|
|
|
- <template v-slot:pricingWay="scope">
|
|
|
+ <!-- <template v-slot:pricingWay="scope">
|
|
|
<el-form-item
|
|
|
:prop="'datasource.' + scope.$index + '.pricingWay'"
|
|
|
:rules="{
|
|
|
@@ -454,10 +454,55 @@
|
|
|
</el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
- </template>
|
|
|
+ </template> -->
|
|
|
<template v-slot:headerPricingWay="{ column }">
|
|
|
<span class="is-required">{{ column.label }}</span>
|
|
|
</template>
|
|
|
+ <template v-slot:purchaseCount="scope">
|
|
|
+ <el-form-item
|
|
|
+ style="margin-bottom: 20px"
|
|
|
+ :prop="'datasource.' + scope.$index + '.purchaseCount'"
|
|
|
+ :rules="{
|
|
|
+ required: true,
|
|
|
+ message: '请输入数量',
|
|
|
+ trigger: 'change'
|
|
|
+ }"
|
|
|
+ >
|
|
|
+ <el-input
|
|
|
+ v-model="scope.row.purchaseCount"
|
|
|
+ placeholder="请输入"
|
|
|
+ type="number"
|
|
|
+ :min="0"
|
|
|
+ @input="changeCount(scope.row, scope.$index)"
|
|
|
+ >
|
|
|
+ </el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </template>
|
|
|
+ <template v-slot:purchaseUnit="scope">
|
|
|
+ <el-form-item
|
|
|
+ style="margin-bottom: 20px"
|
|
|
+ :prop="'datasource.' + scope.$index + '.purchaseUnitId'"
|
|
|
+ :rules="{
|
|
|
+ required: true,
|
|
|
+ message: '请选择单位',
|
|
|
+ trigger: 'change'
|
|
|
+ }"
|
|
|
+ >
|
|
|
+ <el-select
|
|
|
+ v-model="scope.row.purchaseUnitId"
|
|
|
+ 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>
|
|
|
</ele-pro-table>
|
|
|
|
|
|
<product-list
|
|
|
@@ -481,15 +526,13 @@
|
|
|
</el-form>
|
|
|
</template>
|
|
|
<script>
|
|
|
- import { emailReg, phoneReg, numberReg, positiveIntegerReg } from 'ele-admin';
|
|
|
+ import { numberReg, positiveIntegerReg } from 'ele-admin';
|
|
|
import productList from '@/BIZComponents/product-list.vue';
|
|
|
import dictMixins from '@/mixins/dictMixins';
|
|
|
- import store from '@/store';
|
|
|
import fileUpload from '@/components/upload/fileUpload';
|
|
|
import headList from '@/BIZComponents/user-select/user-select.vue';
|
|
|
import { getFile } from '@/api/system/file';
|
|
|
- import { getByCode } from '@/api/system/dictionary-data';
|
|
|
- // import fileMain from '@/components/addDoc/index.vue';
|
|
|
+
|
|
|
import billDetailDialog from './billDetailDialog.vue';
|
|
|
import taskinstanceDialog from '@/BIZComponents/procedure/taskinstanceDialog.vue';
|
|
|
import { getCode } from '@/components/addDoc/api/index.js';
|
|
|
@@ -498,6 +541,7 @@
|
|
|
import tabMixins from '@/mixins/tableColumnsMixin';
|
|
|
import { levelList } from '@/enum/dict.js';
|
|
|
import { getGoodsPriceByCondition } from '@/api/goodsManage/index';
|
|
|
+ import { changeCount, getAllPrice } from '@/BIZComponents/setProduct.js';
|
|
|
|
|
|
const dayjs = require('dayjs');
|
|
|
|
|
|
@@ -632,27 +676,58 @@
|
|
|
},
|
|
|
{
|
|
|
width: 150,
|
|
|
- prop: 'totalCount',
|
|
|
+ prop: 'purchaseCount',
|
|
|
label: '数量',
|
|
|
- slot: 'totalCount',
|
|
|
+ slot: 'purchaseCount',
|
|
|
+ headerSlot: 'headerTotalCount',
|
|
|
+ align: 'center'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ width: 150,
|
|
|
+ prop: 'purchaseUnit',
|
|
|
+ label: '单位',
|
|
|
+ slot: 'purchaseUnit',
|
|
|
headerSlot: 'headerTotalCount',
|
|
|
align: 'center'
|
|
|
},
|
|
|
{
|
|
|
width: 120,
|
|
|
- prop: 'availableCountBase',
|
|
|
- label: '库存数量',
|
|
|
- slot: 'availableCountBase',
|
|
|
+ prop: 'packingSpecification',
|
|
|
+ align: 'center',
|
|
|
+ label: '包装规格',
|
|
|
+ showOverflowTooltip: true
|
|
|
+ },
|
|
|
+ {
|
|
|
+ width: 150,
|
|
|
+ prop: 'totalCount',
|
|
|
+ label: '计量数量',
|
|
|
+ // slot: 'totalCount',
|
|
|
+ // headerSlot: 'headerTotalCount',
|
|
|
align: 'center'
|
|
|
},
|
|
|
+
|
|
|
{
|
|
|
- width: 160,
|
|
|
- prop: 'pricingWay',
|
|
|
- label: '计价方式',
|
|
|
- headerSlot: 'headerPricingWay',
|
|
|
- slot: 'pricingWay',
|
|
|
+ width: 80,
|
|
|
+ prop: 'measuringUnit',
|
|
|
+ label: '计量单位',
|
|
|
+ slot: 'measuringUnit',
|
|
|
+ align: 'center'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ width: 120,
|
|
|
+ prop: 'availableCountBase',
|
|
|
+ label: '库存数量',
|
|
|
+ slot: 'availableCountBase',
|
|
|
align: 'center'
|
|
|
},
|
|
|
+ // {
|
|
|
+ // width: 160,
|
|
|
+ // prop: 'pricingWay',
|
|
|
+ // label: '计价方式',
|
|
|
+ // headerSlot: 'headerPricingWay',
|
|
|
+ // slot: 'pricingWay',
|
|
|
+ // align: 'center'
|
|
|
+ // },
|
|
|
{
|
|
|
minWidth: 120,
|
|
|
prop: 'goodsLevel',
|
|
|
@@ -761,21 +836,6 @@
|
|
|
}
|
|
|
},
|
|
|
|
|
|
- {
|
|
|
- width: 120,
|
|
|
- prop: 'packingSpecification',
|
|
|
- align: 'center',
|
|
|
- label: '包装规格',
|
|
|
- showOverflowTooltip: true
|
|
|
- },
|
|
|
-
|
|
|
- {
|
|
|
- width: 80,
|
|
|
- prop: 'measuringUnit',
|
|
|
- label: '计量单位',
|
|
|
- slot: 'measuringUnit',
|
|
|
- align: 'center'
|
|
|
- },
|
|
|
{
|
|
|
width: 120,
|
|
|
prop: 'singleWeight',
|
|
|
@@ -911,7 +971,6 @@
|
|
|
created() {
|
|
|
this.requestDict('生产类型');
|
|
|
this.requestDict('商品价格类型');
|
|
|
-
|
|
|
},
|
|
|
methods: {
|
|
|
handleGetBillDetail(row, type) {
|
|
|
@@ -946,15 +1005,60 @@
|
|
|
getPrice() {
|
|
|
return [this.allPrice];
|
|
|
},
|
|
|
+ packingChange(item, index) {
|
|
|
+ this.$set(
|
|
|
+ this.form.datasource[index],
|
|
|
+ 'purchaseUnit',
|
|
|
+ item.conversionUnit
|
|
|
+ );
|
|
|
+ },
|
|
|
+
|
|
|
//改变数量
|
|
|
changeCount(row, index) {
|
|
|
if (this.detailType) {
|
|
|
return;
|
|
|
}
|
|
|
+ let countObj = {
|
|
|
+ countKey: 'purchaseCount',
|
|
|
+ unitKey: 'purchaseUnit',
|
|
|
+ unitIdKey: 'purchaseUnitId'
|
|
|
+ };
|
|
|
+ if (!row) {
|
|
|
+ this.form.datasource.forEach((item, index) => {
|
|
|
+ this.$set(
|
|
|
+ this.form,
|
|
|
+ 'datasource[' + index + ']',
|
|
|
+ changeCount(item, countObj)
|
|
|
+ );
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ this.$set(
|
|
|
+ this.form,
|
|
|
+ 'datasource[' + index + ']',
|
|
|
+ changeCount(row, countObj)
|
|
|
+ );
|
|
|
+ }
|
|
|
|
|
|
- this.singleWeightChange(row, index);
|
|
|
- this.getTotalPrice();
|
|
|
+ this.getNotaxSinglePrice();
|
|
|
+ this.changeAll();
|
|
|
+ this.$forceUpdate();
|
|
|
},
|
|
|
+ changeAll() {
|
|
|
+ this.allPrice = getAllPrice(this.form.datasource) || 0;
|
|
|
+ this.$store.commit('concact/setDiscountAmount', this.allPrice);
|
|
|
+ this.$store.commit('order/setAllcountAmount', this.allPrice);
|
|
|
+ this.$emit('orderDiscountAmount', this.allPrice);
|
|
|
+ },
|
|
|
+
|
|
|
+ // //改变数量
|
|
|
+ // changeCount(row, index) {
|
|
|
+ // if (this.detailType) {
|
|
|
+ // return;
|
|
|
+ // }
|
|
|
+
|
|
|
+ // this.singleWeightChange(row, index);
|
|
|
+ // this.getTotalPrice();
|
|
|
+ // },
|
|
|
goodsPriceTypeChange(row, index) {
|
|
|
if (row.goodsId) {
|
|
|
getGoodsPriceByCondition({
|
|
|
@@ -989,28 +1093,28 @@
|
|
|
});
|
|
|
}
|
|
|
},
|
|
|
- //计算总金额
|
|
|
- getTotalPrice(row, index) {
|
|
|
- this.getNotaxSinglePrice();
|
|
|
+ // //计算总金额
|
|
|
+ // getTotalPrice(row, index) {
|
|
|
+ // this.getNotaxSinglePrice();
|
|
|
|
|
|
- if (this.form.datasource.length) {
|
|
|
- let sum = 0;
|
|
|
- sum = this.getNumTotalPrice();
|
|
|
- let allsum = sum.toFixed(2);
|
|
|
- this.allPrice = allsum;
|
|
|
- this.form.discountTotalPrice = allsum;
|
|
|
- this.$store.commit('concact/setDiscountAmount', allsum);
|
|
|
- this.$store.commit('order/setAllcountAmount', allsum);
|
|
|
- this.$emit('orderDiscountAmount', this.allPrice);
|
|
|
- this.$refs.table.reload();
|
|
|
- return allsum;
|
|
|
- } else {
|
|
|
- this.allPrice = 0.0;
|
|
|
- this.form.discountTotalPrice = 0.0;
|
|
|
- this.$emit('orderDiscountAmount', 0);
|
|
|
- return 0.0;
|
|
|
- }
|
|
|
- },
|
|
|
+ // if (this.form.datasource.length) {
|
|
|
+ // let sum = 0;
|
|
|
+ // sum = this.getNumTotalPrice();
|
|
|
+ // let allsum = sum.toFixed(2);
|
|
|
+ // this.allPrice = allsum;
|
|
|
+ // this.form.discountTotalPrice = allsum;
|
|
|
+ // this.$store.commit('concact/setDiscountAmount', allsum);
|
|
|
+ // this.$store.commit('order/setAllcountAmount', allsum);
|
|
|
+ // this.$emit('orderDiscountAmount', this.allPrice);
|
|
|
+ // this.$refs.table.reload();
|
|
|
+ // return allsum;
|
|
|
+ // } else {
|
|
|
+ // this.allPrice = 0.0;
|
|
|
+ // this.form.discountTotalPrice = 0.0;
|
|
|
+ // this.$emit('orderDiscountAmount', 0);
|
|
|
+ // return 0.0;
|
|
|
+ // }
|
|
|
+ // },
|
|
|
//计算不含税单价
|
|
|
getNotaxSinglePrice() {
|
|
|
this.form.datasource.forEach((item, index) => {
|
|
|
@@ -1027,64 +1131,82 @@
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
- //计算总金额
|
|
|
- getNumTotalPrice() {
|
|
|
- console.log(111);
|
|
|
- let sum = 0;
|
|
|
- this.form.datasource.forEach((r) => {
|
|
|
- this.$set(
|
|
|
- r,
|
|
|
- 'discountSinglePrice',
|
|
|
- r.singlePrice ? Number(r.singlePrice) : ''
|
|
|
- );
|
|
|
- if (r.singlePrice && r.totalCount) {
|
|
|
- r.totalPrice = this.getAllPrice(r);
|
|
|
- r.discountTotalPrice = this.getDiscountTotalPrice(r);
|
|
|
- this.$set(r, 'totalPrice', Number(r.totalPrice));
|
|
|
- this.$set(r, 'discountTotalPrice', Number(r.discountTotalPrice));
|
|
|
- sum += Number(r.totalPrice);
|
|
|
- } else {
|
|
|
- this.$set(r, 'totalPrice', '');
|
|
|
- this.$set(r, 'discountTotalPrice', '');
|
|
|
- }
|
|
|
- });
|
|
|
- return sum;
|
|
|
- },
|
|
|
+ // //计算总金额
|
|
|
+ // getNumTotalPrice() {
|
|
|
+ // console.log(111);
|
|
|
+ // let sum = 0;
|
|
|
+ // this.form.datasource.forEach((r) => {
|
|
|
+ // this.$set(
|
|
|
+ // r,
|
|
|
+ // 'discountSinglePrice',
|
|
|
+ // r.singlePrice ? Number(r.singlePrice) : ''
|
|
|
+ // );
|
|
|
+ // if (r.singlePrice && r.totalCount) {
|
|
|
+ // r.totalPrice = this.getAllPrice(r);
|
|
|
+ // r.discountTotalPrice = this.getDiscountTotalPrice(r);
|
|
|
+ // this.$set(r, 'totalPrice', Number(r.totalPrice));
|
|
|
+ // this.$set(r, 'discountTotalPrice', Number(r.discountTotalPrice));
|
|
|
+ // sum += Number(r.totalPrice);
|
|
|
+ // } else {
|
|
|
+ // this.$set(r, 'totalPrice', '');
|
|
|
+ // this.$set(r, 'discountTotalPrice', '');
|
|
|
+ // }
|
|
|
+ // });
|
|
|
+ // return sum;
|
|
|
+ // },
|
|
|
|
|
|
- //计算单重
|
|
|
- singleWeightChange(row, index) {
|
|
|
- if (row && row.singleWeight && row.totalCount) {
|
|
|
- row.totalWeight = (row.singleWeight * row.totalCount).toFixed(2) || 0;
|
|
|
- this.$set(
|
|
|
- this.form.datasource[index],
|
|
|
- 'totalWeight',
|
|
|
- row.totalWeight
|
|
|
- );
|
|
|
- }
|
|
|
- if (row.pricingWay == 2) {
|
|
|
- this.getTotalPrice(row);
|
|
|
- }
|
|
|
- },
|
|
|
+ // //计算单重
|
|
|
+ // singleWeightChange(row, index) {
|
|
|
+ // if (row && row.singleWeight && row.totalCount) {
|
|
|
+ // row.totalWeight = (row.singleWeight * row.totalCount).toFixed(2) || 0;
|
|
|
+ // this.$set(
|
|
|
+ // this.form.datasource[index],
|
|
|
+ // 'totalWeight',
|
|
|
+ // row.totalWeight
|
|
|
+ // );
|
|
|
+ // }
|
|
|
+ // if (row.pricingWay == 2) {
|
|
|
+ // this.getTotalPrice(row);
|
|
|
+ // }
|
|
|
+ // },
|
|
|
//设置优惠后总金额修改产品单价
|
|
|
discountInputByOrder(val) {
|
|
|
this.form.discountTotalPrice = val;
|
|
|
//获取优惠金额和总计的差价
|
|
|
- this.form.datasource.forEach((item) => {
|
|
|
+ this.form.datasource.forEach((item, index) => {
|
|
|
if (val === 0) {
|
|
|
- item.discountTotalPrice = 0;
|
|
|
- item.discountSinglePrice = 0;
|
|
|
+ this.$set(this.form.datasource[index], 'discountTotalPrice', 0);
|
|
|
+ this.$set(this.form.datasource[index], 'discountSinglePrice', 0);
|
|
|
return;
|
|
|
}
|
|
|
if (!val) {
|
|
|
- item.discountTotalPrice = item.totalPrice;
|
|
|
- item.discountSinglePrice = item.singlePrice;
|
|
|
+ this.$set(
|
|
|
+ this.form.datasource[index],
|
|
|
+ 'discountTotalPrice',
|
|
|
+ item.totalPrice
|
|
|
+ );
|
|
|
+ this.$set(
|
|
|
+ this.form.datasource[index],
|
|
|
+ 'discountSinglePrice',
|
|
|
+ item.singlePrice
|
|
|
+ );
|
|
|
return;
|
|
|
}
|
|
|
+
|
|
|
+ this.$set(
|
|
|
+ this.form.datasource[index],
|
|
|
+ 'discountSinglePrice',
|
|
|
+ this.getDiscountSinglePrice(item)
|
|
|
+ );
|
|
|
//获取折让单价
|
|
|
- item.discountSinglePrice = this.getDiscountSinglePrice(item);
|
|
|
- item.discountTotalPrice = this.getDiscountTotalPrice(item);
|
|
|
+ this.$set(
|
|
|
+ this.form.datasource[index],
|
|
|
+ 'discountTotalPrice',
|
|
|
+ this.getDiscountTotalPrice(item)
|
|
|
+ );
|
|
|
});
|
|
|
- this.$refs.table.reload();
|
|
|
+ this.$forceUpdate();
|
|
|
+ this.$refs.table.reRenderTable();
|
|
|
this.$store.commit('concact/setDiscountAmount', val);
|
|
|
},
|
|
|
//获取折让单价
|
|
|
@@ -1109,35 +1231,26 @@
|
|
|
row.produceRoutingId
|
|
|
);
|
|
|
},
|
|
|
- //获取合计
|
|
|
- getAllPrice(row) {
|
|
|
- let num = 0;
|
|
|
- if (row.pricingWay == 1) {
|
|
|
- num = Number(row.singlePrice) * Number(row.totalCount);
|
|
|
- }
|
|
|
- if (row.pricingWay == 2) {
|
|
|
- num =
|
|
|
- Number(row.singlePrice) *
|
|
|
- Number(row.totalCount) *
|
|
|
- Number(row.singleWeight);
|
|
|
- }
|
|
|
- console.log(row, 'row');
|
|
|
+ // //获取合计
|
|
|
+ // getAllPrice(row) {
|
|
|
+ // let num = 0;
|
|
|
+ // if (row.pricingWay == 1) {
|
|
|
+ // num = Number(row.singlePrice) * Number(row.totalCount);
|
|
|
+ // }
|
|
|
+ // if (row.pricingWay == 2) {
|
|
|
+ // num =
|
|
|
+ // Number(row.singlePrice) *
|
|
|
+ // Number(row.totalCount) *
|
|
|
+ // Number(row.singleWeight);
|
|
|
+ // }
|
|
|
+ // console.log(row, 'row');
|
|
|
|
|
|
- return isNaN(num) ? '' : num.toFixed(2);
|
|
|
- },
|
|
|
+ // return isNaN(num) ? '' : num.toFixed(2);
|
|
|
+ // },
|
|
|
//获取折让合计
|
|
|
getDiscountTotalPrice(row) {
|
|
|
let num = 0;
|
|
|
- if (row.pricingWay == 1) {
|
|
|
- num = Number(row.discountSinglePrice) * Number(row.totalCount);
|
|
|
- }
|
|
|
- if (row.pricingWay == 2) {
|
|
|
- num =
|
|
|
- Number(row.discountSinglePrice) *
|
|
|
- Number(row.totalCount) *
|
|
|
- Number(row.singleWeight);
|
|
|
- }
|
|
|
-
|
|
|
+ num = Number(row.discountSinglePrice) * Number(row.totalCount);
|
|
|
return isNaN(num) ? '' : num.toFixed(2);
|
|
|
},
|
|
|
//修改回显
|
|
|
@@ -1240,6 +1353,23 @@
|
|
|
'packingSpecification',
|
|
|
item.extField?.packingSpecification
|
|
|
);
|
|
|
+ this.$set(
|
|
|
+ parasm,
|
|
|
+ 'packageDispositionList',
|
|
|
+ item.packageDispositionList
|
|
|
+ );
|
|
|
+ if (item.packageDispositionList?.length) {
|
|
|
+ this.$set(
|
|
|
+ parasm,
|
|
|
+ 'purchaseUnitId',
|
|
|
+ item.packageDispositionList[0].id
|
|
|
+ );
|
|
|
+ this.$set(
|
|
|
+ parasm,
|
|
|
+ 'purchaseUnit',
|
|
|
+ item.packageDispositionList[0].conversionUnit
|
|
|
+ );
|
|
|
+ }
|
|
|
this.$set(parasm, 'supplierMark', this.supplierMark);
|
|
|
this.$set(parasm, 'batchNo', await getCode('1900101420390125570'));
|
|
|
if (item.purchaseOrigins?.length > 0) {
|