feat(订单): 添加退款功能及相关页面
- 新增退款申请功能,用户可申请订单内所有商品退款 - 更新订单状态显示,增加“已退款”和“退款中”状态 - 新增退款去向页面,展示退款信息 - 更新依赖版本至v1.0.13 - 提升用户体验,优化多个页面的文本提示和样式 - 更新应用版本至2.0.49
This commit is contained in:
@@ -90,6 +90,16 @@
|
||||
v-if="orderContet.orderStatus == 5"
|
||||
>已超时</text
|
||||
>
|
||||
<text
|
||||
class="orderState orderState6"
|
||||
v-if="orderContet.orderStatus == 6"
|
||||
>已退款</text
|
||||
>
|
||||
<text
|
||||
class="orderState orderState7"
|
||||
v-if="orderContet.orderStatus == 7"
|
||||
>退款中</text
|
||||
>
|
||||
</view>
|
||||
<view
|
||||
class="orderContent"
|
||||
@@ -775,6 +785,8 @@ export default {
|
||||
this.OverOrder();
|
||||
} else if (data.text == "查看物流") {
|
||||
this.seeExpressDetail(this.orderContet);
|
||||
} else if (data.text == "申请退款") {
|
||||
this.confirmApplyRefund();
|
||||
}
|
||||
},
|
||||
async clickIcon(data) {
|
||||
@@ -783,6 +795,53 @@ export default {
|
||||
this.kefu();
|
||||
}
|
||||
},
|
||||
confirmApplyRefund() {
|
||||
uni.showModal({
|
||||
title: "提示",
|
||||
content: "确认申请订单内所有商品退款吗?",
|
||||
confirmText: "确认",
|
||||
cancelText: "取消",
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
this.submitOrderRefund();
|
||||
}
|
||||
},
|
||||
});
|
||||
},
|
||||
submitOrderRefund() {
|
||||
if (!this.orderContet || !this.orderContet.orderId) return;
|
||||
this.$http
|
||||
.request({
|
||||
url: "book/buyOrder/refundOrder",
|
||||
method: "POST",
|
||||
data: {
|
||||
order_id: this.orderContet.orderId,
|
||||
},
|
||||
header: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
})
|
||||
.then((res) => {
|
||||
if (res.code == 0) {
|
||||
uni.showToast({
|
||||
icon: "none",
|
||||
title: "退款成功",
|
||||
});
|
||||
this.getOrderList();
|
||||
return;
|
||||
}
|
||||
uni.showToast({
|
||||
icon: "none",
|
||||
title: (res && (res.msg || res.errMsg)) || "退款失败",
|
||||
});
|
||||
})
|
||||
.catch((e) => {
|
||||
uni.showToast({
|
||||
icon: "none",
|
||||
title: (e && (e.msg || e.errMsg)) || "退款失败",
|
||||
});
|
||||
});
|
||||
},
|
||||
// 复制到剪切板
|
||||
copyData(data) {
|
||||
uni.setClipboardData({
|
||||
@@ -1188,10 +1247,19 @@ export default {
|
||||
text: "继续付款",
|
||||
});
|
||||
}
|
||||
if (this.orderContet.orderStatus == 0) {
|
||||
// medicine:注释取消订单按钮
|
||||
// if (this.orderContet.orderStatus == 0) {
|
||||
// this.customButton.push({
|
||||
// width: "160rpx",
|
||||
// text: "取消订单",
|
||||
// color: "#333",
|
||||
// backgroundColor: "#f0f0f0",
|
||||
// });
|
||||
// }
|
||||
if (this.orderContet.refundableStatus === true) {
|
||||
this.customButton.push({
|
||||
width: "160rpx",
|
||||
text: "取消订单",
|
||||
text: "申请退款",
|
||||
color: "#333",
|
||||
backgroundColor: "#f0f0f0",
|
||||
});
|
||||
@@ -1214,6 +1282,10 @@ export default {
|
||||
this.titleStat = "待收到";
|
||||
} else if (this.orderContet.orderStatus == 3) {
|
||||
this.titleStat = "已完成";
|
||||
} else if (this.orderContet.orderStatus == 6) {
|
||||
this.titleStat = "已退款";
|
||||
} else if (this.orderContet.orderStatus == 7) {
|
||||
this.titleStat = "退款中";
|
||||
}
|
||||
if (
|
||||
this.orderContet.orderStatus >= 2 &&
|
||||
@@ -1256,10 +1328,28 @@ export default {
|
||||
},
|
||||
});
|
||||
},
|
||||
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) {
|
||||
console.log(payItem, "订单数据");
|
||||
if (!this.checkPayTimeout(payItem)) return;
|
||||
if (payItem.paymentMethod == 2) {
|
||||
console.log("阿里支付");
|
||||
setPay(
|
||||
@@ -1403,6 +1493,12 @@ export default {
|
||||
.orderState5 {
|
||||
background-color: #787878;
|
||||
}
|
||||
.orderState6 {
|
||||
background-color: #f56c6c;
|
||||
}
|
||||
.orderState7 {
|
||||
background-color: #f56c6c;
|
||||
}
|
||||
.guoqi {
|
||||
font-size: 28rpx;
|
||||
align-items: center;
|
||||
|
||||
Reference in New Issue
Block a user