feat(tickets): 优化水票页面显示和订单状态逻辑

- 集成 dayjs 库用于时间格式化
- 将下单时间格式化为 YYYY年MM月DD日 HH:mm:ss 格式
- 重新设计水票数量展示布局,突出显示可用、已用和剩余赠票
- 更新核销记录标题为票号显示
- 修改二维码扫描页面显示票号而非模板名称
- 添加订单完成状态判断函数
- 在待发货和待收货状态中排除已完成订单
- 移除已完成订单状态下的操作按钮
This commit is contained in:
2026-02-05 12:03:56 +08:00
parent 5dc70a1c3c
commit 24354a38c5
2 changed files with 22 additions and 49 deletions

View File

@@ -149,6 +149,8 @@ function OrderList(props: OrderListProps) {
return '未知状态';
};
const isOrderCompleted = (order: ShopOrder) => order.orderStatus === 1 || order.formId === 10074;
// 获取订单状态颜色
const getOrderStatusColor = (order: ShopOrder) => {
// 优先检查订单状态
@@ -812,7 +814,7 @@ function OrderList(props: OrderListProps) {
)}
{/* 待发货状态:显示申请退款 */}
{item.payStatus && item.deliveryStatus === 10 && item.orderStatus !== 2 && item.orderStatus !== 4 && (
{item.payStatus && item.deliveryStatus === 10 && item.orderStatus !== 2 && item.orderStatus !== 4 && !isOrderCompleted(item) && (
<Button size={'small'} onClick={(e) => {
e.stopPropagation();
applyRefund(item);
@@ -820,7 +822,7 @@ function OrderList(props: OrderListProps) {
)}
{/* 待收货状态:显示查看物流和确认收货 */}
{item.deliveryStatus === 20 && (!item.riderId || !!item.sendEndTime) && item.orderStatus !== 2 && item.orderStatus !== 6 && (
{item.deliveryStatus === 20 && (!item.riderId || !!item.sendEndTime) && item.orderStatus !== 2 && item.orderStatus !== 6 && !isOrderCompleted(item) && (
<Space>
{/*<Button size={'small'} onClick={(e) => {*/}
{/* e.stopPropagation();*/}
@@ -833,25 +835,6 @@ function OrderList(props: OrderListProps) {
</Space>
)}
{/* 已完成状态:显示再次购买、评价商品、申请退款 */}
{item.orderStatus === 1 && (
<Space>
<Button size={'small'} onClick={(e) => {
e.stopPropagation();
buyAgain(item);
}}></Button>
{/*<Button size={'small'} onClick={(e) => {*/}
{/* e.stopPropagation();*/}
{/* evaluateGoods(item);*/}
{/*}}>评价商品</Button>*/}
<Button size={'small'} onClick={(e) => {
e.stopPropagation();
applyRefund(item);
}}>退</Button>
</Space>
)}
{/* 退款/售后状态:显示查看进度和撤销申请 */}
{(item.orderStatus === 4 || item.orderStatus === 7) && (
<Space>

View File

@@ -19,6 +19,7 @@ import type { GltUserTicket } from '@/api/glt/gltUserTicket/model';
import { pageGltUserTicketLog } from '@/api/glt/gltUserTicketLog';
import type { GltUserTicketLog } from '@/api/glt/gltUserTicketLog/model';
import { BaseUrl } from '@/config/app';
import dayjs from "dayjs";
const PAGE_SIZE = 10;
@@ -99,11 +100,11 @@ const UserTicketList = () => {
lines.push(`冻结:${ticket.frozenQty ?? 0}`);
lines.push(`已释放:${ticket.releasedQty ?? 0}`);
if (ticket.orderNo) lines.push(`订单号:${ticket.orderNo}`);
Taro.showModal({
title: '水票详情',
content: lines.join('\n'),
showCancel: false
});
// Taro.showModal({
// title: '水票详情',
// content: lines.join('\n'),
// showCancel: false
// });
};
const reloadTickets = async (isRefresh = true, keywords?: string) => {
@@ -348,7 +349,7 @@ const UserTicketList = () => {
)}
{item.createTime && (
<View className="mt-1">
<Text className="text-xs text-gray-400">{item.createTime}</Text>
<Text className="text-xs text-gray-400">{dayjs(item.createTime).format('YYYY年MM月DD日 HH:mm:ss')}</Text>
</View>
)}
</View>
@@ -372,28 +373,17 @@ const UserTicketList = () => {
</View>
<View className="mt-3 flex justify-between">
<View className="flex flex-col">
<Text className="text-xs text-gray-500"></Text>
<Text className="text-lg font-bold text-blue-600">{item.availableQty ?? 0}</Text>
<View className="flex flex-col items-center">
<Text className="text-lg font-bold text-blue-600 text-center">{item.availableQty ?? 0}</Text>
<Text className="text-xs text-gray-500"></Text>
</View>
<View className="flex flex-col items-center">
<Text className="text-xs text-gray-500"></Text>
<Text className="text-sm text-gray-900">{item.totalQty ?? 0}</Text>
<Text className="text-lg text-gray-900 text-center">{item.usedQty ?? 0}</Text>
<Text className="text-xs text-gray-500"></Text>
</View>
<View className="flex flex-col items-end">
<Text className="text-xs text-gray-500"></Text>
<Text className="text-sm text-gray-900">{item.usedQty ?? 0}</Text>
</View>
</View>
<View className="mt-2 flex justify-between">
<View className="flex flex-col">
<Text className="text-xs text-gray-500"></Text>
<Text className="text-sm text-gray-900">{item.frozenQty ?? 0}</Text>
</View>
<View className="flex flex-col items-end">
<Text className="text-xs text-gray-500"></Text>
<Text className="text-sm text-gray-900">{item.releasedQty ?? 0}</Text>
<View className="flex flex-col items-center">
<Text className="text-lg text-gray-900 text-center">{item.frozenQty ?? 0}</Text>
<Text className="text-xs text-gray-500"></Text>
</View>
</View>
</View>
@@ -426,7 +416,7 @@ const UserTicketList = () => {
<View className="flex items-start justify-between">
<View className="flex-1 pr-3">
<Text className="text-base font-semibold text-gray-900">
{item.userTicketId}
</Text>
{item.createTime && (
<View className="mt-1">
@@ -500,8 +490,8 @@ const UserTicketList = () => {
{qrTicket && (
<View className="bg-gray-50 rounded-lg p-3 mb-4">
<View className="flex justify-between mb-2">
<Text className="text-sm text-gray-600"></Text>
<Text className="text-sm text-gray-900">{qrTicket.templateName || '水票'}</Text>
<Text className="text-sm text-gray-600"></Text>
<Text className="text-sm text-gray-900">{qrTicket.id}</Text>
</View>
<View className="flex justify-between">
<Text className="text-sm text-gray-600"></Text>