fix: 支付管理/退款订单 对标 vue2

This commit is contained in:
dhb52 2023-08-13 01:26:59 +08:00
parent 19cad3b873
commit 620a2009c3
4 changed files with 167 additions and 225 deletions

View File

@ -131,12 +131,8 @@ export enum DICT_TYPE {
// ========== PAY 模块 ==========
PAY_CHANNEL_CODE = 'pay_channel_code', // 支付渠道编码类型
PAY_CHANNEL_CODE_TYPE = 'pay_channel_code_type', // 支付渠道编码类型
PAY_ORDER_STATUS = 'pay_order_status', // 商户支付订单状态
PAY_ORDER_REFUND_STATUS = 'pay_order_refund_status', // 商户支付订单退款状态
PAY_REFUND_ORDER_STATUS = 'pay_refund_order_status', // 退款订单状态
PAY_REFUND_ORDER_TYPE = 'pay_refund_order_type', // 退款订单类别
PAY_REFUND_STATUS = 'pay_refund_status', // 退款订单状态
PAY_NOTIFY_STATUS = 'pay_notify_status', // 商户支付回调状态
PAY_NOTIFY_TYPE = 'pay_notify_type', // 商户支付回调状态

View File

@ -326,7 +326,6 @@ const queryParams = reactive({
createTime: []
})
const queryFormRef = ref() //
const exportLoading = ref(false) //
/** 查询列表 */
const getList = async () => {

View File

@ -1,86 +1,81 @@
<template>
<Dialog v-model="dialogVisible" title="详情" width="50%">
<el-descriptions :column="2">
<el-descriptions-item label="商户名称">{{ detailData.merchantName }}</el-descriptions-item>
<el-descriptions-item label="应用名称">{{ detailData.appName }}</el-descriptions-item>
<el-descriptions-item label="商品名称">{{ detailData.subject }}</el-descriptions-item>
</el-descriptions>
<el-divider />
<el-descriptions :column="2">
<Dialog v-model="dialogVisible" title="详情" width="700px">
<el-descriptions :column="2" label-class-name="desc-label">
<el-descriptions-item label="商户退款单号">
<el-tag>{{ detailData.merchantRefundNo }}</el-tag>
</el-descriptions-item>
<el-descriptions-item label="商户订单号">
{{ detailData.merchantOrderId }}
</el-descriptions-item>
<el-descriptions-item label="交易订单号">{{ detailData.tradeNo }}</el-descriptions-item>
</el-descriptions>
<el-divider />
<el-descriptions :column="2">
<el-descriptions-item label="支付金额">
<el-tag type="success">{{ parseFloat(detailData.payAmount / 100, 2).toFixed(2) }}</el-tag>
</el-descriptions-item>
<el-descriptions-item label="退款金额">
<el-tag class="tag-purple">
{{ parseFloat(detailData.refundAmount / 100).toFixed(2) }}
</el-tag>
</el-descriptions-item>
<el-descriptions-item label="退款类型">
<dict-tag :type="DICT_TYPE.PAY_REFUND_ORDER_TYPE" :value="detailData.type" />
</el-descriptions-item>
<el-descriptions-item label="退款状态">
<dict-tag :type="DICT_TYPE.PAY_REFUND_ORDER_STATUS" :value="detailData.status" />
</el-descriptions-item>
<el-descriptions-item label="创建时间">
{{ formatDate(detailData.createTime) }}
</el-descriptions-item>
<el-descriptions-item label="退款成功时间">
{{ formatDate(detailData.successTime) }}
</el-descriptions-item>
<el-descriptions-item label="退款失效时间">
{{ formatDate(detailData.expireTime) }}
</el-descriptions-item>
<el-descriptions-item label="更新时间">
{{ formatDate(detailData.updateTime) }}
</el-descriptions-item>
</el-descriptions>
<el-divider />
<el-descriptions :column="2">
<el-descriptions-item label="支付渠道">
{{ detailData.channelCodeName }}
</el-descriptions-item>
<el-descriptions-item label="支付 IP">
{{ detailData.userIp }}
</el-descriptions-item>
<el-descriptions-item label="回调地址">{{ detailData.notifyUrl }}</el-descriptions-item>
<el-descriptions-item label="回调状态">
<dict-tag :type="DICT_TYPE.PAY_ORDER_NOTIFY_STATUS" :value="detailData.notifyStatus" />
</el-descriptions-item>
<el-descriptions-item label="回调时间">
{{ formatDate(detailData.notifyTime) }}
</el-descriptions-item>
</el-descriptions>
<el-divider />
<el-descriptions :column="2">
<el-descriptions-item label="渠道订单号">
{{ detailData.channelOrderNo }}
<el-tag size="small">{{ refundDetail.merchantRefundId }}</el-tag>
</el-descriptions-item>
<el-descriptions-item label="渠道退款单号">
{{ detailData.channelRefundNo }}
</el-descriptions-item>
<el-descriptions-item label="渠道错误码">
{{ detailData.channelErrorCode }}
</el-descriptions-item>
<el-descriptions-item label="渠道错误码描述">
{{ detailData.channelErrorMsg }}
<el-tag type="success" size="small" v-if="refundDetail.channelRefundNo">{{
refundDetail.channelRefundNo
}}</el-tag>
</el-descriptions-item>
</el-descriptions>
<br />
<el-descriptions :column="1" border direction="vertical">
<el-descriptions-item label="渠道额外参数">
{{ detailData.channelExtras }}
<el-descriptions :column="2" label-class-name="desc-label">
<el-descriptions-item label="商户支付单号">
<el-tag size="small">{{ refundDetail.merchantOrderId }}</el-tag>
</el-descriptions-item>
<el-descriptions-item label="渠道支付单号">
<el-tag type="success" size="small">{{ refundDetail.channelOrderNo }}</el-tag>
</el-descriptions-item>
</el-descriptions>
<el-descriptions :column="2" label-class-name="desc-label">
<el-descriptions-item label="应用编号">{{ refundDetail.appId }}</el-descriptions-item>
<el-descriptions-item label="应用名称">{{ refundDetail.appName }}</el-descriptions-item>
</el-descriptions>
<el-descriptions :column="2" label-class-name="desc-label">
<el-descriptions-item label="支付金额">
<el-tag type="success" size="small"
>{{ (refundDetail.payPrice / 100.0).toFixed(2) }}</el-tag
>
</el-descriptions-item>
<el-descriptions-item label="退款金额">
<el-tag size="mini" type="danger"
>{{ (refundDetail.refundPrice / 100.0).toFixed(2) }}</el-tag
>
</el-descriptions-item>
</el-descriptions>
<el-descriptions :column="2" label-class-name="desc-label">
<el-descriptions-item label="退款状态">
<dict-tag :type="DICT_TYPE.PAY_REFUND_STATUS" :value="refundDetail.status" />
</el-descriptions-item>
<el-descriptions-item label="退款时间">{{
formatDate(refundDetail.successTime)
}}</el-descriptions-item>
</el-descriptions>
<el-descriptions :column="2" label-class-name="desc-label">
<el-descriptions-item label="创建时间">{{
formatDate(refundDetail.createTime)
}}</el-descriptions-item>
<el-descriptions-item label="更新时间">{{
formatDate(refundDetail.updateTime)
}}</el-descriptions-item>
</el-descriptions>
<!-- 分割线 -->
<el-divider />
<el-descriptions :column="2" label-class-name="desc-label">
<el-descriptions-item label="退款渠道">
<dict-tag :type="DICT_TYPE.PAY_CHANNEL_CODE" :value="refundDetail.channelCode" />
</el-descriptions-item>
<el-descriptions-item label="退款原因">{{ refundDetail.reason }}</el-descriptions-item>
</el-descriptions>
<el-descriptions :column="2" label-class-name="desc-label">
<el-descriptions-item label="退款 IP">{{ refundDetail.userIp }}</el-descriptions-item>
<el-descriptions-item label="通知 URL">{{ refundDetail.notifyUrl }}</el-descriptions-item>
</el-descriptions>
<!-- 分割线 -->
<el-divider />
<el-descriptions :column="2" label-class-name="desc-label">
<el-descriptions-item label="渠道错误码">{{
refundDetail.channelErrorCode
}}</el-descriptions-item>
<el-descriptions-item label="渠道错误码描述">{{
refundDetail.channelErrorMsg
}}</el-descriptions-item>
</el-descriptions>
<el-descriptions :column="1" label-class-name="desc-label" direction="vertical" border>
<el-descriptions-item label="支付通道异步回调内容">
{{ refundDetail.channelNotifyData }}
</el-descriptions-item>
<el-descriptions-item label="退款原因">{{ detailData.reason }}</el-descriptions-item>
</el-descriptions>
</Dialog>
</template>
@ -93,7 +88,7 @@ defineOptions({ name: 'PayRefundDetail' })
const dialogVisible = ref(false) //
const detailLoading = ref(false) //
const detailData = ref({})
const refundDetail = ref({})
/** 打开弹窗 */
const open = async (id: number) => {
@ -101,7 +96,7 @@ const open = async (id: number) => {
//
detailLoading.value = true
try {
detailData.value = await RefundApi.getRefund(id)
refundDetail.value = await RefundApi.getRefund(id)
} finally {
detailLoading.value = false
}

View File

@ -10,21 +10,6 @@
:inline="true"
label-width="120px"
>
<el-form-item label="所属商户" prop="merchantId">
<el-select
v-model="queryParams.merchantId"
clearable
placeholder="请选择所属商户"
class="!w-240px"
>
<el-option
v-for="item in merchantList"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item>
<el-form-item label="应用编号" prop="appId">
<el-select
v-model="queryParams.appId"
@ -35,40 +20,52 @@
<el-option v-for="item in appList" :key="item.id" :label="item.name" :value="item.id" />
</el-select>
</el-form-item>
<el-form-item label="渠道编码" prop="channelCode">
<el-form-item label="退款渠道" prop="channelCode">
<el-select
v-model="queryParams.channelCode"
placeholder="请输入渠道编码"
placeholder="请选择退款渠道"
clearable
class="!w-240px"
>
<el-option
v-for="dict in getStrDictOptions(DICT_TYPE.PAY_CHANNEL_CODE_TYPE)"
v-for="dict in getStrDictOptions(DICT_TYPE.PAY_CHANNEL_CODE)"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="退款类型" prop="type">
<el-select
v-model="queryParams.type"
placeholder="请选择退款类型"
clearable
class="!w-240px"
>
<el-option
v-for="dict in getIntDictOptions(DICT_TYPE.PAY_REFUND_ORDER_TYPE)"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="商户退款订单号" prop="merchantRefundNo">
<el-form-item label="商户支付单号" prop="merchantOrderId">
<el-input
v-model="queryParams.merchantRefundNo"
placeholder="请输入商户退款订单号"
v-model="queryParams.merchantOrderId"
placeholder="请输入商户支付单号"
clearable
@keyup.enter="handleQuery"
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="channelOrderNo">
<el-input
v-model="queryParams.channelOrderNo"
placeholder="请输入渠道支付单号"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item>
<el-form-item label="渠道退款单号" prop="channelRefundNo">
<el-input
v-model="queryParams.channelRefundNo"
placeholder="请输入渠道退款单号"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
@ -82,22 +79,7 @@
class="!w-240px"
>
<el-option
v-for="dict in getIntDictOptions(DICT_TYPE.PAY_REFUND_ORDER_STATUS)"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="退款回调状态" prop="notifyStatus">
<el-select
v-model="queryParams.notifyStatus"
placeholder="请选择通知商户退款结果的回调状态"
clearable
class="!w-240px"
>
<el-option
v-for="dict in getIntDictOptions(DICT_TYPE.PAY_ORDER_NOTIFY_STATUS)"
v-for="dict in getIntDictOptions(DICT_TYPE.PAY_REFUND_STATUS)"
:key="dict.value"
:label="dict.label"
:value="dict.value"
@ -134,67 +116,6 @@
<ContentWrap>
<el-table v-loading="loading" :data="list">
<el-table-column label="编号" align="center" prop="id" />
<el-table-column label="商户名称" align="center" prop="merchantName" width="120" />
<el-table-column label="应用名称" align="center" prop="appName" width="120" />
<el-table-column label="渠道名称" align="center" prop="channelCodeName" width="120" />
<el-table-column label="交易订单号" align="center" prop="tradeNo" width="140" />
<el-table-column label="商户订单编号" align="center" prop="merchantOrderId" width="140" />
<el-table-column label="商户订单号" align="left" width="230">
<template #default="scope">
<p class="order-font">
<el-tag>退款</el-tag>
{{ scope.row.merchantRefundNo }}
</p>
<p class="order-font">
<el-tag type="success">交易</el-tag>
{{ scope.row.merchantOrderId }}
</p>
</template>
</el-table-column>
<el-table-column label="支付订单号" align="center" prop="merchantRefundNo" width="250">
<template #default="scope">
<p class="order-font">
<el-tag>交易</el-tag>
{{ scope.row.tradeNo }}
</p>
<p class="order-font">
<el-tag type="warning">渠道</el-tag>
{{ scope.row.channelOrderNo }}
</p>
</template>
</el-table-column>
<el-table-column label="支付金额(元)" align="center" prop="payAmount" width="100">
<template #default="scope">
{{ parseFloat(scope.row.payAmount / 100).toFixed(2) }}
</template>
</el-table-column>
<el-table-column label="退款金额(元)" align="center" prop="refundAmount" width="100">
<template #default="scope">
{{ parseFloat(scope.row.refundAmount / 100).toFixed(2) }}
</template>
</el-table-column>
<el-table-column label="退款类型" align="center" prop="type" width="80">
<template #default="scope">
<dict-tag :type="DICT_TYPE.PAY_REFUND_ORDER_TYPE" :value="scope.row.type" />
</template>
</el-table-column>
<el-table-column label="退款状态" align="center" prop="status">
<template #default="scope">
<dict-tag :type="DICT_TYPE.PAY_REFUND_ORDER_STATUS" :value="scope.row.status" />
</template>
</el-table-column>
<el-table-column label="回调状态" align="center" prop="notifyStatus">
<template #default="scope">
<dict-tag :type="DICT_TYPE.PAY_ORDER_NOTIFY_STATUS" :value="scope.row.notifyStatus" />
</template>
</el-table-column>
<el-table-column
label="退款原因"
align="center"
prop="reason"
width="140"
:show-overflow-tooltip="true"
/>
<el-table-column
label="创建时间"
align="center"
@ -202,13 +123,61 @@
width="180"
:formatter="dateFormatter"
/>
<el-table-column label="支付金额" align="center" prop="payPrice" width="100">
<template #default="scope">
{{ parseFloat(scope.row.payPrice / 100).toFixed(2) }}
</template>
</el-table-column>
<el-table-column label="退款金额" align="center" prop="refundPrice" width="100">
<template #default="scope">
{{ parseFloat(scope.row.refundPrice / 100).toFixed(2) }}
</template>
</el-table-column>
<el-table-column label="退款订单号" align="left" width="300">
<template #default="scope">
<p class="order-font">
<el-tag size="small">商户</el-tag> {{ scope.row.merchantRefundId }}
</p>
<p class="order-font">
<el-tag size="small" type="warning">退款</el-tag> {{ scope.row.no }}
</p>
<p class="order-font" v-if="scope.row.channelRefundNo">
<el-tag size="small" type="success">渠道</el-tag> {{ scope.row.channelRefundNo }}
</p>
</template>
</el-table-column>
<el-table-column label="支付订单号" align="left" width="300">
<template #default="scope">
<p class="order-font">
<el-tag size="small">商户</el-tag> {{ scope.row.merchantOrderId }}
</p>
<p class="order-font">
<el-tag size="small" type="success">渠道</el-tag> {{ scope.row.channelOrderNo }}
</p>
</template>
</el-table-column>
<el-table-column label="退款状态" align="center" prop="status">
<template #default="scope">
<dict-tag :type="DICT_TYPE.PAY_REFUND_STATUS" :value="scope.row.status" />
</template>
</el-table-column>
<el-table-column label="退款渠道" align="center" width="140">
<template #default="scope">
<dict-tag :type="DICT_TYPE.PAY_CHANNEL_CODE" :value="scope.row.channelCode" />
</template>
</el-table-column>
<el-table-column
label="退款成功时间"
label="成功时间"
align="center"
prop="successTime"
width="180"
:formatter="dateFormatter"
/>
<el-table-column label="支付应用" align="center" prop="successTime" width="100">
<template #default="scope">
<span>{{ scope.row.appName }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" fixed="right">
<template #default="scope">
<el-button
@ -237,8 +206,8 @@
<script lang="ts" setup>
import { DICT_TYPE, getIntDictOptions, getStrDictOptions } from '@/utils/dict'
import { dateFormatter } from '@/utils/formatTime'
// import * as MerchantApi from '@/api/pay/merchant'
import * as RefundApi from '@/api/pay/refund'
import * as AppApi from '@/api/pay/app'
import RefundDetail from './RefundDetail.vue'
import download from '@/utils/download'
@ -254,34 +223,20 @@ const queryParams = reactive({
pageSize: 10,
merchantId: undefined,
appId: undefined,
channelId: undefined,
channelCode: undefined,
orderId: undefined,
tradeNo: undefined,
merchantOrderId: undefined,
merchantRefundNo: undefined,
notifyUrl: undefined,
notifyStatus: undefined,
merchantRefundId: undefined,
status: undefined,
type: undefined,
payAmount: undefined,
refundAmount: undefined,
reason: undefined,
userIp: undefined,
payPrice: undefined,
refundPrice: undefined,
channelOrderNo: undefined,
channelRefundNo: undefined,
channelErrorCode: undefined,
channelErrorMsg: undefined,
channelExtras: undefined,
expireTime: [],
successTime: [],
notifyTime: [],
createTime: []
createTime: [],
successTime: []
})
const queryFormRef = ref() //
const exportLoading = ref(false) //
const appList = ref([]) //
const merchantList = ref([]) //
/** 搜索按钮操作 */
const handleQuery = () => {
@ -303,7 +258,7 @@ const getList = async () => {
/** 重置按钮操作 */
const resetQuery = () => {
queryFormRef.value.resetFields()
queryFormRef.value?.resetFields()
handleQuery()
}
@ -331,10 +286,7 @@ const openDetail = (id: number) => {
/** 初始化 **/
onMounted(async () => {
await getList()
//
// merchantList.value = await MerchantApi.getMerchantListByName()
// TODO
// appList.value = await AppApi.getAppListByMerchantId()
appList.value = await AppApi.getAppList()
})
</script>