diff --git a/src/api/shop/shopStoreRider/model/index.ts b/src/api/shop/shopStoreRider/model/index.ts index 26e51f4..0b7ed68 100644 --- a/src/api/shop/shopStoreRider/model/index.ts +++ b/src/api/shop/shopStoreRider/model/index.ts @@ -38,6 +38,10 @@ export interface ShopStoreRider { otherGoodsCommissionValue?: string; // 用户ID userId?: number; + // 经度(配送员当前位置) + longitude?: string; + // 纬度(配送员当前位置) + latitude?: string; // 备注 comments?: string; // 排序号 diff --git a/src/pages/index/index.tsx b/src/pages/index/index.tsx index d49297d..23ada98 100644 --- a/src/pages/index/index.tsx +++ b/src/pages/index/index.tsx @@ -1,9 +1,9 @@ -import Header from './Header' +// import Header from './Header' import Banner from './Banner' import Taro, { useDidShow, useShareAppMessage } from '@tarojs/taro' import { View, Text, Image, ScrollView } from '@tarojs/components' import { useEffect, useMemo, useState, type ReactNode } from 'react' -import { Cart, Gift, Ticket } from '@nutui/icons-react-taro' +import { Cart, Gift, Ticket, Agenda } from '@nutui/icons-react-taro' import { getShopInfo } from '@/api/layout' import { checkAndHandleInviteRelation, hasPendingInvite } from '@/utils/invite' import { pageShopGoods } from '@/api/shop/shopGoods' @@ -220,6 +220,15 @@ function Home() { Taro.navigateTo({ url: '/user/ticket/use?goodsId=10074' }) }, }, + { + key: 'order', + title: '送水订单', + icon: , + onClick: () => { + if (!ensureLoggedIn('/user/ticket/index')) return + Taro.navigateTo({ url: '/user/ticket/index' }) + }, + }, { key: 'invite', title: '邀请有礼', @@ -249,7 +258,7 @@ function Home() { return ( <> {/* Header区域 */} -
+ {/*
*/} {/* 顶部活动主视觉:使用 Banner 组件 */} diff --git a/src/user/ticket/orders/index.tsx b/src/user/ticket/orders/index.tsx index 40b61c4..7853b6f 100644 --- a/src/user/ticket/orders/index.tsx +++ b/src/user/ticket/orders/index.tsx @@ -21,6 +21,8 @@ import dayjs from 'dayjs' import { pageGltTicketOrder, updateGltTicketOrder } from '@/api/glt/gltTicketOrder' import type { GltTicketOrder, GltTicketOrderParam } from '@/api/glt/gltTicketOrder/model' import { uploadFile } from '@/api/system/file' +import { listShopStoreRider, updateShopStoreRider } from '@/api/shop/shopStoreRider' +import { getCurrentLngLat } from '@/utils/location' const PAGE_SIZE = 10 @@ -236,6 +238,37 @@ export default function TicketOrdersPage() { } setDeliverSubmitting(true) try { + // 送达时同步记录配送员当前位置(用于门店/后台跟踪骑手位置) + const loc = await getCurrentLngLat('确认送达需要记录您的当前位置,请在设置中开启定位权限后重试。') + if (!loc) return + + try { + // 优先按 userId 精确查找;后端若未支持该字段,会自动忽略,我们再做兜底。 + let riderRow = + (await listShopStoreRider({ userId: riderId, storeId: deliverOrder.storeId, status: 1 } as any)) + ?.find(r => String(r?.userId || '') === String(riderId || '')) || + null + + // 兜底:按门店筛选后再匹配 userId + if (!riderRow && deliverOrder.storeId) { + const list = await listShopStoreRider({ storeId: deliverOrder.storeId, status: 1 } as any) + riderRow = list?.find(r => String(r?.userId || '') === String(riderId || '')) || null + } + + if (riderRow?.id) { + await updateShopStoreRider({ + id: riderRow.id, + longitude: loc.lng, + latitude: loc.lat + } as any) + } else { + console.warn('未找到 ShopStoreRider 记录,无法更新骑手经纬度:', { riderId, storeId: deliverOrder.storeId }) + } + } catch (e) { + // 不阻塞送达流程,但记录日志便于排查。 + console.warn('更新 ShopStoreRider 经纬度失败:', e) + } + const now = dayjs().format('YYYY-MM-DD HH:mm:ss') // 送达时间:首次“确认送达”写入;补传照片时不要覆盖原送达时间 const deliveredAt = deliverOrder.sendEndTime || now