Bladeren bron

添加项目经理组件

xiaodai2022 1 jaar geleden
bovenliggende
commit
04c7efe0a0

+ 7 - 0
src/apis/components/project-manager.js

@@ -0,0 +1,7 @@
+import http from '@/apis/axios'
+const api = 'admin/'
+export default {
+  // 列表
+  list: (data, params) => http(api + 'user_role_list', data, 'post', params)
+}
+

+ 2 - 0
src/components/globalComponents/project-manager/index.js

@@ -0,0 +1,2 @@
+import Main from './main.vue'
+export default Main

+ 190 - 0
src/components/globalComponents/project-manager/main.vue

@@ -0,0 +1,190 @@
+<template>
+  <div class="project-manager">
+    <el-select
+      class="p-slesct"
+      v-model="value"
+      multiple
+      filterable
+      remote
+      clearable
+      collapse-tags
+      :multiple-limit="1"
+      reserve-keyword
+      :size="size || 'medium'"
+      placeholder="项目经理"
+      :disabled="disabled"
+      :remote-method="remoteMethod"
+      :loading="selectLoading"
+      @change="selectChange"
+    >
+      <el-option
+        v-for="(item, index) in options"
+        :key="item.id + index"
+        :label="item.nickname"
+        :value="item.id + ''"
+        :disabled="item.status + '' !== '1'"
+      />
+    </el-select>
+    <el-button
+      :size="size || 'medium'"
+      class="p-btn"
+      @click="changeMe"
+      :disabled="loading"
+      >选当前账号</el-button
+    >
+  </div>
+</template>
+
+<script>
+import asyncRequest from "@/apis/components/project-manager";
+import resToken from "@/mixins/resToken";
+import { mapGetters } from "vuex";
+
+export default {
+  name: "ProjectManager",
+  mixins: [resToken],
+  computed: {
+    ...mapGetters(["currentCompany"]),
+    infoPowers() {
+      return this.$store.getters.userInfo;
+    },
+  },
+  props: ["size", "value", "isDetail", "disabled", "names"],
+  /**
+   * 属性集合
+   * @param {String}        size             : 组件大小            非必填
+   * @param {Array}         value            : 选中值              必填
+   * @param {String}        placeholder      : 提示信息            非必填
+   * @param {Boolean}       isDetail          : 是否是详情逻辑       必填
+   * @param {Boolean}       disabled         : 是否禁用            必填
+   * @param {String}        names            : 选中值label         展示详情必填
+   * @param {String}        type             : 数据类型            非必填 1是平台供应商0非平台供应商
+   */
+  /**
+   * 事件集合
+   * @searchChange             : 选中值变化调用   抛出选中数据
+   */
+  data() {
+    return {
+      loading: false,
+      options: [],
+      selectLoading: false,
+      searchName: "",
+      formValue: {
+        page: 1,
+        size: 99999,
+        status: "",
+      },
+    };
+  },
+  watch: {
+    names: function (val, old) {
+      // console.log(val, old, this.isDetail, "1");
+      this.searchName = val;
+      if (this.isDetail && this.searchName) {
+        this.remoteMethod(this.searchName);
+      }
+    },
+    isDetail: function (val, old) {
+      // console.log(val, old, this.isDetail, "2");
+      if (val && this.searchName) {
+        this.remoteMethod(this.searchName);
+      }
+    },
+  },
+  mounted() {
+    this.options = [];
+    this.selectLoading = false;
+  },
+  methods: {
+    async changeMe() {
+      if (this.loading) return;
+      this.loading = true;
+      const id = this.infoPowers.id ?? "";
+      const userName = this.infoPowers.nickname ?? "";
+      if (userName === "") {
+        this.loading = false;
+        this.$message.warning("当前账号异常,请重新登录!");
+        return;
+      }
+      await this.getList(userName);
+      let index = this.options.findIndex((s) => s.id === id);
+      if (index === -1) {
+        this.loading = false;
+        this.$message.warning("当前业务公司下,未找到当前账号!");
+        return;
+      }
+      const model = {
+        id: this.options[index].id + "",
+        label: this.options[index].nickname,
+      };
+      this.$emit("searchChange", model);
+      this.loading = false;
+    },
+    async selectChange(e) {
+      if (e && e.length > 0) {
+        const index = this.options.findIndex((v) => v.id + "" === e[0]);
+        if (index !== -1) {
+          const model = {
+            id: this.options[index].id + "",
+            label: this.options[index].nickname,
+          };
+          this.$emit("searchChange", model);
+        } else {
+          this.$emit("searchChange", {});
+        }
+      } else {
+        this.$emit("searchChange", {});
+      }
+    },
+    async remoteMethod(query) {
+      if (query !== "") {
+        await this.getList(query);
+      } else {
+        this.options = [];
+      }
+    },
+    async getList(query) {
+      if (this.selectLoading) return;
+      this.selectLoading = true;
+      this.options = [];
+      const { code, data, message } = await asyncRequest.list({
+        ...this.formValue,
+        nickname: query,
+        companyNo: this.currentCompany,
+      });
+      if (code === 0) {
+        const { list } = data;
+        this.options = list;
+      } else if (code >= 100 && code <= 104) {
+        await this.logout();
+      } else {
+        this.$message.warning(message);
+      }
+      this.selectLoading = false;
+    },
+  },
+};
+</script>
+
+<style>
+.project-manager {
+  width: 100%;
+  .p-btn {
+    width: 80px;
+    float: left;
+
+    padding-left: 0;
+    padding-right: 0;
+    font-size: 12px;
+    background-color: #f5f7fa;
+    color: #909399;
+    border: 1px solid #dcdfe6;
+    border-left-width: 0;
+  }
+  .p-slesct {
+    float: left;
+    width: calc(100% - 80px);
+  }
+}
+</style>

+ 0 - 0
src/components/globalComponents/project-manager/项目经理


+ 221 - 192
src/views/sellOut/project/components/buyGoodModal.vue

@@ -16,6 +16,7 @@
   >
     <el-card style="margin-top: -20px">
       <el-row>
+        <!-- <el-col :span="24">{{ infoPowers }}</el-col> -->
         <el-col :span="24">
           <show-data-table
             v-if="newTime !== '' && sitem"
@@ -28,6 +29,7 @@
         </el-col>
         <el-col :span="24" style="padding: 10px 0 0 0">
           <span style="line-height: 30px">商品下单:</span>
+
           <el-button-group :size="'mini'" class="fr" style="margin: 0 0 8px 0">
             <el-button
               v-if="total !== 0"
@@ -44,15 +46,25 @@
               class="fr"
               :size="'mini'"
               style="height: 29px"
-            >商品共{{ index + 1 }}/{{ total }}</el-button>
+              >商品共{{ index + 1 }}/{{ total }}</el-button
+            >
             <el-button
               v-if="total !== 0"
               type="primary"
               class="fr"
               :size="'mini'"
               @click="next_goods()"
-            ><i class="el-icon-arrow-right el-icon--right" :size="'mini'" /></el-button>
+              ><i class="el-icon-arrow-right el-icon--right" :size="'mini'"
+            /></el-button>
           </el-button-group>
+          <project-manager
+            :size="'mini'"
+            v-if="index + 1 === total"
+            v-model.value="manager"
+            @searchChange="managerChange"
+            class="fr"
+            style="width: 300px; margin: 0 50px 0 0"
+          />
         </el-col>
         <el-col :span="24">
           <el-table
@@ -83,7 +95,7 @@
                       margin: 0 2px 0 0;
                     "
                     alt=""
-                  >
+                  />
                 </div>
               </template>
             </el-table-column>
@@ -244,7 +256,7 @@
                       :names="scope.row.label"
                       placeholder="收货省市区"
                       :level="3"
-                      @searchChange="areaChange($event,scope.$index)"
+                      @searchChange="areaChange($event, scope.$index)"
                     />
                   </el-form-item>
                   <span v-if="!scope.row.edit">{{ scope.row.addr_code_name }}</span>
@@ -365,9 +377,9 @@
   </el-dialog>
 </template>
 <script>
-import resToken from '@/mixins/resToken'
-import asyncRequest from '@/apis/service/sellOut/project'
-import searchStockGoodModal from '@/components/search-stock-good-modal'
+import resToken from "@/mixins/resToken";
+import asyncRequest from "@/apis/service/sellOut/project";
+import searchStockGoodModal from "@/components/search-stock-good-modal";
 import {
   isnumber,
   isMobile,
@@ -375,389 +387,406 @@ import {
   isEmoticon,
   isSpecialSymbol,
   hasSpace,
-  isAddr
-} from '@/utils/validate'
-import inAddrModel from '@/components/in-addr-model'
-import { ShowDataTableColumns } from './ShowDataTableColumns'
-import { replaceTextWrapAndSpace } from '@/utils'
+  isAddr,
+} from "@/utils/validate";
+import inAddrModel from "@/components/in-addr-model";
+import { ShowDataTableColumns } from "./ShowDataTableColumns";
+import { replaceTextWrapAndSpace } from "@/utils";
 export default {
-  name: 'BuyGoodModal',
+  name: "BuyGoodModal",
   components: { searchStockGoodModal, inAddrModel },
   mixins: [resToken],
-  props: ['showModel', 'sitem'],
+  props: ["showModel", "sitem"],
   data() {
     const validatemobile = (rule, value, callback) => {
-      if (value === '') {
-        callback(new Error('手机号不能为空!'))
+      if (value === "") {
+        callback(new Error("手机号不能为空!"));
       } else {
         if (!isMobile(value)) {
-          callback(new Error('手机号格式不正确!'))
+          callback(new Error("手机号格式不正确!"));
         } else {
-          callback()
+          callback();
         }
       }
-    }
+    };
     const validateWeight = (rule, value, callback) => {
-      if (value === '') {
-        callback(new Error('收货总数不能为空!'))
+      if (value === "") {
+        callback(new Error("收货总数不能为空!"));
       } else {
         if (!isnumber(value)) {
-          callback(new Error('收货总数仅支持整数!'))
+          callback(new Error("收货总数仅支持整数!"));
         } else {
-          callback()
+          callback();
         }
       }
-    }
+    };
     const validatecontactor = (rule, value, callback) => {
-      if (value === '') {
-        callback(new Error('联系人不能为空!'))
+      if (value === "") {
+        callback(new Error("联系人不能为空!"));
       } else {
         if (value.length < 2 || value.length > 10) {
-          callback(new Error('联系人规则为2~10位汉字!'))
+          callback(new Error("联系人规则为2~10位汉字!"));
         } else {
           if (!isChinese(value)) {
-            callback(new Error('联系人规则为2~10位汉字!'))
+            callback(new Error("联系人规则为2~10位汉字!"));
           } else if (isEmoticon(value)) {
-            callback(new Error('联系人规则为2~10位汉字!'))
+            callback(new Error("联系人规则为2~10位汉字!"));
           } else {
-            callback()
+            callback();
           }
         }
       }
-    }
+    };
     const validateAddr = (rule, value, callback) => {
-      if (value === '') {
-        callback(new Error('详细地址不能为空!'))
+      if (value === "") {
+        callback(new Error("详细地址不能为空!"));
       } else {
         if (hasSpace(value)) {
-          callback(new Error('不能出现/回车/换行符!'))
+          callback(new Error("不能出现/回车/换行符!"));
         } else if (isSpecialSymbol(value)) {
-          callback(new Error('不能使用英文特殊字符!'))
+          callback(new Error("不能使用英文特殊字符!"));
         } else if (isAddr(value)) {
-          callback()
+          callback();
         } else {
-          callback(new Error('详细地址填写不规范!'))
+          callback(new Error("详细地址填写不规范!"));
         }
       }
-    }
+    };
     return {
+      manager: [],
+      manager_name: "",
       loading: false,
       addrmodel: false,
       showModelThis: this.showModel,
       showGoodsModel: false,
       ShowDataTableColumns: ShowDataTableColumns,
-      planNo: '',
-      arrtime: '',
+      planNo: "",
+      arrtime: "",
       project_list: [],
       options: [
         {
-          value: '1',
-          label: '有地址下单'
+          value: "1",
+          label: "有地址下单",
         },
         {
-          value: '2',
-          label: '无地址下单'
-        }
+          value: "2",
+          label: "无地址下单",
+        },
       ],
       index: 0,
       total: 0,
       order_good: [],
-      sendtype: '1',
+      sendtype: "1",
       addrForm: {
-        order_addr: [] // 收货地址
+        order_addr: [], // 收货地址
       },
       addrRules: {
         receipt_quantity: [
           {
             required: true,
             validator: validateWeight,
-            trigger: 'blur'
-          }
+            trigger: "blur",
+          },
         ],
 
         contactor: [
           {
             required: true,
-            trigger: 'blur',
-            validator: validatecontactor
-          }
+            trigger: "blur",
+            validator: validatecontactor,
+          },
         ],
         mobile: [
           {
             required: true,
             validator: validatemobile,
-            trigger: 'blur'
-          }
+            trigger: "blur",
+          },
         ],
 
         addr_code: [
           {
-            type: 'array',
+            type: "array",
             required: false,
-            trigger: 'change'
-          }
+            trigger: "change",
+          },
         ],
         addr: [
           {
             required: true,
             validator: validateAddr,
-            trigger: 'blur'
-          }
-        ]
+            trigger: "blur",
+          },
+        ],
       },
 
       loading: false,
-      id: ''
-    }
+      id: "",
+    };
   },
   watch: {
-    showModel: function(val) {
-      this.showModelThis = val
+    showModel: function (val) {
+      this.showModelThis = val;
       if (val) {
-        // this.initForm()
+        this.initForm();
       }
     },
     showModelThis(val) {
       if (!val) {
-        this.$emit('cancel')
+        this.$emit("cancel");
       }
-    }
+    },
   },
   methods: {
     closeModel() {
-      console.log('closeModel!!')
-      this.showModelThis = false
+      console.log("closeModel!!");
+      this.showModelThis = false;
+    },
+    managerChange(e) {
+      const { id, label } = e;
+      this.manager = id ? [id] : [];
+      this.manager_name = label ?? "";
     },
     async initForm() {
-      this.loading = true
-      this.project_list = []
-      console.log(this.sitem)
-      const { planNo, in_arrival_time, feedback } = this.sitem
-      this.planNo = planNo || ''
-      this.arrtime = in_arrival_time || ''
-      const goods = JSON.parse(JSON.stringify(feedback))
+      this.loading = true;
+      this.project_list = [];
+      console.log(this.sitem);
+      const { planNo, in_arrival_time, feedback } = this.sitem;
+      this.planNo = planNo || "";
+      this.arrtime = in_arrival_time || "";
+      const goods = JSON.parse(JSON.stringify(feedback));
       if (goods && goods.length > 0) {
         goods.forEach((e) => {
-          e.sendtype = '1'
-          const model = JSON.parse(JSON.stringify(e))
+          e.sendtype = "1";
+          const model = JSON.parse(JSON.stringify(e));
           const item = {
             order_good: [model],
-            order_addr: []
-          }
-          this.project_list.push(item)
-        })
+            order_addr: [],
+          };
+          this.project_list.push(item);
+        });
       }
-      this.index = 0
-      this.total = this.project_list.length
-      await this.resetForm(this.index)
-      this.getNewTime()
-      this.loading = false
+      this.index = 0;
+      this.total = this.project_list.length;
+      console.log(this.project_list);
+      await this.resetForm(this.index);
+      this.getNewTime();
+      this.loading = false;
     },
     addrRefresh(e) {
-      const list = JSON.parse(JSON.stringify(e.list))
-      list.forEach(item => {
-        item.label = [item.label]
-        item.code = [item.areaCode]
-      })
-      this.addrForm.order_addr.push(...list)
+      const list = JSON.parse(JSON.stringify(e.list));
+      list.forEach((item) => {
+        item.label = [item.label];
+        item.code = [item.areaCode];
+      });
+      this.addrForm.order_addr.push(...list);
     },
     async prev_goods() {
-      this.index--
-      await this.resetForm(this.index)
+      this.index--;
+      await this.resetForm(this.index);
     },
     async next_goods() {
-      const { order_addr } = this.addrForm
-      const { num } = this.order_good[0]
-      let ta = 0
-      if (this.sendtype + '' === '1' && order_addr && order_addr.length === 0) {
-        this.$message.warning('直接发货需要录入地址!')
-        return
+      const { order_addr } = this.addrForm;
+      const { num } = this.order_good[0];
+      let ta = 0;
+      if (this.sendtype + "" === "1" && order_addr && order_addr.length === 0) {
+        this.$message.warning("直接发货需要录入地址!");
+        return;
       }
-      let isedit = false
+      let isedit = false;
       order_addr.forEach((e) => {
-        ta += e.receipt_quantity * 1
+        ta += e.receipt_quantity * 1;
         if (e.edit) {
-          isedit = true
+          isedit = true;
         }
-      })
+      });
       if (isedit) {
-        this.$message.warning('当前已有地址在编辑,请保存后再试!')
-        return
+        this.$message.warning("当前已有地址在编辑,请保存后再试!");
+        return;
       }
-      if (this.sendtype + '' === '1' && ta !== parseInt(num + '')) {
-        this.$message.warning('收货数量总数与购买数量总数不一致!')
-        return
+      if (this.sendtype + "" === "1" && ta !== parseInt(num + "")) {
+        this.$message.warning("收货数量总数与购买数量总数不一致!");
+        return;
       }
 
-      this.project_list[this.index].order_good[0].sendtype = this.sendtype
+      this.project_list[this.index].order_good[0].sendtype = this.sendtype;
       this.project_list[this.index].order_addr =
         this.addrForm.order_addr.length === 0
           ? []
-          : JSON.parse(JSON.stringify(this.addrForm.order_addr))
+          : JSON.parse(JSON.stringify(this.addrForm.order_addr));
       if (this.index + 1 === this.total) {
-        this.submitForm()
+        if (this.manager.length === 0) {
+          this.$message.warning("请选择项目经理");
+          return;
+        }
+        this.submitForm();
       } else {
-        this.index++
+        this.index++;
 
-        await this.resetForm(this.index)
+        await this.resetForm(this.index);
       }
     },
 
     getNewTime() {
-      this.newTime = new Date().valueOf()
+      this.newTime = new Date().valueOf();
     },
     sendtype_change(e, index) {
-      this.order_good[index].sendtype = e
-      this.sendtype = this.order_good[index].sendtype
+      this.order_good[index].sendtype = e;
+      this.sendtype = this.order_good[index].sendtype;
     },
 
     async resetForm(index) {
       // 重置
       await this.$nextTick(() => {
         if (this.$refs.addrForm) {
-          this.$refs.addrForm.resetFields()
-          this.$refs.addrForm.clearValidate()
+          this.$refs.addrForm.resetFields();
+          this.$refs.addrForm.clearValidate();
         }
-        const list1 = this.project_list[index].order_good
-        this.order_good = list1.length > 0 ? JSON.parse(JSON.stringify(list1)) : []
+        const list1 = this.project_list[index].order_good;
+        this.order_good = list1.length > 0 ? JSON.parse(JSON.stringify(list1)) : [];
 
-        this.order_good[0].good_img = this.order_good[0].good_img.split(',')
-        const list2 = this.project_list[index].order_addr
+        this.order_good[0].good_img = this.order_good[0].good_img.split(",");
+        const list2 = this.project_list[index].order_addr;
         this.addrForm.order_addr =
-          list2.length > 0 ? JSON.parse(JSON.stringify(list2)) : []
-        this.sendtype = this.order_good[0].sendtype
-      })
+          list2.length > 0 ? JSON.parse(JSON.stringify(list2)) : [];
+        this.sendtype = this.order_good[0].sendtype;
+      });
     },
     openHouseModal(index) {
-      const findex = this.addrForm.order_addr.findIndex((v) => v.edit === true)
+      const findex = this.addrForm.order_addr.findIndex((v) => v.edit === true);
       if (findex !== -1) {
-        this.$message.warning('当前已有地址在编辑,请保存后再试!')
-        return
+        this.$message.warning("当前已有地址在编辑,请保存后再试!");
+        return;
       } else {
         if (index === -1) {
           this.addrForm.order_addr.push({
             edit: true,
-            receipt_quantity: '',
-            contactor: '',
-            mobile: '',
+            receipt_quantity: "",
+            contactor: "",
+            mobile: "",
             addr_code: [],
-            addr: '',
+            addr: "",
             code: [],
-            label: []
-          })
+            label: [],
+          });
         } else {
-          this.addrForm.order_addr[index].edit = true
+          this.addrForm.order_addr[index].edit = true;
         }
       }
     },
     async areaChange(e, index) {
-      const { code, area_code, label, splitLabel } = e
+      const { code, area_code, label, splitLabel } = e;
       // this.addrForm.order_addr[index] = e
-      this.addrForm.order_addr[index].addr_code_name = splitLabel ? splitLabel.split(',').join('/') : ''
-      this.addrForm.order_addr[index].addr_code = code ? code.split(',') : []
-      this.addrForm.order_addr[index].code = area_code ? [area_code] : []
-      this.addrForm.order_addr[index].label = label ? [label] : []
+      this.addrForm.order_addr[index].addr_code_name = splitLabel
+        ? splitLabel.split(",").join("/")
+        : "";
+      this.addrForm.order_addr[index].addr_code = code ? code.split(",") : [];
+      this.addrForm.order_addr[index].code = area_code ? [area_code] : [];
+      this.addrForm.order_addr[index].label = label ? [label] : [];
 
-      console.log(this.addrForm.order_addr)
+      console.log(this.addrForm.order_addr);
       // this.$refs.ruleForm.validateField('addr_code')
     },
     // 省市区选择
     async select_area_change(e, index) {
-      this.addrForm.order_addr[index].addr_code = e
-      const { addr_code } = this.addrForm.order_addr[index]
+      this.addrForm.order_addr[index].addr_code = e;
+      const { addr_code } = this.addrForm.order_addr[index];
       if (addr_code && addr_code.length === 3) {
-        const arrCode = addr_code[addr_code.length - 1]
+        const arrCode = addr_code[addr_code.length - 1];
         // console.log(model);
         const { code, data, message } = await asyncRequest.addrall({
-          code: arrCode
-        })
+          code: arrCode,
+        });
         if (code === 0) {
-          const { province, city, area } = data
-          const province_name = province && province.name ? province.name : ''
-          const city_name = city && city.name ? city.name : ''
-          const area_name = area && area.name ? area.name : ''
+          const { province, city, area } = data;
+          const province_name = province && province.name ? province.name : "";
+          const city_name = city && city.name ? city.name : "";
+          const 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()
+          await this.logout();
         } else {
-          this.$message.warning(message)
+          this.$message.warning(message);
         }
       } else {
-        this.addrForm.order_addr[index].addr_code_name = ''
+        this.addrForm.order_addr[index].addr_code_name = "";
       }
     },
     // 省市区保存某一行
     checkRow(rowIndex) {
       this.$refs.addrForm.validate((valid) => {
         if (valid) {
-          this.addrForm.order_addr[rowIndex].edit = false
+          this.addrForm.order_addr[rowIndex].edit = false;
         } else {
-          console.log('error submit!!')
-          return false
+          console.log("error submit!!");
+          return false;
         }
-      })
+      });
     },
     // 省市区删除行操作
     deleteRow(index, rows) {
-      rows.splice(index, 1)
+      rows.splice(index, 1);
     },
     async submitForm() {
       if (this.loading) {
-        return
+        return;
       }
-      this.loading = true
+      this.loading = true;
       const model = {
         planNo: this.planNo,
         arrtime: this.arrtime,
-        planinfo: []
-      }
+        manager:this.manager[0],
+        planinfo: [],
+      };
       this.project_list.forEach((e) => {
-        const { order_good, order_addr } = e
+        const { order_good, order_addr } = e;
 
-        const { id, sendtype } = JSON.parse(JSON.stringify(order_good[0]))
+        const { id, sendtype } = JSON.parse(JSON.stringify(order_good[0]));
         const modelA = {
-          feedback_id: id || '',
-          sendtype: sendtype || '2',
-          addrlist: []
-        }
+          feedback_id: id || "",
+          sendtype: sendtype || "2",
+          addrlist: [],
+        };
         order_addr.forEach((a) => {
           const modelB = {
             addr_code: a.addr_code.toString(),
             contactor: a.contactor,
             mobile: a.mobile,
             addr: a.addr,
-            receipt_quantity: a.receipt_quantity
-          }
-          modelA.addrlist.push(modelB)
-        })
-        model.planinfo.push(modelA)
-      })
+            receipt_quantity: a.receipt_quantity,
+          };
+          modelA.addrlist.push(modelB);
+        });
+        model.planinfo.push(modelA);
+      });
 
-      Object.keys(model).forEach(key => {
-        if (typeof model[key] === 'string') { model[key] = replaceTextWrapAndSpace(model[key]) }
-      })
+      Object.keys(model).forEach((key) => {
+        if (typeof model[key] === "string") {
+          model[key] = replaceTextWrapAndSpace(model[key]);
+        }
+      });
 
-      const res = await asyncRequest.project_place_order(model)
-      this.loading = false
+      const res = await asyncRequest.project_place_order(model);
+      this.loading = false;
       if (res && res.code === 0) {
         this.$notify.success({
-          title: '下单成功!',
-          message: ''
-        })
-        this.showModelThis = false
+          title: "下单成功!",
+          message: "",
+        });
+        this.showModelThis = false;
         // 刷新
-        this.$emit('refresh')
+        this.$emit("refresh");
       } else if (res && res.code >= 100 && res.code <= 104) {
-        await this.logout()
+        await this.logout();
       } else {
-        this.$message.warning(res.message)
+        this.$message.warning(res.message);
       }
-    }
-  }
-}
+    },
+  },
+};
 </script>
 
 <style lang="scss" scoped>

+ 394 - 360
src/views/sellOut/zixunOrder/components/buyGoodModal.vue

@@ -28,13 +28,16 @@
             <template slot="good_name">
               <span>{{ sitem.good_name }}</span>
               <span v-for="(si, sii) in sitem.specinfo" :key="si.specid + sii">
-                <span v-if="sii !== 0">--</span><span>{{ si.spec_name }}[{{ si.spec_value_name }}]</span></span>
+                <span v-if="sii !== 0">--</span
+                ><span>{{ si.spec_name }}[{{ si.spec_value_name }}]</span></span
+              >
             </template>
             <template slot="is_noble">
               <span v-if="sitem.is_noble">
                 {{ sitem.noble_weight }}g--{{ sitem.metal_name }}--{{
                   sitem.is_diff === "1" ? "有" : "无"
-                }}工差--{{ sitem.config }}--{{ sitem.other_config }}</span>
+                }}工差--{{ sitem.config }}--{{ sitem.other_config }}</span
+              >
               <span v-else>非贵金属商品</span>
             </template>
             <template slot="in_num">
@@ -120,7 +123,7 @@
                   type="primary"
                   :disabled="loading"
                   @click="submitForm"
-                >保 存
+                  >保 存
                 </el-button>
               </el-col>
               <el-col :span="11">
@@ -147,26 +150,26 @@
 
               <el-col :span="12">
                 <el-row>
-                  <el-form-item
-                    label-width="85px"
-                    label="商品类型"
-                    prop="goodtype"
-                  >
-                    <el-select v-model="ruleForm.goodtype" style="width:100%" placeholder="商品类型">
+                  <el-form-item label-width="85px" label="商品类型" prop="goodtype">
+                    <el-select
+                      v-model="ruleForm.goodtype"
+                      style="width: 100%"
+                      placeholder="商品类型"
+                    >
                       <el-option
                         v-for="goodType in goodTypes"
                         :key="goodType.value"
-                        :disabled="(goodType.value === '1' && Number(ruleForm.sale_price) === 0)
-                          ||(goodType.value !== '1' && Number(ruleForm.sale_price) !== 0)"
+                        :disabled="
+                          (goodType.value === '1' && Number(ruleForm.sale_price) === 0) ||
+                          (goodType.value !== '1' && Number(ruleForm.sale_price) !== 0)
+                        "
                         :value="goodType.value"
                         :label="goodType.label"
                       />
                     </el-select>
                   </el-form-item>
 
-                  <el-col
-                    :span="12"
-                  >
+                  <el-col :span="12">
                     <el-form-item label="凭证类型" prop="proof_type" label-width="85px">
                       <el-select
                         v-model="ruleForm.proof_type"
@@ -205,8 +208,8 @@
                           <div v-if="video_url" class="clearfix">
                             <el-popover placement="top" width="300" trigger="hover">
                               <video width="275" controls class="fl">
-                                <source :src="video_url" type="video/mp4">
-                                <source :src="video_url" type="video/avi">
+                                <source :src="video_url" type="video/mp4" />
+                                <source :src="video_url" type="video/avi" />
                                 您的浏览器不支持Video标签。
                               </video>
                               <i
@@ -220,7 +223,8 @@
                               type="warning"
                               style="margin: 0 0 0 16px"
                               @click="deleteUrl('1')"
-                            >删除</el-link>
+                              >删除</el-link
+                            >
                           </div>
 
                           <div v-else class="activity-upload">
@@ -249,13 +253,14 @@
                               style="width: 50px; height: 50px"
                               :src="img_url"
                               class="avatar fl"
-                            >
+                            />
                             <el-link
                               :underline="false"
                               type="warning"
                               style="margin: 0 0 0 16px"
                               @click="deleteUrl('2')"
-                            >删除</el-link>
+                              >删除</el-link
+                            >
                           </div>
 
                           <div v-else class="activity-upload">
@@ -286,7 +291,8 @@
                               type="warning"
                               style="margin: 0 0 0 16px"
                               @click="deleteUrl('3')"
-                            >删除</el-link>
+                              >删除</el-link
+                            >
                           </div>
 
                           <div v-else class="activity-upload">
@@ -314,18 +320,15 @@
               </el-col>
 
               <el-col :span="12">
-                <el-form-item label="其他单号" prop="workNo" label-width="115px">
-                  <el-input
-                    v-model="ruleForm.workNo"
-                    maxlength="2000"
-                    type="textarea"
-                    :rows="2"
-                    show-word-limit
-                    placeholder="如: 业管单号"
+                <el-form-item label="项目经理" prop="manager" label-width="115px">
+                  <project-manager
+                    :size="'mini'"
+                    v-model.value="ruleForm.manager"
+                    @searchChange="managerChange"
+                    style="width: 100%"
                   />
                 </el-form-item>
-              </el-col>
-              <el-col :span="12">
+
                 <el-form-item
                   label="平台订单号"
                   prop="platform_order"
@@ -340,7 +343,18 @@
                     placeholder="如: PO号"
                   />
                 </el-form-item>
+                <el-form-item label="其他单号" prop="workNo" label-width="115px">
+                  <el-input
+                    v-model="ruleForm.workNo"
+                    maxlength="2000"
+                    type="textarea"
+                    :rows="2"
+                    show-word-limit
+                    placeholder="如: 业管单号"
+                  />
+                </el-form-item>
               </el-col>
+              <el-col :span="12"> </el-col>
             </el-row>
           </el-form>
         </el-col>
@@ -452,7 +466,7 @@
                       :names="scope.row.label"
                       placeholder="收货省市区"
                       :level="3"
-                      @searchChange="areaChange($event,scope.$index)"
+                      @searchChange="areaChange($event, scope.$index)"
                     />
                   </el-form-item>
                   <span v-if="!scope.row.edit">{{ scope.row.addr_code_name }}</span>
@@ -573,9 +587,9 @@
   </el-dialog>
 </template>
 <script>
-import resToken from '@/mixins/resToken'
-import asyncRequest from '@/apis/service/sellOut/zixunOrder'
-import SearchStockGoodModal from '@/components/search-stock-good-modal'
+import resToken from "@/mixins/resToken";
+import asyncRequest from "@/apis/service/sellOut/zixunOrder";
+import SearchStockGoodModal from "@/components/search-stock-good-modal";
 import {
   isnumber,
   isMobile,
@@ -583,281 +597,297 @@ import {
   isEmoticon,
   isSpecialSymbol,
   hasSpace,
-  isAddr
-} from '@/utils/validate'
-import inAddrModel from '@/components/in-addr-model'
-import { ShowDataTableColumns } from './ShowDataTableColumns'
-import { replaceTextWrapAndSpace } from '@/utils'
+  isAddr,
+} from "@/utils/validate";
+import inAddrModel from "@/components/in-addr-model";
+import { ShowDataTableColumns } from "./ShowDataTableColumns";
+import { replaceTextWrapAndSpace } from "@/utils";
 export default {
-  name: 'BuyGoodModal',
+  name: "BuyGoodModal",
   components: { SearchStockGoodModal, inAddrModel },
   mixins: [resToken],
-  props: ['showModel', 'sitem'],
+  props: ["showModel", "sitem"],
   data() {
     const validatemobile = (rule, value, callback) => {
-      if (value === '') {
-        callback(new Error('手机号不能为空!'))
+      if (value === "") {
+        callback(new Error("手机号不能为空!"));
       } else {
         if (!isMobile(value)) {
-          callback(new Error('手机号格式不正确!'))
+          callback(new Error("手机号格式不正确!"));
         } else {
-          callback()
+          callback();
         }
       }
-    }
+    };
     const validateWeight = (rule, value, callback) => {
-      if (value === '') {
-        callback(new Error('收货总数不能为空!'))
+      if (value === "") {
+        callback(new Error("收货总数不能为空!"));
       } else {
         if (!isnumber(value)) {
-          callback(new Error('收货总数仅支持整数!'))
+          callback(new Error("收货总数仅支持整数!"));
         } else {
-          callback()
+          callback();
         }
       }
-    }
+    };
     const validate_num_0 = (rule, value, callback) => {
-      const { required } = rule
-      if (required && value === '') {
-        callback(new Error('不能为空!'))
+      const { required } = rule;
+      if (required && value === "") {
+        callback(new Error("不能为空!"));
       } else if (
         required &&
-        (value === '0' ||
-          value === '0.' ||
-          value === '0.0' ||
-          value === '0.00' ||
-          value === '0.000')
+        (value === "0" ||
+          value === "0." ||
+          value === "0.0" ||
+          value === "0.00" ||
+          value === "0.000")
       ) {
         // new Error('不能为零!')
-        callback()
+        callback();
       } else {
-        callback()
+        callback();
       }
-    }
+    };
     const validatecontactor = (rule, value, callback) => {
-      if (value === '') {
-        callback(new Error('联系人不能为空!'))
+      if (value === "") {
+        callback(new Error("联系人不能为空!"));
       } else {
         if (value.length < 2 || value.length > 10) {
-          callback(new Error('联系人规则为2~10位汉字!'))
+          callback(new Error("联系人规则为2~10位汉字!"));
         } else {
           if (!isChinese(value)) {
-            callback(new Error('联系人规则为2~10位汉字!'))
+            callback(new Error("联系人规则为2~10位汉字!"));
           } else if (isEmoticon(value)) {
-            callback(new Error('联系人规则为2~10位汉字!'))
+            callback(new Error("联系人规则为2~10位汉字!"));
           } else {
-            callback()
+            callback();
           }
         }
       }
-    }
+    };
     const validateAddr = (rule, value, callback) => {
-      if (value === '') {
-        callback(new Error('详细地址不能为空!'))
+      if (value === "") {
+        callback(new Error("详细地址不能为空!"));
       } else {
         if (hasSpace(value)) {
-          callback(new Error('不能出现/回车/换行符!'))
+          callback(new Error("不能出现/回车/换行符!"));
         } else if (isSpecialSymbol(value)) {
-          callback(new Error('不能使用英文特殊字符!'))
+          callback(new Error("不能使用英文特殊字符!"));
         } else if (isAddr(value)) {
-          callback()
+          callback();
         } else {
-          callback(new Error('详细地址填写不规范!'))
+          callback(new Error("详细地址填写不规范!"));
         }
       }
-    }
+    };
     return {
       loading: false,
-      total_price: '0',
+      total_price: "0",
       addrmodel: false,
       showModelThis: this.showModel,
       showGoodsModel: false,
       ShowDataTableColumns: ShowDataTableColumns,
-      video_url: '',
-      img_url: '',
-      other_url: '',
+      video_url: "",
+      img_url: "",
+      other_url: "",
       goodTypes: [
-        { value: '1', label: '常规商品' },
-        { value: '2', label: '赠品' },
-        { value: '3', label: '样品' }
+        { value: "1", label: "常规商品" },
+        { value: "2", label: "赠品" },
+        { value: "3", label: "样品" },
       ],
       proof_options: [
         {
-          value: '1',
-          label: '视频'
+          value: "1",
+          label: "视频",
         },
         {
-          value: '2',
-          label: '图片'
+          value: "2",
+          label: "图片",
         },
         {
-          value: '3',
-          label: '其他'
-        }
+          value: "3",
+          label: "其他",
+        },
       ],
       pickerOptions: {
         disabledDate: (time) => {
-          return time.getTime() < new Date(this.sitem.in_arrival_time).getTime()
-        }
+          return time.getTime() < new Date(this.sitem.in_arrival_time).getTime();
+        },
       },
 
       options: [
         {
-          value: '1',
-          label: '有地址下单'
+          value: "1",
+          label: "有地址下单",
         },
         {
-          value: '2',
-          label: '无地址下单'
-        }
+          value: "2",
+          label: "无地址下单",
+        },
       ],
-      stock_code: '',
-      cat_id: '',
+      stock_code: "",
+      cat_id: "",
       ruleForm: {
-        bidNo: '', // 竞价单反馈编号
-        good_num: '', // 商品数量
-        sale_price: '',
-        sendtype: '1', // 发货方式
-        arrtime: '', // 到货时间
-        remark: '', // 订单备注
-        platform_order: '', // 平台订单号
-        workNo: '', // 其他单号
-        companyNo: ''
+        bidNo: "", // 竞价单反馈编号
+        good_num: "", // 商品数量
+        sale_price: "",
+        sendtype: "1", // 发货方式
+        arrtime: "", // 到货时间
+        remark: "", // 订单备注
+        platform_order: "", // 平台订单号
+        workNo: "", // 其他单号
+        companyNo: "",
+        manager: [],
       },
+      manager_name: "",
       rulesThis: this.rules,
       rules: {
         goodtype: [
           {
             required: true,
-            trigger: 'change',
-            message: '请选择商品类型'
-          }
+            trigger: "change",
+            message: "请选择商品类型",
+          },
         ],
         good_num: [
           {
             required: true,
             validator: validate_num_0,
-            trigger: 'blur'
-          }
+            trigger: "blur",
+          },
         ],
         sale_price: [
           {
             required: true,
             validator: validate_num_0,
-            trigger: 'blur'
-          }
+            trigger: "blur",
+          },
+        ],
+        manager: [
+          {
+            required: true,
+            message: "请选择项目经理",
+            trigger: "change",
+          },
         ],
         companyNo: [
           {
             required: true,
-            message: '请选择业务公司',
-            trigger: 'change'
-          }
+            message: "请选择业务公司",
+            trigger: "change",
+          },
         ],
         sendtype: [
           {
             required: true,
-            message: '请选择发货方式',
-            trigger: 'change'
-          }
+            message: "请选择发货方式",
+            trigger: "change",
+          },
         ],
         remark: [
           {
             required: true,
-            message: '输入订单备注',
-            trigger: 'blur'
-          }
+            message: "输入订单备注",
+            trigger: "blur",
+          },
         ],
         arrtime: [
           {
             required: true,
-            message: '要求到货时间',
-            trigger: 'change'
-          }
+            message: "要求到货时间",
+            trigger: "change",
+          },
         ],
         proof_type: [
           {
             required: false,
-            message: '请选择凭证类型',
-            trigger: 'change'
-          }
+            message: "请选择凭证类型",
+            trigger: "change",
+          },
         ],
         proof_url: [
           {
             required: false,
-            message: '请上传凭证文件',
-            trigger: 'blur,change'
-          }
-        ]
+            message: "请上传凭证文件",
+            trigger: "blur,change",
+          },
+        ],
       },
       addrForm: {
-        order_addr: [] // 收货地址
+        order_addr: [], // 收货地址
       },
       addrRules: {
         receipt_quantity: [
           {
             required: true,
             validator: validateWeight,
-            trigger: 'blur'
-          }
+            trigger: "blur",
+          },
         ],
 
         contactor: [
           {
             required: true,
-            trigger: 'blur',
-            validator: validatecontactor
-          }
+            trigger: "blur",
+            validator: validatecontactor,
+          },
         ],
         mobile: [
           {
             required: true,
             validator: validatemobile,
-            trigger: 'blur'
-          }
+            trigger: "blur",
+          },
         ],
 
         addr_code: [
           {
-            type: 'array',
+            type: "array",
             required: false,
-            trigger: 'change'
-          }
+            trigger: "change",
+          },
         ],
         addr: [
           {
             required: true,
             validator: validateAddr,
-            trigger: 'blur'
-          }
-        ]
+            trigger: "blur",
+          },
+        ],
       },
 
-      id: ''
-    }
+      id: "",
+    };
   },
   watch: {
-    showModel: function(val) {
-      this.showModelThis = val
+    showModel: function (val) {
+      this.showModelThis = val;
       if (val) {
         // this.rulesThis = this.rules;
-        this.initForm()
+        this.initForm();
       }
     },
     showModelThis(val) {
       if (!val) {
-        this.$emit('cancel')
+        this.$emit("cancel");
       }
     },
-    'ruleForm.sale_price'(val) {
+    "ruleForm.sale_price"(val) {
       // console.log(val)
-      this.ruleForm.goodtype = Number(val) === 0 ? '2' : '1'
-    }
+      this.ruleForm.goodtype = Number(val) === 0 ? "2" : "1";
+    },
   },
   created() {
     // this.this.ruleForm.arrtime = this.sitem.in_arrival_time.substring(0, 10);
   },
   methods: {
+    managerChange(e) {
+      console.log(e);
+      const { id, label } = e;
+      this.ruleForm.manager = id ? [id] : [];
+      this.$refs.ruleForm.validateField("manager");
+      this.manager_name = label ?? "";
+    },
     // 修改日期校验
     mdDate() {
       // 用户传递的到货时间不能大于要求到货的时间  对要求到货时间进行字符截取10位抹除时分秒
@@ -865,129 +895,132 @@ export default {
         Date.parse(this.ruleForm.arrtime) <
         Date.parse(this.sitem.in_arrival_time.substring(0, 10))
       ) {
-        this.$message.warning('到货时间不能小于要求到货日期')
-        this.ruleForm.arrtime = ''
+        this.$message.warning("到货时间不能小于要求到货日期");
+        this.ruleForm.arrtime = "";
       }
     },
 
     // 销售方公司选择
     company_idsearchChange(e) {
-      const { code } = e
-      this.ruleForm.companyNo = code || ''
-      this.$refs.ruleForm.validateField('companyNo')
+      const { code } = e;
+      this.ruleForm.companyNo = code || "";
+      this.$refs.ruleForm.validateField("companyNo");
     },
 
     closeModel() {
-      console.log('closeModel!!')
-      this.showModelThis = false
+      console.log("closeModel!!");
+      this.showModelThis = false;
     },
     num_change(e, key) {
-      this.ruleForm[key] = e + ''
-      this.$refs.ruleForm.validateField(key)
-      this.set_total_price()
+      this.ruleForm[key] = e + "";
+      this.$refs.ruleForm.validateField(key);
+      this.set_total_price();
     },
     set_total_price() {
-      const { good_num, sale_price } = this.ruleForm
-      const num = good_num * 1
-      const price = sale_price * 1
-      this.total_price = num * price + ''
+      const { good_num, sale_price } = this.ruleForm;
+      const num = good_num * 1;
+      const price = sale_price * 1;
+      this.total_price = num * price + "";
     },
     async initForm() {
-      this.loading = true
-      this.rulesThis = this.rules
-      const { can } = this.sitem
-      this.sitem.can_name = ''
-      this.sitem.is_noble = false
+      this.loading = true;
+      this.rulesThis = this.rules;
+      const { can } = this.sitem;
+      this.sitem.can_name = "";
+      this.sitem.is_noble = false;
       if (can && can.length > 0) {
         can.forEach((a, ai) => {
-          this.sitem.is_noble = a.id + '' === '6'
-          this.sitem.can_name += `${ai !== 0 ? '_' : ''}${a.name}`
-        })
+          this.sitem.is_noble = a.id + "" === "6";
+          this.sitem.can_name += `${ai !== 0 ? "_" : ""}${a.name}`;
+        });
       }
-      await this.resetForm()
-      this.getNewTime()
-      this.set_total_price()
-      this.loading = false
+      await this.resetForm();
+      this.getNewTime();
+      this.set_total_price();
+      this.loading = false;
     },
     addrRefresh(e) {
-      const list = JSON.parse(JSON.stringify(e.list))
-      list.forEach(item => {
-        item.label = [item.label]
-        item.code = [item.areaCode]
-      })
-      this.addrForm.order_addr.push(...list)
+      const list = JSON.parse(JSON.stringify(e.list));
+      list.forEach((item) => {
+        item.label = [item.label];
+        item.code = [item.areaCode];
+      });
+      this.addrForm.order_addr.push(...list);
     },
 
     getNewTime() {
-      this.newTime = new Date().valueOf()
+      this.newTime = new Date().valueOf();
     },
     async resetForm() {
       // 重置
       await this.$nextTick(() => {
         if (this.$refs.ruleForm) {
-          this.$refs.ruleForm.resetFields()
-          this.$refs.ruleForm.clearValidate()
+          this.$refs.ruleForm.resetFields();
+          this.$refs.ruleForm.clearValidate();
           const {
             bidNo,
             in_num,
             in_arrival_time,
             sale_price,
             remark,
-            in_companyNo
-          } = this.sitem
-          console.log(this.sitem)
+            in_companyNo,
+          } = this.sitem;
+          console.log(this.sitem);
           this.ruleForm = {
-            bidNo: bidNo || '', // 竞价单反馈编号
-            good_num: in_num || '0', // 商品数量
-            sale_price: sale_price || '',
-            sendtype: '1', // 发货方式
-            arrtime: in_arrival_time || '', // 到货时间
-            remark: '',
-            proof_type: '1', // 通过or驳回
-            proof_url: '', // 驳回至
-            companyNo: in_companyNo || '',
-            goodtype: Number(sale_price) === 0 ? '2' : '1'
-          }
+            bidNo: bidNo || "", // 竞价单反馈编号
+            good_num: in_num || "0", // 商品数量
+            sale_price: sale_price || "",
+            sendtype: "1", // 发货方式
+            arrtime: in_arrival_time || "", // 到货时间
+            remark: "",
+            proof_type: "1", // 通过or驳回
+            proof_url: "", // 驳回至
+            companyNo: in_companyNo || "",
+            goodtype: Number(sale_price) === 0 ? "2" : "1",
+            manager: [],
+          };
         }
 
         if (this.$refs.addrForm) {
-          this.$refs.addrForm.resetFields()
-          this.$refs.addrForm.clearValidate()
+          this.$refs.addrForm.resetFields();
+          this.$refs.addrForm.clearValidate();
           this.addrForm = {
-            order_addr: []
-          }
+            order_addr: [],
+          };
         }
-      })
+      });
     },
     openHouseModal(index) {
-      const findex = this.addrForm.order_addr.findIndex((v) => v.edit === true)
+      const findex = this.addrForm.order_addr.findIndex((v) => v.edit === true);
       if (findex !== -1) {
-        this.$message.warning('当前已有地址在编辑,请保存后再试!')
-        return
+        this.$message.warning("当前已有地址在编辑,请保存后再试!");
+        return;
       } else {
         if (index === -1) {
           this.addrForm.order_addr.push({
             edit: true,
-            receipt_quantity: '',
-            contactor: '',
-            mobile: '',
+            receipt_quantity: "",
+            contactor: "",
+            mobile: "",
             addr_code: [],
-            addr: '',
+            addr: "",
             code: [],
-            label: []
-          })
+            label: [],
+          });
         } else {
-          this.addrForm.order_addr[index].edit = true
+          this.addrForm.order_addr[index].edit = true;
         }
       }
     },
     async areaChange(e, index) {
-      const { code, area_code, label, splitLabel } = e
+      const { code, area_code, label, splitLabel } = e;
       // this.addrForm.order_addr[index] = e
-      this.addrForm.order_addr[index].addr_code_name = splitLabel ? splitLabel.split(',').join('/') : ''
-      this.addrForm.order_addr[index].addr_code = code ? code.split(',') : []
-      this.addrForm.order_addr[index].code = area_code ? [area_code] : []
-      this.addrForm.order_addr[index].label = label ? [label] : []
+      this.addrForm.order_addr[index].addr_code_name = splitLabel
+        ? splitLabel.split(",").join("/")
+        : "";
+      this.addrForm.order_addr[index].addr_code = code ? code.split(",") : [];
+      this.addrForm.order_addr[index].code = area_code ? [area_code] : [];
+      this.addrForm.order_addr[index].label = label ? [label] : [];
       // this.$refs.ruleForm.validateField('addr_code')
     },
     // 省市区选择
@@ -1022,253 +1055,254 @@ export default {
     checkRow(rowIndex) {
       this.$refs.addrForm.validate((valid) => {
         if (valid) {
-          this.addrForm.order_addr[rowIndex].edit = false
+          this.addrForm.order_addr[rowIndex].edit = false;
         } else {
-          console.log('error submit!!')
-          return false
+          console.log("error submit!!");
+          return false;
         }
-      })
+      });
     },
     // 省市区删除行操作
     deleteRow(index, rows) {
-      rows.splice(index, 1)
+      rows.splice(index, 1);
     },
     async submitForm() {
-      await this.$refs.ruleForm.validate(async(valid) => {
+      await this.$refs.ruleForm.validate(async (valid) => {
         if (valid) {
-          if (this.loading) return
-          this.loading = true
-          const model = JSON.parse(JSON.stringify(this.ruleForm))
+          if (this.loading) return;
+          this.loading = true;
+          const model = JSON.parse(JSON.stringify(this.ruleForm));
 
-          model.order_addr = []
-          const { sendtype, good_num } = model
-          const { order_addr } = JSON.parse(JSON.stringify(this.addrForm))
-          if (sendtype + '' === '1' && order_addr && order_addr.length === 0) {
-            this.$message.warning('至少上传一个地址信息!')
-            this.loading = false
-            return
+          model.order_addr = [];
+          const { sendtype, good_num,manager } = model;
+          const { order_addr } = JSON.parse(JSON.stringify(this.addrForm));
+          if (sendtype + "" === "1" && order_addr && order_addr.length === 0) {
+            this.$message.warning("至少上传一个地址信息!");
+            this.loading = false;
+            return;
           }
-          if (sendtype + '' === '1') {
-            let addrT = 0
-            let isAEdit = false
+          if (sendtype + "" === "1") {
+            let addrT = 0;
+            let isAEdit = false;
             order_addr.forEach((v2) => {
               if (v2.edit) {
-                isAEdit = true
+                isAEdit = true;
               }
-              addrT += parseInt(v2.receipt_quantity + '')
+              addrT += parseInt(v2.receipt_quantity + "");
               const model2 = {
                 addr_code: v2.addr_code.toString(),
                 contactor: v2.contactor,
                 mobile: v2.mobile,
                 addr: v2.addr,
-                receipt_quantity: v2.receipt_quantity
-              }
-              model.order_addr.push(model2)
-            })
+                receipt_quantity: v2.receipt_quantity,
+              };
+              model.order_addr.push(model2);
+            });
 
             if (isAEdit) {
-              this.$message.warning('请保存地址信息!')
-              this.loading = false
-              return
+              this.$message.warning("请保存地址信息!");
+              this.loading = false;
+              return;
             }
-            if (parseInt(good_num + '') !== addrT) {
-              this.$message.warning('收货总数量与购买不一致!')
-              this.loading = false
-              return
+            if (parseInt(good_num + "") !== addrT) {
+              this.$message.warning("收货总数量与购买不一致!");
+              this.loading = false;
+              return;
             }
           }
 
           // 去除上送字段空格&换行
-          Object.keys(model).forEach(key => {
-            if (typeof model[key] === 'string' && key !== 'arrtime') {
-              model[key] = replaceTextWrapAndSpace(model[key])
+          Object.keys(model).forEach((key) => {
+            if (typeof model[key] === "string" && key !== "arrtime") {
+              model[key] = replaceTextWrapAndSpace(model[key]);
             }
-          })
+          });
+          model.manager = manager.toString();
 
-          const res = await asyncRequest.consultorder(model)
+          const res = await asyncRequest.consultorder(model);
 
           if (res && res.code === 0) {
             this.$notify.success({
-              title: '下单成功!',
-              message: ''
-            })
-            this.showModelThis = false
+              title: "下单成功!",
+              message: "",
+            });
+            this.showModelThis = false;
             // 刷新
-            this.$emit('refresh')
-            this.loading = false
+            this.$emit("refresh");
+            this.loading = false;
           } else if (res && res.code >= 100 && res.code <= 104) {
-            this.loading = false
-            await this.logout()
+            this.loading = false;
+            await this.logout();
           } else {
-            this.loading = false
-            this.$message.warning(res.message)
+            this.loading = false;
+            this.$message.warning(res.message);
           }
         } else {
-          console.log('error submit!!')
-          return false
+          console.log("error submit!!");
+          return false;
         }
-      })
+      });
     },
     // 图片上传成功
     async UploadSuccessEventproof_url(data) {
-      const { url } = data
-      if (url === 'noToken') {
-        await this.logout()
+      const { url } = data;
+      if (url === "noToken") {
+        await this.logout();
       } else {
-        this.img_url = url
-        this.set_proof_url()
-        this.$message.success('图片上传成功!')
+        this.img_url = url;
+        this.set_proof_url();
+        this.$message.success("图片上传成功!");
       }
     },
 
     // 图片上传失败
     UploadErrorEventproof_url(res) {
-      if (res !== 'break') {
-        this.set_proof_url()
-        this.$message.error('图片上传失败!')
+      if (res !== "break") {
+        this.set_proof_url();
+        this.$message.error("图片上传失败!");
       }
     },
 
     // 判断图片规格
     beforeAvatarUpload(file) {
-      let isJPG = false
+      let isJPG = false;
       if (
-        file.type === 'image/jpg' ||
-        file.type === 'image/png' ||
-        file.type === 'image/jpeg'
+        file.type === "image/jpg" ||
+        file.type === "image/png" ||
+        file.type === "image/jpeg"
       ) {
-        isJPG = true
+        isJPG = true;
       }
-      const isLt2M = file.size / 1024 / 1024 < 1
+      const isLt2M = file.size / 1024 / 1024 < 1;
       if (!isJPG) {
-        this.$message.error('图片格式不正确!')
+        this.$message.error("图片格式不正确!");
       }
       if (!isLt2M) {
-        this.$message.error('图片大小不能超过 1MB!')
+        this.$message.error("图片大小不能超过 1MB!");
       }
-      return isJPG && isLt2M
+      return isJPG && isLt2M;
     },
 
     // 视频上传成功
     async UploadSuccessVideoproof_url(data) {
-      const { url } = data
-      if (url === 'noToken') {
-        await this.logout()
+      const { url } = data;
+      if (url === "noToken") {
+        await this.logout();
       } else {
-        this.video_url = url
-        this.set_proof_url()
-        this.$message.success('视频上传成功!')
+        this.video_url = url;
+        this.set_proof_url();
+        this.$message.success("视频上传成功!");
       }
     },
 
     // 视频上传失败
     UploadErrorVideoproof_url(res) {
-      if (res !== 'break') {
-        this.set_proof_url()
-        this.$message.error('视频上传失败!')
+      if (res !== "break") {
+        this.set_proof_url();
+        this.$message.error("视频上传失败!");
       }
     },
 
     // 判断视频规格
     beforeVideoUpload(file) {
-      let isJPG = false
-      if (file.type === 'video/mp4' || file.type === 'video/avi') {
-        isJPG = true
+      let isJPG = false;
+      if (file.type === "video/mp4" || file.type === "video/avi") {
+        isJPG = true;
       }
-      const isLt2M = file.size / 1024 / 1024 < 10
+      const isLt2M = file.size / 1024 / 1024 < 10;
       if (!isJPG) {
-        this.$message.error('视频格式不正确!')
+        this.$message.error("视频格式不正确!");
       }
       if (!isLt2M) {
-        this.$message.error('视频大小不能超过 10MB!')
+        this.$message.error("视频大小不能超过 10MB!");
       }
-      return isJPG && isLt2M
+      return isJPG && isLt2M;
     },
 
     // 其他文件上传成功
     async UploadSuccessOtherproof_url(data) {
-      const { url } = data
-      if (url === 'noToken') {
-        await this.logout()
+      const { url } = data;
+      if (url === "noToken") {
+        await this.logout();
       } else {
-        this.other_url = url
-        this.set_proof_url()
-        this.$message.success('文件成功!')
+        this.other_url = url;
+        this.set_proof_url();
+        this.$message.success("文件成功!");
       }
     },
 
     // 其他文件上传失败
     UploadErrorOtherproof_url(res) {
-      if (res !== 'break') {
-        this.set_proof_url()
-        this.$message.error('文件上传失败!')
+      if (res !== "break") {
+        this.set_proof_url();
+        this.$message.error("文件上传失败!");
       }
     },
 
     // 判断其他文件规格
     beforeOtherUpload(file) {
-      console.log(file)
-      let isJPG = false
+      console.log(file);
+      let isJPG = false;
       if (
-        file.type === 'application/vnd.ms-excel' ||
+        file.type === "application/vnd.ms-excel" ||
         file.type ===
-          'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' ||
-        file.type === 'application/pdf' ||
-        file.type === 'application/x-zip-compressed'
+          "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" ||
+        file.type === "application/pdf" ||
+        file.type === "application/x-zip-compressed"
       ) {
-        isJPG = true
+        isJPG = true;
       }
-      const name = file.name
-      const list = name.split('.')
-      if (list[list.length - 1] === 'rar' || list[list.length - 1] === '7z') {
-        isJPG = true
+      const name = file.name;
+      const list = name.split(".");
+      if (list[list.length - 1] === "rar" || list[list.length - 1] === "7z") {
+        isJPG = true;
       }
 
-      const isLt2M = file.size / 1024 / 1024 < 5
+      const isLt2M = file.size / 1024 / 1024 < 5;
       if (!isJPG) {
-        this.$message.error('文件格式不正确!')
+        this.$message.error("文件格式不正确!");
       }
       if (!isLt2M) {
-        this.$message.error('文件大小不能超过 5MB!')
+        this.$message.error("文件大小不能超过 5MB!");
       }
-      return isJPG && isLt2M
+      return isJPG && isLt2M;
     },
 
     deleteUrl(type) {
       switch (type) {
-        case '1':
-          this.video_url = ''
-          break
-        case '2':
-          this.img_url = ''
-          break
-        case '3':
-          this.other_url = ''
-          break
+        case "1":
+          this.video_url = "";
+          break;
+        case "2":
+          this.img_url = "";
+          break;
+        case "3":
+          this.other_url = "";
+          break;
         default:
-          this.video_url = ''
+          this.video_url = "";
       }
-      this.set_proof_url()
+      this.set_proof_url();
     },
     set_proof_url() {
-      const { proof_type } = this.ruleForm
+      const { proof_type } = this.ruleForm;
       switch (proof_type) {
-        case '1':
-          this.ruleForm.proof_url = this.video_url
-          break
-        case '2':
-          this.ruleForm.proof_url = this.img_url
-          break
-        case '3':
-          this.ruleForm.proof_url = this.other_url
-          break
+        case "1":
+          this.ruleForm.proof_url = this.video_url;
+          break;
+        case "2":
+          this.ruleForm.proof_url = this.img_url;
+          break;
+        case "3":
+          this.ruleForm.proof_url = this.other_url;
+          break;
         default:
-          this.ruleForm.proof_url = this.video_url
+          this.ruleForm.proof_url = this.video_url;
       }
-      this.$refs.ruleForm.validateField('proof_url')
-    }
-  }
-}
+      this.$refs.ruleForm.validateField("proof_url");
+    },
+  },
+};
 </script>
 
 <style lang="scss" scoped>