feat(order): 新增退款功能

This commit is contained in:
2026-05-09 11:14:18 +08:00
parent bde552dcb3
commit 9b21329518
12 changed files with 184 additions and 28 deletions

View File

@@ -4,6 +4,7 @@ let socketUrl = "";
if (process.env.NODE_ENV === 'development') {
// 开发环境
// baseUrl = "http://192.168.110.100:9200/pb/"; // 张川川
// baseUrl = "http://192.168.110.131:9200/pb/"; // 王亚男
baseUrl = "https://api.nuttyreading.com/"; // 线上正式
} else if (process.env.NODE_ENV === 'production') {
// baseUrl = "http://192.168.110.100:9200/pb/"; // 张川川

View File

@@ -64,6 +64,9 @@ Vue.component('common-video', commonVideo);
import CommonCourseVideo from 'edu-core/components/course-video'
Vue.component('CommonCourseVideo', CommonCourseVideo);
import CommonRefundDestination from 'edu-core/components/order/refund-destination.vue'
Vue.component('common-refund-destination', CommonRefundDestination);
import commonCurriculumVideo from '@/pages/component/commonComponents/curriculumVideo.vue'
Vue.component('common-curriculum-video', commonCurriculumVideo);
import commonRichDetail from '@/pages/component/commonComponents/richDetail.vue'

View File

@@ -2,8 +2,8 @@
"name" : "太湖云医",
"appid" : "__UNI__1B1584A",
"description" : "太湖云医",
"versionName" : "1.0.12",
"versionCode" : 1012,
"versionName" : "1.0.14",
"versionCode" : 1014,
"transformPx" : false,
"sassImplementationName" : "node-sass",
/* 5+App */

View File

@@ -1,6 +1,6 @@
{
"dependencies": {
"edu-core": "git+https://git.nuttyreading.com/chenghuan/edu-core.git#v1.0.12",
"edu-core": "git+https://git.nuttyreading.com/chenghuan/edu-core.git#v1.0.13",
"jquery": "^3.7.1",
"lodash": "^4.17.21",
"qs": "^6.14.0",

View File

@@ -373,6 +373,18 @@
}
}
},
{
"path": "pages/order/refundDestination",
"style": {
"navigationBarTitleText": "钱款去向",
"enablePullDownRefresh": false,
"app-plus": {
"bounce": "none",
"titleNView": false,
"popGesture": "none"
}
}
},
{
"path": "pages/goods/order",
"style": {

View File

@@ -365,4 +365,8 @@ export default {
/deep/.titleItem .related_courses_name{
width: calc(100%) !important;
}
.title_list {
margin-bottom: 20rpx;
}
</style>

View File

@@ -11,11 +11,13 @@
</view>
<view class="item_top">
<text class="orderstatus" v-show="item.orderStatus == 0">未付款</text>
<text class="orderstatus" v-show="item.orderStatus == 1">待发</text>
<text class="orderstatus" v-show="item.orderStatus == 2">已发</text>
<text class="orderstatus" v-show="item.orderStatus == 1">待发</text>
<text class="orderstatus" v-show="item.orderStatus == 2">已发</text>
<text class="orderstatus" v-show="item.orderStatus == 3">交易成功</text>
<text class="orderstatus" v-show="item.orderStatus == 4">交易失败</text>
<text class="orderstatus" v-show="item.orderStatus == 5">已过期</text>
<text class="orderstatus" v-show="item.orderStatus == 6">已退款</text>
<text class="orderstatus" v-show="item.orderStatus == 7">退款中</text>
</view>
<view class="order_infor" v-if="item.orderType=='aiVip'||item.orderType=='upgradeAiVip'">
<view class="left">
@@ -117,12 +119,24 @@
<text v-if="item.jfDeduction > 0">{{ item.jfDeduction }} 积分</text>
</view>
</view>
<text class="order_time">下单时间:{{item.createTime}}</text>
<view v-if="item.orderStatus == 0 && $platform == 'android'" class="order_statusbtn">
<text @click.stop="goPay(item)">继续付款</text>
</view>
<view v-if="item.orderStatus == 3" class="order_statusbtn">
<text>申请售后</text>
<text class="order_time">下单时间:{{ item.createTime }}</text>
<view
class="order_actions_row"
v-if="orderItemHasActions(item)"
@click.stop="noop"
>
<view v-if="item.orderStatus == 0 && $platform == 'android'" class="order_statusbtn">
<text @click.stop="goPay(item)">继续付款</text>
</view>
<view v-if="item.orderStatus == 3" class="order_statusbtn">
<text>申请售后</text>
</view>
<view v-if="item.orderStatus == 6 || item.orderStatus == 7" class="order_statusbtn">
<text @click.stop="goRefundDestination(item)">钱款去向</text>
</view>
<view v-if="item.refundableStatus === true" class="order_statusbtn">
<text @click.stop="confirmApplyRefund(item)">申请退款</text>
</view>
</view>
</view>
</view>
@@ -157,6 +171,15 @@ export default {
...mapState(["userInfo"]),
},
methods: {
noop() {},
orderItemHasActions(item) {
if (!item) return false;
if (item.orderStatus == 0 && this.$platform == "android") return true;
if (item.orderStatus == 3) return true;
if (item.orderStatus == 6 || item.orderStatus == 7) return true;
if (item.refundableStatus === true) return true;
return false;
},
//获取数据
getData() {
uni.showLoading({
@@ -277,6 +300,45 @@ export default {
}
}
},
goRefundDestination(row) {
uni.navigateTo({
url: `/pages/order/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.getData();
return;
}
this.$commonJS.showToast(res.errMsg || "申请退款失败");
}).catch(()=> {
this.$commonJS.showToast("申请退款失败");
});
},
},
}
</script>
@@ -301,7 +363,7 @@ export default {
.order_item{
display: block;
width: 100%;
padding: 20rpx 30rpx;
padding: 20rpx 30rpx 88rpx;
box-shadow: 0px 0px 10px 0px #a7bbe4;
border-radius: 10rpx;
margin-bottom: 20rpx;
@@ -319,7 +381,7 @@ export default {
}
}
.item_top{
.item_top {
position: absolute;
top: 70rpx;
right: 30rpx;
@@ -327,7 +389,7 @@ export default {
font-weight: normal;
color: red;
}
.order_infor{
.order_infor {
margin-top: 40rpx;
display: flex;
align-items: center;
@@ -355,7 +417,7 @@ export default {
}
}
}
.order_time{
.order_time {
display: block;
margin-top: 20rpx;
font-size: 26rpx;
@@ -377,10 +439,19 @@ export default {
font-weight: bold;
}
}
.order_statusbtn{
.order_actions_row {
position: absolute;
bottom: 20rpx;
left: 30rpx;
right: 30rpx;
display: flex;
flex-wrap: wrap;
justify-content: flex-end;
align-items: center;
gap: 16rpx;
}
.order_statusbtn{
flex-shrink: 0;
padding: 0 15rpx;
line-height: 45rpx;
font-size: 24rpx;

View File

@@ -10,16 +10,22 @@
v-if="orderContet.orderStatus == 0">待支付</text>
<text
class="orderState orderState1"
v-if="orderContet.orderStatus == 1">待发</text>
v-if="orderContet.orderStatus == 1">待发</text>
<text
class="orderState orderState2"
v-if="orderContet.orderStatus == 2">待收</text>
v-if="orderContet.orderStatus == 2">待收</text>
<text
class="orderState orderState3"
v-if="orderContet.orderStatus == 3">已完成</text>
<text
class="orderState orderState5"
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
@@ -365,14 +371,15 @@ export default {
text: "继续付款",
});
}
if (this.orderContet.orderStatus == 0) {
this.customButton.push({
width: "160rpx",
text: "取消订单",
color: "#333",
backgroundColor: "#f0f0f0",
});
}
// taimed注释取消订单按钮
// if (this.orderContet.orderStatus == 0) {
// this.customButton.push({
// width: "160rpx",
// text: "取消订单",
// color: "#333",
// backgroundColor: "#f0f0f0",
// });
// }
if (this.orderContet.orderStatus == 0) {
this.titleStat = "待支付";
} else if (this.orderContet.orderStatus == 1) {
@@ -381,6 +388,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 &&
@@ -551,6 +562,12 @@ view,uni-view {
.orderState5 {
background-color: #787878;
}
.orderState6 {
background-color: #f56c6c;
}
.orderState7 {
background-color: #f56c6c;
}
.guoqi {
font-size: 28rpx;
align-items: center;

View File

@@ -0,0 +1,26 @@
<template>
<view class="page-wrap">
<common-refund-destination :order-id="orderId" :http="$http" />
</view>
</template>
<script>
export default {
data() {
return {
orderId: "",
};
},
onLoad(options) {
if (options && options.orderId != null) {
this.orderId = options.orderId;
}
},
};
</script>
<style scoped>
.page-wrap {
min-height: 100vh;
}
</style>

View File

@@ -36,8 +36,7 @@
<view class="label_content AC_List">
<view style=" display: flex; align-items: center; justify-content: space-between;">
<view class="left">
<view class="title" v-if="slotProps.row.orderType=='购买商品'&&slotProps.row.productName">{{ slotProps.row.orderType }} <br/> {{ slotProps.row.productName }}</view>
<view class="title" v-else>{{ slotProps.row.orderType }}</view>
<view class="title">{{ slotProps.row.productName || slotProps.row.orderType}}</view>
</view>
<view class="right Hot">
<text v-if="slotProps.row.changeAmount > 0">+</text>
@@ -215,6 +214,12 @@ export default {
.AC_List {
overflow: hidden;
.title,
.AC_note,
.AC_mark {
word-break: break-word;
overflow-wrap: break-word;
}
.left {
width: calc(100% - 140rpx) !important;
font-weight: 700;
@@ -234,6 +239,19 @@ export default {
font-weight: 700;
color: #333;
}
> view:first-child {
.left {
flex: 1;
min-width: 0;
width: auto !important;
float: none;
}
.right {
flex-shrink: 0;
float: none;
width: auto !important;
}
}
.AC_title {
font-size: 32rpx;

View File

@@ -350,4 +350,8 @@ button::after {
// border-bottom: 0.5px solid #dadbde;
}
}
}
uni-text {
white-space: normal;
}

Binary file not shown.