|
|
@@ -5,6 +5,7 @@
|
|
|
<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>
|
|
|
|
|
|
<!-- 退款信息 -->
|
|
|
@@ -103,12 +104,13 @@
|
|
|
<script setup>
|
|
|
import { ref, onMounted, computed } from 'vue'
|
|
|
import { onLoad } from '@dcloudio/uni-app'
|
|
|
-import { getRefundDetail } from '../../api/finance.js'
|
|
|
+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'
|
|
|
@@ -124,6 +126,36 @@ const showFullText = (label, value) => {
|
|
|
})
|
|
|
}
|
|
|
|
|
|
+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 {
|
|
|
@@ -183,6 +215,21 @@ onMounted(async () => {
|
|
|
.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 {
|