feat: 新增退款相关功能及状态显示

- 在订单详情页新增退款状态显示,包括"已退款"和"退款中"
- 新增退款目的地页面,用户可查看退款信息
- 更新应用版本号至1.0.58
- 更新依赖edu-core至v1.0.13
- 修改部分组件样式和逻辑,优化用户体验
This commit is contained in:
2026-05-09 11:13:51 +08:00
parent 69aa5cda40
commit de92a851b7
14 changed files with 223 additions and 40 deletions

View File

@@ -2,7 +2,7 @@
<view class="commonPageBox commonDetailPage">
<z-nav-bar title="我的订单" :backState="2000"></z-nav-bar>
<view class="cateList flexbox">
<common-sticky itemStyle="width:20%; height: 68rpx;font-size:24rpx;" :list="ordersTabs" label="name"
<common-sticky itemStyle="height: 68rpx;font-size:24rpx; padding: 0 20rpx;" :list="ordersTabs" label="name"
:currentCateIndex="currentCateIndex" @handleselectCate="ordersTabCLi"></common-sticky>
</view>
@@ -42,6 +42,8 @@
<text class="orderstatus" v-show="slotProps.row.orderStatus == 3">交易成功</text>
<text class="orderstatus" v-show="slotProps.row.orderStatus == 4">交易失败</text>
<text class="orderstatus" v-show="slotProps.row.orderStatus == 5">已过期</text>
<text class="orderstatus" v-show="slotProps.row.orderStatus == 6">已退款</text>
<text class="orderstatus" v-show="slotProps.row.orderStatus == 7">退款中</text>
</view>
</view>
@@ -248,8 +250,9 @@
</view>
<view class="operation_box boxShadow" v-if="slotProps.row.isShowMore == true">
<view v-if="slotProps.row.orderStatus == 0"
@click.stop="canceOrder(slotProps.row)">取消订单</view>
<!-- soulspace注释取消订单入口 -->
<!-- <view v-if="slotProps.row.orderStatus == 0"
@click.stop="canceOrder(slotProps.row)">取消订单</view> -->
</view>
<!-- @click.stop="openMore(slotProps.row, slotProps.rowIndex)" 更多 -->
<view class="btns flexbox" style="margin-top: 10rpx">
@@ -264,7 +267,10 @@
@click.stop="seeExpressDetail(slotProps.row)">查看物流</view>
<view class="orderstatusbtn" v-if="slotProps.row.orderStatus == 2"
@click.stop="OverOrder(slotProps.row)">确认收到</view>
<view class="orderstatusbtn" v-if="slotProps.row.orderStatus == 3">申请售后</view>
<view class="orderstatusbtn" v-if="slotProps.row.orderStatus == 6 || slotProps.row.orderStatus == 7"
@click.stop="goRefundDestination(slotProps.row)">钱款去向</view>
<view class="orderstatusbtn" v-if="slotProps.row.refundableStatus === true"
@click.stop="confirmApplyRefund(slotProps.row)">申请退款</view>
</view>
</view>
<view style="border-bottom: 2rpx solid #e9e9e9; height: 50rpx"
@@ -300,10 +306,12 @@
come: "3",
isShowTab: false,
isLoadingHide: false,
moreList: [{
name: "取消订单",
key: "false",
}, ],
// soulspace注释取消订单菜单
// moreList: [{
// name: "取消订单",
// key: "false",
// }, ],
moreList: [],
currentCateIndex: 0,
pagination: {
page: 1, //页码
@@ -347,6 +355,16 @@
value: 3,
badge: {},
},
{
name: "已退款",
value: 6,
badge: {},
},
{
name: "退款中",
value: 7,
badge: {},
},
],
selectOrderInfo: {},
ordersListTab: 1,
@@ -437,6 +455,48 @@
val.orderSn,
});
},
goRefundDestination(row) {
uni.navigateTo({
url: `/pages/detail/refundDestination?orderId=${row.orderId}`,
});
},
confirmApplyRefund(row) {
uni.showModal({
title: "申请退款",
content: "请确认是否提交退款申请?",
confirmText: "确认提交",
cancelText: "取消",
success: (res) => {
if (res.confirm) {
this.submitOrderRefund(row);
}
},
});
},
submitOrderRefund(orderRow) {
this.$http.request({
url: "book/buyOrder/refundOrder",
method: "POST",
data: {
orderId: orderRow.orderId,
},
header: {
"Content-Type": "application/json",
},
}).then((res) => {
if (res.code === 0) {
this.$commonJS.showToast("申请退款成功");
this.newestpage = 1;
this.pagination.page = 1;
this.newList = [];
this.getBookList(this.ordersListTab, false);
return;
}
this.$commonJS.showToast(res.errMsg || "申请退款失败");
}).catch(() => {
this.$commonJS.showToast("申请退款失败");
});
},
//初始化获取数据
getBookList(flag, refreshflag) {
this.isLoadingHide = false;
@@ -461,6 +521,8 @@
// * 3已完成
// * 4: 交易失败
// * 5: 已过期
// * 6: 已退款
// * 7: 退款中
that.map = res.data;
that.ordersTabs.map((e) => {
@@ -489,7 +551,7 @@
var params = {
userId: this.userInfo.id,
come: this.come,
orderStatus: flag == -1 ? "" : flag, //传null为全部订单状态 0-未付款 1-待发出 2-待收到 3-交易成功 4-交易失败 5-过期
orderStatus: flag == -1 ? "" : flag, //传null为全部订单状态 0-未付款 1-待发出 2-待收到 3-交易成功 4-交易失败 5-过期 6-已退款 7-退款中
...this.pagination
}
this.$http.request({
@@ -522,8 +584,26 @@
});
this.axiosStatus = 1
},
checkPayTimeout(payItem) {
const createTime = payItem && payItem.createTime;
if (!createTime) return true;
const createdAt = new Date(String(createTime).replace(/-/g, "/")).getTime();
if (!createdAt) return true;
const expired = Date.now() - createdAt > 10 * 60 * 1000;
if (expired) {
uni.showModal({
title: "提示",
content: "订单已超时,不能继续支付,请重新下单",
confirmText: "知道了",
showCancel: false,
});
return false;
}
return true;
},
// 支付
goPay(payItem) {
if (!this.checkPayTimeout(payItem)) return;
if (payItem.paymentMethod == 2) {
console.log("阿里支付");
setPay({
@@ -982,9 +1062,9 @@
width: 100%;
}
/deep/.u-tabs__wrapper__nav__item {
padding: 0 !important;
}
// /deep/.u-tabs__wrapper__nav__item {
// padding: 0 !important;
// }
.order_box {
padding: 20rpx;
}