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 +++++++++++++------
 vue.config.js                                                         |    4 
 src/components/layout/components/appHeader/index.vue                  |    6 
 src/views/orderManageModule/orderManage/index.vue                     |  115 +++++++++++++++++++---
 src/api/orderManageModule/orderManage.js                              |   46 ++++++---
 5 files changed, 202 insertions(+), 71 deletions(-)

diff --git a/src/api/orderManageModule/orderManage.js b/src/api/orderManageModule/orderManage.js
index 4f09a82..e055f30 100644
--- a/src/api/orderManageModule/orderManage.js
+++ b/src/api/orderManageModule/orderManage.js
@@ -4,7 +4,7 @@
 // 濮斿璁㈠崟鍒楄〃
 export const outsourceOrderList = (data) => {
   return request({
-    url: "/api-s/v1/outsourcing/order/list",
+    url: "/api-outsourcing/v1/order/list",
     method: "get",
     params: data
   })
@@ -13,7 +13,7 @@
 // 濮斿璁㈠崟缁熻
 export const outsourceOrderOverview = () => {
   return request({
-    url: "/api-s/v1/outsourcing/order/overview",
+    url: "/api-outsourcing/v1/order/overview",
     method: "get"
   })
 }
@@ -21,7 +21,7 @@
 // 濮斿璁㈠崟浜у搧鍒楄〃
 export const outsourceOrderProductList = (data) => {
   return request({
-    url: "/api-s/v1/outsourcing/order/productList",
+    url: "/api-outsourcing/v1/order/productList",
     method: "get",
     params: data
   })
@@ -30,25 +30,41 @@
 // 濮斿浼佷笟渚涜揣鍘嗗彶
 export const outsourcenterpriseProductList = (data) => {
   return request({
-    url: "/api-s/v1/outsourcing/enterprise/productList",
+    url: "/api-outsourcing/v1/enterprise/productList",
     method: "get",
     params: data
   })
 }
 
-// // 濮斿渚涘簲鍟�
-// export const orderAssign = (data) => {
-//   return request({
-//     url: "/api-s/v1/outsourcing/order/assign",
-//     method: "post",
-//     data
-//   })
-// }
+// 鑾峰彇鍙戣揣鍒楄〃
+export const getDeliveryList = (data) => {
+  return request({
+    url: "/api-outsourcing/v1/order/deliveryList",
+    method: "post",
+    data
+  })
+}
+// 鍙戣揣寮圭獥鍙戣揣鍑嗗鍒楄〃
+export const getDeliveryPrepare = (data) => {
+  return request({
+    url: "/api-outsourcing/v1/order/deliveryPrepare?outsourcingOrderID=" + data.outsourcingOrderID,
+    method: "get",
+    data
+  })
+}
+// 淇濆瓨鍙戣揣淇℃伅
+export const saveDelivery = (data) => {
+  return request({
+    url: "/api-outsourcing/v1/order/saveDelivery",
+    method: "post",
+    data
+  })
+}
 
 // 淇濆瓨鐗╂枡鐢宠鍗�
 export const saveMaterialApply = (data) => {
   return request({
-    url: "/api-s/v1/outsourcing/order/saveMaterialApply",
+    url: "/api-outsourcing/v1/order/saveMaterialApply",
     method: "post",
     data
   })
@@ -57,7 +73,7 @@
 // 鑾峰彇鐗╂枡鐢宠鍗�
 export const getMaterialApplyList = (data) => {
   return request({
-    url: "/api-s/v1/outsourcing/order/getMaterialApplyList",
+    url: "/api-outsourcing/v1/order/getMaterialApplyList",
     method: "post",
     data
   })
@@ -66,7 +82,7 @@
 // 淇敼鐘舵��
 export const changeOutsourceOrderStatus = (data) => {
   return request({
-    url: "/api-s/v1/outsourcing/order/changeStatus",
+    url: "/api-outsourcing/v1/order/changeStatus",
     method: "post",
     data
   })
diff --git a/src/components/layout/components/appHeader/index.vue b/src/components/layout/components/appHeader/index.vue
index d1c5c8a..955df69 100644
--- a/src/components/layout/components/appHeader/index.vue
+++ b/src/components/layout/components/appHeader/index.vue
@@ -37,12 +37,12 @@
     }
   },
   created() {
-    console.log(localStorage, "dddd")
+    // console.log(localStorage, "dddd")
   },
   mounted() {
     // this.username = document.cookie.replace(/(?:(?:^|.*;\s*)username\s*=\s*([^;]*).*$)|^.*$/, "$1")
-    console.log(localStorage, "mounted")
-    console.log(localStorage)
+    // console.log(localStorage, "mounted")
+    // console.log(localStorage)
     this.editConfig.userId = localStorage.getItem("uuid")
     this.username = localStorage.getItem("username")
   },
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(() => {})
+      })
     }
   }
 }
diff --git a/src/views/orderManageModule/orderManage/index.vue b/src/views/orderManageModule/orderManage/index.vue
index 95eb7d0..2997211 100644
--- a/src/views/orderManageModule/orderManage/index.vue
+++ b/src/views/orderManageModule/orderManage/index.vue
@@ -10,7 +10,7 @@
           :otherOptions="otherOptions"
           :show-action-btn="false"
           :placeholder="'璇疯緭鍏ヨ鍗曠紪鍙�'"
-          @searchClick="onFilterSearch"
+          @searchClick="searchClick"
         />
       </div>
     </div>
@@ -30,8 +30,12 @@
               <el-table-column label="鎿嶄綔" width="160" fixed="right">
                 <template slot-scope="scope">
                   <template v-if="scope.row.status == 1">
-                    <el-button type="text" size="small">纭</el-button>
-                    <el-button type="text" size="small">鍙栨秷</el-button>
+                    <el-button type="text" size="small" @click.stop="changeStatusClick(scope.row, '纭')"
+                      >纭</el-button
+                    >
+                    <el-button type="text" size="small" @click.stop="changeStatusClick(scope.row, '鍙栨秷')"
+                      >鍙栨秷</el-button
+                    >
                   </template>
                   <el-button
                     v-else-if="scope.row.status == 2 || scope.row.status == 4"
@@ -41,12 +45,16 @@
                     >鐢宠鐗╂枡</el-button
                   >
                   <template v-else-if="scope.row.status == 5">
-                    <el-button type="text" size="small">鐢熶骇瀹屾垚</el-button>
+                    <el-button type="text" size="small" @click.stop="changeStatusClick(scope.row, '鐢熶骇瀹屾垚')"
+                      >鐢熶骇瀹屾垚</el-button
+                    >
                     <el-button type="text" size="small" @click.stop="deliveryClick(scope.row)">鍙戣揣</el-button>
                   </template>
                   <template v-else-if="scope.row.status == 6">
                     <el-button type="text" size="small" @click.stop="deliveryClick(scope.row)">鍙戣揣</el-button>
-                    <el-button type="text" size="small">鍏抽棴</el-button>
+                    <el-button type="text" size="small" @click.stop="changeStatusClick(scope.row, '鍙戣揣瀹屾垚')"
+                      >鍙戣揣瀹屾垚</el-button
+                    >
                   </template>
                   <span v-else>--</span>
                 </template>
@@ -132,8 +140,9 @@
   outsourceOrderList,
   outsourceOrderOverview,
   outsourceOrderProductList,
-  getMaterialApplyList
-  // changeOutsourceOrderStatus
+  getMaterialApplyList,
+  getDeliveryList,
+  changeOutsourceOrderStatus
 } from "@/api/orderManageModule/orderManage"
 import pageMixin from "@/components/makepager/pager/mixin/pageMixin"
 import ApplyMaterialsDialog from "@/views/orderManageModule/orderManage/components/ApplyMaterialsDialog"
@@ -200,13 +209,13 @@
         { label: "浜у搧鍚嶇О", prop: "productName", default: true },
         { label: "浜у搧缂栧彿", prop: "productId" },
         { label: "璁㈠崟鏁伴噺", prop: "amount" },
-        { label: "鍙戣揣鏁伴噺", prop: "validity_date" },
+        { label: "鍙戣揣鏁伴噺", prop: "sendAmount" },
         { label: "浜у搧瑙勬牸", prop: "specs" },
-        { label: "浜у搧鍨嬪彿", prop: "model" },
+        { label: "浜у搧鍨嬪彿", prop: "type" },
         { label: "鍗曚綅", prop: "unit" },
-        { label: "杩愬崟鍙�", prop: "validity_date" },
-        { label: "鎵胯繍鍟�", prop: "validity_date" },
-        { label: "鍒涘缓鏃堕棿", prop: "client_name", min: 100 }
+        { label: "杩愬崟鍙�", prop: "waybillNumber" },
+        { label: "鎵胯繍鍟�", prop: "carrier" },
+        { label: "鍒涘缓鏃堕棿", prop: "createdAt", min: 100 }
       ],
       showDeliveryRquestCol: [
         "鍙戣揣鍗曞彿",
@@ -274,10 +283,33 @@
     },
     // 鑾峰彇鐗╂枡鐢宠鍗�
     getMaterialApplyList(number) {
-      getMaterialApplyList({ number: number, page: 1, pageSize: 15 }).then((res) => {
+      getMaterialApplyList({ number: number }).then((res) => {
         console.log(res)
         if (res.code == 200) {
           this.bottomTwoTableList2.tableInfomation = res.data
+        }
+      })
+    },
+    // 鑾峰彇鍙戣揣鍒楄〃
+    getDeliveryList(id) {
+      getDeliveryList({ outsourcingOrderID: id }).then((res) => {
+        console.log(res)
+        if (res.code == 200) {
+          let list = res.data.map((item) => {
+            return {
+              number: item.outsourcingOrderDelivery.number,
+              productName: item.outsourcingOrderProduct.productName,
+              productId: item.outsourcingOrderProduct.productId,
+              amount: item.outsourcingOrderProduct.amount,
+              sendAmount: item.sendAmount,
+              type: item.outsourcingOrderProduct.type,
+              unit: item.outsourcingOrderProduct.unit,
+              waybillNumber: item.outsourcingOrderDelivery.waybillNumber,
+              carrier: item.outsourcingOrderDelivery.carrier,
+              createdAt: item.createdAt
+            }
+          })
+          this.bottomTwoTableList3.tableInfomation = list
         }
       })
     },
@@ -296,15 +328,20 @@
     addCommonClick() {
       alert("闇茶タ666")
     },
-    searchClick() {},
-    onFilterSearch() {},
+    searchClick(val) {
+      this.searchParam.keyword = val
+      this.pagerOptions.currPage = 1
+      this.getData()
+    },
     tableRowClick(row, column, event) {
       console.log(row, column, event)
       this.selectRow = row
       if (this.activeNameBottom == 1) {
         this.getProductListMethod(this.selectRow.id)
-      } else {
+      } else if (this.activeNameBottom == 2) {
         this.getMaterialApplyList(this.selectRow.number)
+      } else {
+        this.getDeliveryList(this.selectRow.id)
       }
     },
     tableRowClassName({ row }) {
@@ -313,6 +350,43 @@
       }
     },
     getSelectArray() {},
+    // 鐘舵�佷慨鏀�
+    changeStatusClick(row, val) {
+      if (val == "纭") {
+        this.changeOutsourceOrderStatus(row.number, 2, "纭鎴愬姛")
+      } else if (val == "鍙栨秷") {
+        this.changeOutsourceOrderStatus(row.number, 0, "鍙栨秷鎴愬姛")
+      } else if (val == "鐢熶骇瀹屾垚") {
+        this.$confirm("鏄惁纭鐢熶骇瀹屾垚?", "鎻愮ず", {
+          confirmButtonText: "纭畾",
+          cancelButtonText: "鍙栨秷",
+          type: "warning"
+        }).then(() => {
+          this.changeOutsourceOrderStatus(row.number, 6, "鐢熶骇瀹屾垚鎴愬姛")
+        })
+      } else if (val == "鍙戣揣瀹屾垚") {
+        this.$confirm("鏄惁纭鍏ㄩ儴鍙戣揣瀹屾垚?", "鎻愮ず", {
+          confirmButtonText: "纭畾",
+          cancelButtonText: "鍙栨秷",
+          type: "warning"
+        }).then(() => {
+          this.changeOutsourceOrderStatus(row.number, 7, "鍏ㄩ儴鍙戣揣瀹屾垚鎴愬姛")
+        })
+      }
+    },
+    changeOutsourceOrderStatus(number, status, str) {
+      changeOutsourceOrderStatus({
+        outsourcingOrderNumber: number,
+        status: status
+      })
+        .then((reply) => {
+          if (reply.code == 200) {
+            this.getData()
+            this.$message.success(str)
+          }
+        })
+        .catch(() => {})
+    },
     // 鐢宠鐗╂枡
     applyClick(row) {
       this.editApplyConfig.visible = true
@@ -328,15 +402,18 @@
       this.deliveryConfig.visible = true
       this.deliveryConfig.title = "鍙戣揣"
       this.deliveryConfig.infomation = {
-        outsourcingOrderNumber: row.number
+        id: row.id,
+        number: row.number
       }
     },
     tabClickBottom(activeNameBottom) {
       this.activeNameBottom = activeNameBottom
       if (activeNameBottom == 1) {
         this.getProductListMethod(this.selectRow.id)
-      } else {
+      } else if (activeNameBottom == 2) {
         this.getMaterialApplyList(this.selectRow.number)
+      } else {
+        this.getDeliveryList(this.selectRow.id)
       }
     },
     setTable() {
@@ -437,6 +514,8 @@
         ? "鐢熶骇涓�"
         : val === 6
         ? "鐢熶骇瀹屾垚"
+        : val === 7
+        ? "鍙戣揣瀹屾垚"
         : "--"
     }
   }
diff --git a/vue.config.js b/vue.config.js
index edefb27..5e19cbe 100644
--- a/vue.config.js
+++ b/vue.config.js
@@ -20,8 +20,8 @@
       //   ws: true,
       //   changeOrigin: true
       // },
-      "/api-s": {
-        target: "http://192.168.20.119:9081",
+      "/api-outsourcing": {
+        target: "http://192.168.20.120:8008",
         ws: true,
         changeOrigin: true
       },

--
Gitblit v1.8.0