2 lines
18 KiB
JavaScript
2 lines
18 KiB
JavaScript
import{_ as e,m as t,L as a,M as l,l as r,k as s,N as i,O as n,G as o,H as d,o as u,c,w as p,i as h,P as f,Q as m,R as y,e as g,f as C,t as x,A as _,B as w,g as b,h as k}from"./index-a09151d6.js";import{_ as D}from"./aure-country-picker.01cea584.js";import{A as T}from"./AppServer.888fd24d.js";import{_ as E}from"./ic_back.5440bd15.js";import{_ as A}from"./arrow_down.807172e3.js";import{_ as F}from"./arrow_right2.8bd5bd0f.js";const v=new T;const V=e({data:()=>({serviceId:"",serviceTitle:"",userName:"",userWechat:"",userPhone:"",userWhats:"",remark:"",departureDate:"",returnDate:"",departureCity:"",arrivalCity:"",luggageCount:"",adultCount:0,childCount:0,infantCount:0,calendarType:"departure",tripType:"single",tripTypeIndex:0,submitting:!1,tripTypeColumns:[[{label:"单程",value:"single"},{label:"往返",value:"round"}]],cabinType:"economy",cabinTypeIndex:0,cabinTypeColumns:[[{label:"经济舱",value:"economy"},{label:"超级经济舱",value:"premium_economy"},{label:"商务舱",value:"business"}]],flashingField:"",selectedDialCode:"86",showCalendar:!1,showTripPicker:!1,showCabinPicker:!1,minDate:"",maxDate:""}),computed:{tripTypeText(){const e=this.tripTypeColumns[0].find(e=>e.value===this.tripType);return e?e.label:"单程"},cabinTypeText(){const e=this.cabinTypeColumns[0].find(e=>e.value===this.cabinType);return e?e.label:"经济舱"}},onLoad(e){this.initDateRange(),e.id&&(this.serviceId=e.id),e.title&&(this.serviceTitle=decodeURIComponent(e.title))},methods:{initDateRange(){const e=new Date,t=e.getFullYear(),a=String(e.getMonth()+1).padStart(2,"0"),l=String(e.getDate()).padStart(2,"0");this.minDate=`${t}-${a}-${l}`,this.maxDate=`${t+2}-12-31`},openDepartureCalendar(){console.log("打开出发日期选择器"),this.calendarType="departure",this.initDateRange(),this.$nextTick(()=>{this.showCalendar=!0})},openReturnCalendar(){console.log("打开返程日期选择器"),this.calendarType="return",this.departureDate?this.minDate=this.departureDate:this.initDateRange(),this.$nextTick(()=>{this.showCalendar=!0})},closeCalendar(){this.showCalendar=!1,this.initDateRange()},onCalendarConfirm(e){console.log("日历确认:",e),e&&e.length>0&&("departure"===this.calendarType?(this.departureDate=e[0],this.returnDate&&this.returnDate<e[0]&&(this.returnDate="")):this.returnDate=e[0]),this.showCalendar=!1,this.initDateRange()},onTripTypeConfirm(e){const t=e.value[0];this.tripType=t.value,this.tripTypeIndex=this.tripTypeColumns[0].findIndex(e=>e.value===t.value),this.showTripPicker=!1},onCabinTypeConfirm(e){const t=e.value[0];this.cabinType=t.value,this.cabinTypeIndex=this.cabinTypeColumns[0].findIndex(e=>e.value===t.value),this.showCabinPicker=!1},checkData(){const e=[{field:"userName",selector:"#fieldUserName",check:()=>!this.userName.trim(),message:"请输入真实姓名"},{field:"contact",selector:"#fieldContact",check:()=>!this.userWechat.trim()&&!this.userPhone.trim()&&!this.userWhats.trim(),message:"请至少填写一种联系方式(微信号/手机号/WhatsApp)"},{field:"departureDate",selector:"#fieldDepartureDate",check:()=>!this.departureDate,message:"请选择出发日期"},{field:"returnDate",selector:"#fieldReturnDate",check:()=>"round"===this.tripType&&!this.returnDate,message:"请选择返程日期"},{field:"departureCity",selector:"#fieldDepartureCity",check:()=>!this.departureCity.trim(),message:"请输入出发城市"},{field:"arrivalCity",selector:"#fieldArrivalCity",check:()=>!this.arrivalCity.trim(),message:"请输入到达城市"},{field:"personCount",selector:"#fieldPersonCount",check:()=>0===this.adultCount&&0===this.childCount&&0===this.infantCount,message:"请至少选择一位乘客"},{field:"luggageCount",selector:"#fieldLuggageCount",check:()=>!this.luggageCount||""===this.luggageCount,message:"请输入行李件数"}];for(const a of e)if(a.check())return t({title:a.message,icon:"none"}),this.scrollToElement(a.selector),this.flashingField=a.field,void setTimeout(()=>{this.flashingField=""},1500);this.submitAppointment()},async submitAppointment(){var e;if(!this.submitting){this.submitting=!0,a({title:"提交中...",mask:!0});try{const a={hotServiceId:parseInt(this.serviceId)||null,serviceType:"travel",realName:this.userName.trim(),wechatId:this.userWechat.trim()||null,phone:this.userPhone.trim()||null,phoneCountryCode:this.userPhone.trim()?this.selectedDialCode:null,whatsapp:this.userWhats.trim()||null,notes:this.remark.trim()||null,tripType:this.tripType,departureDate:this.departureDate,returnDate:"round"===this.tripType?this.returnDate:null,departureCity:this.departureCity.trim(),arrivalCity:this.arrivalCity.trim(),adultCount:this.adultCount,childCount:this.childCount,infantCount:this.infantCount,cabinType:this.cabinType,luggageCount:parseInt(this.luggageCount)||0},s=await v.CreateAppointment(a);l(),s.success||0===s.code?(t({title:"预约提交成功",icon:"success"}),setTimeout(()=>{r({delta:1})},1500)):t({title:(null==(e=s.error)?void 0:e.message)||"提交失败,请重试",icon:"none"})}catch(s){l(),console.error("提交预约失败:",s),t({title:"网络错误,请重试",icon:"none"})}finally{this.submitting=!1}}},scrollToElement(e){const t=s().windowHeight,a=i().in(this);a.select(e).boundingClientRect(),a.selectViewport().scrollOffset(),a.exec(e=>{if(e[0]&&e[1]){const a=e[0],l=e[1].scrollTop+a.top-t/2+a.height/2;n({scrollTop:Math.max(0,l),duration:300})}})},back(){r({delta:1})},increaseCount(e){"adult"===e?this.adultCount++:"child"===e?this.childCount++:"infant"===e&&this.infantCount++},decreaseCount(e){"adult"===e&&this.adultCount>0?this.adultCount--:"child"===e&&this.childCount>0?this.childCount--:"infant"===e&&this.infantCount>0&&this.infantCount--}}},[["render",function(e,t,a,l,r,s){const i=b,n=h,T=k,v=o(d("up-input"),f),V=o(d("aure-country-picker"),D),P=o(d("up-picker"),m),$=o(d("up-calendar"),y);return u(),c(n,{class:"page"},{default:p(()=>[g(n,{class:"header"},{default:p(()=>[g(n,{class:"center",style:{width:"50rpx",height:"50rpx","margin-left":"32rpx"}},{default:p(()=>[g(i,{src:E,onClick:s.back,style:{width:"48rpx",height:"48rpx"},mode:""},null,8,["onClick"])]),_:1}),g(T,{style:{"font-size":"30rpx"}},{default:p(()=>[C(x(e.$t("infoEntry.title")),1)]),_:1}),g(n,{style:{width:"50rpx","margin-right":"32rpx"}})]),_:1}),g(n,{class:"scroll-content"},{default:p(()=>[g(n,{class:"content"},{default:p(()=>[g(n,{class:"",style:{width:"680rpx",height:"396rpx","background-image":"linear-gradient(-45deg, #60D7FF, #68BBD7)","margin-top":"32rpx","border-radius":"20rpx","box-shadow":"0 0 10rpx 10rpx rgba(0, 0, 0, 0.1)"}}),g(n,{class:"",style:{width:"100%","font-size":"40rpx","padding-left":"54rpx","margin-top":"38rpx"}},{default:p(()=>[C(x(e.$t("infoEntry.personalInfo")),1)]),_:1}),g(n,{class:_(["column",{"flash-animation":"userName"===r.flashingField}]),style:{width:"680rpx","margin-top":"38rpx"},id:"fieldUserName"},{default:p(()=>[g(T,{style:{"font-size":"30rpx"}},{default:p(()=>[g(T,{style:{color:"#FF0000"}},{default:p(()=>[C("*")]),_:1}),C(x(e.$t("infoEntry.realName")),1)]),_:1}),g(v,{placeholder:e.$t("infoEntry.realNamePlaceholder"),border:"surround",modelValue:r.userName,"onUpdate:modelValue":t[0]||(t[0]=e=>r.userName=e)},null,8,["placeholder","modelValue"])]),_:1},8,["class"]),g(n,{class:"",style:{width:"680rpx",height:"2rpx","background-color":"#EAEAEA"}}),g(n,{class:_(["column",{"flash-animation":"contact"===r.flashingField}]),style:{width:"680rpx","margin-top":"14rpx"},id:"fieldContact"},{default:p(()=>[g(T,{style:{"font-size":"30rpx"}},{default:p(()=>[g(T,{style:{color:"#FF0000"}},{default:p(()=>[C("*")]),_:1}),C(x(e.$t("infoEntry.wechat"))+" ("+x(e.$t("infoEntry.contactMethod"))+")",1)]),_:1}),g(v,{placeholder:e.$t("infoEntry.wechatPlaceholder"),border:"surround",modelValue:r.userWechat,"onUpdate:modelValue":t[1]||(t[1]=e=>r.userWechat=e)},null,8,["placeholder","modelValue"])]),_:1},8,["class"]),g(n,{class:"",style:{width:"680rpx",height:"2rpx","background-color":"#EAEAEA"}}),g(n,{class:_(["column",{"flash-animation":"contact"===r.flashingField}]),style:{width:"680rpx","margin-top":"14rpx"}},{default:p(()=>[g(T,{style:{"font-size":"30rpx"}},{default:p(()=>[g(T,{style:{color:"#FF0000"}},{default:p(()=>[C("*")]),_:1}),C(x(e.$t("infoEntry.phone"))+" ("+x(e.$t("infoEntry.contactMethod"))+")",1)]),_:1}),g(n,{class:"row",style:{"margin-top":"10rpx","margin-bottom":"10rpx"}},{default:p(()=>[g(V,{modelValue:r.selectedDialCode,"onUpdate:modelValue":t[2]||(t[2]=e=>r.selectedDialCode=e),title:e.$t("infoEntry.selectCountry"),height:"70%",width:"60vw",duration:350,position:"bottom",round:!0,radius:"24rpx","mask-closable":!0},null,8,["modelValue","title"]),g(v,{placeholder:e.$t("infoEntry.phonePlaceholder"),border:"surround",modelValue:r.userPhone,"onUpdate:modelValue":t[3]||(t[3]=e=>r.userPhone=e)},null,8,["placeholder","modelValue"])]),_:1})]),_:1},8,["class"]),g(n,{class:"",style:{width:"680rpx",height:"2rpx","background-color":"#EAEAEA"}}),g(n,{class:_(["column",{"flash-animation":"contact"===r.flashingField}]),style:{width:"680rpx","margin-top":"14rpx"}},{default:p(()=>[g(T,{style:{"font-size":"30rpx"}},{default:p(()=>[g(T,{style:{color:"#FF0000"}},{default:p(()=>[C("*")]),_:1}),C(x(e.$t("infoEntry.whatsapp"))+" ("+x(e.$t("infoEntry.contactMethod"))+")",1)]),_:1}),g(v,{placeholder:e.$t("infoEntry.whatsappPlaceholder"),border:"surround",modelValue:r.userWhats,"onUpdate:modelValue":t[4]||(t[4]=e=>r.userWhats=e)},null,8,["placeholder","modelValue"])]),_:1},8,["class"]),g(n,{class:"",style:{width:"680rpx",height:"2rpx","background-color":"#EAEAEA"}}),g(n,{class:"column",style:{width:"680rpx","margin-top":"14rpx"}},{default:p(()=>[g(T,{style:{"font-size":"30rpx"}},{default:p(()=>[C(x(e.$t("infoEntry.remark")),1)]),_:1}),g(v,{placeholder:e.$t("infoEntry.remarkPlaceholder"),border:"surround",modelValue:r.remark,"onUpdate:modelValue":t[5]||(t[5]=e=>r.remark=e)},null,8,["placeholder","modelValue"])]),_:1}),g(n,{class:"",style:{width:"680rpx",height:"2rpx","background-color":"#EAEAEA"}}),g(n,{class:"",style:{width:"100%","font-size":"40rpx","padding-left":"54rpx","margin-top":"38rpx"}},{default:p(()=>[C(x(e.$t("infoEntry.serviceInfo")),1)]),_:1}),g(n,{class:"column",style:{width:"680rpx","margin-top":"14rpx"}},{default:p(()=>[g(T,{style:{"font-size":"30rpx"}},{default:p(()=>[g(T,{style:{color:"#FF0000"}},{default:p(()=>[C("*")]),_:1}),C("单程 / 往返")]),_:1}),g(n,{class:"date-item",onClick:t[6]||(t[6]=e=>r.showTripPicker=!0)},{default:p(()=>[g(T,{class:"date-text"},{default:p(()=>[C(x(s.tripTypeText),1)]),_:1}),g(i,{src:A,style:{width:"32rpx",height:"32rpx"},mode:"aspectFit"})]),_:1})]),_:1}),g(n,{class:"",style:{width:"680rpx",height:"2rpx","background-color":"#EAEAEA"}}),g(n,{class:_(["column",{"flash-animation":"departureDate"===r.flashingField}]),style:{width:"680rpx","margin-top":"14rpx"},id:"fieldDepartureDate"},{default:p(()=>[g(T,{style:{"font-size":"30rpx"}},{default:p(()=>[g(T,{style:{color:"#FF0000"}},{default:p(()=>[C("*")]),_:1}),C(x(e.$t("infoEntry.departureDate")),1)]),_:1}),g(n,{class:"date-item",onClick:s.openDepartureCalendar},{default:p(()=>[g(T,{class:_(["date-text",{"date-placeholder":!r.departureDate}])},{default:p(()=>[C(x(r.departureDate||e.$t("infoEntry.departureDatePlaceholder")),1)]),_:1},8,["class"]),g(i,{src:F,style:{width:"32rpx",height:"32rpx"},mode:"aspectFit"})]),_:1},8,["onClick"])]),_:1},8,["class"]),g(n,{class:"",style:{width:"680rpx",height:"2rpx","background-color":"#EAEAEA"}}),"round"===r.tripType?(u(),c(n,{key:0,class:_(["column",{"flash-animation":"returnDate"===r.flashingField}]),style:{width:"680rpx","margin-top":"14rpx"},id:"fieldReturnDate"},{default:p(()=>[g(T,{style:{"font-size":"30rpx"}},{default:p(()=>[g(T,{style:{color:"#FF0000"}},{default:p(()=>[C("*")]),_:1}),C("返程日期")]),_:1}),g(n,{class:"date-item",onClick:s.openReturnCalendar},{default:p(()=>[g(T,{class:_(["date-text",{"date-placeholder":!r.returnDate}])},{default:p(()=>[C(x(r.returnDate||"请选择返程日期"),1)]),_:1},8,["class"]),g(i,{src:F,style:{width:"32rpx",height:"32rpx"},mode:"aspectFit"})]),_:1},8,["onClick"])]),_:1},8,["class"])):w("",!0),"round"===r.tripType?(u(),c(n,{key:1,class:"",style:{width:"680rpx",height:"2rpx","background-color":"#EAEAEA"}})):w("",!0),g(n,{class:_(["column",{"flash-animation":"departureCity"===r.flashingField}]),style:{width:"680rpx","margin-top":"14rpx"},id:"fieldDepartureCity"},{default:p(()=>[g(T,{style:{"font-size":"30rpx"}},{default:p(()=>[g(T,{style:{color:"#FF0000"}},{default:p(()=>[C("*")]),_:1}),C("出发城市")]),_:1}),g(v,{placeholder:"请输入出发城市",border:"surround",modelValue:r.departureCity,"onUpdate:modelValue":t[7]||(t[7]=e=>r.departureCity=e)},null,8,["modelValue"])]),_:1},8,["class"]),g(n,{class:"",style:{width:"680rpx",height:"2rpx","background-color":"#EAEAEA"}}),g(n,{class:_(["column",{"flash-animation":"arrivalCity"===r.flashingField}]),style:{width:"680rpx","margin-top":"14rpx"},id:"fieldArrivalCity"},{default:p(()=>[g(T,{style:{"font-size":"30rpx"}},{default:p(()=>[g(T,{style:{color:"#FF0000"}},{default:p(()=>[C("*")]),_:1}),C("到达城市")]),_:1}),g(v,{placeholder:"请输入到达城市",border:"surround",modelValue:r.arrivalCity,"onUpdate:modelValue":t[8]||(t[8]=e=>r.arrivalCity=e)},null,8,["modelValue"])]),_:1},8,["class"]),g(n,{class:"",style:{width:"680rpx",height:"2rpx","background-color":"#EAEAEA"}}),g(n,{class:_(["column",{"flash-animation":"personCount"===r.flashingField}]),style:{width:"680rpx","margin-top":"14rpx"},id:"fieldPersonCount"},{default:p(()=>[g(T,{style:{"font-size":"30rpx"}},{default:p(()=>[g(T,{style:{color:"#FF0000"}},{default:p(()=>[C("*")]),_:1}),C("人数")]),_:1}),g(n,{class:"person-row"},{default:p(()=>[g(n,{class:"person-info"},{default:p(()=>[g(T,{class:"person-title"},{default:p(()=>[C("成人")]),_:1}),g(T,{class:"person-desc"},{default:p(()=>[C("13岁或以上")]),_:1})]),_:1}),g(n,{class:"person-counter"},{default:p(()=>[g(n,{class:"counter-btn",onClick:t[9]||(t[9]=e=>s.decreaseCount("adult"))},{default:p(()=>[g(T,{class:"counter-icon"},{default:p(()=>[C("-")]),_:1})]),_:1}),g(T,{class:"counter-value"},{default:p(()=>[C(x(r.adultCount)+"人",1)]),_:1}),g(n,{class:"counter-btn",onClick:t[10]||(t[10]=e=>s.increaseCount("adult"))},{default:p(()=>[g(T,{class:"counter-icon"},{default:p(()=>[C("+")]),_:1})]),_:1})]),_:1})]),_:1}),g(n,{class:"person-row"},{default:p(()=>[g(n,{class:"person-info"},{default:p(()=>[g(T,{class:"person-title"},{default:p(()=>[C("儿童")]),_:1}),g(T,{class:"person-desc"},{default:p(()=>[C("2~12岁")]),_:1})]),_:1}),g(n,{class:"person-counter"},{default:p(()=>[g(n,{class:"counter-btn",onClick:t[11]||(t[11]=e=>s.decreaseCount("child"))},{default:p(()=>[g(T,{class:"counter-icon"},{default:p(()=>[C("-")]),_:1})]),_:1}),g(T,{class:"counter-value"},{default:p(()=>[C(x(r.childCount)+"人",1)]),_:1}),g(n,{class:"counter-btn",onClick:t[12]||(t[12]=e=>s.increaseCount("child"))},{default:p(()=>[g(T,{class:"counter-icon"},{default:p(()=>[C("+")]),_:1})]),_:1})]),_:1})]),_:1}),g(n,{class:"person-row"},{default:p(()=>[g(n,{class:"person-info"},{default:p(()=>[g(T,{class:"person-title"},{default:p(()=>[C("婴儿")]),_:1}),g(T,{class:"person-desc"},{default:p(()=>[C("2岁以下")]),_:1})]),_:1}),g(n,{class:"person-counter"},{default:p(()=>[g(n,{class:"counter-btn",onClick:t[13]||(t[13]=e=>s.decreaseCount("infant"))},{default:p(()=>[g(T,{class:"counter-icon"},{default:p(()=>[C("-")]),_:1})]),_:1}),g(T,{class:"counter-value"},{default:p(()=>[C(x(r.infantCount)+"人",1)]),_:1}),g(n,{class:"counter-btn",onClick:t[14]||(t[14]=e=>s.increaseCount("infant"))},{default:p(()=>[g(T,{class:"counter-icon"},{default:p(()=>[C("+")]),_:1})]),_:1})]),_:1})]),_:1})]),_:1},8,["class"]),g(n,{class:"",style:{width:"680rpx",height:"2rpx","background-color":"#EAEAEA"}}),g(n,{class:"column",style:{width:"680rpx","margin-top":"14rpx"}},{default:p(()=>[g(T,{style:{"font-size":"30rpx"}},{default:p(()=>[g(T,{style:{color:"#FF0000"}},{default:p(()=>[C("*")]),_:1}),C("舱位选择")]),_:1}),g(n,{class:"date-item",onClick:t[15]||(t[15]=e=>r.showCabinPicker=!0)},{default:p(()=>[g(T,{class:"date-text"},{default:p(()=>[C(x(s.cabinTypeText),1)]),_:1}),g(i,{src:A,style:{width:"32rpx",height:"32rpx"},mode:"aspectFit"})]),_:1})]),_:1}),g(n,{class:"",style:{width:"680rpx",height:"2rpx","background-color":"#EAEAEA"}}),g(n,{class:_(["column",{"flash-animation":"luggageCount"===r.flashingField}]),style:{width:"680rpx","margin-top":"14rpx"},id:"fieldLuggageCount"},{default:p(()=>[g(T,{style:{"font-size":"30rpx"}},{default:p(()=>[g(T,{style:{color:"#FF0000"}},{default:p(()=>[C("*")]),_:1}),C("行李件数")]),_:1}),g(v,{placeholder:"请输入行李件数",border:"surround",modelValue:r.luggageCount,"onUpdate:modelValue":t[16]||(t[16]=e=>r.luggageCount=e),type:"number"},null,8,["modelValue"])]),_:1},8,["class"]),g(n,{class:"",style:{width:"680rpx",height:"2rpx","background-color":"#EAEAEA"}}),g(n,{class:"center",onClick:t[17]||(t[17]=e=>s.checkData()),style:{width:"642rpx",height:"72rpx","background-color":"#57C9DD","border-radius":"16rpx","box-shadow":"0 0 10rpx 10rpx rgba(0, 0, 0, 0.1)","margin-top":"50rpx","margin-bottom":"100rpx"}},{default:p(()=>[C(x(e.$t("common.submit")),1)]),_:1})]),_:1})]),_:1}),g(P,{show:r.showTripPicker,columns:r.tripTypeColumns,onConfirm:s.onTripTypeConfirm,onCancel:t[18]||(t[18]=e=>r.showTripPicker=!1),onClose:t[19]||(t[19]=e=>r.showTripPicker=!1),defaultIndex:[r.tripTypeIndex],keyName:"label"},null,8,["show","columns","onConfirm","defaultIndex"]),g(P,{show:r.showCabinPicker,columns:r.cabinTypeColumns,onConfirm:s.onCabinTypeConfirm,onCancel:t[20]||(t[20]=e=>r.showCabinPicker=!1),onClose:t[21]||(t[21]=e=>r.showCabinPicker=!1),defaultIndex:[r.cabinTypeIndex],keyName:"label"},null,8,["show","columns","onConfirm","defaultIndex"]),g($,{show:r.showCalendar,mode:"single",minDate:r.minDate,maxDate:r.maxDate,onConfirm:s.onCalendarConfirm,onClose:s.closeCalendar,confirmText:e.$t("common.confirm"),color:"#57C9DD"},null,8,["show","minDate","maxDate","onConfirm","onClose","confirmText"])]),_:1})}],["__scopeId","data-v-f8d84083"]]);export{V as default};
|