From 37c344f7b5c767c6a87e08a0c8a9698d8610fbfc Mon Sep 17 00:00:00 2001
From: jyy <935090232@qq.com>
Date: Sat, 16 Jan 2021 18:31:29 +0800
Subject: [PATCH] 1

---
 pages/yuyue/showYyInfo.wxml       |   39 +---
 pages/yuyue/showYyInfo.wxss       |    2 
 pages/purchaseRecords/detail.js   |   13 +
 pages/purchaseRecords/index.wxml  |   35 ++-
 pages/yuyue/order.js              |   24 +-
 pages/yuyue/showYyInfo.js         |  156 ++++++++++------
 pages/yuyue/yyInfo.wxml           |    8 
 pages/purchaseRecords/detail.wxml |   33 +--
 project.config.json               |    2 
 pages/purchaseRecords/index.js    |  186 +++++++++++++-------
 10 files changed, 288 insertions(+), 210 deletions(-)

diff --git a/pages/purchaseRecords/detail.js b/pages/purchaseRecords/detail.js
index fc7f51b..5383e51 100644
--- a/pages/purchaseRecords/detail.js
+++ b/pages/purchaseRecords/detail.js
@@ -1,18 +1,27 @@
 // pages/purchaseRecords/detail.js
+var util = require('../../utils/util.js');
+
 Page({
 
   /**
    * 页面的初始数据
    */
   data: {
-
+    order:{}
   },
 
   /**
    * 生命周期函数--监听页面加载
    */
   onLoad: function (options) {
-
+    var _this=this;
+    util.request({api:"/wxapi/erpOrder/findUserOrderById/"+options.id,
+    method:"GET",
+    callback: function (data) {
+      _this.setData({
+        order: data.mapInfo.order
+      });
+    }});
   },
 
   /**
diff --git a/pages/purchaseRecords/detail.wxml b/pages/purchaseRecords/detail.wxml
index eb11849..a481fae 100644
--- a/pages/purchaseRecords/detail.wxml
+++ b/pages/purchaseRecords/detail.wxml
@@ -2,33 +2,28 @@
   <view class="list-item">
       <view class="list-header">
         <view>
-          <view class="name">肽妍星海店</view>
-          <view class="number">订单编号:N20201211164653</view>
+          <view class="name">{{order.shopName}}</view>
+          <view class="number">订单编号:{{order.orderNo}}</view>
         </view>
-        <text>已付款</text>
+        <text>{{order.status}}</text>
       </view>
       <view class="list-content">
-        <view class="list-content-row">
-          <text>深层清洁  x  1</text>
-          <text>¥23</text>
-        </view>
-        <view class="list-content-row">
-          <text>深层清洁  x  1</text>
-          <text>¥23</text>
-        </view>
+					<view class="list-content-row" wx:for="{{order.items}}" wx:for-item="detailItem">
+            <text>{{detailItem.goodsName}}  x  {{detailItem.count}}</text>
+            <text>¥{{detailItem.zkPrice}}</text>
+          </view>
+				</view>
         <view class="pay-info">
-          <view><text>微信:102</text></view>
-          <view><text>储值卡:102</text></view>
+          <view wx:for="{{order.flow}}"  ><text>{{item.payMethod}} :{{item.amount}}</text></view>
           <view>
-            <text class="gray">总价 ¥23.23</text>
-            <text class="ml-10 gray">优惠¥23</text>
-            <text class="ml-10">实付款¥10</text>
+            <text class="gray">总价 ¥{{order.needPay}}</text>
+            <text class="ml-10 gray">优惠¥{{order.discount}}</text>
+            <text class="ml-10">实付款¥{{order.realPay}}</text>
           </view>
         </view>
-      </view>
       <view class="list-footer">
-        <view><text>购买时间:2020-08-23  12:33</text></view>
-        <view class="mt-5"><text>下单顾问:李贝</text></view>
+        <view><text>购买时间:{{order.orderTime}}</text></view>
+        <view class="mt-5"><text>下单顾问:{{order.staffName}}</text></view>
       </view>
   </view>
 </view>
diff --git a/pages/purchaseRecords/index.js b/pages/purchaseRecords/index.js
index 2489fdb..7a3c203 100644
--- a/pages/purchaseRecords/index.js
+++ b/pages/purchaseRecords/index.js
@@ -1,78 +1,136 @@
-// pages/purchaseRecords/index.js
-Page({
-
-  /**
-   * 页面的初始数据
-   */
+var util = require('../../utils/util.js');
+Page({ 
   data: {
-    currentIndex:0
+    currentIndex: 0,
+    orderList:[],
+    limit:10,
+    offset:0,
+    refresh:false,
+    orderShow:false,
+    noMore:false,
   },
-
-  /**
-   * 生命周期函数--监听页面加载
-   */
+  onUnload: function () {  
+    // wx.reLaunch({
+    //   url: '../customerCenter/customerCenter'
+    // })
+  },
   onLoad: function (options) {
-
+    var status = options.status;
+    if (status!=undefined){
+      this.setData({
+        currentIndex: status
+      })
+    } 
+    this.getOrderInfo(this.data.currentIndex);
+    this.goTap();
+  },
+  onShow:function(){
+    if(this.data.refresh){
+      this.getOrderInfo(this.data.currentIndex);
+    }
+  },
+  //获取滚动条当前位置
+  onPageScroll: function (e) {
+    // console.log(e)
+    if (e.scrollTop > 400) {
+      this.setData({
+        floorstatus: true
+      });
+    } else {
+      this.setData({
+        floorstatus: false
+      });
+    }
+  },
+  //一键回到顶部
+  goTap(){
+    util.goTap();
+  },
+  onTabsItemEvent(e){
+    var index = e.currentTarget.dataset.index;
+    this.setData({
+      currentIndex:index,
+      offset: 0
+    })
+    this.setData({
+      noMore:false
+    });
+    this.getOrderInfo(index);
   },
 
-  /**
-   * 生命周期函数--监听页面初次渲染完成
-   */
-  onReady: function () {
-
+  // 根据状态获取订单信息
+  getOrderInfo:function(status){
+    var _this = this;
+    var limit = _this.data.limit;
+    var offset = _this.data.offset;
+    util.request({ 
+    api:"/wxapi/erpOrder/findUserOrderList",
+    data: { "limit": limit, "orderStatus": status, "offset": offset},
+    callback: function (data) {
+      console.log("订单信息")
+      console.log(data.rows)
+      _this.setData({
+        orderList: data.rows,
+        currentIndex: status
+      });
+      var orderList = _this.data.orderList;
+      console.log(orderList)
+      if (orderList.length == 0) {
+        _this.setData({
+          orderShow: true,
+        })
+      } else {
+        _this.setData({
+          orderShow: false
+        })
+      }
+    }});
   },
-
-  /**
-   * 生命周期函数--监听页面显示
-   */
-  onShow: function () {
-
+  toDetail(e){
+    var id = e.currentTarget.dataset.id
+    console.log(id)
+    wx.navigateTo({
+      url: '../purchaseRecords/detail?id='+id,
+    })
   },
+      
 
-  /**
-   * 生命周期函数--监听页面隐藏
-   */
-  onHide: function () {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面卸载
-   */
-  onUnload: function () {
-
-  },
-
-  /**
-   * 页面相关事件处理函数--监听用户下拉动作
-   */
-  onPullDownRefresh: function () {
-
-  },
-
-  /**
-   * 页面上拉触底事件的处理函数
-   */
+  // 上拉加载
   onReachBottom: function () {
 
-  },
+    var _this = this;
+    var offset = _this.data.offset;
+    var limit = _this.data.limit;
+    var orderList = _this.data.orderList;
+    var status = _this.data.currentIndex;
+    _this.setData({
+      offset: offset + limit
+    });
+    offset = _this.data.offset;
 
-  /**
-   * 用户点击右上角分享
-   */
-  onShareAppMessage: function () {
+    util.request({api:"/wxapi/erpOrder/findUserOrderList",data: { "limit": limit, "orderStatus": status, "offset": offset },
+    callback: function (data) {
 
-  },
-  onTabsItemEvent(e) {
-    var index = e.currentTarget.dataset.index;
+      if(data.rows.length>0){
+        _this.setData({
+          noMore:false
+        });
+      }else{
+        _this.setData({
+          noMore:true
+        });
+      }
 
-    this.setData({
-        currentIndex: index
-    })
+      for (var i = 0; i < data.rows.length; i++) {
+        orderList.push(data.rows[i]);
+      }
+      _this.setData({
+        orderList: orderList
+      });
+    }});
   },
-  toDetail(){
-    wx.navigateTo({
-      url: '/pages/purchaseRecords/detail'
-    })
-  }
-})
\ No newline at end of file
+ 
+
+  
+  
+})
diff --git a/pages/purchaseRecords/index.wxml b/pages/purchaseRecords/index.wxml
index 93274cb..35f37dd 100644
--- a/pages/purchaseRecords/index.wxml
+++ b/pages/purchaseRecords/index.wxml
@@ -1,7 +1,7 @@
 <!--pages/purchaseRecords/index.wxml-->
 <view>
   <view class='tabs_box'>
-    <view class="tabs_item {{currentIndex==0?'selected':''}}" bindtap='onTabsItemEvent' data-index="">
+    <view class="tabs_item {{currentIndex==0?'selected':''}}" bindtap='onTabsItemEvent' data-index="0">
         全部
     </view>
     <view class="tabs_item {{currentIndex==1?'selected':''}}" bindtap='onTabsItemEvent' data-index="1">
@@ -13,31 +13,36 @@
     <view class="tabs_item {{currentIndex==3?'selected':''}}" bindtap='onTabsItemEvent' data-index="3">
         欠款
     </view>
+    <view class="tabs_item {{currentIndex==4?'selected':''}}" bindtap='onTabsItemEvent' data-index="4">
+      已取消
+    </view>
   </view>
   <view>
-    <view class="list-item" bindtap='toDetail'>
+    <view class="list-item" bindtap='toDetail' wx:for="{{orderList}}" data-id="{{item.orderId}}"  >
 				<view class="list-header">
 					<view>
-            <view class="name">肽妍星海店</view>
-            <view class="number">订单编号:N20201211164653</view>
+            <view class="name">{{item.shopName}}</view>
+            <view class="number">订单编号:{{item.orderNo}}</view>
           </view>
-          <text>已付款</text>
+          <text>{{item.status}}</text>
 				</view>
 				<view class="list-content">
-					<view class="list-content-row">
-            <text>深层清洁  x  1</text>
-            <text>¥23</text>
-          </view>
-          <view class="list-content-row">
-            <text>深层清洁  x  1</text>
-            <text>¥23</text>
+					<view class="list-content-row" wx:for="{{item.items}}" wx:for-item="detailItem">
+            <text>{{detailItem.goodsName}}  x  {{detailItem.count}}</text>
+            <text>¥{{detailItem.zkPrice}}</text>
           </view>
 				</view>
 				<view class="list-footer">
-					<text class="gray">总价 ¥23.23</text>
-          <text class="ml-10 gray">优惠¥23</text>
-					<text class="ml-10">实付款¥10</text>
+					<text class="gray">总价 ¥{{item.needPay}}</text>
+          <text class="ml-10 gray">优惠¥{{item.discount}}</text>
+					<text class="ml-10">实付款¥{{item.realPay}}</text>
 				</view>
     </view>
+     <!-- 没有更多数据 -->
+     <view class='text-center pd-10' wx:if="{{noMore}}">
+        <view>
+            <text class="color_gray font-12">没有更多了~</text>
+        </view>
+        </view>
   </view>
 </view>
diff --git a/pages/yuyue/order.js b/pages/yuyue/order.js
index 55a2942..9fdfc8e 100644
--- a/pages/yuyue/order.js
+++ b/pages/yuyue/order.js
@@ -5,8 +5,8 @@
     data: {
         currentIndex: 0,
         orderList: [],
-        pageSize: 8,
-        pageNum: 1,
+        limit: 8,
+        offset: 0,
         refresh: false,
         orderShow: false,
         // hiddenData:true
@@ -52,7 +52,7 @@
 
         this.setData({
             currentIndex: index,
-            pageNum: 0
+            offset: 0
         })
         this.getOrderInfo(index);
     },
@@ -61,15 +61,15 @@
     getOrderInfo: function(index) {
 
         var _this = this;
-        var pageSize = _this.data.pageSize;
-        var pageNum = _this.data.pageNum;
+        var limit = _this.data.limit;
+        var offset = _this.data.offset;
         var status=this.data.currentIndex;
         util.request({
             api: api.yuyue.getServiceOrderList,
             data: {
-                "pageSize": pageSize,
+                "limit": limit,
                 "vipStatus": status,
-                "pageNum": pageNum
+                "offset": offset
             },
             callback: function(data) {
                 console.log("订单信息")
@@ -166,19 +166,19 @@
     onReachBottom: function() {
 
         var _this = this;
-        var pageSize = _this.data.pageSize;
-        var pageNum = _this.data.pageNum + 1;
+        var limit = _this.data.limit;
+        var offset = _this.data.offset + limit;
         var orderList = _this.data.orderList;
         var status = _this.data.currentIndex;
         _this.setData({
-            pageNum: pageNum 
+            offset: offset 
         });
         util.request({
             api: api.yuyue.getServiceOrderList,
             data: {
-                "pageSize": pageSize,
+                "limit": limit,
                 "vipStatus": status,
-                "pageNum": pageNum
+                "offset": offset
             },
             callback: function(data) {
 
diff --git a/pages/yuyue/showYyInfo.js b/pages/yuyue/showYyInfo.js
index 04e1020..fec236a 100644
--- a/pages/yuyue/showYyInfo.js
+++ b/pages/yuyue/showYyInfo.js
@@ -8,44 +8,59 @@
      * 页面的初始数据
      */
     data: {
-       
+        //是否可以进行评论
+        ablePl: true,
+        id:""
     },
 
     /**
      * 生命周期函数--监听页面加载
      */
-    onLoad: function(options) {
+    onLoad: function (options) {
         console.log(options);
+
         var _this = this;
-            //查看已有订单
-            util.request({
-                api: api.yuyue.getServiceOrderById + options.id,
-                callback: function(data) {
-                  
+
+        //查看已有订单
+        util.request({
+            api: api.yuyue.getServiceOrderById + options.id,
+            callback: function (data) {
+                var serviceOrder = data.mapInfo.detail
+                if ((serviceOrder.status == '服务完成' || serviceOrder.status == '服务单结束') && !serviceOrder.comment) {
                     _this.setData({
-                        serviceOrder: data.mapInfo.detail,
-                        shopInfo:data.mapInfo.shopInfo
-                    })
+                        ablePl: true
+                    });
+                } else {
+                    _this.setData({
+                        ablePl: false
+                    });
                 }
-            });
+                _this.setData({
+                    serviceOrder: serviceOrder,
+                    id:options.id
+                })
+            }
+        });
     },
 
-    cancel: function() {
+    cancel: function () {
         console.log("cancel");
         var _this = this;
         wx.showModal({
             title: '提示',
             content: '确定要取消吗?',
-            success: function(sm) {
+            success: function (sm) {
                 if (sm.confirm) {
                     var id = _this.data.serviceOrder.id;
                     util.request({
                         api: api.yuyue.cancelOrderById,
-                        data: { id: id },
-                        callback: function(data) {
+                        data: {
+                            id: id
+                        },
+                        callback: function (data) {
                             wx.showToast({
                                 title: '取消成功',
-                                success: function() {
+                                success: function () {
                                     wx.navigateBack({});
                                 }
                             })
@@ -54,68 +69,87 @@
                 }
             }
         })
-
     },
 
-
-    backKhyuyue: function() {
-      
-            wx.navigateBack({
-                
-            })
+    /**
+     * 评论服务单 
+     */
+    submitComment: function (e) {
        
-    },
- 
+        var _this = this;
+        var comment = e.detail.value.comment;
+        var id=_this.data.id;
+        util.request({
+            api: '/wxapi/yuyue/commentService',
+            data: {
+                id: id,
+                comment:comment
+            },
+            callback: function (data) {
+                wx.showToast({
+                    title: '评论成功',
+                    success: function () {
+                        wx.navigateBack({});
+                    }
+                })
+            }
+        });
+},
 
 
- 
 
-    /**
-     * 生命周期函数--监听页面初次渲染完成
-     */
-    onReady: function() {
 
-    },
 
-    /**
-     * 生命周期函数--监听页面显示
-     */
-    onShow: function() {
 
-    },
 
-    /**
-     * 生命周期函数--监听页面隐藏
-     */
-    onHide: function() {
 
-    },
 
-    /**
-     * 生命周期函数--监听页面卸载
-     */
-    onUnload: function() {
+/**
+ * 生命周期函数--监听页面初次渲染完成
+ */
+onReady: function () {
 
-    },
+},
 
-    /**
-     * 页面相关事件处理函数--监听用户下拉动作
-     */
-    onPullDownRefresh: function() {
+/**
+ * 生命周期函数--监听页面显示
+ */
+onShow: function () {
 
-    },
+},
 
-    /**
-     * 页面上拉触底事件的处理函数
-     */
-    onReachBottom: function() {
+/**
+ * 生命周期函数--监听页面隐藏
+ */
+onHide: function () {
 
-    },
+},
 
-    /**
-     * 用户点击右上角分享
-     */
-    onShareAppMessage: function() {
+/**
+ * 生命周期函数--监听页面卸载
+ */
+onUnload: function () {
 
-    }
+},
+
+/**
+ * 页面相关事件处理函数--监听用户下拉动作
+ */
+onPullDownRefresh: function () {
+
+},
+
+/**
+ * 页面上拉触底事件的处理函数
+ */
+onReachBottom: function () {
+
+},
+
+/**
+ * 用户点击右上角分享
+ */
+onShareAppMessage: function () {
+
+}
 })
\ No newline at end of file
diff --git a/pages/yuyue/showYyInfo.wxml b/pages/yuyue/showYyInfo.wxml
index f23f5fe..7f669d8 100644
--- a/pages/yuyue/showYyInfo.wxml
+++ b/pages/yuyue/showYyInfo.wxml
@@ -15,8 +15,8 @@
      <text class="iconfont icondianpu"></text>
      <text >门店地址</text>
    </view>
-   <view class="info">{{shopInfo.shopName}}</view>
-   <view  class="info-s">{{shopInfo.shopAddr}}</view>
+   <view class="info">{{serviceOrder.shopName}}</view>
+   <view  class="info-s">{{serviceOrder.shopAddr}}</view>
  </view>
 
   <view class="itemWrap">
@@ -24,7 +24,7 @@
      <text class="iconfont icondianpu"></text>
      <text >预约到店时间</text>
    </view>
-   <view class="info">{{serviceOrder.yyTime}}</view>
+   <view class="info">{{serviceOrder.time}}</view>
    <view  class="info-s">服务时长约{{serviceOrder.totalTime}}分钟</view>
  </view>
 
@@ -33,37 +33,22 @@
      <text class="iconfont icondianpu"></text>
      <text >服务和技师</text>
    </view>
-   <view wx:for="{{serviceOrder.items}}" >
-   <view class="info">{{item.name}}</view>
+   <view wx:for="{{serviceOrder.projs}}" >
+   <view class="info">{{item.projName}}</view>
    <view  class="info-s">{{item.beautyName}}</view>
   </view>
  </view>
-<form  bindsubmit="submitYuyue" >
-
-<view class="itemWrap" wx:if="{{model==0}}">
+<form  bindsubmit="submitComment" >
    <view class="lable">
      <text class="iconfont icondianpu"></text>
-     <text >到店人</text>
+     <text >服务评价</text>
    </view>
    <view class="forms" >
-       <input placeholder="请输入到店人名称" value="{{serviceOrder.vipName}}"name="vipName" ></input>
-       <input  placeholder="请输入联系电话" value="{{serviceOrder.phone}}" name="tel" ></input>
-       <input placeholder="备注"  value="{{serviceOrder.remark}}" name="remark" ></input>
+      <input wx:if="{{ablePl}}"  placeholder="请对我们的服务进行评价" value="{{comment}}"name="comment" ></input>
+       <view wx:if="{{!ablePl}}"  >{{serviceOrder.comment}}</view>
+       <view wx:if="{{!ablePl && serviceOrder.reply }}"  >商家回复 {{serviceOrder.reply}}</view>
    </view>
- </view>
-
-
-
-
- 
-
-<view bindtap="backKhyuyue" class=" bgbtn "  >
- 返回
-</view>
-
+<view bindtap="backKhyuyue" class=" bgbtn " wx:if="{{!ablePl}}" >返回</view>
+<button  formType="submit"  class=" bgbtn "  wx:if="{{ablePl}}">评论返回</button>
 </form>
-
-
-
-
 </scroll-view>
\ No newline at end of file
diff --git a/pages/yuyue/showYyInfo.wxss b/pages/yuyue/showYyInfo.wxss
index dc35481..b095ec7 100644
--- a/pages/yuyue/showYyInfo.wxss
+++ b/pages/yuyue/showYyInfo.wxss
@@ -27,7 +27,7 @@
 .forms{
   background: #fff;
   border-radius: 5px;
-    height: 400rpx;
+    height: 280rpx;
   width: 100%;
   margin-top: 20px;
   padding: 15px
diff --git a/pages/yuyue/yyInfo.wxml b/pages/yuyue/yyInfo.wxml
index cf4685a..d0f05d1 100644
--- a/pages/yuyue/yyInfo.wxml
+++ b/pages/yuyue/yyInfo.wxml
@@ -46,26 +46,18 @@
       <text >到店人</text>
     </view>
     <view class="forms" >
-     
         <input placeholder="请输入到店人名称" value="{{serviceOrder.vipName}}"name="vipName" ></input>
         <input  placeholder="请输入联系电话" value="{{serviceOrder.tel}}" name="tel" ></input>
         <input placeholder="备注"  value="{{serviceOrder.remark}}" name="remark" ></input>
         <radio class="radio"  bindtap="shouquan"  wx:if="{{model==0}}" ><text>接收预约提醒</text></radio>
     </view>
   </view>
-
-
-
-
-
 <button  class="bgbtn" formType="submit" wx:if="{{model==0}}" >
   确认预约
 </button>
-
 <view bindtap="backKhyuyue" class=" bgbtn " wx:if="{{model!=0  }}" >
   返回
 </view>
-
 </form>
 
 
diff --git a/project.config.json b/project.config.json
index 0175b15..a251ded 100644
--- a/project.config.json
+++ b/project.config.json
@@ -42,7 +42,7 @@
   "compileType": "miniprogram",
   "libVersion": "1.9.98",
   "appid": "wx5cc58f796224af61",
-  "projectname": "%E8%9C%82%E5%B7%A2%E7%BE%8E%E4%B8%9A",
+  "projectname": "讯聪美业",
   "isGameTourist": false,
   "simulatorType": "wechat",
   "simulatorPluginLibVersion": {},

--
Gitblit v1.9.1