2 lines
4.1 KiB
JavaScript
2 lines
4.1 KiB
JavaScript
|
"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"),o=require("../../logic/pay.js");if(!Array){(a.resolveComponent("wd-icon")+a.resolveComponent("w-avatar")+a.resolveComponent("wd-input-number")+a.resolveComponent("layout-default-uni"))()}Math||(n+(()=>"../../node-modules/wot-design-uni/components/wd-icon/wd-icon.js")+u+(()=>"../../node-modules/wot-design-uni/components/wd-input-number/wd-input-number.js")+i)();const n=()=>"../../components/TopBar.js",u=()=>"../../components/Map.js",i=()=>"../../components/LoadingAnimation.js",r={__name:"detail",setup(n){const u=new Date,i=u.getFullYear(),r=(u.getMonth()+1).toString().padStart(2,"0"),s=u.getDate().toString().padStart(2,"0"),v=a.ref(`${i}-${r}-${s}`),d=a.ref(!1),c=a.ref({}),m=a.ref([]),p=a.ref([]),f=a.ref(!1),g=a.ref(""),h=a.ref(""),y=a.ref(""),w=a.ref(""),_=a.ref(1),b=a.ref({}),S=({value:e})=>{e>=1&&e<=12?_.value=e:l.toast("选择的服务时长在1-12小时")},j=()=>{},z=()=>e(this,null,(function*(){const e={reservationTime:`${v.value} 00:00:00`,personalServiceId:w.value,personalServiceUserId:c.value.serviceUserId,price:c.value.price*_.value,paymentMethod:"wxpay",address:b.value.id,pet:g.value,serviceHours:_.value};yield o.pay(e),I()})),x=e=>{v.value=e.detail.value},U=e=>{b.value=p.value[e.detail.value]},$=()=>{f.value=!0},I=()=>{f.value=!1},D=()=>e(this,null,(function*(){g.value&&v.value&&b.value.display?(yield z(),I()):l.toast("请选择宠物、日期和地址")}));return a.onLoad((o=>e(this,null,(function*(){d.value=!0;try{if(!o.id)return l.toast("该服务不存在!"),void a.index.navigateBack();const e=o.id;w.value=o.id,(()=>{const e=new Date;h.value=e.toISOString().split("T")[0];const a=new Date(e);a.setDate(e.getDate()+7),y.value=a.toISOString().split("T")[0]})();const n=yield t.httpGet(`/personal-service/service/${e}`);200===n.code?c.value=n.data:l.toast(n.message);const u=yield t.httpGet("/petInfo/my");200===u.code?(m.value=u.data,0!==m.value.length&&(g.value=m.value[0].id)):l.toast(u.message);const i=yield t.httpGet("/china-address/my");200===i.code?(p.value=i.data,p.value.forEach((e=>{e.display=`${e.province} ${e.city} ${e.district} ${e.detailAddress}`})),b.value=p.value[0]):l.toast(i.message)}catch(e){l.toast("获取服务详情失败!")}d.value=!1})))),(e,t)=>a.e({a:a.unref(l.baseUrl)+c.value.bgUrl,b:a.unref(l.baseUrl)+c.value.userAvatar,c:a.t(c.value.userName),d:a.t(c.value.certificationTime),e:a.t(c.value.serviceNumber),f:a.p({name:"location",size:"20"}),g:a.t(c.value.address),h:a.t(c.value.description),i:a.t(c.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(c.value.price),n:a.p({name:"home",size:"24"}),o:a.p({name:"scooter",size:"24"}),p:c.value.comment},c.value.comment?{q:a.t(c.value.comment.star),r:a.f(c.value.comment.star,((e,a,t)=>({a:"5694b64f-8-"+t+",5694b64f-0"}))),s:a.p({name:"star-on",size:"20"}),t:a.t(c.value.comment.commentNum),v:a.t(c.value.comment.comment)}:{},{w:a.p({locationName:"服务位置",initialLatitude:c.value.latitude,initialLongitude:c.value.longitude}),x:a.t(c.value.price),y:a.o(j),z:a.o($),A:f.value},f.value?a.e({B:m.value.length>0},m.value.length>0?{C:a.f(m.value,((e,t,o)=>({a:a.unref(l.baseUrl)+e.profileUrl,b:a.t(e.name),c:e.id,d:a.o((a=>{return t=e.id,void(g.value=t);var t}),e.id),e:a.n(g.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)("/pages/pet/pet-add-page")))},{F:a.t(v.value||"选择日期"),G:h.value,H:y.value,I:a.o(x),J:a.o(S),K:a.o((e=>_.value=e)),L:a.p({min:1,max:12,modelValue:_.value}),M:p.value.length>0},p.value.length>0?{N:a.t(b.value.display||"请选择地址"),O:p.value,P:a.o(U)}:{Q:a.p({size:80}),R:a.o((e=>a.unref(l.toPath)("/pages/address/index")))},{S:a.o(I),T:a.o(D)}):{},{U:a.o((e=
|