index.vue 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275
  1. <template>
  2. <doc-alert title="支付功能开启" url="https://doc.iocoder.cn/pay/build/" />
  3. <!-- 搜索工作栏 -->
  4. <ContentWrap>
  5. <el-form
  6. :model="queryParams"
  7. ref="queryFormRef"
  8. :inline="true"
  9. v-show="showSearch"
  10. label-width="100px"
  11. >
  12. <el-form-item label="应用编号" prop="appId">
  13. <el-select clearable v-model="queryParams.appId" filterable placeholder="请选择应用信息">
  14. <el-option v-for="item in appList" :key="item.id" :label="item.name" :value="item.id" />
  15. </el-select>
  16. </el-form-item>
  17. <el-form-item label="通知类型" prop="type">
  18. <el-select v-model="queryParams.type" placeholder="请选择通知类型" clearable size="small">
  19. <el-option
  20. v-for="dict in getIntDictOptions(DICT_TYPE.PAY_NOTIFY_TYPE)"
  21. :key="dict.value"
  22. :label="dict.label"
  23. :value="dict.value"
  24. />
  25. </el-select>
  26. </el-form-item>
  27. <el-form-item label="关联编号" prop="dataId">
  28. <el-input
  29. v-model="queryParams.dataId"
  30. placeholder="请输入关联编号"
  31. clearable
  32. @keyup.enter="handleQuery"
  33. />
  34. </el-form-item>
  35. <el-form-item label="通知状态" prop="status">
  36. <el-select v-model="queryParams.status" placeholder="请选择通知状态" clearable>
  37. <el-option
  38. v-for="dict in getIntDictOptions(DICT_TYPE.PAY_NOTIFY_STATUS)"
  39. :key="dict.value"
  40. :label="dict.label"
  41. :value="dict.value"
  42. />
  43. </el-select>
  44. </el-form-item>
  45. <el-form-item label="商户订单编号" prop="merchantOrderId">
  46. <el-input
  47. v-model="queryParams.merchantOrderId"
  48. placeholder="请输入商户订单编号"
  49. clearable
  50. @keyup.enter="handleQuery"
  51. />
  52. </el-form-item>
  53. <el-form-item label="创建时间" prop="createTime">
  54. <el-date-picker
  55. v-model="queryParams.createTime"
  56. style="width: 240px"
  57. value-format="yyyy-MM-dd HH:mm:ss"
  58. type="daterange"
  59. range-separator="-"
  60. start-placeholder="开始日期"
  61. end-placeholder="结束日期"
  62. :default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
  63. />
  64. </el-form-item>
  65. <el-form-item>
  66. <el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
  67. <el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
  68. </el-form-item>
  69. </el-form>
  70. </ContentWrap>
  71. <!-- 列表 -->
  72. <ContentWrap>
  73. <el-table v-loading="loading" :data="list">
  74. <el-table-column label="任务编号" align="center" prop="id" />
  75. <el-table-column label="应用编号" align="center" prop="appName" />
  76. <el-table-column label="商户订单编号" align="center" prop="merchantOrderId" />
  77. <el-table-column label="通知类型" align="center" prop="type">
  78. <template #default="scope">
  79. <dict-tag :type="DICT_TYPE.PAY_NOTIFY_TYPE" :value="scope.row.type" />
  80. </template>
  81. </el-table-column>
  82. <el-table-column label="关联编号" align="center" prop="dataId" />
  83. <el-table-column label="通知状态" align="center" prop="status">
  84. <template #default="scope">
  85. <dict-tag :type="DICT_TYPE.PAY_NOTIFY_STATUS" :value="scope.row.status" />
  86. </template>
  87. </el-table-column>
  88. <el-table-column
  89. label="最后通知时间"
  90. align="center"
  91. prop="lastExecuteTime"
  92. width="180"
  93. :formatter="dateFormatter"
  94. />
  95. <el-table-column
  96. label="下次通知时间"
  97. align="center"
  98. prop="nextNotifyTime"
  99. width="180"
  100. :formatter="dateFormatter"
  101. />
  102. <el-table-column label="通知次数" align="center" prop="notifyTimes">
  103. <template #default="scope">
  104. <el-tag size="small" type="success">
  105. {{ scope.row.notifyTimes }} / {{ scope.row.maxNotifyTimes }}
  106. </el-tag>
  107. </template>
  108. </el-table-column>
  109. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  110. <template #default="scope">
  111. <el-button
  112. size="small"
  113. type="text"
  114. icon="el-icon-search"
  115. @click="handleDetail(scope.row)"
  116. v-hasPermi="['pay:notify:query']"
  117. >查看详情
  118. </el-button>
  119. </template>
  120. </el-table-column>
  121. </el-table>
  122. <!-- 分页组件 -->
  123. <pagination
  124. v-show="total > 0"
  125. :total="total"
  126. v-model:page="queryParams.pageNo"
  127. v-model:limit="queryParams.pageSize"
  128. @pagination="getList"
  129. />
  130. </ContentWrap>
  131. <!-- 对话框(详情) -->
  132. <el-dialog title="通知详情" v-model:visible="open" width="700px" append-to-body destroy-on-close>
  133. <el-descriptions :column="2" label-class-name="desc-label">
  134. <el-descriptions-item label="商户订单编号">
  135. <el-tag size="small">{{ notifyDetail.merchantOrderId }}</el-tag>
  136. </el-descriptions-item>
  137. <el-descriptions-item label="通知状态">
  138. <dict-tag :type="DICT_TYPE.PAY_NOTIFY_STATUS" :value="notifyDetail.status" size="small" />
  139. </el-descriptions-item>
  140. </el-descriptions>
  141. <el-descriptions :column="2" label-class-name="desc-label">
  142. <el-descriptions-item label="应用编号">{{ notifyDetail.appId }}</el-descriptions-item>
  143. <el-descriptions-item label="应用名称">{{ notifyDetail.appName }}</el-descriptions-item>
  144. </el-descriptions>
  145. <el-descriptions :column="2" label-class-name="desc-label">
  146. <el-descriptions-item label="关联编号">{{ notifyDetail.dataId }}</el-descriptions-item>
  147. <el-descriptions-item label="通知类型">
  148. <dict-tag :type="DICT_TYPE.PAY_NOTIFY_TYPE" :value="notifyDetail.type" />
  149. </el-descriptions-item>
  150. </el-descriptions>
  151. <el-descriptions :column="2" label-class-name="desc-label">
  152. <el-descriptions-item label="通知次数">{{ notifyDetail.notifyTimes }}</el-descriptions-item>
  153. <el-descriptions-item label="最大通知次数">{{
  154. notifyDetail.maxNotifyTimes
  155. }}</el-descriptions-item>
  156. </el-descriptions>
  157. <el-descriptions :column="2" label-class-name="desc-label">
  158. <el-descriptions-item label="最后通知时间">{{
  159. formatDate(notifyDetail.lastExecuteTime)
  160. }}</el-descriptions-item>
  161. <el-descriptions-item label="下次通知时间">{{
  162. formatDate(notifyDetail.nextNotifyTime)
  163. }}</el-descriptions-item>
  164. </el-descriptions>
  165. <el-descriptions :column="2" label-class-name="desc-label">
  166. <el-descriptions-item label="创建时间">{{
  167. formatDate(notifyDetail.createTime)
  168. }}</el-descriptions-item>
  169. <el-descriptions-item label="更新时间">{{
  170. formatDate(notifyDetail.updateTime)
  171. }}</el-descriptions-item>
  172. </el-descriptions>
  173. <!-- 分割线 -->
  174. <el-divider />
  175. <el-descriptions :column="1" label-class-name="desc-label" direction="vertical" border>
  176. <el-descriptions-item label="回调日志">
  177. <el-table :data="notifyDetail.logs">
  178. <el-table-column label="日志编号" align="center" prop="id" />
  179. <el-table-column label="通知状态" align="center" prop="status">
  180. <template #default="scope">
  181. <dict-tag :type="DICT_TYPE.PAY_NOTIFY_STATUS" :value="scope.row.status" />
  182. </template>
  183. </el-table-column>
  184. <el-table-column label="通知次数" align="center" prop="notifyTimes" />
  185. <el-table-column label="通知时间" align="center" prop="lastExecuteTime" width="180">
  186. <template #default="scope">
  187. <span>{{ formatDate(scope.row.createTime) }}</span>
  188. </template>
  189. </el-table-column>
  190. <el-table-column label="响应结果" align="center" prop="response" />
  191. </el-table>
  192. </el-descriptions-item>
  193. </el-descriptions>
  194. </el-dialog>
  195. </template>
  196. <script lang="ts" setup name="PayNotify">
  197. import { getNotifyTaskPage, getNotifyTaskDetail } from '@/api/pay/notify'
  198. import { getAppList } from '@/api/pay/app'
  199. import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
  200. import { dateFormatter, formatDate } from '@/utils/formatTime'
  201. // 遮罩层
  202. const loading = ref(true)
  203. // 显示搜索条件
  204. const showSearch = ref(true)
  205. // 总条数
  206. const total = ref(0)
  207. // 支付通知列表
  208. const list = ref([])
  209. // 是否显示弹出层
  210. const open = ref(false)
  211. // 查询参数
  212. const queryParams = ref({
  213. pageNo: 1,
  214. pageSize: 10,
  215. appId: null,
  216. type: null,
  217. dataId: null,
  218. status: null,
  219. merchantOrderId: null,
  220. createTime: []
  221. })
  222. // 支付应用列表集合
  223. const appList = ref([])
  224. // 通知详情
  225. const notifyDetail = ref<any>({
  226. logs: []
  227. })
  228. const queryFormRef = ref()
  229. onMounted(async () => {
  230. await getList()
  231. // 获得筛选项
  232. const data = await getAppList()
  233. appList.value = data
  234. })
  235. /** 查询列表 */
  236. const getList = async () => {
  237. loading.value = true
  238. // 执行查询
  239. const data = await getNotifyTaskPage(queryParams.value)
  240. list.value = data.list
  241. total.value = data.total
  242. loading.value = false
  243. }
  244. /** 搜索按钮操作 */
  245. const handleQuery = () => {
  246. queryParams.value.pageNo = 1
  247. getList()
  248. }
  249. /** 重置按钮操作 */
  250. const resetQuery = () => {
  251. queryFormRef.value?.resetFields()
  252. handleQuery()
  253. }
  254. /** 详情按钮操作 */
  255. const handleDetail = async (row: any) => {
  256. notifyDetail.value = {}
  257. const data = await getNotifyTaskDetail(row.id)
  258. // 设置值
  259. notifyDetail.value = data
  260. // 弹窗打开
  261. open.value = true
  262. }
  263. </script>