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: 'createTime'
   },
   {
    title: '城市',
    align:"center",
    dataIndex: 'cityId_dictText'
   },
   {
    title: '所属区域',
    align:"center",
    dataIndex: 'shopCion_dictText'
   },
   {
    title: '商品分类',
    align:"center",
    dataIndex: 'shopClass_dictText'
   },
   {
    title: '商品标题',
    align:"center",
    dataIndex: 'name'
   },
   {
    title: '商品图片',
    align:"center",
    dataIndex: 'image',
    customRender:render.renderAvatar,
   },
   {
    title: '价格',
    align:"center",
    dataIndex: 'price'
   },
   {
    title: '单位',
    align:"center",
    dataIndex: 'unit'
   },
   {
    title: '材料',
    align:"center",
    dataIndex: 'material'
   },
   {
    title: '服务',
    align:"center",
    dataIndex: 'service'
   },
   {
    title: '参数',
    align:"center",
    dataIndex: 'parameter'
   },
   {
    title: '库存',
    align:"center",
    dataIndex: 'num'
   },
   {
    title: '购买量',
    align:"center",
    dataIndex: 'payNum'
   },
   {
    title: '是否上架',
    align:"center",
    dataIndex: 'isOpen',
    customRender:({text}) => {
       return  render.renderSwitch(text, [{text:'是',value:'Y'},{text:'否',value:'N'}])
     },
   },
   {
    title: '直接推荐佣金',
    align:"center",
    dataIndex: 'oneMoney'
   },
   {
    title: '间接推荐佣金',
    align:"center",
    dataIndex: 'twoMoney'
   },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
	{
      label: "城市",
      field: "cityId",
      component: 'JSearchSelect',
      componentProps:{
         dict:"common_city,name,id"
      },
      colProps: {span: 6},
 	},
	{
      label: "所属区域",
      field: "shopCion",
      component: 'JSearchSelect',
      componentProps:{
         dict:"common_icon_image,title,id"
      },
      colProps: {span: 6},
 	},
	{
      label: "商品分类",
      field: "shopClass",
      component: 'JMultiSelectTag',//暂无该组件
      componentProps:{
          dictCode:"query_field_dictCode?default("")"
      },
      colProps: {span: 6},
 	},
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '城市',
    field: 'cityId',
    component: 'JSearchSelect',
    componentProps:{
       dict:"common_city,name,id"
    },
  },
  {
    label: '所属区域',
    field: 'shopCion',
    component: 'JSearchSelect',
    componentProps:{
       dict:"common_icon_image,title,id"
    },
  },
  {
    label: '商品分类',
    field: 'shopClass',
    component: 'JMultiSelectTag',//TODO  暂无该组件
    componentProps:{
        dictCode:"common_shop_class,title,id"
     },
  },
  {
    label: '商品标题',
    field: 'name',
    component: 'Input',
  },
  {
    label: '商品图片',
    field: 'image',
     component: 'JImageUpload',
     componentProps:{
      },
  },
  {
    label: '价格',
    field: 'price',
    component: 'InputNumber',
  },
  {
    label: '单位',
    field: 'unit',
    component: 'Input',
  },
  {
    label: '材料',
    field: 'material',
    component: 'Input',
  },
  {
    label: '服务',
    field: 'service',
    component: 'Input',
  },
  {
    label: '参数',
    field: 'parameter',
    component: 'Input',
  },
  {
    label: '库存',
    field: 'num',
    component: 'InputNumber',
  },
  {
    label: '购买量',
    field: 'payNum',
    component: 'InputNumber',
  },
  {
    label: '是否上架',
    field: 'isOpen',
     component: 'JSwitch',
     componentProps:{
     },
  },
  {
    label: '直接推荐佣金',
    field: 'oneMoney',
    component: 'InputNumber',
  },
  {
    label: '间接推荐佣金',
    field: 'twoMoney',
    component: 'InputNumber',
  },
  {
    label: 'x详情富文本',
    field: 'details',
    component: 'JCodeEditor', //TODO String后缀暂未添加
  },
];
