sunshine1130 4 anos atrás
pai
commit
4f3f874e8a

+ 22 - 0
api/comments.js

@@ -0,0 +1,22 @@
+import request from '../utils/request.js'
+
+
+class comments extends request {
+
+    static async getCommentsByProduct(storeId, productId) {
+        const res = await this.getRequest(`${this.BASE_URL}Discuss/index?productId=${productId}&storeId=${storeId}`, this._defaultHeader)
+        return res.data;
+    }
+    static async getCommentsByStore(storeId) {
+        const res = await this.getRequest(`${this.BASE_URL}Discuss/index?storeId=${storeId}`, this._defaultHeader)
+        return res.data;
+    }
+    static async getPersonComments(myDiscuss=1) {
+        const res = await this.getRequest(`${this.BASE_URL}Discuss/index?myDiscuss=${myDiscuss}`, this._defaultHeader)
+        return res.data;
+    }
+
+
+}
+
+export default comments;

+ 5 - 0
api/product.js

@@ -10,5 +10,10 @@ class product extends request{
         const res = await this.getRequest(`${this.BASE_URL}Product/index?page=${page}&pageSize=${pageSize}`)
         return res.data;
     }
+    static async getProductById(id) {
+        const res = await this.getRequest(`${this.BASE_URL}Product/read?id=${id}`)
+        return res.data;
+    }
+    
 }
 export default product

+ 4 - 0
api/store.js

@@ -10,6 +10,10 @@ class store extends request{
         const res = await this.getRequest(`${this.BASE_URL}Store/index?page=${page}&pageSize=${pageSize}`, this._defaultHeader)
         return res.data;
     }
+    static async getStoreById(id) {
+        const res = await this.getRequest(`${this.BASE_URL}Store/read?id=${id}`, this._defaultHeader)
+        return res.data;
+    }
 
     static async getNearStore(lat, lon) {
         const res = await this.postRequest(`${this.BASE_URL}Store/getStore`, {

+ 34 - 0
api/upload.js

@@ -0,0 +1,34 @@
+import request from '../utils/request.js'
+
+class uploadImg extends request {
+
+    static async uploadCommentImgs(tempFilePaths) {
+        wx.showLoading({
+            title: '上传图片中...',
+            mask: true
+        });
+        var uploads = [];
+        tempFilePaths.forEach((item, i) => {
+                uploads[i] = request.upload(`${this.BASE_URL}Common/upload`, 'image', item)
+            }
+
+        );
+        Promise.all(uploads).then(res => {
+            //图片上传完成
+            // resolve(res)
+            console.log(res)
+            wx.hideLoading()
+            console.log("完成")
+        }).catch(err => {
+            // reject(err)
+            console.log(err)
+            wx.hideLoading()
+            wx.showToast({
+                title: '上传失败请重试',
+                icon: 'none'
+            })
+        })
+
+    }
+}
+export default uploadImg

+ 7 - 10
componets/comments/index.js

@@ -6,25 +6,22 @@ Component({
             value: [],
             observer: function () {}
         },
-        
+
     },
-    
+
     data: {
-        
+
     },
     methods: {
         // 预览图片
         previewImg: function (e) {
-            
+
             //获取当前图片的下标
             var index = e.currentTarget.dataset.index;
             var active = e.currentTarget.dataset.active;
             //所有图片
-            var imgurls = this.properties.commentsList[active].comments.imgs;
-            var imgs = []
-            imgurls.forEach(function (item,i,array) {
-                imgs.push(item.imgurl);
-            })
+            var imgs = this.properties.commentsList[active].imgs;
+
             wx.previewImage({
                 //当前显示图片
                 current: imgs[index],
@@ -40,7 +37,7 @@ Component({
 
     },
     ready: function () {
-       
+
     },
     moved: function () {
 

+ 11 - 11
componets/comments/index.wxml

@@ -1,27 +1,27 @@
 <view class="container" wx:for="{{commentsList}}" wx:key="id" wx:for-index="fatherindex" >
     <view class="photo">
-        <image class="head-img" src="{{item.headImg}}" >
+        <image class="head-img" src="{{item.avatar}}" >
             
         </image>
         
     </view>
     <view class="comments">
         <view class="product padding5">
-            <view class="product-name fw400">{{item.product}}</view>
-            <view class="assess-date f13 .color-gray fw300">{{item.assessDate}}</view>
+            <view class="product-name fw400">{{item.productName}}</view>
+            <view class="assess-date f13 .color-gray fw300">{{item.commentTime}}</view>
         </view>
         <view class="stars padding5" >
-            <mp-icon icon="star" color="#E15F3D" size="18" type="{{item.stars>0?'filled':'outline'}}"></mp-icon>
-            <mp-icon icon="star" color="#E15F3D" size="18" type="{{item.stars>1?'filled':'outline'}}"></mp-icon>
-            <mp-icon icon="star" color="#E15F3D" size="18" type="{{item.stars>2?'filled':'outline'}}"></mp-icon>
-            <mp-icon icon="star" color="#E15F3D" size="18" type="{{item.stars>3?'filled':'outline'}}"></mp-icon>
-            <mp-icon icon="star" color="#E15F3D" size="18" type="{{item.stars>4?'filled':'outline'}}"></mp-icon>
+            <mp-icon icon="star" color="#E15F3D" size="18" type="{{item.productScore>0?'filled':'outline'}}"></mp-icon>
+            <mp-icon icon="star" color="#E15F3D" size="18" type="{{item.productScore>1?'filled':'outline'}}"></mp-icon>
+            <mp-icon icon="star" color="#E15F3D" size="18" type="{{item.productScore>2?'filled':'outline'}}"></mp-icon>
+            <mp-icon icon="star" color="#E15F3D" size="18" type="{{item.productScore>3?'filled':'outline'}}"></mp-icon>
+            <mp-icon icon="star" color="#E15F3D" size="18" type="{{item.productScore>4?'filled':'outline'}}"></mp-icon>
         </view>
         <view class="comment-content padding5">
-            <view class=" fw300 padding5">{{item.comments.content}}</view>
+            <view class=" fw300 padding5">{{item.content}}</view>
             <view class="imgs">
-                <view class="comment-img " hidden="{{item.comments.imgs.length<1}}" wx:for-index="index" wx:for="{{item.comments.imgs}}" wx:key="imgurl">
-                        <image class="comm-img" src="{{item.imgurl}}"  data-index="{{index}}"  data-active="{{fatherindex}}"  bindtap = "previewImg">
+                <view class="comment-img " hidden="{{item.imgs.length<1}}" wx:for-index="index" wx:for="{{item.imgs}}" wx:key="imgurl">
+                        <image class="comm-img" src="{{item}}"  data-index="{{index}}"  data-active="{{fatherindex}}"  bindtap = "previewImg">
                             
                         </image>
                 </view>

+ 27 - 3
pages/appointment/appointment.js

@@ -1,3 +1,6 @@
+const app = getApp();
+import productApi from '../../api/product'
+import storeApi from '../../api/store'
 Page({
 
   /**
@@ -7,9 +10,9 @@ Page({
     peopleNum: 1,
     activeTab: 0,
     productInfo: {
-      title: "葛优躺(北京躺)电影足疗",
-      shop: "大华店",
+     
     },
+    shopInfo: {},
     tabs: [],
     orderTime: "",
     orderTimeHeight: 0
@@ -19,6 +22,16 @@ Page({
    * 生命周期函数--监听页面加载
    */
   onLoad: async function (options) {
+    var shopId = options.shopId;
+    var productId = options.productId
+    var productInfo = await productApi.getProductById(productId);
+    var shopInfo = await storeApi.getStoreById(shopId);
+    this.setData({
+      productInfo: productInfo.info,
+      shopInfo:shopInfo.info
+    })
+
+
     var tabs = await this.createTimeList(268);
     this.setData({
       tabs
@@ -26,6 +39,17 @@ Page({
     this.getOrderHeight();
     this.checkedTime()
   },
+  checkAuth: async function () {
+    console.log(this)
+    const isAuth = await app.isAuth()
+    if (!isAuth) {
+      wx.redirectTo({
+        url: '/pages/prompt/prompt?page=' + this.route,
+      })
+    }
+  },
+
+
   onSlideChangeEnd: function (e) {
     var that = this;
     that.setData({
@@ -229,7 +253,7 @@ Page({
       }
     })
     this.setData({
-      tabs:nowTabs
+      tabs: nowTabs
     })
   },
 

+ 4 - 4
pages/appointment/appointment.wxml

@@ -1,6 +1,6 @@
 <view class="container">
-    <view class="product-title card f17">{{productInfo.title}}</view>
-    <view class="shop-name card f17">门店·{{productInfo.shop}}</view>
+    <view class="product-title card f17">{{productInfo.productName}}</view>
+    <view class="shop-name card f17">门店·{{shopInfo.storeName}}</view>
     <view class="people-num card">
         <view class="title">选择人数</view>
         <view class="num-box">
@@ -28,7 +28,7 @@
                         
                        <view class="time-info {{item.checked&&item.inTime?'select-time':''}}  {{item.inTime?'':'out-time'}}"  data-time="{{item.time}}"  data-i="{{index}}"  bindtap = "getOrderTime" >
                            <view class="time fw300" >{{item.time}}</view>
-                           <view class="price fw300" >¥{{item.price}}</view>
+                           <view class="price fw300" >¥{{productInfo.currentPrice}}</view>
                        </view>
                     </block>
 
@@ -39,7 +39,7 @@
 
     </view>
     <navigator class="appointment card" url="" hover-class="appointment-hover" open-type="navigate">
-        <view class="btn" >
+        <view class="btn" bindtap = "checkAuth">
             确认预约
         </view>
     </navigator>

+ 4 - 1
pages/commentinfo/commentinfo.js

@@ -1,4 +1,6 @@
 // pages/commentinfo/commentinfo.js
+
+import uploadApi from '../../api/upload'
 Page({
 
   /**
@@ -49,7 +51,8 @@ Page({
             imgs.push(tempFilePaths[i]);
           }
         }
-        // console.log(imgs);
+        uploadApi.uploadCommentImgs(tempFilePaths)
+        
         that.setData({
           imgs: imgs
         });

+ 2 - 1
pages/commentinfo/commentinfo.scss

@@ -63,7 +63,8 @@
                 display: flex;
                 justify-content:flex-start;
                 flex-wrap: wrap;
-                padding-top: 30rpx;
+                padding:30rpx 0;
+                
                 .pic {
                     width: 30%;
                     height: 200rpx;

+ 1 - 1
pages/commentinfo/commentinfo.wxss

@@ -64,7 +64,7 @@
   display: flex;
   justify-content: flex-start;
   flex-wrap: wrap;
-  padding-top: 30rpx;
+  padding: 30rpx 0;
 }
 
 .container .comment-img .weui-uploader .weui-uploader__bd .pic {

+ 212 - 141
pages/comments/comments.js

@@ -1,145 +1,216 @@
 // pages/comments/comments.js
+import commentsApi from '../../api/comments'
+const app = getApp()
 Page({
 
-  /**
-   * 页面的初始数据
-   */
-  data: {
-    commentsList:[{
-      id:1,
-      headImg:"../../images/headImg.jpg",
-      product:"葛优躺(北京躺)电影足疗",
-      assessDate:"2020-02-02",
-      stars:5,
-      comments:{
-          content:"3号技师特别好~~~赞一个,下次还来。",
-          imgs:[
-              {imgurl:"https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1608485845363&di=e7d98132fabd3cff8c6af84706dabbd3&imgtype=0&src=http%3A%2F%2Fdpic.tiankong.com%2F13%2Fsi%2FQJ6552879374.jpg"},
-              {imgurl:"https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1608485845364&di=51f1ef89c02857c1187ba1abb7d0afb4&imgtype=0&src=http%3A%2F%2Fpicnew11.photophoto.cn%2F20170225%2Fzhongyiyangshengjiamubiao-zhongyituinaanmo-24406997_1.jpg"},
-              {imgurl:"https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1608485845364&di=f3d84d43be664894c7a7666198a98055&imgtype=0&src=http%3A%2F%2Fpic9.nipic.com%2F20100827%2F3079353_153325059762_2.jpg"},
-              {imgurl:"https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1608485845364&di=f3d84d43be664894c7a7666198a98055&imgtype=0&src=http%3A%2F%2Fpic9.nipic.com%2F20100827%2F3079353_153325059762_2.jpg"},
-              {imgurl:"https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1608485845364&di=f3d84d43be664894c7a7666198a98055&imgtype=0&src=http%3A%2F%2Fpic9.nipic.com%2F20100827%2F3079353_153325059762_2.jpg"},
-              {imgurl:"https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1608485845364&di=f3d84d43be664894c7a7666198a98055&imgtype=0&src=http%3A%2F%2Fpic9.nipic.com%2F20100827%2F3079353_153325059762_2.jpg"},
-              {imgurl:"https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1608485845364&di=f3d84d43be664894c7a7666198a98055&imgtype=0&src=http%3A%2F%2Fpic9.nipic.com%2F20100827%2F3079353_153325059762_2.jpg"},
-              {imgurl:"https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1608485845364&di=f3d84d43be664894c7a7666198a98055&imgtype=0&src=http%3A%2F%2Fpic9.nipic.com%2F20100827%2F3079353_153325059762_2.jpg"},
-              {imgurl:"https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1608485845364&di=f3d84d43be664894c7a7666198a98055&imgtype=0&src=http%3A%2F%2Fpic9.nipic.com%2F20100827%2F3079353_153325059762_2.jpg"},
-          ]
-      }
-  },{
-      id:2,
-      headImg:"../../images/headImg.jpg",
-      product:"葛优躺(北京躺)电影足疗",
-      assessDate:"2020-02-02",
-      stars:5,
-      comments:{
-          content:"3号技师特别好~~~赞一个,下次还来。",
-          imgs:[
-              {imgurl:"https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1608485845364&di=f3d84d43be664894c7a7666198a98055&imgtype=0&src=http%3A%2F%2Fpic9.nipic.com%2F20100827%2F3079353_153325059762_2.jpg"},
-              
-          ]
-      }
-  },{
-      id:3,
-      headImg:"../../images/headImg.jpg",
-      product:"葛优躺(北京躺)电影足疗",
-      assessDate:"2020-02-02",
-      stars:4,
-      comments:{
-          content:"3号技师特别好~~~赞一个,下次还来。",
-          imgs:[ ]
-      }
-  },{
-      id:4,
-      headImg:"../../images/headImg.jpg",
-      product:"葛优躺(北京躺)电影足疗",
-      assessDate:"2020-02-02",
-      stars:5,
-      comments:{
-          content:"3号技师特别好~~~赞一个,下次还来。",
-          imgs:[
-              {imgurl:"https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1608485845364&di=f3d84d43be664894c7a7666198a98055&imgtype=0&src=http%3A%2F%2Fpic9.nipic.com%2F20100827%2F3079353_153325059762_2.jpg"},
-              {imgurl:"https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1608485845364&di=f3d84d43be664894c7a7666198a98055&imgtype=0&src=http%3A%2F%2Fpic9.nipic.com%2F20100827%2F3079353_153325059762_2.jpg"},
-              {imgurl:"https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1608485845364&di=f3d84d43be664894c7a7666198a98055&imgtype=0&src=http%3A%2F%2Fpic9.nipic.com%2F20100827%2F3079353_153325059762_2.jpg"},
-              {imgurl:"https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1608485845364&di=f3d84d43be664894c7a7666198a98055&imgtype=0&src=http%3A%2F%2Fpic9.nipic.com%2F20100827%2F3079353_153325059762_2.jpg"},
-              
-          ]
-      }
-  },{
-      id:5,
-      headImg:"../../images/headImg.jpg",
-      product:"葛优躺(北京躺)电影足疗",
-      assessDate:"2020-02-02",
-      stars:5,
-      comments:{
-          content:"3号技师特别好~~~赞一个,下次还来。",
-          imgs:[
-            {imgurl:"https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1608485845364&di=f3d84d43be664894c7a7666198a98055&imgtype=0&src=http%3A%2F%2Fpic9.nipic.com%2F20100827%2F3079353_153325059762_2.jpg"},
-            {imgurl:"https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1608485845364&di=f3d84d43be664894c7a7666198a98055&imgtype=0&src=http%3A%2F%2Fpic9.nipic.com%2F20100827%2F3079353_153325059762_2.jpg"},
-            {imgurl:"https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1608485845364&di=f3d84d43be664894c7a7666198a98055&imgtype=0&src=http%3A%2F%2Fpic9.nipic.com%2F20100827%2F3079353_153325059762_2.jpg"},
-            {imgurl:"https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1608485845364&di=f3d84d43be664894c7a7666198a98055&imgtype=0&src=http%3A%2F%2Fpic9.nipic.com%2F20100827%2F3079353_153325059762_2.jpg"},
-            {imgurl:"https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1608485845364&di=f3d84d43be664894c7a7666198a98055&imgtype=0&src=http%3A%2F%2Fpic9.nipic.com%2F20100827%2F3079353_153325059762_2.jpg"},
-        ]
-      }
-  }],
-
-  },
-
-  /**
-   * 生命周期函数--监听页面加载
-   */
-  onLoad: function (options) {
-      
-    wx.setNavigationBarTitle({
-      title: options.title
-    })
-  },
-
-  /**
-   * 生命周期函数--监听页面初次渲染完成
-   */
-  onReady: function () {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面显示
-   */
-  onShow: function () {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面隐藏
-   */
-  onHide: function () {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面卸载
-   */
-  onUnload: function () {
-
-  },
-
-  /**
-   * 页面相关事件处理函数--监听用户下拉动作
-   */
-  onPullDownRefresh: function () {
-
-  },
-
-  /**
-   * 页面上拉触底事件的处理函数
-   */
-  onReachBottom: function () {
-
-  },
-
-  /**
-   * 用户点击右上角分享
-   */
-  onShareAppMessage: function () {
-
-  }
+    /**
+     * 页面的初始数据
+     */
+    data: {
+        commentsList: [{
+            id: 1,
+            headImg: "../../images/headImg.jpg",
+            product: "葛优躺(北京躺)电影足疗",
+            assessDate: "2020-02-02",
+            stars: 5,
+            comments: {
+                content: "3号技师特别好~~~赞一个,下次还来。",
+                imgs: [{
+                        imgurl: "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1608485845363&di=e7d98132fabd3cff8c6af84706dabbd3&imgtype=0&src=http%3A%2F%2Fdpic.tiankong.com%2F13%2Fsi%2FQJ6552879374.jpg"
+                    },
+                    {
+                        imgurl: "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1608485845364&di=51f1ef89c02857c1187ba1abb7d0afb4&imgtype=0&src=http%3A%2F%2Fpicnew11.photophoto.cn%2F20170225%2Fzhongyiyangshengjiamubiao-zhongyituinaanmo-24406997_1.jpg"
+                    },
+                    {
+                        imgurl: "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1608485845364&di=f3d84d43be664894c7a7666198a98055&imgtype=0&src=http%3A%2F%2Fpic9.nipic.com%2F20100827%2F3079353_153325059762_2.jpg"
+                    },
+                    {
+                        imgurl: "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1608485845364&di=f3d84d43be664894c7a7666198a98055&imgtype=0&src=http%3A%2F%2Fpic9.nipic.com%2F20100827%2F3079353_153325059762_2.jpg"
+                    },
+                    {
+                        imgurl: "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1608485845364&di=f3d84d43be664894c7a7666198a98055&imgtype=0&src=http%3A%2F%2Fpic9.nipic.com%2F20100827%2F3079353_153325059762_2.jpg"
+                    },
+                    {
+                        imgurl: "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1608485845364&di=f3d84d43be664894c7a7666198a98055&imgtype=0&src=http%3A%2F%2Fpic9.nipic.com%2F20100827%2F3079353_153325059762_2.jpg"
+                    },
+                    {
+                        imgurl: "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1608485845364&di=f3d84d43be664894c7a7666198a98055&imgtype=0&src=http%3A%2F%2Fpic9.nipic.com%2F20100827%2F3079353_153325059762_2.jpg"
+                    },
+                    {
+                        imgurl: "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1608485845364&di=f3d84d43be664894c7a7666198a98055&imgtype=0&src=http%3A%2F%2Fpic9.nipic.com%2F20100827%2F3079353_153325059762_2.jpg"
+                    },
+                    {
+                        imgurl: "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1608485845364&di=f3d84d43be664894c7a7666198a98055&imgtype=0&src=http%3A%2F%2Fpic9.nipic.com%2F20100827%2F3079353_153325059762_2.jpg"
+                    },
+                ]
+            }
+        }, {
+            id: 2,
+            headImg: "../../images/headImg.jpg",
+            product: "葛优躺(北京躺)电影足疗",
+            assessDate: "2020-02-02",
+            stars: 5,
+            comments: {
+                content: "3号技师特别好~~~赞一个,下次还来。",
+                imgs: [{
+                        imgurl: "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1608485845364&di=f3d84d43be664894c7a7666198a98055&imgtype=0&src=http%3A%2F%2Fpic9.nipic.com%2F20100827%2F3079353_153325059762_2.jpg"
+                    },
+
+                ]
+            }
+        }, {
+            id: 3,
+            headImg: "../../images/headImg.jpg",
+            product: "葛优躺(北京躺)电影足疗",
+            assessDate: "2020-02-02",
+            stars: 4,
+            comments: {
+                content: "3号技师特别好~~~赞一个,下次还来。",
+                imgs: []
+            }
+        }, {
+            id: 4,
+            headImg: "../../images/headImg.jpg",
+            product: "葛优躺(北京躺)电影足疗",
+            assessDate: "2020-02-02",
+            stars: 5,
+            comments: {
+                content: "3号技师特别好~~~赞一个,下次还来。",
+                imgs: [{
+                        imgurl: "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1608485845364&di=f3d84d43be664894c7a7666198a98055&imgtype=0&src=http%3A%2F%2Fpic9.nipic.com%2F20100827%2F3079353_153325059762_2.jpg"
+                    },
+                    {
+                        imgurl: "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1608485845364&di=f3d84d43be664894c7a7666198a98055&imgtype=0&src=http%3A%2F%2Fpic9.nipic.com%2F20100827%2F3079353_153325059762_2.jpg"
+                    },
+                    {
+                        imgurl: "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1608485845364&di=f3d84d43be664894c7a7666198a98055&imgtype=0&src=http%3A%2F%2Fpic9.nipic.com%2F20100827%2F3079353_153325059762_2.jpg"
+                    },
+                    {
+                        imgurl: "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1608485845364&di=f3d84d43be664894c7a7666198a98055&imgtype=0&src=http%3A%2F%2Fpic9.nipic.com%2F20100827%2F3079353_153325059762_2.jpg"
+                    },
+
+                ]
+            }
+        }, {
+            id: 5,
+            headImg: "../../images/headImg.jpg",
+            product: "葛优躺(北京躺)电影足疗",
+            assessDate: "2020-02-02",
+            stars: 5,
+            comments: {
+                content: "3号技师特别好~~~赞一个,下次还来。",
+                imgs: [{
+                        imgurl: "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1608485845364&di=f3d84d43be664894c7a7666198a98055&imgtype=0&src=http%3A%2F%2Fpic9.nipic.com%2F20100827%2F3079353_153325059762_2.jpg"
+                    },
+                    {
+                        imgurl: "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1608485845364&di=f3d84d43be664894c7a7666198a98055&imgtype=0&src=http%3A%2F%2Fpic9.nipic.com%2F20100827%2F3079353_153325059762_2.jpg"
+                    },
+                    {
+                        imgurl: "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1608485845364&di=f3d84d43be664894c7a7666198a98055&imgtype=0&src=http%3A%2F%2Fpic9.nipic.com%2F20100827%2F3079353_153325059762_2.jpg"
+                    },
+                    {
+                        imgurl: "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1608485845364&di=f3d84d43be664894c7a7666198a98055&imgtype=0&src=http%3A%2F%2Fpic9.nipic.com%2F20100827%2F3079353_153325059762_2.jpg"
+                    },
+                    {
+                        imgurl: "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1608485845364&di=f3d84d43be664894c7a7666198a98055&imgtype=0&src=http%3A%2F%2Fpic9.nipic.com%2F20100827%2F3079353_153325059762_2.jpg"
+                    },
+                ]
+            }
+        }],
+        shopId: '',
+        productId: ''
+
+    },
+
+    /**
+     * 生命周期函数--监听页面加载
+     */
+    onLoad: async function (options) {
+        
+
+        wx.setNavigationBarTitle({
+            title: options.title
+        })
+        if (options.commentstype == 'my') {
+
+            var comments = await commentsApi.getPersonComments(1);
+            var list = this.standardCommentsList(comments.list);
+            this.setData({
+                commentsList: list
+            })
+
+        }
+        if (options.commentstype == 'all') {
+            var shopId = options.shopId;
+            var productId = options.productId;
+            var comments = await commentsApi.getCommentsByProduct(shopId, productId);
+            //对返回的评论列表进行处理
+            var list = this.standardCommentsList(comments.list);
+            this.setData({
+                commentsList: list,
+                shopId,
+                productId
+            })
+
+        }
+    },
+
+    standardCommentsList: function (list) {
+        list.forEach(function (item, i, array) {
+            let urls = item.imgUrls;
+            let imgs = urls.split(',');
+            item.imgs = imgs;
+            let time = item.createTime.trim().split(" ")[0];
+            item.commentTime = time
+        })
+        return list;
+    },
+    /**
+     * 生命周期函数--监听页面初次渲染完成
+     */
+    onReady: function () {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面显示
+     */
+    onShow: function () {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面隐藏
+     */
+    onHide: function () {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面卸载
+     */
+    onUnload: function () {
+
+    },
+
+    /**
+     * 页面相关事件处理函数--监听用户下拉动作
+     */
+    onPullDownRefresh: function () {
+
+    },
+
+    /**
+     * 页面上拉触底事件的处理函数
+     */
+    onReachBottom: function () {
+        console.log('bottom')
+    },
+
+    /**
+     * 用户点击右上角分享
+     */
+    onShareAppMessage: function () {
+
+    }
 })

+ 68 - 32
pages/index/index.js

@@ -1,22 +1,21 @@
-import { default as storeApi} from "../../api/store"
-import { default as commonApi} from "../../api/commonApi"
-import { default as requestApi} from "../../utils/request"
-import { default as productApi} from "../../api/product"
+import {
+  default as storeApi
+} from "../../api/store"
+import {
+  default as commonApi
+} from "../../api/commonApi"
+import {
+  default as requestApi
+} from "../../utils/request"
+import {
+  default as productApi
+} from "../../api/product"
+
+const app = getApp();
 
 Page({
   data: {
-    shopList: [{
-      id: 1,
-      imgurl: "../../images/shop.jpg",
-      shopname: "大华店",
-      stars: 4,
-      mark: true,
-      new: true,
-      discount: false,
-      marktext: "新店促销",
-      shop_address: "上海市宝山区大华虎城A座10L",
-      shop_distance: "6.5KM"
-    }],
+
     tabs: [],
     activeTab: 0,
     productHeight: 0,
@@ -53,7 +52,7 @@ Page({
         imgurl: "../../images/product01.jpg"
       }
     ],
-    isLocation:false
+    isLocation: false,
 
   },
 
@@ -61,10 +60,10 @@ Page({
   onLoad: async function () {
     const self = this
     const tokenData = await commonApi.getToken();
-      if(tokenData.token){
-        wx.setStorageSync('token', tokenData.token)
-        requestApi.HEAD.token = tokenData.token
-      }
+    if (tokenData.token) {
+      wx.setStorageSync('token', tokenData.token)
+      requestApi.HEAD.token = tokenData.token
+    }
     wx.getSetting({
       success: (res) => {
         let authSetting = res.authSetting
@@ -97,12 +96,11 @@ Page({
 
   getProductList: async function () {
     const self = this
-    const productList = await productApi.getProductList(1,4)
-    console.log()
+    const productList = await productApi.getProductList(1, 4)
     self.setData({
       productList: productList,
-      page:1,
-      pageSize:10
+      page: 1,
+      pageSize: 10
     })
   },
   requestAll(url, data, header = {}, method) {
@@ -163,28 +161,64 @@ Page({
     })
   },
   handleClick(e) {
-    wx.navigateTo({
-      url: './webview',
+   
+  },
+  getLocation: async function () {
+    console.log('getlocation')
+    const self = this
+    wx.getLocation({
+      type: 'wgs84',
+      async success(res) {
+        console.log(res)
+        const latitude = res.latitude
+        const longitude = res.longitude
+        const speed = res.speed
+        const accuracy = res.accuracy
+        const rs = await storeApi.getNearStore(latitude, longitude)
+        console.log(rs.info);
+        self.setData({
+          locationFlag: true,
+          storeInfo: rs.info
+        })
+      },fail(err){
+        console.log(err)
+
+      }
     })
   },
-  getLocation: async function(){
+
+  showProduct:async function (e) {
     const self = this
+    console.log(e.currentTarget.dataset.productid)
+    var productId = e.currentTarget.dataset.productid;
+    if (this.data.storeInfo) {
+      var shopId = this.data.storeInfo.id;
+      wx.navigateTo({
+        url: '../product/product?shopId=' + shopId + '&productId=' + productId,
+      })
+      return
+    }
     wx.getLocation({
       type: 'wgs84',
-      async success (res) {
+      async success(res) {
         console.log(res)
         const latitude = res.latitude
         const longitude = res.longitude
         const speed = res.speed
         const accuracy = res.accuracy
-        const rs = await storeApi.getNearStore(latitude,longitude)
+        const rs = await storeApi.getNearStore(latitude, longitude)
         console.log(rs.info);
         self.setData({
           locationFlag: true,
           storeInfo: rs.info
         })
+        var shopId = self.data.storeInfo.id;
+        wx.navigateTo({
+          url: '../product/product?shopId=' + shopId + '&productId=' + productId,
+        })
       }
-     })
+    })
+    
   },
   /**
    * 页面上拉触底事件的处理函数
@@ -198,4 +232,6 @@ Page({
   onPullDownRefresh: function () {
     console.log(111)
   },
-})
+
+
+})

+ 0 - 1
pages/index/index.json

@@ -1,7 +1,6 @@
 {
   "usingComponents": {
     "mp-icon": "weui-miniprogram/icon/icon",
-    
     "mp-tabs": "/componets/tabs/index"
   },
   "navigationBarBackgroundColor": "#343434",

+ 8 - 8
pages/index/index.wxml

@@ -33,11 +33,11 @@
                   </view>
                   <view class="shopview">
                       <view>
-                          <mp-icon icon="star" color="#E15F3D" size="18" type="{{parseInt(storeInfo.score)>0?'filled':'outline'}}"></mp-icon>
-                          <mp-icon icon="star" color="#E15F3D" size="18" type="{{parseInt(storeInfo.score)>1?'filled':'outline'}}"></mp-icon>
-                          <mp-icon icon="star" color="#E15F3D" size="18" type="{{parseInt(storeInfo.score)>2?'filled':'outline'}}"></mp-icon>
-                          <mp-icon icon="star" color="#E15F3D" size="18" type="{{parseInt(storeInfo.score)>3?'filled':'outline'}}"></mp-icon>
-                          <mp-icon icon="star" color="#E15F3D" size="18" type="{{parseInt(storeInfo.score)>4?'filled':'outline'}}"></mp-icon>
+                          <mp-icon icon="star" color="#E15F3D" size="18" type="{{parseInt(storeInfo.storeScore)>0?'filled':'outline'}}"></mp-icon>
+                          <mp-icon icon="star" color="#E15F3D" size="18" type="{{parseInt(storeInfo.storeScore)>1?'filled':'outline'}}"></mp-icon>
+                          <mp-icon icon="star" color="#E15F3D" size="18" type="{{parseInt(storeInfo.storeScore)>2?'filled':'outline'}}"></mp-icon>
+                          <mp-icon icon="star" color="#E15F3D" size="18" type="{{parseInt(storeInfo.storeScore)>3?'filled':'outline'}}"></mp-icon>
+                          <mp-icon icon="star" color="#E15F3D" size="18" type="{{parseInt(storeInfo.storeScore)>4?'filled':'outline'}}"></mp-icon>
                       </view>
                   </view>
                   <view class="shop-address shopview">
@@ -91,15 +91,15 @@
       </mp-tabs>
  -->
 
- <block wx:for="{{productList.list}}" wx:key="id">
+ <block wx:for="{{productList.list}}" wx:key="id" >
   <view class="productinfo">
-    <view class="product-item" style="background-image: url({{item.productImg}});">
+    <view class="product-item" data-productid="{{item.id}}" bindtap = "showProduct" style="background-image: url({{item.productImg}});">
       <view class="product-desc" >
         <view class="f17">{{item.productName}}</view>
         <view class=".fw700">¥{{item.currentPrice}}/人</view>
         <view class="f13">{{item.productContent}}</view>
       </view>
-      <view class="order {{item.status?'':'gray'}}">
+      <view class="order {{item.status==1?'':'gray'}}">
         <view >
           立即预约
         </view>

+ 4 - 5
pages/index/index.wxss

@@ -1,9 +1,8 @@
-
-page {
+@charset "UTF-8";
+Page {
   width: 100%;
   height: 100%;
   background-color: #F7F7F7;
- 
 }
 
 .container {
@@ -119,7 +118,7 @@ page {
 }
 
 .container .product {
-  /* overflow-y: auto; */
+  overflow-y: auto;
   /* .weui-tabs {
       .weui-tabs-bar__wrp {
         .weui-tabs-bar__content {
@@ -151,7 +150,7 @@ page {
 }
 
 .container .product .productinfo .product-item .product-desc {
-  /* height: 380rpx; */
+  height: 380rpx;
   color: #fff;
   position: absolute;
   color: #fff;

+ 25 - 14
pages/person/person.js

@@ -6,7 +6,7 @@ Page({
    * 页面的初始数据
    */
   data: {
-   
+
     hasUserInfo: false
   },
 
@@ -16,7 +16,7 @@ Page({
   onLoad: async function (options) {
     let userInfo = await app.getWxUserInfo()
     console.log(userInfo);
-    if (userInfo){
+    if (userInfo) {
       this.setData({
         userInfo: userInfo,
         hasUserInfo: true,
@@ -36,15 +36,9 @@ Page({
    * 生命周期函数--监听页面显示
    */
   onShow: async function () {
-    let userInfo = await app.getWxUserInfo()
-    console.log(userInfo);
-    if (userInfo){
-      this.setData({
-        userInfo: userInfo,
-        hasUserInfo: true,
-        hasMobile: userInfo.mobile ? true : false
-      })
-    }
+
+
+
   },
 
   /**
@@ -81,14 +75,14 @@ Page({
   onShareAppMessage: function () {
 
   },
-  getInfo : async function(e){
+  getInfo: async function (e) {
     const _self = this
     let userInfo = e.detail.userInfo
     userInfo['encryptedData'] = e.detail.encryptedData
     userInfo['iv'] = e.detail.iv
     let info = await app.wxLogin(userInfo);
     let hasMobile = false;
-    if (info.mobile){
+    if (info.mobile) {
       hasMobile = true
     }
     _self.setData({
@@ -96,6 +90,23 @@ Page({
       userInfo: info,
       hasMobile: hasMobile,
     })
-    console.log(2222)
+  },
+  gotoComment:async function (e) {
+    console.log(this)
+    const isAuth = await app.isAuth()
+    if (!isAuth) {
+      wx.redirectTo({
+        url: '/pages/prompt/prompt?page=pages/comments/comments',
+      })
+      return
+    }
+    wx.navigateTo({
+      url: '../comments/comments?title=我的评论&commentstype=my',
+    })
+  },
+  gotoPersonInfo: function (e) {
+    wx.navigateTo({
+      url: '../personinfo/personinfo',
+    })
   }
 })

+ 14 - 6
pages/person/person.scss

@@ -12,13 +12,15 @@
             .user-name {
                 position: relative;
                 margin-top: 10rpx;
+               
 
-                image {
+                .next {
                     width: 35rpx;
                     height: 35rpx;
                     position: absolute;
-                    left: 88rpx;
+                    right: -74rpx;
                     top: 12rpx;
+                    z-index: -1
                 }
             }
 
@@ -28,13 +30,13 @@
         }
 
         .head-img {
-            width: 200rpx;
-            height: 200rpx;
+            width: 180rpx;
+            height: 180rpx;
             border-radius: 50%;
 
             image {
-                width: 200rpx;
-                height: 200rpx;
+                width: 180rpx;
+                height: 180rpx;
                 border-radius: 50%;
             }
         }
@@ -59,10 +61,16 @@
         .next{
             width: 50rpx;
             height: 50rpx;
+            position: absolute;
+            top: 122rpx;
+            right: 385rpx;
         }
         .defult-user{
             width: 150rpx;
             height: 150rpx;
+            position: absolute;
+            top: 70rpx;
+            right: 65rpx;
         }
     }
 

+ 6 - 6
pages/person/person.wxml

@@ -1,9 +1,9 @@
 <!--pages/person/person.wxml-->
 <view class="container">
-    <navigator class="person card" url="../personinfo/personinfo" wx:if="{{hasUserInfo}}">
+    <view class="person card" wx:if="{{hasUserInfo}}" bindtap = "gotoPersonInfo">
         <view class="person-info">
             <view class="user-name f18 c-202020">{{userInfo.name}}
-                <image class="" src="../../images/icons/next.png">
+                <image class="next" src="../../images/icons/next.png">
                 </image>
             </view>
             <view class="tel c-707070 fw300">{{userInfo.mobile}}</view>
@@ -12,12 +12,12 @@
             <image class="" src="{{userInfo.avatar}}">
             </image>
         </view>
-    </navigator>
+    </view>
     <view wx:else class="user-login">
         <view class="person-info">
             <view class="user-name f18 c-202020">
                 <button open-type="getUserInfo" bindgetuserinfo="getInfo" class="login-btn"
-            style="height: 100px;">请点击登录</button>
+            style="height: 100px;width: 200px;">请点击登录</button>
                 <image class="next" src="../../images/icons/next.png">
                 </image>
             </view>
@@ -40,7 +40,7 @@
         <image class="next-gray" src="../../images/icons/next-gray.png">
         </image>
     </view>
-    <navigator class="assess" hover-class="none" url="../comments/comments?title=我的评论">
+    <view class="assess" bindtap = "gotoComment">
         <image class="icons" src="../../images/icons/assess.png"></image>
         <view class="assess-text">我的点评
 
@@ -48,5 +48,5 @@
         <image class="next-gray" src="../../images/icons/next-gray.png">
 
         </image>
-    </navigator>
+    </view>
 </view>

+ 13 - 6
pages/person/person.wxss

@@ -15,12 +15,13 @@
   margin-top: 10rpx;
 }
 
-.container .person .person-info .user-name image {
+.container .person .person-info .user-name .next {
   width: 35rpx;
   height: 35rpx;
   position: absolute;
-  left: 88rpx;
+  right: -74rpx;
   top: 12rpx;
+  z-index: -1;
 }
 
 .container .person .person-info .tel {
@@ -28,14 +29,14 @@
 }
 
 .container .person .head-img {
-  width: 200rpx;
-  height: 200rpx;
+  width: 180rpx;
+  height: 180rpx;
   border-radius: 50%;
 }
 
 .container .person .head-img image {
-  width: 200rpx;
-  height: 200rpx;
+  width: 180rpx;
+  height: 180rpx;
   border-radius: 50%;
 }
 
@@ -61,11 +62,17 @@
 .container .user-login .next {
   width: 50rpx;
   height: 50rpx;
+  position: absolute;
+  top: 122rpx;
+  right: 385rpx;
 }
 
 .container .user-login .defult-user {
   width: 150rpx;
   height: 150rpx;
+  position: absolute;
+  top: 70rpx;
+  right: 65rpx;
 }
 
 .container .order {

+ 6 - 3
pages/personorder/personorder.js

@@ -123,9 +123,7 @@ Page({
     })
   },
   handleClick(e) {
-    wx.navigateTo({
-      url: './webview',
-    })
+   
   },
   /**
    * 生命周期函数--监听页面初次渲染完成
@@ -174,5 +172,10 @@ Page({
    */
   onShareAppMessage: function () {
 
+  },
+  gotoComment:function (e) {
+    wx.navigateTo({
+      url: '../commentinfo/commentinfo',
+    })
   }
 })

+ 1 - 1
pages/personorder/personorder.wxml

@@ -41,7 +41,7 @@
                             </view>
                             <view class="operate-btn">
                                 <view class="buy-again btn f14" wx:if="{{item.orderStatus !==0}}">再来一单</view>
-                                <view class="comment btn f14" wx:if="{{item.orderStatus==1}}">评价</view>
+                                <view class="comment btn f14" wx:if="{{item.orderStatus==1}}"  bindtap = "gotoComment">评价</view>
                                 <view class="pay btn f14" wx:if="{{item.orderStatus==0}}">付款</view>
                             </view>
                         </view>

+ 214 - 181
pages/product/product.js

@@ -1,186 +1,219 @@
 // pages/productinfo/productinfo.js
+import productApi from '../../api/product'
+
 Page({
 
-  /**
-   * 页面的初始数据
-   */
-  data: {
-    productinfo:{
-      title:"葛优躺(北京躺)电影足疗",
-      price:"666",
-      commentsList:[]
+    /**
+     * 页面的初始数据
+     */
+    data: {
+        productinfo: {
+            title: "葛优躺(北京躺)电影足疗",
+            price: "666",
+            commentsList: []
+        },
+        shopId: 0,
+        productId: 0,
+        product: {}
+
+    },
+
+    /**
+     * 生命周期函数--监听页面加载
+     */
+    onLoad: async function (options) {
+        wx.showLoading({
+            title: '加载中',
+        })
+        var shopId = options.shopId;
+        var productId = options.productId;
+        var product = await productApi.getProductById(productId);
+        this.setData({
+            shopId,
+            productId,
+            product: product.info
+        })
+
+        /*    var list = [{
+             id: 1,
+             headImg: "../../images/headImg.jpg",
+             product: "葛优躺(北京躺)电影足疗",
+             assessDate: "2020-02-02",
+             stars: 5,
+             comments: {
+                 content: "3号技师特别好~~~赞一个,下次还来。",
+                 imgs: [{
+                         imgurl: "../../images/commentsImg01.jpg"
+                     },
+                     {
+                         imgurl: "../../images/commentsImg02.jpg"
+                     },
+                     {
+                         imgurl: "../../images/commentsImg03.jpg"
+                     },
+                     {
+                         imgurl: "../../images/commentsImg03.jpg"
+                     },
+                     {
+                         imgurl: "../../images/commentsImg02.jpg"
+                     },
+                     {
+                         imgurl: "../../images/commentsImg01.jpg"
+                     },
+                     {
+                         imgurl: "../../images/commentsImg02.jpg"
+                     },
+                     {
+                         imgurl: "../../images/commentsImg01.jpg"
+                     },
+                     {
+                         imgurl: "../../images/commentsImg03.jpg"
+                     },
+                 ]
+             }
+         }, {
+             id: 2,
+             headImg: "../../images/headImg.jpg",
+             product: "葛优躺(北京躺)电影足疗",
+             assessDate: "2020-02-02",
+             stars: 5,
+             comments: {
+                 content: "3号技师特别好~~~赞一个,下次还来。",
+                 imgs: [{
+                         imgurl: "../../images/commentsImg01.jpg"
+                     },
+
+                 ]
+             }
+         }, {
+             id: 3,
+             headImg: "../../images/headImg.jpg",
+             product: "葛优躺(北京躺)电影足疗",
+             assessDate: "2020-02-02",
+             stars: 4,
+             comments: {
+                 content: "3号技师特别好~~~赞一个,下次还来。",
+                 imgs: []
+             }
+         }, {
+             id: 4,
+             headImg: "../../images/headImg.jpg",
+             product: "葛优躺(北京躺)电影足疗",
+             assessDate: "2020-02-02",
+             stars: 5,
+             comments: {
+                 content: "3号技师特别好~~~赞一个,下次还来。",
+                 imgs: [{
+                         imgurl: "../../images/commentsImg01.jpg"
+                     },
+                     {
+                         imgurl: "../../images/commentsImg02.jpg"
+                     },
+                     {
+                         imgurl: "../../images/commentsImg01.jpg"
+                     },
+                     {
+                         imgurl: "../../images/commentsImg03.jpg"
+                     },
+
+                 ]
+             }
+         }, {
+             id: 5,
+             headImg: "../../images/headImg.jpg",
+             product: "葛优躺(北京躺)电影足疗",
+             assessDate: "2020-02-02",
+             stars: 5,
+             comments: {
+                 content: "3号技师特别好~~~赞一个,下次还来。",
+                 imgs: [{
+                         imgurl: "../../images/commentsImg01.jpg"
+                     },
+                     {
+                         imgurl: "../../images/commentsImg02.jpg"
+                     },
+                     {
+                         imgurl: "../../images/commentsImg03.jpg"
+                     },
+                     {
+                         imgurl: "../../images/commentsImg02.jpg"
+                     },
+                     {
+                         imgurl: "../../images/commentsImg01.jpg"
+                     },
+
+                 ]
+             }
+         }];
+
+         
+         this.setData({
+             // id: options.id,
+             commentsList: list,
+         })
+         */
+    },
+
+    /**
+     * 生命周期函数--监听页面初次渲染完成
+     */
+    onReady: function () {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面显示
+     */
+    onShow: function () {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面隐藏
+     */
+    onHide: function () {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面卸载
+     */
+    onUnload: function () {
+
+    },
+
+    /**
+     * 页面相关事件处理函数--监听用户下拉动作
+     */
+    onPullDownRefresh: function () {
+
+    },
+
+    /**
+     * 页面上拉触底事件的处理函数
+     */
+    onReachBottom: function () {
+
+    },
+
+    /**
+     * 用户点击右上角分享
+     */
+    onShareAppMessage: function () {
+
+    },
+    gotoAllComments: function (e) {
+        var shopId = this.data.shopId;
+        var productId = this.data.productId;
+        wx.navigateTo({
+          url: '../comments/comments?title=全部评论&commentstype=all&shopId='+shopId+'&productId='+productId,
+        })
+    },
+    gotoAppointment:function (e) {
+        var shopId = this.data.shopId;
+        var productId = this.data.productId;
+        wx.navigateTo({
+          url: '../appointment/appointment?shopId='+shopId+'&productId='+productId,
+        })
     }
-  },
-
-  /**
-   * 生命周期函数--监听页面加载
-   */
-  onLoad: function (options) {
-    var list = [{
-      id: 1,
-      headImg: "../../images/headImg.jpg",
-      product: "葛优躺(北京躺)电影足疗",
-      assessDate: "2020-02-02",
-      stars: 5,
-      comments: {
-          content: "3号技师特别好~~~赞一个,下次还来。",
-          imgs: [{
-                  imgurl: "../../images/commentsImg01.jpg"
-              },
-              {
-                  imgurl: "../../images/commentsImg02.jpg"
-              },
-              {
-                  imgurl: "../../images/commentsImg03.jpg"
-              },
-              {
-                  imgurl: "../../images/commentsImg03.jpg"
-              },
-              {
-                  imgurl: "../../images/commentsImg02.jpg"
-              },
-              {
-                  imgurl: "../../images/commentsImg01.jpg"
-              },
-              {
-                  imgurl: "../../images/commentsImg02.jpg"
-              },
-              {
-                  imgurl: "../../images/commentsImg01.jpg"
-              },
-              {
-                  imgurl: "../../images/commentsImg03.jpg"
-              },
-          ]
-      }
-  }, {
-      id: 2,
-      headImg: "../../images/headImg.jpg",
-      product: "葛优躺(北京躺)电影足疗",
-      assessDate: "2020-02-02",
-      stars: 5,
-      comments: {
-          content: "3号技师特别好~~~赞一个,下次还来。",
-          imgs: [{
-                  imgurl: "../../images/commentsImg01.jpg"
-              },
-
-          ]
-      }
-  }, {
-      id: 3,
-      headImg: "../../images/headImg.jpg",
-      product: "葛优躺(北京躺)电影足疗",
-      assessDate: "2020-02-02",
-      stars: 4,
-      comments: {
-          content: "3号技师特别好~~~赞一个,下次还来。",
-          imgs: []
-      }
-  }, {
-      id: 4,
-      headImg: "../../images/headImg.jpg",
-      product: "葛优躺(北京躺)电影足疗",
-      assessDate: "2020-02-02",
-      stars: 5,
-      comments: {
-          content: "3号技师特别好~~~赞一个,下次还来。",
-          imgs: [{
-                  imgurl: "../../images/commentsImg01.jpg"
-              },
-              {
-                  imgurl: "../../images/commentsImg02.jpg"
-              },
-              {
-                  imgurl: "../../images/commentsImg01.jpg"
-              },
-              {
-                  imgurl: "../../images/commentsImg03.jpg"
-              },
-
-          ]
-      }
-  }, {
-      id: 5,
-      headImg: "../../images/headImg.jpg",
-      product: "葛优躺(北京躺)电影足疗",
-      assessDate: "2020-02-02",
-      stars: 5,
-      comments: {
-          content: "3号技师特别好~~~赞一个,下次还来。",
-          imgs: [{
-                  imgurl: "../../images/commentsImg01.jpg"
-              },
-              {
-                  imgurl: "../../images/commentsImg02.jpg"
-              },
-              {
-                  imgurl: "../../images/commentsImg03.jpg"
-              },
-              {
-                  imgurl: "../../images/commentsImg02.jpg"
-              },
-              {
-                  imgurl: "../../images/commentsImg01.jpg"
-              },
-
-          ]
-      }
-  }];
-
-  this.setData({
-      // id: options.id,
-      commentsList: list,
-  })
- 
-  },
-
-  /**
-   * 生命周期函数--监听页面初次渲染完成
-   */
-  onReady: function () {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面显示
-   */
-  onShow: function () {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面隐藏
-   */
-  onHide: function () {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面卸载
-   */
-  onUnload: function () {
-
-  },
-
-  /**
-   * 页面相关事件处理函数--监听用户下拉动作
-   */
-  onPullDownRefresh: function () {
-
-  },
-
-  /**
-   * 页面上拉触底事件的处理函数
-   */
-  onReachBottom: function () {
-
-  },
-
-  /**
-   * 用户点击右上角分享
-   */
-  onShareAppMessage: function () {
-
-  }
 })

+ 0 - 1
pages/product/product.scss

@@ -29,7 +29,6 @@ page {
     .product-desc {
         margin-top: 10rpx;
         width: 100%;
-        height: 1000rpx;
 
         image {
             width: 100%;

+ 10 - 11
pages/product/product.wxml

@@ -2,14 +2,13 @@
 <view class="container">
     <!-- 产品图片 -->
     <view class="product-img ">
-        <image src="../../images/product01.jpg"></image>
-        <view class="title ">{{productinfo.title}}</view>
-        <view class="price c-e40360 fw300">¥{{productinfo.price}}/人</view>
+        <image src="{{product.productImg}}"></image>
+        <view class="title ">{{product.productName}}</view>
+        <view class="price c-e40360 fw300">¥{{product.currentPrice}}/人</view>
     </view>
     <!-- 产品描述 -->
     <view class="product-desc card">
-        <image class="" src="../../images/richText.png">
-        </image>
+        {{product.product.productContent}}
     </view>
     <!-- 评论 -->
     <view class="comments card">
@@ -18,20 +17,20 @@
 
                 网友点评
             </view>
-            <navigator class="all-comments f15 .c-707070" target="" url="../comments/comments?title=全部评论"
-                hover-class="navigator-hover" open-type="navigate">
+            <view class="all-comments f15 .c-707070"  bindtap = "gotoAllComments"
+                >
                 全部{{commentsList.length}}条
                 <mp-icon icon="arrow" size="12" class="comments-icon" color="#707070"></mp-icon>
-            </navigator>
+            </view>
         </view>
         <comments commentsList="{{[commentsList[0],commentsList[1],commentsList[1]]}}"></comments>
 
     </view>
     <!-- 预约 -->
     <!-- <navigator class="appointment card" url="../appointment/appointment?price={{productinfo.price}}" hover-class="appointment-hover" open-type="navigate"> -->
-    <navigator class="appointment card" url="../appointment/appointment?price=268" hover-class="appointment-hover" open-type="navigate">
-        <view class="btn">
+    <view class="appointment card"  hover-class="appointment-hover" >
+        <view class="btn" bindtap = "gotoAppointment">
             立即预约
         </view>
-    </navigator>
+    </view>
 </view>

+ 0 - 1
pages/product/product.wxss

@@ -29,7 +29,6 @@ page {
 .container .product-desc {
   margin-top: 10rpx;
   width: 100%;
-  height: 1000rpx;
 }
 
 .container .product-desc image {

+ 18 - 4
pages/prompt/prompt.js

@@ -92,9 +92,23 @@ Page({
       userInfo: info,
       hasMobile: hasMobile,
     })
-    wx.switchTab({
-      url: '/'+_self.data.fromPage,
-    })
-    console.log(2222)
+
+    if(_self.data.fromPage=="pages/personorder/personorder"){
+      wx.switchTab({
+        url: '/'+_self.data.fromPage,
+      })
+    }/* else{
+      wx.redirectTo({
+        url: '/'+_self.data.fromPage,
+      })
+    } */
+    if(_self.data.fromPage=="pages/comments/comments"){
+      wx.redirectTo({
+        url: '../comments/comments?title=我的评论&commentstype=my',
+      })
+    }
+
+    console.log(_self.data.fromPage)
+   
   }
 })

+ 1 - 1
pages/shop/shop.wxml

@@ -1,4 +1,4 @@
 <!--pages/shop/shop.wxml-->
 <view class="container">
-    <shop shops="{{shopList}}"></shop>
+    <shop shops="{{shopList}}" ></shop>
 </view>

+ 33 - 5
pages/shopinfo/shopinfo.js

@@ -1,11 +1,13 @@
 // pages/shopinfo/shopinfo.js
+import storeApi from '../../api/store'
+import productApi from '../../api/product'
 Page({
 
     /**
      * 页面的初始数据
      */
     data: {
-        id: "",
+
         shopInfo: {
             shopImg: "../../images/shopImg.jpg",
             shopName: "大华店",
@@ -72,12 +74,14 @@ Page({
             shopDesc: "本店所有商品照片为专业摄影师拍摄,后期起精心修制及色彩调整,尽量与实际商品保持一致,但由于拍摄时的用光、角度、显示器色彩偏差、个人对颜色的认知等方面的差异,导致实物可能会与照片存在一些色差,最终颜色以实际商品为准。"
         },
         commentsList: [],
+        productList: []
     },
 
     /**
      * 生命周期函数--监听页面加载
      */
-    onLoad: function (options) {
+    onLoad: async function (options) {
+
         var list = [{
             id: 1,
             headImg: "../../images/headImg.jpg",
@@ -189,12 +193,17 @@ Page({
                 ]
             }
         }];
+        await this.getShopInfo(options.id);
 
-        this.setData({
-            id: options.id,
+        // this.setData({
+        //     productList
+        // });
+        /*  this.setData({
+            shopId:options.id,
+            productList,
             commentsList: list,
         })
-       
+ */
     },
 
     /**
@@ -244,5 +253,24 @@ Page({
      */
     onShareAppMessage: function () {
 
+    },
+    getShopInfo: async function (shopId) {
+        const self = this;
+        const productList = await productApi.getProductList(1, 100);
+        const shopInfo = await storeApi.getStoreById(shopId);
+        console.log(productList)
+        self.setData({
+            productList,
+            shopInfo: shopInfo.info
+        })
+    },
+    showProduct: function (e) {
+        console.log(e.currentTarget.dataset.productid)
+        var productId = e.currentTarget.dataset.productid;
+        var shopId = this.data.shopInfo.id;
+        // console.log('shop='+shopId)
+        wx.navigateTo({
+            url: '../product/product?shopId=' + shopId + '&productId=' + productId,
+        })
     }
 })

+ 12 - 7
pages/shopinfo/shopinfo.scss

@@ -42,17 +42,20 @@
                     margin-right: 40rpx;
                 }
 
-                .discover {
+                .next {
                     position: absolute;
-                    top: -2rpx;
-                    right: 3rpx;
+                    top: 8rpx;
+                    right: 13rpx;
+                    width: 30rpx;
+                    height: 30rpx;
                 }
             }
         }
-        .tel{
+
+        .tel {
             margin-top: 20rpx;
         }
-      
+
 
 
     }
@@ -113,9 +116,11 @@
 
     .comments {
         margin-bottom: 10rpx;
-        .all-comments{
+
+        .all-comments {
             position: relative;
-            .comments-icon{
+
+            .comments-icon {
                 position: absolute;
                 top: -1rpx;
                 left: 380rpx;

+ 18 - 16
pages/shopinfo/shopinfo.wxml

@@ -3,30 +3,30 @@
 <view class="container">
    <!-- 门店照片 -->
    <view class="shop-img">
-      <image src="../../images/shopImg.jpg"></image>
+      <image src="{{shopInfo.logo}}"></image>
    </view>
    <!-- 门店信息 -->
    <view class="shop-info card">
       <view class="shop-name f18">
-         {{shopInfo.shopName}}
+         {{shopInfo.storeName}}
       </view>
       <view class="stars">
 
-         <mp-icon icon="star" color="#E15F3D" size="18" type="{{shopInfo.stars>0?'filled':'outline'}}"></mp-icon>
-         <mp-icon icon="star" color="#E15F3D" size="18" type="{{shopInfo.stars>1?'filled':'outline'}}"></mp-icon>
-         <mp-icon icon="star" color="#E15F3D" size="18" type="{{shopInfo.stars>2?'filled':'outline'}}"></mp-icon>
-         <mp-icon icon="star" color="#E15F3D" size="18" type="{{shopInfo.stars>3?'filled':'outline'}}"></mp-icon>
-         <mp-icon icon="star" color="#E15F3D" size="18" type="{{shopInfo.stars>4?'filled':'outline'}}"></mp-icon>
+         <mp-icon icon="star" color="#E15F3D" size="18" type="{{parseInt(storeInfo.storeScore)>0?'filled':'outline'}}"></mp-icon>
+         <mp-icon icon="star" color="#E15F3D" size="18" type="{{parseInt(storeInfo.storeScore)>1?'filled':'outline'}}"></mp-icon>
+         <mp-icon icon="star" color="#E15F3D" size="18" type="{{parseInt(storeInfo.storeScore)>2?'filled':'outline'}}"></mp-icon>
+         <mp-icon icon="star" color="#E15F3D" size="18" type="{{parseInt(storeInfo.storeScore)>3?'filled':'outline'}}"></mp-icon>
+         <mp-icon icon="star" color="#E15F3D" size="18" type="{{parseInt(storeInfo.storeScore)>4?'filled':'outline'}}"></mp-icon>
       </view>
       <view class="tel f13 fw300 padding40">
          <mp-icon icon="cellphone" size="18" class="icon"></mp-icon>
-         {{shopInfo.shopTel}}
+         {{shopInfo.mobile}}
       </view>
       <view class="address f13 fw300 padding40">
          <view class="">
 
             <mp-icon icon="location" size="18" class="icon"></mp-icon>
-            {{shopInfo.shopAddress}}
+            {{shopInfo.address}}
          </view>
          <view class="way f13 fw300">
             <view class="checkway">
@@ -34,7 +34,9 @@
                查看路线
             </view>
 
-            <mp-icon icon="discover" size="18" color="rgb(58, 58, 58)" class="discover"></mp-icon>
+            <image class="next" src="../../images/icons/next-gray.png" >
+               
+            </image>
          </view>
       </view>
    </view>
@@ -43,20 +45,20 @@
       <view class="shop-title f17 fw600">
          门店项目
       </view>
-      <navigator url="../product/product" hover-class="none" open-type="navigate">
-         <view class="product" wx:for="{{shopInfo.products}}" wx:key="imgurl">
+      <view url="../product/product" >
+         <view class="product" wx:for="{{productList.list}}" wx:key="id" data-productid = "{{item.id}}" bindtap = "showProduct">
          <view class="product-img">
-            <image src="{{item.imgurl}}"></image>
+            <image src="{{item.productImg}}"></image>
          </view>
          <view class="product-info">
-            <view class="product-title ">{{item.title}}</view>
+            <view class="product-title ">{{item.productName}}</view>
             <view class="price">
-               <view class="new-price">¥{{item.newPrice}}</view>
+               <view class="new-price">¥{{item.currentPrice}}</view>
                <view class="old-price f13 fw300">¥{{item.oldPrice}}</view>
             </view>
          </view>
       </view>
-      </navigator>
+      </view>
       
 
    </view>

+ 5 - 3
pages/shopinfo/shopinfo.wxss

@@ -41,10 +41,12 @@
   margin-right: 40rpx;
 }
 
-.container .shop-info .address .way .discover {
+.container .shop-info .address .way .next {
   position: absolute;
-  top: -2rpx;
-  right: 3rpx;
+  top: 8rpx;
+  right: 13rpx;
+  width: 30rpx;
+  height: 30rpx;
 }
 
 .container .shop-info .tel {

+ 2 - 2
project.config.json

@@ -17,7 +17,7 @@
     "minified": true,
     "newFeature": false,
     "coverView": true,
-    "nodeModules": false,
+    "nodeModules": true,
     "autoAudits": false,
     "showShadowRootInWxmlPanel": true,
     "scopeDataCheck": false,
@@ -45,7 +45,7 @@
   },
   "compileType": "miniprogram",
   "libVersion": "2.10.4",
-  "appid": "wx7c83ec0af36c5817",
+  "appid": "wxac26792ea601584c",
   "projectname": "zy",
   "debugOptions": {
     "hidedInDevtools": []

+ 1 - 0
utils/date.js

@@ -8,4 +8,5 @@
     return `${y}${seperator}${m}${seperator}${d}`
   }
 
+
  

+ 4 - 1
utils/request.js

@@ -57,7 +57,10 @@ class request {
         return this.requestAll(url, data, header, 'POST')
     }
 
-    static upload(url, name, path, ortherData, header){
+    static upload(url, name, path, ortherData, header = this.HEAD){
+        if (!this.HEAD.token){
+            header.token = wx.getStorageSync('token')
+        }
         return new Promise((resolve, reject) => {
             wx.uploadFile({
                 url: url,