From 6365989d130a8f5e222687b7441aa19a8b5eb9d6 Mon Sep 17 00:00:00 2001
From: haoxuan <haoxuan>
Date: 星期一, 28 八月 2023 19:57:10 +0800
Subject: [PATCH] 采购单联调

---
 src/api/purchaseManage/purchase.js                                    |   98 ++++++++++
 vue.config.js                                                         |    2 
 src/views/purchaseManage/purchase/components/AddPurchase.vue          |  201 +++++++++------------
 src/views/purchaseManage/purchase/index.vue                           |   76 +++++--
 src/api/data.js                                                       |   26 ++
 src/views/purchaseManage/purchase/DetailSupplier.vue                  |   56 ++---
 src/views/purchaseManage/purchase/components/SelectSupplierDialog.vue |   52 ++---
 7 files changed, 305 insertions(+), 206 deletions(-)

diff --git a/src/api/data.js b/src/api/data.js
new file mode 100644
index 0000000..a885f6b
--- /dev/null
+++ b/src/api/data.js
@@ -0,0 +1,26 @@
+// 閲囪喘鐘舵��
+const purchaseStatus=[
+  {
+    name:'宸蹭笅鍗�',
+    id:1,
+  },
+  {
+    name:'鍒拌揣璐ㄦ',
+    id:2,
+  },
+  {
+    name:'宸插叆搴�',
+    id:3,
+  },
+  {
+    name:'宸插畬鎴�',
+    id:4,
+  },
+]
+
+
+export const getDataByType = type => {
+  if(type =='purchaseStatus'){
+    return purchaseStatus;
+  }
+}
diff --git a/src/api/purchaseManage/purchase.js b/src/api/purchaseManage/purchase.js
index 60da679..e5d6a67 100644
--- a/src/api/purchaseManage/purchase.js
+++ b/src/api/purchaseManage/purchase.js
@@ -1 +1,97 @@
-// import request from "@/common/untils/request.js"
+import request from "@/common/untils/request.js"
+import axios from "axios"
+// 閿�鍞嚎绱㈠垪琛�
+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 const getPurchaseList = async (data) => {
+    return await axios.get(`/api/purchase/purchaseList`, {
+      params: data
+    })
+  }
+// 鍒涘缓閲囪喘鍗�
+export function addPurchase(data) {
+    return request({
+      url: "/api/purchase/purchase",
+      method: "post",
+      data
+    })
+  }
+// 鏇存柊閲囪喘鍗�
+export function updatePurchase(data) {
+    return request({
+      url: "/api/purchase/purchase",
+      method: "put",
+      data
+    })
+  }
+//   鑾峰彇閲囪喘鍗曚俊鎭�
+export function getPurchaseInfo(data) {
+    return request({
+      url: "/api/purchase/purchase/"+data.id,
+      method: "get",
+      data
+    })
+  }
+  //  鍒犻櫎閲囪喘鍗曚俊鎭�
+export function deletePurchase(data) {
+    return request({
+      url: "/api/purchase/purchase/"+data.id,
+      method: "delete",
+      data
+    })
+  }
+//   鎻愪氦閲囪喘鍗�
+export function submitPurchase(data) {
+    return request({
+      url: "/api/purchase/submit/"+data.id,
+      method: "post",
+      data
+    })
+  }
diff --git a/src/views/purchaseManage/purchase/DetailSupplier.vue b/src/views/purchaseManage/purchase/DetailSupplier.vue
index c3f9e39..f57178d 100644
--- a/src/views/purchaseManage/purchase/DetailSupplier.vue
+++ b/src/views/purchaseManage/purchase/DetailSupplier.vue
@@ -152,7 +152,7 @@
 </template>
 
 <script>
-import { getDeleteSalesLeads } from "@/api/client/salesLead";
+import { deletePurchase } from "@/api/purchaseManage/purchase";
 export default {
   name: "DetailSupplier",
   props: {
@@ -177,7 +177,6 @@
       basicInfoList: [],
       isDynamicExpand: true, // 璐︽埛淇℃伅
       dynamicInfoList: [],
-      addConfig: {},
       record: "", // 鏈�鏂拌繘灞�
       noContactDays: 0,
       newContactDays: "",
@@ -193,13 +192,7 @@
   },
   created() {
     this.setData(this.detailConfig.infomation);
-    this.addConfig = {
-      id_name: "sales_leads_id",
-      id: this.detailConfig.infomation.id,
-      common_name: this.detailConfig.infomation.id,
-      sales_leads_name: this.detailConfig.infomation.name,
-      sales_leads_id: this.detailConfig.infomation.id,
-    };
+
   },
   mounted() {},
   computed: {},
@@ -214,10 +207,11 @@
         type: "warning",
       })
         .then(() => {
-          getDeleteSalesLeads({ ids: this.selValueList }).then((response) => {
+          deletePurchase({ id: this.commonDetail.infomation.ID }).then((response) => {
             if (response.code === 200) {
               this.$message.success("鍒犻櫎鎴愬姛");
-              this.getData();
+              this.detailConfig.visible=false;
+              this.$parent.getData();
             } else {
               this.$message.warning("鍒犻櫎澶辫触");
             }
@@ -227,16 +221,13 @@
     },
     setData(item) {
       if (item.FollowRecord && item.FollowRecord.length > 0) {
-        this.record = item.FollowRecord[0].record;
-        console.log(item.FollowRecord[0].follow_time);
-        let follow_time = item.FollowRecord[0].follow_time;
-        this.newContactDays = follow_time.substring(0, 10);
         this.noContactDays = this.getDiffDay(Date.now(), this.newContactDays);
       }
+      this.record =item.record?item.record:''
       this.formInfoList = [
         {
           str: "渚涘簲鍟嗗悕绉�",
-          value: "",
+          value: item.name,
         },
         {
           str: "鍚堣",
@@ -252,7 +243,7 @@
         },
         {
           str: "绛剧害鏃ユ湡",
-          value: "",
+          value:item.signingDate,
         },
         {
           str: "閲囪喘璐熻矗浜�",
@@ -282,15 +273,15 @@
         },
         {
           leftStr: "閲囪喘鑱旂郴浜�",
-          leftValue: item.contact_phone,
+          leftValue: item.contact,
           rightStr: "鑱旂郴鐢佃瘽",
-          rightValue: "18513375588",
+          rightValue:  item.phone,
         },
         {
           leftStr: "绛剧害鏃ユ湡",
-          leftValue: item.sales_resources,
+          leftValue: item.signingDate,
           rightStr: "浜や粯鏃ユ湡",
-          rightValue: item.member_name,
+          rightValue: item.deliveryDate,
         },
         {
           leftStr: "鍒拌揣浠撳簱",
@@ -320,22 +311,17 @@
         },
       ];
       this.tableList = {
-        tableInfomation: [
-            {
-            number:1,
-            total:1,
-          }
-        ],
+        tableInfomation: item.productList?item.productList:[],
         selectIndex: true,
         tableColumn: [
-          { label: "浜у搧鍚嶇О", prop: "number", min: 190, isCommonClick: true },
-          { label: "浜у搧缂栫爜", prop: "total", min: 130, isCommonClick: true },
-          { label: "璁¢噺鍗曚綅", prop: "contact_name", min: 130 },
-          { label: "瑙勬牸鍨嬪彿", prop: "contact_phone", min: 130 },
-          { label: "鏁伴噺", prop: "contact_phone", min: 130 },
-          { label: "閿�鍞崟浠�", prop: "sales_resources", min: 130 },
-          { label: "浠风◣鍚堣", prop: "province", min: 130 },
-          { label: "鎻忚堪", prop: "province", min: 130 },
+          { label: "浜у搧鍚嶇О", prop: "name", min: 190, isCommonClick: true },
+          { label: "浜у搧缂栫爜", prop: "number", min: 130, isCommonClick: true },
+          { label: "璁¢噺鍗曚綅", prop: "unit", min: 130 },
+          { label: "瑙勬牸鍨嬪彿", prop: "specifications", min: 130 },
+          { label: "鏁伴噺", prop: "amount", min: 130 },
+          { label: "閿�鍞崟浠�", prop: "price", min: 130 },
+          { label: "浠风◣鍚堣", prop: "total", min: 130 },
+          { label: "鎻忚堪", prop: "remark", min: 130 },
         ],
       };
     },
diff --git a/src/views/purchaseManage/purchase/components/AddPurchase.vue b/src/views/purchaseManage/purchase/components/AddPurchase.vue
index c833e6e..8211eb2 100644
--- a/src/views/purchaseManage/purchase/components/AddPurchase.vue
+++ b/src/views/purchaseManage/purchase/components/AddPurchase.vue
@@ -3,7 +3,7 @@
     <el-dialog
       :title="editCommonConfig.title + '閲囪喘鍗�'"
       :visible.sync="editConfig.visible"
-      :width="dialogWidth"
+      width="50%"
       :before-close="handleClose"
       append-to-body
       custom-class="iframe-dialog"
@@ -26,12 +26,12 @@
               <el-col :span="12">
                 <el-form-item
                   label="閲囪喘绫诲瀷"
-                  prop="brand"
+                  prop="purchaseTypeId"
                   class="form-item float_left"
                 >
                   <el-select
                     placeholder="璇烽�夋嫨閲囪喘绫诲瀷"
-                    v-model="editConfig.infomation.client_name"
+                    v-model="editConfig.infomation.purchaseTypeId"
                     clearable
                     style="width: calc(100% - 30px)"
                   >
@@ -51,11 +51,11 @@
               </el-col>
 
               <el-col :span="12">
-                <el-form-item label="渚涘簲鍟嗗悕绉�" prop="client_name">
+                <el-form-item label="渚涘簲鍟嗗悕绉�" prop="supplierName">
                   <div class="custom-name">
                     <el-autocomplete
                       style="width: calc(100% - 40px)"
-                      v-model="editConfig.infomation.client_name"
+                      v-model="editConfig.infomation.supplierName"
                       :fetch-suggestions="
                         (queryString, callback) => {
                           querySearchAsync(queryString, callback, 'client');
@@ -73,8 +73,8 @@
                     </div>
                     <div
                       v-if="
-                        editConfig.infomation.client_name &&
-                        editConfig.infomation.client_name.length > 0
+                        editConfig.infomation.supplierName &&
+                        editConfig.infomation.supplierName.length > 0
                       "
                       class="common-select-btn"
                       @click="clearupClient('client')"
@@ -88,40 +88,45 @@
                 <el-form-item label="鍗曟嵁鏉ユ簮" prop="number">
                   <el-input
                     v-model="editConfig.infomation.number"
+                    disabled
                     placeholder="璇峰~鍐�"
                   ></el-input>
                 </el-form-item>
               </el-col>
               <el-col :span="12">
-                <el-form-item label="閲囪喘鍗曞悕绉�" prop="number">
+                <el-form-item label="閲囪喘鍗曞悕绉�" prop="name">
                   <el-input
-                    v-model="editConfig.infomation.number"
+                    v-model="editConfig.infomation.name"
                     placeholder="璇峰~鍐�"
+                    clearable
                   ></el-input>
                 </el-form-item>
               </el-col>
               <el-col :span="12">
-                <el-form-item label="渚涘簲鍟嗚仈绯讳汉" prop="number">
+                <el-form-item label="渚涘簲鍟嗚仈绯讳汉" prop="contact">
                   <el-input
-                    v-model="editConfig.infomation.number"
+                    v-model="editConfig.infomation.contact"
                     placeholder="璇峰~鍐�"
+                    clearable
                   ></el-input>
                 </el-form-item>
               </el-col>
               <el-col :span="12">
-                <el-form-item label="鑱旂郴鐢佃瘽" prop="contact_phone">
+                <el-form-item label="鑱旂郴鐢佃瘽" prop="phone">
                   <el-input
-                    v-model="editConfig.infomation.contact_phone"
+                    v-model="editConfig.infomation.phone"
                     placeholder="璇峰~鍐�"
+                    clearable
                   ></el-input>
                 </el-form-item>
               </el-col>
               <el-col :span="12">
-                <el-form-item label="绛剧害鏃ユ湡" prop="validity_date">
+                <el-form-item label="绛剧害鏃ユ湡" prop="signingDate">
                   <el-date-picker
-                    v-model="editConfig.infomation.validity_date"
+                    v-model="editConfig.infomation.signingDate"
                     style="width: 100%"
                     type="date"
+                    clearable
                     placeholder="閫夋嫨鏃ユ湡"
                     value-format="yyyy-MM-dd"
                   >
@@ -129,11 +134,12 @@
                 </el-form-item>
               </el-col>
               <el-col :span="12">
-                <el-form-item label="浜や粯鏃ユ湡" prop="validity_date">
+                <el-form-item label="浜や粯鏃ユ湡" prop="deliveryDate">
                   <el-date-picker
-                    v-model="editConfig.infomation.validity_date"
+                    v-model="editConfig.infomation.deliveryDate"
                     style="width: 100%"
                     type="date"
+                    clearable
                     placeholder="閫夋嫨鏃ユ湡"
                     value-format="yyyy-MM-dd"
                   >
@@ -141,13 +147,13 @@
                 </el-form-item>
               </el-col>
               <el-col :span="24">
-                <el-form-item label="澶囨敞淇℃伅" prop="member_id">
+                <el-form-item label="澶囨敞淇℃伅" prop="remark">
                   <el-input
                     type="textarea"
                     :autosize="{ minRows: 3, maxRows: 4 }"
                     maxlength="500"
                     clearable
-                    v-model="editConfig.infomation.member_id"
+                    v-model="editConfig.infomation.remark"
                   ></el-input>
                 </el-form-item>
               </el-col>
@@ -163,7 +169,6 @@
               @inputContent="inputContent"
               @addProductClick="addProductClick"
               @emptyProductClick="emptyProductClick"
-              @recalculateProductClick="recalculateProductClick"
               @clearupProduct="clearupProduct"
             />
           </div>
@@ -230,10 +235,10 @@
           >鍙栨秷</el-button
         >
       </div>
-      <!-- 閫夋嫨瀹㈡埛 -->
-      <SelectClientDialog
-        v-if="editSelectClientConfig.editVisible"
-        :edit-common-config="editSelectClientConfig"
+      <!-- 閫夋嫨渚涘簲鍟嗗悕绉�-->
+      <SelectSupplierDialog
+        v-if="editSelectSupplierConfig.editVisible"
+        :edit-common-config="editSelectSupplierConfig"
         @selClient="selClient"
       />
     </el-dialog>
@@ -250,18 +255,19 @@
 <script>
 import CommonFormTableView from "@/components/makepager/CommonFormTableView";
 import BomDialog from "@/components/makepager/BomDialog";
+
 import {
-  getAddQuotation,
-  getUpdateQuotation,
-  getAllData,
+  addPurchase,
+  updatePurchase,
 } from "@/api/purchaseManage/purchase";
 // import {
 //   postGetUnitDictList,
 //   postGetSaveSUnitDict,
 // } from "@/api/purchaseManage/purchase";
-import SelectClientDialog from "@/views/purchaseManage/purchase/components/SelectClientDialog";
+import SelectSupplierDialog from "@/views/purchaseManage/purchase/components/SelectSupplierDialog";
 export default {
   name: "QuotationDialog",
+  components: { SelectSupplierDialog, CommonFormTableView,BomDialog },
   props: {
     editCommonConfig: {
       type: Object,
@@ -274,46 +280,25 @@
       },
     },
   },
-  components: { SelectClientDialog, CommonFormTableView,BomDialog },
-  computed: {
-    searchCommonHeight() {
-      return this.$refs.searchCommonView.offsetHeight;
-    },
-    contactNamelist() {
-      return this.$store.state.getClientName.contactNamelist;
-    },
-  },
   data() {
     return {
-      dialogWidth: "50%",
       editConfig: this.editCommonConfig,
       rules: {
-        client_id: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
-        number: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
-        quotation_status_id: [
-          { required: true, message: "璇烽�夋嫨", trigger: "change" },
-        ],
-        member_id: [
-          { required: true, message: "璇烽�夋嫨璐熻矗浜�", trigger: "change" },
-        ],
-        contact_phone: [
+        supplierName: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
+        phone: [
           {
-            required: true,
+            required: false,
             message: "璇峰~鍐�",
             trigger: "change",
           },
           { validator: this.validatorPhone, trigger: "change" },
         ],
       },
-      memberOptions: [],
-      quotationStatusOptions: [{ id: 1, name: "涓嶇煡閬�" }], // 鎶ヤ环鍗曠姸鎬�
-      currencyOptions: [{ id: 1, name: "浜烘皯甯�" }], // 甯佺
-      approvalWorkflowOptions: [], // 瀹℃壒娴佺▼
       productTableList: {},
       showSummary: {
         show: true,
         total: false,
-        sumProp: ["Amount", "total"],
+        sumProp: ["price", "total"],
         titleProp: [
           "缂栧彿",
           "浜у搧鍚嶇О",
@@ -325,14 +310,12 @@
         ],
         mergeNumber: 4,
       },
-      editSelectClientConfig: {
+      editSelectSupplierConfig: {
         editVisible: false,
         title: "",
         infomation: {},
       },
-      clientId: this.editCommonConfig.infomation.client_id,
-      contactId: this.editCommonConfig.infomation.contact_id,
-      saleChanceId: this.editCommonConfig.infomation.sale_chance_id,
+      supplierId: this.editCommonConfig.infomation.supplierId,
       tableData: [],
       productId: 1,
       isNoProduct: true,
@@ -342,7 +325,16 @@
   },
   created() {
     this.setTableForm();
-    this.getCommonData();
+  },
+  computed: {
+  },
+  watch:{
+    'editCommonConfig.visible':{
+      immediate:true,
+      handler:function(){
+        this.setTableForm();
+      }
+    }
   },
   methods: {
     // PLC閰嶇疆璁剧疆
@@ -402,17 +394,6 @@
         callback();
       }
     },
-    getCommonData() {
-      getAllData()
-        .then((res) => {
-          this.memberOptions = res.data.member;
-          this.quotationStatusOptions = res.data.quotationStatus;
-        })
-        .catch((err) => {
-          console.log(err);
-        });
-    },
-
     // 淇濆瓨
     saveClick(formName) {
       this.$refs[formName].validate((valid) => {
@@ -431,7 +412,7 @@
             const params = this.saveParams();
             console.log(params);
             if (this.editConfig.title === "鍒涘缓") {
-              getAddQuotation(params).then((res) => {
+              addPurchase(params).then((res) => {
                 console.log(res);
                 this.editConfig.visible = false;
                 if (res.code === 200) {
@@ -440,7 +421,7 @@
                 }
               });
             } else {
-              getUpdateQuotation(params).then((res) => {
+              updatePurchase(params).then((res) => {
                 this.editConfig.visible = false;
                 if (res.code === 200) {
                   this.$message.success("缂栬緫鎴愬姛");
@@ -456,20 +437,24 @@
       });
     },
     saveParams() {
-      let data = this.editConfig.infomation;
+      debugger
+      let data =JSON.parse(JSON.stringify(this.editConfig.infomation));
       let params = {
-        id: this.editConfig.title === "鍒涘缓" ? 0 : data.id,
-        client_id: this.clientId || 0,
-        conditions: data.conditions || "",
-        contact_id: this.contactId || 0,
-        file: data.file || "",
-        member_id: data.member_id || 0,
-        number: data.number || "",
-        quotation_status_id: data.quotation_status_id || 0,
-        sale_chance_id: this.saleChanceId || 0,
-        validity_date: data.validity_date || "",
-        products: this.tableData,
+        productList:this.tableData,
+        purchase:{
+          supplierId:this.supplierId||0,
+          signingDate:data.signingDate||'',
+          remark:data.remark,
+          purchaseTypeId:this.purchaseTypeId||0,
+          phone:data.phone||'',
+          name:data.name||'',
+          deliveryDate:data.deliveryDate||'',
+          contact:data.contact
+        }
       };
+      if(data.ID){
+        params.purchase.id=data.ID
+      }
       return params;
     },
     handleClose() {
@@ -480,9 +465,7 @@
       var restaurants = [];
       if (value === "client") {
         restaurants = this.clientList;
-      } else if (value === "contact") {
-        restaurants = this.contactNamelist;
-      }
+      } 
       var results = queryString
         ? restaurants.filter(this.createStateFilter(queryString))
         : restaurants;
@@ -498,37 +481,30 @@
     handleSelectClient(value, item) {
       console.log(value);
       if (value === "client") {
-        this.clientId = item.id;
-      } else if (value === "chance") {
-        this.saleChanceId = item.id;
-      } else {
-        this.contactId = item.id;
+        this.supplierId = item.id;
       }
     },
     selClientClick() {
-      this.editSelectClientConfig.editVisible = true;
+      this.editSelectSupplierConfig.editVisible = true;
     },
     selClient(row) {
-      this.editConfig.infomation.client_name = row.name;
-      this.clientId = row.id;
+      this.$set(this.editConfig.infomation,'supplierName',row.name)
+      this.editConfig.infomation.contact = row.contact;
+      this.editConfig.infomation.phone = row.phone;
+      this.supplierId = row.ID;
     },
     // 娓呴櫎宸查�夋嫨鐢ㄦ埛
     clearupClient(value) {
       if (value == "client") {
-        this.editConfig.infomation.client_name = "";
-        this.$set(this.editConfig.infomation, "client_name", "");
-        this.clientId = null;
+        this.$set(this.editConfig.infomation, "supplierName", "");
+        this.supplierId = null;
         this.$forceUpdate();
       }
     },
-    // 娣诲姞闄勪欢
-    addAnnexClick() {},
-    // 璁剧疆鍏佽涓婁紶鏂囦欢鏍煎紡
-    setFormatClick() {},
     setTableForm() {
       if (
-        this.editConfig.title === "鍒涘缓" ||
-        this.editConfig.infomation.products.length === 0
+        !this.editConfig.infomation.ID  ||
+        this.editConfig.infomation.productList.length === 0
       ) {
         this.tableData = [
           {
@@ -543,15 +519,14 @@
           },
         ];
       } else {
-        this.tableData = this.editConfig.infomation.products;
-        this.tableData.map((item, index) => {
-          item.productId = index + 1;
-        });
+        this.tableData = this.editConfig.infomation.productList;
+        // this.tableData.map((item, index) => {
+        //   item.productId = index + 1;
+        // });
       }
       this.productTableList = {
         tableData: this.tableData,
         tableColumn: [
-          { label: "缂栧彿", prop: "productId", width: 40 },
           {
             label: "浜у搧鍚嶇О",
             prop: "name",
@@ -559,8 +534,8 @@
             isRequird: true,
           },
           { label: "浜у搧缂栧彿", prop: "number" },
-          { label: "璁¢噺鍗曚綅", prop: "number" },
-          { label: "瑙勬牸鍨嬪彿", prop: "number" },
+          { label: "璁¢噺鍗曚綅", prop: "unit" },
+          { label: "瑙勬牸鍨嬪彿", prop: "specifications" },
           { label: "鏁伴噺", prop: "amount", inputNumber: true, isRequird: true },
           {
             label: "閲囪喘鍗曚环",
@@ -569,7 +544,7 @@
             isRequird: true,
           },
           { label: "浠风◣鍚堣", prop: "total", inputFloat: true },
-          { label: "鎻忚堪", prop: "name", input: true },
+          { label: "鎻忚堪", prop: "remark", input: true },
         ],
       };
     },
@@ -609,13 +584,11 @@
           name: "",
           number: "",
           price: 0,
-          total: 0,
+          total: 0
         },
       ];
       this.productTableList.tableData = this.tableData;
     },
-    // 浜у搧閲嶇畻
-    recalculateProductClick() {},
     clearupProduct(data) {
       this.tableData = data;
       this.productTableList.tableData = this.tableData;
diff --git a/src/views/purchaseManage/purchase/components/SelectClientDialog.vue b/src/views/purchaseManage/purchase/components/SelectSupplierDialog.vue
similarity index 74%
rename from src/views/purchaseManage/purchase/components/SelectClientDialog.vue
rename to src/views/purchaseManage/purchase/components/SelectSupplierDialog.vue
index ae0c94c..a5dd842 100644
--- a/src/views/purchaseManage/purchase/components/SelectClientDialog.vue
+++ b/src/views/purchaseManage/purchase/components/SelectSupplierDialog.vue
@@ -1,7 +1,7 @@
 <template>
   <div class="edit-selClient-box">
     <el-dialog
-      :title="'瀹㈡埛绠$悊'"
+      :title="'渚涘簲鍟嗗悕绉�'"
       :visible.sync="editConfig.editVisible"
       :width="dialogWidth"
       :before-close="handleClose"
@@ -38,9 +38,7 @@
 </template>
 
 <script>
-import {
-  getClientList
-} from "@/api/purchaseManage/purchase";
+import { getSupplierList } from "@/api/supplierManage/supplier"
 export default {
   name: "EditSelClientDialog",
   props: {
@@ -80,15 +78,14 @@
       this.tableList = {
         tableInfomation: [],
         tableColumn: [
-          { label: "瀹㈡埛鍚嶇О", prop: "name", min: 100, isClick: true },
-          { label: "瀹㈡埛缂栧彿", prop: "number" },
-          { label: "瀹㈡埛鐘舵��", prop: "client_status" },
-          { label: "閿�鍞礋璐d汉", prop: "member_name", min: 100 },
-          { label: "娉曞畾浠h〃浜�", prop: "representative", min: 100 },
-          { label: "娉ㄥ唽鏃堕棿", prop: "registration_time" },
-          { label: "缁忚惀鑼冨洿", prop: "business_scope" },
-          { label: "璇︾粏鍦板潃", prop: "detail_address" },
-          { label: "澶囨敞", prop: "remark" }
+         { label: "渚涘簲鍟嗙紪鍙�", prop: "number", min: 190, isCommonClick: true },
+          { label: "渚涘簲鍟嗗悕绉�", prop: "name", 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 }
         ]
       }
       this.searchOptions = []
@@ -102,22 +99,20 @@
       this.editConfig.editVisible = false
     },
     // 璇锋眰鏁版嵁
-    async getData() {
+    async getData(val, content) {
       this.loading = true
-      await getClientList({
-        search_map: this.search_map,
-        page: 0,
-        pageSize: 0
+      await getSupplierList({
+        [val]: content,
+        page:1,
+        pageSize: 10
       })
         .then((res) => {
-          console.log(res)
-          if (res.code === 200) {
-            if (res.data.list && res.data.list.length > 0) {
-              const list = res.data.list.map((item) => {
+          if (res.data.code == 200) {
+            if (res.data.data.list && res.data.data.list.length > 0) {
+              const list = res.data.data.list.map((item) => {
                 return {
                   ...item,
-                  client_status: item.client_status.name,
-                  member_name: item.member.username
+                  status_name: item.status === 0 ? "鏈惎鐢�" : "鍚敤"
                 }
               })
               this.tableList.tableInfomation = list.slice(0, 5) || []
@@ -131,7 +126,7 @@
         })
         .catch((err) => {
           console.log(err)
-          this.this.tableList.tableInfomation = []
+          this.tableList.tableInfomation = []
           this.loading = false
         })
     },
@@ -141,14 +136,9 @@
     },
     // 鎼滅储
     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()
     }
   }
diff --git a/src/views/purchaseManage/purchase/index.vue b/src/views/purchaseManage/purchase/index.vue
index ea06106..eca326e 100644
--- a/src/views/purchaseManage/purchase/index.vue
+++ b/src/views/purchaseManage/purchase/index.vue
@@ -40,19 +40,21 @@
     <!-- 鏂板缓/缂栬緫閿�鍞嚎绱� -->
     <!-- <AddSalesLeadDialog v-if="editSalesLeadConfig.visible" :edit-rightContent-config="editSalesLeadConfig" /> -->
     <!-- 璇︽儏 -->
-    <DetailSupplier v-if="commonDetail.visible" :common-detail="commonDetail" @submitClick="submitClick" />
+    <DetailSupplier v-if="commonDetail.visible" :common-detail="commonDetail"  />
     <!-- 鏂板缓/缂栬緫 -->
     <AddPurchase v-if="editConfig.visible" :edit-common-config="editConfig" />
   </div>
 </template>
 
 <script>
+
 import pageMixin from "@/components/makepager/pager/mixin/pageMixin"
 import {
-  getSalesLeadsList, getDeleteSalesLeads 
+  getPurchaseList,getPurchaseInfo,submitPurchase, 
 } from "@/api/purchaseManage/purchase";
 import DetailSupplier from "@/views/purchaseManage/purchase/DetailSupplier"
 import AddPurchase from "@/views/purchaseManage/purchase/components/AddPurchase"
+import { getDataByType } from "@/api/data";
 export default {
   name: "SupplierManage",
   props: {},
@@ -74,6 +76,7 @@
         title: "鍒涘缓",
         infomation: {}
       },
+      purchaseStatusList:getDataByType('purchaseStatus'),
     }
   },
   created() {
@@ -87,9 +90,9 @@
         selectIndex: true,
         tableColumn: [
           { label: "閲囪喘鍗曞彿", prop: "number", min: 150, isCommonClick: true },
-          { label: "閲囪喘鍗曞悕绉�", prop: "name", min: 130,},
+          { label: "閲囪喘鍗曞悕绉�", prop: "name", min: 130, isCommonClick: true},
           { label: "鍗曟嵁绫诲瀷", prop: "contact_name", min: 130 },
-          { label: "渚涘簲鍟嗗悕绉�", prop: "contact_phone", min: 130 },
+          { label: "渚涘簲鍟嗗悕绉�", prop: "contact", min: 130 },
           { label: "閲囪喘鏁伴噺", prop: "sales_resources", min: 130 },
           { label: "鏀惰揣浠撳簱", prop: "province", min: 130 },
           { label: "缁忓姙浜�", prop: "city", min: 130 },
@@ -100,23 +103,17 @@
     },
     // 璇锋眰鏁版嵁
     async getData() {
-      await getSalesLeadsList({
-        search_map: this.search_map,
+      await getPurchaseList({
+        keyword: this.search_map,
         page: this.pagerOptions.currPage,
         pageSize: this.pagerOptions.pageSize
       })
         .then((res) => {
-          const list = res.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
-            }
-          })
-          this.tableList.tableInfomation = list || []
-          this.pagerOptions.totalCount = res.data.count
+          if (res.data.code === 200) {
+            const list = res.data.data.list
+            this.tableList.tableInfomation = list || []
+            this.pagerOptions.totalCount = res.data.data.total
+          }
         })
         .catch((err) => {
           console.log(err)
@@ -140,19 +137,39 @@
       // this.$refs.add.islook = true;
       this.editConfig.visible = true
       this.editConfig.title = "鍒涘缓"
-      this.editConfig.infomation = { }
+      this.editConfig.infomation = {
+        productList:[],
+        supplierId:'',
+          signingDate:'',
+          remark:'',
+          purchaseTypeId:'',
+          phone:'',
+          name:'',
+          deliveryDate:'',
+          contact:''
+       }
     },
     
     // 缂栬緫
     editClick(row){
+      getPurchaseInfo({id:row.ID}).then((res) => {
+        if (res.code == 200) {
+          this.editConfig.visible = true
+          this.editConfig.title = "缂栬緫"
+          this.editConfig.infomation = { 
+            productList:res.data.productList,
+            ...res.data.purchase
+           }
+        }else{
+          this.$message.error(res.msg?res.msg+',':''+'鑾峰彇淇℃伅澶辫触锛�')
+        }
+      })
       // this.editRow = row;
       // this.$refs.add.islook = true;
-      this.editConfig.visible = true
-      this.editConfig.title = "缂栬緫"
-      this.editConfig.infomation = { ...row }
+      
     },
     // 纭鍙戣揣
-    submitClick() {
+    submitClick(row) {
         this.$confirm("鏄惁鎻愪氦?", "鎻愮ず", {
           confirmButtonText: "纭畾",
           cancelButtonText: "鍙栨秷",
@@ -160,7 +177,7 @@
         })
           .then(() => {
             console.log("dddd")
-            getDeleteSalesLeads({ ids: this.selValueList }).then((response) => {
+            submitPurchase({ id: row.ID }).then((response) => {
               if (response.code === 200) {
                 this.$message.success("鎻愪氦鎴愬姛")
                 this.getData()
@@ -175,8 +192,17 @@
     // 璇︽儏
     selCommonClick(row) {
       console.log(row)
-      this.commonDetail.visible = true
-      this.commonDetail.infomation = { ...row }
+      getPurchaseInfo({id:row.ID}).then((res) => {
+        if (res.code == 200) {
+          this.commonDetail.visible = true
+          this.commonDetail.infomation = { 
+            productList:res.data.productList,
+            ...res.data.purchase
+           }
+        }else{
+          this.$message.error(res.msg?res.msg+',':''+'鑾峰彇淇℃伅澶辫触锛�')
+        }
+      })
     }
   }
 }
diff --git a/vue.config.js b/vue.config.js
index 5436c86..4df038e 100644
--- a/vue.config.js
+++ b/vue.config.js
@@ -15,6 +15,8 @@
     proxy: {
       "/api": {
         target: "http://192.168.20.118:8889", // http://192.168.20.119:8002 http://fai365.com:30150/
+        // target: "http://192.168.20.120:8889", 
+        // target: "http://192.168.20.119:8004",
         ws: true,
         changeOrigin: true
       }

--
Gitblit v1.8.0