From 6c725f29871d4cf3d43ae6628f04ef107b046b85 Mon Sep 17 00:00:00 2001 From: "453530270@qq.com" Date: Wed, 8 Nov 2023 12:38:02 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A0=87=E7=9A=84=E8=AF=A6=E6=83=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/goods/components/SlideImage.vue | 2 +- pages/goods/detail.scss | 36 ++++++ pages/goods/detail.vue | 167 +++++++++++++++++++++----- pages/index/components/goods.vue | 8 +- 4 files changed, 177 insertions(+), 36 deletions(-) diff --git a/pages/goods/components/SlideImage.vue b/pages/goods/components/SlideImage.vue index adda7bc..570c430 100644 --- a/pages/goods/components/SlideImage.vue +++ b/pages/goods/components/SlideImage.vue @@ -15,7 +15,7 @@ - + diff --git a/pages/goods/detail.scss b/pages/goods/detail.scss index 1366465..232d087 100644 --- a/pages/goods/detail.scss +++ b/pages/goods/detail.scss @@ -117,6 +117,42 @@ font-size: 28rpx; } +// 标的信息 +.bdcontent { + //parent style + line-height: 1.4; + color: #3c3c3c; + + .item-title{ + padding: 26rpx 30rpx; + font-size: 36rpx; + font-weight: 600; + border-bottom: #eee solid 2rpx; + } + + .item-content{ + padding: 20rpx 26rpx; + // font-size: 30rpx; + + .gdic{ + display: flex; + flex-direction: row; + padding: 10rpx 0 10rpx 0rpx; + border-bottom: #eee solid 2rpx; + white-space: nowrap; + + &-tit{ + margin-right: 12rpx; + padding-right: 10rpx; + } + + &-txt{ + color: #808080; + } + } + } +} + // 底部操作栏 .footer-fixed { position: fixed; diff --git a/pages/goods/detail.vue b/pages/goods/detail.vue index 944eaf0..474fef4 100644 --- a/pages/goods/detail.vue +++ b/pages/goods/detail.vue @@ -1,8 +1,11 @@ @@ -93,10 +177,14 @@ return { // 正在加载 isLoading: true, - // 当前商品ID - goodsId: null, + // 当前商品goods_islicode + gislicode: null, // 商品详情 goods: {}, + // 商品相册 + gdimgs:[], + // 标的价格 + bdprice:'', // 购物车总数量 cartTotal: 0, // 显示/隐藏SKU弹窗 @@ -111,7 +199,7 @@ */ onLoad(options) { // 记录商品ID - this.goodsId = parseInt(options.goodsId) + this.gislicode = options.gislicode // 加载页面数据 this.onRefreshPage() }, @@ -122,7 +210,7 @@ onRefreshPage() { const app = this app.isLoading = true - Promise.all([app.getGoodsDetail(), app.getCartTotal()]) + Promise.all([app.getGoodsDetail()]) .finally(() => app.isLoading = false) }, @@ -130,12 +218,24 @@ getGoodsDetail() { const app = this return new Promise((resolve, reject) => { - GoodsApi.detail(app.goodsId) - .then(result => { - app.goods = result.data.detail - resolve(result) - }) - .catch(reject) + console.log(app.gislicode) + // 继续使用搜索商品的接口 + let sodata ={goods_islicode:app.gislicode} + GoodsApi.soglist(sodata).then(res=>{ + this.goods = res.data.data[0] + let imgitem = {"imgurl":this.goods.goods_images} + this.gdimgs.push(imgitem) + // 标的的价格 + if(this.goods.username == "中国数字文化集团有限公司" || + this.goods.username == "国家图书馆出版社有限公司" || + this.goods.username == "深圳国夏文化数字科技有限公司"){ + this.bdprice = "可议价(如需议价请拨打电话:0755-88266899)" + }else{ + this.bdprice = '¥'+this.goods.price + } + resolve(result) + }).catch(reject); + }) }, @@ -218,5 +318,10 @@ } diff --git a/pages/index/components/goods.vue b/pages/index/components/goods.vue index 450e413..95d38e0 100644 --- a/pages/index/components/goods.vue +++ b/pages/index/components/goods.vue @@ -3,7 +3,7 @@ - + @@ -18,7 +18,7 @@ ¥ {{ dataItem.price }} - 销量:110 {{ dataItem.sale_count }} + 销量:{{ dataItem.sale_count }} @@ -62,8 +62,8 @@ /** * 跳转商品详情页 */ - onTargetGoods(goodsId) { - this.$navTo(`pages/goods/detail`, { goodsId }) + onTargetGoods(gislicode) { + this.$navTo(`pages/goods/detail`, { gislicode }) } }