const columns = [
  // {
  //   type: "selection",
  //   fixed: "left",
  //   _noset_: true,
  // },
  {
    prop: 'filingCode',
    label: '报备单编号',
    width: '155px'
  },
  {
    prop: 'status',
    label: '状态',
    width: '125px',
    _slot_: 'status'
  },
  {
    prop: 'wsm_has_account',
    label: '供应商端',
    width: '80px',
    _slot_: 'wsm_has_account'
  },
  {
    prop: 'catinfo',
    label: '商品分类',
    width: '158px'
  },
  {
    prop: 'good_name',
    label: '商品名称',
    'min-width': '145px'
  },

  {
    prop: 'num',
    label: '总数量',
    width: '110px'
  },
  {
    prop: 'transfer_num',
    label: '已转单数量',
    width: '110px'
  },
  {
    prop: 'wait_num',
    label: '未转单数量',
    width: '110px'
  },
  {
    prop: 'cgd_charge',
    label: '采购价',
    width: '110px'
  },
  {
    prop: 'price',
    label: '销售价',
    width: '120px'
  },
  {
    prop: 'expect_service',
    label: '期望服务费',
    width: '110px'
  },
  {
    prop: 'companyName',
    label: '企业客户',
    width: '165px',
    _slot_: 'company'
  },
  {
    prop: 'customerName',
    label: '业务公司',
    width: '225px',
    _slot_: 'customer'
  },
  {
    prop: 'supplierName',
    label: '供应商公司',
    width: '225px',
    _slot_: 'supplier'
  },
  // {
  //   prop: "companyCode",
  //   label: "企业客户编号",
  //   width: "145px",
  // },
  {
    prop: 'addtime',
    label: '创建时间',
    width: '145px'
  },
  {
    prop: '',
    label: '操作',
    fixed: 'right',
    _noset_: true,
    width: '110px',
    _slot_: 'operation'
  }
]

export const is_determine_price_options = [
  { id: '0', label: '否' },
  { id: '1', label: '是' }
]

export const options13 = [
  { id: '0', name: '现结' },
  { id: '1', name: '月清' },
  { id: '2', name: '双月清' }
]

const statusOptions = [
  { value: '0', label: '待审核是否合规' },
  { value: '1', label: '审核不合规' },
  { value: '2', label: '已合规待转单' },
  { value: '3', label: '已部分转单' },
  { value: '4', label: '已全部转单' },
  { value: '5', label: '已取消转单' }
]

export const editColumns = [
  {
    prop: 'filingCode',
    label: '报备单编号',
    span: 6
  },
  {
    prop: 'status',
    label: '状态',
    _slot_: 'status',
    span: 6
  },
  {
    prop: 'apply_name',
    label: '申请人',
    span: 6
  },
  {
    prop: 'addtime',
    label: '申请时间',
    span: 6
  },
  {
    prop: 'supplierName',
    label: '供应商名称',
    _slot_: 'supplierName',
    span: 12
  },
  {
    prop: 'customerName',
    label: '业务公司名称',
    _slot_: 'customerName',
    span: 12
  },
  {
    prop: 'companyName',
    label: '客户名称',
    _slot_: 'companyName',
    span: 12
  },
  {
    prop: 'num',
    label: '销售数量',
    span: 6
  },

  {
    prop: 'is_determine_price',
    label: '是否确认售价',
    _slot_: 'is_determine_price',
    span: 6
  },

  {
    prop: 'cgd_charge',
    label: '采购单价',
    span: 6
  },
  {
    prop: 'price',
    label: '销售单价',
    span: 6
  },
  {
    prop: 'expect_service',
    label: '期望服务费',
    span: 6
  },
  {
    prop: 'expect_service_proportion',
    label: '期望服务费比例',
    span: 6,
    _slot_: 'expect_service_proportion'
  },
  {
    prop: 'service_charge',
    label: '最终服务费',
    span: 6
  },
  {
    prop: 'service_proportion',
    label: '最终服务费比例',
    _slot_: 'service_proportion',
    span: 6
  },
  {
    prop: 'transfer_num',
    label: '已转单数量',
    span: 6
  },
  {
    prop: 'wait_num',
    label: '未转单数量',
    span: 6
  },
  {
    prop: 'plat_code',
    label: '平台商品编号',
    span: 6
  },
  {
    prop: 'manager',
    label: '业务经理',
    span: 6
  },
  {
    prop: 'platform_name',
    label: '所属平台',
    span: 12
  },
  {
    prop: '',
    label: '附件',
    span: 6,
    _slot_: 'annex'
  },
  {
    prop: 'plat_orderCode',
    label: '供应商订单号',
    span: 6
  },
  {
    prop: 'orderCode',
    label: '订单编号',
    span: 12
  }
]

// 采返 采购商品字段
export const coveColumns = [
  {
    prop: 'good_name',
    label: '商品名称',
    _slot_: 'good_name',
    span: 24
  },

  {
    prop: 'cat',
    label: '分类',
    span: 8
  },

  {
    prop: 'brand_name',
    label: '品牌',
    span: 8,
    _slot_:'brand_name'
  },
  {
    prop: 'send_way',
    label: '发货方式',
    _slot_: 'send_way',
    span: 8
  },
  {
    prop: 'unit_name',
    label: '单位',
    span: 6
  },
  {
    prop: 'tax',
    label: '税点',
    append: '%',
    span: 6
  },
  {
    prop: 'pay_way',
    label: '付款方式',
    _slot_: 'pay_way',
    span: 6
  },

  {
    prop: 'weight',
    label: '商品总克重',
    append: 'g',
    span: 6
  },

  // {
  //   prop: "addtime",
  //   label: "反馈时间",
  //   span: 6,
  // },

  {
    prop: 'preservation_day',
    label: '有效期',
    append: '天',
    span: 6
  },

  {
    prop: 'delivery_day',
    label: '物流时间',
    append: '天',
    span: 6
  },
  {
    prop: 'make_day',
    label: '生产工期',
    append: '天',
    span: 6
  },

  {
    prop: 'supply_area',
    label: '供货区域',
    _slot_: 'supply_area',
    span: 6
  },

  {
    prop: 'good_img',
    label: '商品图片',
    _slot_: 'good_img',
    span: 24
  },
  // {
  //   prop: "noble",
  //   _slot_: "noble",
  //   label: "贵金属信息",
  //   span: 24,
  // },
  {
    prop: 'cost_desc',
    label: '工艺说明',
    span: 24
  },
  {
    prop: 'remark',
    label: '采返备注',
    span: 24
  }
]

export const costArr = [
  {
    prop: 'cert_fee',
    label: '成本证书费',
    append: '元',
    span: 6
  },
  {
    prop: 'pakge_fee',
    label: '成本包装费',
    append: '元',
    span: 6
  },
  {
    prop: 'cost_fee',
    label: '成本工艺费',
    append: '元',
    span: 6
  },
  {
    prop: 'mark_fee',
    label: '成本加标费',
    append: '元',
    span: 6
  },

  {
    prop: 'demo_fee',
    label: '成本打样费',
    append: '元',
    span: 6
  },
  {
    prop: 'open_fee',
    label: '成本开模费',
    append: '元',
    span: 6
  },
  {
    prop: 'delivery_fee',
    label: '成本物流费',
    append: '元',
    span: 6
  },
  {
    prop: 'nake_fee',
    label: '成本裸价',
    append: '元',
    span: 6
  },
  {
    prop: 'total_fee',
    label: '采购成本合计',
    append: '元',
    span: 24
  }
]

export const bargainingArr = [
  {
    prop: 'before_rate',
    label: '议价前毛利率',
    append: '%',
    span: 12
  },

  {
    prop: 'after_rate',
    label: '议价后毛利率',
    append: '%',
    span: 12
  }
]

const showColumns = [
  {
    prop: 'cgdNo',
    label: '销售订单编号',
    span: 6
  },
  {
    prop: 'status',
    label: '销售订单状态',
    _slot_: 'status',
    span: 6
  },
  {
    prop: 'order_type',
    label: '销售订单来源',
    _slot_: 'order_type',
    span: 6
  },
  {
    prop: 'lasttime',
    label: '要求入库时间',
    span: 6
  },

  {
    prop: 'supplier_name',
    label: '销售方公司',
    _slot_: 'supplier_name'
  },
  {
    prop: 'company',
    label: '购买方公司',
    _slot_: 'company'
  },

  // {
  //   prop: "wsm",
  //   label: "仓库信息",
  //   _slot_: "wsm",
  // },

  {
    prop: 'total_fee',
    label: '采购总成本',
    span: 8
  },
  {
    prop: 'good_price',
    label: '销售订单价',
    span: 8
  },
  {
    prop: 'good_num',
    label: '采购总数量',
    span: 8
  },
  {
    prop: 'send_num',
    label: '已发货数量',
    span: 8
  },
  {
    prop: 'wsend_num',
    label: '未发货数量',
    span: 8
  },
  {
    prop: 'addtime',
    label: '创建时间',
    span: 8
  },
  {
    prop: 'addr_info',
    label: '收货信息',
    _slot_: 'addr_info',
    span: 24
  }
]

import { isSpecialSymbol, hasSpace } from '@/utils/validate'

// 是否定制
const options1 = [
  { id: '0', name: '否' },
  { id: '1', name: '是' }
]
// 专属类型
const options2 = [
  { id: '0', name: '非泰康' },
  { id: '1', name: '泰康' }
]
// 销售权限
const options3 = [
  { id: '0', name: '无销售权限' },
  { id: '1', name: '有销售权限' }
]

// 是否库存品
const options4 = [
  { id: '0', name: '系统商品' },
  { id: '1', name: '库存品' }
]
// 是否启用实时金价
const options5 = [
  { id: '0', name: '否' },
  { id: '1', name: '是' }
]
// 供货区域
const options6 = [
  { id: '1', name: '全国' },
  { id: '2', name: '全国除偏远' }
]
// 是否启用阶梯
const options7 = [
  { id: '0', name: '否' },
  { id: '1', name: '是' }
]

// 有无工差
const options8 = [
  { id: '0', name: '无工差' },
  { id: '1', name: '有工差' }
]
// 配置要求
const options9 = ['证书', '包装盒', '绒布袋', '标签', '其他']

// 付款方式
const options10 = [
  { id: '0', name: '现结' },
  { id: '1', name: '月清' },
  { id: '2', name: '双月清' }
]
// 发货方式
const options11 = [
  { id: '0', name: '公司自提' },
  { id: '1', name: '供应商包邮' }
]

const statusList = [
  {
    code: '0',
    name: '新建待审核',
    type: ''
  },
  {
    code: '1',
    name: '审核通过',
    type: 'success'
  },
  {
    code: '2',
    name: '基础修改待审核',
    type: ''
  },
  {
    code: '3',
    name: '成本修改待审核',
    type: ''
  },
  {
    code: '4',
    name: '基础修改驳回',
    type: 'danger'
  },
  {
    code: '5',
    name: '成本修改驳回',
    type: 'danger'
  },
  {
    code: '6',
    name: '新建审核驳回',
    type: 'danger'
  },
  {
    code: '7',
    name: '复制商品待编辑',
    type: 'info'
  },
  {
    code: '8',
    name: '竞价商品待编辑',
    type: 'info'
  }
]
const listCol = [
  { type: 'selection', fixed: 'left', _noset_: true },
  {
    prop: 'spuCode',
    label: '编号',
    width: '160px'
  },
  {
    prop: 'status',
    label: '状态',
    _slot_: 'status',
    width: '118px'
  },
  {
    prop: 'good_thumb_img',
    label: '图片',
    _slot_: 'good_thumb_img',
    width: '45px'
  },
  {
    prop: 'good_name',
    label: '名称',
    'min-width': '160px'
  },
  {
    prop: 'cat_name',
    label: '分类'
  },
  {
    prop: 'brand_name',
    label: '品牌'
  },
  {
    prop: 'isonline',
    label: '是否上线',
    _slot_: 'isonline',
    width: '70px'
  },
  {
    prop: 'supplierNo',
    label: '供应商编号',
    width: '110px'
  },
  {
    prop: 'supplier_name',
    label: '供应商名称',
    width: '110px'
  },
  {
    prop: 'companyNo',
    label: '业务公司编号',
    width: '110px'
  },
  {
    prop: 'company',
    label: '业务公司名称',
    width: '110px'
  },
  // {
  //   prop: "company_name",
  //   label: "创建人部门",
  //   minWidth: "150px",
  // },
  {
    prop: 'creater',
    label: '创建人',
    width: '70px'
  },

  {
    prop: 'addtime',
    label: '创建时间',
    width: '140px'
  },
  {
    prop: '',
    label: '操作',
    fixed: 'right',
    _noset_: true,
    width: '200px',
    _slot_: 'operation'
  }
]
const validate_num = (rule, value, callback) => {
  const { required } = rule
  if (required && value === '') {
    callback(new Error('不能为空！'))
  } else {
    callback()
  }
}
const validate_num_0 = (rule, value, callback) => {
  const { required } = rule
  if (required && value === '') {
    callback(new Error('不能为空！'))
  } else if (
    required &&
    (value === '0' ||
      value === '0.' ||
      value === '0.0' ||
      value === '0.00' ||
      value === '0.000')
  ) {
    callback(new Error('不能为零！'))
  } else {
    callback()
  }
}
const validate_good_img = (rule, value, callback) => {
  const { required } = rule
  if (required && value.length == 0) {
    callback(new Error('请上传商品主图！'))
  } else if (required && (value.length < 3 || value.length > 10)) {
    callback(new Error('商品主图应为3~10张！'))
  } else {
    callback()
  }
}
const validate_desc = (rule, value, callback) => {
  const { required } = rule
  if (required && value.length == 0) {
    callback(new Error('不能为空！'))
  } else if (isSpecialSymbol(value)) {
    callback(new Error('不能使用英文特殊字符！'))
  } else {
    callback()
  }
}
const validate_good_name = (rule, value, callback) => {
  const { required } = rule
  if (required && value.length == 0) {
    callback(new Error('不能为空！'))
  } else if (hasSpace(value)) {
    callback(new Error('系统不允许输入转义字符，请检查后重新输入！'))
  } else if (isSpecialSymbol(value)) {
    callback(new Error('不能使用英文特殊字符！'))
  } else {
    callback()
  }
}
const rules = {
  // managerid:[
  //   {
  //     type:'array',
  //     required: true,
  //     message: '请选择业务经理',
  //     trigger: 'chanage'
  //   }
  // ],
  // plat_orderCode:[
  //   {
  //     required: true,
  //     message: '请输入供应商订单号',
  //     trigger: 'blur'
  //   }
  // ],
  fill_url: [
    {
      required: true,
      message: '请选择附件',
      trigger: 'blur'
    }
  ],
  companyName: [
    {
      required: true,
      message: '客户名称不能为空',
      trigger: 'blur'
    }
  ],
  customerCode: [
    {
      required: true,
      message: '业务公司不能为空',
      trigger: 'blur'
    }
  ],

  is_determine_price: [
    {
      required: true,
      message: '请选择是否确定售价',
      trigger: 'blur'
    }
  ],
  expect_service_proportion: [
    {
      required: true,
      message: '期望服务费比例不能为空',
      trigger: 'blur'
    }
  ],
  expect_service: [
    {
      required: true,
      message: '预期服务费不能为空',
      trigger: 'blur'
    }
  ],
  num: [
    {
      required: true,
      message: '销售数量不能为空',
      trigger: 'blur'
    }
  ],
  cat_id: [
    {
      type: 'array',
      required: true,
      message: '商品分类',
      trigger: 'change'
    }
  ],
  preservation_day: [
    {
      required: true,
      validator: validate_num_0,
      trigger: 'blur'
    }
  ],

  supplierNo: [
    {
      type: 'array',
      required: true,
      message: '请选择供应商',
      trigger: 'change'
    }
  ],
  delivery_day: [
    {
      required: true,
      validator: validate_num,
      trigger: 'blur'
    }
  ],

  pname: [
    {
      required: true,
      validator: validate_good_name,
      trigger: 'blur'
    }
  ],
  make_day: [
    {
      required: true,
      validator: validate_num,
      trigger: 'blur'
    }
  ],
  model: [
    {
      required: true,
      message: '型号不能为空',
      trigger: 'blur'
    }
  ],

  color: [
    {
      required: true,
      message: '颜色不能为空',
      trigger: 'blur'
    }
  ],
  material: [
    {
      required: true,
      message: '材质不能为空',
      trigger: 'blur'
    }
  ],

  brand_id: [
    {
      type: 'array',
      required: true,
      message: '商品品牌',
      trigger: 'change'
    }
  ],
  unit_id: [
    {
      type: 'array',
      required: true,
      message: '请输入商品单位',
      trigger: 'blur'
    }
  ],
  weight: [
    {
      required: true,
      validator: validate_num_0,
      trigger: 'blur'
    }
  ],
  tax: [
    {
      required: true,
      message: '请选择税率',
      trigger: 'change'
    }
  ],
  supply_area: [
    {
      required: true,
      message: '请选择供货区域',
      trigger: 'change'
    }
  ],
  origin_place: [
    {
      type: 'array',
      required: true,
      message: '请选择产地',
      trigger: 'change'
    }
  ],

  delivery_place: [
    {
      type: 'array',
      required: true,
      message: '请选择发货地',
      trigger: 'change'
    }
  ],
  // 固定成本
  cert_fee: [
    {
      required: true,
      validator: validate_num,
      trigger: 'blur'
    }
  ],
  pakge_fee: [
    {
      required: true,
      validator: validate_num,
      trigger: 'blur'
    }
  ],
  cost_fee: [
    {
      required: true,
      validator: validate_num,
      trigger: 'blur'
    }
  ],

  mark_fee: [
    {
      required: true,
      validator: validate_num,
      trigger: 'blur'
    }
  ],
  demo_fee: [
    {
      required: true,
      validator: validate_num,
      trigger: 'blur'
    }
  ],

  open_fee: [
    {
      required: true,
      validator: validate_num,
      trigger: 'blur'
    }
  ],
  delivery_fee: [
    {
      required: true,
      validator: validate_num,
      trigger: 'blur'
    }
  ],
  price: [
    {
      required: true,
      validator: validate_num,
      trigger: 'blur'
    }
  ],
  cgd_charge: [
    {
      required: true,
      validator: validate_num,
      trigger: 'blur'
    }
  ],
  gold_weight: [
    {
      required: true,
      validator: validate_num_0,
      trigger: 'blur'
    }
  ],
  noble_metal: [
    {
      required: true,
      message: '请选择贵金属种类',
      trigger: 'change'
    }
  ],
  is_gold_price: [
    {
      required: true,
      message: '请选择是否启用实时金价',
      trigger: 'change'
    }
  ],
  is_diff: [
    {
      required: true,
      message: '请选择有无工差',
      trigger: 'change'
    }
  ],
  config: [
    {
      required: true,
      type: 'array',
      message: '请选择配置要求',
      trigger: 'change'
    }
  ],
  other_config: [
    {
      required: true,
      message: '其他要求不能为空',
      trigger: 'blur'
    }
  ],
  pay_way: [
    {
      required: true,
      message: '请选择付款方式',
      trigger: 'change'
    }
  ],
  send_way: [
    {
      required: true,
      message: '请选择发货方式',
      trigger: 'change'
    }
  ],

  cost_desc: [
    {
      required: false,
      validator: validate_desc,
      trigger: 'blur'
    }
  ],
  remark: [
    {
      required: true,
      validator: validate_desc,
      trigger: 'blur'
    }
  ],
  good_img: [
    {
      required: true,
      message: '商品图片不能为空',
      trigger: 'change'
    }
  ],
  good_name: [
    {
      required: true,
      message: '商品名称不能为空',
      trigger: 'change'
    }
  ]
}
const ruleForm = {
  companyName: '',
  supplierNo: [],
  customerCode: [],
  is_determine_price: '0',
  num: '0',
  cgd_charge: '0',
  price: '0',
  expect_service_proportion: '0',
  expect_service: '0',
  good_name: '',
  origin_place: [],
  delivery_place: [],
  cat_id: [],
  brand_id: [],
  unit_id: [],
  weight: '0.000',
  tax: '',
  supply_area: '',
  pay_way: '',
  send_way: '0',
  preservation_day: '1', // 有效期
  delivery_day: '0', // 物流时间
  make_day: '0', // 生产工期
  gold_weight: '0.000',
  noble_metal: '',
  config: [],
  other_config: '',
  remark: '',
  cost_desc: '',
  good_img: [],
  total: 0,
  type: '0'
}
const other_ruleForm = {
  // infoNo: "",
  // pname: "",
  // color: "",
  // model: "",
  // material: "",
  cert_fee: '0.00',
  pakge_fee: '0.00',
  cost_fee: '0.00',
  mark_fee: '0.00',
  demo_fee: '0.00',
  open_fee: '0.00',
  delivery_fee: '0.00',
  is_gold_price: '0',
  is_diff: '0'
}

const ruleForm1 = {
  plat_orderCode:"",
  customerName: '',
  fill_url: '',
  companyName: '',
  supplierNo: [],
  customerCode: [],
  is_determine_price: '0',
  num: '',
  cgd_charge: '0',
  price: '0',
  expect_service_proportion: '0',
  expect_service: '0',
  good_name: '',
  originPlace: [],
  origin_place: [],
  delivery_place: [],
  deliveryPlace: [],
  cat_id: [],
  brand_id: [],
  unit_id: [],
  weight: '0',
  tax: '',
  supply_area: '',
  pay_way: '',
  send_way: '0',
  preservation_day: '', // 有效期
  delivery_day: '0', // 物流时间
  make_day: '0', // 生产工期
  gold_weight: '0.000',
  noble_metal: '',
  config: [],
  other_config: '',
  remark: '',
  cost_desc: '',
  good_img: [],
  total: 0,
  type: '0'
}

export {
  options1,
  options2,
  options3,
  options4,
  options5,
  options6,
  options7,
  options8,
  options9,
  options10,
  options11,
  listCol,
  rules,
  statusList,
  columns,
  statusOptions,
  showColumns,
  ruleForm,
  ruleForm1,
  other_ruleForm
}
