| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322 |
- <template>
- <view class="detail-container">
- <!-- 状态卡片 -->
- <view class="status-card">
- <text class="status-text" :style="{ color: statusColor }">{{ fmtDictName('RefundLog.status', detail.status) }}</text>
- <text class="status-amount">¥{{ formatAmount(detail.refund) }}</text>
- <text class="status-label">退款金额</text>
- <button v-if="detail.status === 'NEW'" class="process-btn" :loading="processing" @click="handleProcessRefund">退款处理</button>
- </view>
- <!-- 退款信息 -->
- <view class="section">
- <view class="section-title">退款信息</view>
- <view class="info-card">
- <view class="info-row" @click="showFullText('商户退款单号', detail.outRefundNo)">
- <text class="info-label">商户退款单号</text>
- <text class="info-value">{{ detail.outRefundNo || '-' }}</text>
- </view>
- <view class="info-row" @click="showFullText('商户订单号', detail.outTradeNo)">
- <text class="info-label">商户订单号</text>
- <text class="info-value">{{ detail.outTradeNo || '-' }}</text>
- </view>
- <view class="info-row" @click="showFullText('微信支付订单号', detail.transactionId)">
- <text class="info-label">微信支付订单号</text>
- <text class="info-value">{{ detail.transactionId || '-' }}</text>
- </view>
- <view class="info-row" @click="showFullText('微信退款单号', detail.refundId)">
- <text class="info-label">微信退款单号</text>
- <text class="info-value">{{ detail.refundId || '-' }}</text>
- </view>
- <view class="info-row">
- <text class="info-label">退款原因</text>
- <text class="info-value info-value-wrap">{{ detail.reason || '-' }}</text>
- </view>
- <view class="info-row">
- <text class="info-label">退款渠道</text>
- <text class="info-value">{{ detail.channel || '-' }}</text>
- </view>
- <view class="info-row">
- <text class="info-label">退款入账账户</text>
- <text class="info-value">{{ detail.userReceivedAccount || '-' }}</text>
- </view>
- <view class="info-row">
- <text class="info-label">资金账户</text>
- <text class="info-value">{{ detail.fundsAccount || '-' }}</text>
- </view>
- </view>
- </view>
- <!-- 金额信息 -->
- <view class="section">
- <view class="section-title">金额明细</view>
- <view class="info-card">
- <view class="info-row">
- <text class="info-label">原充值金额</text>
- <text class="info-value amount">¥{{ formatAmount(detail.total) }}</text>
- </view>
- <view class="info-row">
- <text class="info-label">退款金额</text>
- <text class="info-value amount-refund">¥{{ formatAmount(detail.refund) }}</text>
- </view>
- <view class="info-row">
- <text class="info-label">不可退优惠金额</text>
- <text class="info-value">{{ formatAmount(detail.discountAmount) }}</text>
- </view>
- <view class="info-row">
- <text class="info-label">币种</text>
- <text class="info-value">{{ detail.currency || 'CNY' }}</text>
- </view>
- </view>
- </view>
- <!-- 操作信息 -->
- <view class="section">
- <view class="section-title">操作信息</view>
- <view class="info-card">
- <view class="info-row">
- <text class="info-label">退款人</text>
- <text class="info-value">{{ detail.adminUsername || '-' }}</text>
- </view>
- <view class="info-row">
- <text class="info-label">申请时间</text>
- <text class="info-value">{{ formatTime(detail.createTime) }}</text>
- </view>
- <view class="info-row">
- <text class="info-label">退款成功时间</text>
- <text class="info-value">{{ detail.successTime ? formatTime(detail.successTime) : '-' }}</text>
- </view>
- <view class="info-row">
- <text class="info-label">更新时间</text>
- <text class="info-value">{{ detail.updateTime ? formatTime(detail.updateTime) : '-' }}</text>
- </view>
- </view>
- </view>
- <!-- 加载状态 -->
- <view class="loading-state" v-if="loading">
- <view class="loading-spinner"></view>
- <text class="loading-text">加载中...</text>
- </view>
- </view>
- </template>
- <script setup>
- import { ref, onMounted, computed } from 'vue'
- import { onLoad } from '@dcloudio/uni-app'
- import { getRefundDetail, processRefund } from '../../api/finance.js'
- import { formatTime, showToast, formatAmount, fmtDictName, getDictColor } from '../../utils/index.js'
- import { loadDicts } from '../../utils/dict.js'
- const detail = ref({})
- const loading = ref(true)
- const processing = ref(false)
- const statusColor = computed(() => {
- return getDictColor('RefundLog.status', detail.value.status) || '#666666'
- })
- const showFullText = (label, value) => {
- if (!value) return
- uni.showModal({
- title: label,
- content: value,
- showCancel: false,
- confirmText: '关闭'
- })
- }
- const handleProcessRefund = () => {
- const refundLogId = detail.value.id
- if (!refundLogId) {
- showToast('退款记录ID不存在')
- return
- }
- uni.showModal({
- title: '确认退款',
- content: `确定对该笔退款进行处理吗?`,
- success: async (res) => {
- if (res.confirm) {
- processing.value = true
- try {
- const result = await processRefund(refundLogId)
- if (result && result.code === 200) {
- showToast('退款处理成功', 'success')
- loadDetail(detail.value.outRefundNo)
- } else {
- showToast(result?.msg || '退款处理失败')
- }
- } catch (error) {
- showToast('退款处理失败')
- } finally {
- processing.value = false
- }
- }
- }
- })
- }
- const loadDetail = async (outRefundNo) => {
- loading.value = true
- try {
- const res = await getRefundDetail(outRefundNo)
- if (res && res.code === 200) {
- detail.value = res.data || {}
- } else {
- showToast(res?.msg || '加载退款详情失败')
- }
- } catch (error) {
- showToast('加载退款详情失败')
- } finally {
- loading.value = false
- }
- }
- onLoad((options) => {
- if (options && options.outRefundNo) {
- loadDetail(options.outRefundNo)
- }
- })
- onMounted(async () => {
- await loadDicts()
- })
- </script>
- <style scoped>
- .detail-container {
- min-height: 100vh;
- background-color: #F5F7FA;
- padding-bottom: 40rpx;
- }
- .status-card {
- display: flex;
- flex-direction: column;
- align-items: center;
- padding: 48rpx 30rpx;
- background-color: #FFFFFF;
- margin-bottom: 20rpx;
- }
- .status-text {
- font-size: 32rpx;
- font-weight: 600;
- margin-bottom: 16rpx;
- }
- .status-amount {
- font-size: 56rpx;
- font-weight: 700;
- color: #1A1A1A;
- margin-bottom: 8rpx;
- }
- .status-label {
- font-size: 24rpx;
- color: #999999;
- margin-bottom: 24rpx;
- }
- .process-btn {
- padding: 16rpx 60rpx;
- background: #C6171E;
- color: #FFFFFF;
- border-radius: 44rpx;
- font-size: 28rpx;
- border: none;
- font-weight: 500;
- }
- .process-btn:active {
- background: #A81212;
- transform: scale(0.97);
- }
- .section {
- padding: 0 20rpx;
- margin-bottom: 20rpx;
- }
- .section-title {
- font-size: 26rpx;
- color: #999999;
- padding: 16rpx 10rpx 12rpx;
- }
- .info-card {
- background-color: #FFFFFF;
- border-radius: 24rpx;
- padding: 8rpx 24rpx;
- box-shadow: 0 1px 3px rgba(0,0,0,0.06);
- }
- .info-row {
- display: flex;
- justify-content: space-between;
- align-items: center;
- padding: 20rpx 0;
- border-bottom: 1rpx solid #F5F5F5;
- }
- .info-row:last-child {
- border-bottom: none;
- }
- .info-label {
- font-size: 26rpx;
- color: #999999;
- flex-shrink: 0;
- }
- .info-value {
- font-size: 26rpx;
- color: #1A1A1A;
- max-width: 420rpx;
- text-align: right;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
- .info-value-wrap {
- white-space: normal;
- word-break: break-all;
- text-overflow: clip;
- }
- .info-value.amount {
- color: #C6171E;
- font-weight: 500;
- }
- .info-value.amount-refund {
- color: #52C41A;
- font-weight: 500;
- }
- .loading-state {
- display: flex;
- flex-direction: column;
- align-items: center;
- padding: 80rpx 0;
- }
- .loading-spinner {
- width: 60rpx;
- height: 60rpx;
- border: 4rpx solid rgba(0, 0, 0, 0.1);
- border-top-color: #C6171E;
- border-radius: 50%;
- animation: spin 0.8s linear infinite;
- }
- @keyframes spin {
- to { transform: rotate(360deg); }
- }
- .loading-text {
- font-size: 28rpx;
- color: #999999;
- margin-top: 16rpx;
- }
- </style>
|