From 8e5ec095fc4ba9cac7c91b681b06846d3e4155ae Mon Sep 17 00:00:00 2001
From: zuozhengqing <a13193816592@163.com>
Date: 星期一, 16 十月 2023 21:17:29 +0800
Subject: [PATCH] 销售明细,退货单、退款单根据客户进行筛选

---
 src/views/sales/masterOrder/index.vue |   86 ++++++++++++++++++++++++++++++-------------
 1 files changed, 60 insertions(+), 26 deletions(-)

diff --git a/src/views/sales/masterOrder/index.vue b/src/views/sales/masterOrder/index.vue
index 09a375d..99aa01c 100644
--- a/src/views/sales/masterOrder/index.vue
+++ b/src/views/sales/masterOrder/index.vue
@@ -8,15 +8,13 @@
       <div class="filter-card">
         <CommonSearch
             :show-add="false"
-            :show-download="false"
             :amount-view="false"
-            :show-action-btn="false"
             placeholder="璇疯緭鍏ュ崟鎹紪鍙�"
             @searchClick="onFilterSearch"
         >
           <template slot="leftButton">
             <el-button size="small" type="primary"  @click="addBtnClick">鏂板缓</el-button>
-            <el-button size="small"  @click="delClick">鍒犻櫎</el-button>
+<!--            <el-button size="small"  @click="delClick">鍒犻櫎</el-button>-->
           </template>
         </CommonSearch>
       </div>
@@ -29,16 +27,16 @@
               ref="tableListRef"
               :show-summary="showSummary"
               :table-list="tableList"
-              :select-box="!isDetail"
               @selClientClick="selClientClick"
               @selCommonClick="selCommonClick"
               @getSelectArray="getSelectArray"
+              @selTableCol="selTableCol"
           >
             <template slot="tableButton">
               <el-table-column label="鎿嶄綔" width="90">
                 <template slot-scope="scope">
                   <el-button @click="handleClick(scope.row)" type="text" size="small">缂栬緫</el-button>
-                  <!-- <el-button @click="delClick(scope.row.id)" type="text" size="small">鍒犻櫎</el-button> -->
+                   <el-button @click="deleteItem(scope.row.id)" type="text" size="small">鍒犻櫎</el-button>
                 </template>
               </el-table-column>
             </template>
@@ -113,7 +111,7 @@
         infomation: {}
       },
       showSummary: {
-        show: true,
+        show: false,
         sumProp: ["money"],
         mergeNumber: 5
       },
@@ -130,7 +128,17 @@
       searchSel: {
         value: "number",
         label: "鍗曟嵁缂栧彿"
-      }
+      },
+      tableColumn: [
+        { label: "鍗曟嵁缂栧彿", prop: "number", min: 100, isCommonClick: true, default: true }, // 鍗曟嵁缂栧彿
+        { label: "瀹㈡埛鍚嶇О", prop: "client_name", min: 120, isClientClick: true }, // 瀹㈡埛鍚嶇О
+        { label: "鏈嶅姟寮�濮嬫椂闂�", prop: "start_time" }, // 鏈嶅姟寮�濮嬫椂闂�
+        { label: "鏈嶅姟鎴鏃堕棿", prop: "end_time" }, // 鏈嶅姟鎴鏃堕棿
+        { label: "鍚堝悓閲戦", prop: "money" }, // 鍚堝悓閲戦
+        { label: "璐熻矗浜�", prop: "member_name" } // 璐熻矗浜�
+        // { label: "瀹℃壒鐘舵��", prop: "approvalStatus" } // 瀹℃壒鐘舵��
+      ],
+      showCol:["鍗曟嵁缂栧彿", "瀹㈡埛鍚嶇О", "鏈嶅姟寮�濮嬫椂闂�", "鏈嶅姟鎴鏃堕棿", "鍚堝悓閲戦", "璐熻矗浜�"]
     }
   },
   created() {
@@ -147,23 +155,31 @@
   methods: {
     setTable() {
       this.tableList = {
+        selectIndex:true,
         tableInfomation: [],
-        tableColumn: [
-          { label: "鍗曟嵁缂栧彿", prop: "number", min: 100, isCommonClick: true }, // 鍗曟嵁缂栧彿
-          { label: "瀹㈡埛鍚嶇О", prop: "client_name", min: 120, isClientClick: true }, // 瀹㈡埛鍚嶇О
-          { label: "鏈嶅姟寮�濮嬫椂闂�", prop: "start_time" }, // 鏈嶅姟寮�濮嬫椂闂�
-          { label: "鏈嶅姟鎴鏃堕棿", prop: "end_time" }, // 鏈嶅姟鎴鏃堕棿
-          { label: "鍚堝悓閲戦", prop: "money" }, // 鍚堝悓閲戦
-          { label: "璐熻矗浜�", prop: "member_name" } // 璐熻矗浜�
-          // { label: "瀹℃壒鐘舵��", prop: "approvalStatus" } // 瀹℃壒鐘舵��
-        ]
+        allcol: [],
+        showcol: this.showCol,
+        tableColumn:this.setColumnVisible(this.showCol)
       }
+      this.tableList.allcol = this.tableList.tableColumn.filter(ele=>!ele.default).map(ele=>ele.label);
       this.searchOptions = []
       for (let i = 0; i < this.tableList.tableColumn.length; i++) {
         const label = this.tableList.tableColumn[i].label
         const value = this.tableList.tableColumn[i].prop
         this.searchOptions.push({ value: value, label: label })
       }
+    },
+    setColumnVisible(showCol){
+      return  this.tableColumn.map(ele=>{
+        return {
+          ...ele,
+          isShowColumn:showCol.includes(ele.label)
+        }
+      })
+    },
+    selTableCol(val) {
+      this.showcol = val;
+      this.tableList.tableColumn = this.setColumnVisible(val);
     },
     // 璇锋眰鏁版嵁
     async getData() {
@@ -225,7 +241,7 @@
       this.editConfig.title = "缂栬緫"
       this.editConfig.infomation = { ...row }
     },
-    // 鍒犻櫎
+    // 鎵归噺鍒犻櫎
     delClick() {
       if (this.selValueList && this.selValueList.length > 0) {
         this.$confirm("鏄惁纭鍒犻櫎?", "璀﹀憡", {
@@ -247,6 +263,33 @@
       } else {
         this.$message.warning("璇疯嚦灏戦�夋嫨涓�鏉¤褰�")
       }
+    },
+    /**
+     * 鍗曚釜鍒犻櫎
+     * @param id 閿�鍞�诲崟id
+     */
+    deleteItem(id) {
+      this.$confirm("鏄惁纭鍒犻櫎?", "璀﹀憡", {
+        confirmButtonText: "纭畾",
+        cancelButtonText: "鍙栨秷",
+        type: "warning"
+      })
+          .then(() => {
+            getDelMasterOrder({ids: [id]}).then((response) => {
+              if (response.code === 200) {
+                this.$message.success("鍒犻櫎鎴愬姛")
+                this.getData()
+              } else {
+                this.$message.warning("鍒犻櫎澶辫触")
+              }
+            })
+          })
+          .catch((err) => {
+            if (err !== 'cancel') {
+              console.error(err)
+              this.$message.warning("鍒犻櫎澶辫触")
+            }
+          })
     },
     getSelectArray(val) {
       console.log(val)
@@ -309,15 +352,6 @@
       border-radius: 12px;
       height: 100%;
       overflow: hidden;
-    }
-
-    .supplier-search {
-      display: flex;
-      align-items: center;
-      .add-view {
-        margin-left: auto;
-        margin-right: 20px;
-      }
     }
     .list-view {
       height: calc(100% - 60px);

--
Gitblit v1.8.0