From 87f7f7a7588e926c6535eea2910ae98ca4101994 Mon Sep 17 00:00:00 2001
From: haoxuan <haoxuan>
Date: 星期二, 29 八月 2023 18:52:49 +0800
Subject: [PATCH] 采购 添加 列表编辑 子段补充,联调

---
 src/components/makepager/BomDialog.vue                       |   49 ----
 src/components/makepager/TableCommonView.vue                 |   12 +
 src/api/purchaseManage/purchase.js                           |   16 +
 src/views/purchaseManage/purchase/components/AddPurchase.vue |  143 +++++++++++----
 src/views/purchaseManage/purchase/index.vue                  |   52 +++--
 src/api/data.js                                              |   35 +++
 src/views/purchaseManage/returned/index.vue                  |   74 ++++---
 src/components/layout/components/appsidebar/index.vue        |    2 
 src/views/purchaseManage/quality/index.vue                   |   73 ++++---
 src/views/purchaseManage/purchase/DetailSupplier.vue         |   25 ++
 10 files changed, 308 insertions(+), 173 deletions(-)

diff --git a/src/api/data.js b/src/api/data.js
index a885f6b..be0d736 100644
--- a/src/api/data.js
+++ b/src/api/data.js
@@ -17,10 +17,43 @@
     id:4,
   },
 ]
-
+// 璐ㄦ鍗曠姸鎬�
+const qualityStatus=[
+  {
+    name:'寰呰川妫�',
+    id:1,
+  },
+  {
+    name:'宸插畬鎴�',
+    id:2,
+  }
+]
+// 閫�璐у崟鐘舵��
+const returnedStatus=[
+  {
+    name:'寰呭彂璐�',
+    id:1,
+  },
+  {
+    name:'寰呯鏀�',
+    id:2,
+  },
+  {
+    name:'寰呭彂璐�',
+    id:3,
+  },
+  {
+    name:'宸插畬鎴�',
+    id:4,
+  },
+]
 
 export const getDataByType = type => {
   if(type =='purchaseStatus'){
     return purchaseStatus;
+  }else if(type=='qualityStatus'){
+    return qualityStatus;
+  }else if(type=='returnedStatus'){
+    return returnedStatus;
   }
 }
diff --git a/src/api/purchaseManage/purchase.js b/src/api/purchaseManage/purchase.js
index e5d6a67..446980d 100644
--- a/src/api/purchaseManage/purchase.js
+++ b/src/api/purchaseManage/purchase.js
@@ -95,3 +95,19 @@
       data
     })
   }
+// 鏂板缓閲囪喘绫诲瀷
+export function savePurchaseType(data) {
+  return request({
+    url: "/api/purchase/purchaseType",
+    method: "post",
+    data
+  })
+}
+// 鑾峰彇閲囪喘绫诲瀷
+export function getPurchaseType(data) {
+  return request({
+    url: "/api/purchase/purchaseTypeList",
+    method: "get",
+    data
+  })
+}
\ No newline at end of file
diff --git a/src/components/layout/components/appsidebar/index.vue b/src/components/layout/components/appsidebar/index.vue
index b84ad33..4aaecf5 100644
--- a/src/components/layout/components/appsidebar/index.vue
+++ b/src/components/layout/components/appsidebar/index.vue
@@ -30,7 +30,7 @@
           </template>
           <el-menu-item index="/purchaseManage/purchase">閲囪喘璁㈠崟</el-menu-item>
           <el-menu-item index="/purchaseManage/quality">閲囪喘璐ㄦ鍗�</el-menu-item>
-          <el-menu-item index="/purchaseManage/warehouse">閲囪喘鍏ュ簱鍗�</el-menu-item>
+          <!-- <el-menu-item index="/purchaseManage/warehouse">閲囪喘鍏ュ簱鍗�</el-menu-item> -->
           <el-menu-item index="/purchaseManage/returned">閲囪喘閫�璐у崟</el-menu-item>
         </el-submenu>
         <el-submenu index="3">
diff --git a/src/components/makepager/BomDialog.vue b/src/components/makepager/BomDialog.vue
index 3a302b6..97f0e2d 100644
--- a/src/components/makepager/BomDialog.vue
+++ b/src/components/makepager/BomDialog.vue
@@ -26,7 +26,7 @@
         </el-table-column>
         <el-table-column prop="createdAt" label="璁句负榛樿">
           <template slot-scope="scope">
-          <el-switch @change="switchChange(scope,scope.row.isDefault)"  v-model="scope.row.isDefault"></el-switch>
+          <el-switch @change="switchChange(scope,scope.row[editRow.isDefault])"  v-model="scope.row[editRow.isDefault]"></el-switch>
           </template>
     
         </el-table-column>
@@ -68,7 +68,9 @@
     editRow: {
       type: Object,
       default: () => {
-        return {};
+        return {
+          isDefault:'isDefault'
+        };
       },
     },
     workList:{
@@ -79,45 +81,10 @@
     return {
       editDialogVisible: false,
       isTableShow:true,
-      form: {},
       BomTableData: [1],
       work: 1,
       flag: "add",
       Tabs: "msg",
-      tableData: [
-        {
-          date: "PEBU",
-          name: "PE甯�",
-          number: "21",
-          unit: "鍚�",
-        },
-      ],
-      rules: {
-        id: [{ required: true, message: "璇疯緭鍏ョ墿鏂欑紪鐮�", trigger: "blur" }],
-        name: [
-          { required: true, message: "璇疯緭鍏ョ墿鏂欏悕绉�", trigger: "blur" },
-          
-        ],
-        specs: [{ required: true, message: "璇疯緭鍏ョ墿鏂欒鏍�", trigger: "blur" }],
-        type: [{ required: true, message: "璇疯緭鍏ョ墿鏂欏瀷鍙�", trigger: "blur" }],
-        amount: [
-          {
-            required: true,
-            message: "璇疯緭鍏ユ暟閲�",
-            trigger: "blur",
-          },
-        ],
-        unit: [
-          {
-            required: true,
-            message: "璇疯緭鍏ュ崟浣�",
-            trigger: "blur",
-          },
-        ],
-        model: [
-          { required: true, message: "璇烽�夋嫨鐗╂枡绫诲瀷", trigger: "change" },
-        ],
-      },
     };
   },
   watch: {
@@ -136,7 +103,7 @@
   },
   methods: {
     handleAdd() {
-      this.BomTableData.push({name:'',isDefault:false});
+      this.BomTableData.push({name:'',[this.editRow.isDefault]:false,sort:this.BomTableData.length});
     },
     handleDelete(scope) {
       this.BomTableData.splice(scope.$index,1)
@@ -148,7 +115,7 @@
     switchChange(scope,val){
       let arr=[]
       for(let i in this.BomTableData){
-        if(this.BomTableData[i].isDefault){
+        if(this.BomTableData[i][this.editRow.isDefault]){
           arr.push(i)
         }
       }
@@ -157,13 +124,13 @@
           message: '鍙兘璁句竴涓负榛樿',
           type: "warning",
         });
-        scope.row.isDefault=!val
+        scope.row[this.editRow.isDefault]=!val
       }
     },
     handleConfirmSave() {
       let arr=[]
       for(let i in this.BomTableData){
-        if(this.BomTableData[i].isDefault){
+        if(this.BomTableData[i][this.editRow.isDefault]){
           arr.push(i)
         }
       }
diff --git a/src/components/makepager/TableCommonView.vue b/src/components/makepager/TableCommonView.vue
index a59e9aa..7b97b49 100644
--- a/src/components/makepager/TableCommonView.vue
+++ b/src/components/makepager/TableCommonView.vue
@@ -311,9 +311,15 @@
   }
 }
 ::v-deep {
-  .el-table__footer-wrapper tbody td.el-table__cell {
-    background-color: #fff;
-    text-align: right;
+  .el-table__footer-wrapper  {
+    tbody td.el-table__cell{
+      background-color: #fff;
+    }
+    // .cell{
+    //     &:nth-last-child(3){
+    //       text-align:right;
+    //     }
+    //   }
   }
 }
 </style>
diff --git a/src/views/purchaseManage/purchase/DetailSupplier.vue b/src/views/purchaseManage/purchase/DetailSupplier.vue
index f57178d..440d449 100644
--- a/src/views/purchaseManage/purchase/DetailSupplier.vue
+++ b/src/views/purchaseManage/purchase/DetailSupplier.vue
@@ -153,6 +153,7 @@
 
 <script>
 import { deletePurchase } from "@/api/purchaseManage/purchase";
+import { getDataByType } from "@/api/data";
 export default {
   name: "DetailSupplier",
   props: {
@@ -184,10 +185,11 @@
       tableList: {},
       showSummary:{
         show: true,
-        sumProp: ["number", "total"],
-        mergeNumber: 4,
+        sumProp: ["amount", "total"],
+        mergeNumber: 5,
         totalName:'灏忚'
       },
+      purchaseStatusList:getDataByType('purchaseStatus'),
     };
   },
   created() {
@@ -197,6 +199,17 @@
   mounted() {},
   computed: {},
   methods: {
+    getpurchaseStatus(val) {
+      if (val) {
+        for (let i in this.purchaseStatusList) {
+          if (this.purchaseStatusList[i].id == val) {
+            return this.purchaseStatusList[i].name;
+          }
+        }
+      } else {
+        return "--";
+      }
+    },
     // email 閫氱煡涓嬪崟
     emailClick() {},
     // 鍒犻櫎
@@ -267,7 +280,7 @@
         },
         {
           leftStr: "閲囪喘鍗曠姸鎬�",
-          leftValue: item.contact_name,
+          leftValue: this.getpurchaseStatus(item.status),
           rightStr: "閲囪喘璐熻矗浜�",
           rightValue: item.contact_position,
         },
@@ -285,7 +298,7 @@
         },
         {
           leftStr: "鍒拌揣浠撳簱",
-          leftValue: item.sales_resources,
+          leftValue: item.warehouse,
           rightStr: "",
           rightValue: "",
         },
@@ -314,8 +327,8 @@
         tableInfomation: item.productList?item.productList:[],
         selectIndex: true,
         tableColumn: [
-          { label: "浜у搧鍚嶇О", prop: "name", min: 190, isCommonClick: true },
-          { label: "浜у搧缂栫爜", prop: "number", min: 130, isCommonClick: true },
+          { label: "浜у搧鍚嶇О", prop: "name", min: 160,  },
+          { label: "浜у搧缂栫爜", prop: "number", min: 130, },
           { label: "璁¢噺鍗曚綅", prop: "unit", min: 130 },
           { label: "瑙勬牸鍨嬪彿", prop: "specifications", min: 130 },
           { label: "鏁伴噺", prop: "amount", min: 130 },
diff --git a/src/views/purchaseManage/purchase/components/AddPurchase.vue b/src/views/purchaseManage/purchase/components/AddPurchase.vue
index 8211eb2..7205625 100644
--- a/src/views/purchaseManage/purchase/components/AddPurchase.vue
+++ b/src/views/purchaseManage/purchase/components/AddPurchase.vue
@@ -37,9 +37,9 @@
                   >
                     <el-option
                       v-for="ele in plcBrandList"
-                      :key="ele.id"
+                      :key="ele.name"
                       :label="ele.name"
-                      :value="ele.name"
+                      :value="ele.ID"
                     ></el-option>
                   </el-select>
                   <i
@@ -85,9 +85,9 @@
                 </el-form-item>
               </el-col>
               <el-col :span="12">
-                <el-form-item label="鍗曟嵁鏉ユ簮" prop="number">
+                <el-form-item label="鍗曟嵁鏉ユ簮" prop="orderSource">
                   <el-input
-                    v-model="editConfig.infomation.number"
+                    v-model="editConfig.infomation.orderSource"
                     disabled
                     placeholder="璇峰~鍐�"
                   ></el-input>
@@ -177,7 +177,7 @@
               <div class="table-bottom-l">
                 <el-form-item label="鏁村崟鎶樻墸" prop="member_id">
                   <el-select
-                    v-model="editConfig.infomation.fieldName"
+                    v-model="editConfig.infomation.wholeDiscountType"
                     placeholder="璇烽�夋嫨"
                     filterable
                   >
@@ -189,7 +189,7 @@
               <div class="table-bottom-r">
                 <el-form-item label="" prop="member_id">
                   <el-input
-                    v-model="editConfig.infomation.number"
+                    v-model="editConfig.infomation.wholeDiscount"
                     size="mini"
                     placeholder="璇峰~鍐�"
                   ></el-input>
@@ -200,7 +200,7 @@
               <div class="table-bottom-l">
                 <el-form-item label="璋冩暣" prop="member_id">
                   <el-select
-                    v-model="editConfig.infomation.fieldName"
+                    v-model="editConfig.infomation.priceAdjustmentType"
                     placeholder="璇烽�夋嫨"
                     filterable
                   >
@@ -212,7 +212,7 @@
               <div class="table-bottom-r">
                 <el-form-item label="" prop="member_id">
                   <el-input
-                    v-model="editConfig.infomation.number"
+                    v-model="editConfig.infomation.priceAdjustment"
                     size="mini"
                     placeholder="璇峰~鍐�"
                   ></el-input>
@@ -221,7 +221,7 @@
             </div>
             <div class="table-bottom-item">
               <div class="table-bottom-l">鍚堣</div>
-              <div class="table-bottom-r">26000.00</div>
+              <div class="table-bottom-r">{{ editConfig.infomation.realTotalPrice }}</div>
             </div>
           </div>
         </div>
@@ -246,6 +246,7 @@
       ref="editDialog"
       @sucessSet="handleGetBomKindDictList"
       @handleConfirmSave="handleConfirmSave"
+      :editRow="editRow"
       :workList="plcBrandList"
       title="閲囪喘绫诲瀷"
     ></BomDialog>
@@ -259,11 +260,10 @@
 import {
   addPurchase,
   updatePurchase,
+  savePurchaseType,
+  getPurchaseType,
 } from "@/api/purchaseManage/purchase";
-// import {
-//   postGetUnitDictList,
-//   postGetSaveSUnitDict,
-// } from "@/api/purchaseManage/purchase";
+
 import SelectSupplierDialog from "@/views/purchaseManage/purchase/components/SelectSupplierDialog";
 export default {
   name: "QuotationDialog",
@@ -284,6 +284,7 @@
     return {
       editConfig: this.editCommonConfig,
       rules: {
+        purchaseTypeId:[{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
         supplierName: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
         phone: [
           {
@@ -292,6 +293,22 @@
             trigger: "change",
           },
           { validator: this.validatorPhone, trigger: "change" },
+        ],
+        wholeDiscount: [
+          {
+            required: false,
+            message: "璇峰~鍐�",
+            trigger: "change",
+          },
+          { validator: this.validatorNum, trigger: "change" },
+        ],
+        priceAdjustment: [
+          {
+            required: false,
+            message: "璇峰~鍐�",
+            trigger: "change",
+          },
+          { validator: this.validatorNumThree, trigger: "change" },
         ],
       },
       productTableList: {},
@@ -321,6 +338,9 @@
       isNoProduct: true,
       clientList: [],
       plcBrandList:[],
+      editRow:{
+        isDefault:'pin'
+      }
     };
   },
   created() {
@@ -332,46 +352,80 @@
     'editCommonConfig.visible':{
       immediate:true,
       handler:function(){
+        
         this.setTableForm();
       }
     }
   },
   methods: {
+    validatorNum(rule, value, callback) {
+      if (value) {
+        if (value == undefined || value == null) {
+          callback(new Error("璇疯緭鍏ユ湁鏁堟暟瀛�"));
+        } else {
+          var reg = /^\+?[0-9]\d*$/;
+          if (!reg.test(value)) {
+            callback(new Error("璇峰~鍐欎笉灏忎簬0鐨勬暟瀛�"));
+          } else {
+            callback();
+          }
+        }
+      } else {
+        callback();
+      }
+    },
+    validatorNumThree(rule, value, callback){
+      if(value){
+        if(value==undefined||value==null){
+          callback(new Error("璇疯緭鍏ユ湁鏁堟暟瀛�"));
+        }else{
+          let reg2=/(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/
+          if(!reg2.test(value)){
+            callback(new Error('璇峰~鍐�2浣嶅皬鏁扮殑鏁板瓧'))
+          }else{
+            callback()
+          }
+        }
+      }else{
+        callback()
+      } 
+    },
     // PLC閰嶇疆璁剧疆
     handleShow() {
-      // this.handleGetBomKindDictList();
+      this.handleGetBomKindDictList();
       this.$refs.editDialog.editDialogVisible = true;
     },
     //  PLC閰嶇疆
     handleGetBomKindDictList(val) {
       console.log(val,'val')
-      // postGetUnitDictList().then((res) => {
-      //   this.plcBrandList = res.data;
-      //   if (val) {
-      //     for (let i in this.plcBrandList) {
-      //       if (this.plcBrandList[i].isDefault) {
-      //         this.form.unit = this.form.unit
-      //           ? this.form.unit
-      //           : this.plcBrandList[i].name;
-      //         this.$set(this.form, "unit", this.form.unit);
-      //         break;
-      //       }
-      //     }
-      //   }
-      // });
+      getPurchaseType().then((res) => {
+        this.plcBrandList = res.data;
+        if (val) {
+          for (let i in this.plcBrandList) {
+            if (this.plcBrandList[i][this.editRow.isDefault]) {
+              this.editConfig.infomation.purchaseTypeId = this.editConfig.infomation.purchaseTypeId
+                ? this.editConfig.infomation.purchaseTypeId
+                : this.plcBrandList[i].ID;
+              this.$set(this.editConfig.infomation, "purchaseTypeId", this.editConfig.infomation.purchaseTypeId);
+             
+              break;
+            }
+          }
+        }
+      });
     },
     handleConfirmSave(data) {
       console.log(data,'data')
-      // postGetSaveSUnitDict({ data: data }).then((res) => {
-      //   if (res.code == 200) {
-      //     this.$message({
-      //       message: "鎿嶄綔鎴愬姛锛�",
-      //       type: "success",
-      //     });
-      //     this.$refs.editDialog.editDialogVisible = false;
-      //     this.handleGetBomKindDictList();
-      //   }
-      // });
+      savePurchaseType(data).then((res) => {
+        if (res.code == 200) {
+          this.$message({
+            message: "鎿嶄綔鎴愬姛锛�",
+            type: "success",
+          });
+          this.$refs.editDialog.editDialogVisible = false;
+          this.handleGetBomKindDictList(true);
+        }
+      });
     },
     validatorPhone(rule, value, callback) {
       if (value) {
@@ -437,7 +491,6 @@
       });
     },
     saveParams() {
-      debugger
       let data =JSON.parse(JSON.stringify(this.editConfig.infomation));
       let params = {
         productList:this.tableData,
@@ -445,11 +498,17 @@
           supplierId:this.supplierId||0,
           signingDate:data.signingDate||'',
           remark:data.remark,
-          purchaseTypeId:this.purchaseTypeId||0,
+          orderSource:data.orderSource||'',
+          purchaseTypeId:data.purchaseTypeId||0,
           phone:data.phone||'',
           name:data.name||'',
           deliveryDate:data.deliveryDate||'',
-          contact:data.contact
+          contact:data.contact,
+          wholeDiscountType:data.wholeDiscountType,
+          wholeDiscount:Number(data.wholeDiscount),
+          priceAdjustmentType:data.priceAdjustmentType,
+          priceAdjustment:Number(data.priceAdjustment),
+          realTotalPrice:data.realTotalPrice||'',
         }
       };
       if(data.ID){
@@ -530,6 +589,7 @@
           {
             label: "浜у搧鍚嶇О",
             prop: "name",
+            min: 170,
             productName: true,
             isRequird: true,
           },
@@ -547,6 +607,7 @@
           { label: "鎻忚堪", prop: "remark", input: true },
         ],
       };
+      this.handleGetBomKindDictList(true);
     },
     // 浜у搧鍒楄〃杈撳叆
     inputContent(val, prop, row) {
diff --git a/src/views/purchaseManage/purchase/index.vue b/src/views/purchaseManage/purchase/index.vue
index eca326e..2d3062f 100644
--- a/src/views/purchaseManage/purchase/index.vue
+++ b/src/views/purchaseManage/purchase/index.vue
@@ -21,6 +21,11 @@
           @selCommonClick="selCommonClick"
         >
           <template slot="tableButton">
+            <el-table-column label="鐘舵��" width="120">
+              <template slot-scope="scope">
+               {{ getpurchaseStatus(scope.row.status) }}
+              </template>
+            </el-table-column>
             <el-table-column label="鎿嶄綔" width="120" fixed="right">
               <template slot-scope="scope">
                 <el-button type="text"  size="small" @click="editClick(scope.row)"  style="margin-right: 5px"
@@ -69,7 +74,7 @@
         visible: false,
         infomation: {}
       },
-      search_map: {},
+      search:'',
       editRow:{},
       editConfig: {
         visible: false,
@@ -84,6 +89,17 @@
     this.getData()
   },
   methods: {
+    getpurchaseStatus(val) {
+      if (val) {
+        for (let i in this.purchaseStatusList) {
+          if (this.purchaseStatusList[i].id == val) {
+            return this.purchaseStatusList[i].name;
+          }
+        }
+      } else {
+        return "--";
+      }
+    },
     setTable() {
       this.tableList = {
         tableInfomation: [],
@@ -91,20 +107,19 @@
         tableColumn: [
           { label: "閲囪喘鍗曞彿", prop: "number", min: 150, isCommonClick: true },
           { label: "閲囪喘鍗曞悕绉�", prop: "name", min: 130, isCommonClick: true},
-          { label: "鍗曟嵁绫诲瀷", prop: "contact_name", min: 130 },
+          { label: "鍗曟嵁绫诲瀷", prop: "orderType", min: 130 },
           { label: "渚涘簲鍟嗗悕绉�", prop: "contact", min: 130 },
-          { label: "閲囪喘鏁伴噺", prop: "sales_resources", min: 130 },
-          { label: "鏀惰揣浠撳簱", prop: "province", min: 130 },
-          { label: "缁忓姙浜�", prop: "city", min: 130 },
-          { label: "鍒跺崟浜�", prop: "member_name", min: 130 },
-          { label: "鐘舵��", prop: "member_name", min: 130 },
+          { label: "閲囪喘鏁伴噺", prop: "quantity", min: 130 },
+          { label: "鏀惰揣浠撳簱", prop: "warehouse", min: 130 },
+          { label: "缁忓姙浜�", prop: "handledBy", min: 130 },
+          { label: "鍒跺崟浜�", prop: "creator", min: 130 },
         ]
       }
     },
     // 璇锋眰鏁版嵁
     async getData() {
       await getPurchaseList({
-        keyword: this.search_map,
+        keyword: this.search,
         page: this.pagerOptions.currPage,
         pageSize: this.pagerOptions.pageSize
       })
@@ -122,13 +137,11 @@
     // 鎼滅储
     searchClick(val, content) {
       console.log(val, content)
-      this.search_map = {
-        [val.value]: content
-      }
+      this.search =  content
       this.getData()
     },
     resetClick() {
-      this.search_map = {}
+      this.search = ''
       this.getData()
     },
     // 鏂板缓
@@ -139,14 +152,16 @@
       this.editConfig.title = "鍒涘缓"
       this.editConfig.infomation = {
         productList:[],
+        purchaseTypeId:'',
         supplierId:'',
+        supplierName:'',
+        orderSource:'鎵嬪姩鍒涘缓',
+        name:'',
+        contact:'',
+        phone:'',
           signingDate:'',
-          remark:'',
-          purchaseTypeId:'',
-          phone:'',
-          name:'',
           deliveryDate:'',
-          contact:''
+          remark:'',
        }
     },
     
@@ -158,7 +173,8 @@
           this.editConfig.title = "缂栬緫"
           this.editConfig.infomation = { 
             productList:res.data.productList,
-            ...res.data.purchase
+            supplierName:res.data.purchase.supplier.name,
+            ...res.data.purchase,
            }
         }else{
           this.$message.error(res.msg?res.msg+',':''+'鑾峰彇淇℃伅澶辫触锛�')
diff --git a/src/views/purchaseManage/quality/index.vue b/src/views/purchaseManage/quality/index.vue
index 9a987ef..68dc484 100644
--- a/src/views/purchaseManage/quality/index.vue
+++ b/src/views/purchaseManage/quality/index.vue
@@ -16,9 +16,13 @@
           ref="tableListRef"
           :table-list="tableList"
           @selCommonClick="selCommonClick"
-          @getSelectArray="getSelectArray"
         >
           <template slot="tableButton">
+            <el-table-column label="鐘舵��" width="120">
+              <template slot-scope="scope">
+               {{ getQualityStatus(scope.row.member_name) }}
+              </template>
+            </el-table-column>
             <el-table-column label="鎿嶄綔" width="120" fixed="right">
               <template slot-scope="scope">
                 <el-button  @click="qualityClick(scope.row)" type="text" size="small">鍘昏川妫�</el-button>
@@ -41,9 +45,11 @@
 
 <script>
 import pageMixin from "@/components/makepager/pager/mixin/pageMixin"
-import { getSalesLeadsList, getDeleteSalesLeads } from "@/api/client/salesLead"
+import {
+  getPurchaseList,getPurchaseInfo,submitPurchase, 
+} from "@/api/purchaseManage/purchase";
 import DetailSupplier from "@/views/purchaseManage/quality/DetailSupplier"
-
+import { getDataByType } from "@/api/data";
 export default {
   name: "SupplierManage",
   props: {},
@@ -58,7 +64,8 @@
         visible: false,
         infomation: {}
       },
-      search_map: {}
+      search: {},
+      qualityStatusList:getDataByType('qualityStatus'),
     }
   },
   created() {
@@ -66,6 +73,17 @@
     this.getData()
   },
   methods: {
+    getQualityStatus(val) {
+      if (val) {
+        for (let i in this.qualityStatusList) {
+          if (this.qualityStatusList[i].id == val) {
+            return this.qualityStatusList[i].name;
+          }
+        }
+      } else {
+        return "--";
+      }
+    },
     setTable() {
       this.tableList = {
         tableInfomation: [],
@@ -78,30 +96,22 @@
           { label: "鍒拌揣浠撳簱", prop: "sales_resources", min: 130 },
           { label: "璐ㄦ鏁伴噺", prop: "province", min: 130 },
           { label: "妫�楠屽憳", prop: "city", min: 130 },
-          { label: "鐘舵��", prop: "member_name", min: 110 },
+          // { label: "鐘舵��", prop: "member_name", min: 110 },
           { label: "璐ㄦ鏃堕棿", prop: "member_name", min: 150 },
         ]
       }
     },
     // 璇锋眰鏁版嵁
     async getData() {
-      await getSalesLeadsList({
-        search_map: this.search_map,
+      await getPurchaseList({
+        keyword: this.search,
         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
-            }
-          })
+          const list = res.data.data.list
           this.tableList.tableInfomation = list || []
-          this.pagerOptions.totalCount = res.data.count
+          this.pagerOptions.totalCount = res.data.data.total
         })
         .catch((err) => {
           console.log(err)
@@ -110,13 +120,11 @@
     // 鎼滅储
     searchClick(val, content) {
       console.log(val, content)
-      this.search_map = {
-        [val.value]: content
-      }
+      this.search = content
       this.getData()
     },
     resetClick() {
-      this.search_map = {}
+      this.search = ''
       this.getData()
     },
    
@@ -129,7 +137,7 @@
         })
           .then(() => {
             console.log("dddd")
-            getDeleteSalesLeads({ ids: this.selValueList }).then((response) => {
+            submitPurchase({ ids: this.selValueList }).then((response) => {
               if (response.code === 200) {
                 this.$message.success("纭鍙戣揣鎴愬姛")
                 this.getData()
@@ -140,18 +148,21 @@
           })
           .catch(() => {})
     },
-    getSelectArray(val) {
-      this.selValueList = []
-      const list = val.map((item) => {
-        return item.id
-      })
-      this.selValueList = list
-    },
+   
     // 璇︽儏
     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/src/views/purchaseManage/returned/index.vue b/src/views/purchaseManage/returned/index.vue
index f5d798d..3554cf8 100644
--- a/src/views/purchaseManage/returned/index.vue
+++ b/src/views/purchaseManage/returned/index.vue
@@ -17,9 +17,13 @@
           ref="tableListRef"
           :table-list="tableList"
           @selCommonClick="selCommonClick"
-          @getSelectArray="getSelectArray"
         >
           <template slot="tableButton">
+            <el-table-column label="鐘舵��" width="120">
+              <template slot-scope="scope">
+               {{ getReturnedStatus(scope.row.member_name) }}
+              </template>
+            </el-table-column>
             <el-table-column label="鎿嶄綔" width="120">
               <template slot-scope="scope">
                 <el-button  @click="confirmClick(scope.row)" type="text" size="small">纭鍙戣揣</el-button>
@@ -42,9 +46,11 @@
 
 <script>
 import pageMixin from "@/components/makepager/pager/mixin/pageMixin"
-import { getSalesLeadsList, getDeleteSalesLeads } from "@/api/client/salesLead"
+import {
+  getPurchaseList,getPurchaseInfo,submitPurchase, 
+} from "@/api/purchaseManage/purchase";
 import DetailSupplier from "@/views/purchaseManage/returned/DetailSupplier"
-
+import { getDataByType } from "@/api/data";
 export default {
   name: "SupplierManage",
   props: {},
@@ -59,7 +65,8 @@
         visible: false,
         infomation: {}
       },
-      search_map: {}
+      search: '',
+      returnedStatusList:getDataByType('returnedStatus'),
     }
   },
   created() {
@@ -67,6 +74,17 @@
     this.getData()
   },
   methods: {
+    getReturnedStatus(val) {
+      if (val) {
+        for (let i in this.returnedStatusList) {
+          if (this.returnedStatusList[i].id == val) {
+            return this.returnedStatusList[i].name;
+          }
+        }
+      } else {
+        return "--";
+      }
+    },
     setTable() {
       this.tableList = {
         tableInfomation: [],
@@ -81,29 +99,21 @@
           { label: "缁忓姙浜�", prop: "city", min: 130 },
           { label: "鍒跺崟浜�", prop: "member_name", min: 130 },
           { label: "閫�璐ф棩鏈�", prop: "member_name", min: 150 },
-          { label: "鐘舵��", prop: "member_name", min: 110 }
+          // { label: "鐘舵��", prop: "member_name", min: 110 }
         ]
       }
     },
     // 璇锋眰鏁版嵁
     async getData() {
-      await getSalesLeadsList({
-        search_map: this.search_map,
+      await getPurchaseList({
+        keyword: this.search,
         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
-            }
-          })
+          const list = res.data.data.list
           this.tableList.tableInfomation = list || []
-          this.pagerOptions.totalCount = res.data.count
+          this.pagerOptions.totalCount = res.data.total
         })
         .catch((err) => {
           console.log(err)
@@ -112,13 +122,12 @@
     // 鎼滅储
     searchClick(val, content) {
       console.log(val, content)
-      this.search_map = {
-        [val.value]: content
-      }
+      this.search =  content
+  
       this.getData()
     },
     resetClick() {
-      this.search_map = {}
+      this.search = ''
       this.getData()
     },
    
@@ -131,7 +140,7 @@
         })
           .then(() => {
             console.log("dddd")
-            getDeleteSalesLeads({ ids: this.selValueList }).then((response) => {
+            submitPurchase({ ids: this.selValueList }).then((response) => {
               if (response.code === 200) {
                 this.$message.success("纭鍙戣揣鎴愬姛")
                 this.getData()
@@ -142,18 +151,21 @@
           })
           .catch(() => {})
     },
-    getSelectArray(val) {
-      this.selValueList = []
-      const list = val.map((item) => {
-        return item.id
-      })
-      this.selValueList = list
-    },
+    
     // 璇︽儏
     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+',':''+'鑾峰彇淇℃伅澶辫触锛�')
+        }
+      })
     }
   }
 }

--
Gitblit v1.8.0