import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
    {
    title: '优惠券编号',
    align:"center",
    dataIndex: 'couponId'
   },
   {
    title: '用户编号',
    align:"center",
    dataIndex: 'userId'
   },
   {
    title: '优惠券名',
    align:"center",
    dataIndex: 'couponName'
   },
   {
    title: '图片',
    align:"center",
    dataIndex: 'pic',
    customRender:render.renderAvatar,
   },
   {
    title: '券额',
    align:"center",
    dataIndex: 'price'
   },
   {
    title: '满足多少金额',
    align:"center",
    dataIndex: 'conditionPrice'
   },
   {
    title: '结束时间',
    align:"center",
    dataIndex: 'endTime'
   },
   {
    title: '类型 0指定时间 1单次使用',
    align:"center",
    dataIndex: 'type_dictText'
   },
   {
    title: '状态 0未使用 1已使用',
    align:"center",
    dataIndex: 'status_dictText'
   },
   {
    title: '是否删除',
    align:"center",
    dataIndex: 'delFlag_dictText'
   },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '优惠券编号',
    field: 'couponId',
    component: 'Input',
  },
  {
    label: '用户编号',
    field: 'userId',
    component: 'Input',
  },
  {
    label: '优惠券名',
    field: 'couponName',
    component: 'Input',
  },
  {
    label: '图片',
    field: 'pic',
     component: 'JImageUpload',
     componentProps:{
      },
  },
  {
    label: '券额',
    field: 'price',
    component: 'InputNumber',
  },
  {
    label: '满足多少金额',
    field: 'conditionPrice',
    component: 'InputNumber',
  },
  {
    label: '结束时间',
    field: 'endTime',
    component: 'Input',
  },
  {
    label: '类型 0指定时间 1单次使用',
    field: 'type',
    component: 'JDictSelectTag',
    componentProps:{
        dictCode:"coupon_type"
     },
  },
  {
    label: '状态 0未使用 1已使用',
    field: 'status',
    component: 'JDictSelectTag',
    componentProps:{
        dictCode:"coupon_log_status"
     },
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入状态 0未使用 1已使用!'},
          ];
     },
  },
  {
    label: '是否删除',
    field: 'delFlag',
    component: 'JDictSelectTag',
    componentProps:{
        dictCode:"is_delete"
     },
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入是否删除!'},
          ];
     },
  },
];
