feat: 订单的处理,ordertype 等于0的处理
This commit is contained in:
@@ -90,7 +90,7 @@ const handleButtonClick = DebounceUtils.createDebounce(async (orderData) => {
|
||||
// 检查接口返回数据
|
||||
if (!res || !res.data) {
|
||||
uni.hideLoading();
|
||||
uni.showToast({ title: "订单创建失败,请重试", icon: "none" });
|
||||
uni.showToast({ title: res.msg || "订单创建失败,请重试", icon: "none" });
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -119,7 +119,10 @@ const handleButtonClick = DebounceUtils.createDebounce(async (orderData) => {
|
||||
uni.showToast({
|
||||
title: "支付成功",
|
||||
icon: "success",
|
||||
success: () => emit("refresh"),
|
||||
success: () => {
|
||||
console.log("支付成功,刷新订单详情");
|
||||
emit("refresh", { orderId: orderId });
|
||||
},
|
||||
});
|
||||
},
|
||||
fail: () => {
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<template>
|
||||
<view
|
||||
v-if="orderType === '0'"
|
||||
v-if="orderType == 0"
|
||||
class="border-box bg-white p-12 rounded-12 mb-12"
|
||||
>
|
||||
<!-- 酒店类型入住离店日期部分 -->
|
||||
<DateRangeSection
|
||||
v-if="orderData.orderType === 0"
|
||||
v-if="orderData.orderType == 0"
|
||||
:selectedDate="selectedDate"
|
||||
/>
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
</view>
|
||||
|
||||
<view
|
||||
v-if="orderType !== '0'"
|
||||
v-if="orderType != 0"
|
||||
class="border-box bg-white p-12 rounded-12 mb-12"
|
||||
>
|
||||
<view
|
||||
@@ -85,7 +85,7 @@ const orderType = computed(() => props.orderData.orderType);
|
||||
const commodityAmount = computed(() => {
|
||||
// 门票单位:张、餐饮单位:份
|
||||
const { commodityAmount } = props.orderData;
|
||||
return orderType.value === "2"
|
||||
return orderType.value == 2
|
||||
? `${parseInt(commodityAmount)}张`
|
||||
: `${parseInt(commodityAmount)}份`;
|
||||
});
|
||||
|
||||
@@ -13,8 +13,8 @@
|
||||
<text
|
||||
:class="[
|
||||
{
|
||||
'color-FF3D60': statusCode === '0',
|
||||
'color-21B466': ['1', '2', '3', '4', '5', '6'].includes(statusCode),
|
||||
'color-FF3D60': statusCode === '0' || statusCode === '3',
|
||||
'color-21B466': ['1', '2', '4', '5', '6'].includes(statusCode),
|
||||
},
|
||||
]"
|
||||
>
|
||||
@@ -45,7 +45,7 @@ const statusCode = computed(() => props.orderData.orderStatus);
|
||||
|
||||
// 使用计算属性缓存支付方式文本
|
||||
const statusText = computed(() =>
|
||||
statusCode.value === "0" ? "未支付" : "已支付"
|
||||
statusCode.value === "0" || statusCode.value === "3" ? "未支付" : "已支付"
|
||||
);
|
||||
</script>
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
<GoodsInfo :orderData="orderData" />
|
||||
|
||||
<UserInfo v-if="orderData.orderType === 0" :orderData="orderData" />
|
||||
<UserInfo v-if="orderData.orderType == 0" :orderData="orderData" />
|
||||
|
||||
<OrderInfo :orderData="orderData" />
|
||||
</view>
|
||||
@@ -21,6 +21,7 @@
|
||||
|
||||
<!-- 核销凭证 二维码 -->
|
||||
<OrderQrcode
|
||||
v-if="orderData.orderStatus === '2'"
|
||||
v-show="visbleQrcode"
|
||||
v-model="visbleQrcode"
|
||||
:orderData="orderData"
|
||||
@@ -34,8 +35,8 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from "vue";
|
||||
import { onLoad } from "@dcloudio/uni-app";
|
||||
import { ref, getCurrentInstance } from "vue";
|
||||
import { onLoad, onUnload } from "@dcloudio/uni-app";
|
||||
import { userOrderDetail, orderRefund } from "@/request/api/OrderApi";
|
||||
import TopNavBar from "@/components/TopNavBar/index.vue";
|
||||
import OrderQrcode from "./components/OrderQrcode/index.vue";
|
||||
@@ -48,6 +49,9 @@ import OrderInfo from "./components/OrderInfo/index.vue";
|
||||
import FooterSection from "./components/FooterSection/index.vue";
|
||||
import RefundPopup from "@/components/RefundPopup/index.vue";
|
||||
|
||||
// 获取事件通道对象
|
||||
let eventChannel = null
|
||||
|
||||
const refundVisible = ref(false);
|
||||
const orderData = ref({});
|
||||
|
||||
@@ -55,7 +59,14 @@ const visbleQrcode = ref(false);
|
||||
const selectedVoucher = ref(null);
|
||||
const selectedVoucherIndex = ref(0);
|
||||
|
||||
onLoad(({ orderId }) => getOrderDetail(orderId));
|
||||
onLoad(({ orderId }) => {
|
||||
getOrderDetail(orderId);
|
||||
|
||||
// 获取当前页面的事件通道(由 navigateTo 打开时可用)
|
||||
const pages = getCurrentPages()
|
||||
const currentPage = pages[pages.length - 1]
|
||||
eventChannel = currentPage.getOpenerEventChannel()
|
||||
});
|
||||
|
||||
// 处理选中核销凭证事件
|
||||
const handleSelectedVoucher = (voucher) => {
|
||||
@@ -96,8 +107,18 @@ const handleRefundConfirm = async ({ orderId }) => {
|
||||
|
||||
// 再次预定
|
||||
const handlePaySuccess = ({ orderId }) => {
|
||||
console.log("支付成功,刷新订单详情", orderId);
|
||||
getOrderDetail(orderId);
|
||||
// 支付成功后通知上一个页面
|
||||
setTimeout(() => {
|
||||
eventChannel.emit('refreshOrderList', { success: true });
|
||||
}, 1000);
|
||||
};
|
||||
|
||||
onUnload(() => {
|
||||
eventChannel.on('refreshOrderList');
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
@@ -51,6 +51,14 @@ const handleOrderClick = ({ orderId }) => {
|
||||
// 这里可以添加订单详情跳转逻辑
|
||||
uni.navigateTo({
|
||||
url: `/pages-order/order/detail?orderId=${orderId}`,
|
||||
events: {
|
||||
refreshOrderList: (event) => {
|
||||
console.log("订单详情页面请求刷新订单列表", event);
|
||||
if (event.success) {
|
||||
queryList(1, 10);
|
||||
}
|
||||
},
|
||||
},
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user