<template>
  <toolbar-container :fields="fields" v-on="$listeners" />
</template>

<script>
import { setStatus } from '@/utils';

export default {
  name: 'OrderManagementToolbar',

  data() {
    return {
      fields: [
        {
          type: 'text',
          name: 'id',
          label: '订单编号'
        },
        {
          type: 'text',
          name: 'accountId',
          label: '购买用户'
        },
        {
          type: 'select',
          name: 'payChannels',
          label: '支付渠道',
          options: setStatus(['积分', '微信', '支付宝'], ['积分', '微信', '支付宝'])
        },
        {
          type: 'dateArray',
          name: 'date',
          label: '支付时间',
          apiName: ['startTime', 'endTime']
        },
        {
          type: 'select',
          name: 'state',
          label: '订单状态',
          options: setStatus(['未支付', '已支付', '待支付'], [-1, 1, 0]),
          format: val => (val !== null && val !== '' ? val : null)
        }
      ]
    };
  }
};
</script>

<style type="scss" scoped></style>
