Просмотр исходного кода

feat:【PAY 支付】转账单,支持导出功能

YunaiV 9 месяцев назад
Родитель
Сommit
876bf8def6

+ 6 - 13
src/api/pay/transfer/index.ts

@@ -1,23 +1,16 @@
 import request from '@/config/axios'
 
-// TODO @芋艿:调整字段
-export interface TransferVO {
-  appId: number
-  channelCode: string
-  merchantTransferId: string
-  type: number
-  price: number
-  subject: string
-  userName: string
-  alipayLogonId: string
-  openid: string
-}
-
 // 查询转账单列表
 export const getTransferPage = async (params: PageParam) => {
   return await request.get({ url: `/pay/transfer/page`, params })
 }
 
+// 查询转账单详情
 export const getTransfer = async (id: number) => {
   return await request.get({ url: '/pay/transfer/get?id=' + id })
 }
+
+// 导出转账单
+export const exportTransfer = async (params: PageParam) => {
+  return await request.download({ url: '/pay/transfer/export-excel', params })
+}

+ 9 - 3
src/views/pay/notify/NotifyDetail.vue

@@ -1,11 +1,17 @@
 <template>
   <Dialog v-model="dialogVisible" title="通知详情" width="50%">
     <el-descriptions :column="2">
-      <el-descriptions-item label="商户订单编号">
+      <el-descriptions-item label="通知状态" :span="2">
+        <dict-tag :type="DICT_TYPE.PAY_NOTIFY_STATUS" :value="detailData.status" />
+      </el-descriptions-item>
+      <el-descriptions-item label="商户订单编号" :span="2">
         <el-tag>{{ detailData.merchantOrderId }}</el-tag>
       </el-descriptions-item>
-      <el-descriptions-item label="通知状态">
-        <dict-tag :type="DICT_TYPE.PAY_NOTIFY_STATUS" :value="detailData.status" />
+      <el-descriptions-item label="商户退款编号" :span="2" v-if="detailData.merchantRefundId">
+        <el-tag>{{ detailData.merchantRefundId }}</el-tag>
+      </el-descriptions-item>
+      <el-descriptions-item label="商户转账编号" :span="2" v-if="detailData.merchantTransferId">
+        <el-tag>{{ detailData.merchantTransferId }}</el-tag>
       </el-descriptions-item>
 
       <el-descriptions-item label="应用编号">{{ detailData.appId }}</el-descriptions-item>

+ 33 - 7
src/views/pay/notify/index.vue

@@ -69,6 +69,24 @@
           class="!w-240px"
         />
       </el-form-item>
+      <el-form-item label="商户退款编号" prop="merchantRefundId">
+        <el-input
+          v-model="queryParams.merchantRefundId"
+          placeholder="请输入商户退款编号"
+          clearable
+          @keyup.enter="handleQuery"
+          class="!w-240px"
+        />
+      </el-form-item>
+      <el-form-item label="商户转账编号" prop="merchantTransferId">
+        <el-input
+          v-model="queryParams.merchantTransferId"
+          placeholder="请输入商户转账编号"
+          clearable
+          @keyup.enter="handleQuery"
+          class="!w-240px"
+        />
+      </el-form-item>
       <el-form-item label="创建时间" prop="createTime">
         <el-date-picker
           v-model="queryParams.createTime"
@@ -94,7 +112,19 @@
     <el-table v-loading="loading" :data="list">
       <el-table-column label="任务编号" align="center" prop="id" />
       <el-table-column label="应用编号" align="center" prop="appName" />
-      <el-table-column label="商户订单编号" align="center" prop="merchantOrderId" />
+      <el-table-column label="商户单信息" align="center" prop="merchant">
+        <template #default="scope">
+          <div v-if="scope.row.merchantOrderId">
+            <div>商户订单编号:{{ scope.row.merchantOrderId }}</div>
+          </div>
+          <div v-if="scope.row.merchantRefundId">
+            <div>商户退款编号:{{ scope.row.merchantRefundId }}</div>
+          </div>
+          <div v-if="scope.row.merchantTransferId">
+            <div>商户转账编号:{{ scope.row.merchantTransferId }}</div>
+          </div>
+        </template>
+      </el-table-column>
       <el-table-column label="通知类型" align="center" prop="type">
         <template #default="scope">
           <dict-tag :type="DICT_TYPE.PAY_NOTIFY_TYPE" :value="scope.row.type" />
@@ -173,16 +203,12 @@ const queryParams = ref({
   dataId: null,
   status: null,
   merchantOrderId: null,
+  merchantRefundId: null,
+  merchantTransferId: null,
   createTime: []
 })
 const queryFormRef = ref() // 搜索的表单
 const appList = ref([]) // 支付应用列表集合
-// 是否显示弹出层
-const open = ref(false)
-// 通知详情
-const notifyDetail = ref<any>({
-  logs: []
-})
 
 /** 搜索按钮操作 */
 const handleQuery = () => {

+ 7 - 7
src/views/pay/transfer/TransferDetail.vue

@@ -25,12 +25,7 @@
     <el-divider />
     <el-descriptions :column="2" label-class-name="desc-label">
       <el-descriptions-item label="收款人姓名">{{ detailData.userName }}</el-descriptions-item>
-      <el-descriptions-item label="支付宝登录账号" v-if="detailData.type === 1">
-        {{ detailData.alipayLogonId }}
-      </el-descriptions-item>
-      <el-descriptions-item label="微信 openid" v-if="detailData.type === 2">
-        {{ detailData.openid }}
-      </el-descriptions-item>
+      <el-descriptions-item label="收款人账号">{{ detailData.userAccount }}</el-descriptions-item>
       <el-descriptions-item label="支付渠道">
         <dict-tag :type="DICT_TYPE.PAY_CHANNEL_CODE" :value="detailData.channelCode" />
       </el-descriptions-item>
@@ -45,7 +40,9 @@
     <el-divider />
     <el-descriptions :column="1" label-class-name="desc-label" direction="vertical" border>
       <el-descriptions-item label="转账渠道通知内容">
-        <el-text>{{ detailData.channelNotifyData }}</el-text>
+        <el-text style="white-space: pre-wrap; word-break: break-word">
+          {{ detailData.channelNotifyData }}
+        </el-text>
       </el-descriptions-item>
     </el-descriptions>
     <el-divider />
@@ -59,10 +56,13 @@
 import { DICT_TYPE } from '@/utils/dict'
 import * as TransferApi from '@/api/pay/transfer'
 import { formatDate } from '@/utils/formatTime'
+
 defineOptions({ name: 'PayTransferDetail' })
+
 const dialogVisible = ref(false) // 弹窗的是否展示
 const detailLoading = ref(false) // 表单的加载中
 const detailData = ref({})
+
 /** 打开弹窗 */
 const open = async (id: number) => {
   dialogVisible.value = true

+ 38 - 22
src/views/pay/transfer/index.vue

@@ -66,7 +66,6 @@
           />
         </el-select>
       </el-form-item>
-
       <el-form-item label="收款人姓名" prop="userName">
         <el-input
           v-model="queryParams.userName"
@@ -76,6 +75,15 @@
           class="!w-240px"
         />
       </el-form-item>
+      <el-form-item label="收款人账号" prop="accountNo">
+        <el-input
+          v-model="queryParams.accountNo"
+          placeholder="请输入收款人账号"
+          clearable
+          @keyup.enter="handleQuery"
+          class="!w-240px"
+        />
+      </el-form-item>
       <el-form-item label="渠道单号" prop="channelTransferNo">
         <el-input
           v-model="queryParams.channelTransferNo"
@@ -99,6 +107,15 @@
       <el-form-item>
         <el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
         <el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
+        <el-button
+          type="success"
+          plain
+          @click="handleExport"
+          :loading="exportLoading"
+          v-hasPermi="['pay:transfer:export']"
+        >
+          <Icon icon="ep:download" class="mr-5px" /> 导出
+        </el-button>
       </el-form-item>
     </el-form>
   </ContentWrap>
@@ -114,12 +131,7 @@
         :formatter="dateFormatter"
         width="180px"
       />
-      <el-table-column label="应用编号" align="center" prop="appId" />
-      <el-table-column label="类型" align="center" prop="type" width="120">
-        <template #default="scope">
-          <dict-tag :type="DICT_TYPE.PAY_TRANSFER_TYPE" :value="scope.row.type" />
-        </template>
-      </el-table-column>
+      <el-table-column label="支付应用" align="center" prop="appName" min-width="100" />
       <el-table-column label="转账金额" align="center" prop="price">
         <template #default="scope">
           <span>¥{{ (scope.row.price / 100.0).toFixed(2) }}</span>
@@ -147,18 +159,7 @@
         </template>
       </el-table-column>
       <el-table-column label="收款人姓名" align="center" prop="userName" width="120" />
-      <el-table-column label="收款账号" align="left" width="200">
-        <template #default="scope">
-          <p class="transfer-font" v-if="scope.row.alipayLogonId">
-            <el-tag size="small">支付宝登录号</el-tag>
-            {{ scope.row.alipayLogonId }}
-          </p>
-          <p class="transfer-font" v-if="scope.row.openid">
-            <el-tag size="small">微信 openId</el-tag>
-            {{ scope.row.openid }}
-          </p>
-        </template>
-      </el-table-column>
+      <el-table-column label="收款账号" align="left" prop="userAccount" width="200" />
       <el-table-column label="转账标题" align="center" prop="subject" width="120" />
       <el-table-column label="转账渠道" align="center" prop="channelCode">
         <template #default="scope">
@@ -194,10 +195,11 @@ import { dateFormatter } from '@/utils/formatTime'
 import * as TransferApi from '@/api/pay/transfer'
 import { DICT_TYPE, getStrDictOptions } from '@/utils/dict'
 import TransferDetail from './TransferDetail.vue'
+import download from '@/utils/download'
+
 defineOptions({ name: 'PayTransfer' })
 
 const message = useMessage() // 消息弹窗
-const { t } = useI18n() // 国际化
 
 const loading = ref(true) // 列表的加载中
 const total = ref(0) // 列表的总页数
@@ -216,8 +218,7 @@ const queryParams = reactive({
   price: null,
   subject: null,
   userName: null,
-  alipayLogonId: null,
-  openid: null,
+  userAccount: null,
   createTime: []
 })
 const queryFormRef = ref() // 搜索的表单
@@ -247,6 +248,21 @@ const resetQuery = () => {
   handleQuery()
 }
 
+/** 导出按钮操作 */
+const handleExport = async () => {
+  try {
+    // 导出的二次确认
+    await message.exportConfirm()
+    // 发起导出
+    exportLoading.value = true
+    const data = await TransferApi.exportTransfer(queryParams)
+    download.excel(data, '转账单.xls')
+  } catch {
+  } finally {
+    exportLoading.value = false
+  }
+}
+
 /** 添加/修改操作 */
 const detailRef = ref()
 const openDetail = (id: number) => {