From 0c9f95ce18e46ddf63baa98648893e42ca274dd3 Mon Sep 17 00:00:00 2001 From: donqi Date: Tue, 7 Jun 2022 11:23:36 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A6=96=E9=A1=B5=E7=83=AD=E9=97=A8=E5=95=86?= =?UTF-8?q?=E5=93=81=E5=B1=95=E7=A4=BA=E6=8E=A5=E5=8F=A3=E5=AF=B9=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/js/request.js | 14 ++++++++- .../goods-card/horizontal-goods-card.vue | 15 ++++++++-- components/goods-card/vertical-goods-card.vue | 11 ++++--- pages/index/home.vue | 30 ++++++++++++------- 4 files changed, 50 insertions(+), 20 deletions(-) diff --git a/common/js/request.js b/common/js/request.js index 2c9ccbb..3b6ad6f 100644 --- a/common/js/request.js +++ b/common/js/request.js @@ -372,5 +372,17 @@ export default { } }) return res[1].data; - } + }, + async getHotGoods(params = {}) { + let res = await uni.request({ + url: '/goods/goods/hot/list', + method: 'POST', + data: params, + header: { + pageNum: params.pageNum, + pageSize: params.pageSize + } + }) + return res[1].data; + }, } diff --git a/components/goods-card/horizontal-goods-card.vue b/components/goods-card/horizontal-goods-card.vue index 0ff6c25..4228903 100644 --- a/components/goods-card/horizontal-goods-card.vue +++ b/components/goods-card/horizontal-goods-card.vue @@ -5,17 +5,26 @@ {{product.goodsName}} - {{product.comments}} + {{product.remark}} {{product.discountPrice}} ¥{{product.goodsPrice}} - + {{product.goodsPrice}} - + + + {{product.goodsStandardList[0].discountPrice}} + ¥{{product.goodsStandardList[0].goodsPrice}} + + + {{product.goodsStandardList[0].goodsPrice}} + + + {{product.type}} diff --git a/components/goods-card/vertical-goods-card.vue b/components/goods-card/vertical-goods-card.vue index cfc94ed..c52f274 100644 --- a/components/goods-card/vertical-goods-card.vue +++ b/components/goods-card/vertical-goods-card.vue @@ -8,16 +8,15 @@ - + - {{item.name}} - {{item.desc}} + {{item.goodsName}} + {{item.remark}} {{item.tag}} - {{item.price}} + {{item.goodsStandardList[0].goodsPrice}} @@ -49,6 +48,6 @@ diff --git a/pages/index/home.vue b/pages/index/home.vue index 2c7a5a7..e1128cd 100644 --- a/pages/index/home.vue +++ b/pages/index/home.vue @@ -4,7 +4,7 @@ - + @@ -69,10 +69,10 @@ - + - + @@ -118,7 +118,7 @@ tabCur: 0, categories: [], subCategories: [], - hotGoods: {}, + hotGoods: [], discountGoods: {}, InputBottom: 0, isAuthWxLoginModal: false, @@ -151,14 +151,21 @@ if (this.isAuthWxPhoneModal) { return; } + // 加载区域信息 + this.loadRegionList(); + // 加载热门商品 + let hotGoodsRes = await this.$request.getHotGoods({ + pageNum: 0, + pageSize: 50 + }); + this.hotGoods = hotGoodsRes.rows; - this.loadRegionList(); this.swiperList = await this.$api.data('swiperList'); this.categories = await this.$api.data('categories'); this.subCategories = await this.$api.data('subCategories'); this.moduleBarInfos = await this.$api.data('moduleBarInfos'); - this.hotGoods = await this.$api.data('hotGoods'); - this.discountGoods = await this.$api.data('discountGoods'); + // this.hotGoods = await this.$api.data('hotGoods'); + // this.discountGoods = await this.$api.data('discountGoods'); }, bindEvent() { uni.$on('index_showProductDetail', this.showDetails); @@ -239,8 +246,11 @@ console.log("商品搜索中..."); }, showDetails(productItem) { - uni.navigateTo({ - url: '../product/product-detail' + let params = { + goodsId: productItem.goodsId + } + uni.navigateTo({ + url: '/pages/product/product-detail?params=' + encodeURIComponent(JSON.stringify(params)) }); }, showProductCategories() {