| | |
| | | // const apiHost = 'http://39.108.148.228:80/user'; |
| | | // const apiHost = 'https://okyueche.com:443/user' |
| | | // const apiHost = 'http://120.220.4.138:9591/user' |
| | | const apiHost = 'https://xn95128.cn/user' |
| | | // const apiHost = 'https://xn95128.cn/user' |
| | | // const apiHost = 'http://192.168.110.34:7777/user' |
| | | const apiHost = 'http://221.182.45.100:7777/user' |
| | | |
| | | |
| | | |
| | | // const apiHost = 'https://zhentonggongsi.com/user' |
| | | |
| | |
| | | initSocket() { |
| | | let that = this; |
| | | that.globalData.localSocket = wx.connectSocket({ |
| | | // url: "ws://192.168.0.80:9090/websocket", |
| | | // url: "ws://192.168.110.34:7777/websocket", |
| | | url: "ws://221.182.45.100:9978", |
| | | |
| | | // url: "ws://221.182.45.100:900", |
| | | url: "wss://xn95128.cn/websocket", |
| | | // url: "wss://xn95128.cn/websocket", |
| | | |
| | | }); |
| | | console.log('shuju//////////////////',this.globalData.localSocket); |
| | | that.globalData.localSocket.onOpen(function(res) { |
| | | console.log(that.globalData.localSocket) |
| | | console.log('----//////-------------',that.globalData.localSocket) |
| | | console.log("WebSocket连接已打开!readyState=" + that.globalData.localSocket.readyState); |
| | | that.globalData.sockTaskStatus = true; |
| | | let msg = { |
| | |
| | | cityName:wx.getStorageSync('cityName')||'', |
| | | userLatitude:wx.getStorageSync('latitude')||'', |
| | | userLongitude:wx.getStorageSync('longitude')||'', |
| | | // Url:'http://192.168.0.80:80/user', |
| | | // Url:'http://192.168.110.34:7777/user', |
| | | Url:'http://221.182.45.100:7777/user', |
| | | // Url:'http://39.108.148.228:80/user', |
| | | // Url:'https://okyueche.com:443/user', |
| | | // Url:'http://120.220.4.138:9591/user', |
| | | Url:'https://xn95128.cn/user', |
| | | // Url:'https://xn95128.cn/user', |
| | | |
| | | localSocket: {}, |
| | | callback: function() {}, |
| | |
| | | pjxq:false, |
| | | ipayShowPop:false, |
| | | showIpay:false, |
| | | orderType:2 |
| | | orderType:2, |
| | | OrderInfo:{}, |
| | | }, |
| | | ipay(){ |
| | | this.setData({ |
| | |
| | | if(res.data.code==200){ |
| | | let money = "payStyle[" + 0 + "].money"; |
| | | let newmoney ="("+res.data.data.balance +'可用'+")" |
| | | // let newmoney = res.data.data.balance |
| | | this.setData({ |
| | | queryBalance:res.data.data, |
| | | [money]:newmoney |
| | |
| | | }) |
| | | }, |
| | | goPay1(){ |
| | | let that = this |
| | | if(this.data.cancelOriginal=='无'){ |
| | | app.showToastSuccess('请选择支付方式',null,"none",1500) |
| | | }else{ |
| | |
| | | }, |
| | | method:"POST", |
| | | success:(res)=>{ |
| | | console.log(res) |
| | | if(res.data.code==200){ |
| | | var jsonData =JSON.parse(res.data.data) |
| | | console.log(jsonData) |
| | | var jsonData =res.data.data |
| | | console.log('wedakwpoakewpaokeqwokeo',jsonData) |
| | | wx.requestPayment({ |
| | | "timeStamp": jsonData.timestamp, |
| | | "nonceStr": jsonData.noncestr, |
| | | "timeStamp": jsonData.timeStamp, |
| | | "nonceStr": jsonData.nonceStr, |
| | | "package": jsonData.package, |
| | | "signType": jsonData.signType, |
| | | "paySign":jsonData.sign, |
| | | "success":function(res){ |
| | | "success":(res)=>{ |
| | | let that = this |
| | | that.setData({ |
| | | showPayVan:false, |
| | |
| | | method:"POST", |
| | | success:(res)=>{ |
| | | console.log(res) |
| | | this.setData({ |
| | | OrderInfo:res.data.data |
| | | }) |
| | | if(res.data.code==200){ |
| | | if(res.data.data.device==2){ |
| | | this.setData({ |
| | |
| | | <!--start--> |
| | | <view class="start" hidden="{{!payEnd}}"> |
| | | <view class="car_monery" wx:if="{{money>0}}">¥{{money||0}}</view> |
| | | <view class="please_pay" style="text-decoration:underline;padding-bottom:15rpx" catchtap="lookMoneyInfo">查看费用明细</view> |
| | | <view class="please_pay" wx:if="{{OrderInfo.payManner==1}}" style="text-decoration:underline;padding-bottom:15rpx" catchtap="lookMoneyInfo">查看费用明细</view> |
| | | <view class="noname" wx:if="{{nmpj}}">匿名评价司机</view> |
| | | <view class="noname" wx:if="{{pjxq}}">评价详情</view> |
| | | <!--遮罩层--> |
| | |
| | | <image src="../../img/icon_close.png" catchtap="onClose"></image> |
| | | </view> |
| | | <view class="van_money car_monery">¥{{money||0}}</view> |
| | | <view class="van_card" catchtap="getCou"> |
| | | <!-- <view class="van_card" catchtap="getCou"> |
| | | <view class="van_card_title">优惠券</view> |
| | | <image src="../../img/icon_nav_open.png"></image> |
| | | <view class="van_card_num" hidden="{{!showNumCoun}}">{{queryBalance.coupon==0?'0张可用券':'您有'+queryBalance.coupon+'张优惠券'}}</view> |
| | | <view class="van_card_num" hidden="{{showNumCoun}}">{{moneyDown==""?'您有'+queryBalance.coupon+'张优惠券':'-'+moneyDown+'元'}}</view> |
| | | </view> |
| | | </view> --> |
| | | <view class="select-item"> |
| | | <van-radio-group value="{{cancelOriginal}}" bind:change="onChange"> |
| | | <van-cell-group> |
| | |
| | | .button_pay { |
| | | width: 694rpx !important; |
| | | height: 80rpx; |
| | | background: rgba(74, 76, 89, 1); |
| | | background: rgba(77, 139, 255, 1); |
| | | border-radius: 8rpx; |
| | | position: absolute; |
| | | bottom: 28rpx; |
| | |
| | | .pay_button_btn{ |
| | | width: 629rpx !important; |
| | | height: 80rpx; |
| | | background: rgba(74, 76, 89, 1); |
| | | background: rgba(77, 139, 255, 1); |
| | | border-radius: 8rpx; |
| | | margin:44rpx auto; |
| | | font-size: 28rpx; |
| | |
| | | const app = getApp(); |
| | | const unit = require("../../utils/util") |
| | | const pinyins = require("../../utils/pinyin"); |
| | | const BaiduMap = require('../../utils/bmap-wx.min') |
| | | // const pinYin = require("../../utils/Convert_Pinyin") |
| | | Page({ |
| | | /** |
| | |
| | | } |
| | | console.log(arr) |
| | | this.selectPinYin(arr); |
| | | // console.log(arr); |
| | | }, |
| | | |
| | | //选择城市 |
| | | selectCity(e) { |
| | | console.log(e) |
| | | var pages = getCurrentPages(); |
| | | var prevPage = pages[pages.length - 2]; //上一个页面 |
| | | let self = e.currentTarget.dataset.self; |
| | | // console.log(e); |
| | | console.log(self) |
| | | console.log('asfkpsaofdjkpqowpor', self) |
| | | //设置地图markers |
| | | if (this.data.where !== 'clickCity') { |
| | | app.getQQMap().geocoder({ |
| | | //获取表单传入地址 |
| | | address: self, //地址参数,例:固定地址,address: '北京市海淀区彩和坊路海淀西大街74号' |
| | | success: function (res) { |
| | | console.log(res); |
| | | //成功后的回调 |
| | | if (res.message == "Success") { |
| | | var res = res.result; |
| | | var latitude = res.location.lat; |
| | | var longitude = res.location.lng; //根据地址解析在地图上标记解析地址位置 |
| | | // app.store.index.latitude = latitude; |
| | | // app.store.index.longitude = longitude; |
| | | wx.setStorageSync('latitude', latitude) |
| | | wx.setStorageSync('longitude', longitude) |
| | | wx.setStorageSync('cityName', res.address_components.city) |
| | | prevPage.setData({ |
| | | cityName: res.address_components.city, |
| | | latitude: latitude, |
| | | longitude: longitude, |
| | | showFrist: false, |
| | | newCityName: self, |
| | | formLocation: false |
| | | }) |
| | | console.log(latitude, longitude) |
| | | //调用home 方法 |
| | | prevPage.getLocal(latitude, longitude) |
| | | prevPage.getadver(res.ad_info.adcode) |
| | | prevPage.getadver2(res.ad_info.adcode) |
| | | prevPage.openCity(res.ad_info.adcode) |
| | | prevPage.setData({ |
| | | isLocation:true |
| | | }) |
| | | wx.navigateBack({ |
| | | delta: 1 |
| | | }); |
| | | } else { |
| | | wx.showToast({ |
| | | title: '服务器错误', |
| | | icon: "none", |
| | | duration: 1500 |
| | | }) |
| | | } |
| | | |
| | | //接入百度地图方法 |
| | | var bmap = new BaiduMap.BMapWX({ |
| | | ak: 'fi3HGJjW153NCNsaTb9FekxeX1Lj3auo' // 必填,您的key |
| | | }) |
| | | |
| | | console.log('shuju', bmap); |
| | | |
| | | bmap.geocoding({ |
| | | address: self, |
| | | coordtype:'bd09ll', |
| | | success: (res) => { |
| | | bmap.regeocoding({ |
| | | coordtype:'bd09ll', |
| | | location: `${res.result.location.lat},${res.result.location.lng}`, //获取到的位置信息 |
| | | success: (resp) => { |
| | | var data = resp.originalData.result |
| | | console.log('wdawda',resp); |
| | | |
| | | var latitude = data.location.lat; |
| | | var longitude = data.location.lng; //根据地址解析在地图上标记解析地址位置 |
| | | wx.setStorageSync('latitude', latitude) |
| | | wx.setStorageSync('longitude', longitude) |
| | | wx.setStorageSync('cityName', data.addressComponent.city) |
| | | prevPage.setData({ |
| | | cityName: data.addressComponent.city, |
| | | latitude: latitude, |
| | | longitude: longitude, |
| | | showFrist: false, |
| | | newCityName: self, |
| | | formLocation: false |
| | | }) |
| | | console.log(latitude, longitude) |
| | | //调用home 方法 |
| | | prevPage.getLocal(latitude, longitude) |
| | | prevPage.getadver(data.addressComponent.adcode) |
| | | prevPage.getadver2(data.addressComponent.adcode) |
| | | prevPage.openCity(data.addressComponent.adcode) |
| | | prevPage.setData({ |
| | | isLocation: true |
| | | }) |
| | | wx.navigateBack({ |
| | | delta: 1 |
| | | }); |
| | | }, |
| | | fail: (res) => { |
| | | console.log('失败', res) |
| | | } |
| | | }) |
| | | } |
| | | }); |
| | | }) |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | // app.getQQMap().geocoder({ |
| | | // //获取表单传入地址 |
| | | // address: self, //地址参数,例:固定地址,address: '北京市海淀区彩和坊路海淀西大街74号' |
| | | // success: function (res) { |
| | | // console.log(res); |
| | | // //成功后的回调 |
| | | // if (res.message == "Success") { |
| | | // var res = res.result; |
| | | // var latitude = res.location.lat; |
| | | // var longitude = res.location.lng; //根据地址解析在地图上标记解析地址位置 |
| | | // // app.store.index.latitude = latitude; |
| | | // // app.store.index.longitude = longitude; |
| | | // wx.setStorageSync('latitude', latitude) |
| | | // wx.setStorageSync('longitude', longitude) |
| | | // wx.setStorageSync('cityName', res.address_components.city) |
| | | // prevPage.setData({ |
| | | // cityName: res.address_components.city, |
| | | // latitude: latitude, |
| | | // longitude: longitude, |
| | | // showFrist: false, |
| | | // newCityName: self, |
| | | // formLocation: false |
| | | // }) |
| | | // console.log(latitude, longitude) |
| | | // //调用home 方法 |
| | | // prevPage.getLocal(latitude, longitude) |
| | | // prevPage.getadver(res.ad_info.adcode) |
| | | // prevPage.getadver2(res.ad_info.adcode) |
| | | // prevPage.openCity(res.ad_info.adcode) |
| | | // prevPage.setData({ |
| | | // isLocation:true |
| | | // }) |
| | | // wx.navigateBack({ |
| | | // delta: 1 |
| | | // }); |
| | | // } else { |
| | | // wx.showToast({ |
| | | // title: '服务器错误', |
| | | // icon: "none", |
| | | // duration: 1500 |
| | | // }) |
| | | // } |
| | | |
| | | |
| | | // } |
| | | // }); |
| | | } else { |
| | | prevPage.setData({ |
| | | cityName: self |
| | | }) |
| | | prevPage.setData({ |
| | | isLocation:true |
| | | isLocation: true |
| | | }) |
| | | wx.navigateBack({ |
| | | delta: 1 |
| | |
| | | <image src='../../img/back@3x.png' style=""></image> |
| | | </view> |
| | | <view class='nav-title'> |
| | | <text style="height:{{navHeight}}px;line-height:{{navHeight}}px;font-size:26rpx;color:">支付费用</text> |
| | | <text style="height:{{navHeight}}px;line-height:{{navHeight}}px;font-size:26rpx;">支付费用</text> |
| | | </view> |
| | | </view> |
| | | </view> |
| | |
| | | var app = getApp() |
| | | const unit = require('../../utils/util') |
| | | const GdMap = require('../../utils/amap-wx') |
| | | const BaiduMap = require('../../utils/bmap-wx.min') |
| | | |
| | | |
| | | Page({ |
| | | |
| | |
| | | this.setData({ |
| | | historyAddressListStart: [] |
| | | }) |
| | | var myAmapFun = new GdMap.AMapWX({ |
| | | key: 'a825dd33982ba213f2be3e83ad2f9a9b' |
| | | }); |
| | | myAmapFun.getInputtips({ |
| | | keywords: inputValue, |
| | | city: this.data.cityName, |
| | | get_subpois: 1, |
| | | var bmap = new BaiduMap.BMapWX({ |
| | | ak: 'fi3HGJjW153NCNsaTb9FekxeX1Lj3auo' // 必填,您的key |
| | | }) |
| | | bmap.suggestion({ |
| | | query: inputValue, |
| | | region:this.data.adcode, |
| | | coordtype:'bd09ll', |
| | | citylimit: true, |
| | | success: (res) => { |
| | | console.log(res) |
| | | if (res.tips.length > 0) { |
| | | if (res.result.length > 0) { |
| | | this.setData({ |
| | | addressList: res.tips, |
| | | addressList: res.result, |
| | | noThing: false |
| | | }) |
| | | } else { |
| | |
| | | console.log(self) |
| | | let pages = getCurrentPages(); |
| | | let prevPage = pages[pages.length - 2]; |
| | | let lat = self.location.split(",")[1] |
| | | let lng = self.location.split(",")[0] |
| | | let lat = self.location.lat |
| | | let lng = self.location.lng |
| | | let data = this.data |
| | | prevPage.setData({ |
| | | startLat: lat, |
| | |
| | | } |
| | | let pages = getCurrentPages(); |
| | | let prevPage = pages[pages.length - 2]; |
| | | let lat = self.location.split(",")[1] |
| | | let lng = self.location.split(",")[0] |
| | | let lat = self.location.lat |
| | | let lng = self.location.lng |
| | | prevPage.setData({ |
| | | startLat: lat, |
| | | startLon: lng, |
| | |
| | | <!--接入历史的数据--> |
| | | <view class="history_box"> |
| | | <view hidden="{{noThing}}"> |
| | | <view class="history_search" wx:for="{{addressList}}" wx:if="{{!item.location.length==0}}" data-self="{{item}}" catchtap="updatePlace" |
| | | <view class="history_search" wx:for="{{addressList}}" wx:if="{{item.location.lat}}" data-self="{{item}}" catchtap="updatePlace" |
| | | style="{{modeSelectId == 2 ? 'height:160rpx' : 'height:120rpx'}}" |
| | | > |
| | | <view class="img_icon"> |
| | |
| | | <view class="history_text_address {{modeSelectId == 2 ? 'font44' : ''}}">{{item.address||'无'}}</view> |
| | | </view> |
| | | </view> |
| | | <view class="history_search" wx:if="{{addressList.length==0}}" wx:if="{{!item.location.length==0}}" wx:for="{{historyAddressListStart}}" data-self="{{item}}" catchtap="historyUpdatePlace" data-index="{{index}}" style="{{modeSelectId == 2 ? 'height:160rpx' : 'height:120rpx'}}"> |
| | | <view class="history_search" wx:if="{{addressList.length==0}}" wx:if="{{item.location.lat}}" wx:for="{{historyAddressListStart}}" data-self="{{item}}" catchtap="historyUpdatePlace" data-index="{{index}}" style="{{modeSelectId == 2 ? 'height:160rpx' : 'height:120rpx'}}"> |
| | | <view class="img_icon"> |
| | | <image src="../../img/icon_history.png" class="history_icon"></image> |
| | | </view> |
| | |
| | | var touchMoveY = 0; // y轴方向移动的距离 |
| | | const app = getApp() |
| | | const unit = require('../../utils/util') |
| | | const QQMapWX = require('../../utils/qqmap-wx-jssdk') |
| | | const GdMap = require('../../utils/amap-wx') |
| | | var WxParse = require("../../utils/wxParse/wxParse") |
| | | var qqmapsdk; |
| | | const BaiduMap = require('../../utils/bmap-wx.min') |
| | | var latitude = app.globalData.userLatitude |
| | | var longitude = app.globalData.userLongitude |
| | | const { |
| | |
| | | isDj: 1, |
| | | tip: '0元', |
| | | changePeople: "选乘车人", |
| | | changeModel:'线上计费', |
| | | payModel:'线上计费', |
| | | yyTime: '现在', |
| | | btnDisabled: false, //呼叫车按钮, |
| | | multiArray: [ |
| | |
| | | sameUserInfoObj: {}, //小件物流个人信息 |
| | | // 协议痰喘显示隐藏 |
| | | agreementShow: wx.getStorageSync('token') ? false : !wx.getStorageSync('isAgreement') && true, |
| | | showModel:false, |
| | | }, |
| | | |
| | | |
| | | //选择计费方式 |
| | | changeModel(){ |
| | | this.setData({ |
| | | showModel:true |
| | | }) |
| | | }, |
| | | |
| | | //关闭弹窗 |
| | | onClose(){ |
| | | this.setData({ |
| | | showModel:false |
| | | }) |
| | | }, |
| | | |
| | | |
| | | //切换计费方式 |
| | | changeTab1(){ |
| | | this.setData({ |
| | | changeModel:'线上计费' |
| | | }) |
| | | }, |
| | | |
| | | //切换计费方式 |
| | | changeTab2(){ |
| | | console.log(2222222222); |
| | | this.setData({ |
| | | changeModel:'打表计费' |
| | | }) |
| | | }, |
| | | |
| | | changePayModel(){ |
| | | this.setData({ |
| | | payModel:this.data.changeModel, |
| | | showModel:false, |
| | | }) |
| | | }, |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | // 同意协议 |
| | | agree() { |
| | | wx.setStorageSync('isAgreement', 1) |
| | |
| | | }) |
| | | }, |
| | | callPhone() { |
| | | this.getIsBlack().then(res=>{ |
| | | this.getIsBlack().then(res => { |
| | | if (res) { |
| | | const phone = this.data.homePhone.filter(item => item.type == 3 && item.platform == 1) |
| | | if (phone.length) { |
| | | wx.makePhoneCall({ |
| | | phoneNumber: phone[0].phone //仅为示例,并非真实的电话号码 |
| | | }) |
| | | } else { |
| | | wx.showToast({ |
| | | title: '助老模式暂未配置电话号码', |
| | | icon: 'none' |
| | | }) |
| | | } |
| | | if (phone.length) { |
| | | wx.makePhoneCall({ |
| | | phoneNumber: phone[0].phone //仅为示例,并非真实的电话号码 |
| | | }) |
| | | } else { |
| | | wx.showToast({ |
| | | title: '助老模式暂未配置电话号码', |
| | | icon: 'none' |
| | | }) |
| | | } |
| | | } |
| | | }) |
| | | }, |
| | |
| | | this.mapCtx = wx.createMapContext("someCityMap"); |
| | | //获取中心坐标 api |
| | | this.mapCtx.getCenterLocation({ |
| | | type: 'gcj02', |
| | | // type: 'bd09ll', |
| | | success: function (res) { |
| | | that.setData({ |
| | | latitude: res.latitude, |
| | | longitude: res.longitude, |
| | | latitude: this.transformFromGCJToBaidu(res.latitude,res.longitude).latitude, |
| | | longitude: this.transformFromGCJToBaidu(res.latitude,res.longitude).longitude, |
| | | }) |
| | | that.getLocal(res.latitude, res.longitude) |
| | | that.getCarNum(res.latitude, res.longitude, that.data.busId) |
| | | } |
| | | }) |
| | | } |
| | | }, |
| | | |
| | | transformFromGCJToBaidu(latitude, longitude) { |
| | | var pi = 3.14159265358979324 * 3000.0 / 180.0; |
| | | |
| | | var z = Math.sqrt(longitude * longitude + latitude * latitude) + 0.00002 * Math.sin(latitude * pi); |
| | | var theta = Math.atan2(latitude, longitude) + 0.000003 * Math.cos(longitude * pi); |
| | | var a_latitude = (z * Math.sin(theta) + 0.006); |
| | | var a_longitude = (z * Math.cos(theta) + 0.0065); |
| | | |
| | | return { latitude: a_latitude, longitude: a_longitude }; |
| | | }, |
| | | //queryLogisticsNumber 获取首页小件物流订单数量 |
| | | async queryLogisticsNumber() { |
| | |
| | | let mapCtx = wx.createMapContext('map4select'); |
| | | mapCtx.moveToLocation({ |
| | | success: (res) => { |
| | | console.log('adsadsad',res); |
| | | this.getLocal(wx.getStorageSync('userLocation').split(",")[1], wx.getStorageSync('userLocation').split(",")[0]) |
| | | // this.getLocal(wx.getStorageSync('latitude'), wx.getStorageSync('longitude')) |
| | | |
| | | this.setData({ |
| | | newCityName: "", |
| | | cityName: wx.getStorageSync('cityName') |
| | |
| | | endLat: '', |
| | | endLon: '', |
| | | }) |
| | | // this.getLocal(wx.getStorageSync('latitude'), wx.getStorageSync('longitude')) |
| | | this.getLocal(wx.getStorageSync('userLocation').split(",")[1], wx.getStorageSync('userLocation').split(",")[0]) |
| | | }, |
| | | // 获取隐私协议和用户协议 |
| | |
| | | //swiper |
| | | // app.getFloatStr(5) |
| | | // this.show() |
| | | |
| | | |
| | | |
| | | this.getAgreement() |
| | | this.getSwiper() |
| | | this.getHomePhone() |
| | |
| | | // 获取是否进入黑名单 |
| | | async getIsBlack() { |
| | | let res = await unit.post(app.globalData.Url + '/api/checkBlack') |
| | | console.log(res, '11111111111111111'); |
| | | if (res.data.code == -1) { |
| | | //已经进入黑名单 |
| | | this.setData({ |
| | |
| | | icon: 'success', |
| | | duration: 1000 |
| | | }) |
| | | //接入高地地图调用..... |
| | | var myAmapFun = new GdMap.AMapWX({ |
| | | key: 'a825dd33982ba213f2be3e83ad2f9a9b' |
| | | }); |
| | | myAmapFun.getRegeo({ |
| | | //接入百度地图方法 |
| | | var bmap = new BaiduMap.BMapWX({ |
| | | ak: 'fi3HGJjW153NCNsaTb9FekxeX1Lj3auo' // 必填,您的key |
| | | }) |
| | | |
| | | bmap.regeocoding({ |
| | | coordtype:'bd09ll', |
| | | success: (res) => { |
| | | // that.setData({ |
| | | // cityName:res[0].regeocodeData.addressComponent.city, |
| | |
| | | // district:res[0].regeocodeData.addressComponent.province, |
| | | // formatted_address:res[0].regeocodeData.formatted_address |
| | | // }) |
| | | wx.setStorageSync('latitude', res[0].latitude) |
| | | wx.setStorageSync('longitude', res[0].longitude) |
| | | wx.setStorageSync('adcode', res[0].regeocodeData.addressComponent.adcode) |
| | | wx.setStorageSync('cityName', res[0].regeocodeData.addressComponent.city) |
| | | wx.setStorageSync('cityNameStart', res[0].name) |
| | | wx.setStorageSync('district', res[0].regeocodeData.addressComponent.district) |
| | | wx.setStorageSync('province', res[0].regeocodeData.addressComponent.province) |
| | | wx.setStorageSync('formatted_address', res[0].regeocodeData.formatted_address) |
| | | that.queryBusiness(res[0].regeocodeData.addressComponent.city, res[0].regeocodeData.addressComponent.district, res[0].regeocodeData.addressComponent.province) |
| | | that.getCarNum(res[0].latitude, res[0].longitude, that.data.busId) |
| | | that.openCity(res[0].regeocodeData.addressComponent.adcode) |
| | | that.getadver2(wx.getStorageSync('adcode') || res[0].regeocodeData.addressComponent.adcode) |
| | | wx.setStorageSync('latitude', res.originalData.result.location.lat) |
| | | wx.setStorageSync('longitude', res.originalData.result.location.lng) |
| | | wx.setStorageSync('adcode', res.originalData.result.addressComponent.adcode) |
| | | wx.setStorageSync('cityName', res.originalData.result.addressComponent.city) |
| | | wx.setStorageSync('cityNameStart', res.originalData.result.formatted_address) |
| | | wx.setStorageSync('district', res.originalData.result.addressComponent.district) |
| | | wx.setStorageSync('province', res.originalData.result.addressComponent.province) |
| | | wx.setStorageSync('formatted_address', res.originalData.result.formatted_address) |
| | | that.queryBusiness(res.originalData.result.addressComponent.city, res.originalData.result.addressComponent.district, res.originalData.result.addressComponent.province) |
| | | that.getCarNum(res.originalData.result.location.lat, res.originalData.result.location.lng, that.data.busId) |
| | | that.openCity(res.originalData.result.addressComponent.adcode) |
| | | that.getadver2(wx.getStorageSync('adcode') || res.originalData.result.addressComponent.adcode) |
| | | } |
| | | }) |
| | | } |
| | |
| | | cancelColor: res, |
| | | }) |
| | | if (res.confirm) { |
| | | var myAmapFun = new GdMap.AMapWX({ |
| | | key: 'a825dd33982ba213f2be3e83ad2f9a9b' |
| | | }); |
| | | myAmapFun.getRegeo({ |
| | | var bmap = new BaiduMap.BMapWX({ |
| | | ak: 'fi3HGJjW153NCNsaTb9FekxeX1Lj3auo' // 必填,您的key |
| | | }) |
| | | |
| | | bmap.regeocoding({ |
| | | coordtype:'bd09ll', |
| | | success: (res) => { |
| | | that.setData({ |
| | | cityName: res[0].regeocodeData.addressComponent.city, |
| | | latitude: res[0].latitude, |
| | | longitude: res[0].longitude, |
| | | adcode: res[0].regeocodeData.addressComponent.adcode, |
| | | cityNameStart: res[0].name, |
| | | district: res[0].regeocodeData.addressComponent.district, |
| | | province: res[0].regeocodeData.addressComponent.province, |
| | | formatted_address: res[0].regeocodeData.formatted_address |
| | | cityName: res.originalData.result.addressComponent.city, |
| | | latitude: res.originalData.result.location.lat, |
| | | longitude: res.originalData.result.location.lng, |
| | | adcode: res.originalData.result.addressComponent.adcode, |
| | | cityNameStart: res.originalData.result.formatted_address, |
| | | district: res.originalData.result.addressComponent.district, |
| | | province: res.originalData.result.addressComponent.province, |
| | | formatted_address: res.originalData.result.formatted_address |
| | | }) |
| | | //获取城市 |
| | | wx.setStorageSync('latitude', res[0].latitude) |
| | | wx.setStorageSync('longitude', res[0].longitude) |
| | | wx.setStorageSync('adcode', res[0].regeocodeData.addressComponent.adcode) |
| | | wx.setStorageSync('cityName', res[0].regeocodeData.addressComponent.city) |
| | | wx.setStorageSync('cityNameStart', res[0].name) |
| | | wx.setStorageSync('district', res[0].regeocodeData.addressComponent.district) |
| | | wx.setStorageSync('province', res[0].regeocodeData.addressComponent.province) |
| | | wx.setStorageSync('formatted_address', res[0].regeocodeData.formatted_address) |
| | | that.queryBusiness(res[0].regeocodeData.addressComponent.city, res[0].regeocodeData.addressComponent.district, res[0].regeocodeData.addressComponent.province) |
| | | that.getCarNum(res[0].latitude, res[0].longitude, that.data.busId) |
| | | that.openCity(res[0].regeocodeData.addressComponent.adcode) |
| | | that.getadver2(wx.getStorageSync('adcode') || that.data.adcode) |
| | | wx.setStorageSync('latitude', res.originalData.result.location.lat) |
| | | wx.setStorageSync('longitude', res.originalData.result.location.lng) |
| | | wx.setStorageSync('adcode', res.originalData.result.addressComponent.adcode) |
| | | wx.setStorageSync('cityName', res.originalData.result.addressComponent.city) |
| | | wx.setStorageSync('cityNameStart', res.originalData.result.formatted_address) |
| | | wx.setStorageSync('district', res.originalData.result.addressComponent.district) |
| | | wx.setStorageSync('province', res.originalData.result.addressComponent.province) |
| | | wx.setStorageSync('formatted_address', res.originalData.result.formatted_address) |
| | | that.queryBusiness(res.originalData.result.addressComponent.city, res.originalData.result.addressComponent.district, res.originalData.result.addressComponent.province) |
| | | that.getCarNum(res.originalData.result.location.lat, res.originalData.result.location.lng, that.data.busId) |
| | | that.openCity(res.originalData.result.addressComponent.adcode) |
| | | that.getadver2(wx.getStorageSync('adcode') || res.originalData.result.addressComponent.adcode) |
| | | } |
| | | }) |
| | | } else { |
| | |
| | | duration: 1000 |
| | | }) |
| | | //接入高地地图调用..... |
| | | var myAmapFun = new GdMap.AMapWX({ |
| | | key: 'a825dd33982ba213f2be3e83ad2f9a9b' |
| | | }); |
| | | myAmapFun.getRegeo({ |
| | | var bmap = new BaiduMap.BMapWX({ |
| | | ak: 'fi3HGJjW153NCNsaTb9FekxeX1Lj3auo' // 必填,您的key |
| | | }) |
| | | |
| | | bmap.regeocoding({ |
| | | coordtype:'bd09ll', |
| | | success: (res) => { |
| | | that.setData({ |
| | | cityName: res[0].regeocodeData.addressComponent.city, |
| | | latitude: res[0].latitude, |
| | | longitude: res[0].longitude, |
| | | adcode: res[0].regeocodeData.addressComponent.adcode, |
| | | cityNameStart: res[0].name, |
| | | district: res[0].regeocodeData.addressComponent.district, |
| | | province: res[0].regeocodeData.addressComponent.province, |
| | | formatted_address: res[0].regeocodeData.formatted_address |
| | | cityName: res.originalData.result.addressComponent.city, |
| | | latitude: res.originalData.result.location.lat, |
| | | longitude: res.originalData.result.location.lng, |
| | | adcode: res.originalData.result.addressComponent.adcode, |
| | | cityNameStart: res.originalData.result.formatted_address, |
| | | district: res.originalData.result.addressComponent.district, |
| | | province: res.originalData.result.addressComponent.province, |
| | | formatted_address: res.originalData.result.formatted_address |
| | | }) |
| | | wx.setStorageSync('latitude', res[0].latitude) |
| | | wx.setStorageSync('longitude', res[0].longitude) |
| | | wx.setStorageSync('adcode', res[0].regeocodeData.addressComponent.adcode) |
| | | wx.setStorageSync('cityName', res[0].regeocodeData.addressComponent.city) |
| | | wx.setStorageSync('cityNameStart', res[0].name) |
| | | wx.setStorageSync('district', res[0].regeocodeData.addressComponent.district) |
| | | wx.setStorageSync('province', res[0].regeocodeData.addressComponent.province) |
| | | wx.setStorageSync('formatted_address', res[0].regeocodeData.formatted_address) |
| | | that.queryBusiness(res[0].regeocodeData.addressComponent.city, res[0].regeocodeData.addressComponent.district, res[0].regeocodeData.addressComponent.province) |
| | | that.getCarNum(res[0].latitude, res[0].longitude, that.data.busId) |
| | | that.openCity(res[0].regeocodeData.addressComponent.adcode) |
| | | that.getadver2(wx.getStorageSync('adcode') || that.data.adcode) |
| | | //获取城市 |
| | | wx.setStorageSync('latitude', res.originalData.result.location.lat) |
| | | wx.setStorageSync('longitude', res.originalData.result.location.lng) |
| | | wx.setStorageSync('adcode', res.originalData.result.addressComponent.adcode) |
| | | wx.setStorageSync('cityName', res.originalData.result.addressComponent.city) |
| | | wx.setStorageSync('cityNameStart', res.originalData.result.formatted_address) |
| | | wx.setStorageSync('district', res.originalData.result.addressComponent.district) |
| | | wx.setStorageSync('province', res.originalData.result.addressComponent.province) |
| | | wx.setStorageSync('formatted_address', res.originalData.result.formatted_address) |
| | | that.queryBusiness(res.originalData.result.addressComponent.city, res.originalData.result.addressComponent.district, res.originalData.result.addressComponent.province) |
| | | that.getCarNum(res.originalData.result.location.lat, res.originalData.result.location.lng, that.data.busId) |
| | | that.openCity(res.originalData.result.addressComponent.adcode) |
| | | that.getadver2(wx.getStorageSync('adcode') || res.originalData.result.addressComponent.adcode) |
| | | } |
| | | }) |
| | | } |
| | |
| | | } |
| | | }); |
| | | } else if (res.authSetting['scope.userLocation'] == true) { |
| | | var myAmapFun = new GdMap.AMapWX({ |
| | | key: 'a825dd33982ba213f2be3e83ad2f9a9b' |
| | | }); |
| | | myAmapFun.getRegeo({ |
| | | var bmap = new BaiduMap.BMapWX({ |
| | | ak: 'fi3HGJjW153NCNsaTb9FekxeX1Lj3auo' // 必填,您的key |
| | | }) |
| | | |
| | | bmap.regeocoding({ |
| | | coordtype:'bd09ll', |
| | | success: (res) => { |
| | | console.log('---------------------------------------------', res); |
| | | that.setData({ |
| | | cityName: res[0].regeocodeData.addressComponent.city, |
| | | latitude: res[0].latitude, |
| | | longitude: res[0].longitude, |
| | | adcode: res[0].regeocodeData.addressComponent.adcode, |
| | | cityNameStart: res[0].name, |
| | | district: res[0].regeocodeData.addressComponent.district, |
| | | province: res[0].regeocodeData.addressComponent.province, |
| | | formatted_address: res[0].regeocodeData.formatted_address |
| | | cityName: res.originalData.result.addressComponent.city, |
| | | latitude: res.originalData.result.location.lat, |
| | | longitude: res.originalData.result.location.lng, |
| | | adcode: res.originalData.result.addressComponent.adcode, |
| | | cityNameStart: res.originalData.result.formatted_address, |
| | | district: res.originalData.result.addressComponent.district, |
| | | province: res.originalData.result.addressComponent.province, |
| | | formatted_address: res.originalData.result.formatted_address |
| | | }) |
| | | wx.setStorageSync('latitude', res[0].latitude) |
| | | wx.setStorageSync('longitude', res[0].longitude) |
| | | wx.setStorageSync('adcode', res[0].regeocodeData.addressComponent.adcode) |
| | | wx.setStorageSync('cityName', res[0].regeocodeData.addressComponent.city) |
| | | wx.setStorageSync('cityNameStart', res[0].name) |
| | | wx.setStorageSync('district', res[0].regeocodeData.addressComponent.district) |
| | | wx.setStorageSync('province', res[0].regeocodeData.addressComponent.province) |
| | | wx.setStorageSync('formatted_address', res[0].regeocodeData.formatted_address) |
| | | that.queryBusiness(res[0].regeocodeData.addressComponent.city, res[0].regeocodeData.addressComponent.district, res[0].regeocodeData.addressComponent.province) |
| | | that.getCarNum(res[0].latitude, res[0].longitude, that.data.busId) |
| | | that.openCity(res[0].regeocodeData.addressComponent.adcode) |
| | | that.getadver2(wx.getStorageSync('adcode') || that.data.adcode) |
| | | wx.setStorageSync('latitude', res.originalData.result.location.lat) |
| | | wx.setStorageSync('longitude', res.originalData.result.location.lng) |
| | | wx.setStorageSync('adcode', res.originalData.result.addressComponent.adcode) |
| | | wx.setStorageSync('cityName', res.originalData.result.addressComponent.city) |
| | | wx.setStorageSync('cityNameStart', res.originalData.result.formatted_address) |
| | | wx.setStorageSync('district', res.originalData.result.addressComponent.district) |
| | | wx.setStorageSync('province', res.originalData.result.addressComponent.province) |
| | | wx.setStorageSync('formatted_address', res.originalData.result.formatted_address) |
| | | that.queryBusiness(res.originalData.result.addressComponent.city, res.originalData.result.addressComponent.district, res.originalData.result.addressComponent.province) |
| | | that.getCarNum(res.originalData.result.location.lat, res.originalData.result.location.lng, that.data.busId) |
| | | that.openCity(res.originalData.result.addressComponent.adcode) |
| | | that.getadver2(wx.getStorageSync('adcode') || res.originalData.result.addressComponent.adcode) |
| | | }, |
| | | fail(err) { |
| | | console.log(err) |
| | |
| | | btnDisabled: true |
| | | }) |
| | | var DATE = unit.formatTimeUser(new Date()); |
| | | |
| | | if (this.data.checkDown == 2) { |
| | | if (this.data.yyTime == "现在") { |
| | | this.setData({ |
| | |
| | | startAddress: this.data.changeStartName || this.data.cityNameStart, |
| | | startLat: startLat, |
| | | startLon: startLon, |
| | | areaCode:wx.getStorageSync('adcode'), |
| | | substitute: this.data.substitute, //代下单 |
| | | tipMoney: +this.data.tip.substr(0, this.data.tip.length - 1), |
| | | travelTime: this.data.date |
| | | travelTime: this.data.date, |
| | | payManner:this.data.payModel=='线上计费'?1:2 |
| | | } |
| | | if (Object.keys(btnCarData).length == 15) { |
| | | |
| | | console.log('wdawdad',btnCarData); |
| | | if (Object.keys(btnCarData).length == 17) { |
| | | btnCarData.oldPeople = Number(!mode) |
| | | if (Number(!mode)) { |
| | | btnCarData.endAddress = '' |
| | |
| | | nextLongitude: '', |
| | | }) |
| | | } |
| | | |
| | | |
| | | unit.post(app.globalData.Url + '/api/taxi/taxiOrder', |
| | | btnCarData, |
| | |
| | | }, |
| | | closeBlack() { |
| | | this.setData({ |
| | | showBlack:false |
| | | showBlack: false |
| | | }) |
| | | }, |
| | | |
| | |
| | | }, |
| | | // 获取当前地理位置 |
| | | getLocal: function (latitude, longitude) { |
| | | qqmapsdk = new QQMapWX({ |
| | | |
| | | key: 'SVIBZ-4RN6J-LPRF2-XZOZF-EAZKF-USFTD' //这里自己的key秘钥进行填充 |
| | | }); |
| | | var bmap = new BaiduMap.BMapWX({ |
| | | ak: 'fi3HGJjW153NCNsaTb9FekxeX1Lj3auo' // 必填,您的key |
| | | }) |
| | | let that = this; |
| | | qqmapsdk.reverseGeocoder({ |
| | | location: { |
| | | latitude: latitude, |
| | | longitude: longitude |
| | | }, |
| | | bmap.regeocoding({ |
| | | coordtype:'bd09ll', |
| | | location: latitude + ',' + longitude, |
| | | success: function (res) { |
| | | console.log(res) |
| | | console.log('454545d4454545451', res) |
| | | //这里的res参数里有具体的城市数据 |
| | | var name = res.result.address_component |
| | | var name = res.originalData.result.addressComponent |
| | | that.setData({ |
| | | changeStartName: '', |
| | | startLat:'', |
| | | startLon:'', |
| | | cityNameStart: res.result.address_reference.landmark_l2.title, |
| | | adcode: res.result.ad_info.adcode, |
| | | latitude: res.result.location.lat, |
| | | longitude: res.result.location.lng |
| | | startLat: '', |
| | | startLon: '', |
| | | cityNameStart: res.originalData.result.formatted_address, |
| | | adcode: res.originalData.result.addressComponent.adcode, |
| | | latitude: res.originalData.result.location.lat, |
| | | longitude: res.originalData.result.location.lng |
| | | }) |
| | | that.queryBusiness(name.city, name.district, name.province) |
| | | that.openCity(res.result.ad_info.adcode) |
| | | that.openCity(res.originalData.result.addressComponent.adcode) |
| | | }, |
| | | fail: function (res) { |
| | | console.log('////////////',res); |
| | | that.setData({ |
| | | cityNameStart: "正在定位中" |
| | | }) |
| | |
| | | |
| | | ] |
| | | |
| | | |
| | | |
| | | |
| | | let startLat = that.data.startLat || that.data.latitude |
| | | let startLon = that.data.startLon || that.data.longitude |
| | | unit.get('https://apis.map.qq.com/ws/direction/v1/driving/?from=' + |
| | | startLat + ',' + |
| | | startLon + '&to=' + that.data.nextLatitude + ',' + |
| | | that.data.nextLongitude + '&output=json&callback=cb&key=SVIBZ-4RN6J-LPRF2-XZOZF-EAZKF-USFTD', {}) |
| | | .then((res) => { |
| | | |
| | | // unit.get('https://apis.map.qq.com/ws/direction/v1/driving/?from=' + |
| | | // startLat + ',' + |
| | | // startLon + '&to=' + that.data.nextLatitude + ',' + |
| | | // that.data.nextLongitude + '&output=json&callback=cb&key=SVIBZ-4RN6J-LPRF2-XZOZF-EAZKF-USFTD', {}) |
| | | // .then((res) => { |
| | | // if (res.data.message == 'Success') { |
| | | // var coors = res.data.result.routes[0].polyline |
| | | // for (var i = 2; i < coors.length; i++) { |
| | | // coors[i] = coors[i - 2] + coors[i] / 1000000 |
| | | // } |
| | | // // coors.forEach((element,index) => { |
| | | // // coors[index] =coors[index - 2]+ coors[index]/ 1000000 |
| | | // // }); |
| | | // //划线 |
| | | // var b = []; |
| | | // for (var i = 0; i < coors.length; i = i + 2) { |
| | | // b[i / 2] = { |
| | | // latitude: coors[i], |
| | | // longitude: coors[i + 1] |
| | | // }; |
| | | // } |
| | | |
| | | if (res.data.message == 'Success') { |
| | | var coors = res.data.result.routes[0].polyline |
| | | for (var i = 2; i < coors.length; i++) { |
| | | coors[i] = coors[i - 2] + coors[i] / 1000000 |
| | | } |
| | | // coors.forEach((element,index) => { |
| | | // coors[index] =coors[index - 2]+ coors[index]/ 1000000 |
| | | // }); |
| | | //划线 |
| | | var b = []; |
| | | for (var i = 0; i < coors.length; i = i + 2) { |
| | | b[i / 2] = { |
| | | latitude: coors[i], |
| | | longitude: coors[i + 1] |
| | | }; |
| | | } |
| | | // that.setData({ |
| | | // polyline: [{ |
| | | // points: b, |
| | | // arrowLine: true, |
| | | // color: '#00C47A', |
| | | // width: 4, |
| | | // borderWidth: 1, |
| | | // borderColor: '#00C47A' |
| | | // }], |
| | | // }) |
| | | // } else { |
| | | // app.showToastSuccess('路线规划失败', null, "none", 1500) |
| | | // } |
| | | // }) |
| | | wx.request({ |
| | | url: `https://api.map.baidu.com/directionlite/v1/driving?origin=${startLat},${startLon}&destination=${ that.data.nextLatitude},${that.data.nextLongitude}&ak=WQhfsluNzEeUHUxoH4jc4JiCQOXw4Mnx&coordtype=bd09ll,`, |
| | | success: function (res) { |
| | | console.log('weewqeqwe', res); |
| | | |
| | | if (res.data.status == 0) { |
| | | var coors = res.data.result.routes[0].steps |
| | | var polyline = []; |
| | | coors.forEach(function (step) { |
| | | polyline.push({ |
| | | latitude: step.end_location.lat, |
| | | longitude: step.end_location.lng |
| | | }); |
| | | }); |
| | | that.setData({ |
| | | polyline: [{ |
| | | points: b, |
| | | points: polyline, |
| | | arrowLine: true, |
| | | color: '#00C47A', |
| | | width: 4, |
| | | borderWidth: 1, |
| | | borderColor: '#00C47A' |
| | | }], |
| | | }) |
| | | } else { |
| | | app.showToastSuccess('路线规划失败', null, "none", 1500) |
| | | }); |
| | | |
| | | } |
| | | }) |
| | | }, |
| | | fail: function (res) { |
| | | app.showToastSuccess('路线规划失败', null, "none", 1500) |
| | | } |
| | | }) |
| | | unit.post(app.globalData.Url + '/base/taxi/queryExpectedTime', { |
| | | // slat:that.data.latitude, |
| | | // slon:that.data.longitude, |
| | |
| | | |
| | | var markers = [{ |
| | | iconPath: "../../img/start_icon.png", |
| | | id: "map4select", |
| | | id: 1, |
| | | latitude: that.data.startLat || that.data.latitude, |
| | | longitude: that.data.startLon || that.data.longitude, |
| | | width: 26, |
| | |
| | | }, |
| | | { |
| | | iconPath: "../../img/end_icon.png", |
| | | id: "map4select", |
| | | id: 2, |
| | | latitude: that.data.nextLatitude, |
| | | longitude: that.data.nextLongitude, |
| | | width: 26, |
| | |
| | | </view> |
| | | <!--选择乘车人--> |
| | | <view class="use_people" catchtap="changePeople" hidden="{{checkDown!==3}}"> |
| | | {{changePeople}} > |
| | | {{changePeople}} > 222222222222 |
| | | </view> |
| | | |
| | | <!--预约原则时间--> |
| | | <view class="use_people" catchtap="selecttime" hidden="{{checkDown!==2}}"> |
| | | {{yyTime=='现在'?'选择时间':yyTime}} > |
| | |
| | | </view> |
| | | <!--选择乘车人--> |
| | | <view class="use_people" catchtap="changePeople" hidden="{{checkDown!==3}}"> |
| | | {{changePeople}} > |
| | | {{changePeople}} > 1111111 |
| | | </view> |
| | | |
| | | <!--预约原则时间--> |
| | | <view class="use_people" catchtap="selecttime" hidden="{{checkDown!==2}}"> |
| | | {{yyTime=='现在'?'选择时间':yyTime}} > |
| | |
| | | <!--乘车人和消费--> |
| | | <view class="car_change" hidden="{{checkDown==2}}"> |
| | | <view wx:if="{{busId==2}}" style="display: flex;align-items: center;justify-content: center;width: 100%;"> |
| | | <view class="people_selsect" catchtap="changePeople"> |
| | | <view class="people_selsect bor-R" catchtap="changePeople"> |
| | | {{changePeople}} |
| | | <image src="../../img/icon_nav_open.png" class="jiantou"></image> |
| | | </view> |
| | | |
| | | <view class="people_selsect" catchtap="changeModel"> |
| | | {{payModel}} |
| | | <image src="../../img/icon_nav_open.png" class="jiantou"></image> |
| | | </view> |
| | | </view> |
| | |
| | | <view wx:if="{{busId==1}}" class="people_selsect" catchtap="setSosPeople">紧急联系人<image src="../../img/icon_nav_open.png" class="jiantou"></image> |
| | | </view> |
| | | </view> |
| | | <view class="car_change" hidden="{{checkDown==1||checkDown==3}}"> |
| | | <view class="people_selsect {{checkDown==2?'three':''}}" catchtap="selecttime"> |
| | | <view class="car_change" style="display: flex;align-items: center;" hidden="{{checkDown==1||checkDown==3}}" wx:if="{{checkDown==2}}"> |
| | | <view class="people_selsect bor-R {{checkDown==2?'three':''}}" catchtap="selecttime"> |
| | | {{yyTime=='现在'?'选择时间':yyTime}} |
| | | <image src="../../img/icon_nav_open.png" class="jiantou"></image> |
| | | </view> |
| | | <view class="people_selsect {{checkDown==2?'three':''}}" catchtap="changePeople"> |
| | | <view class="people_selsect bor-R {{checkDown==2?'three':''}}" catchtap="changePeople"> |
| | | {{changePeople}} |
| | | <image src="../../img/icon_nav_open.png" class="jiantou"></image> |
| | | </view> |
| | | |
| | | <view class="people_selsect {{checkDown==2?'three':''}}" catchtap="changeModel"> |
| | | {{payModel}} |
| | | <image src="../../img/icon_nav_open.png" class="jiantou"></image> |
| | | </view> |
| | | <!-- <view class="people_selsect {{checkDown==2?'three':''}}" catchtap="selecttip"> |
| | |
| | | <view class="contact" catchtap="serverPhone">去联系</view> |
| | | <image catchtap="closeBlack" class="close" src="/img/icon_close@2x.png"></image> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | |
| | | <van-popup position="bottom" overlay="{{ true }}" show="{{showModel}}" bind:close="onClose"> |
| | | <view class="van_top"> |
| | | <view class="van_title" style="font-weight: 600;">选择计费方式</view> |
| | | <image src="../../img/icon_close.png" catchtap="onClose"></image> |
| | | </view> |
| | | |
| | | <view class="van-content"> |
| | | <view class="van-item" bindtap="changeTab1"> |
| | | <image src="../../img/xuanzhong@2x.png" wx:if="{{changeModel=='线上计费'}}" class="check-icon-item" /> |
| | | <image src="../../img/icon_raidobutton.png" wx:if="{{changeModel=='打表计费'}}" class="check-icon-item" /> |
| | | <text style="font-weight: 600;"> 线上计费</text> (平台计费在线付款给平台) |
| | | </view> |
| | | <view class="van-item" bindtap="changeTab2"> |
| | | <image src="../../img/icon_raidobutton.png" wx:if="{{changeModel=='线上计费'}}" class="check-icon-item" /> |
| | | <image src="../../img/xuanzhong@2x.png" wx:if="{{changeModel=='打表计费'}}" class="check-icon-item" /> |
| | | <text style="font-weight: 600;">打表计费</text> (司机打表计费) |
| | | </view> |
| | | </view> |
| | | |
| | | <button disabled="{{btnDisabled}}" catchtap="changePayModel" class="sure-btn">确认</button> |
| | | </van-popup> |
| | |
| | | text-align: center; |
| | | width: 350rpx; |
| | | height: 40rpx; |
| | | margin-top: 24rpx; |
| | | /* margin-top: 24rpx; */ |
| | | font-size: 24rpx; |
| | | font-family: PingFangSC-Regular, PingFang SC; |
| | | font-weight: 400; |
| | | color: rgba(0, 0, 0, 1) |
| | | |
| | | } |
| | | |
| | | .three { |
| | |
| | | margin: auto; |
| | | margin-top: 50rpx; |
| | | } |
| | | |
| | | .blackList .close { |
| | | width: 32rpx; |
| | | height: 32rpx; |
| | | position: absolute; |
| | | top: 40rpx; |
| | | right: 32rpx; |
| | | } |
| | | |
| | | .bor-R { |
| | | border-right: 1rpx solid rgba(232, 232, 232, 1); |
| | | } |
| | | |
| | | |
| | | .van_title { |
| | | font-family: PingFangSC, PingFang SC; |
| | | font-weight: 500; |
| | | font-size: 31rpx; |
| | | color: rgba(0, 0, 0, .8); |
| | | text-align: center; |
| | | margin-top: 34.62rpx; |
| | | } |
| | | |
| | | .check-icon-item { |
| | | width: 34.62rpx; |
| | | height: 34.62rpx; |
| | | margin-right: 19.23rpx; |
| | | } |
| | | |
| | | .van-item { |
| | | margin-left: 26.92rpx; |
| | | margin-right: 26.92rpx; |
| | | display: flex; |
| | | align-items: center; |
| | | height: 90.38rpx; |
| | | font-family: PingFangSC, PingFang SC; |
| | | font-weight: 500; |
| | | font-size: 23rpx; |
| | | border-bottom: 1rpx solid rgba(151, 151, 151, .15); |
| | | } |
| | | |
| | | .sure-btn { |
| | | width: 515rpx !important; |
| | | height: 77rpx; |
| | | background: #4D8BFF; |
| | | border-radius: 8rpx; |
| | | margin-top: 65.38rpx; |
| | | font-family: PingFangSC, PingFang SC; |
| | | font-weight: 500; |
| | | font-size: 29rpx; |
| | | color: #FFFFFF; |
| | | } |
| | |
| | | <view class="money_messageinfo_title">起步价<span>({{dataMoney.startMileage}}) 公里</span></view> |
| | | <view class="money_messageinfo_title"><span class="money_span">{{dataMoney.startMoney}}</span>元</view> |
| | | </view> |
| | | <view class="money_messageinfo" wx:if="{{orderType==1 &&dataMoney.waitMoney!=='0.00'}}"> |
| | | <view class="money_messageinfo" wx:if="{{dataMoney.waitMoney!=='0.00'}}"> |
| | | <view class="money_messageinfo_title">等待费<span>({{dataMoney.wait}}) 分钟</span></view> |
| | | <view class="money_messageinfo_title"><span class="money_span">{{dataMoney.waitMoney}}</span>元</view> |
| | | </view> |
| | | <view class="money_messageinfo" wx:if="{{orderType==1&&dataMoney.durationMoney!=='0.00'}}"> |
| | | <view class="money_messageinfo" wx:if="{{dataMoney.durationMoney!=='0.00'}}"> |
| | | <view class="money_messageinfo_title">时长费<span>({{dataMoney.duration}}) 分钟</span></view> |
| | | <view class="money_messageinfo_title"><span class="money_span">{{dataMoney.durationMoney}}</span>元</view> |
| | | </view> |
| | | <view class="money_messageinfo" wx:if="{{orderType==1&&dataMoney.mileageMoney!=='0.00'}}"> |
| | | <view class="money_messageinfo" wx:if="{{dataMoney.mileageMoney!=='0.00'}}"> |
| | | <view class="money_messageinfo_title">里程费<span>({{dataMoney.mileage}}) 公里</span></view> |
| | | <view class="money_messageinfo_title"><span class="money_span">{{dataMoney.mileageMoney}}</span>元</view> |
| | | </view> |
| | | <view class="money_messageinfo" wx:if="{{orderType==1&&dataMoney.longDistanceMoney!=='0.00'}}"> |
| | | <view class="money_messageinfo" wx:if="{{dataMoney.longDistanceMoney!=='0.00'}}"> |
| | | <view class="money_messageinfo_title">远途费<span>({{dataMoney.longDistance}}) 公里</span></view> |
| | | <view class="money_messageinfo_title"><span class="money_span">{{dataMoney.longDistanceMoney}}</span>元</view> |
| | | </view> |
| | |
| | | orderId: "", |
| | | orderType: "", |
| | | modeSelectId: wx.getStorageSync('modeId') || 1, |
| | | OrderInfo:{}, |
| | | }, |
| | | lookMoneyInfo() { |
| | | wx.navigateTo({ |
| | | if(this.data.OrderInfo.payManner==1){ |
| | | wx.navigateTo({ |
| | | url: '/pages/moneyInfo/moneyInfo?id=' + this.data.orderId + '&orderType=' + this.data.orderType, |
| | | }) |
| | | } |
| | | |
| | | }, |
| | | /** |
| | | * 生命周期函数--监听页面加载 |
| | |
| | | orderType: this.data.orderType |
| | | }) |
| | | .then((res) => { |
| | | console.log(res) |
| | | this.setData({ |
| | | OrderInfo:res.data.data |
| | | }) |
| | | if (res.data.code == 200) { |
| | | var points = [{ |
| | | latitude: res.data.data.startLat, |
| | |
| | | </view> |
| | | <view class="okTrip_car_style"> |
| | | {{orderMessage.brand}} · {{orderMessage.carColor}} |
| | | <!-- <view class="okTrip_money" catchtap="lookMoneyInfo"> |
| | | <view class="okTrip_money" catchtap="lookMoneyInfo"> |
| | | {{orderMoney}}元 |
| | | <image src="/img/arrows@3x.png"></image> |
| | | </view> --> |
| | | </view> |
| | | </view> |
| | | <view class="okTrip_start"> |
| | | <image src="../../../img/icon_score.png"></image> |
| | |
| | | ischeck: false |
| | | }], |
| | | nmpj: true, |
| | | OrderInfo:{}, |
| | | }, |
| | | lookMoneyInfo() { |
| | | wx.navigateTo({ |
| | | if(this.data.OrderInfo.payManner==1){ |
| | | wx.navigateTo({ |
| | | url: '/pages/moneyInfo/moneyInfo?id=' + this.data.orderId + '&orderType=' + this.data.orderType, |
| | | }) |
| | | } |
| | | }, |
| | | //星星评价 |
| | | select(e) { |
| | |
| | | }) |
| | | .then((res) => { |
| | | console.log(res) |
| | | this.setData({ |
| | | OrderInfo:res.data.data |
| | | }) |
| | | if (res.data.code == 200) { |
| | | var points = [{ |
| | | latitude: res.data.data.startLat, |
| | |
| | | </view> |
| | | <view class="okTrip_car_style"> |
| | | {{orderMessage.brand}} · {{orderMessage.carColor}} |
| | | <!-- <view class="okTrip_money" catchtap="lookMoneyInfo"> |
| | | <view class="okTrip_money" catchtap="lookMoneyInfo"> |
| | | {{orderMoney}}元 |
| | | <image src="/img/arrows@3x.png"></image> |
| | | </view> --> |
| | | </view> |
| | | </view> |
| | | <view class="okTrip_start"> |
| | | <image src="../../../img/icon_score.png"></image> |
| | |
| | | const unit = require('../../utils/util') |
| | | const GdMap = require('../../utils/amap-wx') |
| | | |
| | | const BaiduMap = require('../../utils/bmap-wx.min') |
| | | |
| | | Page({ |
| | | |
| | | /** |
| | |
| | | where:"", |
| | | height:wx.getStorageSync('height'), |
| | | cityName:''||wx.getStorageSync('cityName'), |
| | | adcode:''||wx.getStorageSync('adcode'), |
| | | showHistory:false, |
| | | addressList:[] |
| | | }, |
| | |
| | | }, |
| | | //根据未知名调取地图 |
| | | getLocation(inputValue){ |
| | | var myAmapFun = new GdMap.AMapWX({ key: 'a825dd33982ba213f2be3e83ad2f9a9b' }); |
| | | myAmapFun.getInputtips({ |
| | | keywords:inputValue, |
| | | city:this.data.cityName, |
| | | get_subpois:1, |
| | | var bmap = new BaiduMap.BMapWX({ |
| | | ak: 'fi3HGJjW153NCNsaTb9FekxeX1Lj3auo' // 必填,您的key |
| | | }) |
| | | |
| | | bmap.suggestion({ |
| | | query: inputValue, |
| | | region:this.data.adcode, |
| | | coordtype:'bd09ll', |
| | | success:(res)=>{ |
| | | console.log(res) |
| | | this.setData({ |
| | | addressList : res.tips |
| | | addressList : res.result |
| | | }) |
| | | } |
| | | }) |
| | | |
| | | // var myAmapFun = new GdMap.AMapWX({ key: 'a825dd33982ba213f2be3e83ad2f9a9b' }); |
| | | // myAmapFun.getInputtips({ |
| | | // keywords:inputValue, |
| | | // city:this.data.cityName, |
| | | // get_subpois:1, |
| | | // success:(res)=>{ |
| | | // console.log('45454545',res) |
| | | // this.setData({ |
| | | // addressList : res.tips |
| | | // }) |
| | | // } |
| | | // }) |
| | | }, |
| | | clearEnd(){ |
| | | wx.removeStorage({ |
| | |
| | | }) |
| | | }, |
| | | historyUpdatePlace(e){ |
| | | let self = e.currentTarget.dataset.self |
| | | let self = e.currentTarget.dataset.self |
| | | let pages = getCurrentPages(); |
| | | let prevPage = pages[pages.length - 2]; |
| | | let lat = self.location.split(",")[1] |
| | | let lng = self.location.split(",")[0] |
| | | let lat = self.location.lat |
| | | let lng = self.location.lng |
| | | console.log(prevPage) |
| | | prevPage.setData({ |
| | | nextLatitude:lat, |
| | |
| | | } |
| | | let pages = getCurrentPages(); |
| | | let prevPage = pages[pages.length - 2]; |
| | | let lat = self.location.split(",")[1] |
| | | let lng = self.location.split(",")[0] |
| | | let lat = self.location.lat |
| | | let lng = self.location.lng |
| | | console.log(prevPage) |
| | | prevPage.setData({ |
| | | nextLatitude:lat, |
| | |
| | | </view> |
| | | <!--接入历史的数据--> |
| | | <view class="history_box"> |
| | | <view class="history_search" wx:for="{{addressList}}" wx:if="{{!item.location.length==0}}" data-self="{{item}}" catchtap="updatePlace" data-index="{{index}}"> |
| | | <view class="history_search" wx:for="{{addressList}}" wx:if="{{item.location.lat}}" data-self="{{item}}" catchtap="updatePlace" data-index="{{index}}"> |
| | | <view class="img_icon" > |
| | | <image src="../../img/icon_history.png" class="history_icon"></image> |
| | | </view> |
| | |
| | | <view class="history_text_address">{{item.address||'无'}}</view> |
| | | </view> |
| | | </view> |
| | | <view class="history_search" wx:if="{{addressList.length==0}}" wx:key="index" wx:if="{{!item.location.length==0}}" wx:for="{{historyAddressList}}" data-self="{{item}}" catchtap="historyUpdatePlace" data-index="{{index}}"> |
| | | <view class="history_search" wx:if="{{addressList.length==0}}" wx:key="index" wx:if="{{item.location.lat}}" wx:for="{{historyAddressList}}" data-self="{{item}}" catchtap="historyUpdatePlace" data-index="{{index}}"> |
| | | |
| | | <view class="img_icon" > |
| | | <image src="../../img/icon_history.png" class="history_icon"></image> |
| | |
| | | couponId: '', |
| | | isIncok: false, |
| | | showIpay: false, |
| | | payStyle: [{ |
| | | payStyle: [ |
| | | { |
| | | name: "充值余额", |
| | | checked: false, |
| | | money: '0元' |
| | |
| | | orderType: "", //车型类型 |
| | | remark: "", |
| | | sendTitle: "等待应答", //title |
| | | OrderInfo:{}, |
| | | }, |
| | | |
| | | ipay() { |
| | |
| | | orderType: this.data.orderType |
| | | }) |
| | | .then((res) => { |
| | | console.log(res) |
| | | // console.log(res) |
| | | if (res.data.code == 200) { |
| | | this.setData({ |
| | | showPayVan: false, |
| | |
| | | }, |
| | | |
| | | closeOrder() { |
| | | console.log(this.data.orderID, wx.getStorageSync('orderID'), this.data.orderType) |
| | | // console.log(this.data.orderID, wx.getStorageSync('orderID'), this.data.orderType) |
| | | wx.navigateTo({ |
| | | url: '../../pages/canceLorder/canceLorder?id=' + (this.data.orderID || wx.getStorageSync('orderID')) + '&type=' + this.data.orderType + '&state=' + this.data.state, |
| | | }) |
| | |
| | | header: header, |
| | | method: 'POST', |
| | | success: (res) => { |
| | | console.log(res) |
| | | // console.log(res) |
| | | if (res.data.code == 200) { |
| | | let pages = getCurrentPages(); |
| | | let prevPage = pages[pages.length - 2]; |
| | |
| | | }) |
| | | }, |
| | | yesOrder() { |
| | | console.log("111") |
| | | // console.log("111") |
| | | // app.closeSocket() |
| | | this.setData({ |
| | | isShowOrder: false |
| | |
| | | onLoad: function (options) { |
| | | getDriveIng = setInterval(() => { |
| | | this.getDriveIng() |
| | | }, 1000) |
| | | }, 3000) |
| | | let isPhone = app.globalData.isIphoneX; |
| | | if (options.where == "myTrip" || options.where == "drive") { |
| | | wx.setStorageSync('orderID', options.orderID) |
| | |
| | | }) |
| | | //订单状态-监听globalData |
| | | } else { |
| | | console.log('1') |
| | | // console.log('1') |
| | | if (options.orderType) { |
| | | let orderType = options.orderType |
| | | this.setData({ |
| | |
| | | }, |
| | | |
| | | close_order() { |
| | | console.log("11") |
| | | // console.log("11") |
| | | this.setData({ |
| | | isShowClose: true |
| | | }) |
| | |
| | | orderType: this.data.orderType |
| | | }, |
| | | success: (res) => { |
| | | console.log(res,res.data.data.score.toFixed(1)) |
| | | // console.log(res,res.data.data.score.toFixed(1)) |
| | | if (res.data.code == 200) { |
| | | this.setData({ |
| | | drive: res.data.data, |
| | |
| | | //根据经纬度路线规划 |
| | | //获取行车路线 |
| | | getDriverLine(fromValue, toValue) { |
| | | // console.log('shhuji',fromValue,toValue); |
| | | let that = this; |
| | | app.getQQMap().direction({ |
| | | mode: "driving", //可选值:'driving'(驾车)、'walking'(步行)、'bicycling'(骑行),不填默认:'driving',可不填 |
| | | //from参数不填默认当前地址 |
| | | from: fromValue, |
| | | to: toValue, // toValue |
| | | wx.request({ |
| | | url: `https://api.map.baidu.com/directionlite/v1/driving?origin=${fromValue.latitude},${fromValue.longitude}&destination=${toValue.latitude},${toValue.longitude}&ak=WQhfsluNzEeUHUxoH4jc4JiCQOXw4Mnx&coordtype=bd09ll`, |
| | | success: function (res) { |
| | | var ret = res; |
| | | var coors = ret.result.routes[0].polyline, |
| | | pl = []; |
| | | //坐标解压(返回的点串坐标,通过前向差分进行压缩) |
| | | var kr = 1000000; |
| | | for (var i = 2; i < coors.length; i++) { |
| | | coors[i] = Number(coors[i - 2]) + Number(coors[i]) / kr; |
| | | } |
| | | //将解压后的坐标放入点串数组pl中 |
| | | for (var i = 0; i < coors.length; i += 2) { |
| | | pl.push({ |
| | | latitude: coors[i], |
| | | longitude: coors[i + 1] |
| | | if (res.data.status == 0) { |
| | | var coors = res.data.result.routes[0].steps |
| | | var polyline = []; |
| | | coors.forEach(function (step) { |
| | | polyline.push({ |
| | | latitude: step.end_location.lat, |
| | | longitude: step.end_location.lng |
| | | }); |
| | | }); |
| | | that.setData({ |
| | | latitude: polyline[0].latitude, |
| | | longitude: polyline[0].longitude, |
| | | line:true, |
| | | polyline: [{ |
| | | points: polyline, |
| | | arrowLine: true, |
| | | color: '#00C47A', |
| | | width: 4, |
| | | borderWidth: 1, |
| | | borderColor: '#00C47A' |
| | | }], |
| | | }); |
| | | |
| | | } |
| | | //设置polyline属性,将路线显示出来,将解压坐标第一个数据作为起点 |
| | | that.setData({ |
| | | // latitude: pl[0].latitude, |
| | | // longitude: pl[0].longitude, |
| | | line: true, |
| | | polyline: [{ |
| | | points: pl, |
| | | arrowLine: true, |
| | | color: '#00C47A', |
| | | width: 4, |
| | | borderWidth: 1, |
| | | borderColor: '#00C47A' |
| | | }, ], |
| | | }); |
| | | return |
| | | }, |
| | | fail: function (error) { |
| | | console.error(error); |
| | | }, |
| | | complete: function (res) { |
| | | console.log(res); |
| | | }, |
| | | }); |
| | | fail: function (res) { |
| | | app.showToastSuccess('路线规划失败', null, "none", 1500) |
| | | } |
| | | }) |
| | | // app.getQQMap().direction({ |
| | | // mode: "driving", //可选值:'driving'(驾车)、'walking'(步行)、'bicycling'(骑行),不填默认:'driving',可不填 |
| | | // //from参数不填默认当前地址 |
| | | // from: fromValue, |
| | | // to: toValue, // toValue |
| | | // success: function (res) { |
| | | // var ret = res; |
| | | // var coors = ret.result.routes[0].polyline, |
| | | // pl = []; |
| | | // //坐标解压(返回的点串坐标,通过前向差分进行压缩) |
| | | // var kr = 1000000; |
| | | // for (var i = 2; i < coors.length; i++) { |
| | | // coors[i] = Number(coors[i - 2]) + Number(coors[i]) / kr; |
| | | // } |
| | | // //将解压后的坐标放入点串数组pl中 |
| | | // for (var i = 0; i < coors.length; i += 2) { |
| | | // pl.push({ |
| | | // latitude: coors[i], |
| | | // longitude: coors[i + 1] |
| | | // }); |
| | | // } |
| | | // //设置polyline属性,将路线显示出来,将解压坐标第一个数据作为起点 |
| | | // that.setData({ |
| | | // // latitude: pl[0].latitude, |
| | | // // longitude: pl[0].longitude, |
| | | // line: true, |
| | | // polyline: [{ |
| | | // points: pl, |
| | | // arrowLine: true, |
| | | // color: '#00C47A', |
| | | // width: 4, |
| | | // borderWidth: 1, |
| | | // borderColor: '#00C47A' |
| | | // }, ], |
| | | // }); |
| | | // return |
| | | // }, |
| | | // fail: function (error) { |
| | | // console.error(error); |
| | | // }, |
| | | // complete: function (res) { |
| | | // console.log(res); |
| | | // }, |
| | | // }); |
| | | }, |
| | | //封装函数 |
| | | formatTime(num) { |
| | |
| | | return `${m}:${s}`; |
| | | }, |
| | | getMylocation() { |
| | | console.log("1") |
| | | // console.log("1") |
| | | let mapCtx = wx.createMapContext('map4select'); |
| | | mapCtx.moveToLocation({ |
| | | success: (res) => { |
| | | console.log(res) |
| | | // console.log(res) |
| | | }, |
| | | fail: (res) => { |
| | | console.log(res) |
| | | // console.log(res) |
| | | } |
| | | |
| | | }); |
| | |
| | | header: header, |
| | | method: "POST", |
| | | success: (res) => { |
| | | console.log(res) |
| | | // console.log(res) |
| | | } |
| | | }) |
| | | }, |
| | | //webSocket 函数 |
| | | waitTingApi(type) { |
| | | console.log('---------------111') |
| | | // console.log('---------------111') |
| | | let resData = JSON.parse(type); |
| | | console.log("订单", resData.data); |
| | | console.log("订单状态", resData.method); |
| | | // console.log("订单状态", resData.method); |
| | | if (resData.method == 'ORDER_CANCEL') { |
| | | wx.navigateBack() |
| | | return |
| | | } |
| | | |
| | | let { |
| | | orderID |
| | | } = this.data |
| | | console.log(orderID,'111111') |
| | | // console.log(orderID,'111111') |
| | | this.setData({ |
| | | servedMileage: resData.data.servedMileage || 0, //订单为服务中的服务距离 |
| | | laveTime: resData.data.laveTime || 0, //订单为服务中的预计剩余时间 |
| | |
| | | wx.setStorageSync('SERVER_TIME', nowTime) |
| | | |
| | | let time = wx.getStorageSync('SERVER_TIME') |
| | | console.log(time, '++++++++++++++++++') |
| | | // console.log(time, '++++++++++++++++++') |
| | | this.setTimerTime = setInterval(() => { |
| | | this.setData({ |
| | | waitTimeTime: this.formatTime(new Date(time).getTime()), |
| | |
| | | sendTitle: "支付费用" |
| | | }) |
| | | } else if (state == 7) { |
| | | console.log("1") |
| | | // console.log("1") |
| | | this.setData({ |
| | | showMap: false, |
| | | showPay: true, |
| | |
| | | }) |
| | | } |
| | | } else if (state == 9) { |
| | | |
| | | console.log(11111111111111111111+'//////////////////////////'); |
| | | this.setData({ |
| | | sendTitle: "已取消" |
| | | }) |
| | |
| | | points |
| | | }) |
| | | } else if (this.data.state == 5) { |
| | | console.log(resData,'resDataresDataresDataresData'); |
| | | // console.log(resData,'resDataresDataresDataresData'); |
| | | clearInterval(this.setTimer) |
| | | var markers = [{ |
| | | iconPath: "../../img/map_car@3x.png", |
| | |
| | | Authorization: "Bearer" + " " + wx.getStorageSync('token'), |
| | | }, |
| | | success: (res) => { |
| | | console.log(res, 4444, app.globalData.state !== res.data.data.state) |
| | | // console.log(res, 4444, app.globalData.state !== res.data.data.state) |
| | | // && app.globalData.state !== res.data.data.state |
| | | if (res.data.code == 200 && res.data.data.state == 2) { |
| | | console.log("------------------------------------------------------") |
| | | // console.log("------------------------------------------------------") |
| | | this.getDriveInfo() |
| | | var markers = [{ |
| | | iconPath: "../../img/map_car@3x.png", |
| | |
| | | sendTitle: "待出发", |
| | | }) |
| | | } else if (res.data.data.state == 1 && app.globalData.state !== res.data.data.state) { |
| | | console.log("------------------------------------------------------") |
| | | // console.log("------------------------------------------------------") |
| | | this.setData({ |
| | | sendTitle: "等待应答" |
| | | }) |
| | | } else if (res.data.data.state == 3 && app.globalData.state !== res.data.data.state) { |
| | | console.log("------------------------------------------------------") |
| | | // console.log("------------------------------------------------------") |
| | | |
| | | var markers = [{ |
| | | iconPath: "../../img/map_car@3x.png", |
| | |
| | | longitude: res.data.data.lon, |
| | | }, |
| | | ] |
| | | setTimeout(() => { |
| | | this.getDriverLine({ |
| | | |
| | | this.getDriverLine({ |
| | | latitude: res.data.data.lat, |
| | | longitude: res.data.data.lon, |
| | | }, { |
| | | latitude: this.data.startLat, |
| | | longitude: this.data.startLon, |
| | | }) |
| | | }, 1000) |
| | | this.setData({ |
| | | reservationMileage: res.data.data.reservationMileage, //司机距离距离 |
| | | reservationTime: res.data.data.reservationTime, //距离预约地点的时间 |
| | |
| | | sendTitle: "等待接驾" |
| | | }) |
| | | } else if (res.data.data.state == 5 && app.globalData.state !== res.data.data.state) { |
| | | console.log("------------------------------------------------------") |
| | | // console.log("------------------------------------------------------") |
| | | if (this.data.server5) { |
| | | |
| | | var points = [{ |
| | |
| | | clearInterval(this.setTimerTime) |
| | | this.mapCtx = wx.createMapContext("map4select"); |
| | | this.mapCtx.translateMarker({ |
| | | markerId: 'map4select', |
| | | markerId: 1, |
| | | autoRotate: true, |
| | | duration: 3000, |
| | | destination: { |
| | |
| | | longitude: res.data.data.lon, |
| | | }, |
| | | }, { |
| | | markerId: 'map', |
| | | markerId: 2, |
| | | autoRotate: true, |
| | | duration: 3000, |
| | | destination: { |
| | |
| | | }) |
| | | |
| | | } else if (res.data.data.state == 6 && app.globalData.state !== res.data.data.state) { |
| | | console.log("------------------------------------------------------") |
| | | // console.log("------------------------------------------------------") |
| | | this.setData({ |
| | | closeOrder: false, |
| | | closeOrderAdovad: false, |
| | |
| | | |
| | | let time = wx.getStorageSync('SERVER_TIME') |
| | | |
| | | console.log(this.formatTime(nowTime), '++++++++++++++++++') |
| | | // console.log(this.formatTime(nowTime), '++++++++++++++++++') |
| | | this.setTimerTime = setInterval(() => { |
| | | this.setData({ |
| | | waitTimeTime: this.formatTime(new Date(time).getTime()), |
| | |
| | | sendTitle: "支付费用" |
| | | }) |
| | | } else if (res.data.data.state == 7 && app.globalData.state !== res.data.data.state) { |
| | | console.log("1") |
| | | // console.log("1") |
| | | this.setData({ |
| | | showMap: false, |
| | | showPay: true, |
| | |
| | | * 用户点击右上角分享 |
| | | */ |
| | | onShareAppMessage: function (e) { |
| | | console.log(e) |
| | | // console.log(e) |
| | | if (e.from === 'button') { |
| | | this.setData({ |
| | | showPop: false |
| | |
| | | title: '转发', |
| | | path: '/pages/home/home', |
| | | success: function (res) { |
| | | console.log('成功', res) |
| | | // console.log('成功', res) |
| | | } |
| | | } |
| | | }, |
| | |
| | | code: wx.getStorageSync('adcode') |
| | | }) |
| | | .then((res) => { |
| | | console.log(res) |
| | | // console.log(res) |
| | | this.setData({ |
| | | homePhone: res.data.data |
| | | }) |
| | |
| | | header: header, |
| | | method: "POST", |
| | | success: (res) => { |
| | | console.log(res) |
| | | // console.log(res) |
| | | if (res.data.code == 200) { |
| | | this.getMessage() |
| | | this.setData({ |
| | |
| | | header: header, |
| | | method: "POST", |
| | | success: (res) => { |
| | | console.log(res) |
| | | // console.log(res) |
| | | if (res.data.code == 200) { |
| | | this.setData({ |
| | | showPayVan: false, |
| | | }) |
| | | var jsonData = JSON.parse(res.data.data) |
| | | console.log(jsonData) |
| | | var jsonData = res.data.data |
| | | wx.requestPayment({ |
| | | "timeStamp": jsonData.timestamp, |
| | | "nonceStr": jsonData.noncestr, |
| | | "timeStamp": jsonData.timeStamp, |
| | | "nonceStr": jsonData.nonceStr, |
| | | "package": jsonData.package, |
| | | "signType": jsonData.signType, |
| | | "paySign": jsonData.sign, |
| | | "paySign":jsonData.sign, |
| | | "success": (res) => { |
| | | let that = this |
| | | console.log(res) |
| | | // console.log(res) |
| | | that.getMessage() |
| | | that.setData({ |
| | | payEnd: true, |
| | |
| | | clearInterval(this.data.getDriveIng) |
| | | }, |
| | | "fail": function (res) { |
| | | console.log(res) |
| | | // console.log(res) |
| | | } |
| | | }) |
| | | } else { |
| | |
| | | orderType: this.data.orderType |
| | | }) |
| | | .then((res) => { |
| | | console.log(res) |
| | | // console.log(res) |
| | | if (res.data.code == 200) { |
| | | let money = "payStyle[" + 0 + "].money"; |
| | | let newmoney = "(" + res.data.data.balance + '可用' + ")" |
| | |
| | | success: (res) => { |
| | | console.log(res) |
| | | if (res.data.code == 200) { |
| | | this.setData({ |
| | | OrderInfo:res.data.data |
| | | }) |
| | | if (res.data.data.endAddress == '') { |
| | | this.setData({ |
| | | onekey: "1" |
| | |
| | | // let timeNowPick = timeNow.split(' ')[1].slice(4,timeNow.length-1).toString() |
| | | // let data = res.data.data.travelTime |
| | | // let changeDate = dataNow+' '+timeNowPick |
| | | console.log(data, data - 30 * 60 * 1000, data - timeNow <= 30 * 60 * 1000) |
| | | // console.log(data, data - 30 * 60 * 1000, data - timeNow <= 30 * 60 * 1000) |
| | | if (data - timeNow >= 30 * 60 * 1000) { |
| | | this.setData({ |
| | | showShowDom: true, |
| | |
| | | orderType: this.data.orderType |
| | | }) |
| | | .then((res2) => { |
| | | console.log(res2) |
| | | // console.log(res2) |
| | | var markers = [{ |
| | | iconPath: "../../img/map_car@3x.png", |
| | | id: 1, |
| | |
| | | orderType: this.data.orderType |
| | | }) |
| | | .then((res2) => { |
| | | console.log(res2) |
| | | // console.log(res2) |
| | | var markers = [{ |
| | | iconPath: "../../img/map_car@3x.png", |
| | | id: 1, |
| | |
| | | getText: function (e) { |
| | | var index = e.currentTarget.dataset.id |
| | | var value = e.currentTarget.dataset.value |
| | | console.log(value) |
| | | // console.log(value) |
| | | if (this.data.starId == 5) { |
| | | var check = this.data.bq_text |
| | | check[index].ischeck = !check[index].ischeck |
| | | console.log(check) |
| | | // console.log(check) |
| | | this.setData({ |
| | | check: check |
| | | }) |
| | |
| | | starId: this.data.starId, |
| | | showDom: true |
| | | }) |
| | | console.log(this.data.starId) |
| | | // console.log(this.data.starId) |
| | | if (e.currentTarget.dataset.index == 5) { |
| | | console.log(e.currentTarget.dataset.index) |
| | | // console.log(e.currentTarget.dataset.index) |
| | | this.setData({ |
| | | showGood: true, |
| | | showNo: false, |
| | | }) |
| | | } else { |
| | | console.log(e.currentTarget.dataset.index) |
| | | // console.log(e.currentTarget.dataset.index) |
| | | this.setData({ |
| | | showNo: true, |
| | | showGood: false, |
| | |
| | | } |
| | | } |
| | | } |
| | | console.log(textArr) |
| | | // console.log(textArr) |
| | | if (this.data.starId > 0) { |
| | | var header = { |
| | | "content-type": "application/x-www-form-urlencoded", |
| | |
| | | orderType: this.data.orderType |
| | | }, |
| | | success: (res) => { |
| | | console.log(res) |
| | | // console.log(res) |
| | | if (res.data.code == 200) { |
| | | this.setData({ |
| | | pjdisabled: true, |
| | |
| | | orderType: this.data.orderType |
| | | }) |
| | | .then((res) => { |
| | | console.log(res) |
| | | // console.log(res) |
| | | if (res.data.code == 200 && res.data.data.amount > 0) { |
| | | this.setData({ |
| | | showPop: true, |
| | |
| | | orderType: this.data.orderType |
| | | }) |
| | | .then((res) => { |
| | | console.log(res) |
| | | // console.log(res) |
| | | }) |
| | | }, |
| | | //点击支付方式 |
| | | onClick(event) { |
| | | console.log(event) |
| | | // console.log(event) |
| | | const { |
| | | name, |
| | | index |
| | |
| | | <view class='status' style='height: {{status}}px;{{containerStyle}}'></view> |
| | | <view class='navbar' style='height:{{navHeight}}px;{{containerStyle}}'> |
| | | <view class='back-icon' catchtap="homeBack"> |
| | | <image src='/img/back@3x.png' style=""></image> |
| | | <image src='/img/back@3x.png'></image> |
| | | </view> |
| | | <view class='nav-title'> |
| | | <text style="height:{{navHeight}}px;line-height:{{navHeight}}px;font-size:30rpx;color:">{{sendTitle == '待支付' ? '行程结束' : sendTitle}}</text> |
| | | <text style="height:{{navHeight}}px;line-height:{{navHeight}}px;font-size:30rpx;">{{sendTitle == '待支付' ? '行程结束' : sendTitle}}</text> |
| | | </view> |
| | | </view> |
| | | </view> |
| | |
| | | <view hidden="{{payEnd}}" class="pay_view"> |
| | | <view class="please_pay">请支付</view> |
| | | <view class="car_monery">¥{{money||0}}</view> |
| | | <view class="please_pay" style="text-decoration:underline;padding-bottom:15rpx" catchtap="lookMoneyInfo">查看费用明细</view> |
| | | <view class="please_pay" wx:if="{{OrderInfo.payManner==1}}" style="text-decoration:underline;padding-bottom:15rpx" catchtap="lookMoneyInfo">查看费用明细</view> |
| | | <view class="tip_money" wx:if="{{tipMoney!=='0.00'}}">其中含小费:<span>¥{{tipMoney||0}}</span></view> |
| | | <view class="iPay">若您已付款,请忽略!</view> |
| | | <button class="button_pay" style="bottom:{{btuBottom+28}}rpx" disabled="{{false}}" catchtap="goPay">立即支付</button> |
| | |
| | | <!--start--> |
| | | <view class="start" hidden="{{!payEnd}}" style="{{modeSelectId == 2 ? 'padding-top:191rpx' : ''}}"> |
| | | <view class="car_monery" wx:if="{{money>0}}">¥{{money||0}}</view> |
| | | <!-- <view class="please_pay" style="text-decoration:underline;padding-bottom:15rpx" catchtap="lookMoneyInfo">查看费用明细</view> --> |
| | | <view class="please_pay" style="text-decoration:underline;padding-bottom:15rpx" catchtap="lookMoneyInfo">查看费用明细</view> |
| | | <view class="noname {{modeSelectId == 2 ? 'font60' :''}}" wx:if="{{nmpj}}">匿名评价司机</view> |
| | | <view class="noname {{modeSelectId == 2 ? 'font60' :''}}" wx:if="{{pjxq}}">评价详情</view> |
| | | <!--遮罩层--> |
| | |
| | | <image src="../../img/icon_close.png" catchtap="onClose"></image> |
| | | </view> |
| | | <view class="van_money car_monery">¥{{money||0}}</view> |
| | | <view class="van_card" catchtap="getCou"> |
| | | <!-- <view class="van_card" catchtap="getCou"> |
| | | <view class="van_card_title">优惠券</view> |
| | | <image src="../../img/icon_nav_open.png"></image> |
| | | <view class="van_card_num" hidden="{{!showNumCoun}}">{{queryBalance.coupon==0?'0张可用券':'您有'+queryBalance.coupon+'张优惠券'}}</view> |
| | | <view class="van_card_num" hidden="{{showNumCoun}}">{{moneyDown==""?'您有'+queryBalance.coupon+'张优惠券':'-'+moneyDown+'元'}}</view> |
| | | </view> |
| | | </view> --> |
| | | <view class="select-item"> |
| | | <van-radio-group value="{{cancelOriginal}}" bind:change="onChange"> |
| | | <van-cell-group> |
| | |
| | | .button_pay { |
| | | width: 694rpx !important; |
| | | height: 80rpx; |
| | | background: rgba(74, 76, 89, 1); |
| | | background: rgba(77, 139, 255, 1); |
| | | border-radius: 8rpx; |
| | | position: absolute; |
| | | bottom: 28rpx; |
| | |
| | | .pay_button_btn { |
| | | width: 650rpx !important; |
| | | height: 80rpx; |
| | | background: rgba(74, 76, 89, 1); |
| | | background: rgba(77, 139, 255, 1); |
| | | border-radius: 8rpx; |
| | | margin: 44rpx auto; |
| | | font-size: 28rpx; |
| | |
| | | "ignore": [], |
| | | "disablePlugins": [], |
| | | "outputPath": "" |
| | | } |
| | | }, |
| | | "condition": false |
| | | }, |
| | | "condition": {}, |
| | | "editorSetting": { |
| | |
| | | |
| | | const ajax = new Ajax({ |
| | | // baseURL: 'http://192.168.0.49:81/api', |
| | | // baseURL:"http://192.168.0.80:80/user" |
| | | // baseURL:"http://192.168.110.34:7777/user" |
| | | baseURL:"http://221.182.45.100:7777/user" |
| | | |
| | | // baseURL:"http://39.108.148.228:80/user" |
| | | // baseURL: 'http://120.220.4.138:9591/user', |
| | | baseURL: 'https://xn95128.cn/user', |
| | | // baseURL: 'https://xn95128.cn/user', |
| | | |
| | | }) |
| | | |
New file |
| | |
| | | /** |
| | | * @file 微信小程序JSAPI |
| | | * @author 崔健 cuijian03@baidu.com 2017.01.10 |
| | | * @update 邓淑芳 623996689@qq.com 2019.07.03 |
| | | */ |
| | | |
| | | /** |
| | | * 百度地图微信小程序API类 |
| | | * |
| | | * @class |
| | | */ |
| | | class BMapWX { |
| | | |
| | | /** |
| | | * 百度地图微信小程序API类 |
| | | * |
| | | * @constructor |
| | | */ |
| | | constructor(param) { |
| | | this.ak = param["ak"]; |
| | | } |
| | | |
| | | /** |
| | | * 使用微信接口进行定位 |
| | | * |
| | | * @param {string} type 坐标类型 |
| | | * @param {Function} success 成功执行 |
| | | * @param {Function} fail 失败执行 |
| | | * @param {Function} complete 完成后执行 |
| | | */ |
| | | getWXLocation(type, success, fail, complete) { |
| | | type = type || 'gcj02', |
| | | success = success || function () { }; |
| | | fail = fail || function () { }; |
| | | complete = complete || function () { }; |
| | | wx.getLocation({ |
| | | type: type, |
| | | success: success, |
| | | fail: fail, |
| | | complete: complete |
| | | }); |
| | | } |
| | | |
| | | /** |
| | | * POI周边检索 |
| | | * |
| | | * @param {Object} param 检索配置 |
| | | * 参数对象结构可以参考 |
| | | * http://lbsyun.baidu.com/index.php?title=webapi/guide/webservice-placeapi |
| | | */ |
| | | search(param) { |
| | | var that = this; |
| | | param = param || {}; |
| | | let searchparam = { |
| | | query: param["query"] || '生活服务$美食&酒店', |
| | | scope: param["scope"] || 1, |
| | | filter: param["filter"] || '', |
| | | coord_type: param["coord_type"] || 2, |
| | | page_size: param["page_size"] || 10, |
| | | page_num: param["page_num"] || 0, |
| | | output: param["output"] || 'json', |
| | | ak: that.ak, |
| | | sn: param["sn"] || '', |
| | | timestamp: param["timestamp"] || '', |
| | | radius: param["radius"] || 2000, |
| | | ret_coordtype: 'gcj02ll' |
| | | }; |
| | | let otherparam = { |
| | | iconPath: param["iconPath"], |
| | | iconTapPath: param["iconTapPath"], |
| | | width: param["width"], |
| | | height: param["height"], |
| | | alpha: param["alpha"] || 1, |
| | | success: param["success"] || function () { }, |
| | | fail: param["fail"] || function () { } |
| | | }; |
| | | let type = 'gcj02'; |
| | | let locationsuccess = function (result) { |
| | | searchparam["location"] = result["latitude"] + ',' + result["longitude"]; |
| | | wx.request({ |
| | | url: 'https://api.map.baidu.com/place/v2/search', |
| | | data: searchparam, |
| | | header: { |
| | | "content-type": "application/json" |
| | | }, |
| | | method: 'GET', |
| | | success(data) { |
| | | let res = data["data"]; |
| | | if (res["status"] === 0) { |
| | | let poiArr = res["results"]; |
| | | // outputRes 包含两个对象, |
| | | // originalData为百度接口返回的原始数据 |
| | | // wxMarkerData为小程序规范的marker格式 |
| | | let outputRes = {}; |
| | | outputRes["originalData"] = res; |
| | | outputRes["wxMarkerData"] = []; |
| | | for (let i = 0; i < poiArr.length; i++) { |
| | | outputRes["wxMarkerData"][i] = { |
| | | id: i, |
| | | latitude: poiArr[i]["location"]["lat"], |
| | | longitude: poiArr[i]["location"]["lng"], |
| | | title: poiArr[i]["name"], |
| | | iconPath: otherparam["iconPath"], |
| | | iconTapPath: otherparam["iconTapPath"], |
| | | address: poiArr[i]["address"], |
| | | telephone: poiArr[i]["telephone"], |
| | | alpha: otherparam["alpha"], |
| | | width: otherparam["width"], |
| | | height: otherparam["height"] |
| | | } |
| | | } |
| | | otherparam.success(outputRes); |
| | | } else { |
| | | otherparam.fail({ |
| | | errMsg: res["message"], |
| | | statusCode: res["status"] |
| | | }); |
| | | } |
| | | }, |
| | | fail(data) { |
| | | otherparam.fail(data); |
| | | } |
| | | }); |
| | | } |
| | | let locationfail = function (result) { |
| | | otherparam.fail(result); |
| | | }; |
| | | let locationcomplete = function (result) { |
| | | }; |
| | | if (!param["location"]) { |
| | | that.getWXLocation(type, locationsuccess, locationfail, locationcomplete); |
| | | } else { |
| | | let longitude = param.location.split(',')[1]; |
| | | let latitude = param.location.split(',')[0]; |
| | | let errMsg = 'input location'; |
| | | let res = { |
| | | errMsg: errMsg, |
| | | latitude: latitude, |
| | | longitude: longitude |
| | | }; |
| | | locationsuccess(res); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * sug模糊检索 |
| | | * |
| | | * @param {Object} param 检索配置 |
| | | * 参数对象结构可以参考 |
| | | * http://lbsyun.baidu.com/index.php?title=webapi/place-suggestion-api |
| | | */ |
| | | suggestion(param) { |
| | | var that = this; |
| | | param = param || {}; |
| | | let suggestionparam = { |
| | | query: param["query"] || '', |
| | | region: param["region"] || '全国', |
| | | city_limit: param["city_limit"] || false, |
| | | output: param["output"] || 'json', |
| | | ak: that.ak, |
| | | sn: param["sn"] || '', |
| | | timestamp: param["timestamp"] || '', |
| | | ret_coordtype: 'gcj02ll' |
| | | }; |
| | | let otherparam = { |
| | | success: param["success"] || function () { }, |
| | | fail: param["fail"] || function () { } |
| | | }; |
| | | wx.request({ |
| | | url: 'https://api.map.baidu.com/place/v2/suggestion', |
| | | data: suggestionparam, |
| | | header: { |
| | | "content-type": "application/json" |
| | | }, |
| | | method: 'GET', |
| | | success(data) { |
| | | let res = data["data"]; |
| | | if (res["status"] === 0) { |
| | | otherparam.success(res); |
| | | } else { |
| | | otherparam.fail({ |
| | | errMsg: res["message"], |
| | | statusCode: res["status"] |
| | | }); |
| | | } |
| | | }, |
| | | fail(data) { |
| | | otherparam.fail(data); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | /** |
| | | * rgc检索(逆地理编码:经纬度->地点描述) |
| | | * |
| | | * @param {Object} param 检索配置 |
| | | * 参数对象结构可以参考 |
| | | * https://lbs.baidu.com/index.php?title=webapi/guide/webservice-geocoding-abroad |
| | | * |
| | | */ |
| | | regeocoding (param) { |
| | | var that = this; |
| | | param = param || {}; |
| | | let regeocodingparam = { |
| | | coordtype: param["coordtype"] || 'gcj02ll', |
| | | ret_coordtype: 'gcj02ll', |
| | | radius: param["radius"] || 1000, |
| | | ak: that.ak, |
| | | sn: param["sn"] || '', |
| | | output: param["output"] || 'json', |
| | | callback: param["callback"] || function () { }, |
| | | extensions_poi: param["extensions_poi"] || 1, |
| | | extensions_road: param["extensions_road"] || false, |
| | | extensions_town: param["extensions_town"] || false, |
| | | language: param["language"] || 'zh-CN', |
| | | language_auto: param["language_auto"] || 0 |
| | | }; |
| | | let otherparam = { |
| | | iconPath: param["iconPath"], |
| | | iconTapPath: param["iconTapPath"], |
| | | width: param["width"], |
| | | height: param["height"], |
| | | alpha: param["alpha"] || 1, |
| | | success: param["success"] || function () { }, |
| | | fail: param["fail"] || function () { } |
| | | }; |
| | | let type = 'gcj02'; |
| | | let locationsuccess = function (result) { |
| | | regeocodingparam["location"] = result["latitude"] + ',' + result["longitude"]; |
| | | wx.request({ |
| | | url: 'https://api.map.baidu.com/reverse_geocoding/v3', |
| | | data: regeocodingparam, |
| | | header: { |
| | | "content-type": "application/json" |
| | | }, |
| | | method: 'GET', |
| | | success(data) { |
| | | let res = data["data"]; |
| | | if (res["status"] === 0) { |
| | | let poiObj = res["result"]; |
| | | // outputRes 包含两个对象: |
| | | // originalData为百度接口返回的原始数据 |
| | | // wxMarkerData为小程序规范的marker格式 |
| | | let outputRes = {}; |
| | | outputRes["originalData"] = res; |
| | | outputRes["wxMarkerData"] = []; |
| | | outputRes["wxMarkerData"][0] = { |
| | | id: 0, |
| | | latitude: result["latitude"], |
| | | longitude: result["longitude"], |
| | | address: poiObj["formatted_address"], |
| | | iconPath: otherparam["iconPath"], |
| | | iconTapPath: otherparam["iconTapPath"], |
| | | desc: poiObj["sematic_description"], |
| | | business: poiObj["business"], |
| | | alpha: otherparam["alpha"], |
| | | width: otherparam["width"], |
| | | height: otherparam["height"] |
| | | } |
| | | otherparam.success(outputRes); |
| | | } else { |
| | | otherparam.fail({ |
| | | errMsg: res["message"], |
| | | statusCode: res["status"] |
| | | }); |
| | | } |
| | | }, |
| | | fail(data) { |
| | | otherparam.fail(data); |
| | | } |
| | | }); |
| | | }; |
| | | let locationfail = function (result) { |
| | | otherparam.fail(result); |
| | | } |
| | | let locationcomplete = function (result) { |
| | | }; |
| | | if (!param["location"]) { |
| | | that.getWXLocation(type, locationsuccess, locationfail, locationcomplete); |
| | | } else { |
| | | let longitude = param.location.split(',')[1]; |
| | | let latitude = param.location.split(',')[0]; |
| | | let errMsg = 'input location'; |
| | | let res = { |
| | | errMsg: errMsg, |
| | | latitude: latitude, |
| | | longitude: longitude |
| | | }; |
| | | locationsuccess(res); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * gc检索(地理编码:地点->经纬度) |
| | | * |
| | | * @param {Object} param 检索配置 |
| | | * 参数对象结构可以参考 |
| | | * https://lbs.baidu.com/index.php?title=webapi/guide/webservice-geocoding |
| | | * |
| | | */ |
| | | geocoding(param) { |
| | | var that = this; |
| | | param = param || {}; |
| | | let geocodingparam = { |
| | | address: param["address"] || '', |
| | | city: param["city"] || '', |
| | | ret_coordtype: param["coordtype"] || 'gcj02ll', |
| | | ak: that.ak, |
| | | sn: param["sn"] || '', |
| | | output: param["output"] || 'json', |
| | | callback: param["callback"] || function () { } |
| | | }; |
| | | let otherparam = { |
| | | iconPath: param["iconPath"], |
| | | iconTapPath: param["iconTapPath"], |
| | | width: param["width"], |
| | | height: param["height"], |
| | | alpha: param["alpha"] || 1, |
| | | success: param["success"] || function () { }, |
| | | fail: param["fail"] || function () { } |
| | | }; |
| | | if (param["address"]) { |
| | | wx.request({ |
| | | url: 'https://api.map.baidu.com/geocoding/v3', |
| | | data: geocodingparam, |
| | | header: { |
| | | "content-type": "application/json" |
| | | }, |
| | | method: 'GET', |
| | | success(data) { |
| | | let res = data["data"]; |
| | | if (res["status"] === 0){ |
| | | let poiObj = res["result"]; |
| | | // outputRes 包含两个对象: |
| | | // originalData为百度接口返回的原始数据 |
| | | // wxMarkerData为小程序规范的marker格式 |
| | | let outputRes = res; |
| | | outputRes["originalData"] = res; |
| | | outputRes["wxMarkerData"] = []; |
| | | outputRes["wxMarkerData"][0] = { |
| | | id: 0, |
| | | latitude: poiObj["location"]["lat"], |
| | | longitude: poiObj["location"]["lng"], |
| | | iconPath: otherparam["iconPath"], |
| | | iconTapPath: otherparam["iconTapPath"], |
| | | alpha: otherparam["alpha"], |
| | | width: otherparam["width"], |
| | | height: otherparam["height"] |
| | | } |
| | | otherparam.success(outputRes); |
| | | } else { |
| | | otherparam.fail({ |
| | | errMsg: res["message"], |
| | | statusCode: res["status"] |
| | | }); |
| | | } |
| | | }, |
| | | fail(data) { |
| | | otherparam.fail(data); |
| | | } |
| | | }); |
| | | } else { |
| | | let errMsg = 'input address!'; |
| | | let res = { |
| | | errMsg: errMsg |
| | | }; |
| | | otherparam.fail(res); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 天气检索 |
| | | * |
| | | * @param {Object} param 检索配置 |
| | | */ |
| | | weather(param) { |
| | | var that = this; |
| | | param = param || {}; |
| | | let weatherparam = { |
| | | coord_type: param["coord_type"] || 'gcj02', |
| | | output: param["output"] || 'json', |
| | | ak: that.ak, |
| | | sn: param["sn"] || '', |
| | | timestamp: param["timestamp"] || '' |
| | | }; |
| | | let otherparam = { |
| | | success: param["success"] || function () { }, |
| | | fail: param["fail"] || function () { } |
| | | }; |
| | | let type = 'gcj02'; |
| | | let locationsuccess = function (result) { |
| | | weatherparam["location"] = result["longitude"] + ',' + result["latitude"]; |
| | | wx.request({ |
| | | url: 'https://api.map.baidu.com/telematics/v3/weather', |
| | | data: weatherparam, |
| | | header: { |
| | | "content-type": "application/json" |
| | | }, |
| | | method: 'GET', |
| | | success(data) { |
| | | let res = data["data"]; |
| | | if (res["error"] === 0 && res["status"] === 'success') { |
| | | let weatherArr = res["results"]; |
| | | // outputRes 包含两个对象, |
| | | // originalData为百度接口返回的原始数据 |
| | | // wxMarkerData为小程序规范的marker格式 |
| | | let outputRes = {}; |
| | | outputRes["originalData"] = res; |
| | | outputRes["currentWeather"] = []; |
| | | outputRes["currentWeather"][0] = { |
| | | currentCity: weatherArr[0]["currentCity"], |
| | | pm25: weatherArr[0]["pm25"], |
| | | date: weatherArr[0]["weather_data"][0]["date"], |
| | | temperature: weatherArr[0]["weather_data"][0]["temperature"], |
| | | weatherDesc: weatherArr[0]["weather_data"][0]["weather"], |
| | | wind: weatherArr[0]["weather_data"][0]["wind"] |
| | | }; |
| | | otherparam.success(outputRes); |
| | | } else { |
| | | otherparam.fail({ |
| | | errMsg: res["message"], |
| | | statusCode: res["status"] |
| | | }); |
| | | } |
| | | }, |
| | | fail(data) { |
| | | otherparam.fail(data); |
| | | } |
| | | }); |
| | | } |
| | | let locationfail = function (result) { |
| | | otherparam.fail(result); |
| | | } |
| | | let locationcomplete = function (result) { |
| | | } |
| | | if (!param["location"]) { |
| | | that.getWXLocation(type, locationsuccess, locationfail, locationcomplete); |
| | | } else { |
| | | let longitude = param.location.split(',')[0]; |
| | | let latitude = param.location.split(',')[1]; |
| | | let errMsg = 'input location'; |
| | | let res = { |
| | | errMsg: errMsg, |
| | | latitude: latitude, |
| | | longitude: longitude |
| | | }; |
| | | locationsuccess(res); |
| | | } |
| | | } |
| | | } |
| | | |
| | | module.exports.BMapWX = BMapWX; |
New file |
| | |
| | | "use strict"; function _classCallCheck(t, a) { if (!(t instanceof a)) throw new TypeError("Cannot call a class as a function") } var _createClass = function () { function t(t, a) { for (var e = 0; e < a.length; e++) { var i = a[e]; i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(t, i.key, i) } } return function (a, e, i) { return e && t(a.prototype, e), i && t(a, i), a } }(), BMapWX = function () { function t(a) { _classCallCheck(this, t), this.ak = a.ak } return _createClass(t, [{ key: "getWXLocation", value: function (t, a, e, i) { t = t || "gcj02", a = a || function () { }, e = e || function () { }, i = i || function () { }, wx.getLocation({ type: t, success: a, fail: e, complete: i }) } }, { key: "search", value: function (t) { var a = this; t = t || {}; var e = { query: t.query || "生活服务$美食&酒店", scope: t.scope || 1, filter: t.filter || "", coord_type: t.coord_type || 2, page_size: t.page_size || 10, page_num: t.page_num || 0, output: t.output || "json", ak: a.ak, sn: t.sn || "", timestamp: t.timestamp || "", radius: t.radius || 2e3, ret_coordtype: "gcj02ll" }, i = { iconPath: t.iconPath, iconTapPath: t.iconTapPath, width: t.width, height: t.height, alpha: t.alpha || 1, success: t.success || function () { }, fail: t.fail || function () { } }, n = function (t) { e.location = t.latitude + "," + t.longitude, wx.request({ url: "https://api.map.baidu.com/place/v2/search", data: e, header: { "content-type": "application/json" }, method: "GET", success: function (t) { var a = t.data; if (0 === a.status) { var e = a.results, n = {}; n.originalData = a, n.wxMarkerData = []; for (var s = 0; s < e.length; s++)n.wxMarkerData[s] = { id: s, latitude: e[s].location.lat, longitude: e[s].location.lng, title: e[s].name, iconPath: i.iconPath, iconTapPath: i.iconTapPath, address: e[s].address, telephone: e[s].telephone, alpha: i.alpha, width: i.width, height: i.height }; i.success(n) } else i.fail({ errMsg: a.message, statusCode: a.status }) }, fail: function (t) { i.fail(t) } }) }, s = function (t) { i.fail(t) }, o = function (t) { }; if (t.location) { var c = t.location.split(",")[1]; n({ errMsg: "input location", latitude: t.location.split(",")[0], longitude: c }) } else a.getWXLocation("gcj02", n, s, o) } }, { key: "suggestion", value: function (t) { var a = this; t = t || {}; var e = { query: t.query || "", region: t.region || "全国", city_limit: t.city_limit || !1, output: t.output || "json", ak: a.ak, sn: t.sn || "", timestamp: t.timestamp || "", ret_coordtype: "gcj02ll" }, i = { success: t.success || function () { }, fail: t.fail || function () { } }; wx.request({ url: "https://api.map.baidu.com/place/v2/suggestion", data: e, header: { "content-type": "application/json" }, method: "GET", success: function (t) { var a = t.data; 0 === a.status ? i.success(a) : i.fail({ errMsg: a.message, statusCode: a.status }) }, fail: function (t) { i.fail(t) } }) } }, { key: "regeocoding", value: function (t) { var a = this; t = t || {}; var e = { coordtype: t.coordtype || "gcj02ll", ret_coordtype: "gcj02ll", radius: t.radius || 1e3, ak: a.ak, sn: t.sn || "", output: t.output || "json", callback: t.callback || function () { }, extensions_poi: t.extensions_poi || 1, extensions_road: t.extensions_road || !1, extensions_town: t.extensions_town || !1, language: t.language || "zh-CN", language_auto: t.language_auto || 0 }, i = { iconPath: t.iconPath, iconTapPath: t.iconTapPath, width: t.width, height: t.height, alpha: t.alpha || 1, success: t.success || function () { }, fail: t.fail || function () { } }, n = function (t) { e.location = t.latitude + "," + t.longitude, wx.request({ url: "https://api.map.baidu.com/reverse_geocoding/v3", data: e, header: { "content-type": "application/json" }, method: "GET", success: function (a) { var e = a.data; if (0 === e.status) { var n = e.result, s = {}; s.originalData = e, s.wxMarkerData = [], s.wxMarkerData[0] = { id: 0, latitude: t.latitude, longitude: t.longitude, address: n.formatted_address, iconPath: i.iconPath, iconTapPath: i.iconTapPath, desc: n.sematic_description, business: n.business, alpha: i.alpha, width: i.width, height: i.height }, i.success(s) } else i.fail({ errMsg: e.message, statusCode: e.status }) }, fail: function (t) { i.fail(t) } }) }, s = function (t) { i.fail(t) }, o = function (t) { }; if (t.location) { var c = t.location.split(",")[1]; n({ errMsg: "input location", latitude: t.location.split(",")[0], longitude: c }) } else a.getWXLocation("gcj02", n, s, o) } }, { key: "geocoding", value: function (t) { var a = this; t = t || {}; var e = { address: t.address || "", city: t.city || "", ret_coordtype: t.coordtype || "gcj02ll", ak: a.ak, sn: t.sn || "", output: t.output || "json", callback: t.callback || function () { } }, i = { iconPath: t.iconPath, iconTapPath: t.iconTapPath, width: t.width, height: t.height, alpha: t.alpha || 1, success: t.success || function () { }, fail: t.fail || function () { } }; if (t.address) wx.request({ url: "https://api.map.baidu.com/geocoding/v3", data: e, header: { "content-type": "application/json" }, method: "GET", success: function (t) { var a = t.data; if (0 === a.status) { var e = a.result, n = a; n.originalData = a, n.wxMarkerData = [], n.wxMarkerData[0] = { id: 0, latitude: e.location.lat, longitude: e.location.lng, iconPath: i.iconPath, iconTapPath: i.iconTapPath, alpha: i.alpha, width: i.width, height: i.height }, i.success(n) } else i.fail({ errMsg: a.message, statusCode: a.status }) }, fail: function (t) { i.fail(t) } }); else { var n = { errMsg: "input address!" }; i.fail(n) } } }, { key: "weather", value: function (t) { var a = this; t = t || {}; var e = { coord_type: t.coord_type || "gcj02", output: t.output || "json", ak: a.ak, sn: t.sn || "", timestamp: t.timestamp || "" }, i = { success: t.success || function () { }, fail: t.fail || function () { } }, n = function (t) { e.location = t.longitude + "," + t.latitude, wx.request({ url: "https://api.map.baidu.com/telematics/v3/weather", data: e, header: { "content-type": "application/json" }, method: "GET", success: function (t) { var a = t.data; if (0 === a.error && "success" === a.status) { var e = a.results, n = {}; n.originalData = a, n.currentWeather = [], n.currentWeather[0] = { currentCity: e[0].currentCity, pm25: e[0].pm25, date: e[0].weather_data[0].date, temperature: e[0].weather_data[0].temperature, weatherDesc: e[0].weather_data[0].weather, wind: e[0].weather_data[0].wind }, i.success(n) } else i.fail({ errMsg: a.message, statusCode: a.status }) }, fail: function (t) { i.fail(t) } }) }, s = function (t) { i.fail(t) }, o = function (t) { }; if (t.location) { var c = t.location.split(",")[0]; n({ errMsg: "input location", latitude: t.location.split(",")[1], longitude: c }) } else a.getWXLocation("gcj02", n, s, o) } }]), t }(); module.exports.BMapWX = BMapWX; |
| | |
| | | const BaiduMap = require('./bmap-wx.min') |
| | | |
| | | |
| | | const formatTime = date => { |
| | | const year = date.getFullYear() |
| | | const month = date.getMonth() + 1 |
| | |
| | | return n[1] ? n : '0' + n |
| | | } |
| | | const timestampToTime = (timestamp) => { |
| | | var date = new Date(timestamp); // 时间戳为10位需*1000,时间戳为13位的话不需乘1000 |
| | | var Y = date.getFullYear() + '-'; |
| | | var M = (date.getMonth() + 1 < 10 ? '0' + ( |
| | | date.getMonth() + 1 |
| | | ) : date.getMonth() + 1) + '-'; |
| | | var D = (date.getDate() + 1 < 10 ? '0' + ( |
| | | date.getDate() |
| | | ) : date.getDate()) + ' ' |
| | | var h = date.getHours() + ':'; |
| | | var m = date.getMinutes() + ':'; |
| | | var s = date.getSeconds(); |
| | | return Y + M + D + h + m + s; |
| | | var date = new Date(timestamp); // 时间戳为10位需*1000,时间戳为13位的话不需乘1000 |
| | | var Y = date.getFullYear() + '-'; |
| | | var M = (date.getMonth() + 1 < 10 ? '0' + ( |
| | | date.getMonth() + 1 |
| | | ) : date.getMonth() + 1) + '-'; |
| | | var D = (date.getDate() + 1 < 10 ? '0' + ( |
| | | date.getDate() |
| | | ) : date.getDate()) + ' ' |
| | | var h = date.getHours() + ':'; |
| | | var m = date.getMinutes() + ':'; |
| | | var s = date.getSeconds(); |
| | | return Y + M + D + h + m + s; |
| | | } |
| | | //时分秒换算 |
| | | const date_format =(micro_second) => { |
| | | // 总秒数 |
| | | var second = Math.floor(micro_second / 1000); |
| | | // 天数 |
| | | var day = Math.floor(second / 3600 / 24); |
| | | // 小时 |
| | | var hr = Math.floor(second / 3600 % 24); |
| | | // 分钟 |
| | | var min = Math.floor(second / 60 % 60); |
| | | // 秒 |
| | | var sec = Math.floor(second % 60); |
| | | return day + "天" + hr + "小时"+' '+ min + ":" + sec ; |
| | | }; |
| | | const date_format = (micro_second) => { |
| | | // 总秒数 |
| | | var second = Math.floor(micro_second / 1000); |
| | | // 天数 |
| | | var day = Math.floor(second / 3600 / 24); |
| | | // 小时 |
| | | var hr = Math.floor(second / 3600 % 24); |
| | | // 分钟 |
| | | var min = Math.floor(second / 60 % 60); |
| | | // 秒 |
| | | var sec = Math.floor(second % 60); |
| | | return day + "天" + hr + "小时" + ' ' + min + ":" + sec; |
| | | }; |
| | | |
| | | |
| | | export const getSetting = () => { |
| | | wx.getSetting({ |
| | | success: (res) => { |
| | | if(res.authSetting['scope.userLocation']==false){ |
| | | wx.showModal({ |
| | | content: '检测到您没打开定位权限,是否去设置打开?', |
| | | confirmText: "确认", |
| | | cancelText: "取消", |
| | | success:(res)=>{ |
| | | if(res.confirm){ |
| | | wx.openSetting({ |
| | | export const getSetting = () => { |
| | | wx.getSetting({ |
| | | success: (res) => { |
| | | if (res.authSetting['scope.userLocation'] == false) { |
| | | wx.showModal({ |
| | | content: '检测到您没打开定位权限,是否去设置打开?', |
| | | confirmText: "确认", |
| | | cancelText: "取消", |
| | | success: (res) => { |
| | | if (res.confirm) { |
| | | wx.openSetting({ |
| | | success: (res) => { |
| | | if (res.authSetting['scope.userLocation'] == true) { |
| | | wx.showToast({ |
| | | title: '授权成功', |
| | | icon: 'success', |
| | | duration: 1000 |
| | | }) |
| | | //接入百度地图方法 |
| | | var bmap = new BaiduMap.BMapWX({ |
| | | ak: 'fi3HGJjW153NCNsaTb9FekxeX1Lj3auo' // 必填,您的key |
| | | }) |
| | | bmap.regeocoding({ |
| | | // coordtype:'bd09ll', |
| | | success: (res) => { |
| | | if(res.authSetting['scope.userLocation']==true){ |
| | | wx.showToast({ |
| | | title: '授权成功', |
| | | icon:'success', |
| | | duration:1000 |
| | | }) |
| | | //接入高地地图调用..... |
| | | // var myAmapFun = new GdMap.AMapWX({ key: 'a825dd33982ba213f2be3e83ad2f9a9b' }); |
| | | var myAmapFun = new GdMap.AMapWX({ key: '386d4020bf067658716dba6c38bc91dd' }); |
| | | myAmapFun.getRegeo({ |
| | | success: (res) => { |
| | | // that.setData({ |
| | | // cityName:res[0].regeocodeData.addressComponent.city, |
| | | // latitude: res[0].latitude, |
| | | // longitude:res[0].longitude, |
| | | // adcode:res[0].regeocodeData.addressComponent.adcode, |
| | | // cityNameStart:res[0].name, |
| | | // district:res[0].regeocodeData.addressComponent.province, |
| | | // formatted_address:res[0].regeocodeData.formatted_address |
| | | // }) |
| | | wx.setStorageSync('latitude', res[0].latitude) |
| | | wx.setStorageSync('longitude', res[0].longitude) |
| | | wx.setStorageSync('adcode', res[0].regeocodeData.addressComponent.adcode) |
| | | wx.setStorageSync('cityName', res[0].regeocodeData.addressComponent.city) |
| | | wx.setStorageSync('cityNameStart', res[0].name) |
| | | wx.setStorageSync('district', res[0].regeocodeData.addressComponent.district) |
| | | wx.setStorageSync('province', res[0].regeocodeData.addressComponent.province) |
| | | wx.setStorageSync('formatted_address', res[0].regeocodeData.formatted_address) |
| | | } |
| | | }) |
| | | } |
| | | }, |
| | | // that.setData({ |
| | | // cityName:res[0].regeocodeData.addressComponent.city, |
| | | // latitude: res[0].latitude, |
| | | // longitude:res[0].longitude, |
| | | // adcode:res[0].regeocodeData.addressComponent.adcode, |
| | | // cityNameStart:res[0].name, |
| | | // district:res[0].regeocodeData.addressComponent.province, |
| | | // formatted_address:res[0].regeocodeData.formatted_address |
| | | // }) |
| | | wx.setStorageSync('latitude', res.originalData.result.location.lat) |
| | | wx.setStorageSync('longitude', res.originalData.result.location.lng) |
| | | wx.setStorageSync('adcode', res.originalData.result.addressComponent.adcode) |
| | | wx.setStorageSync('cityName', res.originalData.result.addressComponent.city) |
| | | wx.setStorageSync('cityNameStart', res.originalData.result.pois[0].addr) |
| | | wx.setStorageSync('district', res.originalData.result.addressComponent.district) |
| | | wx.setStorageSync('province', res.originalData.result.addressComponent.province) |
| | | wx.setStorageSync('formatted_address', res.originalData.result.formatted_address) |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | }) |
| | | }, |
| | | }) |
| | | } |
| | | } |
| | | }, |
| | | }) |
| | | }; |
| | | }) |
| | | } |
| | | }, |
| | | }) |
| | | }; |
| | | // |
| | | export const sizeNum = (obj, num = 2) => { |
| | | var str = ""; |
| | | var obj = obj.toString(); |
| | | if (obj.length > num) { |
| | | return `${obj}`; |
| | | } |
| | | for (var i = 1; i < num + 1; i++) { |
| | | if (obj.length == i) { |
| | | for (var j = 0; j < num - i; j++) { |
| | | str += "0"; |
| | | } |
| | | return `${str}${obj}`; |
| | | } |
| | | var str = ""; |
| | | var obj = obj.toString(); |
| | | if (obj.length > num) { |
| | | return `${obj}`; |
| | | } |
| | | for (var i = 1; i < num + 1; i++) { |
| | | if (obj.length == i) { |
| | | for (var j = 0; j < num - i; j++) { |
| | | str += "0"; |
| | | } |
| | | return `${str}${obj}`; |
| | | } |
| | | } |
| | | }; |
| | | |
| | | //js 查询当前星期几 |
| | | function get7Days(daysTime){ |
| | | //获取系统当前时间 |
| | | var now = new Date(); |
| | | var nowTime = daysTime||now.getTime() ; |
| | | var oneDayTime = 24*60*60*1000 ; |
| | | var day = [] |
| | | for(var i = 0 ; i < 6 ; i++){ |
| | | //显示周一 |
| | | var ShowTime = nowTime + i*oneDayTime ; |
| | | //初始化日期时间 |
| | | var myDate = new Date(ShowTime); |
| | | var year=myDate.getFullYear(); |
| | | var month=myDate.getMonth()+1; |
| | | var date=myDate.getDate(); |
| | | var str = "星期" + "日一二三四五六".charAt(myDate.getDay()); |
| | | var arr = { |
| | | days :month+"/"+date, |
| | | str:str, |
| | | year:year+"-"+month+"-"+date |
| | | } |
| | | day.push(arr) |
| | | } |
| | | return day |
| | | function get7Days(daysTime) { |
| | | //获取系统当前时间 |
| | | var now = new Date(); |
| | | var nowTime = daysTime || now.getTime(); |
| | | var oneDayTime = 24 * 60 * 60 * 1000; |
| | | var day = [] |
| | | for (var i = 0; i < 6; i++) { |
| | | //显示周一 |
| | | var ShowTime = nowTime + i * oneDayTime; |
| | | //初始化日期时间 |
| | | var myDate = new Date(ShowTime); |
| | | var year = myDate.getFullYear(); |
| | | var month = myDate.getMonth() + 1; |
| | | var date = myDate.getDate(); |
| | | var str = "星期" + "日一二三四五六".charAt(myDate.getDay()); |
| | | var arr = { |
| | | days: month + "/" + date, |
| | | str: str, |
| | | year: year + "-" + month + "-" + date |
| | | } |
| | | day.push(arr) |
| | | } |
| | | return day |
| | | } |
| | | |
| | | const OBSupload = function(filePath) { |
| | | const OBSupload = function (filePath) { |
| | | return new Promise(resolve => { |
| | | if (!filePath) { |
| | | uni.showToast({ |
| | | title: "文件路径不能为空", |
| | | icon: "请重新选择路径", |
| | | }); |
| | | return; |
| | | } |
| | | const fileName = "wximg" + new Date().getTime() + ".png"; //"testMiniprogram.jpg"; //指定上传 |
| | | console.log("开始上传----"); |
| | | wx.uploadFile({ |
| | | url: 'https://jiayixing-bucket.oss-cn-beijing.aliyuncs.com', |
| | | filePath: filePath, |
| | | name: "file", |
| | | formData: { |
| | | key: fileName, |
| | | }, |
| | | success: function(res) { |
| | | if (res.statusCode == "204") { |
| | | console.log("上传图片成功", res); |
| | | resolve({ |
| | | status: "ok", |
| | | data: `${'https://xn95128.cn/user-server/upload/image'.EndPoint}/${fileName}`, |
| | | // xgj |
| | | url: "https://jiayixing-bucket.oss-cn-beijing.aliyuncs.com/" + fileName |
| | | }); |
| | | wx.showToast({ |
| | | title: "上传成功", |
| | | }); |
| | | } else { |
| | | console.log("上传图片失败", res); |
| | | wx.showToast({ |
| | | title: "上传失败", |
| | | icon: "fail", |
| | | }); |
| | | } |
| | | }, |
| | | fail: function(e) { |
| | | console.log("上传失败", e); |
| | | }, |
| | | if (!filePath) { |
| | | uni.showToast({ |
| | | title: "文件路径不能为空", |
| | | icon: "请重新选择路径", |
| | | }); |
| | | return; |
| | | } |
| | | const fileName = "wximg" + new Date().getTime() + ".png"; //"testMiniprogram.jpg"; //指定上传 |
| | | console.log("开始上传----"); |
| | | wx.uploadFile({ |
| | | url: 'https://jiayixing-bucket.oss-cn-beijing.aliyuncs.com', |
| | | filePath: filePath, |
| | | name: "file", |
| | | formData: { |
| | | key: fileName, |
| | | }, |
| | | success: function (res) { |
| | | if (res.statusCode == "204") { |
| | | console.log("上传图片成功", res); |
| | | resolve({ |
| | | status: "ok", |
| | | data: `${'https://xn95128.cn/user-server/upload/image'.EndPoint}/${fileName}`, |
| | | // xgj |
| | | url: "https://jiayixing-bucket.oss-cn-beijing.aliyuncs.com/" + fileName |
| | | }); |
| | | wx.showToast({ |
| | | title: "上传成功", |
| | | }); |
| | | } else { |
| | | console.log("上传图片失败", res); |
| | | wx.showToast({ |
| | | title: "上传失败", |
| | | icon: "fail", |
| | | }); |
| | | } |
| | | }, |
| | | fail: function (e) { |
| | | console.log("上传失败", e); |
| | | }, |
| | | }); |
| | | }); |
| | | }; |
| | | |
| | | // 封装post请求 |
| | | const post = (url,data) => { |
| | | const post = (url, data) => { |
| | | |
| | | wx.showLoading({}) |
| | | var promise = new Promise((resolve, reject) => { |
| | |
| | | url: url, |
| | | data: data, |
| | | method: 'POST', |
| | | header: { |
| | | header: { |
| | | "content-type": "application/x-www-form-urlencoded", |
| | | Authorization: "Bearer" + " " + wx.getStorageSync('token'), |
| | | }, |
| | | success: function (res) {//服务器返回数据 |
| | | console.log(res,'========================'); |
| | | success: function (res) { //服务器返回数据 |
| | | console.log(res, '========================'); |
| | | if (res.statusCode == 200) { |
| | | resolve(res); |
| | | wx.hideLoading({}) |
| | | } |
| | | if((res.data.message=='token验证失败'||res.data.message=='TOKEN_INVALID')&&wx.getStorageSync('token')&&wx.getStorageSync('token')!=='quit'){ |
| | | } |
| | | if ((res.data.message == 'token验证失败' || res.data.message == 'TOKEN_INVALID') && wx.getStorageSync('token') && wx.getStorageSync('token') !== 'quit') { |
| | | wx.showModal({ |
| | | title: '提示', |
| | | content: '登录过期是否重新登录', |
| | | showCancel: true, |
| | | confirmText:"确定",//默认是“确定” |
| | | confirmColor: '#F07207',//确定文字的颜色 |
| | | success: (res) =>{ |
| | | if (res.cancel) { |
| | | //点击取消,默认隐藏弹框 |
| | | } else { |
| | | wx.redirectTo({ |
| | | url: '/pages/index/index', |
| | | }) |
| | | clearInterval(app.globalData.comparisonToken) |
| | | } |
| | | confirmText: "确定", //默认是“确定” |
| | | confirmColor: '#F07207', //确定文字的颜色 |
| | | success: (res) => { |
| | | if (res.cancel) { |
| | | //点击取消,默认隐藏弹框 |
| | | } else { |
| | | wx.redirectTo({ |
| | | url: '/pages/index/index', |
| | | }) |
| | | clearInterval(app.globalData.comparisonToken) |
| | | } |
| | | }, |
| | | fail: function (res) { },//接口调用失败的回调函数 |
| | | complete: function (res) { },//接口调用结束的回调函数(调用成功、失败都会执行) |
| | | }) |
| | | fail: function (res) {}, //接口调用失败的回调函数 |
| | | complete: function (res) {}, //接口调用结束的回调函数(调用成功、失败都会执行) |
| | | }) |
| | | } |
| | | if(res.data.code == 600&&(wx.getStorageSync('token')==''||wx.getStorageSync('token')=='quit')){ |
| | | if (res.data.code == 600 && (wx.getStorageSync('token') == '' || wx.getStorageSync('token') == 'quit')) { |
| | | wx.redirectTo({ |
| | | url: '/pages/index/index', |
| | | }) |
| | | } |
| | | resolve(res) |
| | | }, |
| | | fail:function(e){ |
| | | fail: function (e) { |
| | | wx.showToast({ |
| | | title: '网络错误', |
| | | image:null, |
| | | icon:"none", |
| | | duration:3000 |
| | | image: null, |
| | | icon: "none", |
| | | duration: 3000 |
| | | }) |
| | | wx.hideLoading({}) |
| | | console.log(e) |
| | |
| | | 'content-type': 'application/json', |
| | | 'token': wx.getStorageSync('token') |
| | | }, |
| | | success: function (res) {//服务器返回数据 |
| | | success: function (res) { //服务器返回数据 |
| | | if (res.statusCode == 200) { |
| | | resolve(res); |
| | | wx.hideLoading({}) |
| | | } |
| | | if((res.data.message=='token验证失败'||res.data.message=='TOKEN_INVALID')&&wx.getStorageSync('token')&&wx.getStorageSync('token')!=='quit'){ |
| | | } |
| | | if ((res.data.message == 'token验证失败' || res.data.message == 'TOKEN_INVALID') && wx.getStorageSync('token') && wx.getStorageSync('token') !== 'quit') { |
| | | wx.showModal({ |
| | | title: '提示', |
| | | content: '登录过期是否重新登录', |
| | | showCancel: true, |
| | | confirmText:"确定",//默认是“确定” |
| | | confirmColor: '#F07207',//确定文字的颜色 |
| | | success: (res) =>{ |
| | | if (res.cancel) { |
| | | //点击取消,默认隐藏弹框 |
| | | } else { |
| | | wx.redirectTo({ |
| | | url: '/pages/index/index', |
| | | }) |
| | | clearInterval(app.globalData.comparisonToken) |
| | | } |
| | | confirmText: "确定", //默认是“确定” |
| | | confirmColor: '#F07207', //确定文字的颜色 |
| | | success: (res) => { |
| | | if (res.cancel) { |
| | | //点击取消,默认隐藏弹框 |
| | | } else { |
| | | wx.redirectTo({ |
| | | url: '/pages/index/index', |
| | | }) |
| | | clearInterval(app.globalData.comparisonToken) |
| | | } |
| | | }, |
| | | fail: function (res) { },//接口调用失败的回调函数 |
| | | complete: function (res) { },//接口调用结束的回调函数(调用成功、失败都会执行) |
| | | }) |
| | | fail: function (res) {}, //接口调用失败的回调函数 |
| | | complete: function (res) {}, //接口调用结束的回调函数(调用成功、失败都会执行) |
| | | }) |
| | | } |
| | | if(res.data.code == 600&&(wx.getStorageSync('token')==''||wx.getStorageSync('token')=='quit')){ |
| | | if (res.data.code == 600 && (wx.getStorageSync('token') == '' || wx.getStorageSync('token') == 'quit')) { |
| | | wx.redirectTo({ |
| | | url: '/pages/index/index', |
| | | }) |
| | | } |
| | | resolve(res) |
| | | }, |
| | | fail:function(e){ |
| | | fail: function (e) { |
| | | wx.showToast({ |
| | | title: '网络错误', |
| | | image:null, |
| | | icon:"none", |
| | | duration:3000 |
| | | }) |
| | | wx.hideLoading({}) |
| | | reject(e); |
| | | title: '网络错误', |
| | | image: null, |
| | | icon: "none", |
| | | duration: 3000 |
| | | }) |
| | | wx.hideLoading({}) |
| | | reject(e); |
| | | } |
| | | }) |
| | | }); |
| | | return promise; |
| | | } |
| | | var areaList={ |
| | | var areaList = { |
| | | |
| | | province_list: { |
| | | 110000: '北京市', |
| | |
| | | return map.get(parseInt(value)) || "暂无" |
| | | } |
| | | |
| | | const getDateDiff = function GetDateDiff(startDate,endDate = new Date().getTime()) { |
| | | const getDateDiff = function GetDateDiff(startDate, endDate = new Date().getTime()) { |
| | | let time = endDate - startDate; |
| | | console.log(time); |
| | | } |
| | | |
| | | const farmatTimeJuli = function(endTime) { |
| | | const farmatTimeJuli = function (endTime) { |
| | | let end = endTime.replaceAll("-", "/") |
| | | var endTimeTeam = new Date(end).getTime(); |
| | | var nowTimeTeam = new Date().getTime(); |
| | | if(endTimeTeam - nowTimeTeam < 0) { |
| | | if (endTimeTeam - nowTimeTeam < 0) { |
| | | return false |
| | | } |
| | | let gutterTime = Number((endTimeTeam - nowTimeTeam) / 86400000); |
| | |
| | | formatTime: formatTime, |
| | | post, |
| | | get, |
| | | formatTimeUser:formatTimeUser, |
| | | formatTimeUser: formatTimeUser, |
| | | OBSupload, |
| | | get7Days, |
| | | timestampToTime, |
| | |
| | | formatOrderType, |
| | | getDateDiff, |
| | | farmatTimeJuli |
| | | } |
| | | } |