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: 'title'
   },
   {
    title: '主图',
    align:"center",
    dataIndex: 'image',
    customRender:render.renderAvatar,
   },
   {
    title: '规格',
    align:"center",
    dataIndex: 'sku'
   },
   {
    title: '类型',
    align:"center",
    dataIndex: 'type_dictText'
   },
   {
    title: '价格',
    align:"center",
    dataIndex: 'price'
   },
   {
    title: '原价',
    align:"center",
    dataIndex: 'oldPrice'
   },
   {
    title: '会员价格',
    align:"center",
    dataIndex: 'vipPrice'
   },
   {
    title: '多少盒',
    align:"center",
    dataIndex: 'box'
   },
   {
    title: '斤',
    align:"center",
    dataIndex: 'jin'
   },
   {
    title: '一盒多少罐',
    align:"center",
    dataIndex: 'tank'
   },
   {
    title: '限购数量',
    align:"center",
    dataIndex: 'num'
   },
   {
    title: '标签',
    align:"center",
    dataIndex: 'skuIcon'
   },
   {
    title: '分类标识',
    align:"center",
    dataIndex: 'classId_dictText'
   },
   {
    title: '首页显示',
    align:"center",
    dataIndex: 'indexNo',
    customRender:({text}) => {
       return  render.renderSwitch(text, [{text:'是',value:'Y'},{text:'否',value:'N'}])
     },
   },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
	{
      label: "类型",
      field: "type",
      component: 'JDictSelectTag',
      componentProps:{
          dictCode:"shop_type"
      },
      colProps: {span: 6},
 	},
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '标题',
    field: 'title',
    component: 'Input',
  },
  {
    label: '主图',
    field: 'image',
     component: 'JImageUpload',
     componentProps:{
      },
  },
  {
    label: '规格',
    field: 'sku',
    component: 'Input',
  },
  {
    label: '类型',
    field: 'type',
    component: 'JDictSelectTag',
    componentProps:{
        dictCode:"shop_type"
     },
  },
  {
    label: '价格',
    field: 'price',
    component: 'InputNumber',
  },
  {
    label: '原价',
    field: 'oldPrice',
    component: 'InputNumber',
  },
  {
    label: '会员价格',
    field: 'vipPrice',
    component: 'InputNumber',
  },
  {
    label: '多少盒',
    field: 'box',
    component: 'InputNumber',
  },
  {
    label: '斤',
    field: 'jin',
    component: 'InputNumber',
  },
  {
    label: '一盒多少罐',
    field: 'tank',
    component: 'InputNumber',
  },
  {
    label: '限购数量',
    field: 'num',
    component: 'InputNumber',
  },
  {
    label: '标签',
    field: 'skuIcon',
    component: 'Input',
  },
  {
    label: '详情',
    field: 'details',
    component: 'JCodeEditor', //TODO String后缀暂未添加
  },
  {
    label: '分类标识',
    field: 'classId',
    component: 'JSearchSelect',
    componentProps:{
       dict:"common_class,title,id"
    },
  },
  {
    label: '首页显示',
    field: 'indexNo',
     component: 'JSwitch',
     componentProps:{
     },
  },
];
