diff --git a/src/pages/tabbar/coopMerchant.vue b/src/pages/tabbar/coopMerchant.vue index 651c1ab..8b1fac1 100644 --- a/src/pages/tabbar/coopMerchant.vue +++ b/src/pages/tabbar/coopMerchant.vue @@ -4,13 +4,16 @@ import { onLoad, onShow } from "@dcloudio/uni-app" import { merchantApi } from "@@/api" import { hooks, router } from "@@/index" import { filePath } from "@@/utils/file" +import zTabs from "@@/components/other/z-tabs/z-tabs.vue" const pageRef = ref(null) const state = reactive({ pa: { pagesize: 10, type: "2", + catgoryId: null, }, + tabs: [{ id: null, name: "全部", disabled: false }], }) const pageHook = hooks.usePage(pageRef, merchantApi.page, null, "data.records") @@ -18,14 +21,31 @@ const query = (page: number, pagesize: number) => { pageHook.startPage(page, pagesize, false, state.pa) } -onLoad(() => { +onLoad(async () => { const app = getApp() app._initTabbar() + + try { + const res: any = await merchantApi.selectCatgory({}) + if (res.code == 0) { + state.tabs = state.tabs.concat(res.data) + } else { + state.tabs = [{ id: null, name: "全部", disabled: false }] + } + } catch (error: any) { + uni.showToast({ title: error, icon: "none" }) + } }) onShow(() => { // pageRef.value && pageRef.value.reload(false) }) +const doTab = (e: any) => { + const target = state.tabs[e] + state.pa.catgoryId = target.id + pageRef.value.reload(true) +} + const toDetail = async (v: any) => { const isLogin = await hooks.useCheckLogin() if (isLogin) { @@ -52,6 +72,13 @@ const toDetail = async (v: any) => { :auto-scroll-to-top-when-reload="false" @scroll="pageHook.scroll" > + +