geek 4 anni fa
parent
commit
d4b2e7272e

+ 2 - 0
componets/comments/index.wxss

@@ -16,6 +16,7 @@
 .container .photo .head-img {
   width: 100rpx;
   height: 100rpx;
+  border-radius: 50%;
 }
 
 .container .comments {
@@ -56,6 +57,7 @@
 .container .comments .comment-content .imgs .comment-img .comm-img {
   width: 100%;
   height: 150rpx;
+  border-radius: 15rpx;
 }
 
 .f13 {

BIN
images/no-discuss.png


+ 5 - 1
pages/comments/comments.wxml

@@ -1,4 +1,8 @@
 <!--pages/comments/comments.wxml-->
-<comments commentsList="{{commentsList}}"></comments>
+<comments wx:if="{{commentsList.length > 0}}" commentsList="{{commentsList}}"></comments>
 <view class="comments-end c-707070 f14" wx:if="{{loadingEnd}}">已经到底啦</view>
+<view class="discuss-info" wx:if="{{commentsList.length == 0}}">
+  <image style="height: 400rpx;width: 400rpx;" src="../../images/no-discuss.png"></image>
+  <view class="discuss">暂无评论</view>
+</view>
 

+ 14 - 0
pages/comments/comments.wxss

@@ -1 +1,15 @@
 /* pages/comments/comments.wxss */
+
+.discuss {
+  position: relative;
+  bottom: 100rpx;
+  font-size: 38rpx;
+  color: #9E9E9E;
+  letter-spacing: 5rpx;
+}
+
+.discuss-info {
+  text-align: center;
+  position: absolute;
+  top: 13%;
+}

+ 23 - 9
pages/index/index.js

@@ -74,22 +74,36 @@ Page({
       wx.setStorageSync('token', tokenData.token)
       requestApi.HEAD.token = tokenData.token
     }
-    var tabs = await this.getProductList();
+    var tabs = await this.getProductList(true);
     this.setData({
       tabs
     });
   },
 
 
-  getProductList: async function () {
+  getProductList: async function (refresh = false) {
     const self = this
-    let pageNo = this.data.pageNo;
+    let pageNo = 1
+    if (refresh) {
+      pageNo = 1
+      this.setData({
+        pageNo
+      })
+    }else {
+      pageNo = this.data.pageNo;
+    }
+
     let productList = this.data.productList;
     const proList = await productApi.getProductList(pageNo, 4)
     let list = proList.list;
-    list.forEach((item)=>{
-      productList.push(item)
-    })
+    if (pageNo == 1) {
+      productList = list
+    }else {
+      list.forEach((item)=>{
+        productList.push(item)
+      })
+    }
+    
     self.setData({
       productList,
       pageSum: proList.pageCount
@@ -189,10 +203,10 @@ Page({
     let pageNo = this.data.pageNo;
     let pageSum = this.data.pageSum;
     pageNo++;
-    this.setData({
-      pageNo
-    })
     if (this.data.pageNo <= pageSum) {
+      this.setData({
+        pageNo
+      })
       this.getProductList()
     }
   },

+ 5 - 31
pages/index/index.wxml

@@ -1,3 +1,8 @@
+<view class="content">
+  <view>
+    
+  </view>
+</view>
 
 <!--index.wxml-->
 <view class="container">
@@ -60,37 +65,6 @@
     <!-- 产品信息 -->
     <view class="product" >
 
-      <!--   <mp-tabs tabs="{{tabs}}" activeTab="{{activeTab}}" swiperClass="weui-tabs-swiper" bindtabclick="onTabClick"
-        bindchange="swiperChange" activeClass="tab-bar-title__selected" swiperHeight="{{(tabs[activeTab].list.length)*420}}">
-        <block wx:for="{{tabs}}" wx:key="title">
-
-          <view class="tab-content" data-set="{{item}}" slot="tab-content-{{index}}" bind:tap="handleClick">
-            <view style="overflow-y: auto;height:{{productHeight}}rpx">
-              <block wx:for="{{tabs[index].list}}" wx:key="id">
-                <view class="productinfo">
-                  <view class="product-item" style="background-image: url({{item.imgurl}});">
-
-                    <view class="product-desc" style="height:390rpx">
-                      <view class="f17">{{item.title}}</view>
-                      <view class=".fw700">¥{{item.price}}/人</view>
-                      <view class="f13">{{item.desc}}</view>
-                    </view>
-
-                    <view class="order {{item.open?'':'gray'}}">
-                      <view >
-                        立即预约
-                      </view>
-                    </view>
-                  </view>
-                </view>
-              </block>
-
-            </view>
-          </view>
-        </block>
-      </mp-tabs>
- -->
-
  <block wx:for="{{productList}}" wx:key="id" >
   <view class="productinfo">
     <view class="product-item" data-productid="{{item.id}}" bindtap = "showProduct" style="background-image: url({{item.productImg}});">

+ 1 - 0
pages/index/index.wxss

@@ -53,6 +53,7 @@ Page {
 .container .shop .shop-info > .shopimg > .img {
   width: 100%;
   height: 100%;
+  border-radius: 28rpx;
 }
 
 .container .shop .shop-info .shopmsg {

+ 41 - 0
pages/order/order.js

@@ -200,6 +200,47 @@ Page({
         await self.orderInfo()
       }
     })
+  },
+  guide: function(e){
+    const self = this;
+    var lat = parseFloat(self.data.order.latitude);
+    var lon = parseFloat(self.data.order.longitude);
+    wx.getSetting({
+        success: async (res) => {
+          let authSetting = res.authSetting
+          if (authSetting['scope.userLocation']) {
+            console.log('已授权地理位置')
+            wx.openLocation({
+              latitude:lat,
+              longitude: lon,
+            })
+            // 已授权
+          } else {
+            // 未授权
+            console.log('未授权地理位置');
+            wx.getLocation({
+              type: 'wgs84',
+              async success(res) {
+                console.log(res)
+                const latitude = res.latitude
+                const longitude = res.longitude
+                wx.setStorageSync('lon', longitude)
+                wx.setStorageSync('lat', latitude)
+                wx.openLocation({
+                    latitude:lat,
+                    longitude: lon,
+                  })
+              }
+            })
+          }
+        }
+      })
+  },
+  call: function(e){
+    let phone = this.data.order.mobile
+    wx.makePhoneCall({
+      phoneNumber: phone,
+    })
   }
 
 })

+ 3 - 2
pages/order/order.wxml

@@ -32,12 +32,12 @@
     </view>
     <view class="shop-info card">
         <view class="shop f17">{{ order.storeName}}</view>
-        <view class="address f14 c-707070 ">
+        <view class="address f14 c-707070 " bindtap="guide">
             <image src="../../images/icons/location.png"></image>
             {{order.address}}
         </view>
         <view class="f17 shop">场馆电话</view>
-        <view class="tel f14 c-707070 ">
+        <view class="tel f14 c-707070 " data-mobile="{{order.mobile}}" bindtap="call">
             <image src="../../images/icons/tel.png"></image>
             {{order.mobile}}
         </view>
@@ -46,5 +46,6 @@
         <view class="delete-btn" bindtap="cancelOrder" wx:if="{{order.status==1}}">取消订单</view>
         <view class="pay-btn" wx:if="{{order.status==1}}" bindtap="payOrder">确认支付</view>
         <view class="delete-btn" bindtap="deleteOrder" wx:if="{{order.status==3}}">删除订单</view>
+        <view class="xiaofei" wx:if="{{order.status==2  && order.writeOffStatus==1}}">待消费</view>
     </view>
 </view>

+ 12 - 0
pages/order/order.wxss

@@ -159,3 +159,15 @@
   border: 1rpx solid #999;
   margin: 0 20rpx;
 }
+
+.xiaofei {
+  background-color: #DF3361;
+  width: 180rpx;
+  height: 50rpx;
+  font-size: 14px;
+  text-align: center;
+  line-height: 50rpx;
+  border-radius: 25rpx;
+  color: #fff;
+  margin-right: 20rpx;
+}

+ 18 - 12
pages/personorder/personorder.js

@@ -14,6 +14,8 @@ Page({
     pageNo: [1, 1, 1, 1],
     pageSum: [],
     loadingEnd: false,
+    statusFilter:['','未支付','已支付','已完成'],
+    writeOffStatusFilter:['','待消费','已完成'],
     tabs: [{
         title: '全部'
       },
@@ -33,25 +35,22 @@ Page({
    * 生命周期函数--监听页面加载
    */
   onLoad: async function (options) {
-    console.log(this)
-    const isAuth = await app.isAuth()
-    if (!isAuth) {
-      wx.redirectTo({
-        url: '/pages/prompt/prompt?page=' + this.route,
-      })
-    }
+  
     
    
   },
 
   // 获取全部列表
-  getAllOrderList: async function () {
+  getAllOrderList: async function (refresh = false) {
     const self = this
     let pageNo = this.data.pageNo;
+    if (!refresh) {
+      pageNo = [1,1,1,1]
+    }
     let tabs = this.data.tabs;
     let pageSum = this.data.pageSum;
     // 获取全部订单
-    var orderList = await orderApi.getAllOrderList(pageNo[0], 4);
+    var orderList = await orderApi.getAllOrderList(pageNo[0], 10);
     var list = orderList.list;
     if (!tabs[0].list) {
       tabs[0].list = []
@@ -78,7 +77,7 @@ Page({
     let tabs = this.data.tabs;
     let pageSum = this.data.pageSum;
     // 获取代消费订单
-    var orderList = await orderApi.getOrderList(pageNo[1], 4, 2, 1);
+    var orderList = await orderApi.getOrderList(pageNo[1], 10, 2, 1);
     var list = orderList.list;
     if (!tabs[1].list) {
       tabs[1].list = []
@@ -105,7 +104,7 @@ Page({
     let tabs = this.data.tabs;
     let pageSum = this.data.pageSum;
     // 获取代消费订单
-    var orderList = await orderApi.getDiscussOffOrderList(pageNo[2], 4, 2, 2);
+    var orderList = await orderApi.getDiscussOffOrderList(pageNo[2], 10, 2, 2);
     var list = orderList.list;
     if (!tabs[2].list) {
       tabs[2].list = []
@@ -142,7 +141,7 @@ Page({
     let tabs = this.data.tabs;
     let pageSum = this.data.pageSum;
     // 获取代消费订单
-    var orderList = await orderApi.getOrderList(pageNo[3], 4, 2, 2);
+    var orderList = await orderApi.getOrderList(pageNo[3], 10, 2, 2);
     var list = orderList.list;
     if (!tabs[3].list) {
       tabs[3].list = []
@@ -218,6 +217,13 @@ Page({
    * 生命周期函数--监听页面显示
    */
   onShow: async function () {
+    const isAuth = await app.isAuth()
+    if (!isAuth) {
+      wx.redirectTo({
+        url: '/pages/prompt/prompt?page=' + this.route,
+      })
+      return
+    }
     await this.getAllOrderList()
     let activeTab = this.data.activeTab;
     if(activeTab==2){

+ 1 - 0
pages/personorder/personorder.wxml

@@ -11,6 +11,7 @@
                         <view class="orderinfo card">
                             <view class="order-item" bindtap="showOrderInfo" data-orderid="{{item.id}}"
                                 data-status="{{item.status}}" data-writestatus="{{item.writeOffStatus}}">
+                                <view class="pay-text">{{item.statusText}}</view>
                                 <view class="order-img">
                                     <image class="" src="{{item.productImg}}">
 

+ 10 - 0
pages/personorder/personorder.wxss

@@ -59,6 +59,7 @@
 .container .orders .orderinfo .order-item .order-img image {
   width: 210rpx;
   height: 200rpx;
+  border-radius: 20rpx;
 }
 
 .container .orders .orderinfo .order-item .order-desc {
@@ -128,3 +129,12 @@
   top: -3rpx;
   left: 0;
 }
+
+.pay-text {
+  display: inline;
+  position: absolute;
+  font-size: 28rpx;
+  line-height: 53rpx;
+  left: 20rpx;
+  color: #F4511E;
+}

+ 10 - 6
pages/product/product.wxml

@@ -7,22 +7,26 @@
         <view class="price c-e40360 fw300">¥{{product.currentPrice}}/人</view>
     </view>
     <!-- 产品描述 -->
-    <rich-text class="product-desc card" nodes="{{product.productContent}}">
-        
-    </rich-text>
+    <view style="margin-left: 25rpx;">
+        <rich-text class="product-desc card" nodes="{{product.productContent}}"></rich-text>
+    </view>
     <!-- 评论 -->
-    <view class="comments card" >
-        <view class="comment-title f17 fw300">
+    <view class="comments card-product" >
+        <view class="comment-title f17 fw300" >
             <view class="title">
 
                 网友点评
             </view>
-            <view class="all-comments f15 .c-707070" bindtap="gotoAllComments">
+            <view  wx:if="{{commentsNum!=0}}" class="all-comments f15 .c-707070" bindtap="gotoAllComments">
                 全部{{commentsNum}}条
                 <mp-icon icon="arrow" size="12" class="comments-icon" color="#707070"></mp-icon>
             </view>
         </view>
         <comments wx:if="{{commentsNum!=0}}" commentsList="{{[commentsList[0],commentsList[1],commentsList[1]]}}"></comments>
+        <view class="discuss-info" wx:else>
+            <image style="height: 400rpx;width: 400rpx;" src="../../images/no-discuss.png"></image>
+            <view class="discuss">暂无评论</view>
+        </view>
 
     </view>
     <!-- 预约 -->

+ 28 - 3
pages/product/product.wxss

@@ -18,17 +18,21 @@ page {
 }
 
 .container .product-img image {
-  width: 100%;
-  height: 500rpx;
+  width: 700rpx;
+  height: 446rpx;
+  border-radius: 30rpx;
+  margin-left: 25rpx;
+  margin-top: 25rpx;
 }
 
 .container .product-img > view {
-  margin: 10rpx 0 0 20rpx;
+  margin: 10rpx 0 0 25rpx;
 }
 
 .container .product-desc {
   margin-top: 10rpx;
   width: 100%;
+  margin-left: 25rpx;
 }
 
 .container .comments {
@@ -61,6 +65,15 @@ page {
   margin: 10rpx auto;
   background-color: #DF3361;
   color: #fff;
+  position: fixed;
+  bottom: 26rpx;
+  left: 31rpx;
+  border-radius: 54rpx
+}
+
+.card-product{
+  box-shadow: 0 2px 12px 0 rgba(0,0,0,.1);
+  /* border: 1px solid #ebeef5; */
 }
 
 .container .appointment .btn {
@@ -75,3 +88,15 @@ page {
   border: 2rpx solid #DF3361;
   color: #363636;
 }
+
+.discuss {
+  position: relative;
+  bottom: 100rpx;
+  font-size: 38rpx;
+  color: #9E9E9E;
+  letter-spacing: 5rpx;
+}
+
+.discuss-info {
+  text-align: center;
+}

+ 3 - 3
pages/shopinfo/shopinfo.js

@@ -100,10 +100,10 @@ Page({
         var pageNo = self.data.pageNo;
         pageNo += 1;
 
-        self.setData({
-            pageNo
-        })
         if (self.data.pageNo <= self.data.pageSum) {
+            self.setData({
+                pageNo
+            })
             self.getCommentsList()
             return
         }