acdr-ui/dist/build/mp-weixin/modules/pet/service/search.js
2024-10-01 09:15:35 +08:00

2 lines
2.8 KiB
JavaScript

"use strict";var e=(e,a,l)=>new Promise(((n,t)=>{var o=e=>{try{u(l.next(e))}catch(a){t(a)}},r=e=>{try{u(l.throw(e))}catch(a){t(a)}},u=e=>e.done?n(e.value):Promise.resolve(e.value).then(o,r);u((l=l.apply(e,a)).next())}));const a=require("../../../common/vendor.js"),l=require("../../../utils/http.js"),n=require("../../../utils/commUtils.js");if(!Array){(a.resolveComponent("wd-icon")+a.resolveComponent("wd-loadmore")+a.resolveComponent("layout-default-uni"))()}Math||((()=>"../../../node-modules/wot-design-uni/components/wd-icon/wd-icon.js")+t+(()=>"../../../node-modules/wot-design-uni/components/wd-loadmore/wd-loadmore.js")+o)();const t=()=>"../../../components/PetSitterCard.js",o=()=>"../../../components/EmptyState.js",r={__name:"search",setup(t){const o=a.ref(""),r=a.ref(!0),u=a.ref([]),i=a.ref(1),c=a.ref(!1),s=a.ref(!1),v=a.ref([{name:"interaction",label:"宠物互动",icon:"@/static/home/book.png"},{name:"nanny",label:"宠物月嫂",icon:"@/static/home/pb.png"},{name:"canteen",label:"宠物美容",icon:"@/static/home/yl.png"},{name:"training",label:"社交教培",icon:"@/static/home/mr.png"},{name:"cleaning",label:"宠物清洁",icon:"@/static/home/yl.png"}]),d=a.ref(v.value[0].label),m=a.ref(""),p=a.ref(""),f=()=>e(this,null,(function*(){if(!c.value){c.value=!0;try{const e=yield l.httpPost("/personal-service/list",{current:i.value,size:10,data:{serviceName:o.value,type:d.value}},{sortField:m.value,sortOrder:p.value});200===e.code&&(1===i.value?u.value=e.records:u.value=[...u.value,...e.records],e.records.length<10&&(s.value=!0))}catch(e){}finally{c.value=!1}}})),h=()=>e(this,null,(function*(){s.value||(i.value+=1,f())})),g=()=>e(this,null,(function*(){r.value=!r.value,m.value="price",p.value=r.value?"asc":"desc",i.value=1,s.value=!1,yield f()})),b=()=>e(this,null,(function*(){m.value="createTime",p.value="desc",i.value=1,s.value=!1,yield f()})),y=()=>{},_=a=>e(this,null,(function*(){d.value=a,i.value=1,s.value=!1,f()})),w=()=>{i.value=1,s.value=!1,f()};return a.onLoad((()=>{f()})),(e,l)=>a.e({a:a.p({name:"search",size:"40"}),b:a.o([e=>o.value=e.detail.value,w]),c:o.value,d:a.o(y),e:a.p({name:e.priceSortIcon,size:"20"}),f:a.o(g),g:a.o(b),h:a.p({name:"arrow-down",size:"20"}),i:a.f(v.value,((e,l,t)=>({a:a.n(d.value===e.label?"text-white":"text-gray-500"),b:"dbc510e9-4-"+t+",dbc510e9-0",c:a.p({name:a.unref(n.imgUrl)(e.icon),size:48}),d:a.n(d.value===e.name?"bg-_a__a_ffc107_a_":"bg-gray-200"),e:a.t(e.label),f:a.n(d.value===e.label?"text-_a__a_ffc107_a_":"text-gray-500"),g:e.name,h:a.o((a=>_(e.label)),e.name)}))),j:u.value.length>0},u.value.length>0?{k:a.f(u.value,((e,l,n)=>({a:"dbc510e9-5-"+n+",dbc510e9-0",b:a.p({petSitter:e}),c:l}))),l:a.o(h),m:a.p({loading:c.value,finished:s.value,"finished-text":"没有更多数据了"})}:{n:a.p({type:"search",message:"暂无相关服务"})})}},u=a._export_sfc(r,[["__scopeId","data-v-dbc510e9"]]);wx.createPage(u);