文杰 3 veckor sedan
förälder
incheckning
a4ddb43a32
4 ändrade filer med 39 tillägg och 41 borttagningar
  1. 23 24
      pages/Review/Review.js
  2. 4 6
      pages/Review/Review.wxml
  3. 6 5
      pages/prod/prod.js
  4. 6 6
      pages/prod/prod.wxml

+ 23 - 24
pages/Review/Review.js

@@ -11,6 +11,19 @@ Page({
     list:[]
   },
 
+  /**
+ * 评价图片预览
+ */
+  comPicPreView(e){
+    var idx = e.currentTarget.dataset.idx
+    var urls = e.currentTarget.dataset.pics
+  
+    wx.previewImage({
+      current: urls[idx],
+      urls: urls
+    })
+  },
+
   // 获取列表
   getList(){
     http.request({
@@ -26,12 +39,13 @@ Page({
             let list = []
             let img = ''
             res.records.map(e => {
-              if(e.pic){
-                img = e.pic.split(',')
-                e.pic = img[0]
+              if(e.pics){
+                img = e.pics.split(',')
+                e.pics = img
               }
             })
             if (this.data.current == 1) {
+              list = res.records
               this.setData({
                 list: res.records,
                 pages: res.pages,
@@ -43,12 +57,12 @@ Page({
               this.setData({
                 list
               })
-              console.log(list.length,res.total);
-              if (list.length >= res.total) {
-                this.setData({
-                  isAll: true
-                })
-              }
+            }
+            console.log(list.length,res.total);
+            if (list.length >= res.total) {
+              this.setData({
+                isAll: true
+              })
             }
           }
           
@@ -58,21 +72,6 @@ Page({
 
   },
 
-   /**
-   * 评价图片预览
-   */
-  comPicPreView(e){
-    var idx = e.currentTarget.dataset.idx
-    var urls = []
-    this.data.orderItemInfo.images.forEach(el => {
-      urls.push(el.url)
-    })
-    wx.previewImage({
-      current: urls[idx],
-      urls: urls
-    })
-  },
-
   /**
    * 生命周期函数--监听页面加载
    */

+ 4 - 6
pages/Review/Review.wxml

@@ -12,23 +12,21 @@
               <image src="{{prod}}" mode="aspectFill"  class="img" wx:for="{{item.orderItems}}" wx:for-item="prod" wx:for-index="d" data-idx="{{d}}" bind:tap="comPicPreView"/>
             </scroll-view>
               <view class="total-box">
-                <view class="price">¥13.95</view>
-                <view class="num">共5件</view>
+                <view class="price">¥{{price}}</view>
+                <view class="num">共{{}}件</view>
               </view>
           </view>
         </view>
         <view class="comment">
           <view class="info">
             <view class="user-info">
-              <view class="head"></view>
               <image src="{{item.avatar}}" mode="" class="head" />
-
               <view class="name">{{item.nickName}}</view>
             </view>
             <view class="time">{{item.recTime}}</view>
           </view>
           <view class="score-box">
-            <view class="num">{{item.score}}</view>
+            <view class="num">{{item.score}}.0</view>
             <image class="star" wx:for="{{item.score}}" src="../../images/icon/star-red.png" mode=""/>
           </view>
 
@@ -36,7 +34,7 @@
             <view class="desc">{{item.content}}</view>
 
               <view class="img-box">
-                <image wx:for="{{item.pics}}" wx:for-item="i" src="{{i}}" mode="" class="img" />
+                <image bind:tap="comPicPreView" data-pics="{{item.pics}}" data-idx="{{d}}" wx:for="{{item.pics}}" wx:for-item="i" wx:for-index="d" src="{{i}}" mode="" class="img" />
               </view>
 
               <view class="reply" wx:if="{{item.replyContent}}">

+ 6 - 5
pages/prod/prod.js

@@ -551,6 +551,7 @@ Page({
               }
             })
             if (this.data.current == 1) {
+              prodList = res.records
               this.setData({
                 prodList: res.records,
                 pages: res.pages,
@@ -562,11 +563,11 @@ Page({
               this.setData({
                 prodList
               })
-              if (res.records.length < 1) {
-                this.setData({
-                  isAll: true
-                })
-              }
+            }
+            if (prodList.length >= res.total) {
+              this.setData({
+                isAll: true
+              })
             }
           }
           

+ 6 - 6
pages/prod/prod.wxml

@@ -486,17 +486,17 @@
   <view class="cmt-tit">
     <view class="cmt-t">
       商品评价
-      <text class="cmt-good">好评度{{prodCommData.positiveRating}}%</text>
+      <text class="cmt-good">好评度{{prodCommData.goodRate}}%</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>
+      <text bindtap='getProdCommPage' data-evaluate="-1" class="{{evaluate==-1?'selected':''}}">全部({{prodCommData.all}})</text>
+      <text bindtap='getProdCommPage' data-evaluate="0" class="{{evaluate==0?'selected':''}}">好评({{prodCommData.goodCount}})</text>
+      <text bindtap='getProdCommPage' data-evaluate="1" class="{{evaluate==1?'selected':''}}">中评({{prodCommData.middleCount}})</text>
+      <text bindtap='getProdCommPage' data-evaluate="2" class="{{evaluate==2?'selected':''}}">差评({{prodCommData.badCount}})</text>
+      <text bindtap='getProdCommPage' data-evaluate="3" class="{{evaluate==3?'selected':''}}">有图({{prodCommData.picCount}})</text>
     </view>
     <view class="cmt-items">
       <view class="cmt-item" wx:for="{{prodCommPage.records}}" wx:key="prodCommId">