Przeglądaj źródła

订单管理表单及按钮修改/解决补码是前端打印问题/销售出库显示异常处理/财务对账字段校对及导出问题处理/零售管理数据联动逻辑修改

lph 1 rok temu
rodzic
commit
619cee0236

+ 6 - 5
zkqy-ui/src/views/orderMange/codeListManage/printIndex.vue

@@ -1104,13 +1104,13 @@ export default {
       });
       this.changeGrossWeight(this.printTableData[0]);
       // 前端打印
-      codeListPrint(this.printTableData, "printDom");
+      // codeListPrint(this.printTableData, "printDom");
 
-      if (this.excuteType == 1) {
-        this.tableData.push(this.printTableData[0]);
-      }
+      // if (this.excuteType == 1) {
+      //   this.tableData.push(this.printTableData[0]);
+      // }
       // 后端打印
-      // this.newPrintHandler();
+      this.newPrintHandler();
     },
     // 获取机台选项数据
     async getLineOptionLsit() {
@@ -1131,6 +1131,7 @@ export default {
     },
     // 补码打印回调
     handleSuppleOne(row) {
+      console.log(row);
       this.printTableData = [row];
       this.printConfirmHandler(row.id);
     },

+ 40 - 35
zkqy-ui/src/views/orderMange/components/dialogForm/OutStock.vue

@@ -1,7 +1,9 @@
 <template>
   <div class="table-container">
-    <div style="float: right;margin: 0px;padding: 0px">
-      <el-button @click="exportOutInfo" type="success" icon="el-icon-download">导出明细</el-button>
+    <div style="float: right; margin: 0px; padding: 0px">
+      <el-button @click="exportOutInfo" type="success" icon="el-icon-download"
+        >导出明细</el-button
+      >
     </div>
     <div style="clear: both"></div>
     <el-row :gutter="20" class="mb10">
@@ -32,7 +34,7 @@
       :summary-method="getSummaries"
       show-summary
     >
-      <el-table-column type="index" width="50"/>
+      <el-table-column type="index" width="50" />
       <el-table-column prop="productName" label="品名"></el-table-column>
       <el-table-column prop="productSpecifications" label="规格">
       </el-table-column>
@@ -48,7 +50,9 @@
           <el-button
             size="mini"
             type="danger"
-            @click="handleDelete(scope.$index, scope.row)">删除</el-button>
+            @click="handleDelete(scope.$index, scope.row)"
+            >删除</el-button
+          >
         </template>
       </el-table-column>
     </el-table>
@@ -63,10 +67,9 @@
 </template>
 
 <script>
-import {outboundDetails} from "@/api/system/retailMange.js";
+import { outboundDetails } from "@/api/system/retailMange.js";
 import moment from "moment";
-import {removeErrorOutboundRecord} from "@/api/system/ProductWarehousingRecord";
-
+import { removeErrorOutboundRecord } from "@/api/system/ProductWarehousingRecord";
 
 export default {
   name: "OutStock",
@@ -76,7 +79,7 @@ export default {
     return {
       tableData: [],
       row: {},
-      orderRow:{},
+      orderRow: {},
       // 分页相关
       total: 0,
       queryParams: {
@@ -85,49 +88,50 @@ export default {
       },
     };
   },
-  computed: {
-
-  },
+  computed: {},
   created() {
-    this.orderRow={}
+    this.orderRow = {};
   },
   methods: {
     //删除回滚对应产品的库存
-    handleDelete(index,row){
-      this.$confirm("是否删除名称为 “"+row.productName+"” 出库明细数据", "提示", { type: "warning" }).then(
-        () => {
-          removeErrorOutboundRecord(row.id).then(res=>{
-            if (res.code == 200) {
-              this.$message.success("删除成功");
-              this.getOutStockDetail(this.orderRow);
-            } else {
-              this.$message.error("删除失败");
-              throw Error("删除失败");
-            }
-          })
-        }
-      );
+    handleDelete(index, row) {
+      this.$confirm(
+        "是否删除名称为 “" + row.productName + "” 出库明细数据",
+        "提示",
+        { type: "warning" }
+      ).then(() => {
+        removeErrorOutboundRecord(row.id).then((res) => {
+          if (res.code == 200) {
+            this.$message.success("删除成功");
+            this.getOutStockDetail(this.orderRow);
+          } else {
+            this.$message.error("删除失败");
+            throw Error("删除失败");
+          }
+        });
+      });
       //出库
-      console.log("删除出库产品、回滚库存",row)
+      console.log("删除出库产品、回滚库存", row);
     },
     exportOutInfo() {
       if (this.tableData.length == 0) {
-        this.$message.warning("没有出库数据!")
+        this.$message.warning("没有出库数据!");
         return;
       }
-      let {saleNo} = this.row;
+      let { saleNo } = this.row;
       // 出库明细导出
-      this.download("system/ProductOutboundRecord/importDataOutboundDetails",
+      this.download(
+        "system/ProductOutboundRecord/importDataOutboundDetails",
         {
           saleOrderNo: saleNo,
-          isEnablePaging: false
+          isEnablePaging: false,
         },
         `${saleNo}_出库明细_${new Date().getTime()}.xlsx`
       );
     },
     // 自定义的小计计算方法
     getSummaries(param) {
-      const {columns, data} = param;
+      const { columns, data } = param;
       const sums = [];
       columns.forEach((column, index) => {
         if (index === 5) {
@@ -142,7 +146,8 @@ export default {
           index === 3 ||
           index === 4 ||
           index === 8 ||
-          index === 9
+          index === 9 ||
+          index === 10
         ) {
           sums[index] = "";
         } else if (!values.every((value) => isNaN(value))) {
@@ -171,8 +176,8 @@ export default {
     },
     // 获取出库详情
     async getOutStockDetail(row) {
-      this.orderRow =row;
-      let {saleNo} = row;
+      this.orderRow = row;
+      let { saleNo } = row;
       this.row = row;
       try {
         let payLoad = {

+ 733 - 44
zkqy-ui/src/views/orderMange/financialReconciliation/index.vue

@@ -13,31 +13,26 @@
           v-model="queryParams.orderType"
           placeholder="订单类型"
           @keyup.enter.native.prevent
-          @change="handleQuery">
-          <el-option
-            key="contractOrder"
-            label="合同单"
-            value="false">
+          @change="handleQuery"
+        >
+          <el-option key="contractOrder" label="合同单" value="contractOrder">
           </el-option>
-          <el-option
-            key="retailOrder"
-            label="零售单"
-            value="true">
+          <el-option key="retailOrder" label="零售单" value="retailOrder">
           </el-option>
         </el-select>
       </el-form-item>
-      <el-form-item label="通知单号" prop="noticeNumber">
+      <el-form-item label="合同号" prop="saleNo">
         <el-input
-          v-model="queryParams.noticeNumber"
+          v-model="queryParams.saleNo"
           placeholder="请输入通知单号"
           clearable
           @keyup.enter.native="handleQuery"
         />
       </el-form-item>
-      <el-form-item label="日期" prop="noticeDate">
+      <el-form-item label="日期" prop="saleDate">
         <el-date-picker
           clearable
-          v-model="queryParams.noticeDate"
+          v-model="queryParams.saleDate"
           type="date"
           value-format="yyyy-MM-dd"
           placeholder="请选择通知日期"
@@ -87,13 +82,11 @@
           icon="el-icon-search"
           size="mini"
           @click="handleQuery"
-        >搜索
-        </el-button
-        >
+          >搜索
+        </el-button>
         <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
-        >重置
-        </el-button
-        >
+          >重置
+        </el-button>
       </el-form-item>
     </el-form>
 
@@ -142,9 +135,8 @@
           size="mini"
           @click="handleExport"
           v-hasPermi="['system:ProductInvoice:export']"
-        >导出
-        </el-button
-        >
+          >导出
+        </el-button>
       </el-col>
       <right-toolbar
         :showSearch.sync="showSearch"
@@ -159,17 +151,13 @@
     >
       <!-- <el-table-column label="编号" align="center" prop="id" />
        -->
-      <el-table-column
-        label="日期"
-        align="center"
-        prop="noticeDate"
-        width="180"
-      >
+      <el-table-column type="selection" width="55" align="center" />
+      <el-table-column label="日期" align="center" prop="saleDate" width="180">
         <template slot-scope="scope">
-          <span>{{ parseTime(scope.row.noticeDate, "{y}-{m}-{d}") }}</span>
+          <span>{{ parseTime(scope.row.saleDate, "{y}-{m}-{d}") }}</span>
         </template>
       </el-table-column>
-      <el-table-column label="通知单号" align="center" prop="noticeNumber"/>
+      <el-table-column label="合同号" align="center" prop="saleNo" />
 
       <!-- <el-table-column label="销售员" align="center" prop="salesman" />
       <el-table-column label="客户编号" align="center" prop="customerId" />
@@ -189,7 +177,13 @@
       <el-table-column label="售货单位" align="center" prop="sellingUnit" />
       <el-table-column label="计算类型" align="center" prop="calculationType" />
       <el-table-column label="审核意见" align="center" prop="auditOpinion" /> -->
-      <el-table-column label="客户名称" align="center" prop="customerName"/>
+      <el-table-column label="客户名称" align="center" prop="customName" />
+      <el-table-column
+        label="金额(大写)"
+        align="center"
+        prop="saleAmountInWords"
+      />
+      <el-table-column label="销售" align="center" prop="salesman" />
       <!-- <el-table-column label="状态" align="center" prop="status">
         <template slot-scope="scope">{{ scope.row.status }}</template>
       </el-table-column> -->
@@ -216,10 +210,23 @@
                 >
               </el-dropdown-item> -->
               <el-dropdown-item>
-                <el-button type="text" size="mini" @click="handleSendOrder(scope.$index, scope.row)">
+                <el-button
+                  type="text"
+                  size="mini"
+                  @click="handleSendOrder(scope.$index, scope.row)"
+                >
                   打印对账单
                 </el-button>
               </el-dropdown-item>
+              <el-dropdown-item>
+                <el-button
+                  type="text"
+                  size="mini"
+                  @click="handleDetail(scope.$index, scope.row)"
+                >
+                  详情
+                </el-button>
+              </el-dropdown-item>
             </el-dropdown-menu>
           </el-dropdown>
         </template>
@@ -233,6 +240,16 @@
       :limit.sync="queryParams.pageSize"
       @pagination="getList"
     />
+    <!-- 详情弹窗 -->
+    <el-dialog title="详情" :visible.sync="detailShow" width="1250px">
+      <div ref="detailTable" id="detail"></div>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="detailShow = false">关 闭</el-button>
+        <!-- <el-button type="primary" @click="detailPrintHandler"
+            >打 印</el-button
+          > -->
+      </span>
+    </el-dialog>
     <div id="printDom"></div>
   </div>
 </template>
@@ -251,13 +268,36 @@ import {
   productInvoiceInfo,
   queryDropDownBoxData,
   printDocuments,
+  getProductSpecificationsByProductName,
 } from "@/api/tablelist/commonTable";
-import {mapState} from "vuex";
+import { getSaleOrderProductionList } from "@/api/dragform/form";
+import { mapState } from "vuex";
+import {
+  saleOrderList,
+  getRoleUser,
+  addRetailOrder,
+  getRetailOrderInfo,
+  editRetailOrder,
+  retailProductInvoiceInfo,
+  submitRetailOrder,
+  cancelRetailOrder,
+  deleRetailOrder,
+  submitProductInvoice,
+  getProductInventory,
+  updateOrder,
+} from "@/api/system/retailMange.js";
 
 export default {
   name: "ProductInvoice",
+  dicts: ["sales_order_type", "payment_method", "direction_of_twist"],
   data() {
     return {
+      formData: {},
+      salesmanList: [],
+      colourNumberOptions: [],
+      sliceTypeOptions: [],
+      allProductionOptions: [],
+      detailShow: false,
       customerOptions: [],
       // 遮罩层
       loading: true,
@@ -279,6 +319,8 @@ export default {
       open: false,
       // 查询参数
       queryParams: {
+        saleDate: "",
+        saleNo: "",
         pageNum: 1,
         pageSize: 10,
         noticeNumber: null,
@@ -294,7 +336,7 @@ export default {
         calculationType: null,
         auditOpinion: null,
         status: 2,
-        orderType: "contractOrder"  // 零售单/合同单
+        orderType: "contractOrder", // 零售单/合同单
       },
       // 表单参数
       form: {},
@@ -307,13 +349,612 @@ export default {
   },
   computed: {
     ...mapState({
+      nickName: (state) => state.user.nickName,
+      userInfo: (state) => state.user,
       username: (state) => state.user.name,
     }),
   },
   methods: {
+    // 客户名称改变回调
+    customChangeHandler(val) {
+      // if (!val) return;
+      let customData = this.customerOptions.find(
+        (item) => item.customNo == val
+      );
+      this.formData.customAddress = customData?.customAddress || "无";
+      this.formData.customCountryType = customData?.customCountryType || "无";
+      this.formData.contactPerson = customData?.contactPerson || "无";
+    },
+    // 根据字典value获取字典label
+    getDictLabel(value, dict) {
+      return (
+        this.dict.type[dict].find((item) => {
+          return item.value === value;
+        })?.label || ""
+      );
+    },
+    // 获取详情数据
+    async handleDetail(index, row) {
+      if (this.queryParams.orderType == "contractOrder") {
+        //销售订单
+        this.printDomData = await this.getDetailTableString(row);
+        this.detailShow = true;
+        this.$nextTick(() => {
+          this.$refs.detailTable.innerHTML = this.printDomData;
+        });
+      } else {
+        // 零售订单
+        this.handlePrint(row);
+      }
+    },
+    // 获取销售员角色列表
+    async getRoleUser() {
+      try {
+        let res = await getRoleUser("salesman");
+        if (res.code == 200) {
+          this.salesmanList = res.data.map((item) => {
+            return {
+              label: item.nickName,
+              value: item.nickName,
+              id: item.userId,
+            };
+          });
+        } else {
+          this.$message.error("获取销售员角色列表失败");
+        }
+      } catch (error) {
+        console.log(error);
+      }
+    },
+    // 零售订单详情
+    async handlePrint(row) {
+      // await this.getDropDownData();
+      this.isLeader = !this.userInfo.roles.includes("salesman");
+      if (!this.isLeader) {
+        this.createById = this.userInfo.userId;
+      }
+      await this.getRoleUser();
+      try {
+        let res = await getRetailOrderInfo(row.id);
+        console.log(res);
+        if (res.code == 200) {
+          await this.initData(res.data);
+          this.printDomData = this.getPrintDom(res.data);
+          this.detailShow = true;
+          this.$nextTick(() => {
+            this.$refs.detailTable.innerHTML = this.printDomData;
+          });
+        } else {
+          this.$message.error(res.msg);
+        }
+      } catch (error) {
+        console.log(error);
+      }
+    },
+    async initData(data) {
+      let {
+        id,
+        //订单表数据
+        saleNo,
+        saleCustomNo,
+        saleDate,
+        saleOrderEstimatedTime,
+        saleLeadTime,
+        deliveryDate,
+        saleAmounts,
+        saleAmountInWords,
+        salePayType,
+        salesman,
+        customAddress,
+        customCountryType, //国家类型
+        contactPerson, //联系人
+        truckRegistration, //货车登记
+
+        // 工艺表数据
+        remark,
+
+        // 产品列表
+        saleProductsList,
+      } = data;
+      this.form.truckRegistration = truckRegistration;
+      Object.assign(this.formData, {
+        id,
+        //订单表数据
+        saleNo,
+        saleCustomNo,
+        saleDate,
+        saleOrderEstimatedTime,
+        saleLeadTime,
+        deliveryDate,
+        saleAmounts,
+        saleAmountInWords,
+        salePayType,
+        salesman,
+        customAddress,
+        customCountryType, //国家类型
+        contactPerson, //联系人
+
+        // 工艺表数据
+        orderRemark: remark,
+      });
+      this.customChangeHandler(saleCustomNo);
+      let promiseArr = [],
+        promiseArr2 = [];
+      this.productionTableData = saleProductsList.map((item, index) => {
+        let {
+          id,
+          saleProductNo,
+          productNo, //货品编号
+          productName, //货品名称
+          productNumber, //销售数量
+          productWeight, //销售重量kg
+          productUnitPrice, //单价
+          productAmounts, //金额
+          sliceType, //切片类型  初始为  切片
+          sliceTypeLabel,
+          colourNumberLabel,
+          colourNumber, //色号
+          remark, //备注
+          lotNumber, //批号
+        } = item;
+        let targetItem = this.allProductionOptions.find(
+          (i) => item.productNo == i.productNo
+        );
+        // 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, //货品名称
+          productNumber, //销售数量
+          productWeight, //销售重量kg
+          productUnitPrice, //单价
+          productAmounts, //金额
+          sliceType, //切片类型  初始为  切片
+          sliceTypeLabel,
+          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;
+      });
+    },
+    // 获取打印dom
+    getPrintDom(data) {
+      let {
+        id,
+        //订单表数据
+        saleNo,
+        saleCustomNo,
+        saleDate,
+        saleOrderEstimatedTime,
+        saleLeadTime,
+        deliveryDate,
+        saleAmounts,
+        saleAmountInWords,
+        salePayType,
+        salesman,
+        customAddress,
+        customCountryType, //国家类型
+        contactPerson, //联系人
+
+        // 工艺表数据
+        orderRemark,
+      } = this.formData;
+      console.log(this.form, this.productionTableData);
+      let { truckRegistration } = this.form;
+      let customData = this.customerOptions.find(
+        (item) => item.customNo == saleCustomNo
+      );
+      let customerName = customData ? customData.customName : "";
+      let printStr = `
+        <table style="width:1200px; border-collapse:collapse;" border="1" cellpadding="10" align="center">
+            <div style="text-align:center;font-size: 20px;">诸暨市新丝维纤维有限公司</div>
+            <div style="text-align:center;">销售合同审计单</div>
+            <tbody>
+                <tr>
+                    <td width="600px" colspan="4">合同号:${saleNo}</td>
+                    <td width="600px" colspan="5">日期:${saleDate.replace(
+                      "T",
+                      " "
+                    )}</td>
+                </tr>
+                <tr align="center">
+                    <td width="300px" colspan="2">客户名称:</td>
+                    <td width="300px" colspan="3">${customerName}</td>
+                    <td colspan="2">业务员:</td>
+                    <td colspan="2">${salesman}</td>
+
+                </tr>
+                <tr align="center">
+                    <td width="300px" colspan="2">客户地址:</td>
+                    <td width="300px" colspan="3">${customAddress}</td>
+                    <td width="300px" colspan="2">客户国别:</td>
+                    <td width="300px" colspan="2">${customCountryType}</td>
+                </tr>
+                <tr align="center">
+                    <td width="300px" colspan="2">联系人:</td>
+                    <td width="150px" colspan="2">${contactPerson}</td>
+                    <td  colspan="2">合计金额(大写):</td>
+                    <td colspan="3">${saleAmountInWords}</td>
+                </tr>
+                <tr align="center">
+                    <td colspan="9">货品明细</td>
+                </tr>
+                <tr align="center">
+                    <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>
+                </tr>`;
+      let amountTotal = 0,
+        singlTotal = 0,
+        moneyTotal = 0;
+      for (let i = 0; i < this.productionTableData.length; i++) {
+        let item = this.productionTableData[i];
+        amountTotal += Number(item.productNumber);
+        singlTotal += Number(item.productUnitPrice);
+        moneyTotal += Number(item.productAmounts);
+        let productData = this.allProductionOptions.find(
+          (pro) => pro.productNo == item.productNo
+        );
+        item.sliceTypeLabel =
+          this.sliceTypeOptions.find((k) => k.materielCode == item.sliceType)
+            ?.materielName || "";
+        item.colourNumberLabel = this.colourNumberOptions.find(
+          (k) => k.materielCode == item.colourNumber
+        )?.materieColorNumber;
+        let productName = productData ? productData.productName : "";
+        let productType = productData ? productData.productType : "";
+        printStr += `<tr align="center">
+                    <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.remark}</td>
+                </tr>`;
+      }
+      // 计算小计
+      amountTotal = amountTotal;
+      singlTotal = singlTotal.toFixed(2);
+      moneyTotal = moneyTotal.toFixed(2);
+      printStr += `
+        <tr align="center">
+          <td>小计:</td>
+           <td></td>
+           <td></td>
+          <td></td>
+          <td></td>
+          <td>${amountTotal}</td>
+          <td>${singlTotal}</td>
+          <td>${moneyTotal}</td>
+          <td></td>
+        </tr>`;
+      printStr += `<tr align="left">
+                    <td colspan="9">订单备注:${orderRemark}</td>
+                </tr>
+                </tbody>
+        </table>`;
+      return printStr;
+    },
+    // 获取详情html字符串
+    async getDetailTableString(row) {
+      let { saleNo } = row;
+      let payLoad = [
+        {
+          basicMap: {
+            tableName: "sale_order",
+          },
+          conditionMap: {
+            sale_no: [saleNo],
+          },
+        },
+        {
+          basicMap: {
+            tableName: "sale_products",
+          },
+          conditionMap: {
+            sale_order_no: [saleNo],
+          },
+        },
+        {
+          basicMap: {
+            tableName: "sale_craft",
+          },
+          conditionMap: {
+            sale_order_no: [saleNo],
+          },
+        },
+      ];
+      let res = await queryDropDownBoxData(payLoad);
+      if (res.code == 200) {
+        console.log(res);
+        let { sale_craft, sale_order, sale_products } = res.data.resultMap;
+        let {
+          //订单表数据
+          saleNo, //合同号
+          lotNumber, //批号
+          saleCustomNo, //客户编号
+          saleDate, //销售单日期
+          saleOrderEstimatedTime, //预计下单时间
+          saleLeadTime, //交货周期
+          deliveryDate,
+          saleAmounts, //合计金额 小写
+          saleAmountInWords, //合计金额 大写
+          salePayType, //支付方式
+          earnestMoney,
+          salesman, //业务员
+          saleLeader, //业务主管
+          finance, //财务部
+          production, //生产部
+          saleApprover, //批准人
+          // customAddress, //客户地址
+          // customCountryType, //国家类型
+          // contactPerson, //联系人
+          // 货品明细表数据
+          // productNo, //货品号
+          // productName, //货品名称
+          // productNumber: "", //销售数量
+          // productWeight: "", //销售重量kg
+          // productUnitPrice: "", //单价
+          // productAmounts: "", //金额
+          // remark: "", //备注
+          // 工艺表
+          craftGrid, //网络
+          craftOil, //油剂
+          craftPackage, //卷装
+          craftColorFastness, //色牢度
+          directionOfTwist,
+          craftOther, //其它工艺要求
+          craftMark, //包装/贴唛
+          shippingMethod, //运输方式
+        } = { ...sale_craft[0], ...sale_order[0] };
+        let customData = this.customerOptions.find(
+          (item) => item.customNo == saleCustomNo
+        );
+        let payType = this.getDictLabel(salePayType, "payment_method"); //付款方式
+        let customerName = customData ? customData.customName : "";
+        let customAddress = customData?.customAddress || "无";
+        let customCountryType = customData?.customCountryType || "";
+        let contactPerson = customData?.contactPerson || "无";
+        let directionOfTwistDescription = directionOfTwist
+          ? this.getDictLabel(directionOfTwist, "direction_of_twist")
+          : "";
+        let printStr = `
+        <table style="width:1200px; border-collapse:collapse;" border="1" cellpadding="10" align="center">
+            <div style="text-align:center;font-size: 20px;">诸暨市新丝维纤维有限公司</div>
+            <div style="text-align:center;">销售合同审计单</div>
+            <tbody>
+                <tr>
+                    <td width="600px" colspan="4">合同号:${saleNo}</td>
+                    <td width="600px" colspan="5">日期:${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="2">联系人:</td>
+                    <td width="150px" colspan="3">${contactPerson}</td>
+                </tr>
+                <tr align="center">
+                    <td width="300px" colspan="2">客户地址:</td>
+                    <td width="300px" colspan="3">${customAddress}</td>
+                    <td width="300px" colspan="2">客户国别:</td>
+                    <td width="300px" colspan="2">${customCountryType}</td>
+                </tr>
+                <tr align="center">
+                    <td width="300px" colspan="2">预计下单时间:</td>
+                    <td  colspan="1">${saleOrderEstimatedTime.replace(
+                      "T",
+                      " "
+                    )}</td>
+                    <td  colspan="2">交货周期:</td>
+                    <td >${saleLeadTime}</td>
+                    <td  colspan="2">交货日期:</td>
+                    <td >${deliveryDate.replace("T", " ")}</td>
+                </tr>
+                <tr align="center">
+                    <td colspan="9">货品明细</td>
+                </tr>
+                <tr align="center">
+                    <td width="150px">品名</td>
+                    <td width="100px">规格</td>
+                    <td width="100px">类型</td>
+                    <td width="100px">色号</td>
+                    <td width="150px">数量/kg</td>
+                    <td width="150px">单价</td>
+                    <td width="150px">金额</td>
+                    <td width="150px">切片型号</td>
+                    <td width="150px">备注</td>
+                </tr>`;
+        let amountTotal = 0,
+          singlTotal = 0,
+          moneyTotal = 0;
+        for (let i = 0; i < sale_products.length; i++) {
+          let item = sale_products[i];
+          amountTotal += Number(item.productNumber);
+          singlTotal += Number(item.productUnitPrice);
+          moneyTotal += Number(item.productAmounts);
+          let productData = this.allProductionOptions.find(
+            (pro) => pro.productNo == item.productNo
+          );
+          console.log(item.productNo, productData, this.allProductionOptions);
+          item.sliceTypeLabel =
+            this.sliceTypeOptions.find((k) => k.materielCode == item.sliceType)
+              ?.materielName || "";
+          item.colourNumberLabel = this.colourNumberOptions.find(
+            (k) => k.materielCode == item.colourNumber
+          )?.materieColorNumber;
+          // item.materieEncoding + item.materieColorNumber
+          let materieEncoding = this.colourNumberOptions.find(
+            (k) => k.materielCode == item.colourNumber
+          )?.materieEncoding;
+          let productName = productData ? productData.productName : "";
+          let productType = productData ? productData.productType : "";
+          let productSpecifications = productData
+            ? productData.productSpecifications
+            : ""; //规格
+          printStr += `<tr align="center">
+                    <td>${productName}</td>
+                    <td>${productSpecifications}</td>
+                    <td>${productType}</td>
+                    <td>${materieEncoding + item.colourNumberLabel}</td>
+                    <td>${item.productNumber}</td>
+                    <td>${item.productUnitPrice}</td>
+                    <td>${item.productAmounts}</td>
+                    <td>${item.sliceTypeLabel}</td>
+                    <td>${item.remark}</td>
+                </tr>`;
+        }
+        // 计算小计
+        printStr += `
+        <tr align="center">
+          <td>小计:</td>
+           <td></td>
+           <td></td>
+          <td></td>
+          <td>${amountTotal.toFixed(2)}</td>
+          <td>${singlTotal.toFixed(2)}</td>
+          <td>${moneyTotal.toFixed(2)}</td>
+          <td></td>
+          <td></td>
+        </tr>
+                <tr>
+                    <td colspan="9">合计金额(大写):${saleAmountInWords}</td>
+                </tr>
+                `;
+
+        if (salePayType == "1") {
+          //定金
+          printStr += `
+          <tr>
+            <td colspan="4">付款方式:${payType}</td>
+            <td colspan="5">定金:${earnestMoney}</td>
+          </tr>`;
+        } else {
+          printStr += `
+         <tr>
+              <td colspan="9">付款方式:${payType}</td>
+          </tr>`;
+        }
+        printStr += `<tr align="center">
+                    <td colspan="9">工艺要求</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="150px"></td>
+                </tr>
+                <tr align="center">
+                    <td >${craftGrid}</td>
+                    <td>${craftOil}</td>
+                    <td>${craftPackage}</td>
+                    <td>${craftColorFastness}</td>
+                    <td>${directionOfTwistDescription}</td>
+                    <td>${craftOther}</td>
+                    <td width="150px"></td>
+                    <td width="150px"></td>
+                    <td width="150px"></td>
+                </tr>
+                <tr>
+                    <td colspan="9">包装/贴唛:${craftMark}</td>
+                </tr>
+                <tr>
+                    <td colspan="9">装运方式:${shippingMethod}</td>
+                </tr>
+                <tr align="center">
+                    <td colspan="2">业务员:</td>
+                    <td colspan="2">${salesman}</td>
+                    <td colspan="2">财务部:</td>
+                    <td colspan="3">${finance}</td>
+
+                </tr>
+
+                <tr align="center">
+                    <td colspan="2">业务主管:</td>
+                    <td colspan="2">${saleApprover}</td>
+                    <td></td>
+                    <td></td>
+                    <td></td>
+                    <td></td>
+                    <td></td>
+                </tr>
+            </tbody>
+        </table>
+        `;
+        return printStr;
+        // <td colspan="2">业务主管:</td>
+        // <td colspan="2">${saleLeader}</td>
+        // <tr align="center">
+
+        //     // <td colspan="2">生产部:</td>
+        //     // <td colspan="2">${production}</td>
+        // </tr>
+        //         <tr align="center">
+        //             <td colspan="2"> 2</td>
+        //             <td> </td>
+        //             <td> </td>
+        //             <td> </td>
+        //             <td> </td>
+        //         </tr>
+        //         <tr>
+        //             <td colspan="2">小计:</td>
+        //             <td></td>
+        //             <td></td>
+        //             <td></td>
+        //             <td></td>
+        //         </tr>
+      }
+    },
     // 初始化下拉框数据
     async initDropDownBoxData() {
       try {
+        // 用户数据
         let res = await queryDropDownBoxData([
           {
             basicMap: {
@@ -327,13 +968,58 @@ export default {
         } else {
           throw new Error(res);
         }
+        // 产品数据
+        let proRes = await getSaleOrderProductionList();
+        if (proRes.code == 200) {
+          this.allProductionOptions = proRes.data || [];
+        } else {
+          throw Error("获取下拉框数据失败");
+        }
+        // 切片数据
+        let payLoad = [
+          {
+            basicMap: {
+              tableName: "materiel",
+            },
+            conditionMap: {
+              materiel_species: ["6"],
+            },
+          },
+        ];
+        let res2 = await queryDropDownBoxData(payLoad);
+        if (res2.code == 200) {
+          console.log(res2.data.resultMap);
+          let { materiel } = res2.data.resultMap;
+          this.sliceTypeOptions = materiel || [];
+        } else {
+          throw Error("获取下拉框数据失败");
+        }
+        // 颜色数据
+        let payLoad3 = [
+          {
+            basicMap: {
+              tableName: "materiel",
+            },
+            conditionMap: {
+              materiel_species: ["1"],
+            },
+          },
+        ];
+        let res3 = await queryDropDownBoxData(payLoad3);
+        if (res3.code == 200) {
+          console.log(res3.data.resultMap);
+          let { materiel } = res3.data.resultMap;
+          this.colourNumberOptions = materiel || [];
+        } else {
+          throw Error("获取下拉框数据失败");
+        }
       } catch (error) {
         console.log(error);
       }
     },
     // 打印发货单回调
     async handleDeliverOrder(index, row) {
-      let {saleOrderNo} = row;
+      let { saleOrderNo } = row;
       if (!saleOrderNo) {
         this.$message.error("数据异常,暂无saleOrderNo");
       }
@@ -350,7 +1036,7 @@ export default {
           printUser: this.username,
         });
         deliverOrderPrint(
-          {...row, ...printData, printUser: this.username},
+          { ...row, ...printData, printUser: this.username },
           "printDom"
         );
       } else {
@@ -361,15 +1047,18 @@ export default {
     },
     // 打印送货单回调
     async handleSendOrder(index, row) {
-      let {saleOrderNo} = row;
-      if (!saleOrderNo) {
-        this.$message.error("数据异常,暂无saleOrderNo");
+      let { saleNo } = row;
+      if (!saleNo) {
+        this.$message.error("数据异常,saleNo");
+        return;
       }
       let payload = {
-        saleOrderNo: saleOrderNo,
+        saleOrderNo: saleNo,
       };
       // let res = await productInvoiceInfo(payload);
-      let res = await printDocuments({id: row.id});
+      let res = await printDocuments({ id: row.id });
+      // console.log(res);
+      // return;
       if (res.code == 200) {
         let printData = res.data;
         console.log("printData", {
@@ -378,7 +1067,7 @@ export default {
           printUser: this.username,
         });
         sendOrderPrint(
-          {...row, ...printData, printUser: this.username},
+          { ...row, ...printData, printUser: this.username },
           "printDom"
         );
       } else {
@@ -497,8 +1186,7 @@ export default {
           this.getList();
           this.$modal.msgSuccess("删除成功");
         })
-        .catch(() => {
-        });
+        .catch(() => {});
     },
     /** 导出按钮操作 */
     handleExport() {
@@ -506,6 +1194,7 @@ export default {
         "/system/ProductInvoice/importFinancialStatement",
         {
           ...this.queryParams,
+          ids: this.ids,
         },
         `客户销售汇总_${new Date().getTime()}.xlsx`
       );

+ 12 - 8
zkqy-ui/src/views/orderMange/index.vue

@@ -472,7 +472,6 @@
                     <el-select
                       v-model="scope.row.colourNumber"
                       placeholder=""
-                      clearable
                       filterable
                       @change="colourNumberChangeHandler(scope.row)"
                     >
@@ -1381,9 +1380,9 @@ export default {
         productNo: "", //货品编号
         productType: "", //类型
         productName: "", //货品名称
-        productNumber: "", //销售数量
-        productWeight: "", //销售重量kg
-        productUnitPrice: "", //单价
+        productNumber: 0, //销售数量
+        productWeight: 0, //销售重量kg
+        productUnitPrice: 0, //单价
         productAmounts: "", //金额
         sliceType: "", //切片类型
         sliceTypeLabel: "",
@@ -1407,7 +1406,11 @@ export default {
         fieldName,
         this.productionTableData[Number(index)][fieldName]
       );
-      if (!this.productionTableData[Number(index)][fieldName]) {
+      if (
+        !this.productionTableData[Number(index)][fieldName] &&
+        this.productionTableData[Number(index)][fieldName] !== 0 &&
+        this.productionTableData[Number(index)][fieldName] !== "0"
+      ) {
         callback(new Error(message));
       } else {
         callback();
@@ -1612,7 +1615,7 @@ export default {
               btnType: "myEdit",
               btnIcon: "",
               btnShowCondition:
-                '[{"fieldName":"sale_order.status","mark":"3","refValue":"2"},{"fieldName":"sale_order.status","mark":"3","refValue":"3"},{"fieldName":"sale_order.status","mark":"3","refValue":"4"},{"fieldName":"sale_order.status","mark":"3","refValue":"5"},{"fieldName":"sale_order.status","mark":"3","refValue":"6"},{"fieldName":"sale_order.status","mark":"3","refValue":"8"},{"fieldName":"sale_order.status","mark":"3","refValue":"100"},{"fieldName":"sale_order.status","mark":"3","refValue":"101"}]',
+                '[{"fieldName":"sale_order.status","mark":"3","refValue":"2"},{"fieldName":"sale_order.status","mark":"3","refValue":"3"},{"fieldName":"sale_order.status","mark":"3","refValue":"4"},{"fieldName":"sale_order.status","mark":"3","refValue":"5"},{"fieldName":"sale_order.status","mark":"3","refValue":"6"},{"fieldName":"sale_order.status","mark":"3","refValue":"8"},{"fieldName":"sale_order.status","mark":"3","refValue":"9"},{"fieldName":"sale_order.status","mark":"3","refValue":"100"},{"fieldName":"sale_order.status","mark":"3","refValue":"101"}]',
               btnHasPermi: "huaxian:xsglddgl:INSERT",
               children: [],
             },
@@ -1660,7 +1663,7 @@ export default {
               btnType: "myDelete",
               btnIcon: "",
               btnShowCondition:
-                '[{"fieldName":"sale_order.status","mark":"3","refValue":"2"},{"fieldName":"sale_order.status","mark":"3","refValue":"3"},{"fieldName":"sale_order.status","mark":"3","refValue":"4"},{"fieldName":"sale_order.status","mark":"3","refValue":"5"},{"fieldName":"sale_order.status","mark":"3","refValue":"6"},{"fieldName":"sale_order.status","mark":"3","refValue":"8"}]',
+                '[{"fieldName":"sale_order.status","mark":"3","refValue":"2"},{"fieldName":"sale_order.status","mark":"3","refValue":"3"},{"fieldName":"sale_order.status","mark":"3","refValue":"4"},{"fieldName":"sale_order.status","mark":"3","refValue":"5"},{"fieldName":"sale_order.status","mark":"3","refValue":"6"},{"fieldName":"sale_order.status","mark":"3","refValue":"8"},{"fieldName":"sale_order.status","mark":"3","refValue":"9"}]',
               children: [],
               btnHasPermi: "huaxian:xsglddgl:INSERT",
             },
@@ -3363,7 +3366,7 @@ export default {
     // 自定义删除按钮
     async myDeleteHandler(row) {
       console.log(row);
-      let stateArr = ["2", "3", "4", "5", "6", "8"];
+      let stateArr = ["2", "3", "4", "5", "6", "8", "9"];
       let isDeleteValidate = this.selection.some((item) => {
         return stateArr.includes(item.status);
       });
@@ -3471,6 +3474,7 @@ export default {
       let payload = {
         id: row.id,
         status: 6,
+        saleNo: row.saleNo,
       };
       let res = await updateOrder(payload);
       if (res.code == 200) {

+ 4 - 1
zkqy-ui/src/views/orderMange/outStock/index.vue

@@ -338,6 +338,7 @@ export default {
         let payload = {
           isEnablePaging: false,
           status: 1,
+          // status: 55,
         };
         let res = await productInvoiceList(payload);
         if (res.code == 200) {
@@ -349,7 +350,9 @@ export default {
         } else {
           throw new Error(res.msg);
         }
-      } catch (error) {}
+      } catch (error) {
+        console.log(error);
+      }
     },
     // 根据字典获取文件类型
     getdocumentTypeName(value) {

+ 47 - 31
zkqy-ui/src/views/orderMange/retailMange/index.vue

@@ -171,7 +171,7 @@
                 操作<i class="el-icon-arrow-down el-icon--right"></i>
               </el-button>
               <el-dropdown-menu slot="dropdown">
-                <el-dropdown-item>
+                <el-dropdown-item v-show="scope.row.status != 6">
                   <el-button
                     size="mini"
                     type="text"
@@ -211,7 +211,7 @@
                     >提交
                   </el-button>
                 </el-dropdown-item> -->
-                <el-dropdown-item v-show="scope.row.status == 5">
+                <!-- <el-dropdown-item v-show="scope.row.status == 5">
                   <el-button
                     size="mini"
                     type="text"
@@ -220,7 +220,7 @@
                     @click="handleSubmitCancel(scope.row)"
                     >撤销
                   </el-button>
-                </el-dropdown-item>
+                </el-dropdown-item> -->
                 <el-dropdown-item v-show="scope.row.status != 1">
                   <el-button
                     size="mini"
@@ -239,7 +239,7 @@
                     >打印出库单
                   </el-button>
                 </el-dropdown-item>
-                <el-dropdown-item v-show="scope.row.status == 1">
+                <el-dropdown-item v-show="scope.row.status != 6">
                   <el-button
                     size="mini"
                     type="text"
@@ -265,7 +265,7 @@
       <!-- 添加或修改销售出库单:- 过磅记录生成数据对话框 -->
       <el-dialog
         :title="title"
-        width="1100px"
+        width="1400px"
         :visible.sync="open"
         append-to-body
       >
@@ -503,7 +503,7 @@
                   </el-select>
                 </template>
               </el-table-column>
-              <el-table-column prop="colourNumber" label="色号">
+              <el-table-column prop="colourNumber" width="150" label="色号">
                 <template slot-scope="scope">
                   <el-form-item
                     :prop="'colourNumber-' + scope.$index"
@@ -538,7 +538,7 @@
               <el-table-column prop="productType" label="类型">
               </el-table-column>
 
-              <el-table-column prop="lotNumber" label="批号">
+              <el-table-column prop="lotNumber" width="120" label="批号">
                 <template slot-scope="scope">
                   <el-input
                     v-model="scope.row.lotNumber"
@@ -1114,6 +1114,7 @@ export default {
       let payload = {
         id: row.id,
         status: 6,
+        saleNo: row.saleNo,
       };
       let res = await updateOrder(payload);
       if (res.code == 200) {
@@ -1138,13 +1139,31 @@ export default {
         lotNumber,
         productName,
         productSpecifications,
+        colourNumber,
+        specificationsList,
       } = row;
+      let productColour = "";
+      let targetColor = this.colourNumberOptions.find((item) => {
+        return item.materielCode == colourNumber;
+      });
+      let productId = "";
+      if (specificationsList && specificationsList.length > 0) {
+        let targetItem = specificationsList.find(
+          (item) => item.productSpecifications == productSpecifications
+        );
+        productId = targetItem.id;
+      }
+      if (targetColor) {
+        productColour =
+          targetColor.materieEncoding + "" + targetColor.materieColorNumber;
+      }
       let payload = {
-        productNo,
+        productId,
         productType,
-        lotNumber,
+        lotNum: lotNumber,
         productName,
         productSpecifications,
+        productColour,
       };
       let res = await getProductInventory(payload);
       if ((res.code = 200)) {
@@ -1412,9 +1431,9 @@ export default {
         productType: "", //类型
         lotNumber: "", //批号
         productName: "", //货品名称
-        productNumber: "", //销售数量
+        productNumber: 0, //销售数量
         productWeight: "", //销售重量kg
-        productUnitPrice: "", //单价
+        productUnitPrice: 0, //单价
         productAmounts: "", //金额
         sliceType: "022", //切片类型  初始为  切片
         sliceTypeLabel: "",
@@ -1441,7 +1460,11 @@ export default {
         this.productionTableData[Number(index)][fieldName]
       );
       console.log(this.productionTableData);
-      if (!this.productionTableData[Number(index)][fieldName]) {
+      if (
+        !this.productionTableData[Number(index)][fieldName] &&
+        this.productionTableData[Number(index)][fieldName] !== 0 &&
+        this.productionTableData[Number(index)][fieldName] !== "0"
+      ) {
         callback(new Error(message));
       } else {
         callback();
@@ -1812,7 +1835,6 @@ export default {
             payload.orderType = 1;
             let res = await addRetailOrder(payload);
             if (res.code == 200) {
-              this.$message.success("添加成功");
               // 准备新增时 提交  数据 start
               this.form.noticeNumber = this.getOrderNo();
               this.form.status = 5;
@@ -2409,33 +2431,33 @@ export default {
             <div style="text-align:center;">销售合同审计单</div>
             <tbody>
                 <tr>
-                    <td width="600px" colspan="5">合同号:${saleNo}</td>
-                    <td width="600px" colspan="6">日期:${saleDate.replace(
+                    <td width="600px" colspan="4">合同号:${saleNo}</td>
+                    <td width="600px" colspan="5">日期:${saleDate.replace(
                       "T",
                       " "
                     )}</td>
                 </tr>
                 <tr align="center">
-                    <td width="300px" colspan="3">客户名称:</td>
+                    <td width="300px" colspan="2">客户名称:</td>
                     <td width="300px" colspan="3">${customerName}</td>
                     <td colspan="2">业务员:</td>
-                    <td colspan="3">${salesman}</td>
+                    <td colspan="2">${salesman}</td>
 
                 </tr>
                 <tr align="center">
-                    <td width="300px" colspan="3">客户地址:</td>
+                    <td width="300px" colspan="2">客户地址:</td>
                     <td width="300px" colspan="3">${customAddress}</td>
                     <td width="300px" colspan="2">客户国别:</td>
-                    <td width="300px" colspan="3">${customCountryType}</td>
+                    <td width="300px" colspan="2">${customCountryType}</td>
                 </tr>
                 <tr align="center">
-                    <td width="300px" colspan="3">联系人:</td>
-                    <td width="150px" colspan="3">${contactPerson}</td>
+                    <td width="300px" colspan="2">联系人:</td>
+                    <td width="150px" colspan="2">${contactPerson}</td>
                     <td  colspan="2">合计金额(大写):</td>
                     <td colspan="3">${saleAmountInWords}</td>
                 </tr>
                 <tr align="center">
-                    <td colspan="11">货品明细</td>
+                    <td colspan="9">货品明细</td>
                 </tr>
                 <tr align="center">
                     <td width="150px">品名</td>
@@ -2446,8 +2468,6 @@ export default {
                     <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,
@@ -2478,8 +2498,6 @@ export default {
                     <td>${item.productNumber}</td>
                     <td>${item.productUnitPrice}</td>
                     <td>${item.productAmounts}</td>
-                    <td>${item.inventoryBoxNum}</td>
-                    <td>${item.inventoryWeight}</td>
                     <td>${item.remark}</td>
                 </tr>`;
       }
@@ -2498,11 +2516,9 @@ export default {
           <td>${singlTotal}</td>
           <td>${moneyTotal}</td>
           <td></td>
-          <td></td>
-          <td></td>
         </tr>`;
       printStr += `<tr align="left">
-                    <td colspan="11">订单备注:${orderRemark}</td>
+                    <td colspan="9">订单备注:${orderRemark}</td>
                 </tr>
                 </tbody>
         </table>`;
@@ -3377,14 +3393,14 @@ export default {
     // 自定义删除按钮
     async myDeleteHandler(row) {
       console.log(row);
-      let stateArr = ["2", "3", "4", "5", "6", "8"];
+      let stateArr = ["6"];
       let isDeleteValidate = this.selection.some((item) => {
         return stateArr.includes(item.status);
       });
       console.log(this.selection);
       console.log(isDeleteValidate);
       if (isDeleteValidate) {
-        this.$message.error("仅允许删除订单状态为'未提交'或'未通过'的订单");
+        this.$message.error("'已完成'状态订单不可删除!");
         return;
       }
       await this.$confirm("是否确认删除选中的数据?", "警告", {