<template>
  <div class="app-container">
    <el-form :model="q" inline><el-form-item label="订单号"><el-input v-model="q.orderNo" size="small"/></el-form-item>
    <el-form-item label="网关"><el-select v-model="q.gateway" size="small"><el-option label="微信" value="wechat"/><el-option label="支付宝" value="alipay"/><el-option label="Mock" value="mock"/></el-select></el-form-item>
    <el-form-item><el-button icon="el-icon-search" size="small" @click="search">查询</el-button></el-form-item></el-form>
    <el-table border :data="results" v-loading="loading">
      <el-table-column prop="orderNo" label="订单号" width="200"/>
      <el-table-column prop="gateway" label="支付网关" width="100"/>
      <el-table-column prop="status" label="状态" width="100"><template slot-scope="s"><el-tag :type="s.row.status==='PAID'?'success':s.row.status==='CREATED'?'warning':'info'" size="small">{{ s.row.status }}</el-tag></template></el-table-column>
      <el-table-column prop="transactionId" label="交易号" width="160"/>
      <el-table-column prop="payUrl" label="支付链接" show-overflow-tooltip/>
    </el-table>
  </div>
</template>
<script>
import { queryPayStatus } from '@/api/workflow/lobster-dashboard'
export default {
  data() { return { q:{orderNo:'',gateway:'wechat'}, results:[], loading:false } },
  methods: {
    async search() {
      if(!this.q.orderNo) return this.$message.warning('请输入订单号')
      this.loading=true
      try { const res = await queryPayStatus(this.q.orderNo, this.q.gateway); this.results=[res.data||res] } catch(e){}
      this.loading=false
    }
  }
}
</script>
