<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 :span="3">
            <a-form-item label="结账状态">
              <a-select v-model="queryParam.preferentialStatus" style="width: 100%" :allowClear="true">
                <a-select-option :value="'1'">未结账</a-select-option>
                <a-select-option :value="'2'">已结账</a-select-option>
              </a-select>
            </a-form-item>
          </a-col>
          <a-col :span="3">
            <a-form-item label="房间名">
              <a-input v-model="queryParam.roomName"></a-input>
            </a-form-item>
          </a-col>
          <a-col :span="6">
            <a-form-item label="">
              <a-range-picker @change="timeOk">
                <template slot="renderExtraFooter">
                  <!-- extra footer -->
                </template>
              </a-range-picker>
            </a-form-item>
          </a-col>
          <a-col :md="6" :sm="8">
                    <span style="float: left; overflow: hidden" class="table-page-search-submitButtons">
                        <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
                      <!-- <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button> -->
                    </span>
          </a-col>
        </a-row>
      </a-form>
    </div>

    <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">
        <template slot="subjectType" slot-scope="text, record, index">
          {{ getSubjectTypeText(text,record) }}
        </template>


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

<script>
import {
  JeecgListMixin
} from '@/mixins/JeecgListMixin'

const columns = [
  {
    title: '订单号',
    dataIndex: 'livingOrderId',
    width: 30,
    align: 'center'
  },
  {
    title: '房间',
    dataIndex: 'roomName',
    width: 30,
    align: 'center'
  },
  {
    title: '业务详情',
    dataIndex: 'subjectType',
    width: 60,
    align: 'center',
    scopedSlots: { customRender: 'subjectType' }
  },
  {
    title: '冲账金额',
    dataIndex: 'money',
    width: 60,
    align: 'center',
    customRender: function (text, record) {
      return -record.money
    }
  },
  {
    title: '操作时间',
    dataIndex: 'createTime',
    width: 100,
    align: 'center'
  },
  {
    title: '备注',
    dataIndex: 'remark',
    width: 60,
    align: 'center',
    scopedSlots: { customRender: 'remark'}
  },
]
export default {
  name: "memberList",
  mixins: [JeecgListMixin],
  components: {
  },

  mounted() {

  },
  data() {
    return {
      activeKey: '4',
      columns: columns,
      queryParam: {
        roomName: '',
        preferentialStatus: ''
      },
      url: {
        list: '/business/busOrderFee/strike-balance-page'
      },
      arr: [],
      // dataList:[],
      examineVisible: false,
      // 分页参数
      ipagination: {
        current: 1,
        pageSize: 10,
        pageSizeOptions: ["10", "20", "30"],
        showTotal: (total, range) => {
          return range[0] + "-" + range[1] + " 共" + total + "条";
        },
        showQuickJumper: true,
        showSizeChanger: true,
        total: 0,
      },

    };
  },
  created() {

  },
  methods: {
    tabStockTypeChange(e) {
      this.queryParam.type = e;
      this.loadData();
    },

    handleOk() {

    },

    timeOk(data, dataTime) {
      this.queryParam.startTime = dataTime[0];
      this.queryParam.endTime = dataTime[1];
      this.loadData();
    },
    getSubjectTypeText(text, record) {
      var msg = ''
      if (text == 1) {
        msg = '押金'
      } else if (text == 2) {
        msg = '预收房费'
      } else if (text == 3) {
        msg = '每日房费'
      } else if (text == 4) {
        msg = '优惠金额'
      } else if (text == 5) {
        msg = '结账收款'
      } else if (text == 6 && record.feeGoodVo) {
        msg = '商品-' + record.feeGoodVo.name
      } else if (text == 7) {
        msg = '点餐'
      } else if (text == 8) {
        msg = '夜审房费'
      } else if (text == 9) {
        msg = '会议室'
      } else if (text == 10) {
        msg = '手工房费'
      } else if (text == 11) {
        msg = '水电煤抄表'
      } else if (text == 12) {
        msg = '赔偿费'
      } else if (text == 13) {
        msg = '退单结账'
      }
      return msg
    },
  },
};
</script>

<style lang="less" scoped>
@import "~@assets/less/common.less";

/deep/ .ant-table-content .ant-table-body {
  position: relative;
  z-index: 2;
  background: #FFFFFF;
}

/deep/ .ant-table-footer .ant-table-body {
  overflow: hidden !important;
  position: relative !important;
  z-index: 1 !important;
}

/deep/ .ant-table-content>.ant-table-footer {
  padding: 0 !important;
  top: -47px;
  position: relative;
  z-index: 0;
}
/deep/.ant-table-footer{
  padding: 0 !important;
  top: -8px;
  position: relative;
  z-index: 2;
}
</style>
