import {
  urbanArea
} from '@/assets/js/districtCode'
import {
  orderStatus
} from '@/assets/js/blockSort'
export const employee = () => {
  return [{
    field: 'index',
    label: '编号',
    align: 'center',
  }, {
    field: 'state',
    operation: true,
    label: '状态',
    align: 'center',
    colWidth: '150px',
    options: orderStatus(),
  }, {
    field: 'customer.type',
    label: '客户类型',
    align: 'center',
    colWidth: '100px',
    options: [{
        label: '商户',
        value: 0,
      },
      {
        label: '私人',
        value: 1,
      }
    ]
  }, {
    field: 'customer.name',
    label: '客户名称',
    align: 'center',
    colWidth: '150px',
  }, {
    field: 'customer.principalPhone',
    label: '客户电话',
    align: 'center',
    colWidth: '120px',
  }, {
    field: 'address',
    label: '客户地址',
    align: 'center',
    colWidth: '230px',
  }, {
    field: 'store.name',
    label: '配送门店',
    align: 'center',
    colWidth: '200px',
  }, {
    field: 'user.nickName',
    label: '配送人员',
    align: 'center',
    colWidth: '120px',
  }, {
    field: 'goods.name',
    label: '商品',
    align: 'center',
    colWidth: '120px',
  }, {
    field: 'spec.name',
    label: '规格',
    align: 'center',
    colWidth: '100px',
  }, {
    field: 'quantity',
    label: '数量',
    align: 'center',
    colWidth: '80px',
  }, {
    field: 'orderTime',
    label: '下单时间',
    align: 'center',
    colWidth: '200px',
  }, {
    field: 'action',
    label: '操作',
    colWidth: '280px',
    align: 'center',
    labelButton: [{
      type: 'logs',
      label: '查看',
      icon: 'el-icon-tickets',
      style: 'info',
    }, {
      type: 'edit',
      label: '修改订单',
      icon: 'el-icon-edit',
      style: 'primary',
    }, {
      type: 'del',
      label: '取消订单',
      icon: 'el-icon-delete',
      style: 'danger',
    }]
  }]
}

export const formRules = () => {
  return [{
    field: 'phone',
    label: '来电号码',
    placeholder: '来电号码',
    type: 'input',
    colWidth: 12,
    rules: [{
      required: true,
      message: '请输入来电号码',
      trigger: 'blur'
    }]
  }, {
    label: '搜索客户信息',
    type: 'search',
    colWidth: 12,
  }, {
    label: '客户资料',
    type: 'divider',
    colWidth: 24,
  }, {
    field: 'type',
    label: '客户类型',
    placeholder: '客户类型',
    type: 'radio',
    colWidth: 12,
    rules: [{
      required: true,
      message: '选择客户类型',
      trigger: 'change'
    }],
    options: [{
        label: '商户',
        value: 0,
      },
      {
        label: '私人',
        value: 1,
      }
    ]
  }, {
    field: 'name',
    label: '名字',
    placeholder: '名字',
    type: 'input',
    colWidth: 12,
    labelWidth: '60px',
    rules: [{
      required: true,
      message: '请输入名字',
      trigger: 'change'
    }],
  }, {
    field: 'cityRegion',
    type: 'cascader',
    label: '所在城市/地区',
    placeholder: '请选择',
    colWidth: 24,
    rules: [{
      required: true,
      message: '请选择所在城市/地区',
      trigger: 'change'
    }],
    options: urbanArea(),
  }, {
    field: 'address',
    label: '详细地址',
    placeholder: '详细地址',
    type: 'input',
    colWidth: 24,
    rules: [{
      required: true,
      message: '请输入详细地址',
      trigger: 'change'
    }],
  }, {
    field: 'remark',
    label: '客户备注',
    placeholder: '客户备注',
    type: 'textarea',
    colWidth: 24,
  }, {
    label: '下单信息',
    type: 'divider',
    colWidth: 24,
  }, {
    field: 'goodsId',
    type: 'select',
    label: '商品',
    placeholder: '请选择',
    colWidth: 8,
    labelWidth: '60px',
    multiple: false,
    rules: [{
      required: true,
      message: '请选择商品',
      trigger: 'change'
    }],
    options: [],
  }, {
    field: 'specId',
    type: 'select',
    label: '规格',
    placeholder: '请选择',
    colWidth: 8,
    labelWidth: '60px',
    rules: [{
      required: true,
      message: '请选择规格',
      trigger: 'change'
    }],
    options: [],
  }, {
    field: 'quantity',
    label: '数量',
    placeholder: '数量',
    type: 'input',
    colWidth: 8,
    labelWidth: '60px',
    rules: [{
      required: true,
      message: '请输入数量',
      trigger: 'blur'
    }]
  }, {
    field: 'storeId',
    type: 'select',
    label: '配送门店',
    placeholder: '请选择配送门店',
    colWidth: 12,
    labelWidth: '90px',
    rules: [{
      required: false,
      message: '请选择配送门店',
      trigger: 'change'
    }],
    options: [],
  }, {
    field: 'userId',
    type: 'select',
    label: '配送员',
    placeholder: '请选择配送员',
    colWidth: 12,
    labelWidth: '80px',
    multiple: false,
    rules: [{
      required: false,
      message: '请选择配送员',
      trigger: 'change'
    }],
    options: [],
  }, {
    field: 'orderNote',
    label: '备注',
    placeholder: '订单备注',
    type: 'textarea',
    labelWidth: '60px',
    colWidth: 24,
  }, ]
}
