<template>
  <div class="app-container">
    <!--工具栏-->
    <div class="head-container">
      <div v-if="crud.props.searchToggle">
        <!-- 搜索 -->
        <label class="el-form-item-label">订单号</label>
        <el-input v-model="query.orderCode" clearable placeholder="订单号" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
        <label class="el-form-item-label">发送者电报号</label>
        <el-input v-model="query.sendUserTelegramId" clearable placeholder="发送者电报号" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
        <label class="el-form-item-label">发送者名称</label>
        <el-input v-model="query.sendUserName" clearable placeholder="发送者名称" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
        <label class="el-form-item-label">发送者输赢状况</label>
        <el-input v-model="query.sendUserStatus" clearable placeholder="发送者输赢状况" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
        <label class="el-form-item-label">抢红包者电报号</label>
        <el-input v-model="query.getUserTelegramId" clearable placeholder="抢红包者电报号" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
        <label class="el-form-item-label">抢红包者名称</label>
        <el-input v-model="query.getUserName" clearable placeholder="抢红包者名称" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
        <label class="el-form-item-label">抢红包者输赢状况</label>
        <el-input v-model="query.getUserStatus" clearable placeholder="抢红包者输赢状况" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
        <rrOperation :crud="crud" />
      </div>
      <!--如果想在工具栏加入更多按钮，可以使用插槽方式， slot = 'left' or 'right'-->
      <crudOperation :permission="permission" />
      <!--表单组件-->
      <el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="500px">
        <el-form ref="form" :model="form" :rules="rules" size="small" label-width="80px">
          <el-form-item label="订单号">
            <el-input v-model="form.orderCode" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="发包金额">
            <el-input v-model="form.chipTotal" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="雷号">
            <el-input v-model="form.bombNumber" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="领取次数">
            <el-input v-model="form.nowReceiveCount" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="发送者电报号">
            <el-input v-model="form.sendUserTelegramId" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="发送者名称">
            <el-input v-model="form.sendUserName" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="发送者输赢状况">
            <el-input v-model="form.sendUserStatus" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="手续费">
            <el-input v-model="form.sendUserFee" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="赔率">
            <el-input v-model="form.sendUserProfit" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="抢红包者电报号">
            <el-input v-model="form.getUserTelegramId" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="抢红包者名称">
            <el-input v-model="form.getUserName" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="抢红包者输赢状况">
            <el-input v-model="form.getUserStatus" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="红包金额">
            <el-input v-model="form.getUserGetAmount" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="手续费">
            <el-input v-model="form.getUserFee" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="赔率">
            <el-input v-model="form.getUserProfit" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="specialPrizeType">
            <el-input v-model="form.specialPrizeType" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="specialPrizeAmount">
            <el-input v-model="form.specialPrizeAmount" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="createTime">
            <el-input v-model="form.createTime" style="width: 370px;" />
          </el-form-item>
        </el-form>
        <div slot="footer" class="dialog-footer">
          <el-button type="text" @click="crud.cancelCU">取消</el-button>
          <el-button :loading="crud.status.cu === 2" type="primary" @click="crud.submitCU">确认</el-button>
        </div>
      </el-dialog>
      <!--表格渲染-->
      <el-table ref="table" v-loading="crud.loading" :data="crud.data" size="small" style="width: 100%;" @selection-change="crud.selectionChangeHandler">
        <el-table-column type="selection" width="55" />
        <el-table-column prop="orderCode" label="订单号" />
        <el-table-column prop="chipTotal" label="发包金额" />
        <el-table-column prop="bombNumber" label="雷号" />
        <el-table-column prop="nowReceiveCount" label="领取次数" />
        <el-table-column prop="sendUserTelegramId" label="发送者电报号" />
        <el-table-column prop="sendUserName" label="发送者名称" />
        <el-table-column prop="sendUserStatus" label="发送者输赢状况" />
        <el-table-column prop="sendUserFee" label="手续费" />
        <el-table-column prop="sendUserProfit" label="赔率" />
        <el-table-column prop="getUserTelegramId" label="抢红包者电报号" />
        <el-table-column prop="getUserName" label="抢红包者名称" />
        <el-table-column prop="getUserStatus" label="抢红包者输赢状况" />
        <el-table-column prop="getUserGetAmount" label="红包金额" />
        <el-table-column prop="getUserFee" label="手续费" />
        <el-table-column prop="getUserProfit" label="赔率" />
        <el-table-column prop="createTime" label="创建时间" />
        <!-- <el-table-column v-if="checkPer(['admin','botSendOrderDetails:edit','botSendOrderDetails:del'])" label="操作" width="150px" align="center">
          <template slot-scope="scope">
            <udOperation
              :data="scope.row"
              :permission="permission"
            />
          </template>
        </el-table-column> -->
      </el-table>
      <!--分页组件-->
      <pagination />
    </div>
  </div>
</template>

<script>
import crudBotSendOrderDetails from '@/api/botSendOrderDetails'
import CRUD, { presenter, header, form, crud } from '@crud/crud'
import rrOperation from '@crud/RR.operation'
import crudOperation from '@crud/CRUD.operation'
import udOperation from '@crud/UD.operation'
import pagination from '@crud/Pagination'

const defaultForm = { id: null, orderCode: null, chipTotal: null, bombNumber: null, nowReceiveCount: null, sendUserTelegramId: null, sendUserName: null, sendUserStatus: null, sendUserFee: null, sendUserProfit: null, getUserTelegramId: null, getUserName: null, getUserStatus: null, getUserGetAmount: null, getUserFee: null, getUserProfit: null, specialPrizeType: null, specialPrizeAmount: null, createTime: null }
export default {
  name: 'BotSendOrderDetails',
  components: { pagination, crudOperation, rrOperation, udOperation },
  mixins: [presenter(), header(), form(defaultForm), crud()],
  cruds() {
    return CRUD({ title: 'sendDetail', url: 'api/botSendOrderDetails', idField: 'id', sort: 'id,desc', crudMethod: { ...crudBotSendOrderDetails }})
  },
  data() {
    return {
      permission: {
        add: ['admin', 'botSendOrderDetails:add'],
        edit: ['admin', 'botSendOrderDetails:edit'],
        del: ['admin', 'botSendOrderDetails:del']
      },
      rules: {
      },
      queryTypeOptions: [
        { key: 'orderCode', display_name: '订单号' },
        { key: 'sendUserTelegramId', display_name: '发送者电报号' },
        { key: 'sendUserName', display_name: '发送者名称' },
        { key: 'sendUserStatus', display_name: '发送者输赢状况' },
        { key: 'getUserTelegramId', display_name: '抢红包者电报号' },
        { key: 'getUserName', display_name: '抢红包者名称' },
        { key: 'getUserStatus', display_name: '抢红包者输赢状况' }
      ]
    }
  },
  created() {
    this.crud.optShow = {
      add:false,
      edit: false,
      reset: true,
      download: true
    }
  },
  methods: {
    // 钩子：在获取表格数据之前执行，false 则代表不获取数据
    [CRUD.HOOK.beforeRefresh]() {
      return true
    }
  }
}
</script>

<style scoped>

</style>
