文杰 3 недель назад
Родитель
Сommit
db5af04c2d

+ 67 - 5
pages/Review/Review.js

@@ -1,14 +1,62 @@
 // pages/Review.js
+var http = require('../../utils/http.js');
 Page({
 
   /**
    * 页面的初始数据
    */
   data: {
-
+    current:1,
+    pages:0,
+    list:[]
   },
 
-  getList(){},
+  // 获取列表
+  getList(){
+    http.request({
+      url: "/p/prodComm/myCommList",
+      method: "GET",
+      data: {
+        current: this.data.current,
+        size: 10,
+      },
+      callBack: (res) => {
+
+          if(res.records&&res.records.length){
+            let list = []
+            let img = ''
+            res.records.map(e => {
+              if(e.pic){
+                img = e.pic.split(',')
+                e.pic = img[0]
+              }
+            })
+            if (this.data.current == 1) {
+              this.setData({
+                list: res.records,
+                pages: res.pages,
+                current: res.current
+              });
+            } else {
+              list = this.data.list
+              list.push(...res.records)
+              this.setData({
+                list
+              })
+              console.log(list.length,res.total);
+              if (list.length >= res.total) {
+                this.setData({
+                  isAll: true
+                })
+              }
+            }
+          }
+          
+        
+      }
+    })
+
+  },
 
    /**
    * 评价图片预览
@@ -29,7 +77,7 @@ Page({
    * 生命周期函数--监听页面加载
    */
   onLoad(options) {
-
+    this.getList()
   },
 
   /**
@@ -70,8 +118,22 @@ Page({
   /**
    * 页面上拉触底事件的处理函数
    */
-  onReachBottom() {
-    this.getList()
+  onReachBottom: function () {
+    this.getNextPage()
+  },
+  // 触底加载下一页
+  getNextPage() {
+    console.log('getNextPage',this.data.current);
+    if (this.data.pages > this.data.current) {
+      this.setData({
+        current: this.data.current + 1
+      })
+      this.getList()
+    } else {
+      this.setData({
+        isAll: true
+      })
+    }
   },
 
   /**

+ 26 - 15
pages/Review/Review.wxml

@@ -1,15 +1,15 @@
 <view class="review">
-   <view class="item">
+  <view wx:if="{{list.length>0}}">
+   <view class="item" wx:for="{{list}}">
         <view class="goods-box">
           <view class="shop-info">
             <image src="../../images/icon/shop.png" mode="" class="icon"/>
-            <view class="shop-name">中数超市(富力中心店)</view>
+            <view class="shop-name">{{item.shopName}}</view>
           </view>
 
           <view class="relative">
             <scroll-view class="goods-list"  scroll-x="true">
-              <view class="img"></view>
-              <!-- <image src="{{item}}" mode="aspectFill"  class="img" wx:for="{{}}" data-idx="{{index}}" bind:tap="comPicPreView"/> -->
+              <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>
@@ -21,30 +21,41 @@
           <view class="info">
             <view class="user-info">
               <view class="head"></view>
-              <view class="name">饼饼</view>
+              <image src="{{item.avatar}}" mode="" class="head" />
+
+              <view class="name">{{item.nickName}}</view>
             </view>
-            <view class="time">03-20</view>
+            <view class="time">{{item.recTime}}</view>
           </view>
           <view class="score-box">
-            <view class="num">4.0</view>
-            <image class="star" wx:for="{{4}}" src="../../images/icon/star-red.png" mode=""/>
+            <view class="num">{{item.score}}</view>
+            <image class="star" wx:for="{{item.score}}" src="../../images/icon/star-red.png" mode=""/>
           </view>
 
           <view class="content">
-            <view class="desc">这个大闸蟹非常好,非常新鲜,秋季正是吃大闸蟹的
-  好时候</view>
+            <view class="desc">{{item.content}}</view>
 
               <view class="img-box">
-                <view class="img"></view>
-                <view class="img"></view>
-                <view class="img"></view>
+                <image wx:for="{{item.pics}}" wx:for-item="i" src="{{i}}" mode="" class="img" />
               </view>
 
-              <view class="reply">
+              <view class="reply" wx:if="{{item.replyContent}}">
                 <view class="label">平台回复</view>
-                <view class="value">谢谢您的评价,我们会做得更好</view>
+                <view class="value">{{item.replyContent}}</view>
               </view>
           </view>
         </view>
    </view>
+  </view>
+   <block wx:else>
+      <view style="height: 500rpx;">
+        <van-empty  description="你还没有评论哦" />
+      </view>
+    </block>
+   <block wx:if="{{list.length>0}}">
+    <view class="tips" wx:if="{{isAll}}">已经到底咯~</view>
+    <view class="loading-box" wx:else>
+      <van-loading size="20px" type="spinner" color="#006CE8">加载中...</van-loading>
+    </view>
+  </block>
 </view>

+ 13 - 0
pages/Review/Review.wxss

@@ -168,4 +168,17 @@
   font-size: 24rpx;
   color: #222222;
   margin-left: 20rpx;
+}
+
+.tips {
+  height: 60rpx;
+  line-height: 60rpx;
+  text-align: center;
+  font-size: 24rpx;
+  color: #AAAAAA;
+}
+.loading-box{
+  text-align: center;
+  line-height: 80rpx;
+  height: 80rpx;
 }

+ 22 - 1
pages/afterSales/afterSales.js

@@ -11,6 +11,7 @@ Page({
     pages: 0,
     startTime: '',  //开始时间
     endTime: '',  //结束时间
+    isAll:false
     //orderItems: '',  //订单项
   },
 
@@ -51,6 +52,11 @@ Page({
           list = this.data.list;
           Array.prototype.push.apply(list, res.records);
         }
+        if (list.length >= res.total) {
+          this.setData({
+            isAll: true
+          })
+        }
         this.setData({
           list: list,
           pages: res.pages,
@@ -167,11 +173,26 @@ Page({
 
   },
 
+  // 触底加载下一页
+  getNextPage() {
+    console.log('getNextPage',this.data.current);
+    if (this.data.pages > this.data.current) {
+      this.setData({
+        current: this.data.current + 1
+      })
+      this.myRefundOrder()
+    } else {
+      this.setData({
+        isAll: true
+      })
+    }
+  },
+  
   /**
    * 页面上拉触底事件的处理函数
    */
   onReachBottom: function () {
-
+    this.getNextPage()
   },
 
   /**

+ 6 - 0
pages/afterSales/afterSales.wxml

@@ -79,6 +79,12 @@
       </view>
       <view class="empty-text">还没有退款/售后相关订单~</view>
     </view>
+    <block wx:if="{{list.length>0}}">
+      <view class="tips" wx:if="{{isAll}}">已经到底咯~</view>
+      <view class="loading-box" wx:else>
+        <van-loading size="20px" type="spinner" color="#006CE8">加载中...</van-loading>
+      </view>
+    </block>
     
   </view>
 </view>

+ 14 - 0
pages/afterSales/afterSales.wxss

@@ -210,4 +210,18 @@ image {
 }
 
 
+.tips {
+  height: 60rpx;
+  line-height: 60rpx;
+  text-align: center;
+  font-size: 24rpx;
+  color: #AAAAAA;
+}
+.loading-box{
+  text-align: center;
+  line-height: 80rpx;
+  height: 80rpx;
+}
+
+
 

+ 1 - 1
pages/basket/basket.js

@@ -171,7 +171,7 @@ Page({
     }
     wx.setStorageSync("basketIds", JSON.stringify(basketIds));
     wx.navigateTo({
-      url: '/pages/submit-order/submit-order?orderEntry=0',
+      url: '/pages/submit-order/submit-order?orderEntry=0&shopId='+arr[0].shopId,
     })
   },
 

+ 1 - 1
pages/category/category.js

@@ -749,7 +749,7 @@ Page({
     })
     wx.setStorageSync("basketIds", JSON.stringify(basketIds));
     wx.navigateTo({
-      url: '/pages/submit-order/submit-order?orderEntry=0',
+      url: '/pages/submit-order/submit-order?orderEntry=0&shopId='+this.data.carData[0].shopId,
     })
   }
 

+ 1 - 1
pages/category1/category.js

@@ -749,7 +749,7 @@ Page({
     })
     wx.setStorageSync("basketIds", JSON.stringify(basketIds));
     wx.navigateTo({
-      url: '/pages/submit-order/submit-order?orderEntry=0',
+      url: '/pages/submit-order/submit-order?orderEntry=0&shopId='+this.data.carData[0].shopId,
     })
   }
 

+ 3 - 2
pages/commResult/commResult.wxss

@@ -1,6 +1,6 @@
 /* pages/commResult/commResult.wxss */
 .commResult{
-  background: linear-gradient( 180deg, #E5F1FF 0%, rgba(229,241,255,0) 406rpx,#fff 100%);
+  background: #f6f6f6;
   border-radius: 0rpx 0rpx 0rpx 0rpx;
   display: flex;
   flex-direction: column;
@@ -12,6 +12,7 @@
 .commResult .icon{
   width: 200rpx;
   height: 200rpx;
+  margin-top: 80rpx;
 }
 
 .commResult .title{
@@ -28,7 +29,7 @@
 }
 .commResult .btn-box{
   display: flex;
-
+  margin-top: 60rpx;
 }
 .commResult .btn-box .btn{
   width: 240rpx;

+ 1 - 1
pages/login/login.js

@@ -75,7 +75,7 @@ Page({
       method: 'GET',
       data: {},
       callBack: (res) => {
-        wx.setStorageSync('channelId',res.channelId)
+        res.channelId&&wx.setStorageSync('channelId',res.channelId)
       }
     }
     http.request(param)

+ 35 - 5
pages/order-detail/order-detail.js

@@ -58,6 +58,7 @@ Page({
     polyline:[],
     includePoints:[],//存放点位 显示完整图标
     timer:null,//定时器
+    commSts:1,//评论状态: 0 未评价  1 已评价
   },
 
   /**
@@ -192,8 +193,7 @@ Page({
           estimatedTime: res.estimatedTime,
           estimatedTimeStr: res.estimatedTimeStr,
           cancelReason: res.cancelReason,
-          
-
+          commSts: res.commSts,
         });
         
         wx.hideLoading();
@@ -429,10 +429,8 @@ Page({
    * 去评价
    */
   goWrite(e){
-    var info = e.currentTarget.dataset.info;
-    wx.setStorageSync("orderItemInfo", this.data.orderItemDtos);
     wx.navigateTo({
-      url: '/pages/prodComm/prodComm',
+      url: '/pages/prodComm/prodComm?orderNumber='+this.data.orderNumber,
     })
   },
 
@@ -471,6 +469,38 @@ Page({
     })
   },
 
+  /**
+   * 确认收货
+   */
+  onConfirmReceive: function (e) {
+    var ths = this;
+    wx.showModal({
+      title: '',
+      content: '我已收到货?',
+      confirmColor: "#006CE8",
+      success(res) {
+        if (res.confirm) {
+          wx.showLoading({
+            mask: true
+          });
+          var params = {
+            url: "/p/myOrder/receipt/" + ths.data.orderNumber,
+            method: "PUT",
+            data: {},
+            callBack: function (res) {
+              wx.hideLoading();
+              ths.loadOrderDetail(ths.data.orderNumber)  //请求订单详情数据
+
+            }
+          };
+          http.request(params);
+        } else if (res.cancel) {
+          //console.log('用户点击取消')
+        }
+      }
+    })
+  },
+
   /**
    * 申请退款
    */

+ 8 - 2
pages/order-detail/order-detail.wxml

@@ -77,12 +77,18 @@
         </view>
       </view>
       <!-- <view class="item" bind:tap="goWrite"> -->
-      <!-- <view class="item" wx:if="{{status == 80}}" bind:tap="goWrite">
+      <view class="item" wx:if="{{status == 80&&commSts == 0}}" bind:tap="goWrite">
         <image class="icon" src="../../images/icon/write.png" mode=""/>
         <view class="label">
           评价晒单
         </view>
-      </view> -->
+      </view>
+      <view class="item" wx:if="{{status == 70}}">
+        <image class="icon" src="../../images/icon/buy-icon.png" mode=""/>
+        <view class="label">
+          确认收货
+        </view>
+      </view>
       <!-- <view class="item" wx:if="{{status != 0}}">
         <image class="icon" src="../../images/icon/buy-icon.png" mode=""/>
         <view class="label">

+ 2 - 3
pages/orderList/orderList.js

@@ -360,10 +360,9 @@ Page({
    * 跳转评价页面
    */
   onComment: function (e) {
-    var info = e.currentTarget.dataset.info;
-    wx.setStorageSync("orderItemInfo", info);
+    var ordernum = e.currentTarget.dataset.ordernum;
     wx.navigateTo({
-      url: '/pages/prodComm/prodComm',
+      url: '/pages/prodComm/prodComm?orderNumber='+ordernum,
     })
   }
 

+ 2 - 2
pages/orderList/orderList.wxml

@@ -139,9 +139,9 @@
             <!-- <text class="button warn" bindtap="" data-ordernum="{{item.orderNumber}}" hover-class='none'>再次购买</text> -->
             <text wx:if="{{item.hbOrderStatus==0}}" class="button warn" data-ordertype="{{item.orderType}}" bindtap="onPayAgain" data-ordernum="{{item.orderNumber}}" hover-class='none'>付款</text>
             <!-- <text wx:if="{{item.hbOrderStatus==20 ||item.hbOrderStatus==30 ||item.hbOrderStatus==40 || item.hbOrderStatus==80}}" class="button" bindtap="toDeliveryPage" data-lat="{{item.latitude}}" data-lon="{{item.longitude}}" data-ordernum="{{item.orderNumber}}" hover-class='none'>查看物流</text> -->
-            <text wx:if="{{item.hbOrderStatus==70&&item.dvyType == 1}}" class="button warn" bindtap="onConfirmReceive" data-ordernum="{{item.orderNumber}}" hover-class='none'>确认收货</text>
+            <text wx:if="{{item.hbOrderStatus==70}}" class="button warn" bindtap="onConfirmReceive" data-ordernum="{{item.orderNumber}}" hover-class='none'>确认收货</text>
             <!-- 评价status==5 -->
-            <text wx:if="{{item.hbOrderStatus==80 && item.orderItemDtos[0].commSts==0}}" class="button warn" bindtap="onComment" data-info="{{item.orderItemDtos}}" data-ordernum="{{item.orderNumber}}" hover-class='none'>评价</text>
+            <text wx:if="{{item.hbOrderStatus==80 && item.commSts==0}}" class="button warn" bindtap="onComment" data-info="{{item.orderItemDtos}}" data-ordernum="{{item.orderNumber}}" hover-class='none'>评价</text>
           </view>
         </view>
       </view>

+ 31 - 2
pages/prod/prod.js

@@ -34,6 +34,7 @@ Page({
     content: '',
     prodId: 0,
     brief: '',
+    halfTitle: '',
     skuId: 0,
     popupShow: false,
     // 是否获取过用户领取过的优惠券id
@@ -197,6 +198,8 @@ Page({
     })
     if(tab == 0){//相似商品
       this.getSimilarProdList()
+    }else{
+      this.getOften()
     }
   },
   /**
@@ -356,6 +359,7 @@ Page({
           prodName: res.prodName,
           prodId: res.prodId,
           brief: res.brief,
+          halfTitle: res.halfTitle,
           totalStocks: res.totalStocks,
           // skuId: res.skuId
           skuList: res.skuList,
@@ -427,7 +431,7 @@ Page({
   },
   getProdCommData() {
     http.request({
-      url: "/prod/prodCommData",
+      url: "/p/prodComm/commentCount",
       method: "GET",
       data: {
         prodId: this.data.prodId,
@@ -571,6 +575,31 @@ Page({
     })
 
   },
+   // 获取经常一起买
+   getOften(){
+    let that = this
+    http.request({
+      url: "/sku/buyTogetherOften",
+      method: "GET",
+      data: {
+        shopId:this.data.shopId,
+        prodId:this.data.prodId,
+        channelId:wx.getStorageSync('channelId'),
+        current: 1,
+        size: 18,
+      },
+      callBack: (res) => {
+          let list = that.splitArrayToPages(res.records)
+          that.setData({
+            list
+          })
+      }
+    })
+
+  },
+
+  
+
   // 获取相似商品
   getSimilarProdList(){
     let that = this
@@ -1104,7 +1133,7 @@ Page({
       distributionCardNo: ctx.data.distributionCardNo
     }));
     wx.navigateTo({
-      url: '/pages/submit-order/submit-order?orderEntry=1',
+      url: '/pages/submit-order/submit-order?orderEntry=1&shopId='+ctx.data.shopId,
     })
   },
 

+ 24 - 21
pages/prod/prod.wxml

@@ -22,8 +22,8 @@
   <view class="content">
 
     <!-- 倒计时栏 -->
-    <view class="countdown-box clearfix" wx-if="{{groupActivityId}}">
       <!-- 拼团 -->
+    <!-- <view class="countdown-box clearfix" wx-if="{{groupActivityId}}">
       <text class="second-kill">拼团</text>
       <view class="countdown-content">
         <text class="countdown-tips" wx-if="{{groupActivity.activityStatus === 1}}">距开始仅剩</text>
@@ -31,7 +31,7 @@
         <text class="countdown-time">{{endOfGroupTime.day}} 天 {{endOfGroupTime.hou}} 时 {{endOfGroupTime.min}} 分 {{endOfGroupTime.sec}} 秒
         </text>
       </view>
-    </view>
+    </view> -->
     <!-- 普通商品价格 -->
     <view class="prod-price" wx-if="{{!groupActivityId}}">
       <text class="price">¥<text class="price-num">{{wxs.parsePrice(defaultSku.price)[0]}}</text>.{{wxs.parsePrice(defaultSku.price)[1]}}</text>
@@ -47,7 +47,8 @@
           <!-- 收藏 -->
         </view>
       </view>
-      <view class="sales-p">{{brief}}</view>
+      <view class="sub-title" wx:if="{{halfTitle}}">{{halfTitle}}</view>
+      <view class="sales-p" wx:if="{{brief}}">{{brief}}</view>
 
       <!-- 拼团商品价格 -->
       <view class="goods-price" wx-if="{{groupActivityId}}">
@@ -136,10 +137,10 @@
     <view class='cmt-wrap border-radius-box'>
       <view class="cmt-tit" bindtap='showComment'>
         <view class="cmt-t">
-          评价({{prodCommData.number}})
+          评价({{prodCommData.all}})
           <!-- <text class="cmt-good">好评{{prodCommData.positiveRating}}%</text> -->
         </view>
-        <text class="cmt-good">好评{{prodCommData.positiveRating}}%     <text class="cmt-more"></text></text>
+        <text class="cmt-good">好评{{prodCommData.goodRate}}    <text class="cmt-more"></text></text>
 
         <!-- <view class="cmt-count">
           共{{prodCommData.number}}条
@@ -148,11 +149,11 @@
       </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>
+          <text>全部({{prodCommData.all}})</text>
+          <text>好评({{prodCommData.goodCount}})</text>
+          <text>中评({{prodCommData.middleCount}})</text>
+          <text>差评({{prodCommData.badCount}})</text>
+          <text>有图({{prodCommData.picCount}})</text>
         </view>
         <view class="cmt-items">
           <view class="cmt-item" wx:for="{{littleCommPage}}" wx:key="prodCommId">
@@ -183,19 +184,21 @@
         <view class="tab {{tab == 0?'active':''}}" data-tab="0" bind:tap="handleTab">相似商品</view>
         <view class="tab {{tab == 1?'active':''}}" data-tab="1" bind:tap="handleTab">经常一起买</view>
       </view>
-      <swiper class="swiper-prod {{list[0].length>3?'h844':''}}"  wx-if="{{list.length>0}}" indicator-dots="true" indicator-active-color="#006CE8" >
-      <swiper-item class="swiper-item" wx:for="{{list}}" wx:if="{{item.length}}">
-          <view class="item" wx:for="{{item}}" wx:for-item="i" wx:for-index="d" wx:key="{{d}}" bindtap='toProdPage' data-prodid="{{i.prodId}}" data-shopid="{{i.shopId}}">
-            <image lazy-load class="item-img" src="{{i.pic}}" mode="widthFix"></image>
-            <view class="item-title">{{i.prodName}}</view>
-            <view class="price-box">
-                <view class="name-price" style="font-size:26rpx;color: #FF4D3A;">¥{{wxs.toPrice(i.price)}}</view>
-              <image style="width:44rpx;height:44rpx;" src="/images/icon/car-btn.png" mode=""/>
+      <swiper class="swiper-prod {{list[0].length>3?'h844':''}}"  wx-if="{{list[0].length>0}}" indicator-dots="true" indicator-active-color="#006CE8" >
+        <swiper-item class="swiper-item" wx:for="{{list}}">
+            <view class="item" wx:for="{{item}}" wx:for-item="i" wx:for-index="d" wx:key="{{d}}" bindtap='toProdPage' data-prodid="{{i.prodId}}" data-shopid="{{i.shopId}}">
+              <image lazy-load class="item-img" src="{{i.pic}}" mode="widthFix"></image>
+              <view class="item-title">{{i.prodName}}</view>
+              <view class="price-box">
+                  <view class="name-price" style="font-size:26rpx;color: #FF4D3A;">¥{{wxs.toPrice(i.price)}}</view>
+                <image style="width:44rpx;height:44rpx;" src="/images/icon/car-btn.png" mode=""/>
+              </view>
             </view>
-          </view>
-      </swiper-item>
-
+        </swiper-item>
       </swiper>
+        <view class="none" wx:if="{{list[0].length==0||list.length == 0}}">
+          <van-empty image="/images/icon/none.png" description="暂无商品" />
+        </view>
 
     </view>
 

+ 22 - 9
pages/prod/prod.wxss

@@ -94,9 +94,8 @@ image {
 /** 商品信息 */
 
 .prod-info {
-  padding: 20rpx;
+  padding: 0 20rpx;
   position: relative;
-  background: #fff;
   border-radius: 16rpx;
 }
 
@@ -145,14 +144,24 @@ image {
   left: 0;
 }
 
+.sub-title{
+  font-size: 24rpx;
+  color: #AAAAAA;
+  margin-top: 16rpx;
+}
+
 .sales-p {
-  background: #fff;
-  line-height: 40rpx;
-  color: #999;
-  font-size: 28rpx;
-  margin-top: 6rpx;
-  margin-right: 104rpx;
-  text-align: justify;
+  height: 44rpx;
+  line-height: 44rpx;
+  padding: 0 16rpx;
+  background: #FFF5E9;
+  border-radius: 8rpx 8rpx 8rpx 8rpx;
+  border: 1rpx solid #BC9264;
+  font-weight: bold;
+  font-size: 24rpx;
+  color: #BC9264;
+  display: inline-block;
+  margin-top: 20rpx;
 }
 
 .prod-price {
@@ -1969,4 +1978,8 @@ button.btn-type::after {
   text-align: center;
   line-height: 80rpx;
   height: 80rpx;
+}
+
+.none .van-empty__description{
+  margin-top: -30rpx;
 }

+ 55 - 59
pages/prodComm/prodComm.js

@@ -5,12 +5,17 @@ Page({
    * 页面的初始数据
    */
   data: {
-    orderItemInfo: {
-      images: [],
+    loading:false,
+    orderNumber:'',
+    prodCommInfo: {
+      orderNumber:'',
+      pics: [],
       content: "",
+      isAnonymous: 0,
       score: 5,
-      isAnonymous: 1,
-      evaluate: 0,
+      deliveryPack: 5,
+      deliveryService: 5,
+      deliverySpeed: 5,
     },  //订单列表页参数
   },
 
@@ -18,60 +23,58 @@ Page({
    * 生命周期函数--监听页面加载
    */
   onLoad: function (options) {
-    // 获取上页(订单列表)数据
-    // var orderItemInfo = wx.getStorageSync("orderItemInfo");
-    // // console.log(orderItemInfo);
-    // for (var i = 0; i < orderItemInfo.length; i++){
-    //   orderItemInfo[i].images = [];
-    //   orderItemInfo[i].content = "";
-    //   orderItemInfo[i].score = 5;
-    //   orderItemInfo[i].isAnonymous = 1;
-    //   orderItemInfo[i].evaluate = 0;
-    // }
-    // this.setData({
-    //   orderItemInfo: orderItemInfo
-    // })
-    // console.log(orderItemInfo)
+    console.log(options);
+    this.setData({
+      orderNumber:options.orderNumber
+    })
   },
   
   /**
    * 发表评论
    */
   submitComm: function (e) {
-      var orderItemInfo = this.data.orderItemInfo;
-        if(orderItemInfo.content.trim()==""){
+
+      let that = this
+      var prodCommInfo = this.data.prodCommInfo;
+      prodCommInfo.orderNumber = this.data.orderNumber
+        if(prodCommInfo.content.trim()==""){
          return wx.showToast({
             title: '评价不能为空',
             icon:"none"
           })
+        }else if(this.loading){
+          return
         }
+        this.loading = true
         wx.showLoading();
         var pics = '';
-        orderItemInfo.images.forEach(function(item){
+        prodCommInfo.pics.forEach(function(item){
           pics += item.path + ',';
         });
         if(pics!=''){
           pics = pics.substring(0,pics.length-1)
         }
+        prodCommInfo.pics = pics
+
         // 发布评论
         var params = {
           url: "/p/prodComm",
           method: "POST",
-          data: {
-            content: orderItemInfo.content,
-            score: orderItemInfo.score,
-            evaluate: orderItemInfo.evaluate,
-            isAnonymous: orderItemInfo.isAnonymous,
-            orderItemId: orderItemInfo.orderItemId,
-            prodId: orderItemInfo.prodId,
-            pics: pics
-          },
+          data: prodCommInfo,
           callBack:  (res) => {
-            
+            that.loading = true
             wx.hideLoading();
-            wx.navigateTo({
-              url: '/pages/commResult/commResult',
-            })
+            if(res.code == 500){
+              wx.showToast({
+                title:res.msg,
+                icon:'none'
+              })
+            }else{
+              wx.navigateTo({
+                url: '/pages/commResult/commResult',
+              })
+             
+            }
           }
         };
         http.request(params);
@@ -102,10 +105,10 @@ Page({
             var img = {};
             img.path = JSON.parse(res2).filePath;
             img.url = JSON.parse(res2).resourcesUrl + JSON.parse(res2).filePath;
-            var orderItemInfo = ths.data.orderItemInfo;
-            orderItemInfo.images.push(img);
+            var prodCommInfo = ths.data.prodCommInfo;
+            prodCommInfo.pics.push(img);
             ths.setData({
-              orderItemInfo: orderItemInfo
+              prodCommInfo: prodCommInfo
             })
           }
         };
@@ -119,19 +122,19 @@ Page({
    */
   removeImage(e) {
     const idx = e.target.dataset.idx
-    var orderItemInfo = this.data.orderItemInfo;
-    orderItemInfo.images.splice(idx, 1)
+    var prodCommInfo = this.data.prodCommInfo;
+    prodCommInfo.pics.splice(idx, 1)
     this.setData({
-      orderItemInfo: orderItemInfo
+      prodCommInfo: prodCommInfo
     });
   },
 
   onContentInput:function(e){
     const index = e.target.dataset.index
-    var orderItemInfo = this.data.orderItemInfo;
-    orderItemInfo.content = e.detail.value;
+    var prodCommInfo = this.data.prodCommInfo;
+    prodCommInfo.content = e.detail.value;
     this.setData({
-      orderItemInfo: orderItemInfo
+      prodCommInfo: prodCommInfo
     });
   },
 
@@ -141,34 +144,27 @@ Page({
   * 每一项的选择事件
   */
   onSelectedItem: function (e) {
-    var orderItemInfo = this.data.orderItemInfo;// 获取评论项
-    var isAnonymous = orderItemInfo.isAnonymous; // 获取当前评价的选中状态
+    var prodCommInfo = this.data.prodCommInfo;// 获取评论项
+    var isAnonymous = prodCommInfo.isAnonymous; // 获取当前评价的选中状态
     if (isAnonymous==1){
       isAnonymous = 0;
     }else{
       isAnonymous = 1;
     }
-    orderItemInfo.isAnonymous = isAnonymous; // 改变状态
+    prodCommInfo.isAnonymous = isAnonymous; // 改变状态
     this.setData({
-      orderItemInfo: orderItemInfo
+      prodCommInfo: prodCommInfo
     });
   },
 
   onStarChange:function(e){
-    var index = e.detail.idx;
     var val = e.detail.val;
+    let key = e.currentTarget.dataset.key
     console.log(e);
-    var evaluate = 0;
-    var orderItemInfo = this.data.orderItemInfo;
-    if(val<3){
-      evaluate = 2;
-    }else if(val==3){
-      evaluate = 1;
-    }
-    orderItemInfo.score = val;
-    orderItemInfo.evaluate = evaluate;
+    var prodCommInfo = this.data.prodCommInfo;
+    prodCommInfo[key] = val;
     this.setData({
-      orderItemInfo: orderItemInfo
+      prodCommInfo: prodCommInfo
     });
   },
 
@@ -179,7 +175,7 @@ Page({
   comPicPreView(e){
     var idx = e.currentTarget.dataset.idx
     var urls = []
-    this.data.orderItemInfo.images.forEach(el => {
+    this.data.prodCommInfo.pics.forEach(el => {
       urls.push(el.url)
     })
     wx.previewImage({

+ 19 - 4
pages/prodComm/prodComm.wxml

@@ -5,7 +5,7 @@
         <textarea placeholder="把使用心得分享给想买的他们吧" value="{{content}}" bindinput="onContentInput" data-index="{{index}}" maxlength="150">{{ content }}</textarea>
          <!-- 添加图片 -->
         <view class="img-box">
-          <view class="img-item"  wx:for="{{orderItemInfo.images}}" wx:key="*this" wx:for-index="idx" wx:for-item="imgItem">
+          <view class="img-item"  wx:for="{{prodCommInfo.pics}}" wx:key="*this" wx:for-index="idx" wx:for-item="imgItem">
             <image src="../../images/icon/del.png" data-idx="{{idx}}" bindtap="removeImage" mode="" class="del"/>
             <image src="{{imgItem.url}}" mode="aspectFill" class="img" data-idx="{{idx}}" bindtap="comPicPreView"/>
           </view>
@@ -27,9 +27,24 @@
     <view class="box">
         <!-- 评价星级 -->
         <view class="item-star">
-          <view class="label">评分</view>
-          <comm-star value="5" type="write" bind:onStarChange="onStarChange"></comm-star>
-          <view class="num">{{orderItemInfo.score}}.0</view>
+          <view class="label">商品评价</view>
+          <comm-star value="5" type="write" data-key="score" bind:onStarChange="onStarChange"></comm-star>
+          <view class="num">{{prodCommInfo.score}}.0</view>
+        </view>
+        <view class="item-star">
+          <view class="label">配送打包</view>
+          <comm-star value="5" type="write" data-key="deliveryPack" bind:onStarChange="onStarChange"></comm-star>
+          <view class="num">{{prodCommInfo.deliveryPack}}.0</view>
+        </view>
+        <view class="item-star">
+          <view class="label">送货速度</view>
+          <comm-star value="5" type="write" data-key="deliverySpeed" bind:onStarChange="onStarChange"></comm-star>
+          <view class="num">{{prodCommInfo.deliverySpeed}}.0</view>
+        </view>
+        <view class="item-star">
+          <view class="label">配送员服务</view>
+          <comm-star value="5" type="write" data-key="deliveryService" bind:onStarChange="onStarChange"></comm-star>
+          <view class="num">{{prodCommInfo.deliveryService}}.0</view>
         </view>
     </view>
    

+ 2 - 1
pages/prodComm/prodComm.wxss

@@ -148,7 +148,7 @@ checkbox .wx-checkbox-input.wx-checkbox-input-checked::before {
   -webkit-transform: translate(-50%, -50%) scale(1);
 }
 .item-star{
-  padding:20rpx;
+  padding:20rpx 0;
   display: flex;
   align-items: center;
   font-size: 28rpx;
@@ -159,6 +159,7 @@ checkbox .wx-checkbox-input.wx-checkbox-input-checked::before {
 .item-star .label{
   font-size: 28rpx;
   color: #222222;
+  width: 142rpx;
 }
 .item-star .num{
   font-weight: bold;

+ 2 - 0
pages/submit-order/submit-order.js

@@ -56,6 +56,7 @@ Page({
   onLoad: function (options) {
     this.setData({
       orderEntry: options.orderEntry,
+      shop_id:options.shopId
     });
     // 请求用户可用积分
     this.getUserScore()
@@ -125,6 +126,7 @@ Page({
       method: "POST",
       data: {
         addrId: addrId,
+        shopId:this.data.shop_id,
         orderItem: this.data.orderEntry === "1" ? JSON.parse(wx.getStorageSync("orderItem")) : undefined,
         basketIds: this.data.orderEntry === "0" ? JSON.parse(wx.getStorageSync("basketIds")) : undefined,
         couponIds: this.data.couponIds,

+ 1 - 1
pages/user/user.js

@@ -312,7 +312,7 @@ Page({
         that.setData({
           shopName: res.enterprise || ''
         })
-        wx.setStorageSync('channelId',res.channelId)
+        res.channelId&&wx.setStorageSync('channelId',res.channelId)
       }
     }
     http.request(param)