feat(lbs): 真实距离与按距离派单落地
- 数据库:orders/activities 新增 latitude/longitude(含存量表 ALTER 迁移) - 服务端:Haversine 计算 distanceKm/distanceText,派单池支持 lat/lng/radius 过滤并按距离升序;历史无坐标订单用腾讯地理编码兜底并回写缓存 - 新增 /api/lbs/reverse 逆地址解析(Key 仅服务端持有,登录 + 限流) - 小程序:雷达/接单大厅改用真实定位与真实距离,删除全部写死演示距离;下单页新增地图选点,组局页保存选点经纬度 - 修复接单大厅点接单会新建订单的问题,改为真正 claimOrder 认领 - 新增 lbs-distance 护栏(110 套件/729 用例全绿)
这个提交包含在:
@@ -121,7 +121,7 @@
|
||||
:key="zoneItem"
|
||||
class="zone-chip-item btn-active"
|
||||
:class="{ selected: form.location === zoneItem }"
|
||||
@click="form.location = zoneItem"
|
||||
@click="selectZone(zoneItem)"
|
||||
>
|
||||
{{ zoneItem.split(' ')[0] }}
|
||||
</view>
|
||||
@@ -380,6 +380,8 @@ const form = ref({
|
||||
title: '',
|
||||
startTime: '',
|
||||
location: '',
|
||||
latitude: null,
|
||||
longitude: null,
|
||||
maxParticipants: 4,
|
||||
aaFee: '',
|
||||
pricingMode: 'PER_PERSON',
|
||||
@@ -470,12 +472,20 @@ const selectQuickTime = (timeItem) => {
|
||||
}
|
||||
};
|
||||
|
||||
const selectZone = (zoneItem) => {
|
||||
form.value.location = zoneItem;
|
||||
form.value.latitude = null;
|
||||
form.value.longitude = null;
|
||||
};
|
||||
|
||||
const handleChooseLocation = () => {
|
||||
// #ifdef MP-WEIXIN || APP-PLUS
|
||||
uni.chooseLocation({
|
||||
success: (res) => {
|
||||
if (res && (res.name || res.address)) {
|
||||
form.value.location = res.name ? `${res.address ? res.address + ' ' : ''}${res.name}` : res.address;
|
||||
form.value.latitude = Number.isFinite(Number(res.latitude)) ? Number(res.latitude) : null;
|
||||
form.value.longitude = Number.isFinite(Number(res.longitude)) ? Number(res.longitude) : null;
|
||||
uni.showToast({ title: '已选取地点', icon: 'success' });
|
||||
}
|
||||
},
|
||||
@@ -483,7 +493,7 @@ const handleChooseLocation = () => {
|
||||
console.warn('[ActivityCreate] 地图选点取消或未授权:', err);
|
||||
// 若未授权或在H5/开发环境,平滑引导点选推荐公开商圈
|
||||
if (recommendPublicZones.value.length > 0) {
|
||||
form.value.location = recommendPublicZones.value[0];
|
||||
selectZone(recommendPublicZones.value[0]);
|
||||
uni.showToast({ title: '已填入推荐商圈', icon: 'none' });
|
||||
}
|
||||
}
|
||||
@@ -492,7 +502,7 @@ const handleChooseLocation = () => {
|
||||
|
||||
// #ifndef MP-WEIXIN || APP-PLUS
|
||||
if (recommendPublicZones.value.length > 0) {
|
||||
form.value.location = recommendPublicZones.value[0];
|
||||
selectZone(recommendPublicZones.value[0]);
|
||||
uni.showToast({ title: '已为您填入示范商圈', icon: 'none' });
|
||||
}
|
||||
// #endif
|
||||
@@ -647,6 +657,8 @@ const handleSubmit = async () => {
|
||||
maxParticipants: form.value.maxParticipants,
|
||||
startTime: trimmedTime,
|
||||
location: trimmedLocation,
|
||||
latitude: form.value.latitude,
|
||||
longitude: form.value.longitude,
|
||||
creatorNickname: cachedUser.nickname || '同城局长',
|
||||
creatorAvatar: cachedUser.avatar || 'https://images.unsplash.com/photo-1535713875002-d1d0cf377fde?w=150&h=150&fit=crop',
|
||||
};
|
||||
|
||||
在新工单中引用
屏蔽一个用户