From 8380b537474be9b9aa24efcd65c730e2907b9b8b Mon Sep 17 00:00:00 2001
From: yangfeng <wanwan926_4@163.com>
Date: 星期六, 26 八月 2023 18:07:48 +0800
Subject: [PATCH] 服务商相关接口联调

---
 src/api/supplierManage/supplier.js                       |   15 +
 src/views/supplierManage/supplier/index.vue              |  117 +++++++-------
 src/components/makepager/TableCommonView.vue             |    7 
 src/views/productManage/product/index.vue                |   26 +-
 src/api/purchaseManage/purchase.js                       |  100 ------------
 src/views/supplierManage/supplier/AddNewProduct.vue      |   47 ++---
 src/views/supplierManage/supplier/AddSupplier.vue        |   25 ++
 src/components/makepager/CommonFormTableView.vue         |   28 +-
 src/views/other/commonDialog/EditDropdownDialog.vue      |   37 +++
 src/views/other/commonDialog/SelectCommonDialog.vue      |   10 
 src/views/supplierManage/supplier/RaleteSupplierList.vue |   34 +++
 11 files changed, 215 insertions(+), 231 deletions(-)

diff --git a/src/api/purchaseManage/purchase.js b/src/api/purchaseManage/purchase.js
index cefa894..60da679 100644
--- a/src/api/purchaseManage/purchase.js
+++ b/src/api/purchaseManage/purchase.js
@@ -1,99 +1 @@
-import request from "@/common/untils/request.js"
-
-// 閿�鍞嚎绱㈠垪琛�
-export function getSalesLeadsList(data) {
-  return request({
-    url: "/api/salesLeads/list",
-    method: "post",
-    data
-  })
-}
-// 娣诲姞閿�鍞嚎绱�
-export function getAddSalesLeads(data) {
-  return request({
-    url: "/api/salesLeads/add",
-    method: "post",
-    data
-  })
-}
-// 鍒犻櫎閿�鍞嚎绱�
-export function getDeleteSalesLeads(data) {
-  return request({
-    url: "/api/salesLeads/delete",
-    method: "delete",
-    data
-  })
-}
-// 鏇存柊閿�鍞嚎绱�
-export function getUpdateSalesLeads(data) {
-  return request({
-    url: "/api/salesLeads/update",
-    method: "put",
-    data
-  })
-}
-
-// 鎺ㄨ繘閿�鍞嚎绱�
-export function pushSalesSources(data) {
-  return request({
-    url: "/api/salesLeads/push",
-    method: "post",
-    data
-  })
-}
-
-// 鍟嗘満鏉ユ簮鍒楄〃
-export function getSalesSourcesList() {
-  return request({
-    url: "/api/salesSources/list",
-    method: "get"
-  })
-}
-// 娣诲姞鎶ヤ环鍗�
-export function getAddQuotation(data) {
-  return request({
-    url: "/api/quotation/add",
-    method: "post",
-    data
-  })
-}
-// 鏇存柊鎶ヤ环鍗�
-export function getUpdateQuotation(data) {
-  return request({
-    url: "/api/quotation/update",
-    method: "put",
-    data
-  })
-}
-// 鑾峰彇瀹㈡埛鏉ユ簮绛夋墍鏈夋暟鎹�
-export function getAllData() {
-  return request({
-    url: "/api/data/getAllData",
-    method: "get"
-  })
-}
-// 瀹㈡埛绠$悊鍒楄〃
-export function getClientList(data) {
-  return request({
-    url: "/api/client/list",
-    method: "post",
-    data
-  })
-}
-// ----bom --- 瑷堥噺鍠綅 鐨勬暩鎿� 
-export function postGetUnitDictList(data) {
-  return request({
-    url: "/api-s/v1/dict/getUnitDictList",
-    method: "post",
-    data
-  })
-}
-
-// ----bom --- 瑷堥噺鍠綅 鐨勬暩鎿�  鏇存柊 
-export function postGetSaveSUnitDict(data) {
-  return request({
-    url: "/api-s/v1/dict/saveUnitDict",
-    method: "post",
-    data
-  })
-}
\ No newline at end of file
+// import request from "@/common/untils/request.js"
diff --git a/src/api/supplierManage/supplier.js b/src/api/supplierManage/supplier.js
index 0f556e1..f9e0b2d 100644
--- a/src/api/supplierManage/supplier.js
+++ b/src/api/supplierManage/supplier.js
@@ -76,4 +76,17 @@
   })
 }
 
-//
+// 鏇存柊鎵�灞炶涓�
+export function updateIndustry(data) {
+  return request({
+    url: "/api/i/updateIndustry",
+    method: "put",
+    data
+  })
+}
+// 鎵�灞炶涓氬垪琛�
+export const getIndustryList = async (data) => {
+  return await axios.get(`/api/i/getIndustryList`, {
+    params: data
+  })
+}
diff --git a/src/components/makepager/CommonFormTableView.vue b/src/components/makepager/CommonFormTableView.vue
index 951409e..a42b2e6 100644
--- a/src/components/makepager/CommonFormTableView.vue
+++ b/src/components/makepager/CommonFormTableView.vue
@@ -124,7 +124,12 @@
       <el-button size="small" type="primary" @click="add">鏂板</el-button>
       <el-button size="small" type="primary" @click="empty">娓呯┖</el-button>
 
-      <el-button size="small" v-if="recalculateShow" type="primary" @click="recalculate" :disabled="isRecalculate ? false : true"
+      <el-button
+        size="small"
+        v-if="recalculateShow"
+        type="primary"
+        @click="recalculate"
+        :disabled="isRecalculate ? false : true"
         >閲嶇畻</el-button
       >
     </div>
@@ -138,7 +143,7 @@
 </template>
 
 <script>
-import { getProductList } from "@/api/common/other"
+import { getProductList } from "@/api/productManage/product"
 import SelectCommonDialog from "@/views/other/commonDialog/SelectCommonDialog"
 export default {
   name: "CommmonFormTableView",
@@ -168,16 +173,15 @@
           total: false,
           refundable: false,
           sumProp: [],
-          titleProp:["#", "浜у搧鍚嶇О"],
+          titleProp: ["#", "浜у搧鍚嶇О"],
           mergeNumber: 1
         }
       }
     },
-    recalculateShow:{
-      type:[Boolean],
-      defalut:true,
-    },
-    
+    recalculateShow: {
+      type: [Boolean],
+      defalut: true
+    }
   },
   data() {
     return {
@@ -207,15 +211,13 @@
     // 浜у搧鍚嶇О
     async getProductList() {
       await getProductList({
-        productName: "",
-        productNumber: "",
         page: 1,
-        pageSize: 5
+        pageSize: 100
       }).then((res) => {
         console.log(res.data)
         if (res.data.code === 200) {
-          if (res.data.data.data && res.data.data.data.length > 0) {
-            this.productList = res.data.data.data
+          if (res.data.data.list && res.data.data.list.length > 0) {
+            this.productList = res.data.data.list
           }
         }
       })
diff --git a/src/components/makepager/TableCommonView.vue b/src/components/makepager/TableCommonView.vue
index 0adba05..f5d34c5 100644
--- a/src/components/makepager/TableCommonView.vue
+++ b/src/components/makepager/TableCommonView.vue
@@ -11,6 +11,8 @@
       :summary-method="getSummaries"
       :span-method="arraySpanMethod"
       @selection-change="handleSelectionChange"
+      highlight-current-row
+      @row-click="tableRowClick"
       :header-cell-style="{ background: '#ECF4FF', color: '#666' }"
     >
       <el-table-column v-if="tableList.selectBox" type="selection" width="40"> </el-table-column>
@@ -128,7 +130,12 @@
     return {}
   },
   computed: {},
+  mounted() {},
   methods: {
+    tableRowClick(row) {
+      console.log(row)
+      this.$emit("tableRowClick", row)
+    },
     handleReserve(row) {
       return row._id ? row._id : row.id
     },
diff --git a/src/views/other/commonDialog/EditDropdownDialog.vue b/src/views/other/commonDialog/EditDropdownDialog.vue
index 4691fa8..61713a6 100644
--- a/src/views/other/commonDialog/EditDropdownDialog.vue
+++ b/src/views/other/commonDialog/EditDropdownDialog.vue
@@ -55,7 +55,7 @@
 </template>
 
 <script>
-import { getSupplierTypeList, updateSupplierType } from "@/api/supplierManage/supplier"
+import { getSupplierTypeList, updateSupplierType, updateIndustry, getIndustryList } from "@/api/supplierManage/supplier"
 export default {
   name: "EditDropdownDialog",
   props: {
@@ -90,6 +90,8 @@
     setList() {
       if (this.editConfig.title === "渚涘簲鍟嗙被鍨�") {
         this.getSupplierTypeList()
+      } else if (this.editConfig.title === "鎵�灞炶涓�") {
+        this.getIndustryList()
       }
     },
     // 渚涘簲鍟嗙被鍨�
@@ -98,13 +100,20 @@
         page: 1,
         pageSize: 100
       }).then((res) => {
-        console.log("dsss")
         console.log(res.data)
         this.tableData = res.data.data.list
       })
     },
     // 鎵�灞炶涓�
-    async getIndustryList() {},
+    async getIndustryList() {
+      await getIndustryList({
+        page: 1,
+        pageSize: 100
+      }).then((res) => {
+        console.log(res.data)
+        this.tableData = res.data.data.list
+      })
+    },
     handleClose() {
       this.editConfig.editVisible = false
     },
@@ -151,12 +160,16 @@
     // 鏂板涓嬫媺妗�
     addDropdown() {
       this.tableData.push({
-        name: "",
-        id: 0
+        ID: 0,
+        name: ""
       })
     },
     async saveClick() {
       console.log(this.tableData)
+      this.tableData.map((ite) => {
+        ite.ID = 0
+        return { ...ite }
+      })
       if (this.editConfig.title === "渚涘簲鍟嗙被鍨�") {
         updateSupplierType({
           supplierTypes: this.tableData
@@ -164,7 +177,19 @@
           console.log(res)
           if (res.code === 200) {
             this.$message.success("缂栬緫鎴愬姛")
-            this.$parent.getData()
+            this.$parent.getSupplierTypeList()
+            this.handleClose()
+          }
+        })
+      } else if (this.editConfig.title === "鎵�灞炶涓�") {
+        updateIndustry({
+          industries: this.tableData
+        }).then((res) => {
+          console.log(res)
+          if (res.code === 200) {
+            this.$message.success("缂栬緫鎴愬姛")
+            this.$parent.getIndustryList()
+            this.handleClose()
           }
         })
       }
diff --git a/src/views/other/commonDialog/SelectCommonDialog.vue b/src/views/other/commonDialog/SelectCommonDialog.vue
index 34cde2a..f5597b4 100644
--- a/src/views/other/commonDialog/SelectCommonDialog.vue
+++ b/src/views/other/commonDialog/SelectCommonDialog.vue
@@ -39,7 +39,7 @@
 </template>
 
 <script>
-import { getProductList } from "@/api/common/other"
+import { getProductList } from "@/api/productManage/product"
 export default {
   name: "EditSelCommonDialog",
   props: {
@@ -106,15 +106,13 @@
     // 浜у搧鍚嶇О
     async getProductList() {
       await getProductList({
-        productName: this.keywordType === "浜у搧鍚嶇О" ? this.keyword : "",
-        productNumber: this.keywordType === "浜у搧缂栧彿" ? this.keyword : "",
         page: 1,
-        pageSize: 5
+        pageSize: 100
       }).then((res) => {
         console.log(res.data)
         if (res.data.code === 200) {
-          if (res.data.data.data && res.data.data.data.length > 0) {
-            const list = res.data.data.data.map((item) => {
+          if (res.data.data.list && res.data.data.list.length > 0) {
+            const list = res.data.data.list.map((item) => {
               return {
                 ...item
               }
diff --git a/src/views/productManage/product/index.vue b/src/views/productManage/product/index.vue
index d797006..a904fb1 100644
--- a/src/views/productManage/product/index.vue
+++ b/src/views/productManage/product/index.vue
@@ -9,19 +9,19 @@
           @resetClick="resetClick"
         />
         <div class="add-view">
-          <el-button type="primary" size="mini" @click="addBtnClick">鏂板缓</el-button>
+          <!-- <el-button type="primary" size="mini" @click="addBtnClick">鏂板缓</el-button> -->
         </div>
       </div>
       <template>
         <TableCommonView ref="tableListRef" :table-list="tableList" @selCommonClick="selCommonClick">
-          <template slot="tableButton">
+          <!-- <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="delClick(scope.row.id)" type="text" size="small">鍒犻櫎</el-button>
               </template>
             </el-table-column>
-          </template>
+          </template> -->
         </TableCommonView>
         <div class="btn-pager">
           <PagerView class="page" :pager-options="pagerOptions" v-on="pagerEvents" />
@@ -75,14 +75,14 @@
         tableColumn: [
           { label: "浜у搧缂栫爜", prop: "number", min: 190, isCommonClick: true },
           { label: "浜у搧鍚嶇О", prop: "name", min: 130 },
-          { label: "渚涘簲鍟�", prop: "id", min: 130 },
+          { label: "渚涘簲鍟�", prop: "supplierNumber", min: 130 },
           { label: "浜у搧绫诲埆", prop: "productType", min: 130 },
-          { label: "瑙勬牸", prop: "sales_resources", min: 130 },
-          { label: "鍨嬪彿", prop: "province", min: 130 },
+          { label: "瑙勬牸", prop: "specifications", min: 130 },
+          { label: "鍨嬪彿", prop: "modelNumber", min: 130 },
           { label: "鍗曚綅", prop: "unit", min: 60 },
-          { label: "浠锋牸", prop: "contact_phone1", min: 130 },
-          { label: "鏈�浣庡簱瀛�", prop: "desc", min: 80 },
-          { label: "鏈�楂樺簱瀛�", prop: "member_name", min: 80 }
+          { label: "浠锋牸", prop: "purchasePrice", min: 130 },
+          { label: "鏈�浣庡簱瀛�", prop: "minimumStock", min: 80 },
+          { label: "鏈�楂樺簱瀛�", prop: "maximumStock", min: 80 }
         ]
       }
       this.searchOptions = []
@@ -95,15 +95,15 @@
     // 璇锋眰鏁版嵁
     async getData(val, content) {
       await getProductList({
-        val,
-        content,
+        [val]: content,
         page: this.pagerOptions.currPage,
         pageSize: this.pagerOptions.pageSize
       }).then((res) => {
         if (res.data.code === 200) {
           const list = res.data.data.list.map((item) => {
             return {
-              ...item
+              ...item,
+              supplierNumber: item.supplier.number
             }
           })
           this.tableList.tableInfomation = list || []
@@ -114,7 +114,7 @@
     // 鎼滅储
     searchClick(val, content) {
       console.log(val, content)
-      this.getData(val, content)
+      this.getData(val.value, content)
     },
     resetClick() {
       this.getData()
diff --git a/src/views/supplierManage/supplier/AddNewProduct.vue b/src/views/supplierManage/supplier/AddNewProduct.vue
index f1d305e..b9a1812 100644
--- a/src/views/supplierManage/supplier/AddNewProduct.vue
+++ b/src/views/supplierManage/supplier/AddNewProduct.vue
@@ -31,7 +31,7 @@
 </template>
 
 <script>
-// import { getAddContact, getUpdateContact } from "@/api/client/contacts"
+// import { createProduct, updateProduct } from "@/api/productManage/product"
 import CommonFormTableView from "@/components/makepager/CommonFormTableView"
 export default {
   name: "AddNewProduct",
@@ -75,7 +75,7 @@
       const params = this.saveParams()
       console.log(params)
       if (this.editConfig.title === "娣诲姞") {
-        // getAddContact(params).then((res) => {
+        // createProduct(params).then((res) => {
         //   console.log(res)
         //   this.editConfig.visible = false
         //   if (res.code === 200) {
@@ -84,7 +84,7 @@
         //   }
         // })
       } else {
-        // getUpdateContact(params).then((res) => {
+        // updateProduct(params).then((res) => {
         //   console.log(res)
         //   this.editConfig.visible = false
         //   if (res.code === 200) {
@@ -95,24 +95,21 @@
       }
     },
     saveParams() {
-      let data = this.editConfig.infomation
+      // let data = this.editConfig.infomation
       let params = {
-        id: this.editConfig.title === "娣诲姞" ? 0 : data.id,
-        birthday: data.birthday || "",
-        city_id: data.city_id || 0,
-        client_id: this.clientId || 0,
-        country_id: data.country_id || 0,
-        desc: data.desc || "",
-        email: data.email || "",
-        is_first: data.is_first || false,
-        member_id: data.member_id || 0,
-        name: data.name || "",
-        number: data.number || "",
-        phone: data.phone || "",
-        position: data.position || "",
-        province_id: data.province_id || 0,
-        region_id: data.region_id || 0,
-        wechat: data.wechat || ""
+        deliveryTime: 0,
+        id: 0,
+        maximumStock: 0,
+        minimumStock: 0,
+        name: "string",
+        number: "string",
+        productType: "string",
+        purchasePrice: 0,
+        remark: "string",
+        shippingDuration: 0,
+        specifications: "string",
+        supplierId: 0,
+        unit: "string"
       }
       return params
     },
@@ -141,11 +138,11 @@
         tableColumn: [
           { label: "浜у搧鍚嶇О", prop: "name", productName: true, isRequird: true },
           { label: "浜у搧缂栫爜", prop: "number" },
-          { label: "璁¢噺鍗曚綅", prop: "number" },
-          { label: "瑙勬牸鍨嬪彿", prop: "number" },
-          { label: "閲囪喘浠锋牸", prop: "amount", inputFloat: true, isRequird: true },
-          { label: "渚涜揣鏃堕暱", prop: "price", inputNumber: true, isRequird: true },
-          { label: "鐗╂祦鏃堕暱", prop: "total", inputNumber: true, isRequird: true }
+          { label: "璁¢噺鍗曚綅", prop: "unit" },
+          { label: "瑙勬牸鍨嬪彿", prop: "specifications" },
+          { label: "閲囪喘浠锋牸", prop: "purchasePrice", inputFloat: true, isRequird: true },
+          { label: "渚涜揣鏃堕暱", prop: "deliveryTime", inputNumber: true, isRequird: true },
+          { label: "鐗╂祦鏃堕暱", prop: "shippingDuration", inputNumber: true, isRequird: true }
         ]
       }
     },
diff --git a/src/views/supplierManage/supplier/AddSupplier.vue b/src/views/supplierManage/supplier/AddSupplier.vue
index c313db1..415c271 100644
--- a/src/views/supplierManage/supplier/AddSupplier.vue
+++ b/src/views/supplierManage/supplier/AddSupplier.vue
@@ -43,8 +43,8 @@
                       size="mini"
                     >
                       <el-option
-                        v-for="item in supplierTypeOptions"
-                        :key="item.id"
+                        v-for="(item, index) in supplierTypeOptions"
+                        :key="index"
                         :label="item.name"
                         :value="item.name"
                       >
@@ -63,7 +63,12 @@
                       class="common-select-sel"
                       size="mini"
                     >
-                      <el-option v-for="item in industryOptions" :key="item.id" :label="item.name" :value="item.name">
+                      <el-option
+                        v-for="(item, index) in industryOptions"
+                        :key="index"
+                        :label="item.name"
+                        :value="item.name"
+                      >
                       </el-option>
                     </el-select>
                     <div class="common-select-btn" @click="setIndustry"><i class="el-icon-setting"></i></div>
@@ -193,7 +198,7 @@
 </template>
 
 <script>
-import { createSupplier, createContract, updateSupplier } from "@/api/supplierManage/supplier"
+import { createSupplier, createContract, updateSupplier, getIndustryList } from "@/api/supplierManage/supplier"
 import EditDropdownDialog from "@/views/other/commonDialog/EditDropdownDialog"
 import { getSupplierTypeList } from "@/api/supplierManage/supplier"
 export default {
@@ -252,6 +257,7 @@
   },
   created() {
     this.getSupplierTypeList()
+    this.getIndustryList()
   },
   methods: {
     // 渚涘簲鍟嗙被鍨�
@@ -260,11 +266,18 @@
         page: 1,
         pageSize: 100
       }).then((res) => {
-        console.log("dsss")
-        console.log(res.data)
         this.supplierTypeOptions = res.data.data.list
       })
     },
+    // 鎵�灞炶涓�
+    async getIndustryList() {
+      await getIndustryList({
+        page: 1,
+        pageSize: 100
+      }).then((res) => {
+        this.industryOptions = res.data.data.list
+      })
+    },
     handleClose() {
       this.editConfig.visible = false
     },
diff --git a/src/views/supplierManage/supplier/RaleteSupplierList.vue b/src/views/supplierManage/supplier/RaleteSupplierList.vue
index c3755a2..a5ced7b 100644
--- a/src/views/supplierManage/supplier/RaleteSupplierList.vue
+++ b/src/views/supplierManage/supplier/RaleteSupplierList.vue
@@ -21,7 +21,7 @@
 </template>
 
 <script>
-// import SelectClientDialog from "@/views/other/commonDialog/SelectClientDialog"
+import { getProductList } from "@/api/productManage/product"
 import pageMixin from "@/components/makepager/pager/mixin/pageMixin"
 export default {
   name: "AddSupplierDialog",
@@ -48,6 +48,7 @@
   },
   created() {
     this.setTable()
+    this.getProductList()
   },
   methods: {
     setTable() {
@@ -55,14 +56,35 @@
         tableInfomation: [],
         selectIndex: true,
         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: "supplierNumber", min: 190, isCommonClick: true },
+          { label: "渚涘簲鍟嗗悕绉�", prop: "supplierName", min: 130 },
+          { label: "閲囪喘浠锋牸", prop: "purchasePrice", min: 130 },
+          { label: "渚涜揣澶╂暟", prop: "deliveryTime", min: 130 },
+          { label: "鐗╂祦鏃堕暱(澶�)", prop: "shippingDuration", min: 130 }
         ]
       }
     },
+    // 浜у搧鍒楄〃
+    async getProductList(val, content) {
+      console.log(val, content)
+      await getProductList({
+        number: this.editConfig.infomation.number,
+        supplierId: this.editConfig.infomation.supplierId,
+        page: this.pagerOptions.currPage,
+        pageSize: this.pagerOptions.pageSize
+      }).then((res) => {
+        console.log(res.data)
+        const list = res.data.data.list.map((item) => {
+          return {
+            ...item,
+            supplierNumber: item.supplier.number,
+            supplierName: item.supplier.name
+          }
+        })
+        this.tableList.tableInfomation = list || []
+        this.tableList.totalCount = res.data.data.total
+      })
+    },
     handleClose() {
       this.editConfig.visible = false
     },
diff --git a/src/views/supplierManage/supplier/index.vue b/src/views/supplierManage/supplier/index.vue
index 00e1117..1d45a91 100644
--- a/src/views/supplierManage/supplier/index.vue
+++ b/src/views/supplierManage/supplier/index.vue
@@ -17,7 +17,7 @@
           ref="tableListRef"
           :table-list="tableList"
           @selCommonClick="selCommonClick"
-          @getSelectArray="getSelectArray"
+          @tableRowClick="tableRowClick"
         >
           <template slot="tableButton">
             <el-table-column label="鎿嶄綔" width="120">
@@ -31,7 +31,6 @@
                 >
                 <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>
             </el-table-column>
           </template>
@@ -60,7 +59,7 @@
       </div>
       <template>
         <TableCommonView
-          ref="tableListRef"
+          ref="tableListProduct"
           :table-list="productTableList"
           @selCommonClick="selCommonClick"
           @getSelectArray="getSelectArray"
@@ -71,7 +70,6 @@
                 <el-button @click="raleteClick(scope.row)" type="text" size="small">鐩稿叧渚涘簲鍟�</el-button>
                 <el-button @click="editClick(scope.row)" type="text" size="small">淇敼</el-button>
                 <el-button @click="delClick(scope.row)" type="text" size="small">鍒犻櫎</el-button>
-                <!-- <el-button @click="delClick(scope.row.id)" type="text" size="small">鍒犻櫎</el-button> -->
               </template>
             </el-table-column>
           </template>
@@ -99,6 +97,7 @@
 import AddSupplier from "@/views/supplierManage/supplier/AddSupplier"
 import RaleteSupplierList from "@/views/supplierManage/supplier/RaleteSupplierList"
 import AddNewProduct from "@/views/supplierManage/supplier/AddNewProduct"
+import { getProductList, deleteProduct } from "@/api/productManage/product"
 
 export default {
   name: "SupplierManage",
@@ -135,7 +134,8 @@
         currPage: 1,
         pageSize: 10,
         totalCount: 0
-      }
+      },
+      supplierId: 0
     }
   },
   created() {
@@ -148,6 +148,7 @@
       this.tableList = {
         tableInfomation: [],
         selectIndex: true,
+        ref: "tableListRef",
         tableColumn: [
           { label: "渚涘簲鍟嗙紪鍙�", prop: "number", min: 190, isCommonClick: true },
           { label: "渚涘簲鍟嗗悕绉�", prop: "name", min: 130 },
@@ -168,21 +169,17 @@
     },
     setProductTable() {
       this.productTableList = {
-        tableInfomation: [
-          {
-            number: "aaaaa"
-          }
-        ],
+        tableInfomation: [],
         selectBox: true,
         selectIndex: true,
         tableColumn: [
           { label: "浜у搧缂栫爜", prop: "number", min: 190 },
           { 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: "specifications", min: 130 },
+          { label: "鍗曚綅", prop: "unit", min: 130 },
+          { label: "閲囪喘浠锋牸", prop: "purchasePrice", min: 130 },
+          { label: "渚涜揣鏃堕暱(澶�)", prop: "deliveryTime", min: 130 },
+          { label: "鐗╂祦鏃堕暱(澶�)", prop: "shippingDuration", min: 130 }
         ]
       }
       this.searchProductOptions = []
@@ -193,15 +190,8 @@
       }
     },
     // 璇锋眰鏁版嵁
-    async getData(val, content, searchName) {
-      if (searchName === "渚涘簲鍟�") {
-        this.getSupplierList(val, content)
-      } else if (searchName === "浜у搧") {
-        this.getProductList(val, content)
-      } else {
-        this.getSupplierList()
-        this.getProductList()
-      }
+    async getData(val, content) {
+      this.getSupplierList(val, content)
     },
     // 渚涘簲鍟嗗垪琛�
     async getSupplierList(val, content) {
@@ -220,35 +210,49 @@
           })
           this.tableList.tableInfomation = list || []
           this.pagerOptions.totalCount = res.data.data.total
+          if (list && list.length > 0) {
+            this.supplierId = this.tableList.tableInfomation[0].ID
+          } else {
+            this.supplierId = 0
+          }
+          this.getProductList()
         }
       })
     },
     // 浜у搧鍒楄〃
     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)
-      // })
+      await getProductList({
+        [val]: content,
+        supplierId: this.supplierId,
+        page: this.productPagerOptions.currPage,
+        pageSize: this.productPagerOptions.pageSize
+      }).then((res) => {
+        console.log(res.data)
+        const list = res.data.data.list.map((item) => {
+          return {
+            ...item
+          }
+        })
+        this.productTableList.tableInfomation = list || []
+        this.productPagerOptions.totalCount = res.data.data.total
+      })
     },
     // 鎼滅储渚涘簲鍟�
     searchClick(val, content) {
       console.log(val, content)
-      this.getData(val.value, content, "渚涘簲鍟�")
+      this.getSupplierList(val.value, content)
     },
     resetClick() {
-      this.getData("", "", "渚涘簲鍟�")
+      this.getSupplierList()
     },
     // 鎼滅储浜у搧
     searchProductClick(val, content) {
       console.log(val, content)
-      this.getData(val.value, content, "浜у搧")
+      this.getProductList(val.value, content)
     },
     resetProductClick() {
-      this.getData("", "", "浜у搧")
+      this.getProductList()
     },
     // 鏂板缓渚涘簲鍟�
     addBtnClick() {
@@ -293,28 +297,24 @@
       // this.newProductConfig.title = "淇敼"
     },
     // 鍒犻櫎
-    delClick() {
-      if (this.selValueList && this.selValueList.length > 0) {
-        this.$confirm("鏄惁纭鍒犻櫎?", "璀﹀憡", {
-          confirmButtonText: "纭畾",
-          cancelButtonText: "鍙栨秷",
-          type: "warning"
-        })
-          .then(() => {
-            console.log("dddd")
-            // deleteSupplier({ id: this.selValueList }).then((response) => {
-            //   if (response.code === 200) {
-            //     this.$message.success("鍒犻櫎鎴愬姛")
-            //     this.getData()
-            //   } else {
-            //     this.$message.warning("鍒犻櫎澶辫触")
-            //   }
-            // })
+    delClick(row) {
+      this.$confirm("鏄惁纭鍒犻櫎?", "璀﹀憡", {
+        confirmButtonText: "纭畾",
+        cancelButtonText: "鍙栨秷",
+        type: "warning"
+      })
+        .then(() => {
+          console.log("dddd")
+          deleteProduct({ id: row.ID }).then((response) => {
+            if (response.code === 200) {
+              this.$message.success("鍒犻櫎鎴愬姛")
+              this.getProductList()
+            } else {
+              this.$message.warning("鍒犻櫎澶辫触")
+            }
           })
-          .catch(() => {})
-      } else {
-        this.$message.warning("璇疯嚦灏戦�夋嫨涓�鏉¤褰�")
-      }
+        })
+        .catch(() => {})
     },
     getSelectArray(val) {
       console.log(val)
@@ -324,6 +324,11 @@
       })
       this.selValueList = list
     },
+    tableRowClick(row) {
+      console.log(row)
+      this.supplierId = row.ID
+      this.getProductList()
+    },
     // 璇︽儏
     selCommonClick(row) {
       console.log(row)

--
Gitblit v1.8.0