This commit is contained in:
2026-04-08 10:47:25 +08:00
parent 1739401cb8
commit 078e0bc8ab
2 changed files with 552 additions and 428 deletions

View File

@ -5,17 +5,26 @@
订单编号{{ data.order_no || "-" }} 订单编号{{ data.order_no || "-" }}
</text> </text>
<!-- 待支付状态显示倒计时横幅 --> <!-- 待支付状态显示倒计时横幅 -->
<view v-if="data.status === SHOP_ORDER_UNPAY && !data.tui_status && countDownTime > 0" <view
class="order-status-banner"> v-if="
data.status === SHOP_ORDER_UNPAY &&
!data.tui_status &&
countDownTime > 0
"
class="order-status-banner"
>
<view class="status-banner-left"> <view class="status-banner-left">
<text class="status-text">等待付款</text> <text class="status-text">等待付款</text>
</view> </view>
<view class="status-banner-right"> <view class="status-banner-right">
<text class="countdown-text">{{ formatCountdown(countDownTime) }}</text> <text class="countdown-text">{{
formatCountdown(countDownTime)
}}</text>
</view> </view>
</view> </view>
<!-- 其他状态:显示原有样式 --> <!-- 其他状态:显示原有样式 -->
<view v-else-if=" <view
v-else-if="
([ ([
SHOP_ORDER_CANCEL, SHOP_ORDER_CANCEL,
SHOP_ORDER_UNPAY, SHOP_ORDER_UNPAY,
@ -26,40 +35,59 @@
].includes(data.status) && ].includes(data.status) &&
!data.tui_status) || !data.tui_status) ||
[SHOP_ORDER_AFTERSALE_REJECT].includes(data.tui_status) [SHOP_ORDER_AFTERSALE_REJECT].includes(data.tui_status)
" class="flex-center fs-24 order-btn" :class="[ "
class="flex-center fs-24 order-btn"
:class="[
![SHOP_ORDER_DONE, SHOP_ORDER_CANCEL, SHOP_ORDER_UNREMARK].includes( ![SHOP_ORDER_DONE, SHOP_ORDER_CANCEL, SHOP_ORDER_UNREMARK].includes(
data.status data.status
) )
? 'app-fc-mark confirm' ? 'app-fc-mark confirm'
: 'cancel', : 'cancel',
]"> ]"
>
{{ orderStatus }} {{ orderStatus }}
</view> </view>
<view v-if=" <view
v-if="
[SHOP_ORDER_AFTERSALE, SHOP_ORDER_AFTERSALE_DONE].includes( [SHOP_ORDER_AFTERSALE, SHOP_ORDER_AFTERSALE_DONE].includes(
data.tui_status data.tui_status
) )
" class="flex-center fs-24 order-btn cancel"> "
class="flex-center fs-24 order-btn cancel"
>
{{ refundOrderStatus }} {{ refundOrderStatus }}
</view> </view>
</view> </view>
<view class="order-content" :class="{ 'split-border': showStatusBtn }" @click="jumpToDetails"> <view
class="order-content"
:class="{ 'split-border': showStatusBtn }"
@click="jumpToDetails"
>
<good-info :data="data.items" :actual_price="data.actual_price" /> <good-info :data="data.items" :actual_price="data.actual_price" />
<view v-if="data.type && data.type !== 1" class="fs-24 app-fc-mark order-type"> <view
v-if="data.type && data.type !== 1"
class="fs-24 app-fc-mark order-type"
>
随车订单 随车订单
</view> </view>
</view> </view>
<view v-if="showStatusBtn" class="order-btns"> <view v-if="showStatusBtn" class="order-btns">
<!-- 待支付 --> <!-- 待支付 -->
<template v-if="[SHOP_ORDER_UNPAY].includes(data.status)"> <template v-if="[SHOP_ORDER_UNPAY].includes(data.status)">
<view class="flex-center fs-24 app-fc-main cancel-order-btn" @click.stop="$emit('cancelOrder', data)"> <view
class="flex-center fs-24 app-fc-main cancel-order-btn"
@click.stop="$emit('cancelOrder', data)"
>
取消订单 取消订单
</view> </view>
<view class="order-btns-right"> <view class="order-btns-right">
<!-- <view class="flex-center fs-24 app-fc-main status-btn" @click.stop="$emit('concactService', data)"> <!-- <view class="flex-center fs-24 app-fc-main status-btn" @click.stop="$emit('concactService', data)">
联系客服 联系客服
</view> --> </view> -->
<view class="flex-center fs-24 app-fc-white status-btn confirm" @click.stop="$emit('pay', data)"> <view
class="flex-center fs-24 app-fc-white status-btn confirm"
@click.stop="$emit('pay', data)"
>
立即支付 立即支付
</view> </view>
</view> </view>
@ -68,11 +96,16 @@
<!-- 待预约 --> <!-- 待预约 -->
<template v-if="[SHOP_ORDER_UNSLIVER].includes(data.status)"> <template v-if="[SHOP_ORDER_UNSLIVER].includes(data.status)">
<view class="order-btns-right"> <view class="order-btns-right">
<view class="flex-center fs-24 app-fc-main status-btn" @click.stop="remindRefund(data.order_id)"> <view
class="flex-center fs-24 app-fc-main status-btn"
@click.stop="remindRefund(data.order_id)"
>
申请退款 申请退款
</view> </view>
<view class="flex-center fs-24 app-fc-white status-btn confirm" <view
@click.stop="jumpToReservation"> class="flex-center fs-24 app-fc-white status-btn confirm"
@click.stop="jumpToReservation"
>
立即预约 立即预约
</view> </view>
</view> </view>
@ -84,7 +117,10 @@
联系客服 联系客服
</view> --> </view> -->
<view class="flex-center fs-24 app-fc-main status-btn" @click.stop="$emit('afterSale', data)"> <view
class="flex-center fs-24 app-fc-main status-btn"
@click.stop="$emit('afterSale', data)"
>
申请售后 申请售后
</view> </view>
<!-- 随车订单不显示物流 --> <!-- 随车订单不显示物流 -->
@ -92,8 +128,10 @@
@click.stop="$emit('checkSliver', data)"> @click.stop="$emit('checkSliver', data)">
查看物流 查看物流
</view> --> </view> -->
<view class="flex-center fs-24 app-fc-white status-btn confirm" <view
@click.stop="$emit('confirmSliver', data)"> class="flex-center fs-24 app-fc-white status-btn confirm"
@click.stop="$emit('confirmSliver', data)"
>
确认收货 确认收货
</view> </view>
</template> </template>
@ -103,7 +141,10 @@
<!-- <view class="flex-center fs-24 app-fc-main status-btn" @click.stop="$emit('concactService', data)"> <!-- <view class="flex-center fs-24 app-fc-main status-btn" @click.stop="$emit('concactService', data)">
联系客服 联系客服
</view> --> </view> -->
<view class="flex-center fs-24 app-fc-white status-btn confirm" @click.stop="$emit('remark', data)"> <view
class="flex-center fs-24 app-fc-white status-btn confirm"
@click.stop="$emit('remark', data)"
>
立即评价 立即评价
</view> </view>
</template> </template>
@ -113,18 +154,20 @@
<!-- <view class="flex-center fs-24 app-fc-main status-btn" @click.stop="$emit('concactService', data)"> <!-- <view class="flex-center fs-24 app-fc-main status-btn" @click.stop="$emit('concactService', data)">
联系客服 联系客服
</view> --> </view> -->
<view class="flex-center fs-24 app-fc-white status-btn confirm " <view
style="visibility: hidden;" class="flex-center fs-24 app-fc-white status-btn confirm"
style="visibility: hidden"
> >
</view> </view>
</template> </template>
<template v-if="[SHOP_ORDER_DONE].includes(data.status)"> <template v-if="[SHOP_ORDER_DONE].includes(data.status)">
<!-- <view class="flex-center fs-24 app-fc-main status-btn" @click.stop="$emit('concactService', data)"> <!-- <view class="flex-center fs-24 app-fc-main status-btn" @click.stop="$emit('concactService', data)">
联系客服 联系客服
</view> --> </view> -->
<view class="flex-center fs-24 app-fc-white status-btn confirm" <view
@click.stop="$emit('remarkDetails', data)"> class="flex-center fs-24 app-fc-white status-btn confirm"
@click.stop="$emit('remarkDetails', data)"
>
查看评价 查看评价
</view> </view>
</template> </template>
@ -135,10 +178,7 @@
<script> <script>
import PopUpModal from "@/components/PopUpModal.vue"; import PopUpModal from "@/components/PopUpModal.vue";
import GoodInfo from "./GoodInfo.vue"; import GoodInfo from "./GoodInfo.vue";
import { import { walletTransaction, cancelPetOrderMall } from "../../../../api/login";
walletTransaction,
cancelPetOrderMall,
} from "../../../../api/login";
import { import {
SHOP_ORDER_STATUS, SHOP_ORDER_STATUS,
@ -154,7 +194,7 @@
SHOP_ORDER_UNREMARK, SHOP_ORDER_UNREMARK,
pay_type_ADDRESS, pay_type_ADDRESS,
pay_type_BYCAR, pay_type_BYCAR,
pay_type_BYPET pay_type_BYPET,
} from "@/constants/app.business"; } from "@/constants/app.business";
export default { export default {
@ -186,7 +226,7 @@
}, },
components: { components: {
GoodInfo, GoodInfo,
PopUpModal PopUpModal,
}, },
options: { options: {
styleIsolation: "shared", styleIsolation: "shared",
@ -219,11 +259,11 @@
refundParams() { refundParams() {
return { return {
reasonCode: [410], reasonCode: [410],
note: '用户申请退款', note: "用户申请退款",
applySource: 101, applySource: 101,
afterSaleType: 3, afterSaleType: 3,
needRefundPackFee: true needRefundPackFee: true,
} };
}, },
orderStatus() { orderStatus() {
return SHOP_ORDER_STATUS[this.data.status] || ""; return SHOP_ORDER_STATUS[this.data.status] || "";
@ -240,7 +280,8 @@
SHOP_ORDER_DONE, SHOP_ORDER_DONE,
SHOP_ORDER_UNREMARK, SHOP_ORDER_UNREMARK,
].includes(this.data.status) && ].includes(this.data.status) &&
!this.data.tui_status) || [SHOP_ORDER_AFTERSALE_REJECT].includes(this.data.tui_status) !this.data.tui_status) ||
[SHOP_ORDER_AFTERSALE_REJECT].includes(this.data.tui_status)
); );
}, },
}, },
@ -248,13 +289,13 @@
showCancelModal(val) { showCancelModal(val) {
this.$emit("disableScroll", val); this.$emit("disableScroll", val);
}, },
'data.daojishi'(newVal) { "data.daojishi"(newVal) {
if (this.data.status === this.SHOP_ORDER_UNPAY && newVal) { if (this.data.status === this.SHOP_ORDER_UNPAY && newVal) {
this.countDownTime = newVal; this.countDownTime = newVal;
this.startCountDown(); this.startCountDown();
} }
}, },
'data.status'(newVal) { "data.status"(newVal) {
if (newVal === this.SHOP_ORDER_UNPAY && this.data.daojishi) { if (newVal === this.SHOP_ORDER_UNPAY && this.data.daojishi) {
this.countDownTime = this.data.daojishi; this.countDownTime = this.data.daojishi;
this.startCountDown(); this.startCountDown();
@ -278,52 +319,104 @@
const data = { const data = {
id: Number(id), id: Number(id),
}; };
cancelPetOrderMall(data).then((res) => { uni.showLoading({
icon: "none",
title: "处理中",
mask: true,
});
cancelPetOrderMall(data)
.then((res) => {
uni.hideLoading();
const plugin = tt.requirePlugin("lifeServicePlugin"); const plugin = tt.requirePlugin("lifeServicePlugin");
let res1 = {
code: 0,
result: "success",
msg: "success",
data: {
outOrderNo: "DYG177556196373493862814838179",
refundInfo: {
reason:["计划有变,暂时不需要了"],
reasonCode:[401],
},
goodsList: [
{ goodsId: "7625832097692813354", goodsType: 1, quantity: 1 },
],
},
};
plugin.applyRefund({ plugin.applyRefund({
goodsList:res.data.goodsList, goodsList: res1.data.goodsList,
outOrderNo:res.data.outOrderNo, outOrderNo: res1.data.outOrderNo,
refundInfo:res.data.refundInfo, refundInfo: res1.data.refundInfo,
success(res) { success: (res) => {
uni.showToast({ uni.showToast({
title: '退款成功', title: "退款申请已提交",
icon: 'success' icon: "success",
});
this.$emit("refund", this.data);
},
fail: (err) => {
console.log("退款失败:", err);
// 处理session过期错误
if (err && err.errMsg && err.errMsg.includes("session已过期")) {
uni.showModal({
title: "提示",
content: "会话已过期,请重新登录后再试",
showCancel: false,
confirmText: "确定",
success: () => {
// 清除当前用户信息并跳转到登录页
this.$store.dispatch("user/deleteToken");
this.$store.dispatch("user/clearUserInfo");
uni.clearStorageSync();
uni.reLaunch({
url: "/pages/client/auth/index",
});
},
});
} else {
uni.showToast({
title: err?.errMsg || err?.msg || "退款失败,请重试",
icon: "none",
});
}
},
});
}) })
const { outRefundNo } = res; .catch((err) => {
tt.showToast({ title: outRefundNo }); uni.hideLoading();
}, console.error("获取退款信息失败:", err);
fail(res) { uni.showToast({
console.log("fail", res); title: err?.msg || "获取退款信息失败",
}, icon: "none",
}); });
}); });
}, },
// 退款回调(组件触发) // 退款回调(组件触发)
handleRefund(event) { handleRefund(event) {
const { status, result, outOrderNo } = event.detail const { status, result, outOrderNo } = event.detail;
console.log('退款回调:', { status, result, outOrderNo }) console.log("退款回调:", { status, result, outOrderNo });
if (status === 'success') { if (status === "success") {
uni.showToast({ uni.showToast({
title: '退款申请已提交', title: "退款申请已提交",
icon: 'success' icon: "success",
}) });
this.$emit('refund', this.data) this.$emit("refund", this.data);
} else { } else {
uni.showToast({ uni.showToast({
title: result?.errMsg || '退款失败,请稍后重试', title: result?.errMsg || "退款失败,请稍后重试",
icon: 'none' icon: "none",
}) });
} }
}, },
// 错误处理 // 错误处理
handleError(event) { handleError(event) {
console.error('退款组件报错:', event.detail) console.error("退款组件报错:", event.detail);
uni.showToast({ uni.showToast({
title: '组件加载失败,请稍后重试', title: "组件加载失败,请稍后重试",
icon: 'none' icon: "none",
}) });
}, },
startCountDown() { startCountDown() {
@ -335,7 +428,7 @@
} else { } else {
this.stopCountDown(); this.stopCountDown();
// 倒计时结束,可以触发刷新 // 倒计时结束,可以触发刷新
this.$emit('countdownEnd', this.data); this.$emit("countdownEnd", this.data);
} }
}, 1000); }, 1000);
} }
@ -358,11 +451,11 @@
this.showCancelModal = false; this.showCancelModal = false;
}, },
jumpToDetails() { jumpToDetails() {
this.$emit('jumpToDetails', this.data) this.$emit("jumpToDetails", this.data);
}, },
jumpToReservation() { jumpToReservation() {
uni.reLaunch({ uni.reLaunch({
url: '/pages/client/index/index?activePageId=reservationPage' url: "/pages/client/index/index?activePageId=reservationPage",
}); });
}, },
}, },
@ -409,14 +502,14 @@
align-items: center; align-items: center;
justify-content: center; justify-content: center;
height: 100%; height: 100%;
background: #FF19A0; background: #ff19a0;
padding: 8rpx; padding: 8rpx;
flex-shrink: 0; flex-shrink: 0;
border-radius: 10px 0px 10px 10px; border-radius: 10px 0px 10px 10px;
.status-text { .status-text {
font-size: 20rpx; font-size: 20rpx;
color: #FFFFFF; color: #ffffff;
} }
} }
@ -425,21 +518,18 @@
align-items: center; align-items: center;
justify-content: center; justify-content: center;
height: 100%; height: 100%;
background: #FFF0F8; background: #fff0f8;
padding: 8rpx; padding: 8rpx;
flex-shrink: 0; flex-shrink: 0;
.countdown-text { .countdown-text {
font-size: 20rpx; font-size: 20rpx;
color: #FF19A0; color: #ff19a0;
} }
} }
} }
} }
.order-btns { .order-btns {
padding-top: 20rpx; padding-top: 20rpx;
display: flex; display: flex;
@ -448,7 +538,7 @@
.cancel-order-btn { .cancel-order-btn {
font-size: 24rpx; font-size: 24rpx;
color: #9B939A; color: #9b939a;
padding: 16rpx 0; padding: 16rpx 0;
} }
@ -462,7 +552,7 @@
height: 34px; height: 34px;
// padding: 16rpx 20rpx; // padding: 16rpx 20rpx;
border-radius: 64rpx; border-radius: 64rpx;
border: 1px solid #FF19A0;; border: 1px solid #ff19a0;
margin-left: 20rpx; margin-left: 20rpx;
&.confirm { &.confirm {
@ -476,7 +566,6 @@
.good-info-multi { .good-info-multi {
padding-top: 20rpx; padding-top: 20rpx;
} }
} }
} }
</style> </style>

View File

@ -679,24 +679,59 @@ export default {
const data = { const data = {
id: Number(id), id: Number(id),
}; };
uni.showLoading({
icon: "none",
title: "处理中",
mask: true,
});
cancelPetOrderMall(data).then((res) => { cancelPetOrderMall(data).then((res) => {
uni.hideLoading();
const plugin = tt.requirePlugin("lifeServicePlugin"); const plugin = tt.requirePlugin("lifeServicePlugin");
plugin.applyRefund({ plugin.applyRefund({
goodsList: res.data.goodsList, goodsList: res.data.goodsList,
outOrderNo: res.data.outOrderNo, outOrderNo: res.data.outOrderNo,
refundInfo: res.data.refundInfo, refundInfo: res.data.refundInfo,
success(res) { success: (res) => {
uni.showToast({ uni.showToast({
title: '退款成功', title: '退款申请已提交',
icon: 'success' icon: 'success'
}) });
const { outRefundNo } = res; this.getOrderDetail();
tt.showToast({ title: outRefundNo });
}, },
fail(res) { fail: (err) => {
console.log("fail", res); console.log("退款失败:", err);
// 处理session过期错误
if (err && err.errMsg && err.errMsg.includes('session已过期')) {
uni.showModal({
title: '提示',
content: '会话已过期,请重新登录后再试',
showCancel: false,
confirmText: '确定',
success: () => {
// 清除当前用户信息并跳转到登录页
this.$store.dispatch("user/deleteToken");
this.$store.dispatch("user/clearUserInfo");
uni.clearStorageSync();
uni.reLaunch({
url: "/pages/client/auth/index"
});
}
});
} else {
uni.showToast({
title: err?.errMsg || err?.msg || '退款失败,请重试',
icon: 'none'
});
}
}, },
}); });
}).catch((err) => {
uni.hideLoading();
console.error("获取退款信息失败:", err);
uni.showToast({
title: err?.msg || '获取退款信息失败',
icon: 'none'
});
}); });
}, },