From ef815963da1ebaebcb4de8985f178e3add8c54a3 Mon Sep 17 00:00:00 2001
From: yangfeng <wanwan926_4@163.com>
Date: 星期六, 23 三月 2024 15:17:35 +0800
Subject: [PATCH] 发货列表、 发货准备列表、保存发货信息、全部发货完成等接口联调

---
 src/views/orderManageModule/orderManage/components/DeliveryDialog.vue |  102 ++++++++++++++++++++++++++++++++++----------------
 1 files changed, 69 insertions(+), 33 deletions(-)

diff --git a/src/views/orderManageModule/orderManage/components/DeliveryDialog.vue b/src/views/orderManageModule/orderManage/components/DeliveryDialog.vue
index 2b417fc..0420997 100644
--- a/src/views/orderManageModule/orderManage/components/DeliveryDialog.vue
+++ b/src/views/orderManageModule/orderManage/components/DeliveryDialog.vue
@@ -39,7 +39,6 @@
           style="width: 100%"
           height="500"
           border
-          @selection-change="getSelectArray"
           :header-cell-style="{
             background: '#f1f3f8',
             color: '#000009',
@@ -50,12 +49,12 @@
         >
           <!-- <el-table-column type="selection" width="55"> </el-table-column> -->
           <el-table-column type="index" label="搴忓彿" width="50" align="center"></el-table-column>
-          <el-table-column prop="name" label="浜у搧鍚嶇О" show-overflow-tooltip></el-table-column>
-          <el-table-column prop="number" label="浜у搧缂栧彿" show-overflow-tooltip> </el-table-column>
-          <el-table-column prop="orderAmount" label="璁㈠崟鏁伴噺"> </el-table-column>
-          <el-table-column prop="amount" label="宸插彂璐ф暟閲�"> </el-table-column>
-          <el-table-column prop="specifications" label="浜у搧瑙勬牸"> </el-table-column>
-          <el-table-column prop="modelNumber" label="浜у搧鍨嬪彿"> </el-table-column>
+          <el-table-column prop="productName" label="浜у搧鍚嶇О" show-overflow-tooltip></el-table-column>
+          <el-table-column prop="productId" label="浜у搧缂栧彿" show-overflow-tooltip> </el-table-column>
+          <el-table-column prop="amount" label="璁㈠崟鏁伴噺"> </el-table-column>
+          <el-table-column prop="sendAmount" label="宸插彂璐ф暟閲�"> </el-table-column>
+          <el-table-column prop="specs" label="浜у搧瑙勬牸"> </el-table-column>
+          <el-table-column prop="type" label="浜у搧鍨嬪彿"> </el-table-column>
           <el-table-column prop="unit" label="鍗曚綅"> </el-table-column>
           <el-table-column prop="deliveryAmount" label="鍙戣揣鏁伴噺">
             <template slot-scope="scope">
@@ -82,7 +81,7 @@
           <el-button @click="editRow.visible = false">鍏抽棴</el-button>
         </template>
         <template v-else>
-          <el-button type="primary" :loading="isAddloading" @click="saveClick('form')">鍏ㄩ儴鍙戣揣瀹屾垚</el-button>
+          <!-- <el-button type="primary" :loading="isAddloading" @click="deliveryCompleteClick()">鍏ㄩ儴鍙戣揣瀹屾垚</el-button> -->
           <el-button @click="editRow.visible = false">鍙栨秷</el-button>
           <el-button type="primary" :loading="isAddloading" @click="saveClick('form')">纭鍙戣揣</el-button>
         </template>
@@ -92,6 +91,7 @@
 </template>
 
 <script>
+import { getDeliveryPrepare, saveDelivery, changeOutsourceOrderStatus } from "@/api/orderManageModule/orderManage"
 export default {
   name: "DeliveryDialog",
   props: {
@@ -118,12 +118,7 @@
         infomation: {}
       },
       isAddloading: false,
-      tableData: [
-        {
-          name: "椤堕《椤堕《",
-          deliveryAmount: 2
-        }
-      ],
+      tableData: [],
       ruleForm: {
         number: "",
         carrier: "",
@@ -136,6 +131,7 @@
   },
   created() {
     // this.setTableForm()
+    this.getDeliveryPrepare()
   },
   watch: {
     "editCommonConfig.visible"(val) {
@@ -148,27 +144,26 @@
     handleClose() {
       this.editRow.visible = false
     },
+    // 鑾峰彇鍙戣揣浜у搧鍒楄〃
+    getDeliveryPrepare() {
+      getDeliveryPrepare({
+        outsourcingOrderID: this.editRow.infomation.id
+      }).then((res) => {
+        console.log(res)
+        if (res.code == 200) {
+          let list = res.data.map((item) => {
+            return {
+              ...item,
+              deliveryAmount: 0
+            }
+          })
+          this.tableData = list
+        }
+      })
+    },
     // 澶氶�夊洖璋�
     getSelectArray(arr) {
       console.log(arr)
-      // let isPush = true
-      // if (arr.length > 0) {
-      //   for (let i in arr) {
-      //     let item = {
-      //       outsourcingOrderNumber: this.editRow.infomation.outsourcingOrderNumber,
-      //       materialNumber: arr[i].id,
-      //       materialName: arr[i].name,
-      //       amount: 1,
-      //       unit: arr[i].unit ? arr[i].unit : 1,
-      //       type: arr[i].type ? arr[i].type : "",
-      //       specs: arr[i].specs ? arr[i].specs : ""
-      //     }
-      //     console.log(arr, "8989")
-      //     isPush = this.getIsPush(this.productTableList.tableInfomation, arr[i].id)
-      //     if (isPush) {
-      //       this.productTableList.tableInfomation.splice(this.productTableList.tableInfomation.length, 0, item)
-      //     }
-      //   }
     },
     // 鏁伴噺杈撳叆鍥炶皟
     inputContent(val, scope) {
@@ -177,9 +172,50 @@
     saveClick(formName) {
       this.$refs[formName].validate((valid) => {
         if (valid) {
-          console.log("淇濆瓨鍐呭澶勭悊")
+          console.log(this.ruleForm, "淇濆瓨鍐呭澶勭悊", this.tableData)
+          let deliveryList = this.tableData.map((item) => {
+            return {
+              outsourcingOrderProductID: item.id,
+              sendAmount: item.deliveryAmount
+            }
+          })
+          let params = {
+            carrier: this.ruleForm.carrier,
+            deliveryList: deliveryList,
+            number: this.ruleForm.number,
+            outsourcingOrderID: this.editRow.infomation.id,
+            waybillNumber: this.ruleForm.waybillNumber
+          }
+          saveDelivery(params).then((res) => {
+            if (res.code == 200) {
+              this.handleClose()
+              this.$message.success("鍙戣揣鎴愬姛")
+              this.$emit("reRreshData")
+            }
+          })
         }
       })
+    },
+    // 鍏ㄩ儴鍙戣揣瀹屾垚
+    deliveryCompleteClick() {
+      this.$confirm("鏄惁纭鍏ㄩ儴鍙戣揣瀹屾垚?", "鎻愮ず", {
+        confirmButtonText: "纭畾",
+        cancelButtonText: "鍙栨秷",
+        type: "warning"
+      }).then(() => {
+        changeOutsourceOrderStatus({
+          outsourcingOrderNumber: this.editRow.infomation.number,
+          status: 7
+        })
+          .then((reply) => {
+            if (reply.code == 200) {
+              this.handleClose()
+              this.$message.success("鍏ㄩ儴鍙戣揣瀹屾垚鎴愬姛")
+              this.$emit("reRreshData")
+            }
+          })
+          .catch(() => {})
+      })
     }
   }
 }

--
Gitblit v1.8.0