acdr-ui/dist/build/mp-weixin/pages/service/search.js

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),s=a.ref(!1),c=a.ref(!1),d=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"}]),v=a.ref(d.value[0].label),m=a.ref(""),p=a.ref(""),f=()=>e(this,null,(function*(){if(!s.value){s.value=!0;try{const e=yield l.httpPost("/personal-service/list",{current:i.value,size:10,data:{serviceName:o.value,type:v.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&&(c.value=!0))}catch(e){}finally{s.value=!1}}})),h=()=>e(this,null,(function*(){c.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,c.value=!1,yield f()})),y=()=>e(this,null,(function*(){m.value="createTime",p.value="desc",i.value=1,c.value=!1,yield f()})),_=()=>{},b=a=>e(this,null,(function*(){v.value=a,i.value=1,c.value=!1,f()})),w=()=>{i.value=1,c.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(_),e:a.p({name:e.priceSortIcon,size:"20"}),f:a.o(g),g:a.o(y),h:a.p({name:"arrow-down",size:"20"}),i:a.f(d.value,((e,l,t)=>({a:a.n(v.value===e.label?"text-white":"text-gray-500"),b:"d4a9dda5-4-"+t+",d4a9dda5-0",c:a.p({name:a.unref(n.imgUrl)(e.icon),size:48}),d:a.n(v.value===e.name?"bg-_a__a_ffc107_a_":"bg-gray-200"),e:a.t(e.label),f:a.n(v.value===e.label?"text-_a__a_ffc107_a_":"text-gray-500"),g:e.name,h:a.o((a=>b(e.label)),e.name)}))),j:u.value.length>0},u.value.length>0?{k:a.f(u.value,((e,l,n)=>({a:"d4a9dda5-5-"+n+",d4a9dda5-0",b:a.p({petSitter:e}),c:l}))),l:a.o(h),m:a.p({loading:s.value,finished:c.value,"finished-text":"没有更多数据了"})}:{n:a.p({type:"search",message:"暂无相关服务"})})}},u=a._export_sfc(r,[["__scopeId","data-v-d4a9dda5"]]);wx.createPage(u);