From 7da8d51d212f96b2d419d4f22617827ea4df9e3d Mon Sep 17 00:00:00 2001
From: yangfeng <wanwan926_4@163.com>
Date: 星期六, 26 八月 2023 15:28:26 +0800
Subject: [PATCH] 服务商列表联调及无用api删除

---
 src/views/supplierManage/supplier/index.vue |  132 +++++++++++++++++++++++++++++---------------
 1 files changed, 87 insertions(+), 45 deletions(-)

diff --git a/src/views/supplierManage/supplier/index.vue b/src/views/supplierManage/supplier/index.vue
index 354b34f..00e1117 100644
--- a/src/views/supplierManage/supplier/index.vue
+++ b/src/views/supplierManage/supplier/index.vue
@@ -22,8 +22,14 @@
           <template slot="tableButton">
             <el-table-column label="鎿嶄綔" width="120">
               <template slot-scope="scope">
-                <el-button @click="handleClick(scope.row)" type="text" size="small">鍚敤</el-button>
-                <el-button @click="editClick(scope.row)" type="text" size="small">鍋滅敤</el-button>
+                <el-button
+                  v-if="scope.row.status === 0"
+                  @click="enableClick(scope.row, '鍚敤')"
+                  type="text"
+                  size="small"
+                  >鍚敤</el-button
+                >
+                <el-button v-else @click="enableClick(scope.row, '鍋滅敤')" type="text" size="small">鍋滅敤</el-button>
                 <el-button @click="modifyClick(scope.row)" type="text" size="small">淇敼</el-button>
                 <!-- <el-button @click="delClick(scope.row.id)" type="text" size="small">鍒犻櫎</el-button> -->
               </template>
@@ -45,8 +51,8 @@
           class="search"
           ref="searchCommonView"
           :search-options="searchProductOptions"
-          @searchClick="searchClick"
-          @resetClick="resetClick"
+          @searchClick="searchProductClick"
+          @resetClick="resetProductClick"
         />
         <div class="add-view">
           <el-button type="primary" size="mini" @click="addNewProductClick">娣诲姞鏂颁骇鍝�</el-button>
@@ -71,7 +77,7 @@
           </template>
         </TableCommonView>
         <div class="btn-pager">
-          <PagerView class="page" :pager-options="pagerOptions" v-on="pagerEvents" />
+          <PagerView class="page" :pager-options="productPagerOptions" v-on="pagerEvents" />
         </div>
       </template>
     </div>
@@ -88,7 +94,7 @@
 
 <script>
 import pageMixin from "@/components/makepager/pager/mixin/pageMixin"
-import { getSalesLeadsList, getDeleteSalesLeads } from "@/api/client/salesLead"
+import { getSupplierList, changeSupplierStatus } from "@/api/supplierManage/supplier"
 import DetailSupplier from "@/views/supplierManage/supplier/DetailSupplier"
 import AddSupplier from "@/views/supplierManage/supplier/AddSupplier"
 import RaleteSupplierList from "@/views/supplierManage/supplier/RaleteSupplierList"
@@ -125,7 +131,11 @@
         title: "娣诲姞",
         infomation: {}
       },
-      search_map: {}
+      productPagerOptions: {
+        currPage: 1,
+        pageSize: 10,
+        totalCount: 0
+      }
     }
   },
   created() {
@@ -141,11 +151,11 @@
         tableColumn: [
           { label: "渚涘簲鍟嗙紪鍙�", prop: "number", min: 190, isCommonClick: true },
           { label: "渚涘簲鍟嗗悕绉�", prop: "name", min: 130 },
-          { label: "渚涘簲鍟嗙被鍨�", prop: "contact_name", min: 130 },
-          { label: "鎵�灞炶涓�", prop: "contact_phone", min: 130 },
-          { label: "鑱旂郴浜�", prop: "sales_resources", min: 130 },
-          { label: "鑱旂郴鐢佃瘽", prop: "province", min: 130 },
-          { label: "鐘舵��", prop: "city", min: 130 },
+          { label: "渚涘簲鍟嗙被鍨�", prop: "supplierType", min: 130 },
+          { label: "鎵�灞炶涓�", prop: "industry", min: 130 },
+          { label: "鑱旂郴浜�", prop: "contact", min: 130 },
+          { label: "鑱旂郴鐢佃瘽", prop: "phone", min: 130 },
+          { label: "鐘舵��", prop: "status_name", min: 130 },
           { label: "鍒涘缓鏃堕棿", prop: "member_name", min: 130 }
         ]
       }
@@ -183,49 +193,80 @@
       }
     },
     // 璇锋眰鏁版嵁
-    async getData() {
-      await getSalesLeadsList({
-        search_map: this.search_map,
+    async getData(val, content, searchName) {
+      if (searchName === "渚涘簲鍟�") {
+        this.getSupplierList(val, content)
+      } else if (searchName === "浜у搧") {
+        this.getProductList(val, content)
+      } else {
+        this.getSupplierList()
+        this.getProductList()
+      }
+    },
+    // 渚涘簲鍟嗗垪琛�
+    async getSupplierList(val, content) {
+      await getSupplierList({
+        [val]: content,
         page: this.pagerOptions.currPage,
         pageSize: this.pagerOptions.pageSize
-      })
-        .then((res) => {
-          const list = res.data.list.map((item) => {
+      }).then((res) => {
+        console.log(res.data)
+        if (res.data.code === 200) {
+          const list = res.data.data.list.map((item) => {
             return {
               ...item,
-              province: item.Province.name,
-              city: item.City.name,
-              sales_resources: item.sales_sources.name,
-              member_name: item.member.username
+              status_name: item.status === 0 ? "鏈惎鐢�" : "鍚敤"
             }
           })
           this.tableList.tableInfomation = list || []
-          this.pagerOptions.totalCount = res.data.count
-        })
-        .catch((err) => {
-          console.log(err)
-        })
+          this.pagerOptions.totalCount = res.data.data.total
+        }
+      })
     },
-    // 鎼滅储
+    // 浜у搧鍒楄〃
+    async getProductList(val, content) {
+      console.log(val, content)
+      // await getProductList({
+      //   [val]: content,
+      //   page: this.productPagerOptions.currPage,
+      //   pageSize: this.productPagerOptions.pageSize
+      // }).then((res) => {
+      //   console.log(res.data)
+      // })
+    },
+    // 鎼滅储渚涘簲鍟�
     searchClick(val, content) {
       console.log(val, content)
-      this.search_map = {
-        [val.value]: content
-      }
-      this.getData()
+      this.getData(val.value, content, "渚涘簲鍟�")
     },
     resetClick() {
-      this.search_map = {}
-      this.getData()
+      this.getData("", "", "渚涘簲鍟�")
+    },
+    // 鎼滅储浜у搧
+    searchProductClick(val, content) {
+      console.log(val, content)
+      this.getData(val.value, content, "浜у搧")
+    },
+    resetProductClick() {
+      this.getData("", "", "浜у搧")
     },
     // 鏂板缓渚涘簲鍟�
     addBtnClick() {
       this.editConfig.visible = true
       this.editConfig.title = "鏂板缓"
     },
-    // 缂栬緫渚涘簲鍟�
-    handleClick(row) {
-      console.log(row)
+    // 鍚敤渚涘簲鍟�
+    async enableClick(row, value) {
+      let status = value === "鍚敤" ? 1 : 0
+      await changeSupplierStatus({
+        id: row.ID,
+        status: status
+      }).then((res) => {
+        if (res.code === 200) {
+          this.$message.success("鐘舵�佷慨鏀规垚鍔�")
+          this.getData()
+        }
+      })
     },
     // 淇敼渚涘簲鍟�
     modifyClick(row) {
@@ -261,14 +302,14 @@
         })
           .then(() => {
             console.log("dddd")
-            getDeleteSalesLeads({ ids: this.selValueList }).then((response) => {
-              if (response.code === 200) {
-                this.$message.success("鍒犻櫎鎴愬姛")
-                this.getData()
-              } else {
-                this.$message.warning("鍒犻櫎澶辫触")
-              }
-            })
+            // deleteSupplier({ id: this.selValueList }).then((response) => {
+            //   if (response.code === 200) {
+            //     this.$message.success("鍒犻櫎鎴愬姛")
+            //     this.getData()
+            //   } else {
+            //     this.$message.warning("鍒犻櫎澶辫触")
+            //   }
+            // })
           })
           .catch(() => {})
       } else {
@@ -276,6 +317,7 @@
       }
     },
     getSelectArray(val) {
+      console.log(val)
       this.selValueList = []
       const list = val.map((item) => {
         return item.id

--
Gitblit v1.8.0