戴艳蓉 3 years ago
parent
commit
00d5d48baa

+ 6 - 0
src/apis/components/addr-add-edit-modal.js

@@ -0,0 +1,6 @@
+import http from "@/apis/axios";
+const api = "admin/";
+export default {
+  // 区编码获取省市区汉字
+  addrall: (data, params) => http(api + "addrall", data, "post", params),
+};

+ 3 - 1
src/apis/service/sellOut/zixunOrder/index.js

@@ -26,5 +26,7 @@ export default {
   // 咨询单选定商品
   bidscheck: (data, params) => http(api + "bidscheck", data, "post", params),
   // 咨询商品下单
-  consultorder: (data, params) => http(api + "bidscheck", data, "post", params),
+  consultorder: (data, params) => http(api + "consultorder", data, "post", params),
+  // 区编码获取省市区汉字
+  addrall: (data, params) => http(api + "addrall", data, "post", params),
 };

+ 24 - 38
src/components/addr-add-edit-modal/index.vue

@@ -82,6 +82,7 @@
 <script>
 import { isnumber, isMobile } from "@/utils/validate";
 import { province_list, city_list, county_list } from "@/assets/js/area-data";
+import asyncRequest from "@/apis/components/addr-add-edit-modal";
 export default {
   name: "AddrAddEditModal",
   props: ["showModel", "index", "sitem", "type"],
@@ -129,7 +130,6 @@ export default {
       },
       rulesThis: this.rules,
       rules: {
-    
         receipt_quantity: [
           {
             required: true,
@@ -247,48 +247,34 @@ export default {
       });
     },
     //省市区选择
-    select_area_change(e) {
+    async select_area_change(e) {
       this.ruleForm.addr_code = e;
       this.$refs.ruleForm.validateField("addr_code");
 
-      if (e && e.length === 3) {
-        let item = this.get_name(e[0], e[1], e[2]);
-        this.ruleForm.addr_code_name = item.name;
-      } else {
-        this.ruleForm.addr_code_name = "";
-      }
-    },
-    get_name(code1, code2, code3) {
-       let name = "",
-        code = [];
-      if (code1 && code2 && code3) {
-        for (let x in province_list) {
-          if (code1 === x) {
-            code.push(x);
-            name += province_list[x];
-            break;
-          }
-        }
-        if (code.length === 1) {
-          for (let y in city_list) {
-            if (code2 === y) {
-              code.push(y);
-              name += "/" + city_list[y];
-              break;
-            }
-          }
-        }
-        if (code.length === 2) {
-          for (let z in county_list) {
-            if (code3 === z) {
-              code.push(z);
-              name += "/" + county_list[z];
-              break;
-            }
-          }
+      const { addr_code } = this.ruleForm;
+      if (addr_code && addr_code.length === 3) {
+        let arrCode = addr_code[addr_code.length - 1];
+        // console.log(model);
+        let { code, data, message } = await asyncRequest.addrall({
+          code: arrCode,
+        });
+        if (code === 0) {
+          const { province, city, area } = data;
+          let province_name = province && province.name ? province.name : "";
+          let city_name = city && city.name ? city.name : "";
+          let area_name = area && area.name ? area.name : "";
+          this.addrForm.addr_code_name =
+            province_name && city_name && area_name
+              ? `${province_name}/${city_name}/${area_name}`
+              : "";
+        } else if (code >= 100 && code <= 104) {
+          await this.logout();
+        } else {
+          this.$message.warning(message);
         }
+      } else {
+        this.addrForm.addr_code_name = "";
       }
-      return { name: name, code: code };
     },
     get_code(name1, name2, name3) {
       let name = "",

+ 1 - 0
src/components/in-addr-model/index.vue

@@ -398,6 +398,7 @@ export default {
         this.loading = false;
         this.showModelThis = false;
         let list = JSON.parse(JSON.stringify(order_addr));
+        console.log(list);
         this.$emit("refresh", { list: list });
       }
     },

+ 2 - 1
src/views/sellOut/zixunOrder/components/addEditBargain.vue

@@ -176,11 +176,12 @@ export default {
     async resetForm() {
       // 重置
       await this.$nextTick(() => {
+        const { sale_price } = this.sitem;
         if (this.$refs.ruleForm) {
           this.$refs.ruleForm.resetFields();
           this.$refs.ruleForm.clearValidate();
           this.ruleForm = {
-            bargain_price: "0",
+            bargain_price: sale_price || "0",
           };
         }
       });

+ 42 - 17
src/views/sellOut/zixunOrder/components/buyGoodModal.vue

@@ -114,9 +114,10 @@
               border
               :size="'mini'"
               style="width: 100%"
-              height="300px"
+              max-height="300px"
               row-key="key"
             >
+              <el-table-column type="index" width="80" show-overflow-tooltip />
               <el-table-column
                 prop="receipt_quantity"
                 label="收货总数"
@@ -211,7 +212,9 @@
                       @selectChange="select_area_change($event, scope.$index)"
                     />
                   </el-form-item>
-                  <span v-if="!scope.row.edit">{{ scope.row.addr_code }}</span>
+                  <span v-if="!scope.row.edit">{{
+                    scope.row.addr_code_name
+                  }}</span>
                 </template>
               </el-table-column>
               <el-table-column
@@ -233,7 +236,7 @@
                       :disabled="!scope.row.edit"
                     />
                   </el-form-item>
-                  <span v-if="!scope.row.edit">{{ scope.row.addr_code }}</span>
+                  <span v-if="!scope.row.edit">{{ scope.row.addr }}</span>
                 </template>
               </el-table-column>
 
@@ -503,11 +506,6 @@ export default {
       this.addrForm.order_addr.push(...list);
     },
 
-    // refresh(e) {
-    //   this.showModelThis = e;
-    //   this.$emit("refresh", true);
-    // },
-
     getNewTime() {
       this.newTime = new Date().valueOf();
     },
@@ -556,8 +554,32 @@ export default {
       }
     },
     //省市区选择
-    select_area_change(e, index) {
+    async select_area_change(e, index) {
       this.addrForm.order_addr[index].addr_code = e;
+      const { addr_code } = this.addrForm.order_addr[index];
+      if (addr_code && addr_code.length === 3) {
+        let arrCode = addr_code[addr_code.length - 1];
+        // console.log(model);
+        let { code, data, message } = await asyncRequest.addrall({
+          code: arrCode,
+        });
+        if (code === 0) {
+          const { province, city, area } = data;
+          let province_name = province && province.name ? province.name : "";
+          let city_name = city && city.name ? city.name : "";
+          let area_name = area && area.name ? area.name : "";
+          this.addrForm.order_addr[index].addr_code_name =
+            province_name && city_name && area_name
+              ? `${province_name}/${city_name}/${area_name}`
+              : "";
+        } else if (code >= 100 && code <= 104) {
+          await this.logout();
+        } else {
+          this.$message.warning(message);
+        }
+      } else {
+        this.addrForm.order_addr[index].addr_code_name = "";
+      }
     },
     //省市区保存某一行
     checkRow(rowIndex) {
@@ -579,21 +601,23 @@ export default {
         if (valid) {
           this.loading = true;
           let model = JSON.parse(JSON.stringify(this.ruleForm));
-          const { sendtype } = model;
+          model.order_addr = [];
+          const { sendtype, good_num } = model;
           const { order_addr } = JSON.parse(JSON.stringify(this.addrForm));
           if (sendtype === "2" && order_addr && order_addr.length === 0) {
             this.$message.warning("至少上传一个地址信息!");
             this.loading = false;
             return;
           }
-          let isAEdit = false;
+          let addrT = 0,
+            isAEdit = false;
           order_addr.forEach((v2) => {
             if (v2.edit) {
               isAEdit = true;
             }
-            addrT += parseInt(v2.receipt_quantity);
+            addrT += parseInt(v2.receipt_quantity + "");
             let model2 = {
-              addr_code: v2.addr_code,
+              addr_code: v2.addr_code.toString(),
               contactor: v2.contactor,
               mobile: v2.mobile,
               addr: v2.addr,
@@ -607,12 +631,13 @@ export default {
             this.loading = false;
             return;
           }
-
-          this.loading = false;
+          if (parseInt(good_num + "") !== addrT) {
+            this.$message.warning("收货总数量与购买不一致!");
+            this.loading = false;
+            return;
+          }
           console.log(model);
-          return;
           let res = await asyncRequest.consultorder(model);
-
           this.loading = false;
           if (res && res.code === 0) {
             this.$notify.success({

+ 11 - 55
src/views/sellOut/zixunOrder/components/feedbackList.vue

@@ -103,7 +103,9 @@
             (scope.row === '0' ||
               scope.row.status === '1' ||
               scope.row.status === '2' ||
-              scope.row.status === '5')
+              scope.row.status === '5') &&
+            status == '3'
+         
           "
           effect="dark"
           content="选择该商品"
@@ -120,7 +122,8 @@
             powers.length > 0 &&
             powers.some((item) => item == '070') &&
             is_project === '0' &&
-            scope.row.status === '6'
+            scope.row.status === '6' &&
+            status == '4'
           "
           effect="dark"
           content="下单"
@@ -143,7 +146,7 @@
       :showModel="bayGoodShowModel"
       :sitem="bayGoodItem"
       @cancel="bayGoodShowModel = false"
-      @refresh="(bayGoodShowModel = false), searchList()"
+      @refresh="(bayGoodShowModel = false), $emit('resGoodOk')"
     />
   </div>
 </template>
@@ -184,6 +187,7 @@ export default {
       wantBsitem: "",
       select: "1",
       s_input: "",
+      status: "",
       bayGoodShowModel: false,
       bayGoodItem: {},
       is_project: false,
@@ -243,61 +247,13 @@ export default {
       },
       // 表格 - 列参数
       columns: feedbackListCol,
-      serviceOptions: [
-        {
-          value: "0",
-          label: "待审核",
-        },
-        {
-          value: "1",
-          label: "待物流反馈",
-        },
-        {
-          value: "2",
-          label: "待退货",
-        },
-        {
-          value: "3",
-          label: "已退货",
-        },
-      ],
-      serviceValue: "", //售后申请处理状态
-      expectOptions: [
-        {
-          value: "1",
-          label: "退货",
-        },
-        {
-          value: "2",
-          label: "换货",
-        },
-        {
-          value: "3",
-          label: "改变售价",
-        },
-      ],
-      expectValue: "", //期望意愿
-      resultOptions: [
-        {
-          value: "ad",
-          label: "处理中",
-        },
-        {
-          value: "选项2",
-          label: "已同意",
-        },
-        {
-          value: "选项2",
-          label: "已驳回",
-        },
-      ],
-      resultValue: "", //处理结果
     };
   },
   mounted() {
     console.log(this.sitem);
-    const { is_project } = this.sitem;
+    const { is_project, status } = this.sitem;
     this.is_project = is_project;
+    this.status = status;
     this.searchList();
   },
 
@@ -410,13 +366,13 @@ export default {
         });
     },
     buy_goods(row) {
-      const { company, khname, platform_name, arrival_time,num } = this.sitem;
+      const { company, khname, platform_name, arrival_time, num } = this.sitem;
       this.bayGoodItem = JSON.parse(JSON.stringify(row));
       this.bayGoodItem.in_company = company;
       this.bayGoodItem.in_khname = khname;
       this.bayGoodItem.in_platform_name = platform_name;
       this.bayGoodItem.in_arrival_time = arrival_time;
-      this.bayGoodItem.in_num=num 
+      this.bayGoodItem.in_num = num;
       this.bayGoodShowModel = true;
       // console.log(row);
     },