snow 1 gadu atpakaļ
vecāks
revīzija
3e08bbba62

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 0 - 0
dist/static/js/0.js


+ 7 - 5
src/views/goodStore/goodsOnline/components/fixed-price-form.vue

@@ -808,12 +808,14 @@ export default {
       const _costFee = Number(cost_fee) || 0
       const _systemCostFee = Number(new_cost_fee) || 0
 
-      if(_systemSalePrice && (_salePrice < _systemSalePrice)){
+      console.log(this.sitem)
+
+      if(Number(this.sitem.is_gold_price) !== 1 && (_salePrice < _systemSalePrice)){
         this.$message.warning('售价不能小于系统售价!')
         return
       }
 
-      if(_systemCostFee && (_costFee < _systemCostFee)) {
+      if(Number(this.sitem.is_gold_price) === 1 && (_costFee < _systemCostFee)) {
         this.$message.warning('工艺费不能小于系统工艺费!')
         return
       }
@@ -1017,14 +1019,14 @@ export default {
                  const _costFee = Number(cost_fee) 
                  const _systemCostFee = Number(new_cost_fee) 
 
-                 if(_systemSalePrice &&( _salePrice < _systemSalePrice)){
+                 if(Number(this.sitem.is_gold_price) !== 1 &&( _salePrice < _systemSalePrice)){
                    this.$message.warning(`第 ${index + 1} 行的售价不能小于系统售价!`)
                    this.loading = false
                    return
                  }
                
-                 if(_systemCostFee && (_costFee < _systemCostFee)) {
-                   this.$message.warning('第 ${index + 1} 行的售价不能工艺费不能小于系统工艺费!')
+                 if(Number(this.sitem.is_gold_price) === 1 && (_costFee < _systemCostFee)) {
+                   this.$message.warning('第 ${index + 1} 行的工艺费不能工艺费不能小于系统工艺费!')
                    this.loading = false
                    return
                  }

+ 880 - 0
src/views/netOrderEntry/netOrderEnter/addEdit-c.vue

@@ -0,0 +1,880 @@
+<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"
+            label-position="left"
+            size="mini"
+          >
+            <el-divider>
+              <el-tag size="mini">销售订单信息</el-tag>
+            </el-divider>
+
+            <el-row>
+              <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-col :span="12">
+                <el-form-item label="购买方公司" label-width="100px" prop="khNo">
+                  <search-customer
+                    size="mini"
+                    :names="khName"
+                    :disabled="id !== '003'"
+                    :is-detail="type !== 'add'"
+                    :value="ruleForm.khNo"
+                    placeholder="购买方公司"
+                    @searchChange="handleCustomerChange"
+                  />
+                </el-form-item>
+              </el-col>
+
+              <el-col :span="12">
+                <el-form-item label="所属平台" prop="platform_id" label-width="100px" align="left">
+                  <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="cat_id" label-width="100px">
+                  <company-sort
+                    :value="ruleForm.cat_id"
+                    :placeholder="'商品分类'"
+                    :disabled="id !== '003'"
+                    :size="'mini'"
+                    :company-no="ruleForm.companyNo"
+                    :names="cat_id_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="poCode" label-width="100px">
+                  <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 prop="workCode" label-width="100px">
+                  <template #label>
+                    <p style="padding-left:10px">其他单号</p>
+                  </template>
+                  <el-input
+                    v-model="ruleForm.workCode"
+                    :disabled="id === '007'"
+                    maxlength="50"
+                    placeholder="如:业管单号"
+                  />
+                </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="goodName">
+                  <el-input
+                    v-model="ruleForm.goodName"
+                    placeholder="商品名称"
+                    maxlength="50"
+                    :disabled="id !== '003'"
+                  />
+                </el-form-item>
+              </el-col>
+            </el-row>
+
+            <el-row>
+              <el-col :span="6">
+                <el-form-item label="数量" prop="goodNum" label-width="60px">
+                  <el-input-number
+                    v-model="ruleForm.goodNum"
+                    :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_total">
+                  <!-- <el-input v-model="ruleForm.sale_total" placeholder="销售总额">
+                    <template #append>元</template>
+                  </el-input> -->
+                  <el-input-number
+                    v-model="ruleForm.sale_total"
+                    :disabled="id !== '003' || disabledField"
+                    style="width: 100%"
+                    controls-position="right"
+                    placeholder="销售总额"
+                    :precision="2"
+                    :min="0"
+                    :step="0.01"
+                    @change="number_change_total($event, 'sale_total')"
+                  />
+                </el-form-item>
+              </el-col>
+
+              <el-col :span="6">
+                <el-form-item label="采购总额" prop="cgd_total">
+                  <el-input-number
+                    v-model="ruleForm.cgd_total"
+                    :disabled="id !== '003' || disabledField"
+                    style="width: 100%"
+                    controls-position="right"
+                    placeholder="采购总额"
+                    :precision="2"
+                    :min="0"
+                    :step="0.01"
+                    @change="number_change_total($event, 'cgd_total')"
+                  />
+                </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)"
+                  /> -->
+                  <digital-input
+                    :values="ruleForm.cgd_tax"
+                    :placeholder="'采购毛利率'"
+                    :min="0"
+                    :max="100"
+                    :disabled="id === '007' || disabledField"
+                    :position="'right'"
+                    :precision="2"
+                    :size="'mini'"
+                    :controls="false"
+                    :append="'%'"
+                    @reschange="number_change($event, 2)"
+                  />
+                </el-form-item>
+              </el-col>
+            </el-row>
+            <el-row>
+              <el-col :span="6">
+                <el-form-item label="单位" prop="goodUnit" label-width="60px">
+                  <search-unit
+                    :value="ruleForm.goodUnit"
+                    :disabled="type === 'view' || type === 'editCoin'"
+                    :size="'mini'"
+                    :is-detail="type !== 'add'"
+                    :names="unit_name"
+                    :placeholder="'单位'"
+                    @searchChange="unitsearchChange"
+                  />
+                </el-form-item>
+              </el-col>
+
+              <el-col :span="6">
+                <el-form-item label="销售单价" prop="goodPrice">
+                  <el-input-number
+                    v-model="ruleForm.goodPrice"
+                    :disabled="id !== '003' || disabledField"
+                    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="cgdPrice">
+                  <el-input-number
+                    v-model="ruleForm.cgdPrice"
+                    style="width: 100%"
+                    :disabled="id === '007' || disabledField"
+                    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="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/netOrderEnter'
+import companyHelper from '@/mixins/companyHelper'
+import { accMul, accDiv, accSub, isPhone, isMobile } from '@/utils/validate'
+import resToken from '@/mixins/resToken'
+
+const defaultData = {
+  addr_code: [],
+  cgd_total: '',
+  cgdPrice: '',
+  // buyerid: "",
+  // buyer_name: "",
+  platform_id: '',
+  cgd_tax: '',
+  workCode: '',
+  poCode: '',
+  khNo: '',
+  companyNo: '',
+  contactor: '',
+  mobile: '',
+  addr: '',
+  sendtime: '',
+  supplierNo: '',
+  cat_id: '',
+  goodName: '',
+  goodNum: '',
+  goodPrice: '',
+  sale_total: '',
+  goodUnit: '',
+  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: '添加销售订单信息',
+      khName: '',
+      accounts: [],
+      cat_id_name: '',
+      showModelThis: this.showModel,
+      pickerOptions: {
+        disabledDate: (time) => time.getTime() > new Date()
+      },
+      names: [],
+      unit_name: '',
+      companyName: '',
+      ruleForm: { ...defaultData },
+      rulesThis: this.rules,
+      rules: {
+        goodUnit: [
+          {
+            required: true,
+            message: '请选择单位',
+            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_id: [
+          {
+            required: true,
+            message: '请选择商品分类',
+            trigger: 'change'
+          }
+        ],
+        supplierNo: [
+          {
+            type: 'array',
+            required: true,
+            message: '请选择供应商公司',
+            trigger: 'change'
+          }
+        ],
+        qrdType: [
+          {
+            required: true,
+            message: '请输入订单来源',
+            trigger: 'blur'
+          }
+        ],
+        sale_total: [
+          {
+            required: true,
+            message: '请输入销售总额',
+            trigger: 'blur'
+          }
+        ],
+        // workCode: [
+        //   {
+        //     required: true,
+        //     message: '请输入单据号',
+        //     trigger: 'blur'
+        //   }
+        // ],
+        poCode: [
+          {
+            required: true,
+            message: '请输入平台订单号',
+            trigger: 'blur'
+          }
+        ],
+        khNo: [
+          {
+            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'
+          }
+        ],
+
+        goodName: [
+          {
+            required: true,
+            message: '请输入商品名称',
+            trigger: 'blur'
+          }
+        ],
+        goodPrice: [
+          {
+            required: true,
+            message: '请输入销售单价',
+            trigger: 'blur'
+          }
+        ],
+        cgdPrice: [
+          {
+            required: true,
+            message: '请选择采购单价',
+            trigger: 'blur'
+          }
+        ],
+        goodNum: [
+          {
+            required: true,
+            message: '请输入数量',
+            trigger: 'blur'
+          }
+        ],
+        cgd_total: [
+          {
+            required: true,
+            message: '请输入采购总额',
+            trigger: 'blur'
+          }
+        ]
+      }
+    }
+  },
+  computed: {
+    disabledField() {
+      const { goodNum } = this.ruleForm
+      return !goodNum || Number(goodNum) <= 0
+    },
+    totalWatchSource() {
+      const { goodNum, goodPrice } = this.ruleForm
+      return { goodNum, goodPrice }
+    },
+    cgdTotalWatchSource() {
+      const { goodNum, cgdPrice } = this.ruleForm
+      return { goodNum, cgdPrice }
+    }
+  },
+  watch: {
+    showModel: function(val) {
+      this.showModelThis = val
+      if (val) {
+        this.initForm()
+      }
+    },
+    showModelThis(val) {
+      if (!val) {
+        this.$emit('cancel')
+      }
+    },
+    totalWatchSource: {
+      handler({ goodPrice, goodNum }) {
+        if (goodPrice === 0 || goodNum === 0) {
+          this.ruleForm.sale_total = 0
+          return
+        }
+
+        this.ruleForm.sale_total = accMul(goodPrice, goodNum)
+      },
+      deep: true
+    },
+    cgdTotalWatchSource: {
+      handler({ cgdPrice, goodNum }) {
+        if (cgdPrice === 0 || goodNum === 0) {
+          this.ruleForm.cgd_total = 0
+          return
+        }
+
+        this.ruleForm.cgd_total = accMul(cgdPrice, goodNum)
+      },
+      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) {
+      this.ruleForm.cgd_tax = e
+      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')
+      }
+      if (type === 2) {
+        // cgd_price = ((100 - cgd_tax) / 100) * goodPrice;
+        cgd_price = accMul(accDiv(accSub(100, cgd_tax), 100), goodPrice) || 0
+        this.ruleForm.cgdPrice = cgd_price
+        this.$refs.ruleForm.validateField('cgdPrice')
+      }
+
+      // if (this.ruleForm.cgdPrice && this.ruleForm.goodPrice) {
+      //   this.ruleForm['cgd_tax'] = accMul(accDiv(this.ruleForm.cgdPrice, this.ruleForm.goodPrice), 100) || 0
+      // }
+    },
+    handleClose() {
+      this.showModelThis = false
+      this.companyName = ''
+      this.khName = ''
+      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.khNo = e.code ? [e.code] : ''
+      this.$refs.ruleForm.validateField('khNo')
+    },
+    handleSupplierChange(e) {
+      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')
+    },
+    handleTaxChange(e) {
+      this.ruleForm.tax = e
+      this.$refs.ruleForm.validateField('tax')
+    },
+    unitsearchChange(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()
+        }
+      })
+
+      if (this.id === '003') {
+        this.ruleForm.companyNo = this.currentCompany
+        return
+      }
+
+      if (this.id !== '003') this.getDetail()
+    },
+    number_change_total(current, prop) {
+      const isCgdTotal = prop === 'cgd_total'
+      const { goodNum } = this.ruleForm
+      this.ruleForm[isCgdTotal ? 'cgdPrice' : 'goodPrice'] = accDiv(current, goodNum)
+      this.ruleForm[prop] = current
+
+      let tax = 0
+      tax = accMul(accSub(1, accDiv(this.ruleForm.cgd_total, this.ruleForm.sale_total)), 100)
+      this.ruleForm.cgd_tax = tax
+      // if (this.ruleForm.cgd_total && this.ruleForm.sale_total) {
+      //   this.ruleForm['cgd_tax'] = accMul(accDiv(this.ruleForm.cgd_total, this.ruleForm.sale_total), 100) || 0
+      // }
+    },
+    async getDetail() {
+      this.detailLoading = true
+      const { orderCode } = this.sitem
+      const { data } = await asyncRequest.detail({ orderCode })
+
+      const {
+        cat_id,
+        buyerid,
+        khNo,
+        supplierNo,
+        supplierNanme,
+        khName,
+        goodUnit,
+        tax,
+        addr_code,
+        unitName,
+        ...rest
+      } = data
+
+      this.ruleForm = {
+        ...rest,
+        buyerid: buyerid ? [buyerid] : [],
+        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] : ''
+      }
+
+      this.cat_id_name = cat_id.map(({ name }) => name).join('_')
+      console.log(this.cat_id_name)
+      this.unit_name = unitName
+
+      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')
+    },
+    // async getAccounts() {
+    //   const res = await asyncRequest.accountall(this.dataForm);
+    //   if (res && res.code === 0 && res.data) {
+    //     this.accounts = res.data;
+    //   } else if (res && res.code >= 100 && res.code <= 104) {
+    //     await this.logout();
+    //   } else {
+    //     this.$message.warning(res.message);
+    //   }
+    // },
+    async goods_class_change(e) {
+      const { id } = e
+      this.ruleForm.cat_id = id ? [id] : []
+      this.$refs.ruleForm.validateField('cat_id')
+    },
+    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.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
+
+          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>

+ 319 - 0
src/views/netOrderEntry/prestoreRecordingOrders/template-c.js

@@ -0,0 +1,319 @@
+
+const mapTemplateToTable = {
+  '所属平台ID': 'platform_id',
+  '供应商公司编码': 'supplierNo',
+  '销售方公司编码': 'companyNo',
+  '购买方公司编码': 'customerNo',
+  '一级品类ID': 'cat_id1',
+  '二级品类ID': 'cat_id2',
+  '三级品类ID': 'cat_id',
+  '商品单位ID': 'good_unit',
+  '商品名称': 'good_name',
+  '销售单价': 'sale_price',
+  '数量': 'good_num',
+  '销售总额': 'sale_total',
+  '税率': 'good_tax',
+  '采购单价': 'cgd_price',
+  '采购总额': 'cgd_total',
+  '采购毛利率': 'cgd_tax',
+  '平台订单号': 'poCode',
+  '收货人': 'contactor',
+  '联系电话': 'mobile',
+  '联系地址': 'addr',
+  '发货时间': 'sendtime'
+}
+// '其他单号': 'workCode',
+
+export const getTableProperty = (key) => mapTemplateToTable[key]
+
+export const getTableLabel = (field) => {
+  const keys = Object.keys(mapTemplateToTable)
+  for (const key of keys) {
+    if (mapTemplateToTable[key] === field) {
+      return 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('采购毛利率'),
+  SALE_TOTAL: getTableProperty('销售总额'),
+  CONTACTOR: getTableProperty('收货人'),
+  MOBILE: getTableProperty('联系电话'),
+  ADDR: getTableProperty('联系地址'),
+  SEND_TIME: getTableProperty('发货时间'),
+  PO_CODE: getTableProperty('平台订单号'),
+  CGD_TOTAL: getTableProperty('采购总额'),
+  WORK_CODE: getTableProperty('其他单号')
+}
+
+export const template = [
+  {
+    '所属平台ID': '58',
+    '供应商公司编码': 'QS2206011407522117',
+    '销售方公司编码': 'GS2302231323386950',
+    '购买方公司编码': 'KH2203271822232121',
+    '一级品类ID': '871',
+    '二级品类ID': '871',
+    '三级品类ID': '871',
+    '商品单位ID': '7',
+    '商品名称': '测试商品名称',
+    '销售单价': '32',
+    '数量': '100',
+    '销售总额': '3200',
+    '税率': '13',
+    '采购单价': '30.00',
+    '采购总额': '3000',
+    '采购毛利率': '6',
+    '平台订单号': 'PO206020230400240002',
+    '收货人': '张三',
+    '联系电话': '19955554444',
+    '联系地址': 'xx市xx区xx街道',
+    '发货时间': '2023-4-9 8:00:00'
+  }
+]
+
+export const columns = [
+  {
+    type: 'index',
+    label: '序号',
+    width: '70px'
+  },
+  {
+    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.GOOD_NAME,
+    label: '商品名称',
+    width: '150px',
+    required: true
+  },
+  {
+    prop: PROPERTYS.GOOD_PRICE,
+    label: '销售单价',
+    'width': '150px',
+    required: true
+  },
+  {
+    prop: PROPERTYS.GOOD_NUM,
+    label: '数量',
+    width: '140px',
+    required: true
+  },
+  {
+    prop: PROPERTYS.SALE_TOTAL,
+    label: '销售总额',
+    'width': '150px'
+  },
+  {
+    prop: PROPERTYS.TAX,
+    label: '税率',
+    width: '150px',
+    required: true
+  },
+  {
+    prop: PROPERTYS.CGD_PRICE,
+    label: '采购单价',
+    'width': '150px',
+    required: true
+  },
+  {
+    prop: PROPERTYS.CGD_TOTAL,
+    label: '采购总额',
+    'width': '150px',
+    required: true
+  },
+  {
+    prop: getTableProperty('采购毛利率'),
+    label: '采购毛利率',
+    'width': '150px'
+  },
+  {
+    prop: PROPERTYS.PO_CODE,
+    label: '平台订单号',
+    'width': '150px',
+    required: true
+  },
+  {
+    prop: PROPERTYS.CONTACTOR,
+    label: '收货人',
+    'width': '150px',
+    required: true
+  },
+  // {
+  //   prop: PROPERTYS.WORK_CODE,
+  //   label: '其他单号',
+  //   'width': '150px'
+  // },
+  {
+    prop: PROPERTYS.MOBILE,
+    label: '联系电话',
+    'width': '150px',
+    required: true
+  },
+  {
+    prop: PROPERTYS.ADDR,
+    label: '联系地址',
+    'width': '150px',
+    required: true
+  },
+  {
+    prop: PROPERTYS.SEND_TIME,
+    label: '发货时间',
+    'width': '150px',
+    required: true
+  }
+]
+
+export function createErrorMessage(messages) {
+  const rows = Object.keys(messages)
+  return [rows[0]].reduce((prev, row, index) => {
+    console.log(messages[row])
+    const suffix = index === rows.length - 1 ? '</ul>' : ''
+    const content = prev + `
+      <li>
+        <strong style="font-weight:700">第${row}行</strong>,${messages[row][0]}
+      </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,
+  PROPERTYS.CGD_TAX,
+  PROPERTYS.SALE_TOTAL,
+  PROPERTYS.CGD_TOTAL
+]
+
+// 税率、数量、销售单价、采购单价
+export const requiredFields = [
+  PROPERTYS.TAX,
+  PROPERTYS.ADDR,
+  PROPERTYS.MOBILE,
+  PROPERTYS.PO_CODE,
+  PROPERTYS.PLATFORM,
+  PROPERTYS.CATEGORY,
+  PROPERTYS.GOOD_NAME,
+  PROPERTYS.GOOD_UNIT,
+  PROPERTYS.GOOD_NUM,
+  PROPERTYS.CONTACTOR,
+  PROPERTYS.SEND_TIME,
+  PROPERTYS.COMPANY_NO,
+  PROPERTYS.SUPPLIER_NO,
+  PROPERTYS.CUSTOMER_NO,
+  PROPERTYS.CGD_TOTAL,
+  PROPERTYS.SALE_TOTAL,
+  PROPERTYS.CGD_TAX
+]
+
+export const numberFields = [
+  PROPERTYS.CGD_TOTAL,
+  PROPERTYS.SALE_TOTAL,
+  PROPERTYS.GOOD_PRICE,
+  PROPERTYS.CGD_PRICE,
+  PROPERTYS.CGD_TAX
+]
+
+export const intNumberFields = [
+  PROPERTYS.CATEGORY,
+  PROPERTYS.GOOD_UNIT,
+  PROPERTYS.GOOD_NUM,
+  PROPERTYS.TAX
+]
+
+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]
+    }), {})
+  }
+}

Daži faili netika attēloti, jo izmaiņu fails ir pārāk liels