<template>
  <a-card :bordered="false">
    <!-- 查询区域 -->
    <div class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
        <a-row :gutter="24">
          <a-col :md="6" :sm="8">
            <a-form-item label="输入搜索">
              <j-input placeholder="订单编号/商品货号" v-model="queryParam.id"></j-input>
            </a-form-item>
          </a-col>
          <a-col :md="6" :sm="8">
            <a-form-item label="收货人">
              <j-input placeholder="收货人" v-model="queryParam.userAccount"></j-input>
            </a-form-item>
          </a-col>
          <a-col :md="7" :sm="10">
            <a-form-item label="提交时间">
              <a-date-picker @change="onChangeData" />
            </a-form-item>
          </a-col>

          <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
            <a-col :md="6" :sm="24">
              <a-button type="primary" @click="searchQuery">查询</a-button>
              <a-button style="margin-left: 8px" @click="searchReset">重置</a-button>
            </a-col>
          </span>
        </a-row>
      </a-form>
    </div>
    <!-- table区域-begin -->
    <div>
      <a-table ref="table" size="middle" :scroll="{x:true}" bordered rowKey="id" :columns="columns"
               :dataSource="dataSource" :pagination="ipagination" :loading="loading" class="j-table-force-nowrap"
               @change="handleTableChange">

        <span slot="action" slot-scope="text, record">
          <a @click="onDetail(record.id, 'detail')">详情</a>
            <template v-if="record.orderStatus === 1">
            <a-divider type="vertical"/>
            <a @click="onDetail(record.id, 'audit')">申请退款</a>
          </template>
        </span>
      </a-table>

    </div>
  </a-card>
</template>

<script>
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import {ORDER_STATUS,PAYMENT_METOD, filterDictTextByStatic} from '@/assets/static.js'
// import NoticeModal from "@views/property/property/modules/NoticeModal.vue";
// import CPopupOnlReport from "@comp/custom/modal/JPopupOnlReport.vue";

const columns = [
  {
    title: '订单编号',
    dataIndex: 'id',
    key: 'id',
    align: 'center',
  },
  {
    title: '提交时间',
    dataIndex: 'createTime',
    key: 'createTime',
    align: 'center',
  },
  {
    title: '用户账号',
    dataIndex: 'userAccount',
    key: 'userAccount',
    align: 'center',
  },
  {
    title: '订单金额',
    dataIndex: 'orderAmount',
    key: 'orderAmount',
    align: 'center',
  },
  {
    title: '支付方式',
    dataIndex: 'paymentMethod',
    key: 'paymentMethod',
    align: 'center',
    customRender: function(text) {
      return filterDictTextByStatic(PAYMENT_METOD, text);
    }
  },
  {
    title: '订单来源',
    dataIndex: 'orderSource',
    key: 'orderSource',
    align: 'center',
  },
  {
    title: '订单状态',
    dataIndex: 'orderStatus',
    key: 'orderStatus',
    align: 'center',
    customRender: function(text) {
      return filterDictTextByStatic(ORDER_STATUS, text);
    }
  },
  {
    title: '退款说明',
    dataIndex: 'refundInstructions',
    key: 'refundInstructions',
    align: 'center',
  },
  {
    title: '所属平台',
    dataIndex: 'ownPlatform',
    key: 'ownPlatform',
    align: 'center',
  },
  {
    title: '所属小区',
    dataIndex: 'propertyName',
    key: 'propertyName',
    align: 'center',
  },
  {
    title: '操作',
    dataIndex: 'action',
    scopedSlots: { customRender: 'action' },
    align: 'center',
    width: 150
  }
]
export default {
  name: "PermissionListAsync",
  mixins: [JeecgListMixin],
  data() {
    return {
      columns: columns,
      loading: false,
      pagination: {
        total: 0,
        current: 1,
        pageSize: 10,
        showSizeChanger: true,
      },
      url: {
        list: '/property-central/property/communityReconciliation/list',
      },
      dataSource:[
        {
          id: 1,
          userAccount: 'admin',
          orderAmount: 100,
          orderSource: '微信',
          paymentMethod: 1,
          orderStatus: 1,
          refundInstructions: '退款说明',
          ownPlatform: '微信',
          propertyName: '小区名称',
          createTime: '2018-01-01'
        },
        {
          id: 2,
          userAccount: 'admin',
          orderAmount: 100,
          orderSource: '微信',
          paymentMethod: 1,
          orderStatus: 1,
          refundInstructions: '退款说明',
          ownPlatform: '微信',
          propertyName: '小区名称',
          createTime: '2018-01-01'
        },
      ]
    }
  },
  created() {},
  methods: {
    onDetail(id,type) {
      this.$router.push({
        path: `/paymentorder/paymentDetail?id=${id}&type=${type}`,
      })
    },
    onChangeData(date, dateString) {
      console.log(date, dateString);
    }
  }
}
</script>

<style scoped>

</style>