main
lion 9 months ago
parent 6e1b40193c
commit 85f1123221

@ -7,13 +7,13 @@
<view class="info-item">
<text class="info-label">太湖</text>
<view class="info-value-group">
<text class="info-value"
<!-- <text class="info-value"
>水位深度:{{
statistics.taihu_to_xujiang
? statistics.taihu_to_xujiang.water_level
: "-"
}}m</text
>
> -->
<text class="info-value"
>吃水深度:{{
statistics.taihu_to_xujiang
@ -26,13 +26,13 @@
<view class="info-item">
<text class="info-label">胥江</text>
<view class="info-value-group">
<text class="info-value"
<!-- <text class="info-value"
>水位深度:{{
statistics.xujiang_to_taihu
? statistics.xujiang_to_taihu.water_level
: "-"
}}m</text
>
> -->
<text class="info-value"
>吃水深度:{{
statistics.xujiang_to_taihu

@ -380,7 +380,7 @@ export default {
this.fetchGeofenceByDirection();
}
},
async fetchGeofenceByDirection() {
async fetchGeofenceByDirection(showModal = true) {
const token = uni.getStorageSync('token');
if (!token || !this.direction) return;
try {
@ -403,17 +403,19 @@ export default {
}
// 检查用户位置是否在围栏范围内
this.checkLocationInGeofence(geofenceData);
this.checkLocationInGeofence(geofenceData, showModal);
}
} catch (e) {
// 可选:错误处理
this.isInGeofence = null;
}
},
// 检查用户位置是否在围栏范围内
checkLocationInGeofence(geofenceData) {
checkLocationInGeofence(geofenceData, showModal = true) {
// 检查用户位置是否存在
if (!this.userLocation || !this.userLocation.latitude || !this.userLocation.longitude) {
console.warn('用户位置信息不存在,无法进行范围判断');
this.isInGeofence = null;
return;
}
@ -434,13 +436,16 @@ export default {
}
}
// 如果遍历完所有围栏都不在范围内,设置状态为false并提示用户
// 如果遍历完所有围栏都不在范围内,设置状态为false
this.isInGeofence = false;
uni.showModal({
title: '提示',
content: '您的当前位置不在闸站可预约范围内',
showCancel: false
});
// 只有在选择方向时(showModal为true)才显示提示,提交时(showModal为false)不显示,由onReserve统一处理
if (showModal) {
uni.showModal({
title: '提示',
content: '您的当前位置不在闸站可预约范围内',
showCancel: false
});
}
},
// 判断点是否在多边形内(使用射线法)
isPointInPolygon(lng, lat, coordinates) {
@ -630,7 +635,7 @@ export default {
const found = this.shipTypeEnum.find(item => item.value === type || item.value == type);
return found ? found.label : type;
},
onReserve() {
async onReserve() {
if (!this.agreeNotice) {
uni.showToast({ title: '请先阅读并同意预约须知', icon: 'none' });
return;
@ -639,20 +644,64 @@ export default {
uni.showToast({ title: '请先选择航行方向', icon: 'none' });
return;
}
// 提交前再次检查用户位置是否在可预约范围内
// 如果用户位置不存在,先获取位置
if (!this.userLocation || !this.userLocation.latitude || !this.userLocation.longitude) {
uni.showLoading({ title: '正在获取位置...' });
// 重新获取位置
await new Promise((resolve) => {
this.getUserLocation();
// 等待位置获取完成(最多等待5秒)
let checkCount = 0;
const checkInterval = setInterval(() => {
checkCount++;
if (this.userLocation && this.userLocation.latitude && this.userLocation.longitude) {
clearInterval(checkInterval);
uni.hideLoading();
resolve();
} else if (checkCount >= 50) { // 5秒超时
clearInterval(checkInterval);
uni.hideLoading();
uni.showToast({ title: '获取位置失败,请重试', icon: 'none' });
resolve();
}
}, 100);
});
}
// 如果位置仍然不存在,提示用户
if (!this.userLocation || !this.userLocation.latitude || !this.userLocation.longitude) {
uni.showToast({ title: '无法获取位置信息,请检查位置权限', icon: 'none' });
return;
}
// 重新检查围栏范围(提交时不显示modal,由onReserve统一处理提示)
uni.showLoading({ title: '正在验证位置...' });
await this.fetchGeofenceByDirection(false);
uni.hideLoading();
// 检查是否在围栏范围内
if (this.isInGeofence === false) {
uni.showToast({ title: '您的当前位置不在闸站可预约范围内', icon: 'none' });
return;
}
// 如果检查状态为null(未检查或检查失败),也阻止提交
if (this.isInGeofence === null) {
uni.showToast({ title: '位置验证失败,请重试', icon: 'none' });
return;
}
const token = uni.getStorageSync('token');
if (!token) {
uni.showToast({ title: '请先登录', icon: 'none' });
return;
}
if (!this.currentShip || !this.currentShip.ship_number || !this.currentShip.id) {
uni.showToast({ title: '无效的船舶信息', icon: 'none' });
return;
}
// if (!this.currentShip || !this.currentShip.ship_number || !this.currentShip.id) {
// uni.showToast({ title: '无效的船舶信息', icon: 'none' });
// return;
// }
// direction: north->in, south->out
const directionValue = this.direction || 'in';

@ -1,2 +0,0 @@
<!DOCTYPE html><html lang=zh-CN><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><title>胥口闸站购票</title><script>var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') || CSS.supports('top: constant(a)'))
document.write('<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' + (coverSupport ? ', viewport-fit=cover' : '') + '" />')</script><link rel=stylesheet href=/h5/static/index.883130ca.css></head><body><noscript><strong>Please enable JavaScript to continue.</strong></noscript><div id=app></div><script src=/h5/static/js/chunk-vendors.f93c9f80.js></script><script src=/h5/static/js/index.5f04b5d5.js></script></body></html>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

File diff suppressed because one or more lines are too long

Binary file not shown.

Before

Width:  |  Height:  |  Size: 948 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 910 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 764 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.4 KiB

Loading…
Cancel
Save