Просмотр исходного кода

订单管理添加重新登账功能

lph 10 месяцев назад
Родитель
Сommit
e3ed28cdf4

+ 2 - 1
zkqy-ui/src/views/orderMange/components/dialogForm/OutBound.vue

@@ -201,7 +201,7 @@ export default {
     // 记录批次回调
     async myRecordBatchHandler(row, btnData) {
       let payload = this.tableData.map((item) => {
-        let { saleNo } = this.currentRow;
+        let { saleNo } = this.row;
         return {
           accountingType: "1",
           accountsReceivableDate: new Date(),
@@ -233,6 +233,7 @@ export default {
       let result = await printOutsourceOrder(payload);
       if (result.code == 200) {
         this.$message.success("记录成功");
+        this.getTableData(this.row);
       } else {
         throw new Error(result.msg);
       }

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

@@ -3,10 +3,10 @@
     <div style="float: right; margin: 0px; padding: 0px">
       <el-button
         @click="exportOutInfo"
-        v-show="oldInventoryState != 2"
+        v-show="!isReAcount"
         type="success"
         icon="el-icon-download"
-        >导出明细</el-button
+        >导出全部明细</el-button
       >
     </div>
     <div style="clear: both"></div>
@@ -75,7 +75,7 @@
             <el-table-column label="操作" v-if="row.status != 6">
               <template slot-scope="scope">
                 <el-button
-                  v-show="oldInventoryState != 2"
+                  v-show="!props.row.batchNumber || props.row.batchState == 1"
                   size="mini"
                   type="danger"
                   @click="handleDelete(scope.$index, scope.row)"
@@ -112,6 +112,17 @@
           {{ scope.row.batchState == 1 ? "撤销登账" : "正常" }}
         </template>
       </el-table-column>
+      <el-table-column label="操作">
+        <template slot-scope="scope">
+          <el-button
+            v-show="scope.row.batchState == 1"
+            size="mini"
+            type="danger"
+            @click="handleReAcount(scope.row)"
+            >重新登账</el-button
+          >
+        </template>
+      </el-table-column>
 
       <!-- <el-table-column prop="productName" label="品名"></el-table-column>
       <el-table-column prop="productSpecifications" label="规格">
@@ -129,13 +140,16 @@
       :total="total"
       :page.sync="queryParams.pageNum"
       :limit.sync="queryParams.pageSize"
-      @pagination="getOutStockDetail(row)"
+      @pagination="getOutStockDetail(row, true, isReAcount)"
     />
   </div>
 </template>
 
 <script>
-import { printOutsourceOrderList } from "@/api/tablelist/commonTable";
+import {
+  printOutsourceOrderList,
+  againRecordBatch,
+} from "@/api/tablelist/commonTable";
 import { outboundDetails } from "@/api/system/retailMange.js";
 import { listOldRecord } from "@/api/system/oldRecord.js";
 import moment from "moment";
@@ -147,13 +161,13 @@ export default {
   components: {},
   data() {
     return {
+      isReAcount: false,
       batchNumber: null,
       allTableData: [], //所有表格数据
       batchOptions: [], //批号选项数据
       oldInventoryState: 0,
       tableData: [],
       row: {},
-      orderRow: {},
       // 分页相关
       total: 0,
       queryParams: {
@@ -166,9 +180,34 @@ export default {
   },
   computed: {},
   created() {
-    this.orderRow = {};
+    this.row = {};
   },
   methods: {
+    // 重新登账回调
+    async handleReAcount(row) {
+      let payload = {
+        ...row,
+        customerId: this.row.saleCustomNo, //客户id
+        accountingType: "1",
+        accountsReceivableDate: new Date(),
+        amountReceivable: Number(
+          (Number(row.productNumber) * Number(row.productUnitPrice)).toFixed(2)
+        ),
+        weight: row.productNumber,
+        productPrice: row.productUnitPrice,
+        billingType: "1",
+        receivedAmount: 0,
+        status: 1,
+        returnReceipt: "0",
+      };
+      let res = await againRecordBatch(payload);
+      if (res.code == 200) {
+        this.$message.success("重新登账成功");
+        this.getOutStockDetail(this.row, true, this.isReAcount);
+      } else {
+        this.$message.error("重新登账失败");
+      }
+    },
     // 获取详情回调
     async getDetail(tree) {
       console.log(1111);
@@ -194,7 +233,7 @@ export default {
         removeErrorOutboundRecord(row.id).then((res) => {
           if (res.code == 200) {
             this.$message.success("删除成功");
-            this.getOutStockDetail(this.orderRow);
+            this.getOutStockDetail(this.row, true, this.isReAcount);
           } else {
             this.$message.error("删除失败");
             throw Error("删除失败");
@@ -333,11 +372,12 @@ export default {
       });
     },
     // 获取出库详情
-    async getOutStockDetail(row, flag = true) {
+    async getOutStockDetail(row, flag = true, isReAcount = false) {
       //flag: true 零售  false 订单
       console.log(row);
-      this.orderRow = row;
+      this.isReAcount = isReAcount;
       let { saleNo } = row;
+      this.batchNumber = null;
       this.row = row;
       console.log(this.row.status, "ddddd");
       try {
@@ -370,7 +410,14 @@ export default {
             };
           });
           this.allTableData = JSON.parse(JSON.stringify(this.tableData));
-          this.batchChangeHandler(null); //默认显示当前批次数据
+          if (this.isReAcount) {
+            console.log(this.batchOptions);
+            this.batchChangeHandler(this.batchOptions[1]?.value);
+            this.batchNumber = this.batchOptions[1]?.value;
+          } else {
+            this.batchChangeHandler(null); //默认显示当前批次数据
+          }
+
           this.$nextTick(() => {
             //关闭所有展开行
             this.tableData.forEach((item) => {

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

@@ -805,7 +805,11 @@
         </span>
       </el-dialog>
       <!-- 出库明细 -->
-      <el-dialog title="出库明细" :visible.sync="outStockShow" width="1200px">
+      <el-dialog
+        :title="stockTitle"
+        :visible.sync="outStockShow"
+        width="1200px"
+      >
         <!-- <OutStock ref="outStockRef"></OutStock> -->
         <OutStockDetail ref="OutStockDetailRef"></OutStockDetail>
         <span slot="footer" class="dialog-footer">
@@ -882,6 +886,7 @@ export default {
   },
   data() {
     return {
+      stockTitle: "", //出库弹窗标题
       isAdding: false,
       oldInventoryState: 0,
       totalMoney: "", //总金额 小写
@@ -1697,7 +1702,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":"9"},{"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"},{"fieldName":"sale_order.status","mark":"3","refValue":"11"}]',
               btnHasPermi: "huaxian:xsglddgl:INSERT",
               children: [],
             },
@@ -1707,7 +1712,17 @@ export default {
               btnIcon: "",
               // btnShowCondition: "[]",
               btnShowCondition:
-                '[{"fieldName":"sale_order.status","mark":"3","refValue":"1"},{"fieldName":"sale_order.status","mark":"3","refValue":"7"},{"fieldName":"sale_order.status","mark":"3","refValue":"8"}]',
+                '[{"fieldName":"sale_order.status","mark":"3","refValue":"1"},{"fieldName":"sale_order.status","mark":"3","refValue":"7"},{"fieldName":"sale_order.status","mark":"3","refValue":"8"},{"fieldName":"sale_order.status","mark":"3","refValue":"11"}]',
+              btnHasPermi: "huaxian:xsglddgl:INSERT",
+              children: [],
+            },
+            {
+              btnName: "重新登账",
+              btnType: "ReAccount",
+              btnIcon: "",
+              // btnShowCondition: "[]",
+              btnShowCondition:
+                '[{"fieldName":"sale_order.status","mark":"6","refValue":"11"}]',
               btnHasPermi: "huaxian:xsglddgl:INSERT",
               children: [],
             },
@@ -1717,7 +1732,7 @@ export default {
               btnIcon: "",
               // btnShowCondition: "[]",
               btnShowCondition:
-                '[{"fieldName":"sale_order.status","mark":"3","refValue":"1"},{"fieldName":"sale_order.status","mark":"3","refValue":"2"},{"fieldName":"sale_order.status","mark":"3","refValue":"8"},{"fieldName":"sale_order.status","mark":"3","refValue":"7"}]',
+                '[{"fieldName":"sale_order.status","mark":"3","refValue":"1"},{"fieldName":"sale_order.status","mark":"3","refValue":"2"},{"fieldName":"sale_order.status","mark":"3","refValue":"8"},{"fieldName":"sale_order.status","mark":"3","refValue":"7"},{"fieldName":"sale_order.status","mark":"3","refValue":"11"}]',
               btnHasPermi: "huaxian:xsglddgl:INSERT",
               children: [],
             },
@@ -1727,7 +1742,7 @@ export default {
               btnIcon: "",
               // btnShowCondition: "[]",
               btnShowCondition:
-                '[{"fieldName":"sale_order.status","mark":"3","refValue":"1"},{"fieldName":"sale_order.status","mark":"3","refValue":"2"},{"fieldName":"sale_order.status","mark":"3","refValue":"8"},{"fieldName":"sale_order.status","mark":"3","refValue":"7"}]',
+                '[{"fieldName":"sale_order.status","mark":"3","refValue":"1"},{"fieldName":"sale_order.status","mark":"3","refValue":"2"},{"fieldName":"sale_order.status","mark":"3","refValue":"8"},{"fieldName":"sale_order.status","mark":"3","refValue":"7"},{"fieldName":"sale_order.status","mark":"3","refValue":"11"}]',
               // ,{"fieldName":"sale_order.status","mark":"3","refValue":"3"}  3待生产
               btnHasPermi: "huaxian:xsglddgl:INSERT",
               children: [],
@@ -1745,7 +1760,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":"9"}]',
+                '[{"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":"11"}]',
               children: [],
               btnHasPermi: "huaxian:xsglddgl:INSERT",
             },
@@ -1754,7 +1769,7 @@ export default {
               btnType: "myComplate",
               btnIcon: "",
               btnShowCondition:
-                '[{"fieldName":"sale_order.status","mark":"6","refValue":"9"}]',
+                '[{"fieldName":"sale_order.status","mark":"6","refValue":"9"},{"fieldName":"sale_order.status","mark":"3","refValue":"11"}]',
               children: [],
               btnHasPermi: "huaxian:xsglddgl:INSERT",
             }
@@ -3509,11 +3524,20 @@ export default {
     },
     // 出库明细回调
     handleOutDetail(row) {
+      this.stockTitle = "出库明细";
       this.outStockShow = true;
       this.$nextTick(() => {
         this.$refs.OutStockDetailRef.getOutStockDetail(row, false);
       });
     },
+    // 重新登账回调
+    handleReAccount(row) {
+      this.stockTitle = "重新登账";
+      this.outStockShow = true;
+      this.$nextTick(() => {
+        this.$refs.OutStockDetailRef.getOutStockDetail(row, false, true);
+      });
+    },
     // 操作列回调
     excuteHandler(btnData, row) {
       let { btnType, btnParams, btnFormType } = btnData;
@@ -3550,6 +3574,9 @@ export default {
         case "OutDetail":
           this.handleOutDetail(row);
           break;
+        case "ReAccount": //重新登账
+          this.handleReAccount(row);
+          break;
 
         case "myDetail":
           this.handleDetail(row);

+ 1 - 1
zkqy-ui/src/views/system/financialManage/saleAccountsReceivableDetail.vue

@@ -1105,7 +1105,7 @@ export default {
     },
     // 驳回回调 现在的  撤销登账
     async handlerReturn(row, index) {
-      this.$confirm("是否确认驳回?", "提示", {
+      this.$confirm("是否确认撤销登账?", "提示", {
         confirmButtonText: "确定",
         cancelButtonText: "取消",
         type: "warning",