|
@@ -160,7 +160,7 @@
|
|
|
操作<i class="el-icon-arrow-down el-icon--right"></i>
|
|
|
</el-button>
|
|
|
<el-dropdown-menu slot="dropdown">
|
|
|
- <el-dropdown-item v-show="scope.row.status == 1">
|
|
|
+ <el-dropdown-item>
|
|
|
<el-button
|
|
|
size="mini"
|
|
|
type="text"
|
|
@@ -170,6 +170,16 @@
|
|
|
>修改
|
|
|
</el-button>
|
|
|
</el-dropdown-item>
|
|
|
+ <el-dropdown-item v-show="scope.row.status == 9">
|
|
|
+ <el-button
|
|
|
+ size="mini"
|
|
|
+ type="text"
|
|
|
+ icon="el-icon-edit"
|
|
|
+ v-hasPermi="['system:RetailOrder:update']"
|
|
|
+ @click="handleComplate(scope.row)"
|
|
|
+ >完成
|
|
|
+ </el-button>
|
|
|
+ </el-dropdown-item>
|
|
|
<el-dropdown-item>
|
|
|
<el-button
|
|
|
size="mini"
|
|
@@ -180,7 +190,7 @@
|
|
|
>详情
|
|
|
</el-button>
|
|
|
</el-dropdown-item>
|
|
|
- <el-dropdown-item>
|
|
|
+ <!-- <el-dropdown-item>
|
|
|
<el-button
|
|
|
size="mini"
|
|
|
type="text"
|
|
@@ -189,7 +199,7 @@
|
|
|
@click="handleSubmit(scope.row)"
|
|
|
>提交
|
|
|
</el-button>
|
|
|
- </el-dropdown-item>
|
|
|
+ </el-dropdown-item> -->
|
|
|
<el-dropdown-item v-show="scope.row.status == 5">
|
|
|
<el-button
|
|
|
size="mini"
|
|
@@ -352,6 +362,16 @@
|
|
|
{{ formData.saleAmountInWords }}
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label-width="120px" label="货车登记:">
|
|
|
+ <el-input
|
|
|
+ v-model="form.truckRegistration"
|
|
|
+ size="small"
|
|
|
+ clearable
|
|
|
+ ></el-input>
|
|
|
+ <!-- {{ formData.saleAmountInWords }} -->
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
<!-- <el-col :span="12">
|
|
|
<el-form-item label="付款方式:">
|
|
|
<el-select
|
|
@@ -395,6 +415,7 @@
|
|
|
<el-divider>货品明细</el-divider>
|
|
|
</el-col>
|
|
|
<el-table
|
|
|
+ ref="productionTableRef"
|
|
|
:data="productionTableData"
|
|
|
border
|
|
|
show-summary
|
|
@@ -410,81 +431,115 @@
|
|
|
clearable
|
|
|
></el-input> -->
|
|
|
<el-form-item
|
|
|
- :prop="'productNo-' + scope.$index"
|
|
|
- :name="'productNo-' + scope.$index"
|
|
|
+ :prop="'productName-' + scope.$index"
|
|
|
+ :name="'productName-' + scope.$index"
|
|
|
style="margin: 0px; padding: 0px"
|
|
|
>
|
|
|
+ <!--
|
|
|
+ @change="
|
|
|
+ handleProductChange(scope.row.productNo, scope.row)
|
|
|
+ "
|
|
|
+ @blur="handleProductBlur(productNo)"
|
|
|
+ -->
|
|
|
<el-select
|
|
|
- v-model="scope.row.productNo"
|
|
|
+ v-model="scope.row.productName"
|
|
|
placeholder=""
|
|
|
- :filter-method="(val) => mySelectFilter(val, scope.row)"
|
|
|
- clearable
|
|
|
filterable
|
|
|
@change="
|
|
|
- handleProductChange(scope.row.productNo, scope.row)
|
|
|
+ newProductChange(scope.row.productName, scope.row)
|
|
|
"
|
|
|
- @blur="handleProductBlur(productNo)"
|
|
|
>
|
|
|
<el-option
|
|
|
v-for="item in productionOptions"
|
|
|
- :key="item.productNo"
|
|
|
+ :key="item.productName"
|
|
|
:label="item.productName"
|
|
|
- :value="item.productNo"
|
|
|
+ :value="item.productName"
|
|
|
>
|
|
|
- <span class="discribe" style="float: left">{{
|
|
|
+ <!-- <span class="discribe" style="float: left">{{
|
|
|
item.productName
|
|
|
}}</span>
|
|
|
<span
|
|
|
style="float: right; color: #8492a6; font-size: 13px"
|
|
|
>{{ item.productSpecifications }}</span
|
|
|
- >
|
|
|
+ > -->
|
|
|
</el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column prop="productType" label="类型">
|
|
|
- </el-table-column>
|
|
|
- <el-table-column prop="productNumber" label="箱数">
|
|
|
+ <el-table-column prop="productSpecifications" label="规格">
|
|
|
<template slot-scope="scope">
|
|
|
- <el-form-item
|
|
|
- :prop="'productNumber-' + scope.$index"
|
|
|
- :name="'productNumber-' + scope.$index"
|
|
|
- style="margin: 0px; padding: 0px"
|
|
|
+ <el-select
|
|
|
+ v-model="scope.row.productSpecifications"
|
|
|
+ @change="handleSpecificationsChange(scope.row)"
|
|
|
+ placeholder=""
|
|
|
+ filterable
|
|
|
>
|
|
|
- <el-input
|
|
|
- v-model="scope.row.productNumber"
|
|
|
- oninput="value=value.replace(/[^0-9.]/g,'')"
|
|
|
- size="small"
|
|
|
- clearable
|
|
|
- @change="computedPrice(scope.row)"
|
|
|
- ></el-input>
|
|
|
- </el-form-item>
|
|
|
+ <el-option
|
|
|
+ v-for="item in scope.row.specificationsList"
|
|
|
+ :key="item.productSpecifications"
|
|
|
+ :label="item.productSpecifications"
|
|
|
+ :value="item.productSpecifications"
|
|
|
+ >
|
|
|
+ <span class="discribe" style="float: left">{{
|
|
|
+ item.productSpecifications
|
|
|
+ }}</span>
|
|
|
+ <span
|
|
|
+ style="float: right; color: #8492a6; font-size: 13px"
|
|
|
+ >{{ item.productType }}</span
|
|
|
+ >
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column prop="productUnitPrice" label="单价">
|
|
|
+ <el-table-column prop="colourNumber" label="色号">
|
|
|
<template slot-scope="scope">
|
|
|
<el-form-item
|
|
|
- :prop="'productUnitPrice-' + scope.$index"
|
|
|
- :name="'productUnitPrice-' + scope.$index"
|
|
|
+ :prop="'colourNumber-' + scope.$index"
|
|
|
+ :name="'colourNumber-' + scope.$index"
|
|
|
style="margin: 0px; padding: 0px"
|
|
|
>
|
|
|
- <el-input
|
|
|
- v-model="scope.row.productUnitPrice"
|
|
|
- size="small"
|
|
|
- oninput="value=value.replace(/[^0-9.]/g,'')"
|
|
|
- @change="computedPrice(scope.row)"
|
|
|
+ <el-select
|
|
|
+ v-model="scope.row.colourNumber"
|
|
|
+ placeholder=""
|
|
|
clearable
|
|
|
- ></el-input>
|
|
|
+ filterable
|
|
|
+ @change="colourNumberChangeHandler(scope.row)"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in colourNumberOptions"
|
|
|
+ :key="item.materielCode"
|
|
|
+ :label="item.materieEncoding + item.materieColorNumber"
|
|
|
+ :value="item.materielCode"
|
|
|
+ >
|
|
|
+ <span class="discribe" style="float: left">{{
|
|
|
+ item.materieEncoding + item.materieColorNumber
|
|
|
+ }}</span>
|
|
|
+ <!-- <span
|
|
|
+ style="float: right; color: #8492a6; font-size: 13px"
|
|
|
+ >{{ item.materielCode }}</span
|
|
|
+ > -->
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
</el-form-item>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column prop="productAmounts" label="金额">
|
|
|
+ <el-table-column prop="productType" label="类型">
|
|
|
+ </el-table-column>
|
|
|
+
|
|
|
+ <el-table-column prop="lotNumber" label="批号">
|
|
|
<template slot-scope="scope">
|
|
|
- {{ scope.row.productAmounts }}
|
|
|
+ <el-input
|
|
|
+ v-model="scope.row.lotNumber"
|
|
|
+ placeholder=""
|
|
|
+ size="small"
|
|
|
+ clearable
|
|
|
+ @blur="updateStorage(scope.row)"
|
|
|
+ ></el-input>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column prop="sliceType" label="切片型号">
|
|
|
+
|
|
|
+ <!-- <el-table-column prop="sliceType" label="切片型号">
|
|
|
<template slot-scope="scope">
|
|
|
<el-form-item
|
|
|
:prop="'sliceType-' + scope.$index"
|
|
@@ -508,39 +563,57 @@
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
</template>
|
|
|
+ </el-table-column> -->
|
|
|
+
|
|
|
+ <el-table-column prop="productNumber" label="箱数">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-form-item
|
|
|
+ :prop="'productNumber-' + scope.$index"
|
|
|
+ :name="'productNumber-' + scope.$index"
|
|
|
+ style="margin: 0px; padding: 0px"
|
|
|
+ >
|
|
|
+ <el-input
|
|
|
+ v-model="scope.row.productNumber"
|
|
|
+ oninput="value=value.replace(/[^0-9.]/g,'')"
|
|
|
+ size="small"
|
|
|
+ clearable
|
|
|
+ @change="computedPrice(scope.row)"
|
|
|
+ ></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column prop="colourNumber" label="色号">
|
|
|
+ <el-table-column prop="productUnitPrice" label="单价">
|
|
|
<template slot-scope="scope">
|
|
|
<el-form-item
|
|
|
- :prop="'colourNumber-' + scope.$index"
|
|
|
- :name="'colourNumber-' + scope.$index"
|
|
|
+ :prop="'productUnitPrice-' + scope.$index"
|
|
|
+ :name="'productUnitPrice-' + scope.$index"
|
|
|
style="margin: 0px; padding: 0px"
|
|
|
>
|
|
|
- <el-select
|
|
|
- v-model="scope.row.colourNumber"
|
|
|
- placeholder=""
|
|
|
+ <el-input
|
|
|
+ v-model="scope.row.productUnitPrice"
|
|
|
+ size="small"
|
|
|
+ oninput="value=value.replace(/[^0-9.]/g,'')"
|
|
|
+ @change="computedPrice(scope.row)"
|
|
|
clearable
|
|
|
- filterable
|
|
|
- @change="colourNumberChangeHandler(scope.row)"
|
|
|
- >
|
|
|
- <el-option
|
|
|
- v-for="item in colourNumberOptions"
|
|
|
- :key="item.materielCode"
|
|
|
- :label="item.materieEncoding + item.materieColorNumber"
|
|
|
- :value="item.materielCode"
|
|
|
- >
|
|
|
- <span class="discribe" style="float: left">{{
|
|
|
- item.materieEncoding + item.materieColorNumber
|
|
|
- }}</span>
|
|
|
- <!-- <span
|
|
|
- style="float: right; color: #8492a6; font-size: 13px"
|
|
|
- >{{ item.materielCode }}</span
|
|
|
- > -->
|
|
|
- </el-option>
|
|
|
- </el-select>
|
|
|
+ ></el-input>
|
|
|
</el-form-item>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
+ <el-table-column prop="productAmounts" label="金额">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ {{ scope.row.productAmounts }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="inventoryBoxNum" label="库存箱数">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ {{ scope.row.inventoryBoxNum }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="inventoryWeight" label="库存重量/kg">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ {{ scope.row.inventoryWeight }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
<el-table-column prop="remark" label="备注">
|
|
|
<template slot-scope="scope">
|
|
|
<el-input
|
|
@@ -580,7 +653,7 @@
|
|
|
</el-form-item>
|
|
|
</el-col> -->
|
|
|
<el-col :span="24">
|
|
|
- <el-divider>订单备注</el-divider>
|
|
|
+ <el-divider>备注</el-divider>
|
|
|
</el-col>
|
|
|
<el-col :span="24">
|
|
|
<el-input
|
|
@@ -676,6 +749,8 @@ import {
|
|
|
addProductInvoice,
|
|
|
updateProductInvoice,
|
|
|
queryMaterielList,
|
|
|
+ getSaleOrderProductionListDistinct,
|
|
|
+ getProductSpecificationsByProductName,
|
|
|
} from "@/api/tablelist/commonTable";
|
|
|
import {
|
|
|
saleOrderList,
|
|
@@ -688,6 +763,8 @@ import {
|
|
|
cancelRetailOrder,
|
|
|
deleRetailOrder,
|
|
|
submitProductInvoice,
|
|
|
+ getProductInventory,
|
|
|
+ updateOrder,
|
|
|
} from "@/api/system/retailMange.js";
|
|
|
import { listData } from "@/api/system/tenant/data";
|
|
|
import { getToken } from "@/utils/auth";
|
|
@@ -730,6 +807,26 @@ export default {
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
+ // 提交 表单数据 start
|
|
|
+ form: {
|
|
|
+ noticeNumber: "", //通知单号
|
|
|
+ noticeDate: "", //通知日期
|
|
|
+ salesman: "", //销售员
|
|
|
+ customerId: "", //客户编号
|
|
|
+ drawer: "", //开票员
|
|
|
+ dispatchNoteRemark: "", //发货单备注
|
|
|
+ billingType: "", //开票类型
|
|
|
+ truckRegistration: "", //货车登记
|
|
|
+ documentType: "", //单据类型
|
|
|
+ sellingUnit: "", //售货单位
|
|
|
+ auditOpinion: "", //审核意见
|
|
|
+ inventoryBoxNum: "", //库存箱数
|
|
|
+ inventoryWeight: "", //库存重量
|
|
|
+
|
|
|
+ batchNumberType: 1, //批次类型
|
|
|
+ computeType: 1, //计算方式
|
|
|
+ },
|
|
|
+ // 提交 表单数据 end
|
|
|
outStockShow: false, //出库详情弹窗
|
|
|
totalMoney: "", //合计金额 小写
|
|
|
createById: "", //创建者id
|
|
@@ -887,8 +984,6 @@ export default {
|
|
|
title: "",
|
|
|
// 日期范围
|
|
|
dateRange: [],
|
|
|
- // 表单参数
|
|
|
- form: {},
|
|
|
// cru 弹窗
|
|
|
open: false,
|
|
|
// excel共通导入数据
|
|
@@ -994,9 +1089,112 @@ export default {
|
|
|
...mapState({
|
|
|
nickName: (state) => state.user.nickName,
|
|
|
userInfo: (state) => state.user,
|
|
|
+ username: (state) => state.user.name,
|
|
|
}),
|
|
|
},
|
|
|
methods: {
|
|
|
+ // 零售订单完成回调
|
|
|
+ async handleComplate(row) {
|
|
|
+ console.log(row);
|
|
|
+ let payload = {
|
|
|
+ id: row.id,
|
|
|
+ status: 6,
|
|
|
+ };
|
|
|
+ let res = await updateOrder(payload);
|
|
|
+ if (res.code == 200) {
|
|
|
+ this.$message({
|
|
|
+ type: "success",
|
|
|
+ message: "订单已完成",
|
|
|
+ });
|
|
|
+ this.getList();
|
|
|
+ } else {
|
|
|
+ this.$message({
|
|
|
+ type: "error",
|
|
|
+ message: "订单已完成失败,请稍后再试",
|
|
|
+ });
|
|
|
+ console.log(res);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 更新库存箱数和重量
|
|
|
+ async updateStorage(row) {
|
|
|
+ let {
|
|
|
+ productNo,
|
|
|
+ productType,
|
|
|
+ lotNumber,
|
|
|
+ productName,
|
|
|
+ productSpecifications,
|
|
|
+ } = row;
|
|
|
+ let payload = {
|
|
|
+ productNo,
|
|
|
+ productType,
|
|
|
+ lotNumber,
|
|
|
+ productName,
|
|
|
+ productSpecifications,
|
|
|
+ };
|
|
|
+ let res = await getProductInventory(payload);
|
|
|
+ if ((res.code = 200)) {
|
|
|
+ console.log(res);
|
|
|
+ row.inventoryWeight = res.data.inventoryWeight || 0;
|
|
|
+ row.inventoryBoxNum = res.data.inventoryBoxNum || 0;
|
|
|
+ } else {
|
|
|
+ console.log(res);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 规格变化回调
|
|
|
+ handleSpecificationsChange(row) {
|
|
|
+ let { productSpecifications, specificationsList } = row;
|
|
|
+ if (productSpecifications) {
|
|
|
+ let targetItem = specificationsList.find(
|
|
|
+ (item) => item.productSpecifications == productSpecifications
|
|
|
+ );
|
|
|
+ console.log(targetItem);
|
|
|
+ row.productNo = targetItem?.productNo;
|
|
|
+ row.productType = targetItem?.productType;
|
|
|
+ } else {
|
|
|
+ row.productNo = "";
|
|
|
+ row.productType = "";
|
|
|
+ }
|
|
|
+ this.updateStorage(row);
|
|
|
+ },
|
|
|
+ // 新的产品改变回调
|
|
|
+ async newProductChange(productName, row) {
|
|
|
+ // 发请求获取对应的规格数据
|
|
|
+ if (!productName) {
|
|
|
+ row.specificationsList = [];
|
|
|
+ (row.productNo = ""), (row.productType = "");
|
|
|
+ row.productSpecifications = "";
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ // let targetItem = this.productionOptions.find(
|
|
|
+ // (item) => item.productNo == productNo
|
|
|
+ // );
|
|
|
+ // row.productName = targetItem?.productName;
|
|
|
+ // row.productType = targetItem?.productType;
|
|
|
+ // 获取规格数据
|
|
|
+ let res = await getProductSpecificationsByProductName({
|
|
|
+ productName: productName,
|
|
|
+ });
|
|
|
+ if (res.code == 200) {
|
|
|
+ row.specificationsList = res.data;
|
|
|
+ console.log(row.specificationsList);
|
|
|
+ let defaultItem = row.specificationsList.find(
|
|
|
+ (item) => item.isDefaultSpecifications
|
|
|
+ );
|
|
|
+ if (defaultItem) {
|
|
|
+ row.productSpecifications = defaultItem.productSpecifications;
|
|
|
+ row.productNo = defaultItem.productNo;
|
|
|
+ row.productType = defaultItem.productType;
|
|
|
+ } else {
|
|
|
+ row.productSpecifications =
|
|
|
+ row.specificationsList[0]?.productSpecifications || "";
|
|
|
+ row.productNo = row.specificationsList[0]?.productNo || "";
|
|
|
+ row.productType = row.specificationsList[0]?.productType || "";
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ row.specificationsList = [];
|
|
|
+ }
|
|
|
+ this.updateStorage(row);
|
|
|
+ },
|
|
|
// 出库单回调
|
|
|
async myPrintOutBoundHandler(row) {
|
|
|
console.log("row", row);
|
|
@@ -1157,10 +1355,13 @@ export default {
|
|
|
const values = data.map((item) => Number(item[column.property]));
|
|
|
if (
|
|
|
index === 1 ||
|
|
|
- index === 5 ||
|
|
|
- index === 6 ||
|
|
|
- index === 7 ||
|
|
|
- index === 8
|
|
|
+ index === 2 ||
|
|
|
+ index === 3 ||
|
|
|
+ index === 4 ||
|
|
|
+ index === 8 ||
|
|
|
+ index === 9 ||
|
|
|
+ index === 10 ||
|
|
|
+ index === 11
|
|
|
) {
|
|
|
sums[index] = "";
|
|
|
} else if (!values.every((value) => isNaN(value))) {
|
|
@@ -1172,11 +1373,11 @@ export default {
|
|
|
return prev;
|
|
|
}
|
|
|
}, 0);
|
|
|
- if (index == 3 || index == 4) {
|
|
|
+ if (index == 7 || index == 6) {
|
|
|
sums[index] = sums[index]?.toFixed(2);
|
|
|
}
|
|
|
console.log(sums[index], index);
|
|
|
- if (index == 4) {
|
|
|
+ if (index == 7) {
|
|
|
this.totalMoney = sums[index];
|
|
|
}
|
|
|
} else {
|
|
@@ -1197,6 +1398,7 @@ export default {
|
|
|
saleProductNo: uuidv4(),
|
|
|
productNo: "", //货品编号
|
|
|
productType: "", //类型
|
|
|
+ lotNumber: "", //批号
|
|
|
productName: "", //货品名称
|
|
|
productNumber: "", //销售数量
|
|
|
productWeight: "", //销售重量kg
|
|
@@ -1207,6 +1409,11 @@ export default {
|
|
|
colourNumberLabel: "",
|
|
|
colourNumber: "", //色号
|
|
|
remark: "", //备注
|
|
|
+ specificationsList: [],
|
|
|
+ productSpecifications: "", //型号
|
|
|
+
|
|
|
+ inventoryBoxNum: "", //库存箱数
|
|
|
+ inventoryWeight: "", //库存重量
|
|
|
});
|
|
|
// 添加校验规则
|
|
|
this.initTableValidate();
|
|
@@ -1354,15 +1561,19 @@ export default {
|
|
|
} else {
|
|
|
throw Error("获取下拉框数据失败");
|
|
|
}
|
|
|
- let proRes = await getSaleOrderProductionList();
|
|
|
+ let proRes = await getSaleOrderProductionListDistinct();
|
|
|
if (proRes.code == 200) {
|
|
|
// let { production, customer } = proRes.data.resultMap;
|
|
|
- this.allProductionOptions = proRes.data || [];
|
|
|
- this.productionOptions =
|
|
|
- this.allProductionOptions.slice(0, 500) || [];
|
|
|
+ this.productionOptions = proRes.data;
|
|
|
} else {
|
|
|
throw Error("获取下拉框数据失败");
|
|
|
}
|
|
|
+ let allProRes = await getSaleOrderProductionList();
|
|
|
+ if (allProRes.code == 200) {
|
|
|
+ this.allProductionOptions = allProRes.data || [];
|
|
|
+ } else {
|
|
|
+ console.log(allProRes);
|
|
|
+ }
|
|
|
} catch (error) {
|
|
|
console.log(error);
|
|
|
}
|
|
@@ -1559,8 +1770,23 @@ export default {
|
|
|
};
|
|
|
payload.saleProductsList = this.productionTableData;
|
|
|
|
|
|
+ // 准备 提交 数据 start
|
|
|
+ this.form.saleCustomNo = saleCustomNo;
|
|
|
+ this.form.salesman = salesman;
|
|
|
+ this.form.noticeDate = moment(new Date()).format("YYYY-MM-DD");
|
|
|
+ this.form.drawer = this.username;
|
|
|
+ this.form.documentType = "1";
|
|
|
+ this.form.billingType = "1";
|
|
|
+ this.form.saleOrderNo = saleNo;
|
|
|
+ this.form.dispatchNoteRemark = orderRemark;
|
|
|
+ this.form.customerId = this.customerOptions.find(
|
|
|
+ (item) => item.customNo == saleCustomNo
|
|
|
+ )?.id;
|
|
|
+ // 准备 提交 数据 end
|
|
|
if (this.isEdit) {
|
|
|
payload.id = id;
|
|
|
+ payload.truckRegistration = this.form.truckRegistration;
|
|
|
+ delete payload.status;
|
|
|
let res = await editRetailOrder(payload);
|
|
|
if (res.code === 200) {
|
|
|
this.$message.success("修改成功");
|
|
@@ -1575,8 +1801,23 @@ export default {
|
|
|
let res = await addRetailOrder(payload);
|
|
|
if (res.code == 200) {
|
|
|
this.$message.success("添加成功");
|
|
|
- this.open = false;
|
|
|
- this.getList();
|
|
|
+ // 准备新增时 提交 数据 start
|
|
|
+ this.form.noticeNumber = this.getOrderNo();
|
|
|
+ this.form.status = 5;
|
|
|
+ this.form.id = res.data;
|
|
|
+ // 提交 新增接口
|
|
|
+ let result = await submitRetailOrder({
|
|
|
+ ...this.form,
|
|
|
+ saleProductInfoList: this.productionTableData,
|
|
|
+ });
|
|
|
+ if (result.code == 200) {
|
|
|
+ this.$message.success("提交成功");
|
|
|
+ this.open = false;
|
|
|
+ this.getList();
|
|
|
+ } else {
|
|
|
+ this.$message.error("提交失败");
|
|
|
+ }
|
|
|
+ // 准备新增时 提交 数据 end
|
|
|
} else {
|
|
|
this.$message.error("添加失败");
|
|
|
}
|
|
@@ -1589,6 +1830,32 @@ export default {
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
+ // 单号生成
|
|
|
+ getOrderNo() {
|
|
|
+ let year = new Date().getFullYear();
|
|
|
+ let month = new Date().getMonth() + 1;
|
|
|
+ let day = new Date().getDate();
|
|
|
+ if (month < 10) {
|
|
|
+ month = "0" + month;
|
|
|
+ }
|
|
|
+ if (day < 10) {
|
|
|
+ day = "0" + day;
|
|
|
+ }
|
|
|
+ let hour = new Date().getHours();
|
|
|
+ let minute = new Date().getMinutes();
|
|
|
+ let second = new Date().getSeconds();
|
|
|
+ if (hour < 10) {
|
|
|
+ hour = "0" + hour;
|
|
|
+ }
|
|
|
+ if (minute < 10) {
|
|
|
+ minute = "0" + minute;
|
|
|
+ }
|
|
|
+ if (second < 10) {
|
|
|
+ second = "0" + second;
|
|
|
+ }
|
|
|
+ let orderNo = year + month + day + hour + minute + second;
|
|
|
+ return orderNo;
|
|
|
+ },
|
|
|
// 审计 编辑回调
|
|
|
async handleEdit(index, row) {
|
|
|
console.log(row);
|
|
@@ -1881,7 +2148,7 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
// 初始化数据
|
|
|
- initData(data) {
|
|
|
+ async initData(data) {
|
|
|
let {
|
|
|
id,
|
|
|
//订单表数据
|
|
@@ -1898,6 +2165,7 @@ export default {
|
|
|
customAddress,
|
|
|
customCountryType, //国家类型
|
|
|
contactPerson, //联系人
|
|
|
+ truckRegistration, //货车登记
|
|
|
|
|
|
// 工艺表数据
|
|
|
remark,
|
|
@@ -1905,6 +2173,7 @@ export default {
|
|
|
// 产品列表
|
|
|
saleProductsList,
|
|
|
} = data;
|
|
|
+ this.form.truckRegistration = truckRegistration;
|
|
|
Object.assign(this.formData, {
|
|
|
id,
|
|
|
//订单表数据
|
|
@@ -1926,7 +2195,9 @@ export default {
|
|
|
orderRemark: remark,
|
|
|
});
|
|
|
this.customChangeHandler(saleCustomNo);
|
|
|
- this.productionTableData = saleProductsList.map((item) => {
|
|
|
+ let promiseArr = [],
|
|
|
+ promiseArr2 = [];
|
|
|
+ this.productionTableData = saleProductsList.map((item, index) => {
|
|
|
let {
|
|
|
id,
|
|
|
saleProductNo,
|
|
@@ -1941,20 +2212,28 @@ export default {
|
|
|
colourNumberLabel,
|
|
|
colourNumber, //色号
|
|
|
remark, //备注
|
|
|
+ lotNumber, //批号
|
|
|
} = item;
|
|
|
let targetItem = this.allProductionOptions.find(
|
|
|
- (i) => productNo == i.productNo
|
|
|
+ (i) => item.productNo == i.productNo
|
|
|
);
|
|
|
- if (
|
|
|
- !this.productionOptions.some((i) => i.productNo == item.productNo)
|
|
|
- ) {
|
|
|
- this.productionOptions.unshift(targetItem);
|
|
|
- }
|
|
|
// item.productType = targetItem?.productType;
|
|
|
let productType = targetItem?.productType;
|
|
|
+ let productSpecifications = targetItem?.productSpecifications;
|
|
|
+ promiseArr[index] = getProductSpecificationsByProductName({
|
|
|
+ productName: item.productName,
|
|
|
+ });
|
|
|
+ promiseArr2[index] = getProductInventory({
|
|
|
+ productNo,
|
|
|
+ productType,
|
|
|
+ lotNumber,
|
|
|
+ productName,
|
|
|
+ productSpecifications,
|
|
|
+ });
|
|
|
return {
|
|
|
id,
|
|
|
saleProductNo,
|
|
|
+ productSpecifications, //规格
|
|
|
productNo, //货品编号
|
|
|
productType, //类型
|
|
|
productName, //货品名称
|
|
@@ -1967,8 +2246,27 @@ export default {
|
|
|
colourNumberLabel,
|
|
|
colourNumber, //色号
|
|
|
remark,
|
|
|
+ lotNumber,
|
|
|
+ inventoryBoxNum: 0,
|
|
|
+ inventoryWeight: 0,
|
|
|
+ specificationsList: [],
|
|
|
};
|
|
|
});
|
|
|
+ let promiseRes = await Promise.all(promiseArr);
|
|
|
+ promiseRes.forEach((item, index) => {
|
|
|
+ this.productionTableData[index].specificationsList = item.data;
|
|
|
+ });
|
|
|
+ let promiseRes2 = await Promise.all(promiseArr2);
|
|
|
+ promiseRes2.forEach((item, index) => {
|
|
|
+ this.productionTableData[index].inventoryWeight =
|
|
|
+ item.data.inventoryWeight || 0;
|
|
|
+ this.productionTableData[index].inventoryBoxNum =
|
|
|
+ item.data.inventoryBoxNum || 0;
|
|
|
+ });
|
|
|
+ // this.productionTableData.forEach((item, index) => {
|
|
|
+ // item.inventoryWeight=promiseArr2[index].
|
|
|
+ // });
|
|
|
+
|
|
|
this.initTableValidate();
|
|
|
},
|
|
|
/** 修改按钮操作 */
|
|
@@ -2007,7 +2305,7 @@ export default {
|
|
|
let res = await getRetailOrderInfo(row.id);
|
|
|
console.log(res);
|
|
|
if (res.code == 200) {
|
|
|
- this.initData(res.data);
|
|
|
+ await this.initData(res.data);
|
|
|
this.printDomData = this.getPrintDom(res.data);
|
|
|
this.detailShow = true;
|
|
|
this.$nextTick(() => {
|
|
@@ -2087,7 +2385,8 @@ export default {
|
|
|
// 工艺表数据
|
|
|
orderRemark,
|
|
|
} = this.formData;
|
|
|
- this.productionTableData;
|
|
|
+ console.log(this.form, this.productionTableData);
|
|
|
+ let { truckRegistration } = this.form;
|
|
|
let customData = this.customerOptions.find(
|
|
|
(item) => item.customNo == saleCustomNo
|
|
|
);
|
|
@@ -2098,43 +2397,46 @@ export default {
|
|
|
<div style="text-align:center;">销售合同审计单</div>
|
|
|
<tbody>
|
|
|
<tr>
|
|
|
- <td width="600px" colspan="4">合同号:${saleNo}</td>
|
|
|
- <td width="600px" colspan="4">日期:${saleDate.replace(
|
|
|
+ <td width="600px" colspan="5">合同号:${saleNo}</td>
|
|
|
+ <td width="600px" colspan="6">日期:${saleDate.replace(
|
|
|
"T",
|
|
|
" "
|
|
|
)}</td>
|
|
|
</tr>
|
|
|
<tr align="center">
|
|
|
- <td width="300px" colspan="2">客户名称:</td>
|
|
|
- <td width="300px" colspan="2">${customerName}</td>
|
|
|
+ <td width="300px" colspan="3">客户名称:</td>
|
|
|
+ <td width="300px" colspan="3">${customerName}</td>
|
|
|
<td colspan="2">业务员:</td>
|
|
|
- <td colspan="2">${salesman}</td>
|
|
|
+ <td colspan="3">${salesman}</td>
|
|
|
|
|
|
</tr>
|
|
|
<tr align="center">
|
|
|
- <td width="300px" colspan="2">客户地址:</td>
|
|
|
- <td width="300px" colspan="2">${customAddress}</td>
|
|
|
+ <td width="300px" colspan="3">客户地址:</td>
|
|
|
+ <td width="300px" colspan="3">${customAddress}</td>
|
|
|
<td width="300px" colspan="2">客户国别:</td>
|
|
|
- <td width="300px" colspan="2">${customCountryType}</td>
|
|
|
+ <td width="300px" colspan="3">${customCountryType}</td>
|
|
|
</tr>
|
|
|
<tr align="center">
|
|
|
- <td width="300px" colspan="2">联系人:</td>
|
|
|
- <td width="150px" colspan="1">${contactPerson}</td>
|
|
|
+ <td width="300px" colspan="3">联系人:</td>
|
|
|
+ <td width="150px" colspan="3">${contactPerson}</td>
|
|
|
<td colspan="2">合计金额(大写):</td>
|
|
|
<td colspan="3">${saleAmountInWords}</td>
|
|
|
</tr>
|
|
|
<tr align="center">
|
|
|
- <td colspan="8">货品明细</td>
|
|
|
+ <td colspan="11">货品明细</td>
|
|
|
</tr>
|
|
|
<tr align="center">
|
|
|
<td width="150px">品名</td>
|
|
|
- <td width="150px">类型</td>
|
|
|
- <td width="150px">箱数</td>
|
|
|
- <td width="150px">单价</td>
|
|
|
- <td width="150px">金额</td>
|
|
|
- <td width="150px">切片型号</td>
|
|
|
- <td width="150px">色号</td>
|
|
|
- <td width="150px">备注</td>
|
|
|
+ <td width="100px">规格</td>
|
|
|
+ <td width="100px">色号</td>
|
|
|
+ <td width="100px">类型</td>
|
|
|
+ <td width="100px">批号</td>
|
|
|
+ <td width="100px">箱数</td>
|
|
|
+ <td width="100px">单价</td>
|
|
|
+ <td width="100px">金额</td>
|
|
|
+ <td width="100px">库存箱数</td>
|
|
|
+ <td width="150px">库存重量/kg</td>
|
|
|
+ <td width="100px">备注</td>
|
|
|
</tr>`;
|
|
|
let amountTotal = 0,
|
|
|
singlTotal = 0,
|
|
@@ -2156,13 +2458,16 @@ export default {
|
|
|
let productName = productData ? productData.productName : "";
|
|
|
let productType = productData ? productData.productType : "";
|
|
|
printStr += `<tr align="center">
|
|
|
- <td>${productName}</td>
|
|
|
- <td>${productType}</td>
|
|
|
+ <td>${item.productName}</td>
|
|
|
+ <td>${item.productSpecifications}</td>
|
|
|
+ <td>${item.colourNumberLabel}</td>
|
|
|
+ <td>${item.productType}</td>
|
|
|
+ <td>${item.lotNumber}</td>
|
|
|
<td>${item.productNumber}</td>
|
|
|
<td>${item.productUnitPrice}</td>
|
|
|
<td>${item.productAmounts}</td>
|
|
|
- <td>${item.sliceTypeLabel}</td>
|
|
|
- <td>${item.colourNumberLabel}</td>
|
|
|
+ <td>${item.inventoryBoxNum}</td>
|
|
|
+ <td>${item.inventoryWeight}</td>
|
|
|
<td>${item.remark}</td>
|
|
|
</tr>`;
|
|
|
}
|
|
@@ -2174,6 +2479,9 @@ export default {
|
|
|
<tr align="center">
|
|
|
<td>小计:</td>
|
|
|
<td></td>
|
|
|
+ <td></td>
|
|
|
+ <td></td>
|
|
|
+ <td></td>
|
|
|
<td>${amountTotal}</td>
|
|
|
<td>${singlTotal}</td>
|
|
|
<td>${moneyTotal}</td>
|
|
@@ -2182,7 +2490,7 @@ export default {
|
|
|
<td></td>
|
|
|
</tr>`;
|
|
|
printStr += `<tr align="left">
|
|
|
- <td colspan="8">订单备注:${orderRemark}</td>
|
|
|
+ <td colspan="11">订单备注:${orderRemark}</td>
|
|
|
</tr>
|
|
|
</tbody>
|
|
|
</table>`;
|
|
@@ -2771,6 +3079,7 @@ export default {
|
|
|
// row.colourNumberLabel = this.colourNumberOptions.find(
|
|
|
// (item) => item.materielCode == colourNumber
|
|
|
// )?.materieColorNumber;
|
|
|
+ this.updateStorage(row);
|
|
|
}
|
|
|
},
|
|
|
// 打印回调
|