|
|
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["pages-reservation-index"],{"00ec":function(e,t,n){"use strict";n.r(t);var i=n("64b0"),a=n.n(i);for(var o in i)["default"].indexOf(o)<0&&function(e){n.d(t,e,(function(){return i[e]}))}(o);t["default"]=a.a},"291a":function(e,t,n){var i=n("9098");i.__esModule&&(i=i.default),"string"===typeof i&&(i=[[e.i,i,""]]),i.locals&&(e.exports=i.locals);var a=n("967d").default;a("2fa82ad0",i,!0,{sourceMap:!1,shadowMode:!1})},4726:function(e,t,n){"use strict";n("6a54");var i=n("f5bd").default;Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a=i(n("5de6")),o=i(n("9b1b")),r=i(n("fcf3")),c=i(n("2634")),s=i(n("2fdc"));n("5c47"),n("0506"),n("c223"),n("bf0f"),n("e838"),n("aa9c"),n("8f71"),n("fd3c"),n("64aa"),n("95f8"),n("d4b5"),n("dc8a"),n("aa77"),n("f7a5");var u=i(n("efbe")),l=n("bd31"),d=i(n("409b")),f={name:"ReservationPage",geofenceToleranceMeters:1e3,geofenceAccuracyWarningMeters:1e3,components:{NavBar:u.default},data:function(){return{isWeixinBrowser:!1,direction:"",shipList:[],currentShip:{id:"",total_length:"",total_width:"",molded_depth:"",ship_number:"",total_tonnage:"",ship_type:""},directionEnum:[],shipTypeEnum:[],agreeNotice:!1,gateDate:"today",deadlineTimes:{toTaihu:"",toXujiang:""},isDateDisabled:!1,userLocation:null,isInGeofence:null,geofenceRequestSeq:0,geofenceDebug:{direction:"",locationSource:"",stage:"",result:null,message:"",updatedAt:"",location:null,rawGeofences:null,evaluations:[]},unitPrice:"",calculationDescription:""}},onLoad:function(){this.isWeixinBrowser=/MicroMessenger/i.test(navigator.userAgent)},onShow:function(){var e=this;return(0,s.default)((0,c.default)().mark((function t(){var n;return(0,c.default)().wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.next=2,e.fetchDirectionEnum();case 2:return t.next=4,e.fetchShipTypeEnum();case 4:return t.next=6,e.fetchShipList();case 6:if(n=t.sent,n){t.next=9;break}return t.abrupt("return");case 9:uni.showModal({title:"提示",content:"预约前需要先获取您的位置信息",showCancel:!0,confirmText:"确定",cancelText:"取消",success:function(t){t.confirm?e.getUserLocation():uni.showToast({title:"未获取位置信息,可能无法完成预约",icon:"none"})}}),e.fetchDailyReservationDeadline();case 11:case"end":return t.stop()}}),t)})))()},methods:{fetchUnitPrice:function(){var e=arguments,t=this;return(0,s.default)((0,c.default)().mark((function n(){var i,a,o,r,s;return(0,c.default)().wrap((function(n){while(1)switch(n.prev=n.next){case 0:if(i=e.length>0&&void 0!==e[0]?e[0]:"",a=uni.getStorageSync("token"),a){n.next=4;break}return n.abrupt("return");case 4:return o=i?"?token=".concat(a,"&ship_id=").concat(i):"?token=".concat(a),n.next=7,new Promise((function(e,t){uni.request({url:"".concat(l.API.GET_UNIT_PRICE).concat(o),method:"get",success:e,fail:t})}));case 7:r=n.sent,r.data&&0===r.data.errcode&&(s=r.data.data,t.unitPrice=s.price||"",t.calculationDescription=s.price_desc||"");case 9:case"end":return n.stop()}}),n)})))()},getUserLocation:function(){return this.isWeixinBrowser?(console.log("微信 H5 环境"),this.getWeixinLocation()):(console.log("普通 H5 环境"),this.getBrowserLocation())},handleLocationAccuracyNotice:function(e){var t=e&&"number"===typeof e.accuracy?e.accuracy:null;null!==t&&t>(this.$options.geofenceAccuracyWarningMeters||1e3)&&uni.showToast({title:"当前定位误差约".concat(t.toFixed(0),"米"),icon:"none",duration:2500})},refreshUserLocation:function(){var e=this;return(0,s.default)((0,c.default)().mark((function t(){var n;return(0,c.default)().wrap((function(t){while(1)switch(t.prev=t.next){case 0:return uni.showLoading({title:"重新获取定位..."}),t.next=3,e.getUserLocation();case 3:if(n=t.sent,uni.hideLoading(),n){t.next=8;break}return uni.showToast({title:"重新获取定位失败",icon:"none"}),t.abrupt("return");case 8:if(e.handleLocationAccuracyNotice(n),!e.direction){t.next=12;break}return t.next=12,e.fetchGeofenceByDirection({showModal:!1,direction:e.direction,location:n});case 12:case"end":return t.stop()}}),t)})))()},getWeixinLocation:function(){var e=this;return new Promise((function(t){console.log("[WeixinLocation] 调用 getWeixinLocation");var n=/MicroMessenger/i.test(navigator.userAgent);console.log("[WeixinLocation] 是否微信环境 isWeixinBrowser =",e.isWeixinBrowser,"UA检测 =",n?"是":"否");var i="undefined"!==typeof window&&!!window.wx,a="undefined"!==typeof d.default;console.log("[WeixinLocation] has window.wx =",i,", has module wx =",a);var o=i?window.wx:a?d.default:null;if(console.log("[WeixinLocation] wxObj =",o),!o)return console.error("微信 JS-SDK 未加载"),uni.showModal({title:"提示",content:"微信 JS-SDK 未加载,请刷新页面重试",showCancel:!1}),void t(null);console.log("[WeixinLocation] wxObj.version =",o.version,"typeof wxObj.config =",(0,r.default)(o.config),"typeof wxObj.ready =",(0,r.default)(o.ready),"typeof wxObj.getLocation =",(0,r.default)(o.getLocation)),"function"!==typeof o.config&&console.warn("[WeixinLocation] wx.config 未定义,说明微信JS-SDK可能还没有正确初始化,wx.ready 可能不会触发,请确认后端是否已下发 JSSDK 配置并在 App.vue 中调用 initWechatJSSDK"),"function"!==typeof o.getLocation&&console.warn("[WeixinLocation] wx.getLocation 不是函数,说明当前 JSSDK 可能未加载完整或未包含该接口"),"function"===typeof o.error?o.error((function(e){console.error("[WeixinLocation] wx.error 回调触发,JSSDK 配置或调用出错:",e)})):console.warn("[WeixinLocation] wx.error 不存在,无法捕获 JSSDK 配置错误");var c=!1;setTimeout((function(){c||console.warn("[WeixinLocation] 5 秒内 wx.ready 未回调,可能是 wx.config 未正确执行或签名错误")}),5e3),o.ready((function(){c=!0,console.log("[WeixinLocation] wx.ready 回调触发,开始调用 wx.getLocation"),o.getLocation({type:"gcj02",success:function(n){console.log("[WeixinLocation] wx.getLocation success 原始返回值:",n);var i={latitude:n.latitude,longitude:n.longitude,speed:n.speed,accuracy:n.accuracy};e.userLocation=i,e.updateGeofenceDebug({locationSource:"微信 JSSDK gcj02",location:i,message:"微信定位成功",stage:"定位完成"}),e.handleLocationAccuracyNotice(i),console.log("[WeixinLocation] 已保存 userLocation =",e.userLocation),t(i)},fail:function(n){console.error("[WeixinLocation] wx.getLocation fail:",n),e.updateGeofenceDebug({locationSource:"微信 JSSDK gcj02",location:null,result:null,message:"微信定位失败",stage:"定位失败"}),uni.showModal({title:"提示",content:"获取位置失败,请允许访问位置信息",showCancel:!1}),t(null)}})}))}))},getBrowserLocation:function(){var e=this;return new Promise((function(t){if("undefined"===typeof navigator||!navigator.geolocation)return uni.showModal({title:"提示",content:"您的浏览器不支持地理位置功能",showCancel:!1}),void t(null);navigator.geolocation.getCurrentPosition((function(n){var i={latitude:n.coords.latitude,longitude:n.coords.longitude,accuracy:n.coords.accuracy,altitude:n.coords.altitude,altitudeAccuracy:n.coords.altitudeAccuracy,heading:n.coords.heading,speed:n.coords.speed};e.userLocation=i,e.updateGeofenceDebug({locationSource:"浏览器 geolocation",location:i,message:"浏览器定位成功",stage:"定位完成"}),e.handleLocationAccuracyNotice(i),console.log("浏览器获取位置成功:",e.userLocation),t(i)}),(function(n){console.error("浏览器获取位置失败:",n),e.updateGeofenceDebug({locationSource:"浏览器 geolocation",location:null,result:null,message:"浏览器定位失败:"+(n&&n.message?n.message:"未知错误"),stage:"定位失败"});var i="获取位置失败";switch(n.code){case n.PERMISSION_DENIED:i="用户拒绝了位置请求";break;case n.POSITION_UNAVAILABLE:i="位置信息不可用";break;case n.TIMEOUT:i="获取位置超时";break}uni.showModal({title:"提示",content:i+",请允许访问位置信息",showCancel:!1}),t(null)}),{enableHighAccuracy:!0,timeout:1e4,maximumAge:0})}))},getMiniProgramLocation:function(){return Promise.resolve(null)},setDirection:function(e){if(this.direction=e,this.isInGeofence=null,this.updateGateDateByDirection(),e){var t=++this.geofenceRequestSeq;this.fetchGeofenceByDirection({direction:e,showModal:!0,requestSeq:t})}},fetchGeofenceByDirection:function(){var e=arguments,t=this;return(0,s.default)((0,c.default)().mark((function n(){var i,a,o,r,s,u,d,f,v,p,h,g,b;return(0,c.default)().wrap((function(n){while(1)switch(n.prev=n.next){case 0:if(i=e.length>0&&void 0!==e[0]?e[0]:{},a=i.showModal,o=void 0===a||a,r=i.direction,s=void 0===r?t.direction:r,u=i.location,d=void 0===u?t.userLocation:u,f=i.requestSeq,v=void 0===f?null:f,p=uni.getStorageSync("token"),p&&s){n.next=5;break}return n.abrupt("return",null);case 5:return t.updateGeofenceDebug({direction:s,stage:"请求围栏",location:d||null}),n.prev=6,n.next=9,new Promise((function(e,t){uni.request({url:"".concat(l.API.GET_GEOFENCE_BY_DIRECTION,"?token=").concat(p,"&direction=").concat(s),method:"GET",success:e,fail:t})}));case 9:if(h=n.sent,!h.data||0!==h.data.errcode){n.next=21;break}if(g=h.data.data,console.log(g),t.updateGeofenceDebug({direction:s,rawGeofences:g,stage:"围栏已返回",location:d||null,message:"获取到 ".concat(Array.isArray(g)?g.length:0," 个围栏")}),b=t.checkLocationInGeofence(g,{showModal:o,location:d,suppressStateUpdate:!0}),null===v||v===t.geofenceRequestSeq){n.next=17;break}return n.abrupt("return",b);case 17:if(s===t.direction){n.next=19;break}return n.abrupt("return",b);case 19:return t.isInGeofence=b,n.abrupt("return",b);case 21:n.next=28;break;case 23:return n.prev=23,n.t0=n["catch"](6),null!==v&&v!==t.geofenceRequestSeq||(t.isInGeofence=null),t.updateGeofenceDebug({direction:s,result:null,stage:"围栏请求失败",message:n.t0&&n.t0.message?n.t0.message:"围栏请求失败"}),n.abrupt("return",null);case 28:return n.abrupt("return",null);case 29:case"end":return n.stop()}}),n,null,[[6,23]])})))()},checkLocationInGeofence:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.showModal,i=void 0===n||n,a=t.location,r=void 0===a?this.userLocation:a;if(!r||!r.latitude||!r.longitude)return console.warn("用户位置信息不存在,无法进行范围判断"),this.updateGeofenceDebug({location:r||null,result:null,stage:"无法计算",message:"用户位置信息不存在,无法进行范围判断",evaluations:[]}),null;var c=parseFloat(r.latitude),s=parseFloat(r.longitude);if(!e||!Array.isArray(e)||0===e.length)return this.updateGeofenceDebug({location:r,rawGeofences:e,result:!0,stage:"围栏计算完成",message:"未配置围栏,默认放行",evaluations:[]}),!0;for(var u=[],l=0;l<e.length;l++){var d=e[l];if(d&&d.coordinates&&Array.isArray(d.coordinates)&&d.coordinates.length>0){var f=this.evaluatePointAgainstPolygon(s,c,d.coordinates);if(u.push((0,o.default)({geofenceId:d.id||null,geofenceName:d.name||"",pointCount:d.coordinates.length},f)),f.inside)return console.log("用户位置在围栏范围内"),this.updateGeofenceDebug({location:r,rawGeofences:e,result:!0,stage:"围栏计算完成",message:"命中围栏 ".concat(d.name||d.id||l+1),evaluations:u}),!0}}return this.updateGeofenceDebug({location:r,rawGeofences:e,result:!1,stage:"围栏计算完成",message:"未命中任何围栏",evaluations:u}),i&&uni.showModal({title:"提示",content:"您的当前位置不在闸站可预约范围内",showCancel:!1}),!1},isPointInPolygon:function(e,t,n){return this.evaluatePointAgainstPolygon(e,t,n).inside},evaluatePointAgainstPolygon:function(e,t,n){var i=this.$options.geofenceToleranceMeters||20;if(!n||n.length<3)return{inside:!1,toleranceMeters:i,polygonPointCount:0,onBoundary:!1,withinTolerance:!1,rayCastingInside:!1,minDistanceMeters:null};var a=n.map((function(e){return Array.isArray(e)&&e.length>=2?[parseFloat(e[0]),parseFloat(e[1])]:null})).filter((function(e){return null!==e}));if(a.length<3)return{inside:!1,toleranceMeters:i,polygonPointCount:a.length,onBoundary:!1,withinTolerance:!1,rayCastingInside:!1,minDistanceMeters:null};var o=this.inspectPolygonBoundary(e,t,a,i),r=this.isPointInsidePolygonByRayCasting(e,t,a);return{inside:o.onBoundary||o.withinTolerance||r,toleranceMeters:i,polygonPointCount:a.length,onBoundary:o.onBoundary,withinTolerance:o.withinTolerance,nearestSegmentIndex:o.nearestSegmentIndex,minDistanceMeters:o.minDistanceMeters,rayCastingInside:r}},isPointInsidePolygonByRayCasting:function(e,t,n){for(var i=!1,a=e,o=t,r=0,c=n.length-1;r<n.length;c=r++){var s=n[r][0],u=n[r][1],l=n[c][0],d=n[c][1],f=u>o!==d>o&&a<(l-s)*(o-u)/(d-u)+s;f&&(i=!i)}return i},isPointOnPolygonBoundary:function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:this.$options.geofenceToleranceMeters||20,a=this.inspectPolygonBoundary(e,t,n,i);return a.onBoundary||a.withinTolerance},inspectPolygonBoundary:function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:this.$options.geofenceToleranceMeters||20;if(!n||n.length<2)return{onBoundary:!1,withinTolerance:!1,minDistanceMeters:null,nearestSegmentIndex:null};for(var a=null,o=null,r=0,c=n.length-1;r<n.length;c=r++){var s=n[c],u=n[r];if(!(!s||!u||s.length<2||u.length<2)){if(this.isPointOnSegment(e,t,s[0],s[1],u[0],u[1]))return{onBoundary:!0,withinTolerance:!0,minDistanceMeters:0,nearestSegmentIndex:r};var l=this.getDistanceToSegmentMeters(e,t,s[0],s[1],u[0],u[1]);(null===a||l<a)&&(a=l,o=r)}}return{onBoundary:!1,withinTolerance:null!==a&&a<=i,minDistanceMeters:null!==a?Number(a.toFixed(3)):null,nearestSegmentIndex:o}},isPointOnSegment:function(e,t,n,i,a,o){var r=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1e-10,c=(e-n)*(o-i)-(t-i)*(a-n);if(Math.abs(c)>r)return!1;var s=(e-n)*(a-n)+(t-i)*(o-i);if(s<-r)return!1;var u=(a-n)*(a-n)+(o-i)*(o-i);return s<=u+r},getDistanceToSegmentMeters:function(e,t,n,i,a,o){var r=(t+i+o)/3*Math.PI/180,c=111320*Math.cos(r),s=n*c,u=111320*i,l=a*c,d=111320*o,f=e*c,v=111320*t,p=l-s,h=d-u;if(Math.abs(p)<1e-9&&Math.abs(h)<1e-9)return Math.hypot(f-s,v-u);var g=((f-s)*p+(v-u)*h)/(p*p+h*h);g=Math.max(0,Math.min(1,g));var b=s+g*p,x=u+g*h;return Math.hypot(f-b,v-x)},updateGeofenceDebug:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.geofenceDebug=(0,o.default)((0,o.default)((0,o.default)({},this.geofenceDebug),e),{},{updatedAt:(new Date).toLocaleString()})},formatDebug:function(e){if(null===e||"undefined"===typeof e)return"null";try{return JSON.stringify(e,null,2)}catch(t){return String(e)}},fetchDailyReservationDeadline:function(){var e=this;return(0,s.default)((0,c.default)().mark((function t(){var n,i,a;return(0,c.default)().wrap((function(t){while(1)switch(t.prev=t.next){case 0:if(n=uni.getStorageSync("token"),n){t.next=3;break}return t.abrupt("return");case 3:return t.prev=3,t.next=6,new Promise((function(e,t){uni.request({url:"".concat(l.API.GET_DAILY_RESERVATION_DEADLINE,"?token=").concat(n),method:"GET",success:e,fail:t})}));case 6:i=t.sent,i.data&&0===i.data.errcode&&(a=i.data.data,a&&(e.deadlineTimes={toTaihu:a.deadline_time_to_taihu||"",toXujiang:a.deadline_time_to_xujiang||""},e.updateGateDateByDirection())),t.next=12;break;case 10:t.prev=10,t.t0=t["catch"](3);case 12:case"end":return t.stop()}}),t,null,[[3,10]])})))()},getDeadlineTimeByDirection:function(e){return"out"===e?this.deadlineTimes.toTaihu:"in"===e?this.deadlineTimes.toXujiang:""},updateGateDateByDirection:function(){var e=this.getDeadlineTimeByDirection(this.direction);e?this.checkDeadlineAndSetDate(e):this.isDateDisabled=!1},checkDeadlineAndSetDate:function(e){if(e){var t=new Date,n=t.getHours(),i=t.getMinutes(),o=e.split(":").map(Number),r=(0,a.default)(o,2),c=r[0],s=r[1],u=60*n+i,l=60*c+s;this.gateDate=u>=l?"tomorrow":"today",this.isDateDisabled=!0}},fetchShipList:function(){var e=this;return(0,s.default)((0,c.default)().mark((function t(){var n,i,a;return(0,c.default)().wrap((function(t){while(1)switch(t.prev=t.next){case 0:if(n=uni.getStorageSync("token"),n){t.next=4;break}return uni.showToast({title:"请先登录",icon:"none"}),t.abrupt("return",!1);case 4:return t.prev=4,t.next=7,new Promise((function(e,t){uni.request({url:"".concat(l.API.AVAILABLE_SHIPS,"?token=").concat(n),method:"GET",success:e,fail:t})}));case 7:if(i=t.sent,!i.data||0!==i.data.errcode){t.next=27;break}if(a=Array.isArray(i.data.data)?i.data.data.map((function(t){return e.normalizeShip(t)})):[],e.shipList=a,a.length){t.next=15;break}return uni.showToast({title:"暂无船舶信息",icon:"none",duration:1500}),setTimeout((function(){uni.redirectTo({url:"/pages/index/ship_manage"})}),1e3),t.abrupt("return",!1);case 15:if(1!==a.length){t.next=21;break}return e.currentShip=a[0],t.next=19,e.fetchUnitPrice(e.currentShip.id);case 19:t.next=24;break;case 21:e.currentShip=e.emptyShip(),e.unitPrice="",e.calculationDescription="";case 24:return t.abrupt("return",!0);case 27:return uni.showToast({title:i.data&&i.data.errmsg||"获取船舶信息失败",icon:"none"}),t.abrupt("return",!1);case 29:t.next=35;break;case 31:return t.prev=31,t.t0=t["catch"](4),uni.showToast({title:"网络错误",icon:"none"}),t.abrupt("return",!1);case 35:case"end":return t.stop()}}),t,null,[[4,31]])})))()},fetchDirectionEnum:function(){var e=this;return(0,s.default)((0,c.default)().mark((function t(){var n,i;return(0,c.default)().wrap((function(t){while(1)switch(t.prev=t.next){case 0:if(n=uni.getStorageSync("token"),n){t.next=3;break}return t.abrupt("return");case 3:return t.prev=3,t.next=6,new Promise((function(e,t){uni.request({url:"".concat(l.API.GET_DIRECTION_ENUM,"?token=").concat(n),method:"GET",success:e,fail:t})}));case 6:i=t.sent,i.data&&0===i.data.errcode&&(e.directionEnum=Object.keys(i.data.data).map((function(e){return{label:e,value:i.data.data[e]}}))),t.next=12;break;case 10:t.prev=10,t.t0=t["catch"](3);case 12:case"end":return t.stop()}}),t,null,[[3,10]])})))()},fetchShipTypeEnum:function(){var e=this;return(0,s.default)((0,c.default)().mark((function t(){var n,i,a;return(0,c.default)().wrap((function(t){while(1)switch(t.prev=t.next){case 0:if(n=uni.getStorageSync("token"),n){t.next=3;break}return t.abrupt("return");case 3:return t.prev=3,t.next=6,new Promise((function(e,t){uni.request({url:"".concat(l.API.SHIP_PROPERTY_ENUM,"?token=").concat(n),method:"GET",success:e,fail:t})}));case 6:i=t.sent,i.data&&0===i.data.errcode&&(a=i.data.data.ship_type||{},Array.isArray(a)?e.shipTypeEnum=a:e.shipTypeEnum=Object.keys(a).map((function(e){return{label:e,value:a[e]}}))),t.next=12;break;case 10:t.prev=10,t.t0=t["catch"](3);case 12:case"end":return t.stop()}}),t,null,[[3,10]])})))()},normalizeShip:function(e){return{id:e.id,total_length:e.total_length,total_width:e.total_width,molded_depth:e.molded_depth,ship_number:e.ship_number,total_tonnage:e.total_tonnage,ship_type:e.ship_type}},emptyShip:function(){return{id:"",total_length:"",total_width:"",molded_depth:"",ship_number:"",total_tonnage:"",ship_type:""}},confirmShipSelection:function(e){var t=this,n=this.normalizeShip(e);uni.showModal({title:"确认船舶",content:"本次预约将使用船舶“".concat(n.ship_number,"”,请确认是否继续?"),confirmText:"确认",cancelText:"重选",success:function(){var e=(0,s.default)((0,c.default)().mark((function e(i){return(0,c.default)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:if(i.confirm){e.next=2;break}return e.abrupt("return");case 2:return t.currentShip=n,e.next=5,t.fetchUnitPrice(n.id);case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()})},getShipTypeName:function(e){var t=this.shipTypeEnum.find((function(t){return t.value===e||t.value==e}));return t?t.label:e},formatPrice:function(e){if(""===e||null===e||"undefined"===typeof e)return"";var t=Number(e);return Number.isNaN(t)?e:t.toFixed(2)},onReserve:function(){var e=this;return(0,s.default)((0,c.default)().mark((function t(){var n,i,a,o,s,u,d,f;return(0,c.default)().wrap((function(t){while(1)switch(t.prev=t.next){case 0:if(e.currentShip.id){t.next=3;break}return uni.showToast({title:"请先选择船舶",icon:"none"}),t.abrupt("return");case 3:if(e.agreeNotice){t.next=6;break}return uni.showToast({title:"请先阅读并同意预约须知",icon:"none"}),t.abrupt("return");case 6:if(e.direction){t.next=9;break}return uni.showToast({title:"请先选择航行方向",icon:"none"}),t.abrupt("return");case 9:return uni.showLoading({title:"正在获取位置..."}),t.next=12,e.getUserLocation();case 12:if(n=t.sent,uni.hideLoading(),n&&n.latitude&&n.longitude){t.next=17;break}return uni.showToast({title:"无法获取位置信息,请检查位置权限",icon:"none"}),t.abrupt("return");case 17:return uni.showLoading({title:"正在验证位置..."}),t.next=20,e.fetchGeofenceByDirection({showModal:!1,direction:e.direction,location:n});case 20:if(i=t.sent,uni.hideLoading(),!1!==i){t.next=25;break}return uni.showToast({title:"您的当前位置不在闸站可预约范围内",icon:"none"}),t.abrupt("return");case 25:if(null!==i){t.next=28;break}return uni.showToast({title:"位置验证失败,请重试",icon:"none"}),t.abrupt("return");case 28:if(a=uni.getStorageSync("token"),a){t.next=32;break}return uni.showToast({title:"请先登录",icon:"none"}),t.abrupt("return");case 32:o=e.direction||"in",s="",u=new Date,"today"===e.gateDate?s=u.toISOString().slice(0,10):"tomorrow"===e.gateDate&&(d=new Date(u),d.setDate(u.getDate()+1),s=d.toISOString().slice(0,10)),f={token:a,ship_id:e.currentShip.id,direction:o,passage_date:s},n&&n.latitude&&n.longitude&&(f.latitude=n.latitude,f.longitude=n.longitude),uni.showLoading({title:"提交中..."}),uni.request({url:"".concat(l.API.RESERVATION_CREATE),method:"POST",data:f,success:function(e){if(uni.hideLoading(),e.data&&0===e.data.errcode)uni.showToast({title:"预约成功",icon:"success"}),setTimeout((function(){uni.switchTab({url:"/pages/order/index"})}),800);else{var t=e.data||{},n=t.data||{},i="";if(n&&"object"===(0,r.default)(n)){var a=[];Array.isArray(n.latitude)&&n.latitude.length&&a.push("纬度:".concat(n.latitude.join(","))),Array.isArray(n.longitude)&&n.longitude.length&&a.push("经度:".concat(n.longitude.join(","))),a.length&&(i=a.join(";"))}i||(i=t.errmsg||"预约失败"),uni.showModal({title:"提示",content:i,showCancel:!1})}},fail:function(){uni.hideLoading(),uni.showToast({title:"网络错误",icon:"none"})}});case 40:case"end":return t.stop()}}),t)})))()},toggleAgreeNotice:function(){this.agreeNotice=!this.agreeNotice},setGateDate:function(e){this.isDateDisabled||(this.gateDate=e)}}};t.default=f},"561e":function(e,t,n){"use strict";n.d(t,"b",(function(){return i})),n.d(t,"c",(function(){return a})),n.d(t,"a",(function(){}));var i=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("v-uni-view",{staticClass:"nav-bar",style:{paddingTop:e.statusBarHeight+"px"}},[n("v-uni-view",{staticClass:"nav-content"},[n("v-uni-image",{staticClass:"back-btn",attrs:{src:"/static/back.png",mode:"aspectFit"},on:{click:function(t){arguments[0]=t=e.$handleEvent(t),e.onBack.apply(void 0,arguments)}}}),n("v-uni-text",{staticClass:"nav-title"},[e._v(e._s(e.title))]),n("v-uni-view",{staticClass:"right-slot"},[e._t("right")],2)],1),e._t("default")],2)},a=[]},5759:function(e,t,n){"use strict";n.r(t);var i=n("4726"),a=n.n(i);for(var o in i)["default"].indexOf(o)<0&&function(e){n.d(t,e,(function(){return i[e]}))}(o);t["default"]=a.a},"64b0":function(e,t,n){"use strict";n("6a54"),Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i={props:{title:{type:String,default:""}},data:function(){return{statusBarHeight:0}},mounted:function(){this.statusBarHeight=uni.getSystemInfoSync().statusBarHeight||0},methods:{onBack:function(){console.log("onBack"),uni.navigateBack()}}};t.default=i},"74ae":function(e,t,n){"use strict";var i=n("7e4e"),a=n.n(i);a.a},7645:function(e,t,n){"use strict";var i=n("291a"),a=n.n(i);a.a},"7e4e":function(e,t,n){var i=n("9f4f");i.__esModule&&(i=i.default),"string"===typeof i&&(i=[[e.i,i,""]]),i.locals&&(e.exports=i.locals);var a=n("967d").default;a("29688353",i,!0,{sourceMap:!1,shadowMode:!1})},9098:function(e,t,n){var i=n("c86c");t=i(!1),t.push([e.i,".nav-bar[data-v-28453a18]{background:transparent}.nav-content[data-v-28453a18]{display:flex;align-items:center;justify-content:space-between;height:44px;padding:0 16px}.back-btn[data-v-28453a18]{width:16px;height:16px;display:flex;align-items:center;justify-content:center}.nav-title[data-v-28453a18]{font-size:16px;font-weight:400;color:#222;flex:1;text-align:center}.right-slot[data-v-28453a18]{min-width:24px}",""]),e.exports=t},"95f8":function(e,t,n){"use strict";var i=n("8bdb"),a=Math.hypot,o=Math.abs,r=Math.sqrt,c=!!a&&a(1/0,NaN)!==1/0;i({target:"Math",stat:!0,arity:2,forced:c},{hypot:function(e,t){var n,i,a=0,c=0,s=arguments.length,u=0;while(c<s)n=o(arguments[c++]),u<n?(i=u/n,a=a*i*i+1,u=n):n>0?(i=n/u,a+=i*i):a+=n;return u===1/0?1/0:u*r(a)}})},"9b42":function(e,t,n){"use strict";n.r(t);var i=n("e27c"),a=n("5759");for(var o in a)["default"].indexOf(o)<0&&function(e){n.d(t,e,(function(){return a[e]}))}(o);n("74ae");var r=n("828b"),c=Object(r["a"])(a["default"],i["b"],i["c"],!1,null,"4c55758e",null,!1,i["a"],void 0);t["default"]=c.exports},"9f4f":function(e,t,n){var i=n("c86c");t=i(!1),t.push([e.i,'@charset "UTF-8";\n/* 颜色变量 */\n/* 行为相关颜色 */\n/* 文字基本颜色 */\n/* 背景颜色 */\n/* 边框颜色 */\n/* 尺寸变量 */\n/* 文字尺寸 */\n/* 图片尺寸 */\n/* Border Radius */\n/* 水平间距 */\n/* 垂直间距 */\n/* 透明度 */\n/* 文章场景相关 */\n/* uni.scss */.reservation-page[data-v-4c55758e]{background:linear-gradient(180deg,#cbe6ff,#f6faff);min-height:100vh;padding-bottom:%?140?%;padding-top:90px;font-family:SourceHanSansCN,PingFang SC,Microsoft YaHei,sans-serif}.wechat-browser[data-v-4c55758e]{padding-top:10px}.fixed-nav[data-v-4c55758e]{position:fixed;top:0;left:0;right:0;z-index:100;background:linear-gradient(180deg,#cbe6ff,#f6faff);box-shadow:0 2px 8px rgba(0,0,0,.04)}.header[data-v-4c55758e]{display:flex;align-items:center;justify-content:space-between;padding:20px 16px 10px 16px;background:linear-gradient(180deg,#cbe6ff,#f6faff);padding-top:7vh}.back-btn[data-v-4c55758e], .more-btn[data-v-4c55758e]{font-size:24px;color:#333}.title[data-v-4c55758e]{font-size:22px;font-weight:700;color:#222}.card[data-v-4c55758e]{background:#fff;border-radius:18px;margin:0 16px 16px 16px;box-shadow:0 2px 8px rgba(0,0,0,.04);padding:18px 18px 12px 18px;margin-top:20px}.card-title[data-v-4c55758e]{font-size:16px;font-weight:600;margin-bottom:12px;color:#222}.ship-selector-list[data-v-4c55758e]{display:flex;flex-direction:column;gap:%?12?%}.ship-selector-tip[data-v-4c55758e]{margin-bottom:%?16?%;padding:%?16?% %?20?%;border-radius:%?16?%;background:rgba(255,186,73,.16);color:#9a5a00;font-size:%?24?%}.ship-selector-item[data-v-4c55758e]{display:flex;align-items:center;justify-content:space-between;padding:%?20?% %?24?%;border-radius:%?20?%;background:#f5f8fc;border:%?2?% solid transparent}.ship-selector-item.active[data-v-4c55758e]{border-color:#217aff;background:rgba(33,122,255,.08)}.ship-selector-main[data-v-4c55758e]{display:flex;flex-direction:column}.ship-selector-name[data-v-4c55758e]{font-size:%?30?%;font-weight:600;color:#222}.ship-selector-meta[data-v-4c55758e]{margin-top:%?8?%;font-size:%?24?%;color:#7b8794}.ship-selector-check[data-v-4c55758e]{color:#217aff;font-size:%?24?%;font-weight:600}.location-refresh-btn[data-v-4c55758e]{margin-top:%?20?%;height:%?76?%;line-height:%?76?%;border-radius:%?999?%;background:#fff7ed;color:#c2410c;border:%?1?% solid #fff7ed;font-size:%?26?%}.location-refresh-btn--standalone[data-v-4c55758e]{display:block;width:calc(100% - %?64?%);margin:%?20?% %?32?% 0}.water-info-row[data-v-4c55758e]{display:flex;justify-content:center;align-items:flex-start;width:-webkit-fit-content;width:fit-content;margin:0 auto;gap:%?150?%}.water-info-col[data-v-4c55758e]{display:flex;flex-direction:column;align-items:flex-start;text-align:left}.label[data-v-4c55758e]{color:#888;font-size:15px;margin-bottom:2px;text-align:left}.value.blue[data-v-4c55758e]{color:#217aff;font-size:14px;text-align:left}.info-list[data-v-4c55758e]{border-top:1px solid #f0f0f0}.info-row[data-v-4c55758e]{display:flex;justify-content:space-between;align-items:center;padding:12px 0;border-bottom:1px solid #f0f0f0}.info-row[data-v-4c55758e]:last-child{border-bottom:none}.info-label[data-v-4c55758e]{color:#222;font-size:16px}.info-value[data-v-4c55758e]{color:#222;font-size:16px;display:flex;align-items:center}.arrow[data-v-4c55758e]{color:#bdbdbd;font-size:18px;margin-left:4px}.direction-row[data-v-4c55758e], .batch-row[data-v-4c55758e]{display:flex;margin-bottom:8px;justify-content:center}.direction-btn[data-v-4c55758e], .batch-btn[data-v-4c55758e]{border:none;border-radius:24px;padding:0;font-size:14px;background:#f2f6fa;color:#888;height:24px;width:110px;display:flex;align-items:center;justify-content:center;margin:0 %?20?%;border:none;outline:none}.direction-btn[data-v-4c55758e]::after, .batch-btn[data-v-4c55758e]::after{border:none}.direction-btn.active[data-v-4c55758e], .batch-btn.active[data-v-4c55758e]{background:#217aff;color:#fff}.direction-btn[data-v-4c55758e]:disabled{opacity:.6;pointer-events:none}.direction-btn.tomorrow-default[data-v-4c55758e]{background:linear-gradient(90deg,#ffb980,#ffc99a)!important;color:#fff}.notice-row[data-v-4c55758e]{margin:24px 16px 0 16px}.notice-title[data-v-4c55758e]{font-size:14px;font-weight:600;margin-bottom:8px;color:#222}.notice-check[data-v-4c55758e]{display:flex;align-items:center;margin-top:8px;font-size:13px;color:#888}.tabbar[data-v-4c55758e]{position:fixed;left:0;right:0;bottom:0;height:60px;background:#fff;display:flex;border-top:1px solid #eaeaea;z-index:10}.tab-item[data-v-4c55758e]{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;color:#888;font-size:14px}.tab-item.active[data-v-4c55758e]{color:#217aff}.icon[data-v-4c55758e]{font-size:22px;margin-bottom:2px}.reservation-bottom-bar[data-v-4c55758e]{position:fixed;left:0;right:0;bottom:0;background:#fcfcfc;box-shadow:0 %?-2?% %?16?% rgba(59,124,255,.08);padding:%?24?% %?24?% %?32?% %?24?%;z-index:999;display:flex;justify-content:center}.reservation-btn[data-v-4c55758e]{min-width:%?320?%;height:%?80?%;border-radius:%?40?%;background:#217aff;color:#fff;font-size:%?32?%;font-weight:500;border:none;outline:none;box-shadow:0 %?4?% %?16?% rgba(33,122,255,.08);transition:background .2s}.reservation-scroll[data-v-4c55758e]{padding-bottom:%?80?%}.date-btn.active[data-v-4c55758e]{background:#217aff;color:#fff}.price-info-section[data-v-4c55758e]{background:#fff;border-radius:18px;margin:0 16px 16px 16px;box-shadow:0 2px 8px rgba(0,0,0,.04);padding:18px 18px 12px 18px;margin-top:20px}.price-info-item[data-v-4c55758e]{display:flex;align-items:flex-start;margin-bottom:12px;font-size:14px}.price-info-item[data-v-4c55758e]:last-child{margin-bottom:0}.price-label[data-v-4c55758e]{color:#666;min-width:100px;flex-shrink:0}.price-value[data-v-4c55758e]{color:#217aff;font-weight:600;flex:1}.price-desc[data-v-4c55758e]{color:#222;flex:1;line-height:1.6}',""]),e.exports=t},e27c:function(e,t,n){"use strict";n.d(t,"b",(function(){return i})),n.d(t,"c",(function(){return a})),n.d(t,"a",(function(){}));var i=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("v-uni-view",{staticClass:"reservation-page",class:{"wechat-browser":e.isWeixinBrowser}},[e.isWeixinBrowser?e._e():n("v-uni-view",{staticClass:"fixed-nav"},[n("NavBar",{attrs:{title:"过闸预约"}})],1),n("v-uni-view",{staticClass:"reservation-scroll"},[e.shipList.length>1?n("v-uni-view",{staticClass:"card"},[n("v-uni-view",{staticClass:"card-title"},[e._v("选择船舶")]),e.currentShip.id?e._e():n("v-uni-view",{staticClass:"ship-selector-tip"},[e._v("请先选择本次预约要使用的船舶")]),n("v-uni-view",{staticClass:"ship-selector-list"},e._l(e.shipList,(function(t){return n("v-uni-view",{key:t.id,staticClass:"ship-selector-item",class:{active:e.currentShip.id===t.id},on:{click:function(n){arguments[0]=n=e.$handleEvent(n),e.confirmShipSelection(t)}}},[n("v-uni-view",{staticClass:"ship-selector-main"},[n("v-uni-text",{staticClass:"ship-selector-name"},[e._v(e._s(t.ship_number))]),n("v-uni-text",{staticClass:"ship-selector-meta"},[e._v(e._s(t.total_tonnage)+"吨 / "+e._s(e.getShipTypeName(t.ship_type)))])],1),e.currentShip.id===t.id?n("v-uni-text",{staticClass:"ship-selector-check"},[e._v("已选")]):e._e()],1)})),1)],1):e._e(),n("v-uni-view",{staticClass:"card"},[n("v-uni-view",{staticClass:"card-title"},[e._v("船舶信息")]),n("v-uni-view",{staticClass:"info-list"},[n("v-uni-view",{staticClass:"info-row"},[n("v-uni-text",{staticClass:"info-label"},[e._v("编号")]),n("v-uni-view",{staticClass:"info-value"},[e._v(e._s(e.currentShip.ship_number)+" "),n("v-uni-text",{staticClass:"arrow"},[e._v("›")])],1)],1),n("v-uni-view",{staticClass:"info-row"},[n("v-uni-text",{staticClass:"info-label"},[e._v("总长度")]),n("v-uni-view",{staticClass:"info-value"},[e._v(e._s(e.currentShip.total_length)+"米 "),n("v-uni-text",{staticClass:"arrow"},[e._v("›")])],1)],1),n("v-uni-view",{staticClass:"info-row"},[n("v-uni-text",{staticClass:"info-label"},[e._v("型宽")]),n("v-uni-view",{staticClass:"info-value"},[e._v(e._s(e.currentShip.total_width)+"米 "),n("v-uni-text",{staticClass:"arrow"},[e._v("›")])],1)],1),n("v-uni-view",{staticClass:"info-row"},[n("v-uni-text",{staticClass:"info-label"},[e._v("型深")]),n("v-uni-view",{staticClass:"info-value"},[e._v(e._s(e.currentShip.molded_depth)+"米 "),n("v-uni-text",{staticClass:"arrow"},[e._v("›")])],1)],1),n("v-uni-view",{staticClass:"info-row"},[n("v-uni-text",{staticClass:"info-label"},[e._v("载重吨位")]),n("v-uni-view",{staticClass:"info-value"},[e._v(e._s(e.currentShip.total_tonnage)+"吨 "),n("v-uni-text",{staticClass:"arrow"},[e._v("›")])],1)],1),n("v-uni-view",{staticClass:"info-row",staticStyle:{"align-items":"flex-start"}},[n("v-uni-text",{staticClass:"info-label"},[e._v("单次过闸收费")]),n("v-uni-view",{staticClass:"info-value",staticStyle:{width:"50%","text-align":"right","flex-wrap":"wrap"}},[n("v-uni-view",{staticStyle:{"text-align":"right",width:"100%"}},[e._v(e._s(e.formatPrice(e.unitPrice))+"元")]),e._v(e._s(e.calculationDescription)+" ")],1)],1),n("v-uni-view",{staticClass:"info-row"},[n("v-uni-text",{staticClass:"info-label"},[e._v("类型")]),n("v-uni-view",{staticClass:"info-value"},[e._v(e._s(e.getShipTypeName(e.currentShip.ship_type))+" "),n("v-uni-text",{staticClass:"arrow"},[e._v("›")])],1)],1)],1)],1),n("v-uni-view",{staticClass:"card"},[n("v-uni-view",{staticClass:"card-title"},[e._v("航行方向")]),n("v-uni-view",{staticClass:"direction-row"},e._l(e.directionEnum,(function(t){return n("v-uni-button",{key:t.value,staticClass:"direction-btn",class:{active:e.direction===t.value},on:{click:function(n){arguments[0]=n=e.$handleEvent(n),e.setDirection(t.value)}}},[e._v(" "+e._s(t.label)+" ")])})),1)],1),n("v-uni-button",{staticClass:"location-refresh-btn location-refresh-btn--standalone",on:{click:function(t){arguments[0]=t=e.$handleEvent(t),e.refreshUserLocation.apply(void 0,arguments)}}},[e._v("重新获取定位")]),n("v-uni-view",{staticClass:"card"},[n("v-uni-view",{staticClass:"card-title"},[e._v("过闸日期")]),n("v-uni-view",{staticClass:"direction-row"},[n("v-uni-button",{staticClass:"direction-btn",class:{active:"today"===e.gateDate},attrs:{disabled:e.isDateDisabled},on:{click:function(t){arguments[0]=t=e.$handleEvent(t),e.setGateDate("today")}}},[e._v("今天")]),n("v-uni-button",{staticClass:"direction-btn",class:{active:"tomorrow"===e.gateDate,"tomorrow-default":"tomorrow"===e.gateDate&&e.isDateDisabled},attrs:{disabled:e.isDateDisabled},on:{click:function(t){arguments[0]=t=e.$handleEvent(t),e.setGateDate("tomorrow")}}},[e._v("明天")])],1)],1),n("v-uni-view",{staticClass:"notice-row"},[n("v-uni-text",{staticClass:"notice-title"},[e._v("预约须知")]),n("v-uni-view",{staticClass:"notice-check",staticStyle:{position:"relative"}},[n("v-uni-checkbox",{attrs:{checked:e.agreeNotice}}),n("v-uni-text",[e._v("我已阅读并同意《过闸预约服务协议》")]),n("v-uni-view",{staticStyle:{position:"absolute",left:"0",top:"0",right:"0",bottom:"0","z-index":"2"},on:{click:function(t){arguments[0]=t=e.$handleEvent(t),e.toggleAgreeNotice.apply(void 0,arguments)}}})],1)],1)],1),n("v-uni-view",{staticClass:"reservation-bottom-bar"},[n("v-uni-button",{staticClass:"reservation-btn",on:{click:function(t){arguments[0]=t=e.$handleEvent(t),e.onReserve.apply(void 0,arguments)}}},[e._v("预约")])],1)],1)},a=[]},efbe:function(e,t,n){"use strict";n.r(t);var i=n("561e"),a=n("00ec");for(var o in a)["default"].indexOf(o)<0&&function(e){n.d(t,e,(function(){return a[e]}))}(o);n("7645");var r=n("828b"),c=Object(r["a"])(a["default"],i["b"],i["c"],!1,null,"28453a18",null,!1,i["a"],void 0);t["default"]=c.exports}}]); |