snow %!s(int64=2) %!d(string=hai) anos
pai
achega
a5ec97589c

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 0 - 0
dist/static/js/0.js


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 0 - 0
dist/static/js/app.js


+ 2 - 1
src/apis/service/netOrderEntry/netOrderEnter/index.js

@@ -18,5 +18,6 @@ export default {
   orderimportlist: (data, params) => http(api + 'orderimportlist', data, 'post', params),
   relationstockbatch: (data, params) => http(api + 'relationstockbatch', data, 'post', params),
   accountall: (data, params) => http(api + 'userall', data, 'post', params),
-  getcat: (data, params) => http(api + 'userall', data, 'post', params)
+  getcat: (data, params) => http(api + 'userall', data, 'post', params),
+  importOrder: (data, params) => http(api + 'interorderadd', data, 'post', params)
 }

+ 23 - 0
src/apis/service/netOrderEntry/prestoreRecordingOrders/index.js

@@ -0,0 +1,23 @@
+import http from '@/apis/axios'
+const api = 'admin/'
+export default {
+  // 添加
+  add: (data, params) => http(api + 'interadd', data, 'post', params),
+  // 删除
+  delete: (data, params) => http(api + 'branddel', data, 'post', params),
+  delimportorder: (data, params) => http(api + 'delimportorder', data, 'post', params),
+  // 分页查询
+  list: (data, params) => http(api + 'interorderlist', data, 'post', params),
+  // 更新
+  update: (data, params) => http(api + 'interedit', data, 'post', params),
+  // 修改状态
+  status: (data, params) => http(api + 'brandstatus', data, 'post', params),
+  // 详情
+  detail: (data, params) => http(api + 'interorderinfo', data, 'post', params),
+  // 提交导入数据
+  orderimportlist: (data, params) => http(api + 'orderimportlist', data, 'post', params),
+  relationstockbatch: (data, params) => http(api + 'relationstockbatch', data, 'post', params),
+  accountall: (data, params) => http(api + 'userall', data, 'post', params),
+  getcat: (data, params) => http(api + 'userall', data, 'post', params),
+  importOrder: (data, params) => http(api + 'interorderadd', data, 'post', params)
+}

+ 20 - 19
src/apis/service/sellOut/zixunOrder/index.js

@@ -1,42 +1,43 @@
 // 物业管理员
-import http from "@/apis/axios";
-const api = "admin/";
+import http from '@/apis/axios'
+const api = 'admin/'
 export default {
   // 详情
-  detail: (data, params) => http(api + "consultzxinfo", data, "post", params),
+  detail: (data, params) => http(api + 'consultzxinfo', data, 'post', params),
   // 更新
-  update: (data, params) => http(api + "zxedit", data, "post", params),
+  update: (data, params) => http(api + 'zxedit', data, 'post', params),
   // 修改状态
-  status: (data, params) => http(api + "consultbar", data, "post", params),
+  status: (data, params) => http(api + 'consultbar', data, 'post', params),
   // 分页查询 反馈列表
   feedList: (data, params) =>
-    http(api + "consultbidlist", data, "post", params),
+    http(api + 'consultbidlist', data, 'post', params),
   // 添加
-  add: (data, params) => http(api + "consultcreate", data, "post", params),
+  add: (data, params) => http(api + 'consultcreate', data, 'post', params),
   // 分页查询项目列表
-  plist: (data, params) => http(api + "projectlist", data, "post", params),
+  plist: (data, params) => http(api + 'projectlist', data, 'post', params),
 
   // 删除
-  delete: (data, params) => http(api + "delete", data, "post", params),
+  delete: (data, params) => http(api + 'delete', data, 'post', params),
   // 分页查询
-  list: (data, params) => http(api + "consultlists", data, "post", params),
+  list: (data, params) => http(api + 'consultlists', data, 'post', params),
   // 项目详情
-  pdetail: (data, params) => http(api + "projectinfo", data, "post", params),
+  pdetail: (data, params) => http(api + 'projectinfo', data, 'post', params),
   // 议价单创建
   bargain_add: (data, params) =>
-    http(api + "consultbaradd", data, "post", params),
+    http(api + 'consultbaradd', data, 'post', params),
   // 竞价单选定商品
-  bidscheck: (data, params) => http(api + "bidscheck", data, "post", params),
+  bidscheck: (data, params) => http(api + 'bidscheck', data, 'post', params),
   // 竞价商品下单
   consultorder: (data, params) =>
-    http(api + "consultorder", data, "post", params),
+    http(api + 'consultorder', data, 'post', params),
   // 区编码获取省市区汉字
-  addrall: (data, params) => http(api + "addrall", data, "post", params),
+  addrall: (data, params) => http(api + 'addrall', data, 'post', params),
   // 取实时金价
   golpricelast: (data, params) =>
-    http(api + "golpricelast", data, "post", params),
+    http(api + 'golpricelast', data, 'post', params),
   // 获取分类详情
-  catinfo: (data, params) => http(api + "catinfo", data, "post", params),
+  catinfo: (data, params) => http(api + 'catinfo', data, 'post', params),
   // 复制竞价单
-  copy: (data, params) => http(api + "catinfo", data, "post", params),
-};
+  copy: (data, params) => http(api + 'zxcopy', data, 'post', params),
+  zxcopyedit: (data, params) => http(api + 'zxcopyedit', data, 'post', params)
+}

+ 42 - 43
src/components/globalComponents/search-unit/main.vue

@@ -21,18 +21,17 @@
       :label="item.unit + ''"
       :value="item.id + ''"
       :disabled="item.status + '' === '0'"
-    >
-    </el-option>
+    />
   </el-select>
 </template>
 
 <script>
-import asyncRequest from "@/apis/components/search-unit";
-import resToken from "@/mixins/resToken";
+import asyncRequest from '@/apis/components/search-unit'
+import resToken from '@/mixins/resToken'
 export default {
-  name: "SearchUnit",
+  name: 'SearchUnit',
   mixins: [resToken],
-  props: ["size", "value", "placeholder", "isDetail", "disabled", "type", "names"],
+  props: ['size', 'value', 'placeholder', 'isDetail', 'disabled', 'type', 'names'],
   /**
    * 属性集合
    * @param {String}        size             : 组件大小            非必填
@@ -50,71 +49,71 @@ export default {
     return {
       options: [],
       selectLoading: false,
-      searchName: "",
+      searchName: '',
       formValue: {
         page: 1,
         size: 100,
-        start: "",
-        end: "",
-        unit: "",
-        creater: "",
-      },
-    };
+        start: '',
+        end: '',
+        unit: '',
+        creater: ''
+      }
+    }
   },
   watch: {
-    names: function (val, old) {
+    names: function(val, old) {
       // console.log(val, old, this.isDetail, "1");
-      this.searchName = val;
+      this.searchName = val
       if (this.isDetail && this.searchName) {
-        this.remoteMethod(this.searchName);
+        this.remoteMethod(this.searchName)
       }
-    },
+    }
   },
   mounted() {
-    this.options = [];
-    this.selectLoading = false;
+    this.options = []
+    this.selectLoading = false
   },
   methods: {
     async selectChange(e) {
       if (e && e.length > 0) {
-        let index = this.options.findIndex((v) => v.id + "" === e[0] + "");
-        console.log(index);
+        const index = this.options.findIndex((v) => v.id + '' === e[0] + '')
+        console.log(index)
         if (index !== -1) {
-          let model = {
-            id: this.options[index].id + "",
-            code: this.options[index].id + "",
-            label: this.options[index].unit + "",
-          };
-          this.$emit("searchChange", model);
+          const model = {
+            id: this.options[index].id + '',
+            code: this.options[index].id + '',
+            label: this.options[index].unit + ''
+          }
+          this.$emit('searchChange', model)
         } else {
-          this.$emit("searchChange", {});
+          this.$emit('searchChange', {})
         }
       } else {
-        this.$emit("searchChange", {});
+        this.$emit('searchChange', {})
       }
     },
     async remoteMethod(query) {
-      this.selectLoading = true;
-      if (query !== "") {
-        this.options = [];
-        this.formValue.unit = query;
-        const { code, data, message } = await asyncRequest.list(this.formValue);
+      this.selectLoading = true
+      if (query !== '') {
+        this.options = []
+        this.formValue.unit = query
+        const { code, data, message } = await asyncRequest.list(this.formValue)
 
         if (code === 0) {
-          const { list } = data;
-          this.options = list;
+          const { list } = data
+          this.options = list
         } else if (code >= 100 && code <= 104) {
-          await this.logout();
+          await this.logout()
         } else {
-          this.$message.warning(message);
+          this.$message.warning(message)
         }
       } else {
-        this.options = [];
+        this.options = []
       }
-      this.selectLoading = false;
-    },
-  },
-};
+      this.selectLoading = false
+    }
+  }
+}
 </script>
 
 <style></style>

+ 223 - 221
src/views/netOrderEntry/netOrderEnter/addEdit.vue

@@ -315,9 +315,11 @@
           </el-form>
         </el-col>
         <el-col :span="24" style="text-align: right">
-          <el-button v-if="id !== '007'" type="primary" @click="submitForm"
-            >保 存</el-button
-          >
+          <el-button
+            v-if="id !== '007'"
+            type="primary"
+            @click="submitForm"
+          >保 存</el-button>
           <el-button @click="showModelThis = false">
             {{ id == "007" ? "关 闭" : "取 消" }}
           </el-button>
@@ -327,76 +329,76 @@
   </el-dialog>
 </template>
 <script>
-import asyncRequest from "@/apis/service/netOrderEntry/netOrderEnter";
-import companyHelper from "@/mixins/companyHelper";
-import { accMul, accDiv, accSub, isPhone, isMobile } from "@/utils/validate";
-import resToken from "@/mixins/resToken";
+import asyncRequest from '@/apis/service/netOrderEntry/netOrderEnter'
+import companyHelper from '@/mixins/companyHelper'
+import { accMul, accDiv, accSub, isPhone, isMobile } from '@/utils/validate'
+import resToken from '@/mixins/resToken'
 
 const defaultData = {
   addr_code: [],
-  cgdPrice: "",
+  cgdPrice: '',
   // buyerid: "",
   // buyer_name: "",
-  platform_id: "",
-  cgd_tax: "",
-  workCode: "",
-  poCode: "",
-  khNo: "",
-  companyNo: "",
-  contactor: "",
-  mobile: "",
-  addr: "",
-  sendtime: "",
-  supplierNo: "",
-  cat_id: "",
-  goodName: "",
-  goodNum: "",
-  goodPrice: "",
-  good_total: "",
-  goodUnit: "",
-  tax: "",
-};
+  platform_id: '',
+  cgd_tax: '',
+  workCode: '',
+  poCode: '',
+  khNo: '',
+  companyNo: '',
+  contactor: '',
+  mobile: '',
+  addr: '',
+  sendtime: '',
+  supplierNo: '',
+  cat_id: '',
+  goodName: '',
+  goodNum: '',
+  goodPrice: '',
+  good_total: '',
+  goodUnit: '',
+  tax: ''
+}
 
 export default {
-  name: "Terrace",
+  name: 'Terrace',
   mixins: [resToken, companyHelper],
-  props: ["showModel", "id", "sitem"],
+  props: ['showModel', 'id', 'sitem'],
   data() {
     const validatemobile = (rule, value, callback) => {
-      if (value !== "") {
+      if (value !== '') {
         if (isPhone(value) || isMobile(value)) {
-          callback();
+          callback()
         } else {
-          callback(new Error("联系电话格式不正确!"));
+          callback(new Error('联系电话格式不正确!'))
         }
       } else {
-        callback(new Error("请输入联系电话!"));
+        callback(new Error('请输入联系电话!'))
       }
-    };
+    }
 
     return {
       loading: false,
       detailLoading: false,
-      title: "添加销售订单信息",
-      khName: "",
+      title: '添加销售订单信息',
+      khName: '',
       accounts: [],
-      cat_id_name: "",
+      cat_id_name: '',
       showModelThis: this.showModel,
       pickerOptions: {
-        disabledDate: (time) => time.getTime() > new Date(),
+        disabledDate: (time) => time.getTime() > new Date()
       },
       names: [],
-      unit_name: "",
-      companyName: "",
+      unit_name: '',
+      companyName: '',
       ruleForm: { ...defaultData },
       rulesThis: this.rules,
       rules: {
         goodUnit: [
           {
             required: true,
-            message: "请选择单位",
-            trigger: "blur",
-          },
+            message: '请选择单位',
+            trigger: 'blur'
+          }
         ],
         // addr_code: [
         //   {
@@ -409,46 +411,46 @@ export default {
         platform_id: [
           {
             required: true,
-            message: "请输入所属平台",
-            trigger: "blur",
-          },
+            message: '请输入所属平台',
+            trigger: 'blur'
+          }
         ],
 
         cgd_tax: [
           {
             required: true,
-            message: "请输入采购毛利率",
-            trigger: "blur",
-          },
+            message: '请输入采购毛利率',
+            trigger: 'blur'
+          }
         ],
         cat_id: [
           {
             required: true,
-            message: "请选择商品分类",
-            trigger: "change",
-          },
+            message: '请选择商品分类',
+            trigger: 'change'
+          }
         ],
         supplierNo: [
           {
-            type: "array",
+            type: 'array',
             required: true,
-            message: "请选择供应商公司",
-            trigger: "change",
-          },
+            message: '请选择供应商公司',
+            trigger: 'change'
+          }
         ],
         qrdType: [
           {
             required: true,
-            message: "请输入订单来源",
-            trigger: "blur",
-          },
+            message: '请输入订单来源',
+            trigger: 'blur'
+          }
         ],
         good_total: [
           {
             required: true,
-            message: "请输入货款总金额",
-            trigger: "blur",
-          },
+            message: '请输入货款总金额',
+            trigger: 'blur'
+          }
         ],
         // workCode: [
         //   {
@@ -460,228 +462,228 @@ export default {
         poCode: [
           {
             required: true,
-            message: "请输入PO编号",
-            trigger: "blur",
-          },
+            message: '请输入PO编号',
+            trigger: 'blur'
+          }
         ],
         khNo: [
           {
-            type: "array",
+            type: 'array',
             required: true,
-            message: "请选择购买方公司",
-            trigger: "change",
-          },
+            message: '请选择购买方公司',
+            trigger: 'change'
+          }
         ],
         tax: [
           {
             required: true,
-            message: "请选择税率",
-            trigger: "change",
-          },
+            message: '请选择税率',
+            trigger: 'change'
+          }
         ],
         companyNo: [
           {
             required: true,
-            message: "请选择销售方公司",
-            trigger: "change",
-          },
+            message: '请选择销售方公司',
+            trigger: 'change'
+          }
         ],
         contactor: [
           {
             required: true,
-            message: "请输入收货人",
-            trigger: "blur",
-          },
+            message: '请输入收货人',
+            trigger: 'blur'
+          }
         ],
         mobile: [
           {
             required: true,
             validator: validatemobile,
-            trigger: "blur",
-          },
+            trigger: 'blur'
+          }
         ],
         addr: [
           {
             required: true,
-            message: "请输入联系地址",
-            trigger: "blur",
-          },
+            message: '请输入联系地址',
+            trigger: 'blur'
+          }
         ],
 
         sendtime: [
           {
             required: true,
-            message: "请输入发货时间",
-            trigger: "change",
-          },
+            message: '请输入发货时间',
+            trigger: 'change'
+          }
         ],
 
         goodName: [
           {
             required: true,
-            message: "请输入商品名称",
-            trigger: "blur",
-          },
+            message: '请输入商品名称',
+            trigger: 'blur'
+          }
         ],
         goodPrice: [
           {
             required: true,
-            message: "请输入销售单价",
-            trigger: "blur",
-          },
+            message: '请输入销售单价',
+            trigger: 'blur'
+          }
         ],
         cgdPrice: [
           {
             required: true,
-            message: "请选择采购单价",
-            trigger: "blur",
-          },
+            message: '请选择采购单价',
+            trigger: 'blur'
+          }
         ],
         goodNum: [
           {
             required: true,
-            message: "请输入数量",
-            trigger: "blur",
-          },
-        ],
-      },
-    };
+            message: '请输入数量',
+            trigger: 'blur'
+          }
+        ]
+      }
+    }
   },
   computed: {
     totalWatchSource() {
-      const { goodNum, goodPrice } = this.ruleForm;
-      return { goodNum, goodPrice };
-    },
+      const { goodNum, goodPrice } = this.ruleForm
+      return { goodNum, goodPrice }
+    }
   },
   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')
       }
     },
     totalWatchSource: {
       handler({ goodPrice, goodNum }) {
         if (goodPrice === 0 || goodNum === 0) {
-          this.ruleForm.good_total = 0;
-          return;
+          this.ruleForm.good_total = 0
+          return
         }
 
-        this.ruleForm.good_total = accMul(goodPrice, goodNum);
+        this.ruleForm.good_total = accMul(goodPrice, goodNum)
       },
-      deep: true,
-    },
+      deep: true
+    }
   },
   methods: {
     async handleHandoverName(e) {
-      this.ruleForm.buyerid = e && e.id ? [e.id] : "";
-      this.ruleForm.buyer_name = e && e.label ? e.label : "";
-      this.$refs.ruleForm.validateField("buyerid");
+      this.ruleForm.buyerid = e && e.id ? [e.id] : ''
+      this.ruleForm.buyer_name = e && e.label ? e.label : ''
+      this.$refs.ruleForm.validateField('buyerid')
     },
     async select_area_change(e) {
-      this.ruleForm.addr_code = e;
-      this.$refs.ruleForm.validateField("addr_code");
+      this.ruleForm.addr_code = e
+      this.$refs.ruleForm.validateField('addr_code')
     },
     number_change(e, type) {
-      console.log(1111);
-      const { cgdPrice, goodPrice, cgd_tax } = this.ruleForm;
-      let tax = 0,
-        cgd_price = 0;
+      console.log(1111)
+      const { cgdPrice, goodPrice, cgd_tax } = this.ruleForm
+      let tax = 0
+      let cgd_price = 0
 
       if (type === 1) {
         // tax = (1 - cgdPrice / goodPrice)*100
-        tax = accMul(accSub(1, accDiv(cgdPrice, goodPrice)), 100);
-        this.ruleForm.cgd_tax = tax;
-        this.$refs.ruleForm.validateField("cgd_tax");
-        console.log(type, tax);
+        tax = accMul(accSub(1, accDiv(cgdPrice, goodPrice)), 100)
+        this.ruleForm.cgd_tax = tax
+        this.$refs.ruleForm.validateField('cgd_tax')
+        console.log(type, tax)
       }
       if (type === 2) {
         // cgd_price = (100 - cgd_tax) * goodPrice;
-        cgd_price = accMul(accDiv(100, cgd_tax), goodPrice);
-        this.ruleForm.cgdPrice = cgd_price;
-        this.$refs.ruleForm.validateField("cgdPrice");
-        console.log(type, cgd_tax);
+        cgd_price = accMul(accDiv(100, cgd_tax), goodPrice)
+        this.ruleForm.cgdPrice = cgd_price
+        this.$refs.ruleForm.validateField('cgdPrice')
+        console.log(type, cgd_tax)
       }
     },
     handleClose() {
-      this.showModelThis = false;
-      this.companyName = "";
-      this.khName = "";
-      this.supplierName = "";
-      this.ruleForm = { ...defaultData };
+      this.showModelThis = false
+      this.companyName = ''
+      this.khName = ''
+      this.supplierName = ''
+      this.ruleForm = { ...defaultData }
     },
     async initForm() {
-      this.loading = true;
+      this.loading = true
       // await this.getAccounts();
 
-      if (this.id === "003") {
-        this.title = "添加销售订单信息";
-        this.rulesThis = this.rules;
-      } else if (this.id === "005") {
-        this.title = "修改销售订单信息";
-        this.rulesThis = this.rules;
+      if (this.id === '003') {
+        this.title = '添加销售订单信息'
+        this.rulesThis = this.rules
+      } else if (this.id === '005') {
+        this.title = '修改销售订单信息'
+        this.rulesThis = this.rules
       } else {
-        this.title = "销售订单信息详情";
-        this.rulesThis = {};
+        this.title = '销售订单信息详情'
+        this.rulesThis = {}
       }
-      await this.resetForm();
-      this.loading = false;
+      await this.resetForm()
+      this.loading = false
     },
 
     handleCompanyChange(e) {
-      this.ruleForm.companyNo = e.code || "";
-      this.$refs.ruleForm.validateField("companyNo");
+      this.ruleForm.companyNo = e.code || ''
+      this.$refs.ruleForm.validateField('companyNo')
     },
     handleCustomerChange(e) {
-      this.ruleForm.khNo = e.code ? [e.code] : "";
-      this.$refs.ruleForm.validateField("khNo");
+      this.ruleForm.khNo = e.code ? [e.code] : ''
+      this.$refs.ruleForm.validateField('khNo')
     },
     handleSupplierChange(e) {
-      this.ruleForm.supplierNo = e.code ? [e.code] : "";
-      this.$refs.ruleForm.validateField("supplierNo");
+      this.ruleForm.supplierNo = e.code ? [e.code] : ''
+      this.$refs.ruleForm.validateField('supplierNo')
     },
     handleGoodClassChange(e) {
-      this.ruleForm.cat_id = e;
-      this.$refs.ruleForm.validateField("cat_id");
+      this.ruleForm.cat_id = e
+      this.$refs.ruleForm.validateField('cat_id')
     },
     handleTaxChange(e) {
-      this.ruleForm.tax = e;
-      this.$refs.ruleForm.validateField("tax");
+      this.ruleForm.tax = e
+      this.$refs.ruleForm.validateField('tax')
     },
     unitsearchChange(e) {
-      console.log(e);
-      const { id, code, label } = e;
-      this.ruleForm.goodUnit = code ? [code] : [];
-      this.$refs.ruleForm.validateField("goodUnit");
+      console.log(e)
+      const { id, code, label } = e
+      this.ruleForm.goodUnit = code ? [code] : []
+      this.$refs.ruleForm.validateField('goodUnit')
     },
     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()
         }
-      });
+      })
 
-      console.log(this.id);
+      console.log(this.id)
 
-      if (this.id === "003") {
-        this.ruleForm.companyNo = this.currentCompany;
-        console.log(this.ruleForm.companyNo);
-        return;
+      if (this.id === '003') {
+        this.ruleForm.companyNo = this.currentCompany
+        console.log(this.ruleForm.companyNo)
+        return
       }
 
-      if (this.id !== "003") this.getDetail();
+      if (this.id !== '003') this.getDetail()
     },
     async getDetail() {
-      this.detailLoading = true;
-      const { orderCode } = this.sitem;
-      const { data } = await asyncRequest.detail({ orderCode });
+      this.detailLoading = true
+      const { orderCode } = this.sitem
+      const { data } = await asyncRequest.detail({ orderCode })
 
       const {
         cat_id,
@@ -695,33 +697,33 @@ export default {
         addr_code,
         unitName,
         ...rest
-      } = data;
+      } = data
 
       this.ruleForm = {
         ...rest,
         buyerid: buyerid ? [buyerid] : [],
-        addr_code: addr_code ? addr_code.split(",") : [],
+        addr_code: addr_code ? addr_code.split(',') : [],
         cat_id: cat_id ? [cat_id[cat_id.length - 1]] : [],
         supplierNo: supplierNo ? [supplierNo] : [],
         khNo: khNo ? [khNo] : [],
-        tax: tax ? tax + "%" : "",
-        goodUnit: goodUnit ? [goodUnit] : "",
-      };
+        tax: tax ? tax + '%' : '',
+        goodUnit: goodUnit ? [goodUnit] : ''
+      }
 
-      console.log(this.ruleForm);
+      console.log(this.ruleForm)
 
-      this.cat_id_name = cat_id.map(({ name }) => name).join("_");
-      this.unit_name = unitName;
+      this.cat_id_name = cat_id.map(({ name }) => name).join('_')
+      this.unit_name = unitName
 
-      this.khName = khName;
-      this.supplierName = supplierNanme;
-      this.detailLoading = false;
+      this.khName = khName
+      this.supplierName = supplierNanme
+      this.detailLoading = false
     },
     platform_codesearchChange(e) {
-      const { id, label, pay_name } = e;
-      this.ruleForm.platform_id = id || "";
-      this.pay_name = pay_name || "";
-      this.$refs.ruleForm.validateField("platform_id");
+      const { id, label, pay_name } = e
+      this.ruleForm.platform_id = id || ''
+      this.pay_name = pay_name || ''
+      this.$refs.ruleForm.validateField('platform_id')
     },
     // async getAccounts() {
     //   const res = await asyncRequest.accountall(this.dataForm);
@@ -734,60 +736,60 @@ export default {
     //   }
     // },
     async goods_class_change(e) {
-      const { id } = e;
-      this.ruleForm.cat_id = id ? [id] : [];
-      this.$refs.ruleForm.validateField("cat_id");
+      const { id } = e
+      this.ruleForm.cat_id = id ? [id] : []
+      this.$refs.ruleForm.validateField('cat_id')
     },
     async submitForm() {
-      await this.$refs.ruleForm.validate(async (valid) => {
+      await this.$refs.ruleForm.validate(async(valid) => {
         if (valid) {
           if (this.loading) {
-            return;
+            return
           }
 
-          this.loading = true;
-          const model = JSON.parse(JSON.stringify(this.ruleForm));
-          model.supplierNo = model.supplierNo[0];
-          model.khNo = model.khNo[0];
-          model.buyerid = Array.isArray(model.buyerid) ? model.buyerid[0] : model.buyerid;
-          model.cat_id = model.cat_id ? model.cat_id[model.cat_id.length - 1] : "";
-          model.addr_code = model.addr_code.join(",");
-          model.tax = model.tax.split("%")[0];
-          model.pay_name = this.pay_name;
+          this.loading = true
+          const model = JSON.parse(JSON.stringify(this.ruleForm))
+          model.supplierNo = model.supplierNo[0]
+          model.khNo = model.khNo[0]
+          model.buyerid = Array.isArray(model.buyerid) ? model.buyerid[0] : model.buyerid
+          model.cat_id = model.cat_id ? model.cat_id[model.cat_id.length - 1] : ''
+          model.addr_code = model.addr_code.join(',')
+          model.tax = model.tax.split('%')[0]
+          model.pay_name = this.pay_name
           model.goodUnit = Array.isArray(model.goodUnit)
             ? model.goodUnit[0]
-            : model.goodUnit;
+            : model.goodUnit
 
-          let res = {};
-          if (this.id === "003") {
-            delete model["id"];
-            res = await asyncRequest.add(model);
+          let res = {}
+          if (this.id === '003') {
+            delete model['id']
+            res = await asyncRequest.add(model)
           } else {
-            res = await asyncRequest.update(model);
+            res = await asyncRequest.update(model)
           }
-          this.loading = false;
+          this.loading = false
           if (res && res.code === 0) {
-            const title = this.id === "003" ? "添加成功!" : "修改成功!";
+            const title = this.id === '003' ? '添加成功!' : '修改成功!'
             this.$notify.success({
               title,
-              message: "",
-            });
-            this.showModelThis = false;
+              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)
           }
         } else {
-          console.log("error submit!!");
-          return false;
+          console.log('error submit!!')
+          return false
         }
-      });
-    },
-  },
-};
+      })
+    }
+  }
+}
 </script>
 
 <style lang="scss" scoped>

+ 52 - 57
src/views/netOrderEntry/netOrderEnter/importTemplateModal.vue

@@ -25,10 +25,23 @@
 </template>
 
 <script>
-import { columns, getTableProperty, createErrorMessage, createFieldVerification, requsetFields } from './template'
-import { isMobile, isPhone, isnumber3 } from '@/utils/validate'
+import asyncRequest from '@/apis/service/netOrderEntry/netOrderEnter'
+import { isMobile, isPhone, isnumber } from '@/utils/validate'
 import companyHelper from '@/mixins/companyHelper'
 import { MessageBox } from 'element-ui'
+import dayjs from 'dayjs'
+
+import {
+  helper,
+  columns,
+  PROPERTYS,
+  getTableProperty,
+  createErrorMessage,
+  createFieldVerification,
+  requsetFields,
+  requiredFields,
+  numberFields
+} from './template'
 
 export default {
   mixins: [companyHelper],
@@ -63,6 +76,7 @@ export default {
         const field = header[index]
         const importField = importHeader[index]
         if (field !== importField) {
+          console.log(field, importField)
           isHeaderOk = false
           break
         }
@@ -120,10 +134,13 @@ export default {
     /* 校验导入的税率、数量、采购单价、销售单价是否为数字 **/
     validateNumberField(numberFields) {
       const verification = createFieldVerification('税率、数量、销售单价、采购单价不能为空且必须是数字')
-      const { tax, goodNum, goodPrice, cgdPrice } = numberFields
-      tax.forEach((_, index) => {
-        const values = [tax[index], goodNum[index], goodPrice[index], cgdPrice[index]]
-        const valuesIsNumber = values.every(value => isnumber3(value))
+      const fields = helper.fields(numberFields)
+      numberFields[fields[0]].forEach((_, index) => {
+        const values = helper.values(numberFields, fields, index)
+        const valuesIsNumber = values.every(value => {
+          return isnumber(value)
+        })
+        console.log(valuesIsNumber)
         if (!valuesIsNumber) {
           verification.isValid = false
           verification.notValidRows.push(index + 1)
@@ -131,34 +148,12 @@ export default {
       })
       return verification
     },
-    /* 校验导入的税率、数量、单价、采购毛利率是否为数组 **/
+    /* 所属平台、商品分类、商品名称、单位、收货人、收货地址、PO编号不能为空 **/
     validateRequiredField(requiredFields) {
       const verification = createFieldVerification('所属平台、商品分类、商品名称、单位、收货人、收货地址、PO编号不能为空')
-      const {
-        platform_id,
-        cat_id,
-        goodName,
-        goodUnit,
-        contactor,
-        addr,
-        sendtime,
-        poCode
-      } = requiredFields
-
-      platform_id.forEach((_, index) => {
-        const values = [
-          platform_id[index],
-          contactor[index],
-          goodName[index],
-          goodUnit[index],
-          sendtime[index],
-          cat_id[index],
-          poCode[index],
-          addr[index]
-        ]
-
-        const valuesIsNotNull = values.every(value => value && String(value).trim() !== '')
-        if (!valuesIsNotNull) {
+      const fields = helper.fields(requiredFields)
+      requiredFields[fields[0]].forEach((_, index) => {
+        if (!helper.values(requiredFields, fields, index).every(value => value && String(value).trim() !== '')) {
           verification.isValid = false
           verification.notValidRows.push(index + 1)
         }
@@ -195,7 +190,6 @@ export default {
     /* 校验导入的数据 **/
     validateFields(tableData = []) {
       const mapTableFieldToTableData = {}
-
       for (const tableItem of tableData) {
         const propertys = Object.keys(tableItem)
         for (const property of propertys) {
@@ -206,26 +200,12 @@ export default {
       }
 
       return this.handleNotValidFields(
-        this.validateCompanyNo(mapTableFieldToTableData.companyNo),
-        this.validateKhNo(mapTableFieldToTableData.khNo),
-        this.validateSupplierNo(mapTableFieldToTableData.supplierNo),
-        this.validateMobile(mapTableFieldToTableData.mobile),
-        this.validateRequiredField({
-          platform_id: mapTableFieldToTableData.platform_id,
-          cat_id: mapTableFieldToTableData.cat_id,
-          goodName: mapTableFieldToTableData.goodName,
-          goodUnit: mapTableFieldToTableData.goodUnit,
-          contactor: mapTableFieldToTableData.contactor,
-          addr: mapTableFieldToTableData.addr,
-          sendtime: mapTableFieldToTableData.sendtime,
-          poCode: mapTableFieldToTableData.poCode
-        }),
-        this.validateNumberField({
-          tax: mapTableFieldToTableData.tax,
-          goodNum: mapTableFieldToTableData.goodNum,
-          goodPrice: mapTableFieldToTableData.goodPrice,
-          cgdPrice: mapTableFieldToTableData.cgdPrice
-        })
+        this.validateMobile(mapTableFieldToTableData[PROPERTYS.MOBILE]),
+        this.validateKhNo(mapTableFieldToTableData[PROPERTYS.CUSTOMER_NO]),
+        this.validateCompanyNo(mapTableFieldToTableData[PROPERTYS.COMPANY_NO]),
+        this.validateSupplierNo(mapTableFieldToTableData[PROPERTYS.SUPPLIER_NO]),
+        this.validateNumberField(helper.write(mapTableFieldToTableData, numberFields)),
+        this.validateRequiredField(helper.write(mapTableFieldToTableData, requiredFields))
       )
     },
     mapTemplateItemToTableItem(templateItem) {
@@ -256,16 +236,31 @@ export default {
       })
       this.validateFields(this.tableData).message()
     },
-    onSubmit() {
+    async onSubmit() {
       const { message, isFinalValid } = this.validateFields(this.tableData)
       if (!isFinalValid) return message()
 
-      const data = this.tableData.map(tableItem => requsetFields.reduce((prev, currentKey) => ({
+      const list = this.tableData.map(tableItem => requsetFields.reduce((prev, currentKey) => ({
         ...prev,
-        [currentKey]: tableItem[currentKey]
+        [currentKey]: currentKey === PROPERTYS.SEND_TIME ? dayjs(tableItem[currentKey] * 1000).format('YYYY-MM-DD HH:mm:ss') : tableItem[currentKey]
       }), {}))
 
-      console.log(data, 'TODO:requset api....')
+      this.loading = true
+      const result = await asyncRequest.importOrder({
+        list
+      })
+      this.loading = false
+
+      switch (String(result.code)) {
+        case '0':
+          this.$message.success('导入成功')
+          this.innerVisible = false
+          this.$emit('refresh')
+          break
+        default:
+          this.$message.warning(result.message)
+          break
+      }
     }
   }
 }

+ 2 - 1
src/views/netOrderEntry/netOrderEnter/index.vue

@@ -200,7 +200,8 @@
     </ex-table>
     <no-auth v-else></no-auth>
 
-    <import-template-modal :visible.sync="templateModalVisible" />
+    <import-template-modal :visible.sync="templateModalVisible" @refresh="() => onSearch()" />
+    
     <!-- 弹窗 新增/修改 -->
     <add-edit
       :id="modelId"

+ 166 - 98
src/views/netOrderEntry/netOrderEnter/template.js

@@ -1,27 +1,52 @@
 
 const mapTemplateToTable = {
-  '销售方公司编码': 'companyNo',
-  '销售方公司名称': 'value0',
-  '购买方公司编码': 'khNo',
-  '购买方公司名称': 'value1',
+  '所属平台ID': 'platform_id',
   '供应商公司编码': 'supplierNo',
-  '供应商公司名称': 'value2',
-  '所属平台': 'platform_id',
-  '商品分类': 'cat_id',
-  '商品名称': 'goodName',
-  '单位': 'goodUnit',
-  '税率': 'tax',
-  '数量': 'goodNum',
-  '销售单价': 'goodPrice',
-  '采购单价': 'cgdPrice',
-  '采购毛利率': 'cgd_tax',
-  '销售总额': 'good_total',
+  '销售方公司编码': 'companyNo',
+  '购买方公司编码': 'customerNo',
+  '一级品类ID': 'cat_id1',
+  '二级品类ID': 'cat_id2',
+  '三级品类ID': 'cat_id',
+  '商品单位ID': 'good_unit',
+  '税率': 'good_tax',
+  '单据号': 'workCode',
+  'PO编号': 'poCode',
   '收货人': 'contactor',
   '联系电话': 'mobile',
-  '收货地址': 'addr',
   '发货时间': 'sendtime',
-  'PO编号': 'poCode',
-  '单据号': 'workCode'
+  '联系地址': 'addr',
+  '商品名称': 'good_name',
+  '数量': 'good_num',
+  '销售单价': 'sale_price',
+  '采购单价': 'cgd_price',
+  '采购毛利率': 'cgd_tax',
+  '销售总额': 'good_total'
+  // '销售方公司名称': 'value0',
+  // '购买方公司名称': 'value1',
+  // '供应商公司名称': 'value2',
+}
+
+export const getTableProperty = (key) => mapTemplateToTable[key]
+export const PROPERTYS = {
+  COMPANY_NO: getTableProperty('销售方公司编码'),
+  CUSTOMER_NO: getTableProperty('购买方公司编码'),
+  SUPPLIER_NO: getTableProperty('供应商公司编码'),
+  PLATFORM: getTableProperty('所属平台ID'),
+  CATEGORY: getTableProperty('三级品类ID'),
+  GOOD_NAME: getTableProperty('商品名称'),
+  GOOD_UNIT: getTableProperty('商品单位ID'),
+  GOOD_NUM: getTableProperty('数量'),
+  GOOD_PRICE: getTableProperty('销售单价'),
+  TAX: getTableProperty('税率'),
+  CGD_PRICE: getTableProperty('采购单价'),
+  CGD_TAX: getTableProperty('采购单毛利率'),
+  GOOD_TOTAL: getTableProperty('销售总额'),
+  CONTACTOR: getTableProperty('收货人'),
+  MOBILE: getTableProperty('联系电话'),
+  ADDR: getTableProperty('联系地址'),
+  SEND_TIME: getTableProperty('发货时间'),
+  PO_CODE: getTableProperty('PO编号'),
+  WORK_CODE: getTableProperty('单据号')
 }
 
 export const template = Array(1).fill(1).map(() => Object.keys(mapTemplateToTable).reduce((prev, property) => {
@@ -29,140 +54,149 @@ export const template = Array(1).fill(1).map(() => Object.keys(mapTemplateToTabl
   return prev
 }, {}))
 
-export const getTableProperty = (key) => mapTemplateToTable[key]
-
 export const columns = [
   {
     type: 'index',
     label: '序号',
     width: '70px'
   },
+  // {
+  //   prop: getTableProperty('销售方公司名称'),
+  //   label: '销售方公司名称',
+  //   width: '156px'
+  // },
+  // {
+  //   prop: getTableProperty('购买方公司名称'),
+  //   label: '购买方公司名称',
+  //   width: '180px'
+  // },
+  // {
+  //   prop: getTableProperty('供应商公司名称'),
+  //   label: '供应商公司名称',
+  //   width: '120px'
+  // },
   {
-    prop: getTableProperty('销售方公司编码'),
-    label: '销售方公司编码',
-    width: '156px',
+    prop: PROPERTYS.PLATFORM,
+    label: '所属平台ID',
+    width: '110px',
     required: true
   },
-
-  {
-    prop: getTableProperty('销售方公司名称'),
-    label: '销售方公司名称',
-    width: '156px'
-  },
   {
-    prop: getTableProperty('购买方公司编码'),
-    label: '购买方公司编码',
-    width: '180px',
+    prop: PROPERTYS.SUPPLIER_NO,
+    label: '供应商公司编码',
+    width: '120px',
     required: true
   },
   {
-    prop: getTableProperty('购买方公司名称'),
-    label: '购买方公司名称',
-    width: '180px'
+    prop: PROPERTYS.COMPANY_NO,
+    label: '销售方公司编码',
+    width: '156px',
+    required: true
   },
   {
-    prop: getTableProperty('供应商公司编码'),
-    label: '供应商公司编码',
-    width: '120px',
+    prop: PROPERTYS.CUSTOMER_NO,
+    label: '购买方公司编码',
+    width: '180px',
     required: true
   },
 
   {
-    prop: getTableProperty('供应商公司名称'),
-    label: '供应商公司名称',
-    width: '120px'
-  },
-  {
-    prop: getTableProperty('所属平台'),
-    label: '所属平台',
-    width: '110px',
+    prop: getTableProperty('一级品类ID'),
+    label: '一级品类ID',
+    width: '150px',
     required: true
   },
   {
-    prop: getTableProperty('商品分类'),
-    label: '商品分类',
+    prop: getTableProperty('二级品类ID'),
+    label: '二级品类ID',
     width: '150px',
     required: true
   },
   {
-    prop: getTableProperty('商品名称'),
-    label: '商品名称',
+    prop: getTableProperty('三级品类ID'),
+    label: '三级品类ID',
     width: '150px',
     required: true
   },
   {
-    prop: getTableProperty('单位'),
-    label: '单位',
+    prop: PROPERTYS.GOOD_UNIT,
+    label: '商品单位ID',
     width: '150px',
     required: true
   },
   {
-    prop: getTableProperty('税率'),
+    prop: PROPERTYS.TAX,
     label: '税率',
     width: '150px',
     required: true
   },
   {
-    prop: getTableProperty('数量'),
-    label: '数量',
-    width: '140px',
-    required: true
+    prop: PROPERTYS.WORK_CODE,
+    label: '单据号',
+    'width': '150px'
   },
   {
-    prop: getTableProperty('销售单价'),
-    label: '销售单价',
+    prop: PROPERTYS.PO_CODE,
+    label: 'PO编号',
     'width': '150px',
     required: true
   },
   {
-    prop: getTableProperty('采购单价'),
-    label: '采购单价',
+    prop: PROPERTYS.CONTACTOR,
+    label: '收货人',
     'width': '150px',
     required: true
   },
   {
-    prop: getTableProperty('采购毛利率'),
-    label: '采购毛利率',
-    'width': '150px'
+    prop: PROPERTYS.MOBILE,
+    label: '联系电话',
+    'width': '150px',
+    required: true
   },
   {
-    prop: getTableProperty('销售总额'),
-    label: '销售总额',
-    'width': '150px'
+    prop: PROPERTYS.SEND_TIME,
+    label: '发货时间',
+    'width': '150px',
+    required: true
   },
   {
-    prop: getTableProperty('收货人'),
-    label: '收货人',
+    prop: PROPERTYS.ADDR,
+    label: '联系地址',
     'width': '150px',
     required: true
   },
   {
-    prop: getTableProperty('联系电话'),
-    label: '联系电话',
-    'width': '150px',
+    prop: PROPERTYS.GOOD_NAME,
+    label: '商品名称',
+    width: '150px',
     required: true
   },
   {
-    prop: getTableProperty('收货地址'),
-    label: '收货地址',
-    'width': '150px',
+    prop: PROPERTYS.GOOD_NUM,
+    label: '数量',
+    width: '140px',
     required: true
   },
   {
-    prop: getTableProperty('发货时间'),
-    label: '发货时间',
+    prop: PROPERTYS.GOOD_PRICE,
+    label: '销售单价',
     'width': '150px',
     required: true
   },
   {
-    prop: getTableProperty('PO编号'),
-    label: 'PO编号',
+    prop: PROPERTYS.CGD_PRICE,
+    label: '采购单价',
     'width': '150px',
     required: true
   },
   {
-    prop: getTableProperty('单据号'),
-    label: '单据号',
+    prop: PROPERTYS.CGD_TAX,
+    label: '采购毛利率',
+    'width': '150px'
+  },
+  {
+    prop: PROPERTYS.GOOD_TOTAL,
+    label: '销售总额',
     'width': '150px'
   }
 ]
@@ -188,22 +222,56 @@ export const createFieldVerification = (message) => ({
 })
 
 export const requsetFields = [
-  getTableProperty('销售方公司编码'),
-  getTableProperty('购买方公司编码'),
-  getTableProperty('供应商公司编码'),
-  getTableProperty('所属平台'),
-  getTableProperty('商品分类'),
-  getTableProperty('商品名称'),
-  getTableProperty('单位'),
-  getTableProperty('税率'),
-  getTableProperty('数量'),
-  getTableProperty('销售单价'),
-  getTableProperty('采购单价'),
-  getTableProperty('收货人'),
-  getTableProperty('联系电话'),
-  getTableProperty('收货地址'),
-  getTableProperty('发货时间'),
-  getTableProperty('PO编号'),
-  getTableProperty('单据号')
+  PROPERTYS.TAX,
+  PROPERTYS.ADDR,
+  PROPERTYS.MOBILE,
+  PROPERTYS.PO_CODE,
+  PROPERTYS.PLATFORM,
+  PROPERTYS.CATEGORY,
+  PROPERTYS.GOOD_NAME,
+  PROPERTYS.GOOD_UNIT,
+  PROPERTYS.GOOD_NUM,
+  PROPERTYS.CGD_PRICE,
+  PROPERTYS.CONTACTOR,
+  PROPERTYS.SEND_TIME,
+  PROPERTYS.WORK_CODE,
+  PROPERTYS.GOOD_PRICE,
+  PROPERTYS.COMPANY_NO,
+  PROPERTYS.SUPPLIER_NO,
+  PROPERTYS.CUSTOMER_NO
+]
+
+export const requiredFields = [
+  PROPERTYS.ADDR,
+  PROPERTYS.PO_CODE,
+  PROPERTYS.CATEGORY,
+  PROPERTYS.PLATFORM,
+  PROPERTYS.CONTACTOR,
+  PROPERTYS.SEND_TIME,
+  PROPERTYS.GOOD_NAME,
+  PROPERTYS.GOOD_UNIT
+]
+
+export const numberFields = [
+  PROPERTYS.TAX,
+  PROPERTYS.GOOD_NUM,
+  PROPERTYS.CGD_PRICE,
+  PROPERTYS.GOOD_PRICE
 ]
 
+export const helper = {
+  fields(sourceObject) {
+    return Object.keys(sourceObject)
+  },
+  values(sourceObject, fields, index = 0) {
+    return fields.map(field => {
+      return sourceObject[field][index]
+    })
+  },
+  write(sourceObject, fields) {
+    return fields.reduce((prev, currentKey) => ({
+      ...prev,
+      [currentKey]: sourceObject[currentKey]
+    }), {})
+  }
+}

+ 783 - 0
src/views/netOrderEntry/prestoreRecordingOrders/addEdit.vue

@@ -0,0 +1,783 @@
+<template>
+  <el-dialog
+    v-loading="loading || detailLoading"
+    :title="title"
+    :center="true"
+    align="left"
+    top="10vh"
+    width="1040px"
+    :close-on-click-modal="false"
+    :visible.sync="showModelThis"
+    element-loading-text="拼命加载中"
+    element-loading-spinner="el-icon-loading"
+    element-loading-background="rgba(0, 0, 0, 0.8)"
+    @close="handleClose"
+  >
+    <el-card style="margin: -20px 0 0 0">
+      <el-row :gutter="10">
+        <el-col :span="24">
+          <el-form
+            ref="ruleForm"
+            :model="ruleForm"
+            status-icon
+            :rules="rulesThis"
+            label-width="80px"
+            class="demo-ruleForm"
+            size="mini"
+          >
+            <el-divider>
+              <el-tag size="mini">销售订单信息</el-tag>
+            </el-divider>
+
+            <el-row>
+              <el-col :span="12">
+                <el-form-item label="商品分类" prop="cat_info">
+                  <company-sort
+                    :value="ruleForm.cat_info"
+                    :placeholder="'商品分类'"
+                    :disabled="id !== '003'"
+                    :size="'mini'"
+                    :company-no="ruleForm.companyNo"
+                    :names="cat_info_name"
+                    :is-detail="type !== 'add'"
+                    @searchChange="goods_class_change"
+                  />
+                </el-form-item>
+              </el-col>
+              <!-- <el-col :span="7">
+                <el-form-item label="采购员" prop="buyerid">
+                  <search-account
+                    size="mini"
+                    placeholder="采购员"
+                    level="2"
+                    :value="ruleForm.buyerid"
+                    :names="ruleForm.buyer_name"
+                    :is-detail="true"
+                    @searchChange="handleHandoverName"
+                  />
+                </el-form-item>
+              </el-col> -->
+
+              <el-col :span="12">
+                <el-form-item label="所属平台" prop="platform_id">
+                  <search-terrace
+                    :value="ruleForm.platform_id"
+                    :disabled="id !== '003'"
+                    :size="'mini'"
+                    :is-detail="falsse"
+                    :is_show="'0'"
+                    :placeholder="'所属平台'"
+                    @searchChange="platform_codesearchChange"
+                  />
+                </el-form-item>
+              </el-col>
+              <el-col :span="12">
+                <el-form-item label="单据号" prop="workCode">
+                  <el-input
+                    v-model="ruleForm.workCode"
+                    :disabled="id === '007'"
+                    maxlength="50"
+                    placeholder="单据号"
+                  />
+                </el-form-item>
+              </el-col>
+
+              <el-col :span="12">
+                <el-form-item label="PO编号" prop="poCode">
+                  <el-input
+                    v-model="ruleForm.poCode"
+                    placeholder="PO编号"
+                    maxlength="50"
+                    :disabled="id === '007'"
+                  />
+                </el-form-item>
+              </el-col>
+
+              <el-col :span="12">
+                <el-form-item label="购买方公司" label-width="100px" prop="customerNo">
+                  <search-customer
+                    size="mini"
+                    :names="customerName"
+                    :disabled="id !== '003'"
+                    :is-detail="type !== 'add'"
+                    :value="ruleForm.customerNo"
+                    placeholder="购买方公司"
+                    @searchChange="handleCustomerChange"
+                  />
+                </el-form-item>
+              </el-col>
+
+              <el-col :span="12">
+                <el-form-item label="销售方公司" label-width="100px" prop="companyNo">
+                  <search-work-company
+                    disabled
+                    :value="ruleForm.companyNo"
+                    :names="''"
+                    :size="'mini'"
+                    :placeholder="'销售方公司'"
+                    @searchChange="handleCompanyChange"
+                  />
+                </el-form-item>
+              </el-col>
+            </el-row>
+
+            <el-divider>
+              <el-tag size="mini">收货信息</el-tag>
+            </el-divider>
+            <el-row>
+              <el-col :span="8">
+                <el-form-item label="收货人" prop="contactor">
+                  <el-input
+                    v-model="ruleForm.contactor"
+                    :disabled="id === '007'"
+                    placeholder="收货人"
+                    maxlength="30"
+                  />
+                </el-form-item>
+              </el-col>
+
+              <el-col :span="8">
+                <el-form-item label="联系电话" prop="mobile">
+                  <el-input
+                    v-model="ruleForm.mobile"
+                    :disabled="id === '007'"
+                    placeholder="联系电话"
+                    maxlength="11"
+                  />
+                </el-form-item>
+              </el-col>
+
+              <!-- <el-col :span="12">
+                <el-form-item label="收货省市区" prop="addr_code" label-width="100px">
+                  <select-area
+                    size="mini"
+                    :value="ruleForm.addr_code"
+                    placeholder="收货省市区"
+                    :disabled="id === '007'"
+                    @selectChange="select_area_change($event)"
+                  />
+                </el-form-item>
+              </el-col> -->
+
+              <el-col :span="8">
+                <el-form-item label="发货时间" prop="sendtime">
+                  <el-date-picker
+                    v-model="ruleForm.sendtime"
+                    value-format="yyyy-MM-dd"
+                    :disabled="id === '007'"
+                    type="datetime"
+                    placeholder="发货时间"
+                    style="width: 100%"
+                    :picker-options="pickerOptions"
+                  />
+                </el-form-item>
+              </el-col>
+
+              <el-col :span="24">
+                <el-form-item label="联系地址" prop="addr">
+                  <el-input
+                    v-model="ruleForm.addr"
+                    :disabled="id === '007'"
+                    maxlength="100"
+                    placeholder="联系地址"
+                  />
+                </el-form-item>
+              </el-col>
+            </el-row>
+
+            <el-divider>
+              <el-tag size="mini">商品信息</el-tag>
+            </el-divider>
+            <el-row>
+              <el-col :span="12">
+                <el-form-item label="供应商公司" label-width="100px" prop="supplierNo">
+                  <search-supplier
+                    size="mini"
+                    placeholder="供应商公司"
+                    :value="ruleForm.supplierNo"
+                    :names="supplierName"
+                    :disabled="id === '007'"
+                    :is-detail="type !== 'add'"
+                    @searchChange="handleSupplierChange"
+                  />
+                </el-form-item>
+              </el-col>
+              <el-col :span="12">
+                <el-form-item label="商品名称" prop="good_name">
+                  <el-input
+                    v-model="ruleForm.good_name"
+                    placeholder="商品名称"
+                    maxlength="50"
+                    :disabled="id !== '003'"
+                  />
+                </el-form-item>
+              </el-col>
+            </el-row>
+
+            <el-row>
+              <el-col :span="6">
+                <el-form-item label="数量" prop="good_num" label-width="60px">
+                  <el-input-number
+                    v-model="ruleForm.good_num"
+                    :disabled="id !== '003'"
+                    style="width: 100%"
+                    controls-position="right"
+                    placeholder="数量"
+                    :precision="0"
+                    :min="0"
+                    :step="1"
+                  />
+                </el-form-item>
+              </el-col>
+
+              <el-col :span="6">
+                <el-form-item label="销售单价" prop="sale_price">
+                  <el-input-number
+                    v-model="ruleForm.sale_price"
+                    :disabled="id !== '003'"
+                    style="width: 100%"
+                    controls-position="right"
+                    placeholder="单价"
+                    :precision="2"
+                    :min="0"
+                    :step="0.01"
+                    @change="number_change($event, 1)"
+                  />
+                </el-form-item>
+              </el-col>
+              <el-col :span="6">
+                <el-form-item label="采购单价" prop="cgd_price">
+                  <el-input-number
+                    v-model="ruleForm.cgd_price"
+                    style="width: 100%"
+                    :disabled="id === '007'"
+                    controls-position="right"
+                    placeholder="采购单价"
+                    :precision="2"
+                    :min="0"
+                    :step="0.01"
+                    @change="number_change($event, 1)"
+                  />
+                </el-form-item>
+              </el-col>
+              <el-col :span="6">
+                <el-form-item label="采购毛利率" label-width="100px" prop="cgd_tax">
+                  <el-input-number
+                    v-model="ruleForm.cgd_tax"
+                    style="width: 100%"
+                    :disabled="id === '007'"
+                    controls-position="right"
+                    placeholder="采购毛利率"
+                    :precision="2"
+                    :min="0"
+                    :max="100"
+                    :step="0.01"
+                    @change="number_change($event, 2)"
+                  />
+                </el-form-item>
+              </el-col>
+            </el-row>
+            <el-row>
+              <el-col :span="6">
+                <el-form-item label="单位" prop="good_unit" label-width="60px">
+                  <search-unit
+                    disabled
+                    :value="ruleForm.good_unit"
+                    :size="'mini'"
+                    :is-detail="true"
+                    :names="unit_name"
+                    :placeholder="'good_unit'"
+                    @searchChange="unitsearchChange"
+                  />
+                </el-form-item>
+              </el-col>
+              <el-col :span="6">
+                <el-form-item label="销售总额" prop="good_total">
+                  <el-input v-model="ruleForm.good_total" placeholder="销售总额" disabled>
+                    <template #append>元</template>
+                  </el-input>
+                </el-form-item>
+              </el-col>
+
+              <el-col :span="6">
+                <el-form-item label="税率" prop="tax">
+                  <search-tax
+                    :disabled="id === '007'"
+                    :value="ruleForm.tax"
+                    :size="'mini'"
+                    :is-detail="type !== 'add'"
+                    :placeholder="'税点'"
+                    @searchChange="handleTaxChange"
+                  />
+                </el-form-item>
+              </el-col>
+            </el-row>
+          </el-form>
+        </el-col>
+        <el-col :span="24" style="text-align: right">
+          <el-button
+            v-if="id !== '007'"
+            type="primary"
+            @click="submitForm"
+          >保 存</el-button>
+          <el-button @click="showModelThis = false">
+            {{ id == "007" ? "关 闭" : "取 消" }}
+          </el-button>
+        </el-col>
+      </el-row>
+    </el-card>
+  </el-dialog>
+</template>
+<script>
+import asyncRequest from '@/apis/service/netOrderEntry/prestoreRecordingOrders'
+import companyHelper from '@/mixins/companyHelper'
+import { accMul, accDiv, accSub, isPhone, isMobile } from '@/utils/validate'
+import resToken from '@/mixins/resToken'
+
+const defaultData = {
+  addr_code: [],
+  cgd_price: '',
+  // buyerid: "",
+  // buyer_name: "",
+  platform_id: '',
+  cgd_tax: '',
+  workCode: '',
+  poCode: '',
+  customerNo: '',
+  companyNo: '',
+  contactor: '',
+  mobile: '',
+  addr: '',
+  sendtime: '',
+  supplierNo: '',
+  cat_info: '',
+  good_name: '',
+  good_num: '',
+  sale_price: '',
+  good_total: '',
+  good_unit: '',
+  tax: ''
+}
+
+export default {
+  name: 'Terrace',
+  mixins: [resToken, companyHelper],
+  props: ['showModel', 'id', 'sitem'],
+  data() {
+    const validatemobile = (rule, value, callback) => {
+      if (value !== '') {
+        if (isPhone(value) || isMobile(value)) {
+          callback()
+        } else {
+          callback(new Error('联系电话格式不正确!'))
+        }
+      } else {
+        callback(new Error('请输入联系电话!'))
+      }
+    }
+
+    return {
+      loading: false,
+      detailLoading: false,
+      title: '添加销售订单信息',
+      customerName: '',
+      accounts: [],
+      cat_info_name: '',
+      showModelThis: this.showModel,
+      pickerOptions: {
+        disabledDate: (time) => time.getTime() > new Date()
+      },
+      names: [],
+      unit_name: '',
+      companyName: '',
+      ruleForm: { ...defaultData },
+      rulesThis: this.rules,
+      rules: {
+        good_unit: [
+          {
+            required: true,
+            message: '请选择good_unit',
+            trigger: 'blur'
+          }
+        ],
+        // addr_code: [
+        //   {
+        //     type: "array",
+        //     required: true,
+        //     message: "请选择收货省市区",
+        //     trigger: "blur",
+        //   },
+        // ],
+        platform_id: [
+          {
+            required: true,
+            message: '请输入所属平台',
+            trigger: 'blur'
+          }
+        ],
+
+        cgd_tax: [
+          {
+            required: true,
+            message: '请输入采购毛利率',
+            trigger: 'blur'
+          }
+        ],
+        cat_info: [
+          {
+            required: true,
+            message: '请选择商品分类',
+            trigger: 'change'
+          }
+        ],
+        supplierNo: [
+          {
+            type: 'array',
+            required: true,
+            message: '请选择供应商公司',
+            trigger: 'change'
+          }
+        ],
+        qrdType: [
+          {
+            required: true,
+            message: '请输入订单来源',
+            trigger: 'blur'
+          }
+        ],
+        good_total: [
+          {
+            required: true,
+            message: '请输入货款总金额',
+            trigger: 'blur'
+          }
+        ],
+        // workCode: [
+        //   {
+        //     required: true,
+        //     message: '请输入单据号',
+        //     trigger: 'blur'
+        //   }
+        // ],
+        poCode: [
+          {
+            required: true,
+            message: '请输入PO编号',
+            trigger: 'blur'
+          }
+        ],
+        customerNo: [
+          {
+            type: 'array',
+            required: true,
+            message: '请选择购买方公司',
+            trigger: 'change'
+          }
+        ],
+        tax: [
+          {
+            required: true,
+            message: '请选择税率',
+            trigger: 'change'
+          }
+        ],
+        companyNo: [
+          {
+            required: true,
+            message: '请选择销售方公司',
+            trigger: 'change'
+          }
+        ],
+        contactor: [
+          {
+            required: true,
+            message: '请输入收货人',
+            trigger: 'blur'
+          }
+        ],
+        mobile: [
+          {
+            required: true,
+            validator: validatemobile,
+            trigger: 'blur'
+          }
+        ],
+        addr: [
+          {
+            required: true,
+            message: '请输入联系地址',
+            trigger: 'blur'
+          }
+        ],
+
+        sendtime: [
+          {
+            required: true,
+            message: '请输入发货时间',
+            trigger: 'change'
+          }
+        ],
+
+        good_name: [
+          {
+            required: true,
+            message: '请输入商品名称',
+            trigger: 'blur'
+          }
+        ],
+        sale_price: [
+          {
+            required: true,
+            message: '请输入销售单价',
+            trigger: 'blur'
+          }
+        ],
+        cgd_price: [
+          {
+            required: true,
+            message: '请选择采购单价',
+            trigger: 'blur'
+          }
+        ],
+        good_num: [
+          {
+            required: true,
+            message: '请输入数量',
+            trigger: 'blur'
+          }
+        ]
+      }
+    }
+  },
+  computed: {
+    totalWatchSource() {
+      const { good_num, sale_price } = this.ruleForm
+      return { good_num, sale_price }
+    }
+  },
+  watch: {
+    showModel: function(val) {
+      this.showModelThis = val
+      if (val) {
+        this.initForm()
+      }
+    },
+    showModelThis(val) {
+      if (!val) {
+        this.$emit('cancel')
+      }
+    },
+    totalWatchSource: {
+      handler({ sale_price, good_num }) {
+        if (sale_price === 0 || good_num === 0) {
+          this.ruleForm.good_total = 0
+          return
+        }
+
+        this.ruleForm.good_total = accMul(sale_price, good_num)
+      },
+      deep: true
+    }
+  },
+  methods: {
+    async handleHandoverName(e) {
+      this.ruleForm.buyerid = e && e.id ? [e.id] : ''
+      this.ruleForm.buyer_name = e && e.label ? e.label : ''
+      this.$refs.ruleForm.validateField('buyerid')
+    },
+    async select_area_change(e) {
+      this.ruleForm.addr_code = e
+      this.$refs.ruleForm.validateField('addr_code')
+    },
+    number_change(e, type) {
+      console.log(1111)
+      const { cgd_price, sale_price, cgd_tax } = this.ruleForm
+      let tax = 0
+      let cgd_price1 = 0
+
+      if (type === 1) {
+        // tax = (1 - cgd_price / sale_price)*100
+        tax = accMul(accSub(1, accDiv(cgd_price, sale_price)), 100)
+        this.ruleForm.cgd_tax = tax
+        this.$refs.ruleForm.validateField('cgd_tax')
+        console.log(type, tax)
+      }
+      if (type === 2) {
+        // cgd_price = (100 - cgd_tax) * sale_price;
+        cgd_price1 = accMul(accDiv(100, cgd_tax), sale_price)
+        this.ruleForm.cgd_price = cgd_price1
+        this.$refs.ruleForm.validateField('cgd_price')
+        console.log(type, cgd_tax)
+      }
+    },
+    handleClose() {
+      this.showModelThis = false
+      this.companyName = ''
+      this.customerName = ''
+      this.supplierName = ''
+      this.ruleForm = { ...defaultData }
+    },
+    async initForm() {
+      this.loading = true
+      // await this.getAccounts();
+
+      if (this.id === '003') {
+        this.title = '添加销售订单信息'
+        this.rulesThis = this.rules
+      } else if (this.id === '005') {
+        this.title = '修改销售订单信息'
+        this.rulesThis = this.rules
+      } else {
+        this.title = '销售订单信息详情'
+        this.rulesThis = {}
+      }
+      await this.resetForm()
+      this.loading = false
+    },
+
+    handleCompanyChange(e) {
+      this.ruleForm.companyNo = e.code || ''
+      this.$refs.ruleForm.validateField('companyNo')
+    },
+    handleCustomerChange(e) {
+      this.ruleForm.customerNo = e.code ? [e.code] : ''
+      this.$refs.ruleForm.validateField('customerNo')
+    },
+    handleSupplierChange(e) {
+      this.ruleForm.supplierNo = e.code ? [e.code] : ''
+      this.$refs.ruleForm.validateField('supplierNo')
+    },
+    handleGoodClassChange(e) {
+      this.ruleForm.cat_info = e
+      this.$refs.ruleForm.validateField('cat_info')
+    },
+    handleTaxChange(e) {
+      this.ruleForm.tax = e
+      this.$refs.ruleForm.validateField('tax')
+    },
+    unitsearchChange(e) {
+      console.log(e)
+      const { id, code, label } = e
+      this.ruleForm.good_unit = code ? [code] : []
+      this.$refs.ruleForm.validateField('good_unit')
+    },
+    async resetForm() {
+      // 重置
+      await this.$nextTick(() => {
+        if (this.$refs.ruleForm) {
+          this.$refs.ruleForm.resetFields()
+          this.$refs.ruleForm.clearValidate()
+        }
+      })
+
+      if (this.id === '003') {
+        this.ruleForm.companyNo = this.currentCompany
+        return
+      }
+
+      if (this.id !== '003') this.getDetail()
+    },
+    async getDetail() {
+      this.detailLoading = true
+      const { interNo } = this.sitem
+      const { data } = await asyncRequest.detail({ interNo })
+
+      const {
+        cat_info,
+        buyerid,
+        customerNo,
+        supplierNo,
+        supplierNanme,
+        customerName,
+        good_unit,
+        good_tax,
+        addr_code,
+        unit_name,
+        ...rest
+      } = data
+
+      this.ruleForm = {
+        ...rest,
+        buyerid: buyerid ? [buyerid] : [],
+        addr_code: addr_code ? addr_code.split(',') : [],
+        cat_info: cat_info ? [cat_info[cat_info.length - 1]] : [],
+        supplierNo: supplierNo ? [supplierNo] : [],
+        customerNo: customerNo ? [customerNo] : [],
+        tax: good_tax ? Number(good_tax).toFixed(0) + '%' : '',
+        good_unit: good_unit ? [good_unit] : ''
+      }
+
+      this.cat_info_name = cat_info.map(({ name }) => name).join('_')
+      this.unit_name = unit_name
+
+      this.customerName = customerName
+      this.supplierName = supplierNanme
+      this.detailLoading = false
+    },
+    platform_codesearchChange(e) {
+      const { id, label, pay_name } = e
+      this.ruleForm.platform_id = id || ''
+      this.pay_name = pay_name || ''
+      this.$refs.ruleForm.validateField('platform_id')
+    },
+    async goods_class_change(e) {
+      const { id } = e
+      this.ruleForm.cat_info = id ? [id] : []
+      this.$refs.ruleForm.validateField('cat_info')
+    },
+    async submitForm() {
+      await this.$refs.ruleForm.validate(async(valid) => {
+        if (valid) {
+          if (this.loading) {
+            return
+          }
+
+          this.loading = true
+          const model = JSON.parse(JSON.stringify(this.ruleForm))
+          model.supplierNo = model.supplierNo[0]
+          model.customerNo = model.customerNo[0]
+          model.buyerid = Array.isArray(model.buyerid) ? model.buyerid[0] : model.buyerid
+          model.cat_info = model.cat_info ? model.cat_info[model.cat_info.length - 1] : ''
+          model.addr_code = model.addr_code.join(',')
+          model.tax = model.tax.split('%')[0]
+          model.pay_name = this.pay_name
+          model.good_unit = Array.isArray(model.good_unit)
+            ? model.good_unit[0]
+            : model.good_unit
+
+          let res = {}
+          if (this.id === '003') {
+            delete model['id']
+            res = await asyncRequest.add(model)
+          } else {
+            res = await asyncRequest.update(model)
+          }
+          this.loading = false
+          if (res && res.code === 0) {
+            const title = this.id === '003' ? '添加成功!' : '修改成功!'
+            this.$notify.success({
+              title,
+              message: ''
+            })
+            this.showModelThis = false
+            // 刷新
+            this.$emit('refresh')
+          } else if (res && res.code >= 100 && res.code <= 104) {
+            await this.logout()
+          } else {
+            this.$message.warning(res.message)
+          }
+        } else {
+          console.log('error submit!!')
+          return false
+        }
+      })
+    }
+  }
+}
+</script>
+
+<style lang="scss" scoped>
+.terrace {
+}
+</style>

+ 273 - 0
src/views/netOrderEntry/prestoreRecordingOrders/importTemplateModal.vue

@@ -0,0 +1,273 @@
+<template>
+  <el-dialog
+    center
+    width="1024px"
+    title="导入采销订单补录"
+    :visible="innerVisible"
+    :close-on-click-modal="false"
+    @close="innerVisible = false; tableData = []"
+  >
+    <div v-if="tableData && tableData.length > 0" class="tr" style="padding: 10px 0 0 0">
+      <el-button :size="'mini'" @click="() => tableData = []">取消</el-button>
+      <el-button type="primary" :size="'mini'" @click="onSubmit">提交</el-button>
+    </div>
+    <div v-else>
+      <upload-excel :on-success="onSuccess" :before-upload="beforeUpload" />
+    </div>
+
+    <ex-table
+      :columns="columns"
+      :table="table"
+      :data="tableData"
+      style="margin: 15px 0 0 0"
+    />
+  </el-dialog>
+</template>
+
+<script>
+import asyncRequest from '@/apis/service/netOrderEntry/netOrderEnter'
+import { isMobile, isPhone, isnumber } from '@/utils/validate'
+import companyHelper from '@/mixins/companyHelper'
+import { MessageBox } from 'element-ui'
+import dayjs from 'dayjs'
+
+import {
+  helper,
+  columns,
+  PROPERTYS,
+  getTableProperty,
+  createErrorMessage,
+  createFieldVerification,
+  requsetFields,
+  requiredFields,
+  numberFields
+} from './template'
+
+export default {
+  mixins: [companyHelper],
+  props: ['visible'],
+  data() {
+    return {
+      columns,
+      loading: false,
+      tableData: [],
+      table: {
+        stripe: true,
+        border: true,
+        'max-height': '800px'
+      }
+    }
+  },
+  computed: {
+    innerVisible: {
+      get() {
+        return this.visible
+      },
+      set(newVal) {
+        this.$emit('update:visible', newVal)
+      }
+    }
+  },
+  methods: {
+    validateTableHeader(header, importHeader) {
+      let isHeaderOk = true
+      if (header.length !== importHeader.length) return false
+      for (const index in header) {
+        const field = header[index]
+        const importField = importHeader[index]
+        if (field !== importField) {
+          console.log(field, importField)
+          isHeaderOk = false
+          break
+        }
+      }
+
+      return isHeaderOk
+    },
+    /* 校验导入的销售方列表编码(与选择的公司必须一致) **/
+    validateCompanyNo(companys = []) {
+      const verification = createFieldVerification('销售方公司不能为空且必须与选择的公司一致')
+      const current = this.currentCompany
+      companys.forEach((companyNo, index) => {
+        if (companyNo !== current || !companyNo) {
+          verification.isValid = false
+          verification.notValidRows.push(index + 1)
+        }
+      })
+      return verification
+    },
+    /* 校验导入的购买方列表编码(开头必须为KH) **/
+    validateKhNo(customers = []) {
+      const verification = createFieldVerification("购买方公司编码不能为空且必须以'KH'开头")
+      customers.forEach((customerNo, index) => {
+        const perfix = String(customerNo || '').slice(0, 2)
+        if (perfix !== 'KH' || !customerNo) {
+          verification.isValid = false
+          verification.notValidRows.push(index + 1)
+        }
+      })
+      return verification
+    },
+    /* 校验导入的联系电话是否合法 **/
+    validateMobile(mobiles = []) {
+      const verification = createFieldVerification('联系电话不能为空且必须为手机号或电话号码')
+      mobiles.forEach((mobile, index) => {
+        if (!mobile || isMobile(mobile) && isPhone(mobile)) {
+          verification.isValid = false
+          verification.notValidRows.push(index + 1)
+        }
+      })
+      return verification
+    },
+    /* 校验导入的购买方列表编码(开头必须为QS) **/
+    validateSupplierNo(suppliers = []) {
+      const verification = createFieldVerification("供应商公司编码不能为空且必须以'QS'开头")
+      suppliers.forEach((supplierNo, index) => {
+        const perfix = String(supplierNo || '').slice(0, 2)
+        if (perfix !== 'QS' || !supplierNo) {
+          verification.isValid = false
+          verification.notValidRows.push(index + 1)
+        }
+      })
+      return verification
+    },
+    /* 校验导入的税率、数量、采购单价、销售单价是否为数字 **/
+    validateNumberField(numberFields) {
+      const verification = createFieldVerification('税率、数量、销售单价、采购单价不能为空且必须是数字')
+      const fields = helper.fields(numberFields)
+      numberFields[fields[0]].forEach((_, index) => {
+        const values = helper.values(numberFields, fields, index)
+        const valuesIsNumber = values.every(value => {
+          return isnumber(value)
+        })
+        console.log(valuesIsNumber)
+        if (!valuesIsNumber) {
+          verification.isValid = false
+          verification.notValidRows.push(index + 1)
+        }
+      })
+      return verification
+    },
+    /* 所属平台、商品分类、商品名称、单位、收货人、收货地址、PO编号不能为空 **/
+    validateRequiredField(requiredFields) {
+      const verification = createFieldVerification('所属平台、商品分类、商品名称、单位、收货人、收货地址、PO编号不能为空')
+      const fields = helper.fields(requiredFields)
+      requiredFields[fields[0]].forEach((_, index) => {
+        if (!helper.values(requiredFields, fields, index).every(value => value && String(value).trim() !== '')) {
+          verification.isValid = false
+          verification.notValidRows.push(index + 1)
+        }
+      })
+      return verification
+    },
+    /* 处理不合法的值,提示错误信息,并返回最终的验证状态 **/
+    handleNotValidFields(...validStates) {
+      const messages = {}
+      let isFinalValid = true
+
+      for (const validState of validStates) {
+        const { message, isValid, notValidRows } = validState
+        if (isValid) continue
+        isFinalValid = false
+
+        notValidRows.forEach(row => {
+          if (!messages[row]) messages[row] = []
+          messages[row].push(message)
+        })
+      }
+
+      return {
+        isFinalValid,
+        message: () => !isFinalValid && MessageBox({
+          type: 'warning',
+          title: '数据填写错误',
+          dangerouslyUseHTMLString: true,
+          message: createErrorMessage(messages),
+          customClass: 'error-message__wrapper'
+        })
+      }
+    },
+    /* 校验导入的数据 **/
+    validateFields(tableData = []) {
+      const mapTableFieldToTableData = {}
+      for (const tableItem of tableData) {
+        const propertys = Object.keys(tableItem)
+        for (const property of propertys) {
+          const value = tableItem[property]
+          if (!mapTableFieldToTableData[property]) mapTableFieldToTableData[property] = []
+          mapTableFieldToTableData[property].push(value)
+        }
+      }
+
+      return this.handleNotValidFields(
+        this.validateMobile(mapTableFieldToTableData[PROPERTYS.MOBILE]),
+        this.validateKhNo(mapTableFieldToTableData[PROPERTYS.CUSTOMER_NO]),
+        this.validateCompanyNo(mapTableFieldToTableData[PROPERTYS.COMPANY_NO]),
+        this.validateSupplierNo(mapTableFieldToTableData[PROPERTYS.SUPPLIER_NO]),
+        this.validateNumberField(helper.write(mapTableFieldToTableData, numberFields)),
+        this.validateRequiredField(helper.write(mapTableFieldToTableData, requiredFields))
+      )
+    },
+    mapTemplateItemToTableItem(templateItem) {
+      const tableItem = {}
+      const templatePropertys = Object.keys(templateItem)
+      templatePropertys.forEach(templateProperty => {
+        const tableproperty = getTableProperty(templateProperty)
+        tableItem[tableproperty] = templateItem[templateProperty]
+      })
+      return tableItem
+    },
+    onSuccess({ results: templateItems, header: templateHeader }) {
+      const isHeaderValid = this.validateTableHeader(
+        this.columns.map(({ label }) => label).slice(1),
+        templateHeader
+      )
+      if (!isHeaderValid) {
+        this.$message.warning('表格与导入的表头不一致!')
+        return
+      }
+      if (templateItems.length === 0) {
+        this.$message.warning('导入的表格没有数据!')
+        return
+      }
+      templateItems.forEach(templateItem => {
+        const tableItem = this.mapTemplateItemToTableItem(templateItem)
+        this.tableData.push(tableItem)
+      })
+      this.validateFields(this.tableData).message()
+    },
+    async onSubmit() {
+      const { message, isFinalValid } = this.validateFields(this.tableData)
+      if (!isFinalValid) return message()
+
+      const list = this.tableData.map(tableItem => requsetFields.reduce((prev, currentKey) => ({
+        ...prev,
+        [currentKey]: currentKey === PROPERTYS.SEND_TIME ? dayjs(tableItem[currentKey]).format('YYYY-MM-DD HH:mm:ss') : tableItem[currentKey]
+      }), {}))
+
+      this.loading = true
+      const result = await asyncRequest.importOrder({
+        list
+      })
+      this.loading = false
+
+      switch (String(result.code)) {
+        case '0':
+          this.$message.success('导入成功')
+          this.innerVisible = false
+          this.$emit('refresh')
+          break
+        default:
+          this.$message.warning(result.message)
+          break
+      }
+    }
+  }
+}
+</script>
+
+<style lang="scss">
+.error-message__wrapper{
+  width: 1024px;
+}
+</style>

+ 482 - 0
src/views/netOrderEntry/prestoreRecordingOrders/index.vue

@@ -0,0 +1,482 @@
+<template>
+  <div class="terrace pagePadding">
+    <ex-table
+      v-loading="loading"
+      v-if="powers.some((i) => i == '001')"
+      :table="table"
+      :data="tableData"
+      :columns="columns"
+      :page="pageInfo"
+      :size="size"
+      @page-curr-change="handlePageChange"
+      @page-size-change="handleSizeChange"
+      @screen-reset="
+        pageInfo.curr = 1;
+        parmValue.page = 1;
+        searchList();
+      "
+      @screen-submit="
+        pageInfo.curr = 1;
+        parmValue.page = 1;
+        searchList();
+      "
+    >
+      <template #table-header="{}">
+        <div style="width: 100%">
+          <el-row style="padding: 0 0 10px 80px">
+            <el-col :span="4" style="width: 293px">
+              <period-date-picker
+                :type="1"
+                :width="'135px'"
+                :size="searchSize"
+                :start="parmValue.start"
+                :end="parmValue.end"
+                @timeReturned="handleTime"
+              />
+            </el-col>
+            <el-col :span="4" style="width: 380px; padding: 0 0 0 10px">
+              <el-select v-model="parmValue.status" size="mini"
+                  @change="pageInfo.curr = 1;
+                                  parmValue.page = 1;
+                                  searchList();"
+                >
+                <el-option label="未转单" value="1"></el-option>
+                <el-option label="已转单" value="2"></el-option>
+              </el-select>
+            </el-col>
+
+            <el-col :span="3" class="fr" style="width: 66px; padding: 0 0 0 10px">
+              <el-button type="primary" :size="searchSize" @click="searchList"
+                >刷新</el-button
+              >
+            </el-col>
+            <el-col :span="3" class="fr" style="width: 66px; padding: 0 0 0 10px">
+              <el-button type="warning" :size="searchSize" @click="restSearch"
+                >重置</el-button
+              >
+            </el-col>
+            <!-- <el-col
+              :span="3"
+              class="fr"
+              style="width: 66px; padding: 0 0 0 10px"
+              v-if="powers.includes('003') && !isSupertube"
+            >
+              <el-button type="success" :size="searchSize" @click="openModal({}, '003')"
+                >添加</el-button
+              >
+            </el-col> -->
+          </el-row>
+          <el-row>
+
+            <el-col :span="6" style="width: 373px">
+              <search-customer
+                size="mini"
+                :value="parmValue.customer"
+                :names="customerName"
+                @searchChange="handleCustomerChange"
+                placeholder="客户公司"
+              />
+            </el-col>
+
+            <el-col :span="3" class="fr" style="width: 116px; padding: 0 0 0 10px" v-if="powers.includes('013') && !isSupertube">
+              <el-button
+                class="fr"
+                type="primary"
+                :size="searchSize"
+                @click="downloadTemplate"
+              >
+                下载导入模板
+              </el-button>
+            </el-col>
+            <el-col :span="3" class="fr" style="width: 116px; padding: 0 0 0 10px"  v-if="powers.includes('086') && !isSupertube">
+              <el-button
+                type="primary"
+                class="fr"
+                :size="searchSize"
+                @click="() => (templateModalVisible = true)"
+              >
+                导入订单数据
+              </el-button>
+            </el-col>
+          </el-row>
+        </div>
+      </template>
+
+      <template #status="{ scope }">
+        <el-tag
+          :size="tablebtnSize"
+          :type="scope.row.status + '' == '0' ? 'warning' : ''"
+          v-text="
+            (statusOptions.find((item) => item.id == scope.row.status + '') || {})
+              .label || '--'
+          "
+        ></el-tag>
+      </template>
+
+      <template #order_type="{ scope }">
+        <el-tag
+          :size="tablebtnSize"
+          v-text="
+            (xs_order_type_options.find((item) => item.id == scope.row.order_type) || {})
+              .label || '--'
+          "
+        ></el-tag>
+      </template>
+
+      <template #order_source="{ scope }">
+        <el-tag
+          :size="tablebtnSize"
+          v-text="
+            (
+              xs_order_source_options.find((item) => item.id == scope.row.order_source) ||
+              {}
+            ).label || '--'
+          "
+        ></el-tag>
+      </template>
+
+      <template #operation="{ scope }">
+        <el-tooltip
+          v-if="(powers.some((i) => i == '007') && !isSupertube) || isSupertube"
+          effect="dark"
+          content="详情"
+          placement="top"
+        >
+          <i class="el-icon-view tb-icon" @click="openModal(scope.row, '007')"></i>
+        </el-tooltip>
+        <el-tooltip
+          v-if="powers.some((i) => i == '005') && !isSupertube"
+          effect="dark"
+          content="修改"
+          placement="top"
+        >
+          <i class="el-icon-edit tb-icon" @click="openModal(scope.row, '005')"></i>
+        </el-tooltip>
+      </template>
+    </ex-table>
+    <no-auth v-else></no-auth>
+
+    <import-template-modal :visible.sync="templateModalVisible" @refresh="() => searchList()" />
+    
+    <!-- 弹窗 新增/修改 -->
+    <add-edit
+      :id="modelId"
+      :show-model="showModel"
+      :sitem="sitem"
+      @refresh="searchList"
+      @cancel="showModel = false"
+    />
+  </div>
+</template>
+<script>
+import asyncRequest from "@/apis/service/netOrderEntry/prestoreRecordingOrders";
+import { xs_order_type_options, xs_order_source_options } from "@/assets/js/statusList";
+import { statusList } from "@/assets/js/statusList";
+import mixinPage from "@/mixins/elPaginationHandle";
+import roleLevel from "@/assets/js/roleLevel";
+import resToken from "@/mixins/resToken";
+import { mapGetters } from "vuex";
+import addEdit from "./addEdit";
+import companyHelper from "@/mixins/companyHelper";
+import { utils, writeFile } from "xlsx";
+import importTemplateModal from "./importTemplateModal.vue";
+import { template } from "./template";
+
+export default {
+  name: "netOrderEnter",
+  mixins: [mixinPage, resToken, companyHelper],
+  components: {
+    addEdit,
+    importTemplateModal,
+  },
+  computed: {
+    //组件SIZE设置
+    ...mapGetters(["tablebtnSize", "searchSize", "size", "isSupertube"]),
+    powers() {
+      const { btnList } = this.$store.getters;
+      const tran = btnList.find((i) => i.menu_route == "prestoreRecordingOrders") || {};
+      const { action } = tran ?? {};
+      return action ?? [];
+    },
+  },
+  data() {
+    const mapSelectValue2Query = {
+      orderCode: "销售订单编号",
+      cgdNo: "采购单编号",
+    };
+
+    return {
+      templateModalVisible: false,
+      xs_order_type_options,
+      xs_order_source_options,
+      statusList: statusList,
+      roleLevel: roleLevel,
+      loading: true,
+      showModel: false,
+      modelId: "000",
+      select: "orderCode",
+      sitem: {},
+      customerName: "",
+      mapSelectValue2Query,
+      value: "",
+      parmValue: {
+        page: 1, // 页码
+        size: 15, // 每页显示条数
+        start: "",
+        end: "",
+        customer: "",
+        status:'1'
+      },
+      // 表格 - 数据
+      tableData: [],
+      // 表格 - 参数
+      table: {
+        stripe: true,
+        border: true,
+        _defaultHeader_: ["setcol"],
+      },
+      statusOptions: [
+        { id: "0", label: "待发货" },
+        { id: "1", label: "待发货完成" },
+        { id: "2", label: "发货已完成" },
+        { id: "3", label: "订单已取消" },
+      ],
+      // 表格 - 分页
+      pageInfo: {
+        size: 15,
+        curr: 1,
+        total: 0,
+      },
+      columns: [
+        {
+          prop: "interNo",
+          label: "录单编号",
+          width: "175px",
+        },
+        // {
+        //   prop: "cgdNo",
+        //   label: "采购单编号",
+        //   width: "155px",
+        // },
+        {
+          prop: "good_name",
+          label: "商品名称",
+          width: "150",
+        },
+        {
+          prop: "good_num",
+          label: "商品数量",
+        },
+        {
+          prop: "sale_price",
+          label: "销售单价",
+        },
+        // {
+        //   prop: "total_price",
+        //   label: "总价",
+        // },
+
+        // {
+        //   prop: "status",
+        //   label: "订单状态",
+        //   _slot_: "status",
+        //   width: "120px",
+        // },
+        // {
+        //   prop: "order_source",
+        //   label: "订单来源",
+        //   _slot_: "order_source",
+        //   width: "90px",
+        // },
+        // {
+        //   prop: "order_type",
+        //   label: "商品类型",
+        //   _slot_: "order_type",
+        //   width: "90px",
+        // },
+        {
+          prop: "customerNo",
+          label: "客户公司编码",
+          width: "155px",
+        },
+        {
+          prop: "customerName",
+          label: "企业客户名称",
+          width: "125px",
+        },
+        {
+          prop: "supplierName",
+          label: "销售方公司",
+          width: "125px",
+        },
+        // {
+        //   prop: "company_name",
+        //   label: "订单创建人部门",
+        //   minWidth: "120px",
+        // },
+        {
+          prop: "apply_name",
+          label: "订单创建人",
+          width: "85px",
+        },
+        // {
+        //   prop: "cgder",
+        //   label: "供应商负责人",
+        //   width: "95",
+        // },
+        // {
+        //   prop: "good_creater",
+        //   label: "商品创建人",
+        //   width: "85px",
+        // },
+        {
+          prop: "addtime",
+          label: "创建时间",
+          width: "145px",
+        },
+        {
+          prop: "",
+          label: "操作",
+          fixed: "right",
+          _noset_: true,
+          width: "80px",
+          _slot_: "operation",
+        },
+      ],
+    };
+  },
+  mounted() {
+    this.searchList();
+  },
+  methods: {
+    downloadTemplate() {
+      const workBook = new utils.book_new();
+      const workSheet = new utils.json_to_sheet(template);
+      utils.book_append_sheet(workBook, workSheet, "sheet");
+      writeFile(workBook, "采销订单补录.xlsx", {
+        bookType: "xlsx",
+      });
+    },
+    restSearch() {
+      // 表格 - 分页
+      this.pageInfo = {
+        size: 15,
+        curr: 1,
+        total: 0,
+      };
+      this.parmValue = {
+        page: 1, // 页码
+        size: 15, // 每页显示条数
+        start: "",
+        end: "",
+        customer: "",
+        supplierNo: "",
+      };
+      this.value = "";
+      this.searchList();
+    },
+    // 新建/编辑/详情
+    openModal(row, type) {
+      if (type === "003" && !this.currentCompany) {
+        this.$message.warning("请选择一家业务公司");
+        return;
+      }
+
+      this.sitem = row;
+      this.modelId = type;
+      this.showModel = true;
+    },
+    // 时间
+    async handleTime(e) {
+      this.parmValue.start = e.startTime || "";
+      this.parmValue.end = e.endTime || "";
+
+      if (
+        (this.parmValue.start !== "" && this.parmValue.end !== "") ||
+        (this.parmValue.start === "" && this.parmValue.end === "")
+      ) {
+        this.pageInfo.curr = 1;
+        this.parmValue.page = 1;
+        await this.searchList();
+      }
+    },
+    handleCustomerChange(e) {
+      this.parmValue.customer = e.code ? [e.code] : "";
+      this.customerName = e.label;
+      this.searchList();
+    },
+    handleSupplierChange(e) {
+      this.parmValue.supplierNo = e.code ? [e.code] : "";
+      this.searchList();
+    },
+    /**
+     * 启用/禁用
+     * @param {String} id id
+     * @param {String} status 0-禁用 1-启用
+     */
+    async changeStatus(id, status) {
+      await this.$confirm(`确定要改为${status === "1" ? "禁用" : "启用"}?`, {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+        .then(async () => {
+          this.loading = true;
+          const model = {
+            id: id,
+            status: status === "1" ? "0" : "1",
+          };
+          const res = await asyncRequest.status(model);
+          if (res && res.code === 0) {
+            this.loading = false;
+            this.$notify.success({
+              title: "状态修改成功!",
+              message: "",
+            });
+            await this.searchList();
+          } else if (res && res.code >= 100 && res.code <= 104) {
+            await this.logout();
+          } else {
+            this.loading = false;
+            this.$message.warning(res.message);
+          }
+        })
+        .catch(() => {
+          console.log("取消");
+        });
+    },
+    // 刷新表格
+    async searchList() {
+      const vm = this;
+      if (
+        (vm.parmValue.start !== "" && vm.parmValue.end === "") ||
+        (vm.parmValue.start == "" && vm.parmValue.end != "")
+      ) {
+        vm.$message.warning("开始时间和结束时间不能为空");
+        return;
+      }
+
+      vm.loading = true;
+      const res = await asyncRequest.list({
+        ...vm.parmValue,
+        ...(vm.value ? { [vm.select]: vm.value } : {}),
+        ...(vm.parmValue.customer  ? { customer: vm.parmValue.customer[0] }: {}),
+        ...(vm.parmValue.supplierNo ? { supplierNo: vm.parmValue.supplierNo[0] } : {}),
+      });
+
+      if (res && res.code === 0 && res.data) {
+        vm.tableData = res.data.list;
+        vm.pageInfo.total = Number(res.data.count);
+      } else if (res && res.code >= 100 && res.code <= 104) {
+        await vm.logout();
+      } else {
+        vm.tableData = [];
+        vm.pageInfo.total = 0;
+      }
+      vm.loading = false;
+    },
+  },
+};
+</script>
+
+<style lang="scss" scoped></style>

+ 277 - 0
src/views/netOrderEntry/prestoreRecordingOrders/template.js

@@ -0,0 +1,277 @@
+
+const mapTemplateToTable = {
+  '所属平台ID': 'platform_id',
+  '供应商公司编码': 'supplierNo',
+  '销售方公司编码': 'companyNo',
+  '购买方公司编码': 'customerNo',
+  '一级品类ID': 'cat_id1',
+  '二级品类ID': 'cat_id2',
+  '三级品类ID': 'cat_id',
+  '商品单位ID': 'good_unit',
+  '税率': 'good_tax',
+  '单据号': 'workCode',
+  'PO编号': 'poCode',
+  '收货人': 'contactor',
+  '联系电话': 'mobile',
+  '发货时间': 'sendtime',
+  '联系地址': 'addr',
+  '商品名称': 'good_name',
+  '数量': 'good_num',
+  '销售单价': 'sale_price',
+  '采购单价': 'cgd_price',
+  '采购毛利率': 'cgd_tax',
+  '销售总额': 'good_total'
+  // '销售方公司名称': 'value0',
+  // '购买方公司名称': 'value1',
+  // '供应商公司名称': 'value2',
+}
+
+export const getTableProperty = (key) => mapTemplateToTable[key]
+export const PROPERTYS = {
+  COMPANY_NO: getTableProperty('销售方公司编码'),
+  CUSTOMER_NO: getTableProperty('购买方公司编码'),
+  SUPPLIER_NO: getTableProperty('供应商公司编码'),
+  PLATFORM: getTableProperty('所属平台ID'),
+  CATEGORY: getTableProperty('三级品类ID'),
+  GOOD_NAME: getTableProperty('商品名称'),
+  GOOD_UNIT: getTableProperty('商品单位ID'),
+  GOOD_NUM: getTableProperty('数量'),
+  GOOD_PRICE: getTableProperty('销售单价'),
+  TAX: getTableProperty('税率'),
+  CGD_PRICE: getTableProperty('采购单价'),
+  CGD_TAX: getTableProperty('采购单毛利率'),
+  GOOD_TOTAL: getTableProperty('销售总额'),
+  CONTACTOR: getTableProperty('收货人'),
+  MOBILE: getTableProperty('联系电话'),
+  ADDR: getTableProperty('联系地址'),
+  SEND_TIME: getTableProperty('发货时间'),
+  PO_CODE: getTableProperty('PO编号'),
+  WORK_CODE: getTableProperty('单据号')
+}
+
+export const template = Array(1).fill(1).map(() => Object.keys(mapTemplateToTable).reduce((prev, property) => {
+  prev[property] = ''
+  return prev
+}, {}))
+
+export const columns = [
+  {
+    type: 'index',
+    label: '序号',
+    width: '70px'
+  },
+  // {
+  //   prop: getTableProperty('销售方公司名称'),
+  //   label: '销售方公司名称',
+  //   width: '156px'
+  // },
+  // {
+  //   prop: getTableProperty('购买方公司名称'),
+  //   label: '购买方公司名称',
+  //   width: '180px'
+  // },
+  // {
+  //   prop: getTableProperty('供应商公司名称'),
+  //   label: '供应商公司名称',
+  //   width: '120px'
+  // },
+  {
+    prop: PROPERTYS.PLATFORM,
+    label: '所属平台ID',
+    width: '110px',
+    required: true
+  },
+  {
+    prop: PROPERTYS.SUPPLIER_NO,
+    label: '供应商公司编码',
+    width: '120px',
+    required: true
+  },
+  {
+    prop: PROPERTYS.COMPANY_NO,
+    label: '销售方公司编码',
+    width: '156px',
+    required: true
+  },
+  {
+    prop: PROPERTYS.CUSTOMER_NO,
+    label: '购买方公司编码',
+    width: '180px',
+    required: true
+  },
+
+  {
+    prop: getTableProperty('一级品类ID'),
+    label: '一级品类ID',
+    width: '150px',
+    required: true
+  },
+  {
+    prop: getTableProperty('二级品类ID'),
+    label: '二级品类ID',
+    width: '150px',
+    required: true
+  },
+  {
+    prop: getTableProperty('三级品类ID'),
+    label: '三级品类ID',
+    width: '150px',
+    required: true
+  },
+  {
+    prop: PROPERTYS.GOOD_UNIT,
+    label: '商品单位ID',
+    width: '150px',
+    required: true
+  },
+  {
+    prop: PROPERTYS.TAX,
+    label: '税率',
+    width: '150px',
+    required: true
+  },
+  {
+    prop: PROPERTYS.WORK_CODE,
+    label: '单据号',
+    'width': '150px'
+  },
+  {
+    prop: PROPERTYS.PO_CODE,
+    label: 'PO编号',
+    'width': '150px',
+    required: true
+  },
+  {
+    prop: PROPERTYS.CONTACTOR,
+    label: '收货人',
+    'width': '150px',
+    required: true
+  },
+  {
+    prop: PROPERTYS.MOBILE,
+    label: '联系电话',
+    'width': '150px',
+    required: true
+  },
+  {
+    prop: PROPERTYS.SEND_TIME,
+    label: '发货时间',
+    'width': '150px',
+    required: true
+  },
+  {
+    prop: PROPERTYS.ADDR,
+    label: '联系地址',
+    'width': '150px',
+    required: true
+  },
+  {
+    prop: PROPERTYS.GOOD_NAME,
+    label: '商品名称',
+    width: '150px',
+    required: true
+  },
+  {
+    prop: PROPERTYS.GOOD_NUM,
+    label: '数量',
+    width: '140px',
+    required: true
+  },
+  {
+    prop: PROPERTYS.GOOD_PRICE,
+    label: '销售单价',
+    'width': '150px',
+    required: true
+  },
+  {
+    prop: PROPERTYS.CGD_PRICE,
+    label: '采购单价',
+    'width': '150px',
+    required: true
+  },
+  {
+    prop: PROPERTYS.CGD_TAX,
+    label: '采购毛利率',
+    'width': '150px'
+  },
+  {
+    prop: PROPERTYS.GOOD_TOTAL,
+    label: '销售总额',
+    'width': '150px'
+  }
+]
+
+export function createErrorMessage(messages) {
+  const rows = Object.keys(messages)
+  return rows.reduce((prev, row, index) => {
+    const suffix = index === rows.length - 1 ? '</ul>' : ''
+
+    const content = prev + `
+      <li>
+        <strong style="font-weight:700">第${row}行</strong>,${messages[row]}
+      </li>
+    `
+    return content + suffix
+  }, '<ul>')
+}
+
+export const createFieldVerification = (message) => ({
+  notValidRows: [],
+  isValid: true,
+  message
+})
+
+export const requsetFields = [
+  PROPERTYS.TAX,
+  PROPERTYS.ADDR,
+  PROPERTYS.MOBILE,
+  PROPERTYS.PO_CODE,
+  PROPERTYS.PLATFORM,
+  PROPERTYS.CATEGORY,
+  PROPERTYS.GOOD_NAME,
+  PROPERTYS.GOOD_UNIT,
+  PROPERTYS.GOOD_NUM,
+  PROPERTYS.CGD_PRICE,
+  PROPERTYS.CONTACTOR,
+  PROPERTYS.SEND_TIME,
+  PROPERTYS.WORK_CODE,
+  PROPERTYS.GOOD_PRICE,
+  PROPERTYS.COMPANY_NO,
+  PROPERTYS.SUPPLIER_NO,
+  PROPERTYS.CUSTOMER_NO
+]
+
+export const requiredFields = [
+  PROPERTYS.ADDR,
+  PROPERTYS.PO_CODE,
+  PROPERTYS.CATEGORY,
+  PROPERTYS.PLATFORM,
+  PROPERTYS.CONTACTOR,
+  PROPERTYS.SEND_TIME,
+  PROPERTYS.GOOD_NAME,
+  PROPERTYS.GOOD_UNIT
+]
+
+export const numberFields = [
+  PROPERTYS.TAX,
+  PROPERTYS.GOOD_NUM,
+  PROPERTYS.CGD_PRICE,
+  PROPERTYS.GOOD_PRICE
+]
+
+export const helper = {
+  fields(sourceObject) {
+    return Object.keys(sourceObject)
+  },
+  values(sourceObject, fields, index = 0) {
+    return fields.map(field => {
+      return sourceObject[field][index]
+    })
+  },
+  write(sourceObject, fields) {
+    return fields.reduce((prev, currentKey) => ({
+      ...prev,
+      [currentKey]: sourceObject[currentKey]
+    }), {})
+  }
+}

+ 242 - 242
src/views/purchaseIn/recovery/columns.js

@@ -5,300 +5,300 @@ const columns = [
   //   width: "158px",
   // },
   {
-    prop: "infoNo",
-    label: "任务单号",
-    width: "153px",
+    prop: 'infoNo',
+    label: '任务单号',
+    width: '153px'
   },
 
   {
-    prop: "bidNo",
-    label: "反馈商品编号",
-    width: "153px",
+    prop: 'bidNo',
+    label: '反馈商品编号',
+    width: '153px'
   },
 
   {
-    prop: "good_name",
-    label: "商品名称",
-    _slot_: "good_name",
-    "min-width": "220px",
+    prop: 'good_name',
+    label: '商品名称',
+    _slot_: 'good_name',
+    'min-width': '220px'
   },
   {
-    prop: "can",
-    label: "分类",
-    _slot_: "can",
-    width: "180px",
+    prop: 'can',
+    label: '分类',
+    _slot_: 'can',
+    width: '180px'
   },
 
   {
-    prop: "brand_name",
-    label: "品牌",
-    width: "80px",
+    prop: 'brand_name',
+    label: '品牌',
+    width: '80px'
   },
 
   {
-    prop: "unit",
-    label: "单位",
-    width: "50px",
+    prop: 'unit',
+    label: '单位',
+    width: '50px'
   },
   {
-    prop: "companyNo",
-    label: "业务公司编号",
-    width: "160",
+    prop: 'companyNo',
+    label: '业务公司编号',
+    width: '160'
   },
   {
-    prop: "companyName",
-    label: "业务公司名称",
-    "min-width": "135",
+    prop: 'companyName',
+    label: '业务公司名称',
+    'min-width': '135'
   },
   {
-    prop: "supplierName",
-    label: "供应商名称",
-    minWidth: "150px",
+    prop: 'supplierName',
+    label: '供应商名称',
+    minWidth: '150px'
   },
   {
-    prop: "cgder",
-    label: "供应商负责人",
-    width: "95",
+    prop: 'cgder',
+    label: '供应商负责人',
+    width: '95'
   },
   {
-    prop: "creater",
-    label: "商品创建人",
-    width: "85px",
+    prop: 'creater',
+    label: '商品创建人',
+    width: '85px'
   },
   {
-    prop: "addtime",
-    label: "创建时间",
-    width: "145px",
+    prop: 'addtime',
+    label: '创建时间',
+    width: '145px'
   },
   {
-    prop: "",
-    label: "操作",
-    fixed: "right",
+    prop: '',
+    label: '操作',
+    fixed: 'right',
     _noset_: true,
-    width: "50px",
-    _slot_: "operation",
-  },
-];
+    width: '50px',
+    _slot_: 'operation'
+  }
+]
 const statusOptions = [
-  { value: "0", label: "待与供应商确认" },
-  { value: "1", label: "待入库" },
-  { value: "2", label: "部分入库" },
-  { value: "3", label: "入库完成" },
-  { value: "4", label: "已取消订单" },
-];
+  { value: '0', label: '待与供应商确认' },
+  { value: '1', label: '待入库' },
+  { value: '2', label: '部分入库' },
+  { value: '3', label: '入库完成' },
+  { value: '4', label: '已取消订单' }
+]
 
-//是否定制
+// 是否定制
 const options1 = [
-  { id: "0", name: "否" },
-  { id: "1", name: "是" },
-];
-//专属类型
+  { id: '0', name: '否' },
+  { id: '1', name: '是' }
+]
+// 专属类型
 const options2 = [
-  { id: "0", name: "非泰康" },
-  { id: "1", name: "泰康" },
-];
-//销售权限
+  { id: '0', name: '非泰康' },
+  { id: '1', name: '泰康' }
+]
+// 销售权限
 const options3 = [
-  { id: "0", name: "无销售权限" },
-  { id: "1", name: "有销售权限" },
-];
+  { id: '0', name: '无销售权限' },
+  { id: '1', name: '有销售权限' }
+]
 
-//是否库存品
+// 是否库存品
 const options4 = [
-  { id: "0", name: "非库存品" },
-  { id: "1", name: "库存品" },
-];
-//是否启用实时金价
+  { id: '0', name: '非库存品' },
+  { id: '1', name: '库存品' }
+]
+// 是否启用实时金价
 const options5 = [
-  { id: "0", name: "否" },
-  { id: "1", name: "是" },
-];
-//供货区域
+  { id: '0', name: '否' },
+  { id: '1', name: '是' }
+]
+// 供货区域
 const options6 = [
-  { id: "1", name: "全国" },
-  { id: "2", name: "全国除偏远" },
-];
-//是否启用阶梯
+  { id: '1', name: '全国' },
+  { id: '2', name: '全国除偏远' }
+]
+// 是否启用阶梯
 const options7 = [
-  { id: "0", name: "否" },
-  { id: "1", name: "是" },
-];
+  { id: '0', name: '否' },
+  { id: '1', name: '是' }
+]
 const options8 = [
   // { id: "0", name: "待提交" },
-  { id: "1", name: "待完善成本" },
-  { id: "2", name: "待产品审核" },
-  { id: "3", name: "待财务定价" },
-  { id: "4", name: "待财务审核定价" },
-  { id: "5", name: "待上线" },
-  { id: "6", name: "上线成功" },
-  { id: "7", name: "审核失败" },
-  { id: "8", name: "已下线" },
-];
+  { id: '1', name: '待完善成本' },
+  { id: '2', name: '待产品审核' },
+  { id: '3', name: '待财务定价' },
+  { id: '4', name: '待财务审核定价' },
+  { id: '5', name: '待上线' },
+  { id: '6', name: '上线成功' },
+  { id: '7', name: '审核失败' },
+  { id: '8', name: '已下线' }
+]
 
 const options9 = [
-  { id: "0", name: "现结" },
-  { id: "1", name: "月清" },
-  { id: "2", name: "双月清" },
-];
+  { id: '0', name: '现结' },
+  { id: '1', name: '月清' },
+  { id: '2', name: '双月清' }
+]
 const costColumns = [
   {
-    prop: "good_name",
-    label: "商品名称",
-    _slot_: "good_name",
-    span: 24,
+    prop: 'good_name',
+    label: '商品名称',
+    _slot_: 'good_name',
+    span: 24
   },
   {
-    prop: "supplierName",
-    label: "供应商名称",
-    _slot_: "supplierName",
-    span: 12,
+    prop: 'supplierName',
+    label: '供应商名称',
+    _slot_: 'supplierName',
+    span: 12
   },
   {
-    prop: "brand_name",
-    label: "品牌",
-    span: 12,
+    prop: 'brand_name',
+    label: '品牌',
+    span: 12
   },
   {
-    prop: "cat",
-    label: "分类",
-    _slot_: "cat",
-    span: 12,
+    prop: 'cat',
+    label: '分类',
+    _slot_: 'cat',
+    span: 12
   },
 
   {
-    prop: "tax",
-    label: "税点",
-    append: "%",
-    span: 6,
+    prop: 'tax',
+    label: '税点',
+    append: '%',
+    span: 6
   },
   {
-    prop: "unit",
-    label: "单位",
-    span: 6,
+    prop: 'unit',
+    label: '单位',
+    span: 6
   },
   {
-    prop: "delivery_place_cn",
-    label: "发货地",
-    span: 9,
+    prop: 'delivery_place_cn',
+    label: '发货地',
+    span: 9
   },
   {
-    prop: "expire_day",
-    label: "有效期",
-    append: "天",
-    span: 5,
+    prop: 'expire_day',
+    label: '有效期',
+    append: '天',
+    span: 5
   },
   {
-    prop: "delivery_day",
-    label: "物流时间",
-    append: "天",
-    span: 5,
+    prop: 'delivery_day',
+    label: '物流时间',
+    append: '天',
+    span: 5
   },
   {
-    prop: "work_day",
-    label: "生产工期",
-    append: "天",
-    span: 5,
+    prop: 'work_day',
+    label: '生产工期',
+    append: '天',
+    span: 5
   },
   {
-    prop: "origin_place_cn",
-    label: "产地",
-    span: 9,
+    prop: 'origin_place_cn',
+    label: '产地',
+    span: 9
   },
   {
-    prop: "pay_way",
-    label: "付款方式",
-    _slot_: "pay_way",
-    span: 5,
+    prop: 'pay_way',
+    label: '付款方式',
+    _slot_: 'pay_way',
+    span: 5
   },
   {
-    prop: "good_creater",
-    label: "反馈人",
-    span: 4,
+    prop: 'good_creater',
+    label: '反馈人',
+    span: 4
   },
   {
-    prop: "addtime",
-    label: "反馈时间",
-    span: 6,
+    prop: 'addtime',
+    label: '反馈时间',
+    span: 6
   },
 
   {
-    prop: "weight",
-    label: "商品总克重",
-    append: "g",
-    span: 6,
+    prop: 'weight',
+    label: '商品总克重',
+    append: 'g',
+    span: 6
   },
 
   {
-    prop: "supply_area",
-    label: "供货区域",
-    _slot_: "supply_area",
-    span: 6,
+    prop: 'supply_area',
+    label: '供货区域',
+    _slot_: 'supply_area',
+    span: 6
   },
 
   {
-    prop: "send_way",
-    label: "发货方式",
-    _slot_: "send_way",
-    span: 6,
+    prop: 'send_way',
+    label: '发货方式',
+    _slot_: 'send_way',
+    span: 6
   },
   {
-    prop: "total_fee",
-    label: "成本合计",
-    append: "元",
-    span: 6,
+    prop: 'total_fee',
+    label: '成本合计',
+    append: '元',
+    span: 6
   },
   {
-    prop: "cert_fee",
-    label: "证书费",
-    append: "元",
-    span: 6,
+    prop: 'cert_fee',
+    label: '证书费',
+    append: '元',
+    span: 6
   },
   {
-    prop: "pakge_fee",
-    label: "包装费",
-    append: "元",
-    span: 6,
+    prop: 'pakge_fee',
+    label: '包装费',
+    append: '元',
+    span: 6
   },
 
   {
-    prop: "cost_fee",
-    label: "工艺费",
-    append: "元",
-    span: 6,
+    prop: 'cost_fee',
+    label: '工艺费',
+    append: '元',
+    span: 6
   },
 
   {
-    prop: "mark_fee",
-    label: "加标费",
-    append: "元",
-    span: 6,
+    prop: 'mark_fee',
+    label: '加标费',
+    append: '元',
+    span: 6
   },
 
   {
-    prop: "demo_fee",
-    label: "打样费",
-    append: "元",
-    span: 6,
+    prop: 'demo_fee',
+    label: '打样费',
+    append: '元',
+    span: 6
   },
 
   {
-    prop: "open_fee",
-    label: "开模费",
-    append: "元",
-    span: 6,
+    prop: 'open_fee',
+    label: '开模费',
+    append: '元',
+    span: 6
   },
 
   {
-    prop: "delivery_fee",
-    label: "物流费",
-    append: "元",
-    span: 6,
+    prop: 'delivery_fee',
+    label: '物流费',
+    append: '元',
+    span: 6
   },
   {
-    prop: "nake_fee",
-    label: "裸价",
-    append: "元",
-    span: 6,
+    prop: 'nake_fee',
+    label: '裸价',
+    append: '元',
+    span: 6
   },
 
   // {
@@ -308,78 +308,78 @@ const costColumns = [
   // },
 
   {
-    prop: "remark",
-    label: "采返备注",
-    span: 24,
+    prop: 'remark',
+    label: '采返备注',
+    span: 24
   },
   {
-    prop: "cost_desc",
-    label: "工艺说明",
-    span: 24,
+    prop: 'cost_desc',
+    label: '工艺说明',
+    span: 24
   },
   {
-    prop: "good_img",
-    _slot_: "good_img",
-    label: "商品图片",
-    span: 12,
+    prop: 'good_img',
+    _slot_: 'good_img',
+    label: '商品图片',
+    span: 12
   },
   {
-    prop: "noble",
-    _slot_: "noble",
-    label: "贵金属信息",
-    span: 12,
-  },
-];
+    prop: 'noble',
+    _slot_: 'noble',
+    label: '贵金属信息',
+    span: 12
+  }
+]
 const infoColumns = [
   {
-    prop: "infoNo",
-    label: "竞价单编号",
-    span: 6,
+    prop: 'infoNo',
+    label: '竞价单编号',
+    span: 6
   },
   {
-    prop: "status",
-    label: "状态",
-    _slot_: "status",
-    span: 6,
+    prop: 'status',
+    label: '状态',
+    _slot_: 'status',
+    span: 6
   },
 
   {
-    prop: "is_addrs",
-    label: "是否多地",
-    _slot_: "is_addrs",
-    span: 6,
+    prop: 'is_addrs',
+    label: '是否多地',
+    _slot_: 'is_addrs',
+    span: 6
   },
   {
-    prop: "num",
-    label: "数量",
-    span: 6,
+    prop: 'num',
+    label: '数量',
+    span: 6
   },
   {
-    prop: "company",
-    label: "销售方公司",
-    _slot_: "company",
+    prop: 'company',
+    label: '销售方公司',
+    _slot_: 'company'
   },
   {
-    prop: "khName",
-    label: "购买方公司",
-    _slot_: "khName",
-  },
-];
+    prop: 'khName',
+    label: '购买方公司',
+    _slot_: 'khName'
+  }
+]
 const is_addrs_options = [
-  { value: "0", label: "一地" },
-  { value: "1", label: "多地" },
-];
+  { value: '0', label: '一地' },
+  { value: '1', label: '多地' }
+]
 
 const options0 = [
-  { id: "0", label: "待发布竞标" },
-  { id: "1", label: "招标进行中" },
-  { id: "2", label: "招标已结束" },
-  { id: "3", label: "待选择商品" },
-  { id: "4", label: "已选商品待下单" },
-  { id: "5", label: "已成功转单" },
-  { id: "6", label: "已取消转单" },
-  { id: "7", label: "招标已暂停" },
-];
+  { id: '0', label: '待发布竞标' },
+  { id: '1', label: '招标进行中' },
+  { id: '2', label: '招标已结束' },
+  { id: '3', label: '待选择商品' },
+  { id: '4', label: '已选商品待下单' },
+  { id: '5', label: '已成功转单' },
+  { id: '6', label: '已取消转单' },
+  { id: '7', label: '招标已暂停' }
+]
 export {
   columns,
   statusOptions,
@@ -395,5 +395,5 @@ export {
   costColumns,
   infoColumns,
   is_addrs_options,
-  options0,
-};
+  options0
+}

+ 2 - 2
src/views/sellOut/zixunOrder/columns.js

@@ -650,11 +650,11 @@ const listCol = [
     fixed: 'right',
     _noset_: true,
     _slot_: 'operation',
-    width: 80
+    width: 120
   }
 ]
 const options = [
-  // { id: "0", label: "待发布竞标" },
+  { id: '0', label: '复制待编辑' },
   { id: '1', label: '招标进行中' },
   { id: '2', label: '招标已结束' },
   { id: '3', label: '待业务下单' },

+ 4 - 1
src/views/sellOut/zixunOrder/components/editForm.vue

@@ -1173,7 +1173,10 @@ export default {
           });
           // this.loading = false;
           // return;
-          const res = await asyncRequest.update(model);
+          const api =  this.type === 'copy-edit' ? asyncRequest.zxcopyedit : asyncRequest.update
+          const res = await api(model)
+          
+          console.log(res)
           this.loading = false;
           if (res && res.code === 0) {
             this.$notify.success({

+ 44 - 7
src/views/sellOut/zixunOrder/index.vue

@@ -189,23 +189,39 @@
               @click="getRouter('zixunOrderDetail', scope.row.infoNo)"
             ></i>
           </el-tooltip>
-        </template>
-        <el-tooltip
+          <el-tooltip
+          effect="dark"
+          content="复制"
+          placement="top"
           v-if="
             powers.some((i) => i == '010') &&
             String(scope.row.is_project) === '0' &&
             !String(scope.row.status) === '0' &&
             !isSupertube
           "
-          effect="dark"
-          content="复制"
-          placement="top"
         >
           <i
             class="el-icon-document-copy tb-icon"
             @click="order_copy(scope.row.infoNo)"
           ></i>
         </el-tooltip>
+
+        <el-tooltip
+          effect="dark"
+          content="编辑"
+          placement="top"
+          v-if="
+            powers.some((i) => i == '005') &&
+            String(scope.row.status) === '0' &&
+            !isSupertube
+          "
+        >
+          <i
+            class="el-icon-edit tb-icon"
+            @click="getRouterEdit('zixunOrderDetail', scope.row.infoNo)"
+          ></i>
+        </el-tooltip>
+        </template>
       </ex-table>
     </div>
     <div v-else>
@@ -343,6 +359,27 @@ export default {
         this.$message.warning("暂未找到相关流程!");
       }
     },
+    getRouterEdit(toRouter, queryId) {
+      if (toRouter && queryId) {
+        let model = {
+          id: queryId,
+          type: "copy-edit",
+        };
+
+        //有多选框的条件
+        this.parmValue.select = this.select;
+        this.parmValue.s_input = this.s_input;
+        let routerModel = {
+          options: JSON.parse(JSON.stringify(this.parmValue)),
+          router: this.$route.path,
+        };
+        model.preModel = JSON.stringify(routerModel);
+
+        this.routeGoto(toRouter, model);
+      } else {
+        this.$message.warning("暂未找到相关流程!");
+      }
+    },
     restSearch() {
       this.select = "1";
       this.s_input = "";
@@ -435,7 +472,7 @@ export default {
       this.parmValue.page = 1;
       await this.searchList();
     },
-    async order_copy(spuCode) {
+    async order_copy(infoNo) {
       if (this.loading) {
         return;
       }
@@ -447,7 +484,7 @@ export default {
         .then(async () => {
           this.loading = true;
           const model = {
-            spuCode: spuCode,
+            infoNo,
           };
           const { code, message } = await asyncRequest.copy(model);
           if (code === 0) {

Algúns arquivos non se mostraron porque demasiados arquivos cambiaron neste cambio