appointment_system/miniprogram/dist/build/h5/assets/pages-appointment-unaccompanied-minor-page.8ff7a674.js
2025-12-19 00:37:31 +08:00

2 lines
12 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import{_ as e,m as t,L as l,M as a,l as s,k as r,N as o,O as i,G as n,H as d,o as c,c as u,w as h,i as p,P as m,R as f,e as g,f as y,t as x,A as C,g as _,h as b}from"./index-a09151d6.js";import{_ as w}from"./aure-country-picker.01cea584.js";import{A as E}from"./AppServer.888fd24d.js";import{_ as A}from"./ic_back.5440bd15.js";import{_ as k}from"./arrow_right2.8bd5bd0f.js";const D=new E;const F=e({data:()=>({serviceId:"",serviceTitle:"",userName:"",userWechat:"",userPhone:"",userWhats:"",remark:"",reservationDate:"",itinerary:"",childAge:"",boyCount:0,girlCount:0,submitting:!1,flashingField:"",selectedDialCode:"86",showCalendar:!1,minDate:"",maxDate:""}),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(),l=String(e.getMonth()+1).padStart(2,"0"),a=String(e.getDate()).padStart(2,"0");this.minDate=`${t}-${l}-${a}`,this.maxDate=`${t+2}-12-31`},openCalendar(){this.initDateRange(),this.$nextTick(()=>{this.showCalendar=!0})},closeCalendar(){this.showCalendar=!1},onCalendarConfirm(e){e&&e.length>0&&(this.reservationDate=e[0]),this.showCalendar=!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:"reservationDate",selector:"#fieldReservationDate",check:()=>!this.reservationDate,message:"请选择预约日期"},{field:"itinerary",selector:"#fieldItinerary",check:()=>!this.itinerary.trim(),message:"请输入行程信息"},{field:"childAge",selector:"#fieldChildAge",check:()=>!this.childAge||parseInt(this.childAge)<=0,message:"请输入有效的儿童年龄"},{field:"childCount",selector:"#fieldChildCount",check:()=>0===this.boyCount&&0===this.girlCount,message:"请至少选择一位儿童"}];for(const l of e)if(l.check())return t({title:l.message,icon:"none"}),this.scrollToElement(l.selector),this.flashingField=l.field,void setTimeout(()=>{this.flashingField=""},1500);this.submitAppointment()},async submitAppointment(){var e;if(!this.submitting){this.submitting=!0,l({title:"提交中...",mask:!0});try{const l={hotServiceId:parseInt(this.serviceId)||null,serviceType:"unaccompanied_minor",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,appointmentDate:this.reservationDate,itinerary:this.itinerary.trim(),childAge:parseInt(this.childAge)||0,boyCount:this.boyCount,girlCount:this.girlCount},r=await D.CreateAppointment(l);a(),r.success||0===r.code?(t({title:"预约提交成功",icon:"success"}),setTimeout(()=>{s({delta:1})},1500)):t({title:(null==(e=r.error)?void 0:e.message)||"提交失败,请重试",icon:"none"})}catch(r){a(),console.error("提交预约失败:",r),t({title:"网络错误,请重试",icon:"none"})}finally{this.submitting=!1}}},scrollToElement(e){const t=r().windowHeight,l=o().in(this);l.select(e).boundingClientRect(),l.selectViewport().scrollOffset(),l.exec(e=>{if(e[0]&&e[1]){const l=e[0],a=e[1].scrollTop+l.top-t/2+l.height/2;i({scrollTop:Math.max(0,a),duration:300})}})},back(){s({delta:1})},increaseCount(e){"boy"===e?this.boyCount++:"girl"===e&&this.girlCount++},decreaseCount(e){"boy"===e&&this.boyCount>0?this.boyCount--:"girl"===e&&this.girlCount>0&&this.girlCount--}}},[["render",function(e,t,l,a,s,r){const o=_,i=p,E=b,D=n(d("up-input"),m),F=n(d("aure-country-picker"),w),v=n(d("up-calendar"),f);return c(),u(i,{class:"page"},{default:h(()=>[g(i,{class:"header"},{default:h(()=>[g(i,{class:"center",style:{width:"50rpx",height:"50rpx","margin-left":"32rpx"}},{default:h(()=>[g(o,{src:A,onClick:r.back,style:{width:"48rpx",height:"48rpx"},mode:""},null,8,["onClick"])]),_:1}),g(E,{style:{"font-size":"30rpx"}},{default:h(()=>[y(x(e.$t("infoEntry.title")),1)]),_:1}),g(i,{style:{width:"50rpx","margin-right":"32rpx"}})]),_:1}),g(i,{class:"scroll-content"},{default:h(()=>[g(i,{class:"content"},{default:h(()=>[g(i,{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(i,{class:"",style:{width:"100%","font-size":"40rpx","padding-left":"54rpx","margin-top":"38rpx"}},{default:h(()=>[y(x(e.$t("infoEntry.personalInfo")),1)]),_:1}),g(i,{class:C(["column",{"flash-animation":"userName"===s.flashingField}]),style:{width:"680rpx","margin-top":"38rpx"},id:"fieldUserName"},{default:h(()=>[g(E,{style:{"font-size":"30rpx"}},{default:h(()=>[g(E,{style:{color:"#FF0000"}},{default:h(()=>[y("*")]),_:1}),y(x(e.$t("infoEntry.realName")),1)]),_:1}),g(D,{placeholder:e.$t("infoEntry.realNamePlaceholder"),border:"surround",modelValue:s.userName,"onUpdate:modelValue":t[0]||(t[0]=e=>s.userName=e)},null,8,["placeholder","modelValue"])]),_:1},8,["class"]),g(i,{class:"",style:{width:"680rpx",height:"2rpx","background-color":"#EAEAEA"}}),g(i,{class:C(["column",{"flash-animation":"contact"===s.flashingField}]),style:{width:"680rpx","margin-top":"14rpx"},id:"fieldContact"},{default:h(()=>[g(E,{style:{"font-size":"30rpx"}},{default:h(()=>[g(E,{style:{color:"#FF0000"}},{default:h(()=>[y("*")]),_:1}),y(x(e.$t("infoEntry.wechat"))+" ("+x(e.$t("infoEntry.contactMethod"))+")",1)]),_:1}),g(D,{placeholder:e.$t("infoEntry.wechatPlaceholder"),border:"surround",modelValue:s.userWechat,"onUpdate:modelValue":t[1]||(t[1]=e=>s.userWechat=e)},null,8,["placeholder","modelValue"])]),_:1},8,["class"]),g(i,{class:"",style:{width:"680rpx",height:"2rpx","background-color":"#EAEAEA"}}),g(i,{class:C(["column",{"flash-animation":"contact"===s.flashingField}]),style:{width:"680rpx","margin-top":"14rpx"}},{default:h(()=>[g(E,{style:{"font-size":"30rpx"}},{default:h(()=>[g(E,{style:{color:"#FF0000"}},{default:h(()=>[y("*")]),_:1}),y(x(e.$t("infoEntry.phone"))+" ("+x(e.$t("infoEntry.contactMethod"))+")",1)]),_:1}),g(i,{class:"row",style:{"margin-top":"10rpx","margin-bottom":"10rpx"}},{default:h(()=>[g(F,{modelValue:s.selectedDialCode,"onUpdate:modelValue":t[2]||(t[2]=e=>s.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(D,{placeholder:e.$t("infoEntry.phonePlaceholder"),border:"surround",modelValue:s.userPhone,"onUpdate:modelValue":t[3]||(t[3]=e=>s.userPhone=e)},null,8,["placeholder","modelValue"])]),_:1})]),_:1},8,["class"]),g(i,{class:"",style:{width:"680rpx",height:"2rpx","background-color":"#EAEAEA"}}),g(i,{class:C(["column",{"flash-animation":"contact"===s.flashingField}]),style:{width:"680rpx","margin-top":"14rpx"}},{default:h(()=>[g(E,{style:{"font-size":"30rpx"}},{default:h(()=>[g(E,{style:{color:"#FF0000"}},{default:h(()=>[y("*")]),_:1}),y(x(e.$t("infoEntry.whatsapp"))+" ("+x(e.$t("infoEntry.contactMethod"))+")",1)]),_:1}),g(D,{placeholder:e.$t("infoEntry.whatsappPlaceholder"),border:"surround",modelValue:s.userWhats,"onUpdate:modelValue":t[4]||(t[4]=e=>s.userWhats=e)},null,8,["placeholder","modelValue"])]),_:1},8,["class"]),g(i,{class:"",style:{width:"680rpx",height:"2rpx","background-color":"#EAEAEA"}}),g(i,{class:"column",style:{width:"680rpx","margin-top":"14rpx"}},{default:h(()=>[g(E,{style:{"font-size":"30rpx"}},{default:h(()=>[y(x(e.$t("infoEntry.remark")),1)]),_:1}),g(D,{placeholder:e.$t("infoEntry.remarkPlaceholder"),border:"surround",modelValue:s.remark,"onUpdate:modelValue":t[5]||(t[5]=e=>s.remark=e)},null,8,["placeholder","modelValue"])]),_:1}),g(i,{class:"",style:{width:"680rpx",height:"2rpx","background-color":"#EAEAEA"}}),g(i,{class:"",style:{width:"100%","font-size":"40rpx","padding-left":"54rpx","margin-top":"38rpx"}},{default:h(()=>[y(x(e.$t("infoEntry.serviceInfo")),1)]),_:1}),g(i,{class:C(["column",{"flash-animation":"reservationDate"===s.flashingField}]),style:{width:"680rpx","margin-top":"14rpx"},id:"fieldReservationDate"},{default:h(()=>[g(E,{style:{"font-size":"30rpx"}},{default:h(()=>[g(E,{style:{color:"#FF0000"}},{default:h(()=>[y("*")]),_:1}),y("预约日期")]),_:1}),g(i,{class:"date-item",onClick:r.openCalendar},{default:h(()=>[g(E,{class:C(["date-text",{"date-placeholder":!s.reservationDate}])},{default:h(()=>[y(x(s.reservationDate||"请选择预约日期"),1)]),_:1},8,["class"]),g(o,{src:k,style:{width:"32rpx",height:"32rpx"},mode:"aspectFit"})]),_:1},8,["onClick"])]),_:1},8,["class"]),g(i,{class:"",style:{width:"680rpx",height:"2rpx","background-color":"#EAEAEA"}}),g(i,{class:C(["column",{"flash-animation":"itinerary"===s.flashingField}]),style:{width:"680rpx","margin-top":"14rpx"},id:"fieldItinerary"},{default:h(()=>[g(E,{style:{"font-size":"30rpx"}},{default:h(()=>[g(E,{style:{color:"#FF0000"}},{default:h(()=>[y("*")]),_:1}),y("行程")]),_:1}),g(D,{placeholder:"请输入行程信息(如:北京-上海)",border:"surround",modelValue:s.itinerary,"onUpdate:modelValue":t[6]||(t[6]=e=>s.itinerary=e)},null,8,["modelValue"])]),_:1},8,["class"]),g(i,{class:"",style:{width:"680rpx",height:"2rpx","background-color":"#EAEAEA"}}),g(i,{class:C(["column",{"flash-animation":"childAge"===s.flashingField}]),style:{width:"680rpx","margin-top":"14rpx"},id:"fieldChildAge"},{default:h(()=>[g(E,{style:{"font-size":"30rpx"}},{default:h(()=>[g(E,{style:{color:"#FF0000"}},{default:h(()=>[y("*")]),_:1}),y("儿童年龄")]),_:1}),g(D,{placeholder:"请输入儿童年龄",border:"surround",modelValue:s.childAge,"onUpdate:modelValue":t[7]||(t[7]=e=>s.childAge=e),type:"number"},null,8,["modelValue"])]),_:1},8,["class"]),g(i,{class:"",style:{width:"680rpx",height:"2rpx","background-color":"#EAEAEA"}}),g(i,{class:C(["column",{"flash-animation":"childCount"===s.flashingField}]),style:{width:"680rpx","margin-top":"14rpx"},id:"fieldChildCount"},{default:h(()=>[g(E,{style:{"font-size":"30rpx"}},{default:h(()=>[g(E,{style:{color:"#FF0000"}},{default:h(()=>[y("*")]),_:1}),y("儿童人数")]),_:1}),g(i,{class:"person-row"},{default:h(()=>[g(i,{class:"person-info"},{default:h(()=>[g(E,{class:"person-title"},{default:h(()=>[y("男孩")]),_:1}),g(E,{class:"person-desc"},{default:h(()=>[y("Boys")]),_:1})]),_:1}),g(i,{class:"person-counter"},{default:h(()=>[g(i,{class:"counter-btn",onClick:t[8]||(t[8]=e=>r.decreaseCount("boy"))},{default:h(()=>[g(E,{class:"counter-icon"},{default:h(()=>[y("")]),_:1})]),_:1}),g(E,{class:"counter-value"},{default:h(()=>[y(x(s.boyCount)+"人",1)]),_:1}),g(i,{class:"counter-btn",onClick:t[9]||(t[9]=e=>r.increaseCount("boy"))},{default:h(()=>[g(E,{class:"counter-icon"},{default:h(()=>[y("")]),_:1})]),_:1})]),_:1})]),_:1}),g(i,{class:"person-row"},{default:h(()=>[g(i,{class:"person-info"},{default:h(()=>[g(E,{class:"person-title"},{default:h(()=>[y("女孩")]),_:1}),g(E,{class:"person-desc"},{default:h(()=>[y("Girls")]),_:1})]),_:1}),g(i,{class:"person-counter"},{default:h(()=>[g(i,{class:"counter-btn",onClick:t[10]||(t[10]=e=>r.decreaseCount("girl"))},{default:h(()=>[g(E,{class:"counter-icon"},{default:h(()=>[y("")]),_:1})]),_:1}),g(E,{class:"counter-value"},{default:h(()=>[y(x(s.girlCount)+"人",1)]),_:1}),g(i,{class:"counter-btn",onClick:t[11]||(t[11]=e=>r.increaseCount("girl"))},{default:h(()=>[g(E,{class:"counter-icon"},{default:h(()=>[y("")]),_:1})]),_:1})]),_:1})]),_:1})]),_:1},8,["class"]),g(i,{class:"",style:{width:"680rpx",height:"2rpx","background-color":"#EAEAEA"}}),g(i,{class:"center",onClick:t[12]||(t[12]=e=>r.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:h(()=>[y(x(e.$t("common.submit")),1)]),_:1})]),_:1})]),_:1}),g(v,{show:s.showCalendar,mode:"single",minDate:s.minDate,maxDate:s.maxDate,onConfirm:r.onCalendarConfirm,onClose:r.closeCalendar,confirmText:e.$t("common.confirm"),color:"#57C9DD"},null,8,["show","minDate","maxDate","onConfirm","onClose","confirmText"])]),_:1})}],["__scopeId","data-v-3d5b1747"]]);export{F as default};