forked from gxwebsoft/mp-10550
feat(tickets): 优化水票页面显示和订单状态逻辑
- 集成 dayjs 库用于时间格式化 - 将下单时间格式化为 YYYY年MM月DD日 HH:mm:ss 格式 - 重新设计水票数量展示布局,突出显示可用、已用和剩余赠票 - 更新核销记录标题为票号显示 - 修改二维码扫描页面显示票号而非模板名称 - 添加订单完成状态判断函数 - 在待发货和待收货状态中排除已完成订单 - 移除已完成订单状态下的操作按钮
This commit is contained in:
@@ -149,6 +149,8 @@ function OrderList(props: OrderListProps) {
|
|||||||
return '未知状态';
|
return '未知状态';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const isOrderCompleted = (order: ShopOrder) => order.orderStatus === 1 || order.formId === 10074;
|
||||||
|
|
||||||
// 获取订单状态颜色
|
// 获取订单状态颜色
|
||||||
const getOrderStatusColor = (order: ShopOrder) => {
|
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) => {
|
<Button size={'small'} onClick={(e) => {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
applyRefund(item);
|
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>
|
<Space>
|
||||||
{/*<Button size={'small'} onClick={(e) => {*/}
|
{/*<Button size={'small'} onClick={(e) => {*/}
|
||||||
{/* e.stopPropagation();*/}
|
{/* e.stopPropagation();*/}
|
||||||
@@ -833,25 +835,6 @@ function OrderList(props: OrderListProps) {
|
|||||||
</Space>
|
</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) && (
|
{(item.orderStatus === 4 || item.orderStatus === 7) && (
|
||||||
<Space>
|
<Space>
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ import type { GltUserTicket } from '@/api/glt/gltUserTicket/model';
|
|||||||
import { pageGltUserTicketLog } from '@/api/glt/gltUserTicketLog';
|
import { pageGltUserTicketLog } from '@/api/glt/gltUserTicketLog';
|
||||||
import type { GltUserTicketLog } from '@/api/glt/gltUserTicketLog/model';
|
import type { GltUserTicketLog } from '@/api/glt/gltUserTicketLog/model';
|
||||||
import { BaseUrl } from '@/config/app';
|
import { BaseUrl } from '@/config/app';
|
||||||
|
import dayjs from "dayjs";
|
||||||
|
|
||||||
const PAGE_SIZE = 10;
|
const PAGE_SIZE = 10;
|
||||||
|
|
||||||
@@ -99,11 +100,11 @@ const UserTicketList = () => {
|
|||||||
lines.push(`冻结:${ticket.frozenQty ?? 0}`);
|
lines.push(`冻结:${ticket.frozenQty ?? 0}`);
|
||||||
lines.push(`已释放:${ticket.releasedQty ?? 0}`);
|
lines.push(`已释放:${ticket.releasedQty ?? 0}`);
|
||||||
if (ticket.orderNo) lines.push(`订单号:${ticket.orderNo}`);
|
if (ticket.orderNo) lines.push(`订单号:${ticket.orderNo}`);
|
||||||
Taro.showModal({
|
// Taro.showModal({
|
||||||
title: '水票详情',
|
// title: '水票详情',
|
||||||
content: lines.join('\n'),
|
// content: lines.join('\n'),
|
||||||
showCancel: false
|
// showCancel: false
|
||||||
});
|
// });
|
||||||
};
|
};
|
||||||
|
|
||||||
const reloadTickets = async (isRefresh = true, keywords?: string) => {
|
const reloadTickets = async (isRefresh = true, keywords?: string) => {
|
||||||
@@ -348,7 +349,7 @@ const UserTicketList = () => {
|
|||||||
)}
|
)}
|
||||||
{item.createTime && (
|
{item.createTime && (
|
||||||
<View className="mt-1">
|
<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>
|
||||||
)}
|
)}
|
||||||
</View>
|
</View>
|
||||||
@@ -372,28 +373,17 @@ const UserTicketList = () => {
|
|||||||
</View>
|
</View>
|
||||||
|
|
||||||
<View className="mt-3 flex justify-between">
|
<View className="mt-3 flex justify-between">
|
||||||
<View className="flex flex-col">
|
<View className="flex flex-col items-center">
|
||||||
<Text className="text-xs text-gray-500">可用</Text>
|
<Text className="text-lg font-bold text-blue-600 text-center">{item.availableQty ?? 0}</Text>
|
||||||
<Text className="text-lg font-bold text-blue-600">{item.availableQty ?? 0}</Text>
|
<Text className="text-xs text-gray-500">可用水票</Text>
|
||||||
</View>
|
</View>
|
||||||
<View className="flex flex-col items-center">
|
<View className="flex flex-col items-center">
|
||||||
<Text className="text-xs text-gray-500">总量</Text>
|
<Text className="text-lg text-gray-900 text-center">{item.usedQty ?? 0}</Text>
|
||||||
<Text className="text-sm text-gray-900">{item.totalQty ?? 0}</Text>
|
<Text className="text-xs text-gray-500">已用水票</Text>
|
||||||
</View>
|
</View>
|
||||||
<View className="flex flex-col items-end">
|
<View className="flex flex-col items-center">
|
||||||
<Text className="text-xs text-gray-500">已用</Text>
|
<Text className="text-lg text-gray-900 text-center">{item.frozenQty ?? 0}</Text>
|
||||||
<Text className="text-sm text-gray-900">{item.usedQty ?? 0}</Text>
|
<Text className="text-xs text-gray-500">剩余赠票</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>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
@@ -426,7 +416,7 @@ const UserTicketList = () => {
|
|||||||
<View className="flex items-start justify-between">
|
<View className="flex items-start justify-between">
|
||||||
<View className="flex-1 pr-3">
|
<View className="flex-1 pr-3">
|
||||||
<Text className="text-base font-semibold text-gray-900">
|
<Text className="text-base font-semibold text-gray-900">
|
||||||
核销记录
|
票号:{item.userTicketId}
|
||||||
</Text>
|
</Text>
|
||||||
{item.createTime && (
|
{item.createTime && (
|
||||||
<View className="mt-1">
|
<View className="mt-1">
|
||||||
@@ -500,8 +490,8 @@ const UserTicketList = () => {
|
|||||||
{qrTicket && (
|
{qrTicket && (
|
||||||
<View className="bg-gray-50 rounded-lg p-3 mb-4">
|
<View className="bg-gray-50 rounded-lg p-3 mb-4">
|
||||||
<View className="flex justify-between mb-2">
|
<View className="flex justify-between mb-2">
|
||||||
<Text className="text-sm text-gray-600">水票</Text>
|
<Text className="text-sm text-gray-600">票号</Text>
|
||||||
<Text className="text-sm text-gray-900">{qrTicket.templateName || '水票'}</Text>
|
<Text className="text-sm text-gray-900">{qrTicket.id}</Text>
|
||||||
</View>
|
</View>
|
||||||
<View className="flex justify-between">
|
<View className="flex justify-between">
|
||||||
<Text className="text-sm text-gray-600">可用次数</Text>
|
<Text className="text-sm text-gray-600">可用次数</Text>
|
||||||
|
|||||||
Reference in New Issue
Block a user