data.js 6.44 KB
const commodityObj = {
  searchFormData: [
    {
      label: '商品名称',
      name: 'goodsName',
      type: 'input',
      isClear: true,
      maxlength: 50
    },
    {
      label: '商品编码',
      name: 'type',
      type: 'input',
      isClear: true,
      maxlength: 50
    },
    {
      label: '品牌方',
      name: 'brandMerchantName',
      type: 'input',
      isClear: true,
      maxlength: 20
    },
    {
      label: '供应方',
      name: 'supplierName',
      type: 'input',
      isClear: true,
      maxlength: 20
    },
    {
      label: '产品类型',
      name: 'proType',
      type: 'select',
      optionList: [],
      optionId: 'confId',
      optionLabel: 'confValue',
      optionsName: 'typeList'
    },
    {
      label: '使用门店',
      name: 'merchantIdList',
      type: 'select',
      optionList: [],
      optionId: 'merchantId',
      optionLabel: 'merchantName',
      optionsName: 'merchantList'
    },
    {
      label: '所属分类',
      name: 'goodsType',
      type: 'select',
      optionList: [],
      optionId: 'categoryType',
      optionLabel: 'categoryName',
      optionsName: 'goodsCategoryList'
    }
  ]
}
const editCommodityObj = {
  editRule: {
    goodsName: [{ required: true, message: '请输入商品名称', trigger: 'change' }],
    // goodsCode: [{ required: true, message: '请选择所属系列', trigger: 'change' }],
    goodsType: [{ required: true, message: '请选择所属分类', trigger: 'change' }],
    position: [{ required: true, message: '请选择适用部位', trigger: 'change' }],
    convertedValue: [{ required: true, message: '请输入比例换算', trigger: 'change' }],
    deductionStandard: [{ required: true, message: '请输入扣减标准', trigger: 'change' }],
    sellPrice: [{ required: true, message: '请输入售价', trigger: 'change' }],
    minSellPrice: [{ required: true, message: '请输入最低售价', trigger: 'change' }],
    giftCost: [{ required: true, message: '请输入赠送成本', trigger: 'change' }],
    productCost: [{ required: true, message: '请输入产品成本', trigger: 'change' }],
    // warningValue: [{ required: true, message: '请输入库存预警下限', trigger: 'change' }],
    // warningValueMax: [{ required: true, message: '请输入库存预警上限', trigger: 'change' }],
    merchantList: [{ required: true, message: '请选择门店', trigger: 'change' }],
    warrantyPeriod: [{ required: true, message: '请输入质保年限', trigger: 'change' }]
  },
  editFormData: [
    {
      label: '商品名称',
      name: 'goodsName',
      type: 'input',
      maxlength: 50
    },
    {
      label: '商品编码',
      name: 'type',
      type: 'input',
      maxlength: 50
    },
    {
      label: '所属分类',
      name: 'goodsType',
      type: 'select',
      optionList: [],
      optionId: 'categoryType',
      optionLabel: 'categoryName',
      optionsName: 'goodsCategoryList',
      changeAttr: function(val, targetItem, that) {
        let labelList = ['适用部位', '扣减标准', '产品类型', '质保年限']
        let jpLabelList = ['比例换算']
        let baseLabelList = ['售价', '最低售价', '产品成本']
        let unitLabelList = ['库存下限预警', '库存上限预警']
        let txt = targetItem.optionList.find(k => k.categoryType == val)?.categoryName || ''
        that.changeFormAttr('editFormData', 'isHide', labelList, txt != '自建商品-太阳膜')
        that.changeFormAttr('editFormData', 'isHide', jpLabelList, txt == '自建商品-精品')
        that.changeFormAttr('editFormData', 'append', baseLabelList, txt == '自建商品-精品' ? '元/件' : '元/车')
        that.changeFormAttr('editFormData', 'append', unitLabelList, txt == '自建商品-精品' ? '件' : '米')
        if (txt != '自建商品-太阳膜') {
          that.changeFormAttr('editFormData', 'isHide', baseLabelList, !(txt != '自建商品-太阳膜'))
        }
        that.editForm.baseProductFlag = 'N'
        that.editForm.upgradeProductFlag = 'Y'
        that.handleCheckChange('Y', 'upgradeProductFlag')
        that.handleCheckChange('N', 'baseProductFlag')
      }
    },
    {
      label: '品牌方',
      name: 'brandMerchantName',
      type: 'input',
      maxlength: 20
    },
    {
      label: '供应方',
      name: 'supplierName',
      type: 'input',
      maxlength: 20
    },
    {
      label: '适用部位',
      name: 'position',
      type: 'select',
      isHide: true,
      optionList: [],
      optionId: 'positionValue',
      optionLabel: 'positionName',
      optionsName: 'goodsPosList'
    },
    {
      label: '比例换算',
      name: 'convertedValue',
      type: 'slot',
      addHtml: 'convertedValue',
      isHide: true
    },
    {
      label: '扣减标准',
      name: 'deductionStandard',
      type: 'slot',
      addHtml: 'deductionStandard',
      placeholder: '请输入米数',
      isHide: true
    },
    {
      label: '产品类型',
      name: '',
      type: 'slot',
      addHtml: 'productFlag',
      isHide: true,
      tips: '说明:基础产品应用于客户战败(不升级)订单中,升级产品应用于客户升级订单中'
    },
    {
      label: '售价',
      name: 'sellPrice',
      type: 'input',
      isHide: true,
      append: '元/件'
    },
    {
      label: '最低售价',
      name: 'minSellPrice',
      // type: 'input',
      type: 'slot',
      addHtml: 'minSellPrice',
      // placeholder: '请输入最低售价',
      isHide: true
      // append: '元/件'
    },
    {
      label: '赠送成本',
      name: 'giftCost',
      type: 'input',
      isHide: true,
      append: '元/车'
    },
    {
      label: '产品成本',
      name: 'productCost',
      type: 'input',
      isHide: true,
      append: '元/件'
    },
    {
      label: '库存下限预警',
      name: 'warningValue',
      type: 'input',
      append: '米'
    },
    {
      label: '库存上限预警',
      name: 'warningValueMax',
      type: 'input',
      append: '米'
    },
    {
      label: '质保年限',
      name: 'warrantyPeriod',
      type: 'input',
      isHide: true
    }
  ],

  merchantEditFormData: [
    // {
    //   label: '使用门店列表',
    //   name: 'merchantList',
    //   addHtml: 'selectMerchant',
    //   style: {
    //     'margin-bottom': '10px'
    //   }
    // },
    {
      // label: '',
      name: '',
      addHtml: 'merchantTable'
    }
  ]
}

export default {
  commodityObj,
  editCommodityObj
}