"use strict";var e=(e,a,t)=>new Promise(((l,o)=>{var n=e=>{try{i(t.next(e))}catch(a){o(a)}},u=e=>{try{i(t.throw(e))}catch(a){o(a)}},i=e=>e.done?l(e.value):Promise.resolve(e.value).then(n,u);i((t=t.apply(e,a)).next())}));const a=require("../../../common/vendor.js"),t=require("../../../utils/http.js"),l=require("../../../utils/commUtils.js");if(!Array){(a.resolveComponent("wd-icon")+a.resolveComponent("w-avatar")+a.resolveComponent("wd-input-number")+a.resolveComponent("wd-overlay")+a.resolveComponent("layout-default-uni"))()}Math||(o+(()=>"../../../node-modules/wot-design-uni/components/wd-icon/wd-icon.js")+n+(()=>"../../../node-modules/wot-design-uni/components/wd-input-number/wd-input-number.js")+(()=>"../../../node-modules/wot-design-uni/components/wd-overlay/wd-overlay.js")+u)();const o=()=>"../../../components/TopBar.js",n=()=>"../../../components/Map.js",u=()=>"../../../components/LoadingAnimation.js",i={__name:"detail",setup(o){const n=new Date,u=n.getFullYear(),i=(n.getMonth()+1).toString().padStart(2,"0"),r=n.getDate().toString().padStart(2,"0"),s=a.ref(`${u}-${i}-${r}`),v=a.ref(!1),d=a.ref({}),c=a.ref([]),m=a.ref([]),p=a.ref(!1),f=a.ref(""),g=a.ref(""),h=a.ref(""),w=a.ref(""),y=a.ref(1),_=a.ref({}),S=a.ref(!0),b=({value:e})=>{e>=1&&e<=12?y.value=e:l.toast("选择的服务时长在1-12小时")},j=()=>{},z=()=>e(this,null,(function*(){const e={reservationTime:new Date(`${s.value} 00:00:00`).getTime(),personalServiceId:w.value,personalServiceUserId:d.value.serviceUserId,price:d.value.price*y.value,paymentMethod:"alipay",address:_.value.id,pet:f.value,serviceHours:y.value};(yield t.httpPost("/order/create",e)).code,I()})),$=e=>{s.value=e.detail.value},x=e=>{_.value=m.value[e.detail.value]},D=()=>{p.value=!0,S.value=!1},I=()=>{p.value=!1,S.value=!0},T=()=>e(this,null,(function*(){f.value&&s.value&&_.value.display?(yield z(),I()):l.toast("请选择宠物、日期和地址")}));return a.onLoad((o=>e(this,null,(function*(){v.value=!0,S.value=!1,setTimeout((()=>{!v.value&&S.value&&(v.value=!1,S.value=!0)}),5e3);try{if(!o.id)return l.toast("该服务不存在!"),void a.index.navigateBack();const e=o.id;w.value=o.id,(()=>{const e=new Date;g.value=e.toISOString().split("T")[0];const a=new Date(e);a.setDate(e.getDate()+7),h.value=a.toISOString().split("T")[0]})();const n=yield t.httpGet(`/personal-service/service/${e}`);200===n.code?d.value=n.data:l.toast(n.message);const u=yield t.httpGet("/petInfo/my");200===u.code?(c.value=u.data,0!==c.value.length&&(f.value=c.value[0].id)):l.toast(u.message);const i=yield t.httpGet("/china-address/my");200===i.code?(m.value=i.data,m.value.forEach((e=>{e.display=`${e.province} ${e.city} ${e.district} ${e.detailAddress}`})),_.value=m.value[0]):l.toast(i.message)}catch(e){l.toast("获取服务详情失败!")}v.value=!1,S.value=!0})))),(e,t)=>a.e({a:d.value.bgUrl,b:d.value.userAvatar,c:a.t(d.value.userName),d:a.t(d.value.certificationTime),e:a.t(d.value.serviceNumber),f:a.p({name:"location",size:"20"}),g:a.t(d.value.address),h:a.t(d.value.description),i:a.t(d.value.serviceName),j:a.p({name:"bowl",size:"24"}),k:a.p({name:"water",size:"24"}),l:a.p({name:"litter",size:"24"}),m:a.t(d.value.price),n:a.p({name:"home",size:"24"}),o:a.p({name:"scooter",size:"24"}),p:d.value.comment},d.value.comment?{q:a.t(d.value.comment.star),r:a.f(d.value.comment.star,((e,a,t)=>({a:"67341ef4-8-"+t+",67341ef4-0"}))),s:a.p({name:"star-on",size:"20"}),t:a.t(d.value.comment.commentNum),v:a.t(d.value.comment.comment)}:{},{w:S.value,x:a.p({locationName:"服务位置",initialLatitude:d.value.latitude,initialLongitude:d.value.longitude}),y:a.t(d.value.price),z:a.o(j),A:a.o(D),B:c.value.length>0},c.value.length>0?{C:a.f(c.value,((e,t,o)=>({a:a.unref(l.imgUrl)(e.profileUrl),b:a.t(e.name),c:e.id,d:a.o((a=>{return t=e.id,void(f.value=t);var t}),e.id),e:a.n(f.value==e.id?"border-4 border-_a__a_ffc107_a_ color-_a__a_ffc107_a_":"")})))}:{D:a.p({size:80}),E:a.o((e=>a.unref(l.toPath)("/modules/pet/pet/pet-add-page")))},{F:a.t(s.value||"选择日期"),G:g.value,H:h.value,I:a.o($),J:a.o(b),K:a.o((e=>y.value=e)),L:a.p({min:1,max:12,modelValue:y.value}),M:m.value.length>0},m.value.length>0?{N:a.t(_.value.display||"请选择地址"),O:m.value,P:a.o(x)}:{Q:a.p({size:80}),R:a.o((e=>a.unref(l.toPath)("/modules/pet/address/index")))},{S:a.o(I),T:a.o(T),U:a.p({show:p.value}),V:a.o((e=>v.value=e)),W:a.p({modelValue:v.value})})}},r=a._export_sfc(i,[["__scopeId","data-v-67341ef4"]]);wx.createPage(r);