From 06993b2db1e1596467b738257fdf56b65a5bc8cd Mon Sep 17 00:00:00 2001 From: Cxpller Date: Thu, 26 Oct 2023 23:34:19 +0800 Subject: [PATCH] =?UTF-8?q?feat=20=E5=AE=A2=E6=9C=8D=E5=BC=B9=E7=AA=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../details/components/buy-bar/index.wxml | 2 +- pages/goods/details/index.js | 52 +++++++--- pages/goods/details/index.wxml | 99 +++++-------------- pages/goods/details/index.wxss | 36 +++++++ 4 files changed, 103 insertions(+), 86 deletions(-) diff --git a/pages/goods/details/components/buy-bar/index.wxml b/pages/goods/details/components/buy-bar/index.wxml index 37538c6..0f022d4 100644 --- a/pages/goods/details/components/buy-bar/index.wxml +++ b/pages/goods/details/components/buy-bar/index.wxml @@ -17,7 +17,7 @@ {{shopCartNum > 99 ? '99+' : shopCartNum}} - + {{item.title}} diff --git a/pages/goods/details/index.js b/pages/goods/details/index.js index 7a57523..52a9555 100644 --- a/pages/goods/details/index.js +++ b/pages/goods/details/index.js @@ -18,6 +18,9 @@ import { getGoodsDetailsCommentList, getGoodsDetailsCommentsCount, } from '~/services/good/fetchGoodsDetailsComments'; +import { + getCustomerServiceList +} from '~/services/usercenter/getCustomerServiceList'; import { cdnBase @@ -63,11 +66,10 @@ Page({ ], storeLogo: `${imgPrefix}common/store-logo.png`, storeName: '云mall标准版旗舰店', - jumpArray: [ - { + jumpArray: [{ title: '客服', url: '', - iconName: 'user_list', + iconName: 'user-list', }, { title: '收藏', @@ -112,6 +114,8 @@ Page({ duration: 500, interval: 5000, soldNum: 0, // 已售数量 + showCustomerService: false, //客服 + CustomerService: {}, //客服数据 }, handlePopupHide() { @@ -136,15 +140,40 @@ Page({ this.showSkuSelectPopup(2); }, + // 获取客服列表 + onGetCustomerServiceList() { + getCustomerServiceList().then((res) => { + if (res.code == 200) { + this.setData({ + CustomerService: res.data[0] + }) + } + }) + }, + + closeCustomerService() { + this.setData({ + showCustomerService: false + }); + }, + toNav(e) { const { url, title } = e.detail; + if (title == "客服") { + this.setData({ + showCustomerService: true, + }); + } + if (title == "收藏") { - if(this.data.details.isCollect){ - CancelGoodsCollection({goodsGuid: this.data.details.spuId}).then(() => { + if (this.data.details.isCollect) { + CancelGoodsCollection({ + goodsGuid: this.data.details.spuId + }).then(() => { Toast({ context: this, selector: '#t-toast', @@ -153,9 +182,10 @@ Page({ duration: 1000, }); }) - } - else{ - addOrUpdateGoodsCollection({goodsGuid: this.data.details.spuId}).then(() => { + } else { + addOrUpdateGoodsCollection({ + goodsGuid: this.data.details.spuId + }).then(() => { Toast({ context: this, selector: '#t-toast', @@ -477,12 +507,11 @@ Page({ // details.desc = details.desc.replace(/]*style\s*=\s*(['"])[^'"]*\1[^>]*>/gi, ']*>/gi, ''); if (details.isCollect === true) { - this.data.jumpArray[1].iconName = 'star_filled'; + this.data.jumpArray[1].iconName = 'star-filled'; this.setData({ jumpArray: this.data.jumpArray }) - } - else{ + } else { this.data.jumpArray[1].iconName = 'star'; this.setData({ jumpArray: this.data.jumpArray @@ -617,5 +646,6 @@ Page({ this.getDetail(spuId); this.getCommentsList(spuId); this.getCommentsStatistics(spuId); + this.onGetCustomerServiceList() }, }); \ No newline at end of file diff --git a/pages/goods/details/index.wxml b/pages/goods/details/index.wxml index e751166..35ee1a3 100644 --- a/pages/goods/details/index.wxml +++ b/pages/goods/details/index.wxml @@ -13,27 +13,21 @@ > --> - - - - + + + + - - - - + + + + - + @@ -51,7 +45,7 @@ --> - + {{details.title}} @@ -90,13 +84,7 @@ {{commentItem.userName}} - + {{commentItem.commentContent}} @@ -137,62 +125,25 @@ - + - + - - + + - + + + + + + + + 取消 + + \ No newline at end of file diff --git a/pages/goods/details/index.wxss b/pages/goods/details/index.wxss index 78a8ff7..4b47e78 100644 --- a/pages/goods/details/index.wxss +++ b/pages/goods/details/index.wxss @@ -428,4 +428,40 @@ page { border-radius: 50rpx; color: white; font-size: 25rpx; +} + +/* 客服弹窗 */ +.popup-content { + background: #f5f5f5; + margin-bottom: env(safe-area-inset-bottom); + border-radius: 16rpx 16rpx 0 0; +} + +.popup-content .popup-title { + background: #fff; + text-align: center; + font-size: 24rpx; + color: #999; + height: 112rpx; + text-align: center; + line-height: 112rpx; + border-radius: 16rpx 16rpx 0 0; +} + +.popup-content .popup-close { + background: #fff; + height: 100rpx; + display: flex; + justify-content: center; + align-items: center; + text-align: center; + font-size: 30rpx; + font-family: PingFangSC-Regular, PingFang SC; + font-weight: 400; + color: #333; +} + +.customer-service-img, +.customer-service-img>image { + width: 100%; } \ No newline at end of file