diff --git a/src/App.vue b/src/App.vue index f7e497a..746ebf9 100644 --- a/src/App.vue +++ b/src/App.vue @@ -66,7 +66,7 @@ const tabbar: TabbarItem[] = [ text: "共富商城", iconPath: "/static/tabbar/prosperity-shop.png", selectedIconPath: "/static/tabbar/prosperity-shop-select.png", - launchParam: ["onlineShop"], + launchParam: ["prosperityShop"], auth: ["user"], }, { @@ -114,7 +114,7 @@ const tabbar: TabbarItem[] = [ text: "我的", iconPath: "/static/tabbar/my.png", selectedIconPath: "/static/tabbar/my-select.png", - launchParam: ["canteen", "selfMerchant", "onlineShop", "coopMerchant", "integrated"], + launchParam: ["canteen", "selfMerchant", "onlineShop", "coopMerchant", "integrated", "prosperityShop"], auth: ["user", "merchant", "doorAdmin"], }, ] diff --git a/src/pages.json b/src/pages.json index 1b93263..d6e1571 100644 --- a/src/pages.json +++ b/src/pages.json @@ -135,6 +135,46 @@ } ] }, + { + "root": "pages/prosperity-shop", + "pages": [ + { + "path": "goods-detail", + "style": { + "navigationBarTitleText": "商品详情", + "disableScroll": true + } + }, + { + "path": "shop-detail", + "style": { + "navigationBarTitleText": "超市详情", + "disableScroll": true + } + }, + { + "path": "goods-search", + "style": { + "navigationBarTitleText": "商品搜索", + "disableScroll": true + } + }, + { + "path": "goods-manage", + "style": { + "navigationBarTitleText": "商品管理", + "disableScroll": true + } + }, + { + "path": "goods-form", + "style": { + "navigationBarTitleText": "商品信息管理", + "disableScroll": true + } + } + ] + }, { "root": "pages/apply", "pages": [ diff --git a/src/pages/canteen/detail.vue b/src/pages/canteen/detail.vue index 03be740..25f3397 100644 --- a/src/pages/canteen/detail.vue +++ b/src/pages/canteen/detail.vue @@ -251,7 +251,7 @@ const doFood = () => { - + diff --git a/src/pages/prosperity-shop/goods-detail.vue b/src/pages/prosperity-shop/goods-detail.vue new file mode 100644 index 0000000..c9ef73c --- /dev/null +++ b/src/pages/prosperity-shop/goods-detail.vue @@ -0,0 +1,94 @@ + + + + + diff --git a/src/pages/prosperity-shop/goods-form.vue b/src/pages/prosperity-shop/goods-form.vue new file mode 100644 index 0000000..69770c1 --- /dev/null +++ b/src/pages/prosperity-shop/goods-form.vue @@ -0,0 +1,104 @@ + + + diff --git a/src/pages/prosperity-shop/goods-manage.vue b/src/pages/prosperity-shop/goods-manage.vue new file mode 100644 index 0000000..9ba3c7d --- /dev/null +++ b/src/pages/prosperity-shop/goods-manage.vue @@ -0,0 +1,206 @@ + + + + + diff --git a/src/pages/prosperity-shop/goods-search.vue b/src/pages/prosperity-shop/goods-search.vue new file mode 100644 index 0000000..d794b07 --- /dev/null +++ b/src/pages/prosperity-shop/goods-search.vue @@ -0,0 +1,106 @@ + + + diff --git a/src/pages/prosperity-shop/shop-detail.vue b/src/pages/prosperity-shop/shop-detail.vue new file mode 100644 index 0000000..5c531fb --- /dev/null +++ b/src/pages/prosperity-shop/shop-detail.vue @@ -0,0 +1,271 @@ + + + + + diff --git a/src/pages/tabbar/index.vue b/src/pages/tabbar/index.vue index 9326f03..23e5528 100644 --- a/src/pages/tabbar/index.vue +++ b/src/pages/tabbar/index.vue @@ -28,6 +28,12 @@ const moduleList = [ iconPath: "/static/tabbar/online-shop-select.png", launchParam: "onlineShop", }, + { + pagePath: "/pages/tabbar/prosperityShop", + text: "共富商城", + iconPath: "/static/tabbar/prosperity-shop-select.png", + launchParam: "prosperityShop", + }, { pagePath: "/pages/tabbar/cabinet", text: "智能柜", @@ -106,6 +112,10 @@ const jumpByParam = async () => { uni.setStorageSync("launchParam", launchParam) return uni.reLaunch({ url: "/pages/tabbar/onlineShop" }) } + if (launchParam === "prosperityShop") { + uni.setStorageSync("launchParam", launchParam) + return uni.reLaunch({ url: "/pages/tabbar/prosperityShop" }) + } if (launchParam === "coopMerchant") { uni.setStorageSync("launchParam", launchParam) return uni.reLaunch({ url: "/pages/tabbar/coopMerchant" }) diff --git a/src/pages/tabbar/my.vue b/src/pages/tabbar/my.vue index 6391ac9..a4138f5 100644 --- a/src/pages/tabbar/my.vue +++ b/src/pages/tabbar/my.vue @@ -3,10 +3,13 @@ - - + + {{ state.userInfo?.sysUser?.name }} @@ -22,8 +25,7 @@ - + {{ v.text }} @@ -33,15 +35,13 @@ - + 退出登录 - + 切换角色 @@ -426,10 +426,18 @@ onLoad(async () => { await userApi.userRole() + await isMerchant() + // 获取存储中的用户信息 storage.getUserInfo() }) +const isMerchant = async () => { + const { data } = await userApi.isMerchant() + if (data) + state.menuList.unshift({ text: "共富商城商品管理", icon: "/static/icon/service_4.png", router: "/pages/prosperity-shop/goods-manage" }) +} + onShow(() => { // 获取存储中的用户信息 storage.getUserInfo() diff --git a/src/pages/tabbar/onlineShop.vue b/src/pages/tabbar/onlineShop.vue index 274508d..731d4bc 100644 --- a/src/pages/tabbar/onlineShop.vue +++ b/src/pages/tabbar/onlineShop.vue @@ -53,7 +53,7 @@ { } } -const treeToList = (tree: T[], result: T[] = []): T[] => { - for (const node of tree) { - result.push(node) - if (node?.children?.length) { - treeToList(node.children, result) - } - } - return result -} - // 获取分类 const getClassify = async () => { if (state.curMerchant.id) { @@ -225,7 +216,7 @@ const getClassify = async () => { state.classifyList.unshift({ id: "", name: "全部分类" }) if (!isEmpty(state.classifyList)) { state.params.categoryId = state.classifyList[0].id - pageRef.value && pageRef.value.reload(true) + pageRef.value && pageRef.value.reload(false) } } } @@ -243,20 +234,20 @@ const confirmRadioMerchant = async () => { state.params.merchantId = state.curMerchant.id cartStore.saveShopMerchantId(state.curMerchant.id) await cartStore.getShopCart() - pageRef.value && pageRef.value.reload(true) + pageRef.value && pageRef.value.reload(false) } // 点击搜索 const searchProduct = () => { state.params.categoryId = "" - pageRef.value && pageRef.value.reload(true) + pageRef.value && pageRef.value.reload(false) } // 切换分类 const doClassify = async (categoryId: string) => { if (state.params.categoryId == categoryId) return state.params.categoryId = categoryId - pageRef.value && pageRef.value.reload(true) + pageRef.value && pageRef.value.reload(false) } const pageHook = hooks.usePage(pageRef, onlineShopApi.getSpuList, null, "data.records") diff --git a/src/pages/tabbar/prosperityShop.vue b/src/pages/tabbar/prosperityShop.vue index da0ac85..baa2c70 100644 --- a/src/pages/tabbar/prosperityShop.vue +++ b/src/pages/tabbar/prosperityShop.vue @@ -19,7 +19,7 @@ 共富商城 优质商户,品质商品,欢迎联系购买 - + - + - + {{ v.name }} {{ v.contactName }} - {{ v.contactPhone }} + {{ v.contactPhone }} {{ v.email }} - - 营业:{{ v.businessHours }} + + 营业:{{ v.businessHours }} @@ -80,7 +80,7 @@ - + {{ pV.title }} @@ -106,7 +106,7 @@ diff --git a/src/pages/user/userRole.vue b/src/pages/user/userRole.vue index b94be64..61fd70e 100644 --- a/src/pages/user/userRole.vue +++ b/src/pages/user/userRole.vue @@ -27,7 +27,7 @@ - 我是商户 + 我是合作商户 diff --git a/src/sheep/api/prosperityShop.ts b/src/sheep/api/prosperityShop.ts index 8097e42..fc623fa 100644 --- a/src/sheep/api/prosperityShop.ts +++ b/src/sheep/api/prosperityShop.ts @@ -9,4 +9,49 @@ export default { params: { productLimit: 5 }, }) }, + // 获取商品分类列表 + getGoodsCategory: (params?: any): Promise => { + return request({ + url: "/supermarket/app/mall/merchant/category/list", + method: "GET", + params, + }) + }, + // 获取超市详情 + getShopDetail: (id: string): Promise => { + return request({ + url: `/supermarket/app/mall/merchant/${id}`, + method: "GET", + }) + }, + // 获取超市商品分类列表树 + getGoodsCategoryTree: (params: { merchantId: string }): Promise => { + return request({ + url: `/supermarket/app/mall/category/tree`, + method: "GET", + params, + }) + }, + // 获取商品列表 + getGoodsList: (params: any): Promise => { + return request({ + url: `/supermarket/app/mall/merchant/product/list`, + method: "GET", + params, + }) + }, + // 获取商品详情 + getGoodsDetail: (id: string): Promise => { + return request({ + url: `/supermarket/app/mall/product/${id}`, + method: "GET", + }) + }, + // 删除商品 + deleteGoods: (id: string): Promise => { + return request({ + url: `/supermarket/app/mall/merchant/product/${id}`, + method: "DELETE", + }) + }, } diff --git a/src/sheep/components/crud/crud-layout/crud-layout.vue b/src/sheep/components/crud/crud-layout/crud-layout.vue index c90d790..1a38e1a 100644 --- a/src/sheep/components/crud/crud-layout/crud-layout.vue +++ b/src/sheep/components/crud/crud-layout/crud-layout.vue @@ -21,6 +21,7 @@ const props = withDefaults(defineProps(), { mainIsScroll: false, bg: "", }) +const emit = defineEmits(["scroll"]) const state = reactive({ navBgTitleColor_: props.navBgTitleColor, @@ -46,10 +47,11 @@ onMounted(() => { }) function scroll(e) { - if (!router.hasTabbar()) return - if (!props.scrollHideTabbar) return - const offset = 50 - const top = e.target.scrollTop + // if (!router.hasTabbar()) return + // if (!props.scrollHideTabbar) return + // const offset = 50 + // const top = e.target.scrollTop + emit("scroll", e) } function defaultPage() { @@ -67,7 +69,7 @@ function initBackStyle() { break case "just-flot-back": state.visble.topSafe = true - state.visble.topNav = false + state.visble.topNav = true break default: break diff --git a/src/sheep/utils/tree-to-list.ts b/src/sheep/utils/tree-to-list.ts new file mode 100644 index 0000000..ba991d7 --- /dev/null +++ b/src/sheep/utils/tree-to-list.ts @@ -0,0 +1,11 @@ +const treeToList = (tree: T[], result: T[] = []): T[] => { + for (const node of tree) { + result.push(node) + if (node?.children?.length) { + treeToList(node.children, result) + } + } + return result +} + +export default treeToList diff --git a/src/static/page/shop-goods-search.png b/src/static/page/shop-goods-search.png new file mode 100644 index 0000000..900b785 Binary files /dev/null and b/src/static/page/shop-goods-search.png differ diff --git a/src/uni_modules/tm-ui/components/tm-picker-view/picker-item.vue b/src/uni_modules/tm-ui/components/tm-picker-view/picker-item.vue index f223a0a..22b4268 100644 --- a/src/uni_modules/tm-ui/components/tm-picker-view/picker-item.vue +++ b/src/uni_modules/tm-ui/components/tm-picker-view/picker-item.vue @@ -1,54 +1,72 @@