<template>
  <div class="app-container">

    <el-table :data="orderList" id="QuestionTable" border
      style="width: 100%;border-radius: 5px;box-shadow: 0 0 10px #efefef;margin-top: 10px;" :stripe='true'>
      <el-table-column type="index" prop="date" width="50" align="center"></el-table-column>
      <el-table-column prop="date" label="用户昵称">
        <template slot-scope="scope">
          <span>{{ scope.row.UserName }}</span>
        </template>
      </el-table-column>

      <el-table-column prop="date" label="订单号">
        <template slot-scope="scope">
            <span>{{ scope.row.OrderId }}</span>
        </template>
      </el-table-column>
      <el-table-column prop="PayPrice" label="价格">
        <template slot-scope="scope">
            <span>{{ scope.row.OrderPrice *0.01}}</span>
        </template>
      </el-table-column>


      <el-table-column prop="date" label="支付方式">
        <template slot-scope="scope">
          <span >余额支付</span>
        </template>
      </el-table-column>
      <el-table-column prop="date" label="购买时间">
        <template slot-scope="scope">
          <span v-if="scope.row.PayTime">{{ scope.row.PayTime.replace('T',' ') }}</span>
        </template>
      </el-table-column>

    </el-table>
    <el-pagination background @current-change="currentchange"
      style="position:static;bottom: 3px;text-align: center;margin-top: 5px;" :page-size="this.query.PageSize"
      layout="total,prev, pager, next" :total="Count">
    </el-pagination>

  </div>
</template>

<script>
  import {
    OrderGetOrderList
  } from '@/api/order.js'
  import {
    formatTime
  } from '@/utils/util.js'
  export default {
    data() {

      return {
        orderList: [],

        Count: 0,
        query: {
          PurchaseContent: 3, //1：余额充值，3：试卷购买
          PageIndex: 1,
          PageSize: 20,
        },

      }
    },
    created() {
      this.GetOrder()
    },
    methods: {
      currentchange(page) {
        this.query.PageIndex = page;
        this.GetOrder();
      },

      GetOrder() {
        OrderGetOrderList(this.query).then(res => {
          this.orderList = res.data.data.rows.map(t => {
            if (t.phone) {
              t.phone1 = t.phone.replace(t.phone.substring(3, 7), '****')
            }
            return t
          })
          this.Count = res.data.data.total
        })
      },

    }
  }
</script>

<style>
  .seetingsDiv {
    width: 100%;
    height: 60px;
    background: #efefef;
    line-height: 60px;
    border-radius: 5px;
    box-shadow: 0 0 5px #cdcdcd;
  }

  .seetingsDiv button {
    background-color: #304156;
    border: 0px;
    margin-left: 10px;
    box-shadow: 0 0 5px #cdcdcd;
    float: right;
    margin-top: 12px;
    margin-right: 10px;
  }
</style>
