index.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. <template>
  2. <doc-alert title="支付功能开启" url="https://doc.iocoder.cn/pay/build/" />
  3. <!-- 搜索工作栏 -->
  4. <ContentWrap>
  5. <el-form
  6. class="-mb-15px"
  7. :model="queryParams"
  8. ref="queryFormRef"
  9. :inline="true"
  10. label-width="100px"
  11. >
  12. <el-form-item label="应用编号" prop="appId">
  13. <el-select
  14. v-model="queryParams.appId"
  15. placeholder="请选择应用信息"
  16. clearable
  17. filterable
  18. class="!w-240px"
  19. >
  20. <el-option v-for="item in appList" :key="item.id" :label="item.name" :value="item.id" />
  21. </el-select>
  22. </el-form-item>
  23. <el-form-item label="通知类型" prop="type">
  24. <el-select
  25. v-model="queryParams.type"
  26. placeholder="请选择通知类型"
  27. clearable
  28. class="!w-240px"
  29. >
  30. <el-option
  31. v-for="dict in getIntDictOptions(DICT_TYPE.PAY_NOTIFY_TYPE)"
  32. :key="dict.value"
  33. :label="dict.label"
  34. :value="dict.value"
  35. />
  36. </el-select>
  37. </el-form-item>
  38. <el-form-item label="关联编号" prop="dataId">
  39. <el-input
  40. v-model="queryParams.dataId"
  41. placeholder="请输入关联编号"
  42. clearable
  43. @keyup.enter="handleQuery"
  44. class="!w-240px"
  45. />
  46. </el-form-item>
  47. <el-form-item label="通知状态" prop="status">
  48. <el-select
  49. v-model="queryParams.status"
  50. placeholder="请选择通知状态"
  51. clearable
  52. class="!w-240px"
  53. >
  54. <el-option
  55. v-for="dict in getIntDictOptions(DICT_TYPE.PAY_NOTIFY_STATUS)"
  56. :key="dict.value"
  57. :label="dict.label"
  58. :value="dict.value"
  59. />
  60. </el-select>
  61. </el-form-item>
  62. <el-form-item label="商户订单编号" prop="merchantOrderId">
  63. <el-input
  64. v-model="queryParams.merchantOrderId"
  65. placeholder="请输入商户订单编号"
  66. clearable
  67. @keyup.enter="handleQuery"
  68. class="!w-240px"
  69. />
  70. </el-form-item>
  71. <el-form-item label="创建时间" prop="createTime">
  72. <el-date-picker
  73. v-model="queryParams.createTime"
  74. style="width: 240px"
  75. value-format="yyyy-MM-dd HH:mm:ss"
  76. type="daterange"
  77. range-separator="-"
  78. start-placeholder="开始日期"
  79. end-placeholder="结束日期"
  80. :default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
  81. class="!w-240px"
  82. />
  83. </el-form-item>
  84. <el-form-item>
  85. <el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
  86. <el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
  87. </el-form-item>
  88. </el-form>
  89. </ContentWrap>
  90. <!-- 列表 -->
  91. <ContentWrap>
  92. <el-table v-loading="loading" :data="list">
  93. <el-table-column label="任务编号" align="center" prop="id" />
  94. <el-table-column label="应用编号" align="center" prop="appName" />
  95. <el-table-column label="商户订单编号" align="center" prop="merchantOrderId" />
  96. <el-table-column label="通知类型" align="center" prop="type">
  97. <template #default="scope">
  98. <dict-tag :type="DICT_TYPE.PAY_NOTIFY_TYPE" :value="scope.row.type" />
  99. </template>
  100. </el-table-column>
  101. <el-table-column label="关联编号" align="center" prop="dataId" />
  102. <el-table-column label="通知状态" align="center" prop="status">
  103. <template #default="scope">
  104. <dict-tag :type="DICT_TYPE.PAY_NOTIFY_STATUS" :value="scope.row.status" />
  105. </template>
  106. </el-table-column>
  107. <el-table-column
  108. label="最后通知时间"
  109. align="center"
  110. prop="lastExecuteTime"
  111. width="180"
  112. :formatter="dateFormatter"
  113. />
  114. <el-table-column
  115. label="下次通知时间"
  116. align="center"
  117. prop="nextNotifyTime"
  118. width="180"
  119. :formatter="dateFormatter"
  120. />
  121. <el-table-column label="通知次数" align="center" prop="notifyTimes">
  122. <template #default="scope">
  123. <el-tag size="small" type="success">
  124. {{ scope.row.notifyTimes }} / {{ scope.row.maxNotifyTimes }}
  125. </el-tag>
  126. </template>
  127. </el-table-column>
  128. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  129. <template #default="scope">
  130. <el-button
  131. link
  132. type="primary"
  133. @click="openDetail(scope.row.id)"
  134. v-hasPermi="['pay:notify:query']"
  135. >
  136. 查看详情
  137. </el-button>
  138. </template>
  139. </el-table-column>
  140. </el-table>
  141. <!-- 分页组件 -->
  142. <Pagination
  143. :total="total"
  144. v-model:page="queryParams.pageNo"
  145. v-model:limit="queryParams.pageSize"
  146. @pagination="getList"
  147. />
  148. </ContentWrap>
  149. <!-- 表单弹窗:预览 -->
  150. <NotifyDetail ref="detailRef" />
  151. </template>
  152. <script lang="ts" setup>
  153. import * as PayNotifyApi from '@/api/pay/notify'
  154. import * as PayAppApi from '@/api/pay/app'
  155. import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
  156. import { dateFormatter } from '@/utils/formatTime'
  157. import NotifyDetail from './NotifyDetail.vue'
  158. defineOptions({ name: 'PayNotify' })
  159. const loading = ref(true) // 列表的加载中
  160. const total = ref(0) // 列表的总页数
  161. const list = ref() // 列表的数据
  162. const queryParams = ref({
  163. pageNo: 1,
  164. pageSize: 10,
  165. appId: null,
  166. type: null,
  167. dataId: null,
  168. status: null,
  169. merchantOrderId: null,
  170. createTime: []
  171. })
  172. const queryFormRef = ref() // 搜索的表单
  173. const appList = ref([]) // 支付应用列表集合
  174. // 是否显示弹出层
  175. const open = ref(false)
  176. // 通知详情
  177. const notifyDetail = ref<any>({
  178. logs: []
  179. })
  180. /** 搜索按钮操作 */
  181. const handleQuery = () => {
  182. queryParams.value.pageNo = 1
  183. getList()
  184. }
  185. /** 查询列表 */
  186. const getList = async () => {
  187. loading.value = true
  188. try {
  189. const data = await PayNotifyApi.getNotifyTaskPage(queryParams.value)
  190. list.value = data.list
  191. total.value = data.total
  192. loading.value = false
  193. } finally {
  194. loading.value = false
  195. }
  196. }
  197. /** 重置按钮操作 */
  198. const resetQuery = () => {
  199. queryFormRef.value?.resetFields()
  200. handleQuery()
  201. }
  202. /** 详情按钮操作 */
  203. const detailRef = ref()
  204. const openDetail = (id: number) => {
  205. detailRef.value.open(id)
  206. }
  207. /** 初始化 **/
  208. onMounted(async () => {
  209. await getList()
  210. // 获得筛选项
  211. appList.value = await PayAppApi.getAppList()
  212. })
  213. </script>