mirror of
https://gitee.com/gz-yami/mall4m.git
synced 2025-12-26 07:06:28 +08:00
未登录时不请求授权接口;
移除详情页评价模块;
This commit is contained in:
parent
1ff07df80d
commit
ac956c4896
@ -63,10 +63,6 @@ Page({
|
||||
|
||||
// 加载商品信息
|
||||
this.getProdInfo();
|
||||
// 加载评论数据
|
||||
this.getProdCommData();
|
||||
// 加载评论项
|
||||
this.getLittleProdComm();
|
||||
// 查看用户是否关注
|
||||
this.getCollection();
|
||||
},
|
||||
@ -75,6 +71,9 @@ Page({
|
||||
* 获取是否关注信息
|
||||
*/
|
||||
getCollection() {
|
||||
if (!wx.getStorageSync('token')) {
|
||||
return
|
||||
}
|
||||
wx.showLoading();
|
||||
var params = {
|
||||
url: "/p/user/collection/isCollection",
|
||||
@ -148,78 +147,7 @@ Page({
|
||||
};
|
||||
http.request(params);
|
||||
},
|
||||
getProdCommData() {
|
||||
http.request({
|
||||
url: "/prodComm/prodCommData",
|
||||
method: "GET",
|
||||
data: {
|
||||
prodId: this.data.prodId,
|
||||
},
|
||||
callBack: (res) => {
|
||||
this.setData({
|
||||
prodCommData: res
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
// 获取部分评论
|
||||
getLittleProdComm() {
|
||||
if (this.data.prodCommPage.records.length) {
|
||||
return;
|
||||
}
|
||||
this.getProdCommPage();
|
||||
},
|
||||
getMoreCommPage(e) {
|
||||
this.getProdCommPage();
|
||||
},
|
||||
// 获取分页获取评论
|
||||
getProdCommPage(e) {
|
||||
if (e) {
|
||||
if (e.currentTarget.dataset.evaluate === this.data.evaluate) {
|
||||
return;
|
||||
}
|
||||
this.setData({
|
||||
prodCommPage: {
|
||||
current: 0,
|
||||
pages: 0,
|
||||
records: []
|
||||
},
|
||||
evaluate: e.currentTarget.dataset.evaluate
|
||||
})
|
||||
}
|
||||
http.request({
|
||||
url: "/prodComm/prodCommPageByProd",
|
||||
method: "GET",
|
||||
data: {
|
||||
prodId: this.data.prodId,
|
||||
size: 10,
|
||||
current: this.data.prodCommPage.current + 1,
|
||||
evaluate: this.data.evaluate
|
||||
},
|
||||
callBack: (res) => {
|
||||
res.records.forEach(item => {
|
||||
if (item.pics) {
|
||||
item.pics = item.pics.split(',')
|
||||
}
|
||||
})
|
||||
let records = this.data.prodCommPage.records
|
||||
records = records.concat(res.records)
|
||||
this.setData({
|
||||
prodCommPage: {
|
||||
current: res.current,
|
||||
pages: res.pages,
|
||||
records: records
|
||||
}
|
||||
})
|
||||
// 如果商品详情中没有评论的数据,截取两条到商品详情页商品详情
|
||||
if (!this.data.littleCommPage.length) {
|
||||
this.setData({
|
||||
littleCommPage: records.slice(0, 2)
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
getCouponList() {
|
||||
http.request({
|
||||
url: "/coupon/listByProdId",
|
||||
|
||||
@ -47,47 +47,6 @@
|
||||
<view class="sku-con">{{selectedProp.length>0?selectedProp+',':selectedProp}}{{prodNum}}件</view>
|
||||
<view class="more">...</view>
|
||||
</view>
|
||||
<!-- 评价 -->
|
||||
<view class='cmt-wrap'>
|
||||
<view class="cmt-tit" bindtap='showComment'>
|
||||
<view class="cmt-t">
|
||||
评价
|
||||
<text class="cmt-good">好评{{prodCommData.positiveRating}}%</text>
|
||||
</view>
|
||||
<view class="cmt-count">
|
||||
共{{prodCommData.number}}条
|
||||
<text class="cmt-more"></text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="cmt-cont">
|
||||
<view class="cmt-tag" bindtap='showComment'>
|
||||
<text>全部({{prodCommData.number}})</text>
|
||||
<text>好评({{prodCommData.praiseNumber}})</text>
|
||||
<text>中评({{prodCommData.secondaryNumber}})</text>
|
||||
<text>差评({{prodCommData.negativeNumber}})</text>
|
||||
<text>有图({{prodCommData.picNumber}})</text>
|
||||
</view>
|
||||
<view class="cmt-items">
|
||||
<view class="cmt-item" wx:for="{{littleCommPage}}" wx:key="prodCommId">
|
||||
<view class="cmt-user">
|
||||
<text class="date">{{item.recTime}}</text>
|
||||
<view class="cmt-user-info">
|
||||
<image class="user-img" src="{{item.pic}}"></image>
|
||||
<view class="nickname">{{item.nickName}}</view>
|
||||
<van-rate readonly value="{{ item.score }}" bind:change="onChange" color="#f44" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="cmt-cnt">{{item.content}}</view>
|
||||
<scroll-view class="cmt-attr" scroll-x="true" wx:if="{{item.pics.length}}">
|
||||
<image src="{{commPic}}" wx:for='{{item.pics}}' wx:for-item="commPic" wx:key='*this'></image>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="cmt-more-v" wx:if="{{prodCommPage.records.length > 2}}">
|
||||
<text bindtap='showComment'>查看全部评价</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 商品详情 -->
|
||||
<view class="prod-detail">
|
||||
<view>
|
||||
@ -180,46 +139,5 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 评价弹窗 -->
|
||||
<view class="cmt-popup" wx:if="{{commentShow}}">
|
||||
<view class="cmt-tit">
|
||||
<view class="cmt-t">
|
||||
商品评价
|
||||
<text class="cmt-good">好评度{{prodCommData.positiveRating}}%</text>
|
||||
</view>
|
||||
<text class="close" bindtap='closePopup'></text>
|
||||
</view>
|
||||
<view class="cmt-cont">
|
||||
<view class="cmt-tag">
|
||||
<text bindtap='getProdCommPage' data-evaluate="-1" class="{{evaluate==-1?'selected':''}}">全部({{prodCommData.number}})</text>
|
||||
<text bindtap='getProdCommPage' data-evaluate="0" class="{{evaluate==0?'selected':''}}">好评({{prodCommData.praiseNumber}})</text>
|
||||
<text bindtap='getProdCommPage' data-evaluate="1" class="{{evaluate==1?'selected':''}}">中评({{prodCommData.secondaryNumber}})</text>
|
||||
<text bindtap='getProdCommPage' data-evaluate="2" class="{{evaluate==2?'selected':''}}">差评({{prodCommData.negativeNumber}})</text>
|
||||
<text bindtap='getProdCommPage' data-evaluate="3" class="{{evaluate==3?'selected':''}}">有图({{prodCommData.picNumber}})</text>
|
||||
</view>
|
||||
<view class="cmt-items">
|
||||
<view class="cmt-item" wx:for="{{prodCommPage.records}}" wx:key="prodCommId">
|
||||
<view class="cmt-user">
|
||||
<text class="date">{{item.recTime}}</text>
|
||||
<view class="cmt-user-info">
|
||||
<image class="user-img" src="{{item.pic}}"></image>
|
||||
<view class="nickname">{{item.nickName}}</view>
|
||||
<van-rate readonly value="{{ item.score }}" bind:change="onChange" color="#f44" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="cmt-cnt">{{item.content}}</view>
|
||||
<scroll-view class="cmt-attr" scroll-x="true" wx:if="{{item.pics.length}}">
|
||||
<image src="{{commPic}}" wx:for='{{item.pics}}' wx:for-item="commPic" wx:key='*this'></image>
|
||||
</scroll-view>
|
||||
<view class="cmt-reply" wx:if="{{item.replyContent}}">
|
||||
<text class='reply-tit'>店铺回复:</text> {{item.replyContent}}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="load-more" wx:if='{{prodCommPage.pages > prodCommPage.current}}'>
|
||||
<text bindtap='getMoreCommPage'>点击加载更多</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<wxs module="wxs" src="../../wxs/number.wxs" />
|
||||
@ -149,6 +149,10 @@ function updateUserInfo() {
|
||||
|
||||
//获取购物车商品数量
|
||||
function getCartCount() {
|
||||
if (!wx.getStorageSync('token')) {
|
||||
wx.removeTabBarBadge()
|
||||
return
|
||||
}
|
||||
var params = {
|
||||
url: "/p/shopCart/prodCount",
|
||||
method: "GET",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user