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: 'name'
   },
   {
    title: '图片',
    align:"center",
    dataIndex: 'pic',
    customRender:render.renderAvatar,
   },
   {
    title: '券额',
    align:"center",
    dataIndex: 'price'
   },
   {
    title: '满多少金额',
    align:"center",
    dataIndex: 'conditionPrice'
   },
   {
    title: '说明',
    align:"center",
    dataIndex: 'info',
    slots: { customRender: 'htmlSlot' },
   },
   {
    title: '优惠券结束时间',
    align:"center",
    dataIndex: 'endTime'
   },
   {
    title: '类型 0指定时间 1单次',
    align:"center",
    dataIndex: 'type_dictText'
   },
   {
    title: '是否删除',
    align:"center",
    dataIndex: 'delFlag_dictText'
   },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '优惠券名',
    field: 'name',
    component: 'Input',
  },
  {
    label: '图片',
    field: 'pic',
     component: 'JImageUpload',
     componentProps:{
      },
  },
  {
    label: '券额',
    field: 'price',
    component: 'InputNumber',
  },
  {
    label: '满多少金额',
    field: 'conditionPrice',
    component: 'InputNumber',
  },
  {
    label: '说明',
    field: 'info',
    component: 'JCodeEditor', //TODO String后缀暂未添加
  },
  {
    label: '优惠券结束时间',
    field: 'endTime',
    component: 'Input',
  },
  {
    label: '类型 0指定时间 1单次',
    field: 'type',
    component: 'JDictSelectTag',
    componentProps:{
        dictCode:"coupon_type"
     },
  },
  {
    label: '是否删除',
    field: 'delFlag',
    component: 'JDictSelectTag',
    componentProps:{
        dictCode:"is_delete"
     },
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入是否删除!'},
          ];
     },
  },
];
