Feat:订单退款,礼品下单

This commit is contained in:
linxi
2025-10-21 17:51:40 +08:00
parent 64db7b8cd4
commit bf4861f088
7 changed files with 328 additions and 131 deletions
+43 -11
View File
@@ -55,12 +55,13 @@
</template>
<script>
import { sojoumOrderRefundInfo, sojoumOrderRefund } from '@/api/sojoumOrder.js'
export default {
data() {
return {
refundAmount: 3500.0,
orderAmount: 3888,
deductionAmount: 388.8,
refundAmount: '',
orderAmount: '',
deductionAmount: '',
refundReasons: [
'行程变更',
'定错时间/地址',
@@ -70,24 +71,55 @@ export default {
'其他'
],
selectedReason: '',
otherReason: ''
otherReason: '',
key: ''
}
},
onLoad(opts) {
this.key = opts.id
this.getRefundInfo(opts.id)
},
methods: {
getRefundInfo(id) {
sojoumOrderRefundInfo({
orderId: id
}).then(res => {
if (res.status === 200) {
this.refundAmount = res.data.refundPrice
this.orderAmount = res.data.payPrice
this.deductionAmount = res.data.penalty
}
})
},
selectReason(reason) {
this.selectedReason = reason
},
submitRefund() {
// TODO: 实现退款提交逻辑
// orderId string 订单号
// refundReasonWap string 选择的退款原因
// refundReasonWapExplain string 退款原因说明(其他个人原因)
const refundData = {
amount: this.refundAmount,
reason: this.selectedReason,
otherReason: this.otherReason
orderId: this.key,
refundReasonWap: this.selectedReason,
refundReasonWapExplain: this.otherReason
}
console.log('提交退款申请:', refundData)
uni.showToast({
title: '退款申请已提交',
icon: 'success'
uni.showLoading({
title: '加载中...',
mask: true,
})
sojoumOrderRefund(refundData).then(res => {
if (res.status === 200) {
uni.showToast({
title: '退款申请已提交',
icon: 'success'
})
uni.navigateBack({
url: '/pkg_product/views/sojoumOrderDetails?id=' + this.key
})
}
}).finally(() => {
uni.hideLoading();
})
}
}