luck 2 years ago
parent
commit
af746da40d

+ 9 - 2
app.js

@@ -7,7 +7,13 @@ if(envVersion=='release'){projectMode=2}
 import api from './utils/api'
 App({
   onLaunch() {
-    // 展示本地存储能力
+    //云开发
+    wx.cloud.init({
+      traceUser: true,
+    })
+    
+
+
     const logs = wx.getStorageSync('logs') || []
     logs.unshift(Date.now())
     wx.setStorageSync('logs', logs)
@@ -35,6 +41,7 @@ App({
   globalData: {
     userInfo: null,
     btnInfo:null,
+    status:['可下单','服务中','已满柜','暂停服务'],
     baseAppUrl: projectMode==2 ? 'https://wash.nanodreamtech.com/':(projectMode==1 ?'https://wash.nanodreamtech.com/':'http://127.0.0.1:8000/'),
     location:""
   },
@@ -112,10 +119,10 @@ App({
     })
 
 
-
    
    })
   }
+ 
 
 })
 

+ 10 - 1
app.wxss

@@ -4,7 +4,16 @@ view {
   box-sizing: border-box;
   transition: all 0.4s cubic-bezier(0.55, 0.085, 0.68, 0.53);
 }
-
+button {
+  font-size: 24rpx;
+  border: solid 0;
+  background-color: transparent;
+  padding: 0;
+}
+button::after{
+  border: none;
+  outline: none;
+}
 .flex {
   display: flex;
   align-items: center;

+ 4 - 1
pages/home/map/list.js

@@ -7,7 +7,7 @@ Page({
    */
   data: {
     workelist:[],
-    status:['可下单','服务中','已满柜','暂停服务'],
+    status:"",
     inputValue:""
   },
 
@@ -16,6 +16,9 @@ Page({
    */
   onLoad: function (options) {
       this.workDesc();
+      that.setData({
+        status:app.globalData.status
+      })
   },
 
   /**

+ 4 - 3
pages/home/map/list.wxml

@@ -5,7 +5,8 @@
       <view class="section3">
         <view class="outer2">
           <view class="bd1">
-            <icon class="iconfont iconsousuo" style="font-size: 36rpx; margin-bottom: 10rpx;margin-right: 4rpx;"></icon>
+            <van-icon name="search" />
+            <!-- <icon class="iconfont iconsousuo" style="font-size: 36rpx; margin-bottom: 10rpx;margin-right: 4rpx;"></icon> -->
             <input lines="1" class="word4" placeholder="搜索" value="" bindconfirm="workDesc" type="text" confirm-type="search" bindinput="bindKeyInput"></input>
           </view>
         </view>
@@ -29,7 +30,7 @@
           </view>
           <view class="main2">
             <icon class="label2 iconfont icondingwei1"></icon>
-            <text lines="1" class="info2">{{item.province_id}}{{item.city_id}}{{item.area_id}}{{item.address}}雄楚大道120号创业街9栋3楼2单元319</text>
+            <text lines="1" class="info2">{{item.address}}</text>
           </view>
           <view class="main3">
             <icon class="label2 iconfont iconshouye2"></icon>
@@ -42,7 +43,7 @@
             <image src="/image/icon/navigation.png" class="icon4"></image>
             <text lines="1" class="word8">导航</text>
           </view>
-          <text lines="1" class="info3">距离{{item.distance}}m</text>
+          <text lines="1" class="info3">距离{{item.distance}}km</text>
         </view>
       </view>
     </view>

+ 96 - 8
pages/home/map/map.js

@@ -10,7 +10,10 @@ Page({
         mapworkelist:[],
         inputValue:"",
         workelist:[],
-        hasMarkers:true
+        hasMarkers:true,
+        workedesc:"",
+        status:"",
+        show:false
     },
 
     /**
@@ -25,6 +28,10 @@ Page({
           }
           })
           that.workDesc();
+          that.setData({
+            status:app.globalData.status
+          })
+    
     },
 
     onHide(){
@@ -64,25 +71,68 @@ Page({
               })
         } else {
          var data=res.message.data.data
+        
          that.setData({
             workelist:res.message.data.data
          })
          var maplist=[];
+         var workelist=[];
          for (var i = 0; i < data.length; ++i) {
           maplist[i]={
-           
             'id':data[i]['id'],
             'latitude':data[i]['lat'],
             'longitude':data[i]['lng'],
             'iconPath': '/image/address/location.png',
-            'width':100,
-            'height':100
+            'width':60,
+            'height':60,
+          }
+          workelist[data[i]['id']]={
+            'id':data[i]['id'],
+            'latitude':data[i]['lat'],
+            'longitude':data[i]['lng'],
+            'title':data[i]['title'],
+            'address':data[i]['address'],
+            'name':data[i]['name'],
+            'signing_status':data[i]['signing_status'],
+            'distance':data[i]['distance']
           }
            
+          if((keyword!='' || keyword!=null)&& i==0){
+            
+            that.setData({
+              workedesc: workelist[data[i]['id']],
+              show:true
+            })
+           }
+
         }
+       
+
+        console.log(data);
+        if(data=="" || data ==null || data==[]){
+          console.log(33333);
+         var workedesc={
+            'id':0,
+            'latitude':0,
+            'longitude':0,
+            'title':'暂无数据',
+            'address':'暂无数据',
+            'name':'暂无数据',
+            'signing_status':0,
+            'distance':0
+          }
+          that.setData({
+            workedesc: workedesc,
+            show:true
+          })
+
+         }
+        
+
         that.setData({
           mapworkelist:maplist,
-          hasMarkers:true
+          hasMarkers:true,
+          workelist:workelist
         })
 
 
@@ -92,13 +142,51 @@ Page({
         wx.hideLoading();
 
       }).catch(function (err) {
-        console.log(222);
-      })
-
+        var workedesc={
+           'id':0,
+           'latitude':0,
+           'longitude':0,
+           'title':'暂无数据!',
+           'address':'暂无数据!',
+           'name':'暂无数据!',
+           'signing_status':12,
+           'distance':0
+         }
+         that.setData({
+           workedesc: workedesc,
+           show:true
+         })})
 },
 bindKeyInput: function (e) {
   this.setData({
     inputValue: e.detail.value
   })
 },
+markertap(e) {
+  console.log('@@@ markertap', e)
+var workelist=this.data.workelist;
+var markerId=e.detail.markerId;
+var workedesc=workelist[markerId];
+this.setData({
+  workedesc: workedesc,
+  show:true
+})
+
+},
+//设置网点
+setworke(e){
+  app.api.useApi(app.globalData.baseAppUrl+"api/user",{
+    network_id:e.target.dataset.id,
+
+  },"get").then(function(res){
+    if (res.code == 200) {
+      wx.showLoading({
+        title: '网点设置成功',
+      })
+    }
+  }).catch(function(err){
+    console.log(222);
+  })
+}
+
 })

+ 6 - 8
pages/home/map/map.wxml

@@ -14,14 +14,12 @@
 </view>
 
 <view class="contioner" hover-class="none" hover-stop-propagation="false" style="width: 100%; height: 100%;">
-    <map name="" longitude="{{location.longitude}}" latitude="{{location.latitude}}" markers="{{mapworkelist}}" show-location style="width: 100%; height: 100%;" wx:if="{{hasMarkers}}"></map>
+    <map name="" longitude="{{location.longitude}}" latitude="{{location.latitude}}" bindmarkertap="markertap" markers="{{mapworkelist}}" show-location style="width: 100%; height: 100%;" wx:if="{{hasMarkers}}" scale="10"></map>
 </view>
-]
-
-<view class="footerBox flex ju-b">
+<view class="footerBox flex ju-b" wx:if="{{show}}" bindtap="setworke" data-id="{{workedesc.id}}">
         <view class="le">
             <view class="tit">
-                中央美术学院9号楼洗衣房1号柜
+                {{workedesc.title}}
             </view>
 
             <view class="tipsBox flex m-top-20">
@@ -30,13 +28,13 @@
                 </view>
 
                 <view class="tips blue">
-                    可存衣
+                    {{status[workedesc.signing_status]}}
                 </view>
             </view>
 
             <view class="box flex m-top-15">
                 <van-icon name="location-o" class="m-right-10"/>
-                <text>洪山区茅店山西路4号创星汇科技园南门</text>
+                <text> {{workedesc.address}}</text>
             </view>
 
             <view class="box flex m-top-15">
@@ -52,7 +50,7 @@
             </view>
 
             <view class="footer m-top-15">
-                距离40m
+                距离 {{workedesc.distance}}km
             </view>
         </view>
 </view>

+ 5 - 41
pages/my/cashier/cashier.js

@@ -21,46 +21,10 @@ Page({
     onReady: function () {
 
     },
-
-    /**
-     * 生命周期函数--监听页面显示
-     */
-    onShow: function () {
-
-    },
-
-    /**
-     * 生命周期函数--监听页面隐藏
-     */
-    onHide: function () {
-
-    },
-
-    /**
-     * 生命周期函数--监听页面卸载
-     */
-    onUnload: function () {
-
-    },
-
-    /**
-     * 页面相关事件处理函数--监听用户下拉动作
-     */
-    onPullDownRefresh: function () {
-
-    },
-
-    /**
-     * 页面上拉触底事件的处理函数
-     */
-    onReachBottom: function () {
-
-    },
-
-    /**
-     * 用户点击右上角分享
-     */
-    onShareAppMessage: function () {
-
+    pay(){
+        wx.switchTab({
+          url: '/pages/tabber/order/index',
+        })
     }
+ 
 })

+ 1 - 1
pages/my/cashier/cashier.wxml

@@ -35,5 +35,5 @@
 </view>
 
 <view class="footerNav ju-c flex">
-    <view class="btn btn-sky">支付1.00元</view>
+    <view class="btn btn-sky" bindtap="pay">支付1.00元</view>
 </view>

+ 30 - 0
pages/order/confirmOreder/confirmOreder.js

@@ -1,4 +1,5 @@
 // pages/order/confirmOreder/confirmOreder.js
+const app=getApp();
 Page({
 
     /**
@@ -26,6 +27,7 @@ Page({
         checked:false,
         show1:false,
         show2:false,
+        code:""
 
     },
     onLoad() {
@@ -74,5 +76,33 @@ Page({
             mode
         })
     },
+    goto(){
+        wx.navigateTo({
+            url:'/pages/my/cashier/cashier'
+        })
+    },
+    getPhoneNumber (e){
+        app.login()
+        console.log(e)
+        this.setData({
+            code: e.detail.code,
+          })
+
+             wx.cloud.callFunction({
+              name: 'getPhoneNumber',
+              data:{
+                  message:e.detail
+              },
+              success:res=>{console.log(res)},
+              fail:err=>{
+                  console.log(err)
+              }
+            })
+      
+            // console.log("fetch cloudfunction success", cloudResult.result)
+          
+
+
 
+      }
 })

+ 4 - 3
pages/order/confirmOreder/confirmOreder.wxml

@@ -99,8 +99,8 @@
 
         <view class="tips">价格以实际收到为准</view>
     </view>
-
-    <view class="btn btn-sky">确认支付</view>
+    
+    <view class="btn btn-sky" bindtap="goto">确认支付</view>
 </view>
 
 
@@ -116,7 +116,8 @@
             </view>
 
             <view class="inputBox flex b-bottom">
-                <text>手机</text><input type="text" placeholder="请填写您的手机号" />
+                <text>手机</text><input type="text" placeholder="请填写您的手机号" value="{{code}}" />
+                <button open-type="getPhoneNumber"  bindgetphonenumber="getPhoneNumber" style="color: green;">获取微信手机号</button>
             </view>
 
             <view class="inputBox flex b-bottom">

+ 1 - 1
pages/order/confirmOreder/confirmOreder.wxss

@@ -286,7 +286,7 @@ page {
 
 .pupBox .content .inputBox input {
     font-size: 28rpx;
-    width: 80%;
+    width: 52%;
 }
 
 .pupBox .btn {

+ 1 - 1
pages/order/placeOrder/placeOrder.js

@@ -166,7 +166,7 @@ Page({
     },
     getOrder() {
         wx.navigateTo({
-            url: '/pages/order/serviceDetails/serviceDetails',
+            url: '/pages/order/confirmOreder/confirmOreder',
         })
     },
     carPlus(e) {

+ 1 - 4
pages/tabber/home/index.js

@@ -20,11 +20,8 @@ Page({
             {
                 url: '/image/home/xidifanwei.png',
                 text: '洗涤范围'
-            },
-            {
-                url: '/image/home/fenxianghaoyou.png',
-                text: '分享好友'
             }
+            
         ],
         current: 3,
         btnInfo: app.globalData.btnInfo,

+ 6 - 0
pages/tabber/home/index.wxml

@@ -29,6 +29,12 @@
         <image src="{{item.url}}" class="icon"></image>
         <view class="text">{{item.text}}</view>
     </view>
+    <view class="mainItem">
+    <button open-type="share">
+        <image src="/image/home/fenxianghaoyou.png" class="icon"></image>
+        <view class="text">分享好友</view>
+        </button>
+    </view>
 </view>
 
 <!-- or gray -->

+ 24 - 2
pages/tabber/my/index.js

@@ -35,7 +35,10 @@ Page({
                 text: '客服热线'
             }
         ],
-        active: false
+        active: false,
+        userInfo:"",
+        hasUserInfo:false,
+        code:""
     },
 
     /**
@@ -63,6 +66,25 @@ Page({
         wx.navigateTo({
           url,
         })
-    }
+    },
+    getUserProfile(e) {
+        // 推荐使用wx.getUserProfile获取用户信息,开发者每次通过该接口获取用户个人信息均需用户确认
+        // 开发者妥善保管用户快速填写的头像昵称,避免重复弹窗
+        wx.getUserProfile({
+          desc: '用于完善会员资料', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
+          success: (res) => {
+            this.setData({
+              userInfo: res.userInfo,
+              hasUserInfo: true
+            })
+          }
+        })
+      },
+      getPhoneNumber (e){
+        console.log(e)
+        this.setData({
+            code: e.detail.code,
+          })
+      }
 
 })

+ 14 - 5
pages/tabber/my/index.wxml

@@ -2,8 +2,17 @@
     <view class="title" style="top:{{btnInfo.top + 5}}px">我的</view>
     <view class="topBoxs flex">
         <view class="le flex">
-            <image src="/image/order/houwaitao.png" class="userPicture"></image>
-            <text class="phone"> {{handle.toHide('12345678901')}}</text>
+            <image src="{{userInfo.avatarUrl?userInfo.avatarUrl:'/image/order/houwaitao.png'}}" class="userPicture"></image>
+            <view class="dd">
+                <view  wx:if="{{hasUserInfo}}">
+                <text class="phone">{{userInfo.nickName}}</text>
+                 </view>
+            <view wx:else>
+                <text class="phone" bindtap="getUserProfile">请点击登录</text>
+            </view>
+                <button class="phone"  open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumber">{{code?handle.toHide(code):'点击获取手机号'}}</button>
+                <!-- <text class="phone" style="    margin-top: 15rpx;"> </text> -->
+           </view>
             <wxs src="/utils/handle.wxs" module="handle"></wxs>
         </view>
 
@@ -13,7 +22,7 @@
     <!-- 无活动 -->
     <view class="menuBoxs " wx:if="{{!active}}">
         <van-grid border="{{false}}">
-            <van-grid-item use-slot wx:for="{{menuList}}" wx:key="*this" bindtap="toUrl"  data-url="{{item.url}}">
+            <van-grid-item use-slot wx:for="{{menuList}}" wx:key="*this" bindtap="toUrl" data-url="{{item.url}}">
                 <view class="menuItem">
                     <image src="{{item.icon}}" class="icon"></image>
                     <view class="tit">{{item.text}}</view>
@@ -27,7 +36,7 @@
     <!-- 有活动 -->
     <view class="active" wx:else>
         <view class="message flex ju-a">
-            <view class="le" bindtap="toUrl"  data-url="/pages/my/account/account">
+            <view class="le" bindtap="toUrl" data-url="/pages/my/account/account">
                 <view class="num">0.00</view>
                 <view class="tips">余额(元)</view>
             </view>
@@ -42,7 +51,7 @@
             <view class="titText">我的服务</view>
             <view class="menuBoxs2">
                 <van-grid border="{{false}}">
-                    <van-grid-item use-slot wx:for="{{menuList}}" wx:key="*this" bindtap="toUrl"  data-url="{{item.url}}">
+                    <van-grid-item use-slot wx:for="{{menuList}}" wx:key="*this" bindtap="toUrl" data-url="{{item.url}}">
                         <view class="menuItem">
                             <image src="{{item.icon}}" class="icon"></image>
                             <view class="tit">{{item.text}}</view>

+ 11 - 0
pages/tabber/my/index.wxss

@@ -3,6 +3,7 @@
     width: 750rpx;
     height: 100vh;
 }
+button {}
 
 .page1 {
     background: linear-gradient(180deg, #F4F3F8 0%, #F6F6F6 100%);
@@ -31,9 +32,19 @@
     height: 120rpx;
     border-radius: 50%;
 }
+.dd{display: flex;
+    flex-direction: column;}
 
 .topBoxs .phone {
     margin-left: 30rpx;
+    font-size: 24rpx;
+    border: solid 0;
+    background-color: transparent;
+    padding: 0;
+}
+.phone::after{
+    border: none;
+    outline: none;
 }
 
 .topBoxs .bg {

+ 3 - 1
project.config.json

@@ -8,6 +8,7 @@
       }
     ]
   },
+  
   "setting": {
     "urlCheck": false,
     "es6": true,
@@ -51,11 +52,12 @@
     "showES6CompileOption": false,
     "useCompilerPlugins": false
   },
+  "cloudfunctionRoot": "./cloudfunction",
   "compileType": "miniprogram",
   "libVersion": "2.22.0",
   "appid": "wxb824dbe860d7480d",
   "projectname": "%E6%B5%B7%E6%98%9F%E7%94%A8%E6%88%B7%E7%AB%AF",
-  "cloudfunctionTemplateRoot": "",
+  "cloudfunctionTemplateRoot": "cloudfunctionTemplate",
   "watchOptions": {
     "ignore": []
   },

+ 24 - 0
project.private.config.json

@@ -47,6 +47,30 @@
           "pathName": "pages/home/map/list",
           "query": "",
           "scene": null
+        },
+        {
+          "name": "",
+          "pathName": "pages/order/confirmOreder/confirmOreder",
+          "query": "",
+          "scene": null
+        },
+        {
+          "name": "",
+          "pathName": "pages/order/detail/detail",
+          "query": "",
+          "scene": null
+        },
+        {
+          "name": "",
+          "pathName": "pages/my/account/account",
+          "query": "",
+          "scene": null
+        },
+        {
+          "name": "",
+          "pathName": "pages/my/cashier/cashier",
+          "query": "",
+          "scene": null
         }
       ]
     }

+ 5 - 5
utils/api.js

@@ -1,7 +1,7 @@
 // api接口请求封装
 
 var useApi = (url, data = {}, method = "get") => {
-  
+
     console.log(url);
     return new Promise((resolve, reject) => {
         wx.request({
@@ -26,9 +26,9 @@ var useApi = (url, data = {}, method = "get") => {
                 reject(err)
             },
             complete() {
-                     wx.hideLoading(333)
+                wx.hideLoading(333)
                 wx.hideLoading({ //因为showToast、hideLoading不能同时使用
-                    fail() {}
+                    fail() { }
                 })
             }
         })
@@ -38,10 +38,10 @@ var useApi = (url, data = {}, method = "get") => {
 
 module.exports = {
     useApi,
-    getBanner(data){
+    getBanner(data) {
         console.log(1);
         return useApi('', data)
- 
+
     }
 
 }