From 2aa506566031eae9a53006119db0cea8c876e6c3 Mon Sep 17 00:00:00 2001
From: yangfeng <wanwan926_4@163.com>
Date: 星期一, 01 四月 2024 11:42:23 +0800
Subject: [PATCH] 选择产品信息单位处理

---
 src/views/orderManageModule/orderManage/index.vue |  269 +++++++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 218 insertions(+), 51 deletions(-)

diff --git a/src/views/orderManageModule/orderManage/index.vue b/src/views/orderManageModule/orderManage/index.vue
index b915842..46950f2 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>
@@ -29,7 +29,14 @@
             <template slot="tableButton">
               <el-table-column label="鎿嶄綔" width="160" fixed="right">
                 <template slot-scope="scope">
-                  <el-button v-if="scope.row.status == 0" type="text" size="small">寰呯‘璁�</el-button>
+                  <template v-if="scope.row.status == 1">
+                    <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"
                     type="text"
@@ -38,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>
@@ -125,6 +136,14 @@
 </template>
 
 <script>
+import {
+  outsourceOrderList,
+  outsourceOrderOverview,
+  outsourceOrderProductList,
+  getMaterialApplyList,
+  getDeliveryList,
+  changeOutsourceOrderStatus
+} from "@/api/orderManageModule/orderManage"
 import pageMixin from "@/components/makepager/pager/mixin/pageMixin"
 import ApplyMaterialsDialog from "@/views/orderManageModule/orderManage/components/ApplyMaterialsDialog"
 import DeliveryDialog from "@/views/orderManageModule/orderManage/components/DeliveryDialog"
@@ -155,10 +174,10 @@
       tableList: {},
       tableColumn: [
         { label: "璁㈠崟缂栧彿", prop: "number", min: 90, default: true },
-        { label: "浜у搧鏁伴噺", prop: "quotationName", min: 120 },
-        { label: "绛剧害鏃ユ湡", prop: "validity_date", min: 100 },
-        { label: "浜や粯鏃ユ湡", prop: "client_name", min: 120 },
-        { label: "鐘舵��", prop: "quotationStatus", isCallMethod: true, getCallMethod: this.getStatus }
+        { label: "浜у搧鏁伴噺", prop: "productQuantity", min: 120 },
+        { label: "绛剧害鏃ユ湡", prop: "signTime", min: 100 },
+        { label: "浜や粯鏃ユ湡", prop: "deliveryDate", min: 120 },
+        { label: "鐘舵��", prop: "status", isCallMethod: true, getCallMethod: this.getStatus }
       ],
       showCol: ["璁㈠崟缂栧彿", "浜у搧鏁伴噺", "绛剧害鏃ユ湡", "浜や粯鏃ユ湡", "鐘舵��"],
       selectRow: {},
@@ -168,35 +187,35 @@
       bottomTwoTableList2: {},
       bottomTwoTableList3: {},
       productColumn: [
-        { label: "浜у搧鍚嶇О", prop: "number", min: 90, default: true },
-        { label: "浜у搧缂栧彿", prop: "quotationName", min: 120 },
-        { label: "Bom缂栧彿", prop: "validity_date", min: 100 },
-        { label: "浜у搧瑙勬牸", prop: "client_name", min: 120 },
-        { label: "浜у搧鏁伴噺", prop: "quotationStatus" },
-        { label: "鍗曚綅", prop: "client_name", min: 120 }
+        { label: "浜у搧鍚嶇О", prop: "productName", min: 90, default: true },
+        { label: "浜у搧缂栧彿", prop: "productId", min: 120 },
+        { label: "Bom缂栧彿", prop: "bomID", min: 100 },
+        { label: "浜у搧瑙勬牸", prop: "specs", min: 120 },
+        { label: "浜у搧鏁伴噺", prop: "amount" },
+        { label: "鍗曚綅", prop: "unit", min: 120 }
       ],
       showProductCol: ["浜у搧鍚嶇О", "浜у搧缂栧彿", "Bom缂栧彿", "浜у搧瑙勬牸", "浜у搧鏁伴噺", "鍗曚綅"],
       materialRquestColumn: [
-        { label: "浜у搧鍚嶇О", prop: "number", min: 90, default: true },
-        { label: "浜у搧缂栧彿", prop: "quotationName", min: 120 },
-        { label: "浜у搧鏁伴噺", prop: "validity_date", min: 100 },
-        { label: "浜у搧瑙勬牸", prop: "client_name", min: 120 },
-        { label: "浜у搧鍨嬪彿", prop: "quotationStatus" },
-        { label: "鍗曚綅", prop: "client_name", min: 120 }
+        { label: "浜у搧鍚嶇О", prop: "materialName", min: 90, default: true },
+        { label: "浜у搧缂栧彿", prop: "materialNumber", min: 120 },
+        { label: "浜у搧鏁伴噺", prop: "amount", min: 100 },
+        { label: "浜у搧瑙勬牸", prop: "specs", min: 120 },
+        { label: "浜у搧鍨嬪彿", prop: "type" },
+        { label: "鍗曚綅", prop: "unit", min: 120 }
       ],
       showMaterialRquestCol: ["浜у搧鍚嶇О", "浜у搧缂栧彿", "浜у搧鏁伴噺", "浜у搧瑙勬牸", "浜у搧鍨嬪彿", "鍗曚綅"],
       deliveryRquestColumn: [
         { label: "鍙戣揣鍗曞彿", prop: "number", default: true },
-        { label: "浜у搧鍚嶇О", prop: "number", default: true },
-        { label: "浜у搧缂栧彿", prop: "quotationName" },
-        { label: "璁㈠崟鏁伴噺", prop: "validity_date" },
-        { label: "鍙戣揣鏁伴噺", prop: "validity_date" },
-        { label: "浜у搧瑙勬牸", prop: "client_name" },
-        { label: "浜у搧鍨嬪彿", prop: "quotationStatus" },
-        { label: "鍗曚綅", prop: "client_name" },
-        { label: "杩愬崟鍙�", prop: "validity_date" },
-        { label: "鎵胯繍鍟�", prop: "validity_date" },
-        { label: "鍒涘缓鏃堕棿", prop: "client_name", min: 100 }
+        { label: "浜у搧鍚嶇О", prop: "productName", default: true },
+        { label: "浜у搧缂栧彿", prop: "productId" },
+        { label: "璁㈠崟鏁伴噺", prop: "amount" },
+        { label: "鍙戣揣鏁伴噺", prop: "sendAmount" },
+        { label: "浜у搧瑙勬牸", prop: "specs" },
+        { label: "浜у搧鍨嬪彿", prop: "type" },
+        { label: "鍗曚綅", prop: "unit" },
+        { label: "杩愬崟鍙�", prop: "waybillNumber" },
+        { label: "鎵胯繍鍟�", prop: "carrier" },
+        { label: "鍒涘缓鏃堕棿", prop: "createdAt", min: 100 }
       ],
       showDeliveryRquestCol: [
         "鍙戣揣鍗曞彿",
@@ -220,23 +239,167 @@
         visible: false,
         title: "鍙戣揣",
         infomation: {}
+      },
+      searchParam: {
+        keyword: "",
+        page: 1,
+        pageSize: 15
       }
     }
   },
   created() {
     this.setTable()
+    this.getData()
   },
   methods: {
     reRreshData() {
       this.getData()
     },
-    addCommonClick() {
-      alert("闇茶タ666")
+    // 鑾峰彇top璁㈠崟鍒楄〃鏁版嵁
+    async getData() {
+      this.searchParam.page = this.pagerOptions.currPage
+      this.searchParam.pageSize = this.pagerOptions.pageSize
+      let rsp = await outsourceOrderList(this.searchParam)
+      let list = rsp
+      if (list && list.code == 200) {
+        this.tableList.tableInfomation = list.data
+        this.pagerOptions.totalCount = list.total
+        if (list.total > 0) {
+          this.selectRow = list.data[0]
+          if (this.activeNameBottom == 1) {
+            this.getProductListMethod(this.selectRow.id)
+          } else if (this.activeNameBottom == 2) {
+            this.getMaterialApplyList(this.selectRow.number)
+          } else {
+            this.getDeliveryList(this.selectRow.id)
+          }
+        } else {
+          this.selectRow = {}
+        }
+        this.overview()
+      }
     },
-    searchClick() {},
-    onFilterSearch() {},
-    tableRowClick() {},
+    // 鑾峰彇浜у搧淇℃伅
+    getProductListMethod(id) {
+      outsourceOrderProductList({ outsourcingOrderId: id }).then((res) => {
+        if (res.code == 200) {
+          this.bottomTwoTableList1.tableInfomation = res.data
+        }
+      })
+    },
+    // 鑾峰彇鐗╂枡鐢宠鍗�
+    getMaterialApplyList(number) {
+      getMaterialApplyList({ number: number }).then((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
+        }
+      })
+    },
+    overview() {
+      outsourceOrderOverview().then((reply) => {
+        this.totalObject.value = reply.data.total || 0
+        this.otherOptions.map((item) => {
+          if (item.label === "寰呭垎閰�") {
+            item.value = reply.data.waitAssigned
+          } else if (item.label === "宸插垎閰�") {
+            item.value = reply.data.hasAssigned
+          }
+        })
+      })
+    },
+    searchClick(val) {
+      this.searchParam.keyword = val
+      this.pagerOptions.currPage = 1
+      this.bottomTwoTableList1.tableInfomation = []
+      this.bottomTwoTableList2.tableInfomation = []
+      this.bottomTwoTableList3.tableInfomation = []
+      this.getData()
+    },
+    tableRowClick(row, column, event) {
+      console.log(row, column, event)
+      this.selectRow = row
+      if (this.activeNameBottom == 1) {
+        this.getProductListMethod(this.selectRow.id)
+      } else if (this.activeNameBottom == 2) {
+        this.getMaterialApplyList(this.selectRow.number)
+      } else {
+        this.getDeliveryList(this.selectRow.id)
+      }
+    },
+    tableRowClassName({ row }) {
+      if (row.id == this.selectRow.id) {
+        return "onSelect"
+      }
+    },
     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, "鐢熶骇瀹屾垚鎴愬姛")
+          })
+          .catch(() => {
+            this.$message.warning("宸插彇娑堢敓浜у畬鎴�")
+          })
+      } else if (val == "鍙戣揣瀹屾垚") {
+        this.$confirm("鏄惁纭鍏ㄩ儴鍙戣揣瀹屾垚?", "鎻愮ず", {
+          confirmButtonText: "纭畾",
+          cancelButtonText: "鍙栨秷",
+          type: "warning"
+        })
+          .then(() => {
+            this.changeOutsourceOrderStatus(row.number, 7, "鍏ㄩ儴鍙戣揣瀹屾垚鎴愬姛")
+          })
+          .catch(() => {
+            this.$message.warning("宸插彇娑堝彂璐у畬鎴�")
+          })
+      }
+    },
+    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
@@ -252,27 +415,27 @@
       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 {
-      //   this.getMaterialApplyList(this.selectRow.number);
-      // }
+      if (Object.keys(this.selectRow).length > 0) {
+        if (activeNameBottom == 1) {
+          this.getProductListMethod(this.selectRow.id)
+        } else if (activeNameBottom == 2) {
+          this.getMaterialApplyList(this.selectRow.number)
+        } else {
+          this.getDeliveryList(this.selectRow.id)
+        }
+      }
     },
     setTable() {
       this.tableList = {
         selectIndex: true,
         selectBox: true,
-        tableInfomation: [
-          {
-            number: "1111",
-            status: 4
-          }
-        ],
+        tableInfomation: [],
         allcol: [],
         showcol: this.showCol,
         tableColumn: this.setColumnVisible(this.showCol, this.tableColumn)
@@ -354,10 +517,8 @@
     },
     // 鐘舵��
     getStatus(val) {
-      return val === 0
-        ? "寰呭垎閰�"
-        : val === 1
-        ? "宸插垎閰�"
+      return val === 1
+        ? "寰呯‘璁�"
         : val === 2
         ? "寰呯敓浜�"
         : val === 3
@@ -368,6 +529,12 @@
         ? "鐢熶骇涓�"
         : val === 6
         ? "鐢熶骇瀹屾垚"
+        : val === 7
+        ? "鍙戣揣瀹屾垚"
+        : val == 8
+        ? "鍏ュ簱瀹屾垚"
+        : val == 9
+        ? "鍏抽棴"
         : "--"
     }
   }

--
Gitblit v1.8.0