<template>
  <div>
    <listTemp ref="list" :columns="columns" :param="param" :tableName="'payOrdersTable'" keyRouteName="orderno" :searchType="searchType" :detailPage="{name:'payOrdersDetail',idname:'sys_payorderid'}">
      <template #operation>
        <addTemp @payClose="onSuccess"></addTemp>
      </template>
      <template #tb_cell="{data}">
        <template v-if="data.column.dataIndex === 'ispaid'">
          <span v-if="data.record.ispaid == '0'" style="color: #4f7bfd">未付费</span>
          <span v-else-if="data.record.ispaid == '3'" style="color: #afb0be">已取消</span>
          <span v-else-if="data.record.ispaid == '4'" style="color: #afb0be">已退款</span>
          <span v-else-if="data.record.ispaid == '1'"  style="color: green">已付费</span>
        </template>
        <template v-else-if="data.column.dataIndex === 'amount'">
          <span style="color: red">{{utils.formatAmount(data.record.amount,2)}}</span>
        </template>
        <template v-if="data.column.dataIndex === 'operation'">
          <a-space>
<!--            <editTemp :data="data.record"></editTemp>
            <a-button type="link" @click="onDelete(data.record)">删 除</a-button>-->
          </a-space>
        </template>
      </template>
    </listTemp>
  </div>
</template>

<script setup>
  import Api from '@/api/api'
  import utils from '@/utils/utils'
  import listTemp from '@/components/listTemplate/index.vue'
  import addTemp from './modules/add.vue'
  import {ref, createVNode, defineEmits} from 'vue'
  import { useRouter } from "vue-router";
  import { onMounted } from "vue";
  const emit = defineEmits(['onSuccess'])
  const router = useRouter()
  const list = ref()
  let columns = ref([])
  let dataSource = ref([])
  let searchType = ref([
    {label:'搜索',key:'condition',type:'input'},
  ])
  let param = ref({
    "content": {
      "nocache":true,
      "pageNumber": 1,
      "pageSize": 20,
      "where": {
        "condition": ""
      }
    },
    "id":20230904132202
  })
  const onSuccess = async()=>{
    list.value.tableData()
    const res = await Api.requested({
      "classname": "sysmanage.develop.userauthforweb.userauth",
      "method": "query_userauth",
      "content": {
        "nocache":true,
        "place": 1
      },
      "systemappid": ""
    })
    console.log(res.data)
    // sessionStorage.setItem('app',JSON.stringify(res.data[1].modules[1].apps))
  }

</script>

<style scoped>

</style>
