"use strict";const e=require("../../common/vendor.js"),a=require("../../api/index.js");if(!Array){(e.resolveComponent("wd-search")+e.resolveComponent("z-paging"))()}Math||((()=>"../../uni_modules/wot-design-uni/components/wd-search/wd-search.js")+(()=>"../../uni_modules/z-paging/components/z-paging/z-paging.js"))();const o=e.defineComponent({__name:"cate",setup(o){const l=e.ref(0),t=e.ref([]);e.ref([]);const n=e.ref(null),r=e.ref([]),u=e.ref(null),i=e.ref("");e.onLoad((()=>{a.api.goodsCate().then((e=>{t.value=e.list,u.value=e.list[0].id}))}));const c=(e,o)=>{u.value?a.api.goodsPage({pageNo:e,pageSize:o,categoryId:u.value,name:i.value}).then((e=>{n.value.complete(e.list)})).catch((e=>{n.value.complete(!1)})):a.api.goodsCate().then((l=>{t.value=l.list,u.value=l.list[0].id,a.api.goodsPage({pageNo:e,pageSize:o,categoryId:u.value,name:i.value}).then((e=>{n.value.complete(e.list)})).catch((e=>{n.value.complete(!1)}))}))},s=()=>{i.value="",n.value.reload()},d=e=>{i.value=e.value,n.value.reload()};let g=(e,a)=>{l.value=e,u.value=a,n.value.reload()};return(a,o)=>({a:e.o(d),b:e.o(s),c:e.p({"placeholder-left":!0,placeholder:"搜一搜药品名称","hide-cancel":!0,customStyle:{background:"#799675",height:"80rpx"}}),d:e.f(t.value,((a,o,t)=>({a:e.t(a.name),b:o,c:e.n(l.value==o?"u-tab-item-active":""),d:o,e:e.o((l=>e.unref(g)(o,a.id)),o)}))),e:e.f(r.value,((a,o,l)=>({a:a.cover,b:e.t(a.name),c:e.t(a.specs),d:e.t(a.currentPrice),e:e.t(a.originalPrice),f:o,g:e.o((o=>{return l=a.id,void e.index.navigateTo({url:`/pages/goods/goods?id=${l}`});var l}),o)}))),f:e.sr(n,"5aeaa743-1",{k:"paging"}),g:e.o(c),h:e.o((e=>r.value=e)),i:e.p({"use-page-scroll":!0,"paging-style":{"background-color":"#FFF"},modelValue:r.value})})}}),l=e._export_sfc(o,[["__scopeId","data-v-5aeaa743"]]);wx.createPage(l);
