sunshine1130 4 years ago
parent
commit
979eccadf0

+ 3 - 1
app.json

@@ -10,7 +10,9 @@
     "pages/appointment/appointment",
     "pages/personorder/personorder",
     "pages/shopinfo/shopinfo",
-    "pages/shop/shop"
+    "pages/shop/shop",
+    "pages/prompt/prompt"
+   
   
   ],
   "window":{

+ 13 - 15
componets/shop/index.wxml

@@ -1,43 +1,41 @@
     <navigator url="../../pages/shopinfo/shopinfo?id={{item.id}}" wx:for="{{shops}}" wx:key="id" hover-class="none">
-        <view class="shop-info" wx:if="{{false}}">
+        <view class="shop-info" >
             <view class="shopimg">
-                <image src="{{item.imgurl}}" mode="aspectFill" lazy-load="false" class="img">
+                <image src="{{item.logo}}" mode="aspectFill" lazy-load="false" class="img">
 
                 </image>
             </view>
             <view class="shopmsg">
                 <view class="shopview">
                     <view class="c-202020">
-                        {{item.shopname}}
+                        {{item.storeName}}
                     </view>
-                    <view class="c-202020 mark f12 {{item.new?'new':''}} {{item.discount?'discount':''}}" wx:if="{{item.mark}}">
+                    <!-- <view class="c-202020 mark f12 {{item.new?'new':''}} {{item.discount?'discount':''}}" wx:if="{{item.mark}}">
                         {{item.marktext}}
-                    </view>
+                    </view> -->
                 </view>
                 <view class="shopview">
                     <view>
 
-                        <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.score>0?'filled':'outline'}}"></mp-icon>
+                        <mp-icon icon="star" color="#E15F3D" size="18" type="{{item.score>1?'filled':'outline'}}"></mp-icon>
+                        <mp-icon icon="star" color="#E15F3D" size="18" type="{{item.score>2?'filled':'outline'}}"></mp-icon>
+                        <mp-icon icon="star" color="#E15F3D" size="18" type="{{item.score>3?'filled':'outline'}}"></mp-icon>
+                        <mp-icon icon="star" color="#E15F3D" size="18" type="{{item.score>4?'filled':'outline'}}"></mp-icon>
                     </view>
                 </view>
                 <view class="shop-address shopview">
 
                     <view class="c-707070 f12">
                         <mp-icon icon="location" color="#707070" size="20" class="address-icon" ></mp-icon>
-                        {{item.shop_address}}
+                        {{item.address}}
                     </view>
                     <view class="c-707070 f12">
-                        {{item.shop_distance}}
+                        {{item.distance}}
                     </view>
                 </view>
             </view>
 
         </view>
-        <view catchtap="getLocation" open-type="getLocation">
-            <button>授权获取最近门店信息</button>
-        </view>
+      
     </navigator>

BIN
images/icons/defult-user.png


BIN
images/pos.png


+ 1 - 1
pages/index/index.json

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

+ 7 - 7
pages/index/index.wxml

@@ -15,7 +15,7 @@
       <!-- 店铺 -->
       <view wx:if="{{locationFlag}}">
 
-        <navigator url="../../pages/shopinfo/shopinfo?id={{item.id}}" wx:for="{{shopList}}" wx:key="id"
+        <navigator url="../../pages/shopinfo/shopinfo?id={{storeInfo.id}}" 
           hover-class="none">
           <view class="shop-info">
               <view class="shopimg">
@@ -33,11 +33,11 @@
                   </view>
                   <view class="shopview">
                       <view>
-                          <mp-icon icon="star" color="#E15F3D" size="18" type="{{storeInfo.score>0?'filled':'outline'}}"></mp-icon>
-                          <mp-icon icon="star" color="#E15F3D" size="18" type="{{storeInfo.score>1?'filled':'outline'}}"></mp-icon>
-                          <mp-icon icon="star" color="#E15F3D" size="18" type="{{storeInfo.score>2?'filled':'outline'}}"></mp-icon>
-                          <mp-icon icon="star" color="#E15F3D" size="18" type="{{storeInfo.score>3?'filled':'outline'}}"></mp-icon>
-                          <mp-icon icon="star" color="#E15F3D" size="18" type="{{storeInfo.score>4?'filled':'outline'}}"></mp-icon>
+                          <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>
                       </view>
                   </view>
                   <view class="shop-address shopview">
@@ -58,7 +58,7 @@
       </view>
     </view>
     <!-- 产品信息 -->
-    <view class="product" style="">
+    <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}}">

+ 1 - 4
pages/person/person.js

@@ -6,10 +6,7 @@ Page({
    * 页面的初始数据
    */
   data: {
-    person:{
-      tel:"18822225555",
-      userName:"伊布"
-    },
+   
     hasUserInfo: false
   },
 

+ 30 - 1
pages/person/person.scss

@@ -35,10 +35,37 @@
             image {
                 width: 200rpx;
                 height: 200rpx;
+                border-radius: 50%;
             }
         }
     }
 
+    .user-login {
+        display: flex;
+        height: 260rpx;
+        padding: 10rpx 30rpx;
+        border-bottom: 1px solid #ebeef5;
+        background-size: cover;
+        position: relative;
+        .login-btn {
+            background-color: rgba($color: #000000, $alpha: 0);
+            height: 200px;
+            position: absolute;
+            line-height: 100px;
+            top: 14%;
+            font-weight: 400;
+            letter-spacing: 5rpx;
+        }
+        .next{
+            width: 50rpx;
+            height: 50rpx;
+        }
+        .defult-user{
+            width: 150rpx;
+            height: 150rpx;
+        }
+    }
+
     .order {
         display: flex;
         width: 100%;
@@ -47,6 +74,7 @@
         border-bottom: 1px solid #ebeef5;
         justify-content: flex-start;
         position: relative;
+
         .icons {
             width: 40rpx;
             height: 40rpx;
@@ -75,6 +103,7 @@
         border-bottom: 1px solid #ebeef5;
         justify-content: flex-start;
         position: relative;
+
         .icons {
             width: 55rpx;
             height: 55rpx;
@@ -84,7 +113,7 @@
         .assess-text {
             line-height: 120rpx;
             letter-spacing: 3rpx;
-            
+
         }
 
         .next-gray {

+ 23 - 7
pages/person/person.wxml

@@ -3,7 +3,7 @@
     <navigator class="person card" url="../personinfo/personinfo" wx:if="{{hasUserInfo}}">
         <view class="person-info">
             <view class="user-name f18 c-202020">{{userInfo.name}}
-                <image class="" src="../../images/icons/next.png" >      
+                <image class="" src="../../images/icons/next.png">
                 </image>
             </view>
             <view class="tel c-707070 fw300">{{userInfo.mobile}}</view>
@@ -13,24 +13,40 @@
             </image>
         </view>
     </navigator>
-    <view wx:else>
-        <button open-type="getUserInfo" bindgetuserinfo="getInfo">授权登入</button>
+    <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>
+                <image class="next" src="../../images/icons/next.png">
+                </image>
+            </view>
+        </view>
+        <view class="head-img">
+            <image class="defult-user" src="../../images/icons/defult-user.png">
+
+            </image>
+            
+        </view>
+        
+
+
     </view>
     <view class="order">
         <image class="icons" src="../../images/icons/order.png">
         </image>
-        <view class="order-text">我的订单        
+        <view class="order-text">我的订单
         </view>
-        <image class="next-gray" src="../../images/icons/next-gray.png">             
+        <image class="next-gray" src="../../images/icons/next-gray.png">
         </image>
     </view>
     <navigator class="assess" hover-class="none" url="../comments/comments?title=我的评论">
         <image class="icons" src="../../images/icons/assess.png"></image>
         <view class="assess-text">我的点评
-            
+
         </view>
         <image class="next-gray" src="../../images/icons/next-gray.png">
-                
+
         </image>
     </navigator>
 </view>

+ 30 - 0
pages/person/person.wxss

@@ -36,6 +36,36 @@
 .container .person .head-img image {
   width: 200rpx;
   height: 200rpx;
+  border-radius: 50%;
+}
+
+.container .user-login {
+  display: flex;
+  height: 260rpx;
+  padding: 10rpx 30rpx;
+  border-bottom: 1px solid #ebeef5;
+  background-size: cover;
+  position: relative;
+}
+
+.container .user-login .login-btn {
+  background-color: transparent;
+  height: 200px;
+  position: absolute;
+  line-height: 100px;
+  top: 14%;
+  font-weight: 400;
+  letter-spacing: 5rpx;
+}
+
+.container .user-login .next {
+  width: 50rpx;
+  height: 50rpx;
+}
+
+.container .user-login .defult-user {
+  width: 150rpx;
+  height: 150rpx;
 }
 
 .container .order {

+ 93 - 0
pages/prompt/prompt.js

@@ -0,0 +1,93 @@
+// pages/prompt/prompt.js
+const app = getApp()
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    companyName:"测试公司"
+  },
+
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad: async function (options) {
+    let userInfo = await app.getWxUserInfo()
+    console.log(userInfo);
+    if (userInfo){
+      this.setData({
+        userInfo: userInfo,
+        hasUserInfo: true,
+        hasMobile: userInfo.mobile ? true : false
+      })
+    }
+  },
+
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面隐藏
+   */
+  onHide: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面卸载
+   */
+  onUnload: function () {
+
+  },
+
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh: function () {
+
+  },
+
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  onReachBottom: function () {
+
+  },
+
+  /**
+   * 用户点击右上角分享
+   */
+  onShareAppMessage: function () {
+
+  },
+  getInfo : async function(e){
+    const _self = this
+    let userInfo = e.detail.userInfo
+    console.log(userInfo)
+    userInfo['encryptedData'] = e.detail.encryptedData
+    userInfo['iv'] = e.detail.iv
+    let info = await app.wxLogin(userInfo);
+    let hasMobile = false;
+    if (info.mobile){
+      hasMobile = true
+    }
+    _self.setData({
+      hasUserInfo: true,
+      userInfo: info,
+      hasMobile: hasMobile,
+    })
+    console.log(2222)
+  }
+})

+ 3 - 0
pages/prompt/prompt.json

@@ -0,0 +1,3 @@
+{
+  "usingComponents": {}
+}

+ 59 - 0
pages/prompt/prompt.scss

@@ -0,0 +1,59 @@
+.container {
+
+    .logo {
+        height: 400rpx;
+        position: relative;
+        >.logo-img {
+            width: 200rpx;
+            height: 200rpx;
+            border-radius: 50%;
+            position: absolute;
+            bottom: 100rpx;
+            left: 50%;
+            transform: translateX(-50%);
+        }
+        >.info{
+            width: 100%;
+            height: 50rpx;
+            text-align: center;
+            letter-spacing: 3rpx;
+            position: absolute;
+            bottom: 10rpx;
+            font-size: 22px;
+        }
+    }
+
+    .desc{
+        width: 90%;
+        margin: 50rpx auto;
+        .text-h{
+            height: 100rpx;
+            padding: 0 20rpx 20rpx 20rpx;
+        }
+        .text-f{
+            padding: 0 50rpx;
+            color: #999;
+            font-size: 13px;
+            position: relative;
+            &::before{
+                content: "";
+                width: 6rpx;
+                height: 6rpx;
+                background-color: #999;
+                position: absolute;
+                top: 15rpx;
+                left: 25rpx;
+                border-radius: 50%;
+            }
+        }
+    }
+
+    .confirm{
+        width: 80%;
+        margin:100rpx auto ;
+        >button{
+            width: 100%;
+            font-weight: 400;
+        }
+    }
+}

+ 18 - 0
pages/prompt/prompt.wxml

@@ -0,0 +1,18 @@
+<!--pages/prompt/prompt.wxml-->
+<view class="container">
+    <view class="logo">
+        <image class="logo-img" src="../../images/pos.png"  >
+            
+        </image>
+        <view class="info ">欢迎来到{{companyName}}</view>
+    </view>
+    <view class="desc">
+        <view class="text-h f16">为提供更优质的服务,{{companyName}}需要获取以下信息:</view>
+        <view class="text-f ">
+            
+            你的公开信息(昵称,头像等)</view>
+    </view>
+    <view class="confirm">
+        <button open-type="getUserInfo" bindgetuserinfo="getInfo" type="primary">确认</button>
+    </view>
+</view>

+ 62 - 0
pages/prompt/prompt.wxss

@@ -0,0 +1,62 @@
+.container .logo {
+  height: 400rpx;
+  position: relative;
+}
+
+.container .logo > .logo-img {
+  width: 200rpx;
+  height: 200rpx;
+  border-radius: 50%;
+  position: absolute;
+  bottom: 100rpx;
+  left: 50%;
+  transform: translateX(-50%);
+}
+
+.container .logo > .info {
+  width: 100%;
+  height: 50rpx;
+  text-align: center;
+  letter-spacing: 3rpx;
+  position: absolute;
+  bottom: 10rpx;
+  font-size: 22px;
+}
+
+.container .desc {
+  width: 90%;
+  margin: 50rpx auto;
+}
+
+.container .desc .text-h {
+  height: 100rpx;
+  padding: 0 20rpx 20rpx 20rpx;
+}
+
+.container .desc .text-f {
+  padding: 0 50rpx;
+  color: #999;
+  font-size: 13px;
+  position: relative;
+}
+
+.container .desc .text-f::before {
+  content: "";
+  width: 6rpx;
+  height: 6rpx;
+  background-color: #999;
+  position: absolute;
+  top: 15rpx;
+  left: 25rpx;
+  border-radius: 50%;
+}
+
+.container .confirm {
+  width: 80%;
+  margin: 100rpx auto;
+}
+
+.container .confirm > button {
+  width: 100%;
+  font-weight: 400;
+}

+ 9 - 136
pages/shop/shop.js

@@ -1,150 +1,23 @@
-// pages/shop/shop.js
+// pages/shoplist/shoplist.js
+import { default as storeApi} from "../../api/store"
 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"
-      }, {
-        id:2,
-        imgurl:"../../images/shop.jpg",
-        shopname:"大华店",
-        stars:5,
-        mark:true,
-        new:false,
-        discount:true,
-        marktext:"优惠打折",
-        shop_address:"上海市宝山区大华虎城A座10L",
-        shop_distance:"6.5KM"
-      }, {
-        id:3,
-        imgurl:"../../images/shop.jpg",
-        shopname:"大华店",
-        stars:4,
-        mark:false,
-        new:false,
-        discount:false,
-        marktext:"新店促销",
-        shop_address:"上海市宝山区大华虎城A座10L",
-        shop_distance:"6.5KM"
-      },
-      {
-        id:4,
-        imgurl:"../../images/shop.jpg",
-        shopname:"大华店",
-        stars:4,
-        mark:false,
-        new:false,
-        discount:false,
-        marktext:"新店促销",
-        shop_address:"上海市宝山区大华虎城A座10L",
-        shop_distance:"6.5KM"
-      },
-      {
-        id:5,
-        imgurl:"../../images/shop.jpg",
-        shopname:"大华店",
-        stars:4,
-        mark:false,
-        new:false,
-        discount:false,
-        marktext:"新店促销",
-        shop_address:"上海市宝山区大华虎城A座10L",
-        shop_distance:"6.5KM"
-      },
-      {
-        id:6,
-        imgurl:"../../images/shop.jpg",
-        shopname:"大华店",
-        stars:4,
-        mark:false,
-        new:false,
-        discount:false,
-        marktext:"新店促销",
-        shop_address:"上海市宝山区大华虎城A座10L",
-        shop_distance:"6.5KM"
-      },
-      {
-        id:7,
-        imgurl:"../../images/shop.jpg",
-        shopname:"大华店",
-        stars:4,
-        mark:false,
-        new:false,
-        discount:false,
-        marktext:"新店促销",
-        shop_address:"上海市宝山区大华虎城A座10L",
-        shop_distance:"6.5KM"
-      },
-      {
-        id:8,
-        imgurl:"../../images/shop.jpg",
-        shopname:"大华店",
-        stars:4,
-        mark:false,
-        new:false,
-        discount:false,
-        marktext:"新店促销",
-        shop_address:"上海市宝山区大华虎城A座10L",
-        shop_distance:"6.5KM"
-      },
-      {
-        id:9,
-        imgurl:"../../images/shop.jpg",
-        shopname:"大华店",
-        stars:4,
-        mark:false,
-        new:false,
-        discount:false,
-        marktext:"新店促销",
-        shop_address:"上海市宝山区大华虎城A座10L",
-        shop_distance:"6.5KM"
-      },
-      {
-        id:10,
-        imgurl:"../../images/shop.jpg",
-        shopname:"大华店",
-        stars:4,
-        mark:false,
-        new:false,
-        discount:false,
-        marktext:"新店促销",
-        shop_address:"上海市宝山区大华虎城A座10L",
-        shop_distance:"6.5KM"
-      },
-      {
-        id:11,
-        imgurl:"../../images/shop.jpg",
-        shopname:"大华店",
-        stars:4,
-        mark:false,
-        new:false,
-        discount:false,
-        marktext:"新店促销",
-        shop_address:"上海市宝山区大华虎城A座10L",
-        shop_distance:"6.5KM"
-      }
-
-    ]
+shopList:[]
   },
 
   /**
    * 生命周期函数--监听页面加载
    */
-  onLoad: function (options) {
-
+  onLoad:async function (options) {
+   var rs = await storeApi.getStoreList(1,5);
+   console.log(rs)
+   this.setData({
+    shopList:rs.list
+   })
   },
 
   /**

+ 70 - 0
pages/shoplist/shoplist.js

@@ -0,0 +1,70 @@
+// pages/shoplist/shoplist.js
+import { default as storeApi} from "../../api/store"
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+shopList:[]
+  },
+
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad: function (options) {
+   var shopList =  storeApi.getStoreList(1,5);
+   this.setData({
+    shopList
+   })
+  },
+
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面隐藏
+   */
+  onHide: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面卸载
+   */
+  onUnload: function () {
+
+  },
+
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh: function () {
+
+  },
+
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  onReachBottom: function () {
+
+  },
+
+  /**
+   * 用户点击右上角分享
+   */
+  onShareAppMessage: function () {
+
+  }
+})

+ 10 - 0
pages/shoplist/shoplist.json

@@ -0,0 +1,10 @@
+{
+  "usingComponents": {
+    "shop":"/componets/shop/index"
+  },
+  "navigationBarBackgroundColor": "#343434",
+  "navigationBarTextStyle": "white",
+  "navigationBarTitleText": "门店",
+  "backgroundColor": "#fff",
+  "backgroundTextStyle": "light"
+}

+ 2 - 0
pages/shoplist/shoplist.wxml

@@ -0,0 +1,2 @@
+<!--pages/shoplist/shoplist.wxml-->
+<shop shopList="{{shopList}}"></shop>

+ 1 - 0
pages/shoplist/shoplist.wxss

@@ -0,0 +1 @@
+/* pages/shoplist/shoplist.wxss */

+ 21 - 8
project.config.json

@@ -55,23 +55,36 @@
   "simulatorType": "wechat",
   "simulatorPluginLibVersion": {},
   "condition": {
-    "search": {
-      "list": []
-    },
-    "conversation": {
+    "plugin": {
       "list": []
     },
     "game": {
       "list": []
     },
-    "plugin": {
-      "list": []
-    },
     "gamePlugin": {
       "list": []
     },
     "miniprogram": {
-      "list": []
+      "list": [
+        {
+          "name": "pages/shoplist/shoplist",
+          "pathName": "pages/shoplist/shoplist",
+          "query": "",
+          "scene": null
+        },
+        {
+          "name": "pages/person/person",
+          "pathName": "pages/person/person",
+          "query": "",
+          "scene": null
+        },
+        {
+          "name": "pages/prompt/prompt",
+          "pathName": "pages/prompt/prompt",
+          "query": "",
+          "scene": null
+        }
+      ]
     }
   }
 }