2 lines
9.8 KiB
JavaScript
2 lines
9.8 KiB
JavaScript
import{_ as e,m as t,L as l,M as a,l as r,k as o,N as s,O as i,G as n,H as d,o as c,c as u,w as h,i as p,P as m,e as f,f as g,t as y,A as x,g as E,h as _}from"./index-a09151d6.js";import{_ as b}from"./aure-country-picker.01cea584.js";import{A as w}from"./AppServer.888fd24d.js";import{_ as k}from"./ic_back.5440bd15.js";const A=new w;const P=e({data:()=>({serviceId:"",serviceTitle:"",userName:"",userWechat:"",userPhone:"",userWhats:"",remark:"",originPort:"",destinationPort:"",cargoName:"",cargoQuantity:"",submitting:!1,flashingField:"",selectedDialCode:"86"}),onLoad(e){e.id&&(this.serviceId=e.id),e.title&&(this.serviceTitle=decodeURIComponent(e.title))},methods:{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:"originPort",selector:"#fieldOriginPort",check:()=>!this.originPort.trim(),message:"请输入起运港"},{field:"destinationPort",selector:"#fieldDestinationPort",check:()=>!this.destinationPort.trim(),message:"请输入目的港"},{field:"cargoName",selector:"#fieldCargoName",check:()=>!this.cargoName.trim(),message:"请输入货物名称"},{field:"cargoQuantity",selector:"#fieldCargoQuantity",check:()=>!this.cargoQuantity||parseInt(this.cargoQuantity)<=0,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:"sea_freight",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,originPort:this.originPort.trim(),destinationPort:this.destinationPort.trim(),cargoName:this.cargoName.trim(),cargoQuantity:parseInt(this.cargoQuantity)||0},o=await A.CreateAppointment(l);a(),o.success||0===o.code?(t({title:"预约提交成功",icon:"success"}),setTimeout(()=>{r({delta:1})},1500)):t({title:(null==(e=o.error)?void 0:e.message)||"提交失败,请重试",icon:"none"})}catch(o){a(),console.error("提交预约失败:",o),t({title:"网络错误,请重试",icon:"none"})}finally{this.submitting=!1}}},scrollToElement(e){const t=o().windowHeight,l=s().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(){r({delta:1})}}},[["render",function(e,t,l,a,r,o){const s=E,i=p,w=_,A=n(d("up-input"),m),P=n(d("aure-country-picker"),b);return c(),u(i,{class:"page"},{default:h(()=>[f(i,{class:"header"},{default:h(()=>[f(i,{class:"center",style:{width:"50rpx",height:"50rpx","margin-left":"32rpx"}},{default:h(()=>[f(s,{src:k,onClick:o.back,style:{width:"48rpx",height:"48rpx"},mode:""},null,8,["onClick"])]),_:1}),f(w,{style:{"font-size":"30rpx"}},{default:h(()=>[g(y(e.$t("infoEntry.title")),1)]),_:1}),f(i,{style:{width:"50rpx","margin-right":"32rpx"}})]),_:1}),f(i,{class:"scroll-content"},{default:h(()=>[f(i,{class:"content"},{default:h(()=>[f(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)"}}),f(i,{class:"",style:{width:"100%","font-size":"40rpx","padding-left":"54rpx","margin-top":"38rpx"}},{default:h(()=>[g(y(e.$t("infoEntry.personalInfo")),1)]),_:1}),f(i,{class:x(["column",{"flash-animation":"userName"===r.flashingField}]),style:{width:"680rpx","margin-top":"38rpx"},id:"fieldUserName"},{default:h(()=>[f(w,{style:{"font-size":"30rpx"}},{default:h(()=>[f(w,{style:{color:"#FF0000"}},{default:h(()=>[g("*")]),_:1}),g(y(e.$t("infoEntry.realName")),1)]),_:1}),f(A,{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"]),f(i,{class:"",style:{width:"680rpx",height:"2rpx","background-color":"#EAEAEA"}}),f(i,{class:x(["column",{"flash-animation":"contact"===r.flashingField}]),style:{width:"680rpx","margin-top":"14rpx"},id:"fieldContact"},{default:h(()=>[f(w,{style:{"font-size":"30rpx"}},{default:h(()=>[f(w,{style:{color:"#FF0000"}},{default:h(()=>[g("*")]),_:1}),g(y(e.$t("infoEntry.wechat"))+" ("+y(e.$t("infoEntry.contactMethod"))+")",1)]),_:1}),f(A,{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"]),f(i,{class:"",style:{width:"680rpx",height:"2rpx","background-color":"#EAEAEA"}}),f(i,{class:x(["column",{"flash-animation":"contact"===r.flashingField}]),style:{width:"680rpx","margin-top":"14rpx"}},{default:h(()=>[f(w,{style:{"font-size":"30rpx"}},{default:h(()=>[f(w,{style:{color:"#FF0000"}},{default:h(()=>[g("*")]),_:1}),g(y(e.$t("infoEntry.phone"))+" ("+y(e.$t("infoEntry.contactMethod"))+")",1)]),_:1}),f(i,{class:"row",style:{"margin-top":"10rpx","margin-bottom":"10rpx"}},{default:h(()=>[f(P,{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"]),f(A,{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"]),f(i,{class:"",style:{width:"680rpx",height:"2rpx","background-color":"#EAEAEA"}}),f(i,{class:x(["column",{"flash-animation":"contact"===r.flashingField}]),style:{width:"680rpx","margin-top":"14rpx"}},{default:h(()=>[f(w,{style:{"font-size":"30rpx"}},{default:h(()=>[f(w,{style:{color:"#FF0000"}},{default:h(()=>[g("*")]),_:1}),g(y(e.$t("infoEntry.whatsapp"))+" ("+y(e.$t("infoEntry.contactMethod"))+")",1)]),_:1}),f(A,{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"]),f(i,{class:"",style:{width:"680rpx",height:"2rpx","background-color":"#EAEAEA"}}),f(i,{class:"column",style:{width:"680rpx","margin-top":"14rpx"}},{default:h(()=>[f(w,{style:{"font-size":"30rpx"}},{default:h(()=>[g(y(e.$t("infoEntry.remark")),1)]),_:1}),f(A,{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}),f(i,{class:"",style:{width:"680rpx",height:"2rpx","background-color":"#EAEAEA"}}),f(i,{class:"",style:{width:"100%","font-size":"40rpx","padding-left":"54rpx","margin-top":"38rpx"}},{default:h(()=>[g(y(e.$t("infoEntry.serviceInfo")),1)]),_:1}),f(i,{class:x(["column",{"flash-animation":"originPort"===r.flashingField}]),style:{width:"680rpx","margin-top":"14rpx"},id:"fieldOriginPort"},{default:h(()=>[f(w,{style:{"font-size":"30rpx"}},{default:h(()=>[f(w,{style:{color:"#FF0000"}},{default:h(()=>[g("*")]),_:1}),g("起运港")]),_:1}),f(A,{placeholder:"请输入起运港",border:"surround",modelValue:r.originPort,"onUpdate:modelValue":t[6]||(t[6]=e=>r.originPort=e)},null,8,["modelValue"])]),_:1},8,["class"]),f(i,{class:"",style:{width:"680rpx",height:"2rpx","background-color":"#EAEAEA"}}),f(i,{class:x(["column",{"flash-animation":"destinationPort"===r.flashingField}]),style:{width:"680rpx","margin-top":"14rpx"},id:"fieldDestinationPort"},{default:h(()=>[f(w,{style:{"font-size":"30rpx"}},{default:h(()=>[f(w,{style:{color:"#FF0000"}},{default:h(()=>[g("*")]),_:1}),g("目的港")]),_:1}),f(A,{placeholder:"请输入目的港",border:"surround",modelValue:r.destinationPort,"onUpdate:modelValue":t[7]||(t[7]=e=>r.destinationPort=e)},null,8,["modelValue"])]),_:1},8,["class"]),f(i,{class:"",style:{width:"680rpx",height:"2rpx","background-color":"#EAEAEA"}}),f(i,{class:x(["column",{"flash-animation":"cargoName"===r.flashingField}]),style:{width:"680rpx","margin-top":"14rpx"},id:"fieldCargoName"},{default:h(()=>[f(w,{style:{"font-size":"30rpx"}},{default:h(()=>[f(w,{style:{color:"#FF0000"}},{default:h(()=>[g("*")]),_:1}),g("货物名称")]),_:1}),f(A,{placeholder:"请输入货物名称",border:"surround",modelValue:r.cargoName,"onUpdate:modelValue":t[8]||(t[8]=e=>r.cargoName=e)},null,8,["modelValue"])]),_:1},8,["class"]),f(i,{class:"",style:{width:"680rpx",height:"2rpx","background-color":"#EAEAEA"}}),f(i,{class:x(["column",{"flash-animation":"cargoQuantity"===r.flashingField}]),style:{width:"680rpx","margin-top":"14rpx"},id:"fieldCargoQuantity"},{default:h(()=>[f(w,{style:{"font-size":"30rpx"}},{default:h(()=>[f(w,{style:{color:"#FF0000"}},{default:h(()=>[g("*")]),_:1}),g("货物数量")]),_:1}),f(A,{placeholder:"请输入货物数量",border:"surround",modelValue:r.cargoQuantity,"onUpdate:modelValue":t[9]||(t[9]=e=>r.cargoQuantity=e),type:"number"},null,8,["modelValue"])]),_:1},8,["class"]),f(i,{class:"",style:{width:"680rpx",height:"2rpx","background-color":"#EAEAEA"}}),f(i,{class:"center",onClick:t[10]||(t[10]=e=>o.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(()=>[g(y(e.$t("common.submit")),1)]),_:1})]),_:1})]),_:1})]),_:1})}],["__scopeId","data-v-575f8784"]]);export{P as default};
|