<template>
  <div> 
    <el-form :inline="true" size="mini" :model="queryForm" >
      <el-form-item>
        <el-input style="width:200px" v-model="queryForm.key" placeholder="请输入查询订单编号" clearable></el-input>
        <el-button class="ml10" @click="getDataList()" type="primary">查询</el-button>
      </el-form-item>
      </el-form>
    <el-table v-loading="dataListLoading"
    :data="dataList"
    stripe
    style="width: 100%">
    <el-table-column
      prop="orderid"
      label="订单号"
      >
    </el-table-column>
    <el-table-column
      prop="productID"
      label="商品id">
    </el-table-column>
    <el-table-column
      prop="customerOid"
      label="用户id">
    </el-table-column>
    <el-table-column      
      label="操作" width="180">
      <template slot-scope="scope">
        <el-button  type="text" @click="showDetails(scope.row)">详情</el-button>
      </template>
    </el-table-column>
  </el-table>
   <el-pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" :current-page="pageIndex"
      :page-sizes="[10, 20, 50, 100]" :page-size="pageSize" :total="totalPage"
      layout="total, sizes, prev, pager, next, jumper">
    </el-pagination> 
  <el-dialog
    title="支付详情"
    :visible.sync="dialogVisible"
    width="50%"
    :before-close="handleClose">    
    <div>
      <h4>支付基本信息</h4>
      <el-row class="mb10">
        <el-col :span="12"><span class="title">订单号：</span><span>{{payDetails.orderid}}</span></el-col>
        <el-col :span="12"><span class="title">订单创建时间：</span><span>{{payDetails.createTime}}</span></el-col>
      </el-row>
      <el-row class="mb10">
        <el-col :span="12"><span class="title">用户名：</span><span>{{payDetails.username}}</span></el-col>
        <el-col :span="12"><span class="title">交易商品id：</span><span>{{payDetails.productID}}</span></el-col>
      </el-row>      
      <h4>支付细节</h4>
      <el-row class="mb10">
        <el-col :span="12"><span class="title">交易金额：</span><span class="money">￥{{payDetails.money}}</span></el-col>
        <el-col :span="12"><span class="title">交易方式：</span>
          <span v-if="payDetails.paymentMethod == 3">苹果内购</span>
          <span v-if="payDetails.paymentMethod == 2">支付宝支付</span>
          <span v-if="payDetails.paymentMethod == 1">微信支付</span>
        </el-col>        
      </el-row>
      <el-row class="mb10">
        <el-col :span="12"><span class="title">收据ID：</span><span>{{payDetails.transactionId}}</span></el-col>     
        <el-col :span="12"><span class="title">支付时间：</span><span>{{payDetails.successTime}}</span></el-col>
      </el-row>      
      <el-row class="mb10">
        <el-col :span="24"><span class="title">收据：</span><el-input type="textarea"  :rows="4" v-model="payDetails.receiptData"></el-input></el-col>
      </el-row>
      <el-row class="mb10">
        <el-col :span="24"><span class="title">异常原因：</span><span></span></el-col>        
      </el-row>
    </div>
    <span slot="footer" class="dialog-footer">    
      <el-button type="primary" @click="dialogVisible = false">关 闭</el-button>
    </span>
</el-dialog>
  </div>
</template>

<script>
export default ({
  data() {
    return {
            dataList: [],
          dataListLoading: false,
          dialogVisible: false,   // 弹窗可视化
          payDetails: {},
          pageIndex: 1,
          pageSize: 10,
          totalPage: 0,
          queryForm: {
            key:''
          }
        }
  },    
    methods: {
        // 获取数据列表
    getDataList() {
      this.dataListLoading = true
      this.$http({
        url: this.$http.adornUrl('/Ipa/showFailure'),
        method: 'post',
        data: {
            'page': this.pageIndex,
          'limit': this.pageSize,
            'key': this.queryForm.key,
        }
        // params: this.$http.adornParams({
        //   'page': this.pageIndex,
        //   'limit': this.pageSize,
        //   'key': this.queryForm.key,
        // //   'startTime': this.dataForm.time[0],
        // //   'endTime': this.dataForm.time[1],
        // //   'orderStatus': this.tabChange.tabActiveName,   // 订单状态参数
        // //   'isPrint': this.tabChange.isPrint,
        // //   'orderorderType': this.tabChange.orderName,
        // })

      }).then(({ data }) => {
        if (data && data.code === 0) {
          this.dataList = data.page.list
          this.totalPage = data.page.totalCount          
        } else {
          this.dataList = []          
        }
        this.dataListLoading = false
      })
      },
       // 每页数
    sizeChangeHandle(val) {
      this.pageSize = val
      this.pageIndex = 1
      this.getDataList()
    },
    // 当前页
    currentChangeHandle(val) {
      this.pageIndex = val
      this.getDataList()
      },
    // 查看详情
      showDetails(row) { 
        this.dialogVisible = true
        this.payDetails = row
      },
      handleClose() {
        this.dialogVisible = false
        this.payDetails = {}
      },
      con() { 
        console.log(9999999999)
      }
  },
  created() {
    
    this.getDataList()
     
    },
})
</script>


<style lang="less" scoped>
  .mb10{margin-bottom: 10px;}
  .money{font-size: 16px; color: #17B3A3;}
  .title{color: #888;}
  .ml10{margin-left: 10px;}
</style>