Przeglądaj źródła

订单管理添加出库明细/零售订单添加出库明细,打印出库单

lph 1 rok temu
rodzic
commit
c6aafee16d

+ 2 - 1
zkqy-ui/src/api/codeListManage/productCodeList.js

@@ -49,10 +49,11 @@ export function delProductCodeList(id) {
 }
 
 // 获取完成产品列表
-export function finishedProductList() {
+export function finishedProductList(params) {
   return request({
     url: '/system/productCodeList/finishedProductList',
     method: 'get',
+    params
     //baseURL: process.env.VUE_APP_BASE_API1
   })
 }

+ 32 - 0
zkqy-ui/src/api/system/retailMange.js

@@ -50,6 +50,38 @@ export function retailProductInvoiceInfo(params) {
     params
   })
 }
+// 提交零售单  零售单提交
+export function submitRetailOrder(params) {
+  return request({
+    url: '/system/order/submitRetailOrder',
+    method: 'post',
+    data: params
+  })
+}
+// 提交零售单  零售单提交
+export function cancelRetailOrder(params) {
+  return request({
+    url: '/system/order/cancelRetailOrder',
+    method: 'post',
+    data: params
+  })
+}
+// 提交零售单  零售单提交保存
+// export function cancelRetailOrder(params) {
+//   return request({
+//     url: '/system/order/cancelRetailOrder',
+//     method: 'post',
+//     data: params
+//   })
+// }
+// 零售单  出库明细查询
+export function outboundDetails(params) {
+  return request({
+    url: '/system/ProductOutboundRecord/outboundDetails',
+    method: 'get',
+    params
+  })
+}
 
 // 获取库存箱数
 export function getProductInventory(data) {

+ 22 - 10
zkqy-ui/src/utils/print/outBoundPrint.js

@@ -1,4 +1,4 @@
-function outBoundPrint(data, domId) {
+function outBoundPrint(data, domId, isRetail = false) {
   console.log(data);
   let { outStockDate, remark, unitName, printUser } = data.form
   let { tableData } = data
@@ -13,6 +13,24 @@ function outBoundPrint(data, domId) {
   if (dd < 10) {
     dd = "0" + dd;
   }
+  let tableHeader = ``
+  if (isRetail) { //零售
+    tableHeader = `<td style="width: 100px;">名称</td>
+        <td style="width: 100px;">规格</td>
+        <td style="width: 100px;">单位</td>
+        <td style="width: 100px;">数量</td>
+        <td style="width: 100px;">单价</td>
+        <td style="width: 100px;">金额</td>`
+
+  } else {
+    tableHeader = `<td style="width: 100px;">名称</td>
+        <td style="width: 100px;">规格</td>
+        <td style="width: 100px;">批号</td>
+        <td style="width: 100px;">单位</td>
+        <td style="width: 100px;">数量</td>
+        <td style="width: 100px;">单价</td>
+        <td style="width: 100px;">金额</td>`
+  }
 
   let printContent = `<div style="width: 700px;position: relative;">
 
@@ -29,13 +47,7 @@ function outBoundPrint(data, domId) {
     </div>
     <table style="width: 100%;border-collapse:collapse;" cellpadding="10" border="1">
       <tr style="text-align: center;">
-        <td style="width: 100px;">名称</td>
-        <td style="width: 100px;">规格</td>
-        <td style="width: 100px;">批号</td>
-        <td style="width: 100px;">单位</td>
-        <td style="width: 100px;">数量</td>
-        <td style="width: 100px;">单价</td>
-        <td style="width: 100px;">金额</td>
+        ${tableHeader}
       </tr>`;
   let totalPrice = 0, totalWeight = 0;
   for (let i = 0; i < tableData.length; i++) {
@@ -50,7 +62,7 @@ function outBoundPrint(data, domId) {
     printContent += `<tr style="text-align: center;">
       <td>${productName}</td>
       <td>${productSpecifications}</td>
-      <td>${lotNumber}</td>
+      ${isRetail ? '' : '<td>' + lotNumber + '</td>'}
       <td>${unit}</td>
       <td>${productNumber}</td>
       <td>${productUnitPrice}</td>
@@ -62,7 +74,7 @@ function outBoundPrint(data, domId) {
   printContent += `<tr style="text-align: center;border: none;">
         <td style="width: 100px;">合计</td>
         <td style="width: 100px;"></td>
-        <td style="width: 100px;"></td>
+        ${isRetail ? '' : '<td style="width: 100px;"></td>'}
         <td style="width: 100px;"></td>
         <td style="width: 100px;">${totalWeight}</td>
         <td style="width: 100px;"></td>

+ 51 - 6
zkqy-ui/src/views/orderMange/components/dialogForm/OutBound.vue

@@ -46,14 +46,18 @@
         </el-col>
       </el-form>
     </el-row>
-    <el-table :data="tableData" border stripe>
+    <el-table ref="tableRef" v-if="tableShow" :data="tableData" border stripe>
       <el-table-column type="index" width="50" />
       <el-table-column label="名称" prop="productName"></el-table-column>
       <el-table-column
         label="规格"
         prop="productSpecifications"
       ></el-table-column>
-      <el-table-column label="批号" prop="lotNumber"></el-table-column>
+      <el-table-column
+        v-if="!isRetail"
+        label="批号"
+        prop="lotNumber"
+      ></el-table-column>
       <el-table-column label="单位" prop="unit">
         <template slot-scope="scope">
           <el-input
@@ -64,7 +68,10 @@
           ></el-input>
         </template>
       </el-table-column>
-      <el-table-column label="数量" prop="productNumber"></el-table-column>
+      <el-table-column
+        :label="isRetail ? '箱数' : '数量'"
+        prop="productNumber"
+      ></el-table-column>
       <el-table-column label="单价" prop="productUnitPrice"></el-table-column>
       <el-table-column label="金额" prop="productAmounts"></el-table-column>
     </el-table>
@@ -82,6 +89,8 @@ export default {
   components: {},
   data() {
     return {
+      isRetail: false,
+      tableShow: true,
       form: {
         unitName: "",
         remark: "",
@@ -93,10 +102,43 @@ export default {
         // ],
       },
       tableData: [],
-      columns: [],
+      columns: [
+        {
+          prop: "productName",
+          label: "名称",
+        },
+        {
+          prop: "productSpecifications",
+          label: "规格",
+        },
+        {
+          prop: "lotNumber",
+          label: "批号",
+        },
+        {
+          prop: "unit",
+          label: "单位",
+        },
+        {
+          prop: "productName",
+          label: "名称",
+        },
+        {
+          prop: "productName",
+          label: "名称",
+        },
+      ],
     };
   },
   computed: {},
+  watch: {
+    isRetail(val) {
+      console.log(val);
+      this.$nextTick(() => {
+        this.$refs.tableRef.doLayout();
+      });
+    },
+  },
   methods: {
     // 重置表单
     resetForm() {
@@ -107,14 +149,16 @@ export default {
       });
     },
     // 获取表格数据
-    async getTableData(row) {
+    async getTableData(row, isRetail = true) {
       this.resetForm();
       this.row = row;
+
       console.log(row);
       try {
         let payload = {
-          saleOrderNo: row.saleOrderSaleNo,
+          saleOrderNo: row.saleOrderSaleNo || row.saleNo,
         };
+        console.log(payload);
         let res = await outboundOrderInfo(payload);
         if (res.code == 200) {
           res.data.forEach((item) => {
@@ -128,6 +172,7 @@ export default {
             item.unit = "";
           });
           this.tableData = res.data;
+          this.isRetail = isRetail;
         }
       } catch (error) {}
     },

+ 106 - 0
zkqy-ui/src/views/orderMange/components/dialogForm/OutStock.vue

@@ -0,0 +1,106 @@
+<template>
+  <div class="table-container">
+    <el-table
+      :data="tableData"
+      border
+      stripe
+      :summary-method="getSummaries"
+      show-summary
+    >
+      <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>
+      <el-table-column prop="productColor" label="色泽"> </el-table-column>
+      <el-table-column prop="lotNum" label="批号"> </el-table-column>
+      <el-table-column prop="levels" label="等级"> </el-table-column>
+      <el-table-column prop="grossWeight" label="毛重"> </el-table-column>
+      <el-table-column prop="suttle" label="净重"> </el-table-column>
+      <el-table-column prop="qrCode" label="码单号"> </el-table-column>
+      <el-table-column prop="boxNum" label="箱号"> </el-table-column>
+    </el-table>
+  </div>
+</template>
+
+<script>
+import { outboundDetails } from "@/api/system/retailMange.js";
+import moment from "moment";
+export default {
+  name: "OutStock",
+  props: [],
+  components: {},
+  data() {
+    return {
+      tableData: [],
+    };
+  },
+  computed: {},
+  methods: {
+    // 自定义的小计计算方法
+    getSummaries(param) {
+      const { columns, data } = param;
+      const sums = [];
+      columns.forEach((column, index) => {
+        if (index === 5) {
+          sums[index] = "小计:";
+          return;
+        }
+        const values = data.map((item) => Number(item[column.property]));
+        if (
+          index === 0 ||
+          index === 1 ||
+          index === 2 ||
+          index === 3 ||
+          index === 4 ||
+          index === 8 ||
+          index === 9
+        ) {
+          sums[index] = "";
+        } else if (!values.every((value) => isNaN(value))) {
+          sums[index] = values
+            .reduce((prev, curr) => {
+              const value = Number(curr);
+              if (!isNaN(value)) {
+                return prev + curr;
+              } else {
+                return prev;
+              }
+            }, 0)
+            ?.toFixed(2);
+          console.log(sums[index], index);
+        } else {
+          sums[index] = "N/A";
+        }
+      });
+
+      return sums;
+    },
+    // 事件格式化工具
+    formatTime(time) {
+      // typeof time === "string" ? (time = new Date(time)) : time;
+      return moment(time).format("YYYY-MM-DD");
+    },
+    // 获取出库详情
+    async getOutStockDetail(row) {
+      console.log(row);
+      let { saleNo } = row;
+      try {
+        let payLoad = {
+          saleOrderNo: saleNo,
+        };
+        let res = await outboundDetails(payLoad);
+        if (res.code == 200) {
+          console.log(res);
+          this.tableData = res.data;
+        } else {
+          this.$message.error(res.msg);
+        }
+      } catch (error) {
+        console.log(error);
+      }
+    },
+  },
+};
+</script>
+
+<style scoped lang="scss"></style>

+ 4 - 0
zkqy-ui/src/views/orderMange/components/dialogForm/RetailProvide.vue

@@ -383,6 +383,7 @@ export default {
       let payload = {
         saleOrderNo: saleNo,
       };
+
       let res = await retailProductInvoiceInfo(payload);
       if (res.code == 200) {
         this.tableData = res.data.saleProductInfoList;
@@ -408,6 +409,8 @@ export default {
         this.form.saleOrderNo = saleNo;
         this.form.inventoryBoxNum = res.data.inventoryBoxNum;
         console.log(this.form);
+        this.form.dispatchNoteRemark = res.data.dispatchNoteRemark || "";
+        this.form.truckRegistration = res.data.truckRegistration || "";
 
         // 初始化表单数据  end
         this.form.inventoryWeight = Number(this.form.inventoryWeight)?.toFixed(
@@ -417,6 +420,7 @@ export default {
         if (!this.isEdit) {
           this.form.drawer = this.username;
           this.form.noticeNumber = this.getOrderNo();
+
           this.form.status = 1;
         } else {
           this.form.noticeNumber = res.data.noticeNumber;

+ 34 - 3
zkqy-ui/src/views/orderMange/index.vue

@@ -733,6 +733,15 @@
           >
         </span>
       </el-dialog>
+      <!-- 出库明细 -->
+      <el-dialog title="出库明细" :visible.sync="outStockShow" width="1200px">
+        <OutStock ref="outStockRef"></OutStock>
+        <span slot="footer" class="dialog-footer">
+          <el-button @click="outStockShow = false">关 闭</el-button>
+          <!-- <el-button @click="btnSave">保 存</el-button> -->
+          <!-- <el-button type="primary" @click="btnComfirm">确 定</el-button> -->
+        </span>
+      </el-dialog>
       <div id="printDom"></div>
     </div>
   </el-card>
@@ -776,12 +785,14 @@ import Deliver from "@/views/orderMange/components/dialogForm/Deliver.vue";
 import OutBound from "@/views/orderMange/components/dialogForm/OutBound.vue";
 import outBoundPrint from "@/utils/print/outBoundPrint";
 import { listCustomer } from "@/api/system/customer";
+import OutStock from "@/views/orderMange/components/dialogForm/OutStock.vue";
 export default {
   name: "listInfo",
   dicts: ["payment_method", "direction_of_twist"],
-  components: { Queryfrom, Menu, DialogTemplate, Deliver, OutBound },
+  components: { Queryfrom, Menu, DialogTemplate, Deliver, OutBound, OutStock },
   data() {
     return {
+      outStockShow: false, //出库详情
       selection: [], //勾选的数据
       // 出库单 start
       outBoundShow: false,
@@ -1077,7 +1088,7 @@ export default {
       this.currentRow = row;
       this.outBoundShow = true;
       this.$nextTick(() => {
-        this.$refs.outBoundRef.getTableData(row);
+        this.$refs.outBoundRef.getTableData(row, false);
       });
     },
     // 出库单打印回调
@@ -1086,7 +1097,7 @@ export default {
       console.log(res);
       if (res.flag) {
         res.data.form.printUser = this.nickName;
-        outBoundPrint(res.data, "printDom");
+        outBoundPrint(res.data, "printDom", false);
       }
     },
 
@@ -1361,6 +1372,15 @@ export default {
               btnHasPermi: "huaxian:xsglddgl:INSERT",
               children: [],
             },
+            {
+              btnName: "出库明细",
+              btnType: "OutDetail",
+              btnIcon: "",
+              btnShowCondition:
+                '[{"fieldName":"sale_order.status","mark":"3","refValue":"1"}]',
+              btnHasPermi: "huaxian:xsglddgl:INSERT",
+              children: [],
+            },
             {
               btnName: "打印出库单",
               btnType: "printOutBound",
@@ -3089,6 +3109,13 @@ export default {
         this.$refs.deliverRef.productInvoiceInfo(row);
       });
     },
+    // 出库详情回调
+    handleOutDetail(row) {
+      this.outStockShow = true;
+      this.$nextTick(() => {
+        this.$refs.outStockRef.getOutStockDetail(row, false);
+      });
+    },
 
     // 操作列回调
     excuteHandler(btnData, row) {
@@ -3123,6 +3150,10 @@ export default {
         case "myEdit":
           this.handleEdit("1", row);
           break;
+        case "OutDetail":
+          this.handleOutDetail(row);
+          break;
+
         case "myDetail":
           this.handleDetail(row);
           break;

+ 165 - 32
zkqy-ui/src/views/orderMange/retailMange/index.vue

@@ -143,9 +143,11 @@
         <el-table-column prop="saleLeadTime" label="交货天数" />
         <el-table-column prop="saleAmountInWords" label="合计金额(大写)" />
         <el-table-column prop="status" label="状态">
-          <template slot-scope="scope">{{
-            getDictLabel(scope.row.status, "sales_order_status")
-          }}</template>
+          <template slot-scope="scope">
+            <el-tag :type="scope.row.listClass">{{
+              getDictLabel(scope.row.status, "sales_order_status")
+            }}</el-tag>
+          </template>
         </el-table-column>
 
         <el-table-column prop="salesman" label="销售员" />
@@ -175,7 +177,7 @@
                     >详情
                   </el-button>
                 </el-dropdown-item>
-                <el-dropdown-item>
+                <el-dropdown-item v-show="scope.row.status == 1">
                   <el-button
                     size="mini"
                     type="text"
@@ -184,6 +186,39 @@
                     >提交
                   </el-button>
                 </el-dropdown-item>
+                <el-dropdown-item v-show="scope.row.status == 2">
+                  <el-button
+                    size="mini"
+                    type="text"
+                    icon="el-icon-folder-delete"
+                    @click="handleSubmitCancel(scope.row)"
+                    >取消提交
+                  </el-button>
+                </el-dropdown-item>
+                <el-dropdown-item v-show="scope.row.status != 1">
+                  <el-button
+                    size="mini"
+                    type="text"
+                    icon="el-icon-folder-delete"
+                    @click="handleOutDetail(scope.row)"
+                    >出库明细
+                  </el-button>
+                </el-dropdown-item>
+                <el-dropdown-item
+                  v-show="
+                    scope.row.status == 1 ||
+                    scope.row.status == 2 ||
+                    scope.row.status == 8
+                  "
+                >
+                  <el-button
+                    size="mini"
+                    type="text"
+                    icon="el-icon-folder-delete"
+                    @click="myPrintOutBoundHandler(scope.row)"
+                    >打印出库单
+                  </el-button>
+                </el-dropdown-item>
                 <el-dropdown-item>
                   <el-button
                     size="mini"
@@ -551,6 +586,7 @@
         <RetailProvide ref="deliverRef"></RetailProvide>
         <span slot="footer" class="dialog-footer">
           <el-button @click="deliverShow = false">取 消</el-button>
+          <!-- <el-button @click="btnSave">保 存</el-button> -->
           <el-button type="primary" @click="btnComfirm">确 定</el-button>
         </span>
       </el-dialog>
@@ -578,6 +614,15 @@
           >
         </span>
       </el-dialog>
+      <!-- 出库详情 -->
+      <el-dialog title="出库明细" :visible.sync="outStockShow" width="1200px">
+        <OutStock ref="outStockRef"></OutStock>
+        <span slot="footer" class="dialog-footer">
+          <el-button @click="outStockShow = false">关 闭</el-button>
+          <!-- <el-button @click="btnSave">保 存</el-button> -->
+          <!-- <el-button type="primary" @click="btnComfirm">确 定</el-button> -->
+        </span>
+      </el-dialog>
       <div id="printDom"></div>
     </div>
   </el-card>
@@ -608,6 +653,8 @@ import {
   getRetailOrderInfo,
   editRetailOrder,
   retailProductInvoiceInfo,
+  submitRetailOrder,
+  cancelRetailOrder,
 } from "@/api/system/retailMange.js";
 import { listData } from "@/api/system/tenant/data";
 import { getToken } from "@/utils/auth";
@@ -626,6 +673,7 @@ import { mapState } from "vuex";
 import moment from "moment";
 import Deliver from "@/views/orderMange/components/dialogForm/Deliver.vue";
 import RetailProvide from "@/views/orderMange/components/dialogForm/RetailProvide.vue";
+import OutStock from "@/views/orderMange/components/dialogForm/OutStock.vue";
 import OutBound from "@/views/orderMange/components/dialogForm/OutBound.vue";
 import outBoundPrint from "@/utils/print/outBoundPrint";
 import { listCustomer } from "@/api/system/customer";
@@ -645,9 +693,11 @@ export default {
     Deliver,
     OutBound,
     RetailProvide,
+    OutStock,
   },
   data() {
     return {
+      outStockShow: false, //出库详情弹窗
       totalMoney: "", //合计金额  小写
       createById: "", //创建者id
       salesmanList: [], //销售员列表
@@ -914,6 +964,22 @@ export default {
     }),
   },
   methods: {
+    // 出库单回调
+    async myPrintOutBoundHandler(row) {
+      console.log("row", row);
+      this.currentRow = row;
+      this.outBoundShow = true;
+      this.$nextTick(() => {
+        this.$refs.outBoundRef.getTableData(row);
+      });
+    },
+    // 出库详情回调
+    handleOutDetail(row) {
+      this.outStockShow = true;
+      this.$nextTick(() => {
+        this.$refs.outStockRef.getOutStockDetail(row);
+      });
+    },
     // 业务员改变回调
     salemanChange(val) {
       if (!val) {
@@ -979,7 +1045,7 @@ export default {
       console.log(res);
       if (res.flag) {
         res.data.form.printUser = this.nickName;
-        outBoundPrint(res.data, "printDom");
+        outBoundPrint(res.data, "printDom", true);
       }
     },
 
@@ -1261,6 +1327,12 @@ export default {
         console.log(res);
         if (res.code == 200) {
           this.tableList = res.rows;
+          console.log(this.dict.type.sales_order_status);
+          this.tableList.forEach((item) => {
+            item.listClass = this.dict.type.sales_order_status.find(
+              (i) => i.value == item.status
+            ).raw.listClass;
+          });
           this.total = res.total;
         } else {
           this.$message.error(res.msg);
@@ -1843,6 +1915,44 @@ export default {
         this.$refs.deliverRef.productInvoiceInfo(row);
       });
     },
+    // 取消提交
+    async handleSubmitCancel(row) {
+      console.log(row);
+      this.$confirm("此操作将撤回该次提交, 是否继续?", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+        .then(async () => {
+          // this.$message({
+          //   type: 'success',
+          //   message: '删除成功!'
+          // });
+          try {
+            let { saleNo } = row;
+            let payLoad = {
+              saleOrderNo: saleNo,
+              status: 1,
+            };
+            let res = await cancelRetailOrder(payLoad);
+            if (res.code == 200) {
+              this.$message.success("取消成功");
+              this.getList();
+            } else {
+              this.$message.error("取消失败");
+              console.log(res);
+            }
+          } catch (error) {
+            console.log(error);
+          }
+        })
+        .catch(() => {
+          this.$message({
+            type: "info",
+            message: "已取消",
+          });
+        });
+    },
     // 获取打印dom
     getPrintDom(data) {
       let {
@@ -2177,35 +2287,58 @@ export default {
       let res = await this.$refs.deliverRef.getAllData();
       let { flag, isEdit, data } = res;
       if (flag) {
-        if (isEdit) {
-          //编辑
-          let payLoad = {
-            ...data.formData,
-            saleProductInfoList: data.tableData,
-          };
-          let res = await updateProductInvoice(payLoad);
-          if (res.code == 200) {
-            this.$message.success("修改成功");
-            this.deliverShow = false;
-            this.getList();
-          } else {
-            this.$message.error("网络异常");
-          }
+        // if (isEdit) {
+        //   //编辑
+        //   let payLoad = {
+        //     ...data.formData,
+        //     saleProductInfoList: data.tableData,
+        //   };
+        //   let res = await updateProductInvoice(payLoad);
+        //   if (res.code == 200) {
+        //     this.$message.success("修改成功");
+        //     this.deliverShow = false;
+        //     this.getList();
+        //   } else {
+        //     this.$message.error("网络异常");
+        //   }
+        // } else {
+        //新增
+        let payLoad = {
+          ...data.formData,
+          saleProductInfoList: data.tableData,
+        };
+        payLoad.status = 5;
+        // let res = await addProductInvoice(payLoad);
+        let res = await submitRetailOrder(payLoad);
+        if (res.code == 200) {
+          this.$message.success("提交成功");
+          this.deliverShow = false;
+          this.getList();
         } else {
-          //新增
-          let payLoad = {
-            ...data.formData,
-            saleProductInfoList: data.tableData,
-          };
-          let res = await addProductInvoice(payLoad);
-          if (res.code == 200) {
-            this.$message.success("保存成功");
-            this.deliverShow = false;
-            this.getList();
-          } else {
-            this.$message.error("网络异常");
-          }
+          this.$message.error("网络异常");
+        }
+        // }
+      }
+    },
+    // 保存提交数据
+    async btnSave() {
+      let res = await this.$refs.deliverRef.getAllData();
+      let { flag, isEdit, data } = res;
+      if (flag) {
+        let payLoad = {
+          ...data.formData,
+          saleProductInfoList: data.tableData,
+        };
+        payLoad.status = 1;
+        let res = await updateProductInvoice(payLoad);
+        if (res.code == 200) {
+          this.$message.success("保存成功");
+          this.deliverShow = false;
+          this.getList();
+        } else {
+          this.$message.error("网络异常");
         }
+        // }
       }
     },
     // 去掉表名 开头字母小写