浏览代码

销售出库更换新的接口/处理记录批次重复点击问题

lph 11 月之前
父节点
当前提交
06a6997024

+ 10 - 1
zkqy-ui/src/api/tablelist/commonTable.js

@@ -344,7 +344,7 @@ export function saleStorageDetails(id) {
   return request({
     url: '/system/ProductInvoice/saleStorageDetails',
     method: 'get',
-    params: {id},
+    params: { id },
     //baseURL: process.env.VUE_APP_BASE_API1
   })
 }
@@ -358,6 +358,15 @@ export function noticeOutStorage(data) {
     //baseURL: process.env.VUE_APP_BASE_API1
   })
 }
+// 销售出库  新
+export function confirmNoticeOutStorage(data) {
+  return request({
+    url: '/system/ProductInventory/confirmNoticeOutStorage',
+    method: 'post',
+    data: data,
+    //baseURL: process.env.VUE_APP_BASE_API1
+  })
+}
 
 // 销售出库  旧
 export function oldNoticeOutStorage(data) {

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

@@ -1231,7 +1231,7 @@ export default {
           this.$modal.msgSuccess("删除成功");
         })
         .catch(() => {
-          this.$modal.msgError("删除失败!请检查库存");
+          this.$modal.msgSuccess("取消操作");
         });
     },
     // 确认保存修改一条数据

+ 18 - 16
zkqy-ui/src/views/orderMange/components/dialogForm/OutBound.vue

@@ -9,7 +9,7 @@
         :model="form"
         ref="form"
         :rules="rules"
-        label-width="80px"
+        label-width="100px"
         :inline="false"
         size="normal"
       >
@@ -34,7 +34,7 @@
           </el-form-item>
         </el-col>
         <el-col :span="8">
-          <el-form-item label="出库日期:" prop="remark" size="normal">
+          <el-form-item label="出库日期:" prop="outStockDate" size="normal">
             <el-date-picker
               v-model="form.outStockDate"
               type="date"
@@ -48,7 +48,6 @@
           <el-form-item label="批次:" prop="batchNumber" size="normal">
             <el-select
               v-model="form.batchNumber"
-              clearable
               filterable
               @change="batchChangeHandler"
             >
@@ -139,11 +138,18 @@ export default {
         unitName: "",
         remark: "",
         outStockDate: new Date(),
-        batchNumber: null,
+        batchNumber: 0,
       },
       rules: {
-        // unitName: [
-        //   { required: true, message: "请输入单位名称", trigger: "blur" },
+        unitName: [
+          { required: true, message: "请输入单位名称", trigger: "blur" },
+        ],
+        remark: [{ required: true, message: "请输入备注", trigger: "blur" }],
+        outStockDate: [
+          { required: true, message: "请选择出库日期", trigger: "change" },
+        ],
+        // batchNumber: [
+        //   { required: true, message: "请选择批次", trigger: "change" },
         // ],
       },
       tableData: [],
@@ -174,6 +180,7 @@ export default {
         },
       ],
       allTableData: [], //所有表格数据
+      isCanRecordBatch: false, //防止重复提交
     };
   },
   computed: {
@@ -181,13 +188,6 @@ export default {
       username: (state) => state.user.name,
       nickName: (state) => state.user?.nickName,
     }),
-    isCanRecordBatch() {
-      return (
-        (this.form.batchNumber !== null ||
-          this.tableData.some((item) => item.batchState == "1")) &&
-        !this.tableData.length
-      );
-    },
   },
   watch: {
     isRetail(val) {
@@ -200,6 +200,7 @@ export default {
   methods: {
     // 记录批次回调
     async myRecordBatchHandler(row, btnData) {
+      this.isCanRecordBatch = true;
       let payload = this.tableData.map((item) => {
         let { saleNo } = this.row;
         return {
@@ -234,8 +235,9 @@ export default {
         this.$message.success("记录成功");
         this.getTableData(this.row);
       } else {
-        throw new Error(result.msg);
+        this.$message.error(result.msg);
       }
+      this.isCanRecordBatch = false;
     },
     // 批次改变回调
     batchChangeHandler(val) {
@@ -298,7 +300,7 @@ export default {
           this.tableData = res.data;
           this.allTableData = JSON.parse(JSON.stringify(res.data));
           this.getBatchOptions(res.data); //获取批号选项数据
-          this.batchChangeHandler(null); //默认显示当前批次数据
+          this.batchChangeHandler(0); //默认显示当前批次数据
           this.isRetail = isRetail;
         }
       } catch (error) {}
@@ -307,7 +309,7 @@ export default {
     getBatchOptions(rows) {
       let batchOptions = [];
       batchOptions.push({
-        value: null,
+        value: 0,
         label: "当前批次",
       });
       rows.forEach((row) => {

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

@@ -162,7 +162,7 @@ export default {
   data() {
     return {
       isReAcount: false,
-      batchNumber: null,
+      batchNumber: 0,
       allTableData: [], //所有表格数据
       batchOptions: [], //批号选项数据
       oldInventoryState: 0,
@@ -400,7 +400,7 @@ export default {
       console.log(row);
       this.isReAcount = isReAcount;
       let { saleNo } = row;
-      this.batchNumber = null;
+      this.batchNumber = 0;
       this.row = row;
       console.log(this.row.status, "ddddd");
       try {
@@ -438,7 +438,7 @@ export default {
             this.batchChangeHandler(this.batchOptions[1]?.value);
             this.batchNumber = this.batchOptions[1]?.value;
           } else {
-            this.batchChangeHandler(null); //默认显示当前批次数据
+            this.batchChangeHandler(0); //默认显示当前批次数据
           }
 
           this.$nextTick(() => {
@@ -466,7 +466,7 @@ export default {
     getBatchOptions(rows) {
       let batchOptions = [];
       batchOptions.push({
-        value: null,
+        value: 0,
         label: "当前批次",
       });
       rows.forEach((row) => {

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

@@ -354,7 +354,7 @@
             <el-table-column label="操作">
               <template slot-scope="scope">
                 <el-button
-                  v-show="scope.row.batchState == 1"
+                  v-show="false"
                   size="mini"
                   type="danger"
                   @click="handleReAcount(scope.row)"
@@ -383,6 +383,7 @@ import {
   queryDropDownBoxData,
   noticeOutStorage,
   printOutsourceOrderList,
+  confirmNoticeOutStorage,
 } from "@/api/tablelist/commonTable";
 import { mapState } from "vuex";
 import { outboundDetails } from "@/api/system/retailMange.js";
@@ -697,7 +698,8 @@ export default {
               }
               delete payLoad.documentTypeName;
               if (payLoad.batchNumber == "all") payLoad.batchNumber = null;
-              let res = await noticeOutStorage(payLoad);
+              let res = await confirmNoticeOutStorage(payLoad);
+              // let res = await noticeOutStorage(payLoad);
               if (res.code == 200) {
                 this.$message.success("出库成功");
                 this.currentIndex = 0;
@@ -707,7 +709,8 @@ export default {
                 this.$message.error(res.msg);
               }
             })
-            .catch(() => {
+            .catch((err) => {
+              console.log(err);
               this.$message({
                 type: "info",
                 message: "已取消出库",