From a64cda2312e7c4bb717da2a9a4f755a5337a4f1b Mon Sep 17 00:00:00 2001 From: weiwei Date: Thu, 11 Sep 2025 12:38:54 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E5=95=86=E5=93=81=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages.json | 7 + src/pages/prosperity-shop/goods-form.vue | 104 +++++++++ src/pages/prosperity-shop/goods-manage.vue | 206 ++++++++++++++++-- src/pages/prosperity-shop/goods-search.vue | 2 +- src/pages/prosperity-shop/shop-detail.vue | 6 +- src/pages/tabbar/onlineShop.vue | 8 +- src/pages/tabbar/prosperityShop.vue | 4 +- src/sheep/api/prosperityShop.ts | 26 ++- .../components/tm-picker-view/picker-item.vue | 139 +++++++----- 9 files changed, 411 insertions(+), 91 deletions(-) create mode 100644 src/pages/prosperity-shop/goods-form.vue diff --git a/src/pages.json b/src/pages.json index c73d75b..d6e1571 100644 --- a/src/pages.json +++ b/src/pages.json @@ -165,6 +165,13 @@ "navigationBarTitleText": "商品管理", "disableScroll": true } + }, + { + "path": "goods-form", + "style": { + "navigationBarTitleText": "商品信息管理", + "disableScroll": true + } } ] }, 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 index 2b49354..9ba3c7d 100644 --- a/src/pages/prosperity-shop/goods-manage.vue +++ b/src/pages/prosperity-shop/goods-manage.vue @@ -1,30 +1,206 @@ + + diff --git a/src/pages/prosperity-shop/goods-search.vue b/src/pages/prosperity-shop/goods-search.vue index f1b8ba9..d794b07 100644 --- a/src/pages/prosperity-shop/goods-search.vue +++ b/src/pages/prosperity-shop/goods-search.vue @@ -94,7 +94,7 @@ onLoad((options: any) => { // 点击搜索 const search = () => { - pageRef.value && pageRef.value.reload(true) + pageRef.value && pageRef.value.reload(false) } const doGoodsDetail = (id: string) => { diff --git a/src/pages/prosperity-shop/shop-detail.vue b/src/pages/prosperity-shop/shop-detail.vue index 6cf636c..5c531fb 100644 --- a/src/pages/prosperity-shop/shop-detail.vue +++ b/src/pages/prosperity-shop/shop-detail.vue @@ -108,7 +108,7 @@ onLoad(async (option: any) => { uni.showLoading({ title: "加载中..." }) state.id = option.id await getShopDetail(option.id) - await getGoodsCategory(option.id) + await getGoodsCategoryTree(option.id) await getGoodsList() uni.hideLoading() }) @@ -119,8 +119,8 @@ const getShopDetail = async (id: string) => { state.detail = data } -const getGoodsCategory = async (id: string) => { - const { code, data, msg } = await prosperityShopApi.getGoodsCategory({ merchantId: id }) +const getGoodsCategoryTree = async (id: string) => { + const { code, data, msg } = await prosperityShopApi.getGoodsCategoryTree({ merchantId: id }) if (code != 0) return uni.showToast({ title: msg || "商品分类获取失败", icon: "none" }) state.category = treeToList(data) ?? [] } diff --git a/src/pages/tabbar/onlineShop.vue b/src/pages/tabbar/onlineShop.vue index f1231aa..731d4bc 100644 --- a/src/pages/tabbar/onlineShop.vue +++ b/src/pages/tabbar/onlineShop.vue @@ -216,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) } } } @@ -234,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 8a733e9..baa2c70 100644 --- a/src/pages/tabbar/prosperityShop.vue +++ b/src/pages/tabbar/prosperityShop.vue @@ -136,13 +136,13 @@ onLoad(async () => { // 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 search = () => { // state.params.categoryId = "" - pageRef.value && pageRef.value.reload(true) + pageRef.value && pageRef.value.reload(false) } // 联系商家 diff --git a/src/sheep/api/prosperityShop.ts b/src/sheep/api/prosperityShop.ts index bcba12c..fc623fa 100644 --- a/src/sheep/api/prosperityShop.ts +++ b/src/sheep/api/prosperityShop.ts @@ -9,13 +9,14 @@ export default { params: { productLimit: 5 }, }) }, - // 获取超市商户分类列表 - // getShopCategory: (): Promise => { - // return request({ - // url: "/supermarket/app/mall/merchant/category/list", - // method: "GET", - // }) - // }, + // 获取商品分类列表 + getGoodsCategory: (params?: any): Promise => { + return request({ + url: "/supermarket/app/mall/merchant/category/list", + method: "GET", + params, + }) + }, // 获取超市详情 getShopDetail: (id: string): Promise => { return request({ @@ -23,8 +24,8 @@ export default { method: "GET", }) }, - // 获取超市商品分类列表 - getGoodsCategory: (params: { merchantId: string }): Promise => { + // 获取超市商品分类列表树 + getGoodsCategoryTree: (params: { merchantId: string }): Promise => { return request({ url: `/supermarket/app/mall/category/tree`, method: "GET", @@ -46,4 +47,11 @@ export default { method: "GET", }) }, + // 删除商品 + deleteGoods: (id: string): Promise => { + return request({ + url: `/supermarket/app/mall/merchant/product/${id}`, + method: "DELETE", + }) + }, } 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 @@