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: 'orderCode',
    width: 300,
  },
  {
    title: '总金额',
    align: "center",
    dataIndex: 'totalAmount',
    customRender: ({text}) => {
      if(text){
        return parseFloat(text)/100
      }
      return '未知';
    },
  },
  {
    title: '商品编号',
    align: "center",
    dataIndex: 'skuCode',
    customRender: ({text}) => {
      if (text === '1001') {
        return '体验卡';
      }else if(text ==='1002'){
        return 'VIP';
      }else if(text ==='9999'){
        return '管理员';
      }else{
        return '未知';
      }
    },
  },
  {
    title: '支付方式',
    //1借记卡、2信用卡、3微信、4支付宝、5现金
    align: "center",
    dataIndex: 'paymentType',
  },
  {
    title: '订单状态',//1未付款、2已付款、3已发货、4已签收
    align: "center",
    dataIndex: 'orderStatus',
  },
  {
    title: '购买人手机号',
    align: "center",
    dataIndex: 'paymentUserId_dictText',//paymentUserId
  },{
    title: '下单时间',
    align: "center",
    dataIndex: 'createTime',//paymentUserId
    resizable: true,
    sorter: {
      multiple: 2
    }
  },{
    title: '支付时间',
    align: "center",
    dataIndex: 'paymentTime',//paymentUserId
    resizable: true,
    sorter: {
      multiple: 2
    }
  },
];
//查询数据
export const searchFormSchema: FormSchema[] = [];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '订单编号（流水号）',
    field: 'orderCode',
    component: 'Input',
  },
  {
    label: '总金额',
    field: 'totalAmount',
    component: 'InputNumber',
  },
  {
    label: '商品编号',
    field: 'skuCode',
    component: 'Input',
  },
  {
    label: '支付方式：1借记卡、2信用卡、3微信、4支付宝、5现金',
    field: 'paymentType',
    component: 'Input',
  },
  {
    label: '订单状态：1未付款、2已付款、3已发货、4已签收',
    field: 'orderStatus',
    component: 'Input',
  },
  {
    label: '购买用户id',
    field: 'paymentUserId',
    component: 'Input',
  },
  // TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false
  },
];


/**
 * 流程表单调用这个方法获取formSchema
 * @param param
 */
export function getBpmFormSchema(_formData): FormSchema[] {
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}
