withdraw.js 3.13 KB
import moment from 'moment';

const withdrawStatus = {
  0: '提现中',
  1: '提现成功',
  2: '提现失败',
};

export default function() {
  return {
    filters: {
      createTime: {
        label: '创建时间',
        model: '',
      },
      beginTime: {
        model: '',
      },
      endTime: {
        model: '',
      },
      timeFlag: {
        label: '时间标志',
        model: '',
      },
      withdrawStatus: {
        label: '提现状态',
        model: '',
        options: [
          {
            value: 0,
            label: '提现中',
          },
          {
            value: 1,
            label: '提现成功',
          },
          {
            value: 2,
            label: '提现失败',
          },
        ],
      },
      statementSn: {
        label: '业务单据号',
        model: '',
      },
      targetAccount: {
        label: '提现账户',
        model: '',
      },
      pageNo: 1,
      pageSize: 10,
    },
    tableCols: [
      {
        title: 'ID',
        key: 'id',
        align: 'center',
      },
      {
        title: '申请时间',
        key: 'createTime',
        align: 'center',
        render(h, params) {
          const time = moment.unix(params.row.createTime);
          return (
            <div>
              <div>{time.format('YYYY/MM/DD')}</div>
              <div>{time.format('HH:mm:ss')}</div>
            </div>
          );
        },
      },
      {
        title: '商家收款账户',
        key: 'targetAccount',
        align: 'center',
      },
      {
        title: '申请金额(元)',
        key: 'applyAmount',
        align: 'center',
      },
      {
        title: '服务费(元)',
        key: 'serviceAmount',
        align: 'center',
      },
      {
        title: '成功金额(元)',
      },
      {
        title: '提现状态',
        key: 'status',
        align: 'center',
        render: (h, params) => {
          const row = params.row;
          const as = row.status;
          const asText = as === 2 ? `${withdrawStatus[row.status]}(${row.rejectReason})` : withdrawStatus[as];
          row.lineIndex = params.index;
          return <p class={{ 'high-light': as === 2 }}>{asText}</p>;
        },
        className: 'status-column',
      },
      // {
      //   title: '业务单据号',
      //   key: 'statementSn',
      //   align: 'center',
      // },
      {
        title: '说明',
        key: 'remarks',
      },
      {
        title: '操作人',
        key: 'applyPid',
        align: 'center',
      },
      {
        title: '操作',
        key: 'action',
        width: 180,
        align: 'center',
        render: (h, params) => {
          const row = params.row;
          return (
            <div>
              <div class="cell-action-row">
                <i-button type="primary" size="small" onClick={() => this.getDetailById(row.id)}>
                  提现明细
                </i-button>
              </div>
            </div>
          );
        },
        className: 'action-column',
      },
    ],
    tableData: [],
    pageData: {
      total: 0,
      current: 1,
      pageSize: 10,
    },
  };
}