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

View File

@ -679,24 +679,59 @@ export default {
const data = {
id: Number(id),
};
uni.showLoading({
icon: "none",
title: "处理中",
mask: true,
});
cancelPetOrderMall(data).then((res) => {
uni.hideLoading();
const plugin = tt.requirePlugin("lifeServicePlugin");
plugin.applyRefund({
goodsList:res.data.goodsList,
outOrderNo:res.data.outOrderNo,
refundInfo:res.data.refundInfo,
success(res) {
goodsList: res.data.goodsList,
outOrderNo: res.data.outOrderNo,
refundInfo: res.data.refundInfo,
success: (res) => {
uni.showToast({
title: '退款成功',
title: '退款申请已提交',
icon: 'success'
})
const { outRefundNo } = res;
tt.showToast({ title: outRefundNo });
});
this.getOrderDetail();
},
fail(res) {
console.log("fail", res);
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'
});
}
},
});
}).catch((err) => {
uni.hideLoading();
console.error("获取退款信息失败:", err);
uni.showToast({
title: err?.msg || '获取退款信息失败',
icon: 'none'
});
});
},