consumer模块完成度95%,准备部署消费者端测试
This commit is contained in:
@@ -1,14 +1,14 @@
|
||||
<template>
|
||||
<template>
|
||||
<view class="apply-refund-page">
|
||||
<view class="section">
|
||||
<view class="section-title">退款类型</view>
|
||||
<radio-group @change="handleTypeChange" class="type-group">
|
||||
<label class="type-item">
|
||||
<radio value="1" :checked="refundType === 1" color="#ff4444" class="type-radio" />
|
||||
<radio value="1" :checked="refundType === 1" color="#ff5000" class="type-radio" />
|
||||
<text>仅退款</text>
|
||||
</label>
|
||||
<label class="type-item">
|
||||
<radio value="2" :checked="refundType === 2" color="#ff4444" class="type-radio" />
|
||||
<radio value="2" :checked="refundType === 2" color="#ff5000" class="type-radio" />
|
||||
<text>退货退款</text>
|
||||
</label>
|
||||
</radio-group>
|
||||
@@ -133,20 +133,29 @@ const handleReasonChange = (e: any) => {
|
||||
}
|
||||
|
||||
const submitRefund = async () => {
|
||||
console.log('=== 提交退款 ===')
|
||||
console.log('refundReason:', refundReason.value)
|
||||
console.log('refundAmount:', refundAmount.value)
|
||||
console.log('maxAmount:', maxAmount.value)
|
||||
|
||||
if (refundReason.value == '') {
|
||||
uni.showToast({ title: '请选择退款原因', icon: 'none' })
|
||||
return
|
||||
}
|
||||
|
||||
const amount = parseFloat(refundAmount.value)
|
||||
console.log('解析后金额:', amount)
|
||||
|
||||
if (isNaN(amount) || amount <= 0 || amount > maxAmount.value) {
|
||||
uni.showToast({ title: '请输入有效的退款金额', icon: 'none' })
|
||||
return
|
||||
}
|
||||
|
||||
submitting.value = true
|
||||
uni.showLoading({ title: '提交中...' })
|
||||
|
||||
try {
|
||||
console.log('调用 createRefund, orderId:', orderId.value)
|
||||
const result = await supabaseService.createRefund({
|
||||
order_id: orderId.value,
|
||||
refund_type: refundType.value,
|
||||
@@ -155,13 +164,13 @@ const submitRefund = async () => {
|
||||
description: description.value
|
||||
})
|
||||
|
||||
console.log('createRefund 结果:', JSON.stringify(result))
|
||||
uni.hideLoading()
|
||||
|
||||
if (result.success) {
|
||||
uni.showToast({ title: '提交成功', icon: 'success' })
|
||||
|
||||
setTimeout(() => {
|
||||
// Go back to orders listing focused on refund type?
|
||||
// or stay here? User probably wants to see list.
|
||||
// Since profile redirects "Refunds" to orders list, let's go there.
|
||||
uni.navigateBack()
|
||||
}, 1500)
|
||||
} else {
|
||||
@@ -169,6 +178,7 @@ const submitRefund = async () => {
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('提交退款失败', err)
|
||||
uni.hideLoading()
|
||||
uni.showToast({ title: '提交异常', icon: 'none' })
|
||||
} finally {
|
||||
submitting.value = false
|
||||
@@ -278,10 +288,11 @@ const submitRefund = async () => {
|
||||
}
|
||||
|
||||
.submit-btn {
|
||||
background-color: #ff4444;
|
||||
background-color: #ff5000;
|
||||
color: #ffffff;
|
||||
border-radius: 22px;
|
||||
font-size: 16px;
|
||||
font-weight: bold;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user