| | |
| | | |
| | | 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); |
| | |
| | | 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.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.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) |
| | | // bmap.regeocoding({ |
| | | // 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.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) |
| | | // } |
| | | // }) |
| | | wx.getLocation({ |
| | | // isHighAccuracy:true, |
| | | type: 'gcj02', |
| | | success: res => { |
| | | that.setData({ |
| | | latitude: res.latitude, |
| | | longitude: res.longitude |
| | | }) |
| | | wx.setStorageSync('latitude', res.latitude) |
| | | wx.setStorageSync('longitude', res.longitude) |
| | | wx.request({ |
| | | url: `https://api.map.baidu.com/geoconv/v2/?coords=${res.longitude},${res.latitude}&model=1&ak=3mHKIXMArjgIkgADzOlTYp4XssNSNkwr`, |
| | | success: function (res) { |
| | | bmap.regeocoding({ |
| | | coordtype: 'bd09ll', |
| | | location: res.data.result[0].y + ',' + res.data.result[0].x, |
| | | success: function (res) { |
| | | // that.setData({ |
| | | // 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('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: function (res) { |
| | | that.setData({ |
| | | cityNameStart: "正在定位中" |
| | | }) |
| | | }, |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | |
| | | ak: 'fi3HGJjW153NCNsaTb9FekxeX1Lj3auo' // 必填,您的key |
| | | }) |
| | | |
| | | bmap.regeocoding({ |
| | | coordtype: 'bd09ll', |
| | | success: (res) => { |
| | | wx.getLocation({ |
| | | // isHighAccuracy:true, |
| | | type: 'gcj02', |
| | | success: res => { |
| | | that.setData({ |
| | | 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 |
| | | latitude: res.latitude, |
| | | longitude: res.longitude |
| | | }) |
| | | //获取城市 |
| | | 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) |
| | | wx.setStorageSync('latitude', res.latitude) |
| | | wx.setStorageSync('longitude', res.longitude) |
| | | wx.request({ |
| | | url: `https://api.map.baidu.com/geoconv/v2/?coords=${res.longitude},${res.latitude}&model=1&ak=3mHKIXMArjgIkgADzOlTYp4XssNSNkwr`, |
| | | success: function (res) { |
| | | bmap.regeocoding({ |
| | | coordtype: 'bd09ll', |
| | | location: res.data.result[0].y + ',' + res.data.result[0].x, |
| | | success: function (res) { |
| | | that.setData({ |
| | | 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('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: function (res) { |
| | | that.setData({ |
| | | cityNameStart: "正在定位中" |
| | | }) |
| | | }, |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | } else { |
| | |
| | | ak: 'fi3HGJjW153NCNsaTb9FekxeX1Lj3auo' // 必填,您的key |
| | | }) |
| | | |
| | | bmap.regeocoding({ |
| | | coordtype: 'bd09ll', |
| | | success: (res) => { |
| | | wx.getLocation({ |
| | | // isHighAccuracy:true, |
| | | type: 'gcj02', |
| | | success: res => { |
| | | that.setData({ |
| | | 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 |
| | | latitude: res.latitude, |
| | | longitude: res.longitude |
| | | }) |
| | | //获取城市 |
| | | 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) |
| | | console.log('7878787878787////////////////'); |
| | | wx.setStorageSync('latitude', res.latitude) |
| | | wx.setStorageSync('longitude', res.longitude) |
| | | wx.request({ |
| | | url: `https://api.map.baidu.com/geoconv/v2/?coords=${res.longitude},${res.latitude}&model=1&ak=3mHKIXMArjgIkgADzOlTYp4XssNSNkwr`, |
| | | success: function (res) { |
| | | bmap.regeocoding({ |
| | | coordtype: 'bd09ll', |
| | | location: res.data.result[0].y + ',' + res.data.result[0].x, |
| | | success: function (res) { |
| | | that.setData({ |
| | | 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('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: function (res) { |
| | | that.setData({ |
| | | cityNameStart: "正在定位中" |
| | | }) |
| | | }, |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | |
| | | ak: 'fi3HGJjW153NCNsaTb9FekxeX1Lj3auo' // 必填,您的key |
| | | }) |
| | | wx.getLocation({ |
| | | // isHighAccuracy:true, |
| | | type: 'gcj02', |
| | | success: res => { |
| | | that.setData({ |
| | | latitude: res.latitude, |
| | | longitude: res.longitude |
| | | }) |
| | | console.log('wewaeawewaq2e12', res); |
| | | wx.setStorageSync('latitude', res.latitude) |
| | | wx.setStorageSync('longitude', res.longitude) |
| | | wx.request({ |
| | | url: `https://api.map.baidu.com/geoconv/v2/?coords=${res.longitude},${res.latitude}&model=1&ak=3mHKIXMArjgIkgADzOlTYp4XssNSNkwr`, |
| | | success: function (res) { |
| | | console.log('weqwewqeqwe41545454545545445', res); |
| | | bmap.regeocoding({ |
| | | coordtype: 'bd09ll', |
| | | location: res.data.result[0].y + ',' + res.data.result[0].x, |
| | | success: function (res) { |
| | | success: (res) => { |
| | | console.log('shuju//////////////////', res); |
| | | that.setData({ |
| | | cityName: res.originalData.result.addressComponent.city, |
| | | // latitude: res.originalData.result.location.lat, |
| | |
| | | travelTime: this.data.date, |
| | | payManner: this.data.modeSelectId == 2 ? 3 : this.data.payModel == '线上计费' ? 1 : 2 |
| | | } |
| | | if (btnCarData.endLon) { |
| | | wx.request({ |
| | | url: `https://api.map.baidu.com/geoconv/v2/?coords=${btnCarData.startLon},${btnCarData.startLat};${btnCarData.endLon},${btnCarData.endLat}&model=1&ak=3mHKIXMArjgIkgADzOlTYp4XssNSNkwr`, |
| | | success: (res) => { |
| | | btnCarData.startLon = res.data.result[0].x |
| | | btnCarData.startLat = res.data.result[0].y |
| | | btnCarData.endLon = res.data.result[1]?.x |
| | | btnCarData.endLat = res.data.result[1]?.y |
| | | if (Object.keys(btnCarData).length == 17) { |
| | | btnCarData.oldPeople = Number(!mode) |
| | | if (Number(!mode)) { |
| | | btnCarData.endAddress = '' |
| | | btnCarData.endLat = '' |
| | | btnCarData.endLon = '' |
| | | this.setData({ |
| | | endAddress: '', |
| | | nextLatitude: '', |
| | | nextLongitude: '', |
| | | }) |
| | | } |
| | | unit.post(app.globalData.Url + '/api/taxi/taxiOrder', |
| | | btnCarData, |
| | | ) |
| | | .then((res) => { |
| | | if (res.data.code == 200) { |
| | | wx.setStorageSync('orderID', res.data.data.id) |
| | | wx.navigateTo({ |
| | | url: '../../pages/waiting/waiting?startAddress=' + |
| | | (this.data.changeStartName || this.data.cityNameStart) + '&startLat=' + |
| | | startLat + '&startLon=' + |
| | | startLon + '&endAddress=' + |
| | | this.data.endAddress + '&endLat=' + |
| | | this.data.nextLatitude + '&endLon=' + |
| | | this.data.nextLongitude + '&time=' + |
| | | this.data.date + '&orderType=' + 2 + "&onekey=" + |
| | | index |
| | | |
| | | wx.request({ |
| | | url: `https://api.map.baidu.com/geoconv/v2/?coords=${btnCarData.startLon},${btnCarData.startLat};${btnCarData.endLon},${btnCarData.endLat}&model=1&ak=3mHKIXMArjgIkgADzOlTYp4XssNSNkwr`, |
| | | success: (res) => { |
| | | btnCarData.startLon = res.data.result[0].x |
| | | btnCarData.startLat = res.data.result[0].y |
| | | btnCarData.endLon = res.data.result[1].x |
| | | btnCarData.endLat = res.data.result[1].y |
| | | if (Object.keys(btnCarData).length == 17) { |
| | | btnCarData.oldPeople = Number(!mode) |
| | | if (Number(!mode)) { |
| | | btnCarData.endAddress = '' |
| | | btnCarData.endLat = '' |
| | | btnCarData.endLon = '' |
| | | this.setData({ |
| | | endAddress: '', |
| | | nextLatitude: '', |
| | | nextLongitude: '', |
| | | }) |
| | | } |
| | | |
| | | |
| | | unit.post(app.globalData.Url + '/api/taxi/taxiOrder', |
| | | btnCarData, |
| | | ) |
| | | .then((res) => { |
| | | if (res.data.code == 200) { |
| | | wx.setStorageSync('orderID', res.data.data.id) |
| | | wx.navigateTo({ |
| | | url: '../../pages/waiting/waiting?startAddress=' + |
| | | (this.data.changeStartName || this.data.cityNameStart) + '&startLat=' + |
| | | startLat + '&startLon=' + |
| | | startLon + '&endAddress=' + |
| | | this.data.endAddress + '&endLat=' + |
| | | this.data.nextLatitude + '&endLon=' + |
| | | this.data.nextLongitude + '&time=' + |
| | | this.data.date + '&orderType=' + 2 + "&onekey=" + |
| | | index |
| | | |
| | | }) |
| | | this.setData({ |
| | | btnDisabled: false, |
| | | startChangeCar: true, //没有选择之前底部样式 |
| | | endChangeCar: false, //选择起始点以后底部样式 |
| | | nextCityName: "您要去哪儿", |
| | | yyTime: "现在", |
| | | tip: "0元", |
| | | markers: "", |
| | | points: "", |
| | | polyline: [], |
| | | showLocationIcon: true, |
| | | changephone: "", |
| | | changePeople: "更换乘车人", |
| | | startLon: "", |
| | | startLat: "", |
| | | nextBoolean: false, |
| | | |
| | | endAddress: '', |
| | | endLat: '', |
| | | endLon: '', |
| | | |
| | | }) |
| | | } else if (res.data.code == 600 || res.data.code == 700) { |
| | | // 清空本地token |
| | | wx.navigateTo({ |
| | | url: '/pages/index/index', |
| | | }) |
| | | setTimeout(() => { |
| | | this.setData({ |
| | | btnDisabled: false |
| | | }) |
| | | }) |
| | | } else if (res.data.code == 500) { |
| | | if (res.data.msg == '有未完成的订单') { |
| | | this.getNowOrder() |
| | | this.setData({ |
| | | btnDisabled: false, |
| | | startChangeCar: true, //没有选择之前底部样式 |
| | | endChangeCar: false, //选择起始点以后底部样式 |
| | | nextCityName: "您要去哪儿", |
| | | yyTime: "现在", |
| | | tip: "0元", |
| | | markers: "", |
| | | points: "", |
| | | polyline: [], |
| | | showLocationIcon: true, |
| | | changephone: "", |
| | | changePeople: "更换乘车人", |
| | | startLon: "", |
| | | startLat: "", |
| | | nextBoolean: false, |
| | | |
| | | endAddress: '', |
| | | endLat: '', |
| | | endLon: '', |
| | | |
| | | }) |
| | | } else if (res.data.code == 600 || res.data.code == 700) { |
| | | // 清空本地token |
| | | wx.navigateTo({ |
| | | url: '/pages/index/index', |
| | | }) |
| | | setTimeout(() => { |
| | | this.setData({ |
| | | btnDisabled: false |
| | | }) |
| | | }) |
| | | } else if (res.data.code == 500) { |
| | | if (res.data.msg == '有未完成的订单') { |
| | | this.getNowOrder() |
| | | } else { |
| | | app.showToastSuccess(res.data.msg, null, 'none', 1500) |
| | | } |
| | | |
| | | setTimeout(() => { |
| | | this.setData({ |
| | | btnDisabled: false |
| | | }) |
| | | }, 2000) |
| | | } else { |
| | | setTimeout(() => { |
| | | this.setData({ |
| | | btnDisabled: false |
| | | }) |
| | | }, 2000) |
| | | app.showToastSuccess(res.data.msg, null, 'none', 1500) |
| | | } |
| | | }) |
| | | } else { |
| | | setTimeout(() => { |
| | | this.setData({ |
| | | btnDisabled: false |
| | | }) |
| | | }, 2000) |
| | | app.showToastSuccess('参数错误', null, 'none', 1500) |
| | | } |
| | | }, |
| | | }) |
| | | } else { |
| | | wx.request({ |
| | | url: `https://api.map.baidu.com/geoconv/v2/?coords=${btnCarData.startLon},${btnCarData.startLat}&model=1&ak=3mHKIXMArjgIkgADzOlTYp4XssNSNkwr`, |
| | | success: (res) => { |
| | | btnCarData.startLon = res.data.result[0].x |
| | | btnCarData.startLat = res.data.result[0].y |
| | | btnCarData.endLon = res.data.result[1]?.x |
| | | btnCarData.endLat = res.data.result[1]?.y |
| | | if (Object.keys(btnCarData).length == 17) { |
| | | btnCarData.oldPeople = Number(!mode) |
| | | if (Number(!mode)) { |
| | | btnCarData.endAddress = '' |
| | | btnCarData.endLat = '' |
| | | btnCarData.endLon = '' |
| | | this.setData({ |
| | | endAddress: '', |
| | | nextLatitude: '', |
| | | nextLongitude: '', |
| | | }) |
| | | } |
| | | unit.post(app.globalData.Url + '/api/taxi/taxiOrder', |
| | | btnCarData, |
| | | ) |
| | | .then((res) => { |
| | | if (res.data.code == 200) { |
| | | wx.setStorageSync('orderID', res.data.data.id) |
| | | wx.navigateTo({ |
| | | url: '../../pages/waiting/waiting?startAddress=' + |
| | | (this.data.changeStartName || this.data.cityNameStart) + '&startLat=' + |
| | | startLat + '&startLon=' + |
| | | startLon + '&endAddress=' + |
| | | this.data.endAddress + '&endLat=' + |
| | | this.data.nextLatitude + '&endLon=' + |
| | | this.data.nextLongitude + '&time=' + |
| | | this.data.date + '&orderType=' + 2 + "&onekey=" + |
| | | index |
| | | |
| | | setTimeout(() => { |
| | | this.setData({ |
| | | btnDisabled: false |
| | | }) |
| | | }, 2000) |
| | | } else { |
| | | setTimeout(() => { |
| | | this.setData({ |
| | | btnDisabled: false |
| | | btnDisabled: false, |
| | | startChangeCar: true, //没有选择之前底部样式 |
| | | endChangeCar: false, //选择起始点以后底部样式 |
| | | nextCityName: "您要去哪儿", |
| | | yyTime: "现在", |
| | | tip: "0元", |
| | | markers: "", |
| | | points: "", |
| | | polyline: [], |
| | | showLocationIcon: true, |
| | | changephone: "", |
| | | changePeople: "更换乘车人", |
| | | startLon: "", |
| | | startLat: "", |
| | | nextBoolean: false, |
| | | |
| | | endAddress: '', |
| | | endLat: '', |
| | | endLon: '', |
| | | |
| | | }) |
| | | }, 2000) |
| | | app.showToastSuccess(res.data.msg, null, 'none', 1500) |
| | | } |
| | | }) |
| | | } else { |
| | | setTimeout(() => { |
| | | this.setData({ |
| | | btnDisabled: false |
| | | }) |
| | | }, 2000) |
| | | app.showToastSuccess('参数错误', null, 'none', 1500) |
| | | } |
| | | }, |
| | | }) |
| | | } else if (res.data.code == 600 || res.data.code == 700) { |
| | | // 清空本地token |
| | | wx.navigateTo({ |
| | | url: '/pages/index/index', |
| | | }) |
| | | setTimeout(() => { |
| | | this.setData({ |
| | | btnDisabled: false |
| | | }) |
| | | }) |
| | | } else if (res.data.code == 500) { |
| | | if (res.data.msg == '有未完成的订单') { |
| | | this.getNowOrder() |
| | | } else { |
| | | app.showToastSuccess(res.data.msg, null, 'none', 1500) |
| | | } |
| | | |
| | | setTimeout(() => { |
| | | this.setData({ |
| | | btnDisabled: false |
| | | }) |
| | | }, 2000) |
| | | } else { |
| | | setTimeout(() => { |
| | | this.setData({ |
| | | btnDisabled: false |
| | | }) |
| | | }, 2000) |
| | | app.showToastSuccess(res.data.msg, null, 'none', 1500) |
| | | } |
| | | }) |
| | | } else { |
| | | setTimeout(() => { |
| | | this.setData({ |
| | | btnDisabled: false |
| | | }) |
| | | }, 2000) |
| | | app.showToastSuccess('参数错误', null, 'none', 1500) |
| | | } |
| | | }, |
| | | }) |
| | | } |
| | | |
| | | |
| | | console.log('wdawdad', btnCarData); |
| | | |
| | | }, |
| | |
| | | getCarNum(lat, lon, type) { |
| | | wx.request({ |
| | | url: `https://api.map.baidu.com/geoconv/v2/?coords=${lon},${lat}&model=1&ak=3mHKIXMArjgIkgADzOlTYp4XssNSNkwr`, |
| | | success: function (res) { |
| | | console.log('shuju', res); |
| | | success: (res) => { |
| | | unit.post(app.globalData.Url + '/base/driver/queryIdleDriver', { |
| | | lat: res.data.result[0].y, |
| | | lon: res.data.result[0].x, |
| | |
| | | let that = this; |
| | | wx.request({ |
| | | url: `https://api.map.baidu.com/geoconv/v2/?coords=${longitude},${latitude}&model=1&ak=3mHKIXMArjgIkgADzOlTYp4XssNSNkwr`, |
| | | success: function (res) { |
| | | success: (res) => { |
| | | bmap.regeocoding({ |
| | | coordtype: 'bd09ll', |
| | | location: res.data.result[0].y + ',' + res.data.result[0].x, |
| | | success: function (res) { |
| | | //这里的res参数里有具体的城市数据 |
| | | var name = res.originalData.result.addressComponent |
| | | that.setData({ |
| | | changeStartName: '', |
| | | changeStartName: res.originalData.result.formatted_address, |
| | | startLat: '', |
| | | startLon: '', |
| | | cityNameStart: res.originalData.result.formatted_address, |
| | |
| | | |
| | | let startLat = that.data.startLat || that.data.latitude |
| | | let startLon = that.data.startLon || that.data.longitude |
| | | wx.request({ |
| | | url: `https://api.map.baidu.com/geoconv/v2/?coords=${startLon},${startLat};${that.data.nextLongitude},${that.data.nextLatitude}&model=1&ak=3mHKIXMArjgIkgADzOlTYp4XssNSNkwr`, |
| | | success: (res) => { |
| | | unit.post(app.globalData.Url + '/base/loadLine', { |
| | | startLat: res.data.result[0].y, |
| | | startLon: res.data.result[0].x, |
| | | nextLatitude: res.data.result[1]?.y, |
| | | nextLongitude: res.data.result[1]?.x, |
| | | }) |
| | | .then((res) => { |
| | | var coors = res.data.data |
| | | var polyline = []; |
| | | coors.forEach(function (step, index) { |
| | | if (index == 0) { |
| | | polyline.push({ |
| | | latitude: step.start_location.lat, |
| | | longitude: step.start_location.lng |
| | | }); |
| | | } else { |
| | | polyline.push({ |
| | | latitude: step.end_location.lat, |
| | | longitude: step.end_location.lng |
| | | }); |
| | | } |
| | | |
| | | }); |
| | | that.setData({ |
| | | polyline: [{ |
| | | points: polyline, |
| | | arrowLine: true, |
| | | color: '#00C47A', |
| | | width: 4, |
| | | borderWidth: 1, |
| | | borderColor: '#00C47A' |
| | | }], |
| | | }); |
| | | }) |
| | | } |
| | | }) |
| | | // unit.get('https://apis.map.qq.com/ws/direction/v1/driving/?from=' + |
| | | // startLat + ',' + |
| | | // startLon + '&to=' + that.data.nextLatitude + ',' + |
| | |
| | | // 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: polyline, |
| | | arrowLine: true, |
| | | color: '#00C47A', |
| | | width: 4, |
| | | borderWidth: 1, |
| | | borderColor: '#00C47A' |
| | | }], |
| | | }); |
| | | |
| | | } |
| | | }, |
| | | fail: function (res) { |
| | | 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`, |
| | | // success: function (res) { |
| | | // if (res.data.status == 0) { |
| | | |
| | | // } |
| | | // }, |
| | | // fail: function (res) { |
| | | // app.showToastSuccess('路线规划失败', null, "none", 1500) |
| | | // } |
| | | // }) |
| | | unit.post(app.globalData.Url + '/base/taxi/queryExpectedTime', { |
| | | // slat:that.data.latitude, |
| | | // slon:that.data.longitude, |
| | |
| | | }) |
| | | }, |
| | | goWaiting(e) { |
| | | if (e.currentTarget.dataset.state <= 5) { |
| | | if (e.currentTarget.dataset.state <= 6) { |
| | | wx.navigateTo({ |
| | | url: '../../pages/waiting/waiting?where=' + "myTrip" + "&orderID=" + e.currentTarget.dataset.orderid + "&state=" + e.currentTarget.dataset.state + '&orderType=' + e.currentTarget.dataset.ordertype + "&onekey=" + '0' |
| | | }) |
| | |
| | | </view> |
| | | <view class="okTrip_car_style"> |
| | | {{orderMessage.brand}} · {{orderMessage.carColor}} |
| | | <view class="okTrip_money" catchtap="lookMoneyInfo"> |
| | | <view class="okTrip_money" catchtap="lookMoneyInfo" wx:if="{{OrderInfo.payManner!=3}}"> |
| | | {{orderMoney}}元 |
| | | <image src="/img/arrows@3x.png"></image> |
| | | </view> |
| | |
| | | bmap.suggestion({ |
| | | query: inputValue, |
| | | region:this.data.adcode, |
| | | coordtype:'bd09ll', |
| | | success:(res)=>{ |
| | | this.setData({ |
| | | addressList : res.result |
| | |
| | | onekey: "0", |
| | | showPop: false, |
| | | showSuccess: false, |
| | | servedMileage:0, |
| | | servedTime:0, |
| | | servedMileage: 0, |
| | | servedTime: 0, |
| | | showNumCoun: true, |
| | | imgs: [{ |
| | | id: 1 |
| | |
| | | couponId: '', |
| | | isIncok: false, |
| | | showIpay: false, |
| | | payStyle: [ |
| | | { |
| | | payStyle: [{ |
| | | name: "充值余额", |
| | | checked: false, |
| | | money: '0元' |
| | |
| | | orderType: "", //车型类型 |
| | | remark: "", |
| | | sendTitle: "等待应答", //title |
| | | OrderInfo:{}, |
| | | OrderInfo: {}, |
| | | }, |
| | | |
| | | ipay() { |
| | |
| | | getDriveIng = setInterval(() => { |
| | | this.getDriveIng() |
| | | }, 3000) |
| | | |
| | | let isPhone = app.globalData.isIphoneX; |
| | | if (options.where == "myTrip" || options.where == "drive") { |
| | | wx.setStorageSync('orderID', options.orderID) |
| | |
| | | //根据经纬度路线规划 |
| | | //获取行车路线 |
| | | getDriverLine(fromValue, toValue) { |
| | | // console.log('shhuji',fromValue,toValue); |
| | | console.log('shhuji', fromValue, toValue); |
| | | let that = this; |
| | | 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) { |
| | | 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' |
| | | }], |
| | | }); |
| | | unit.post(app.globalData.Url + '/base/loadLine', { |
| | | startLat: fromValue.latitude, |
| | | startLon: fromValue.longitude, |
| | | nextLatitude: toValue.latitude, |
| | | nextLongitude: toValue.longitude, |
| | | }) |
| | | .then((res) => { |
| | | var coors = res.data.data |
| | | var polyline = []; |
| | | coors.forEach(function (step, index) { |
| | | if (index == 0) { |
| | | polyline.push({ |
| | | latitude: step.start_location.lat, |
| | | longitude: step.start_location.lng |
| | | }); |
| | | } else { |
| | | polyline.push({ |
| | | latitude: step.end_location.lat, |
| | | longitude: step.end_location.lng |
| | | }); |
| | | } |
| | | |
| | | } |
| | | }, |
| | | fail: function (res) { |
| | | app.showToastSuccess('路线规划失败', null, "none", 1500) |
| | | } |
| | | }) |
| | | }); |
| | | that.setData({ |
| | | polyline: [{ |
| | | points: polyline, |
| | | arrowLine: true, |
| | | color: '#00C47A', |
| | | width: 4, |
| | | borderWidth: 1, |
| | | borderColor: '#00C47A' |
| | | }], |
| | | }); |
| | | }) |
| | | |
| | | // wx.request({ |
| | | // url: `https://api.map.baidu.com/directionlite/v1/driving?origin=${fromValue.latitude},${fromValue.longitude}&destination=${toValue.latitude},${toValue.longitude}&ak=WQhfsluNzEeUHUxoH4jc4JiCQOXw4Mnx&coordtype=gcj02ll&ret_coordtype=gcj02ll`, |
| | | // success: function (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({ |
| | | // latitude: polyline[0].latitude, |
| | | // longitude: polyline[0].longitude, |
| | | // line:true, |
| | | // polyline: [{ |
| | | // points: polyline, |
| | | // arrowLine: true, |
| | | // color: '#00C47A', |
| | | // width: 4, |
| | | // borderWidth: 1, |
| | | // borderColor: '#00C47A' |
| | | // }], |
| | | // }); |
| | | |
| | | // } |
| | | // }, |
| | | // fail: function (res) { |
| | | // app.showToastSuccess('路线规划失败', null, "none", 1500) |
| | | // } |
| | | // }) |
| | | // app.getQQMap().direction({ |
| | | // mode: "driving", //可选值:'driving'(驾车)、'walking'(步行)、'bicycling'(骑行),不填默认:'driving',可不填 |
| | | // //from参数不填默认当前地址 |
| | |
| | | sendTitle: "等待接驾" |
| | | }) |
| | | } else if (state == 3) { |
| | | var markers = [{ |
| | | iconPath: "../../img/map_car@3x.png", |
| | | id: 1, |
| | | latitude: this.data.drivelat, |
| | | longitude: this.data.drivelon, |
| | | width: 26, |
| | | height: 36, |
| | | }, { |
| | | iconPath: "../../img/start_icon.png", |
| | | id: 2, |
| | | latitude: this.data.startLat, |
| | | longitude: this.data.startLon, |
| | | width: 26, |
| | | height: 34, |
| | | callout: { |
| | | content: this.data.startAddress, |
| | | fontSize: 12, |
| | | borderRadius: 10, |
| | | padding: 10, |
| | | display: "ALWAYS" |
| | | } |
| | | }] |
| | | var points = [{ |
| | | latitude: this.data.startLat, |
| | | longitude: this.data.startLon, |
| | | }, |
| | | { |
| | | latitude: this.data.drivelat, |
| | | longitude: this.data.drivelon, |
| | | }, |
| | | ] |
| | | // var markers = [{ |
| | | // iconPath: "../../img/map_car@3x.png", |
| | | // id: 1, |
| | | // latitude: this.data.drivelat, |
| | | // longitude: this.data.drivelon, |
| | | // width: 26, |
| | | // height: 36, |
| | | // }, { |
| | | // iconPath: "../../img/start_icon.png", |
| | | // id: 2, |
| | | // latitude: this.data.startLat, |
| | | // longitude: this.data.startLon, |
| | | // width: 26, |
| | | // height: 34, |
| | | // callout: { |
| | | // content: this.data.startAddress, |
| | | // fontSize: 12, |
| | | // borderRadius: 10, |
| | | // padding: 10, |
| | | // display: "ALWAYS" |
| | | // } |
| | | // }] |
| | | // var points = [{ |
| | | // latitude: this.data.startLat, |
| | | // longitude: this.data.startLon, |
| | | // }, |
| | | // { |
| | | // latitude: this.data.drivelat, |
| | | // longitude: this.data.drivelon, |
| | | // }, |
| | | // ] |
| | | // 11/12改 |
| | | |
| | | this.setData({ |
| | | markers, |
| | | points, |
| | | // markers, |
| | | // points, |
| | | sendTitle: "等待接驾" |
| | | }) |
| | | this.getDriverLine({ |
| | | latitude: this.data.startLat, |
| | | longitude: this.data.startLon, |
| | | }, { |
| | | latitude: this.data.drivelat, |
| | | longitude: this.data.drivelon, |
| | | }) |
| | | // this.getDriverLine({ |
| | | // latitude: this.data.startLat, |
| | | // longitude: this.data.startLon, |
| | | // }, { |
| | | // latitude: this.data.drivelat, |
| | | // longitude: this.data.drivelon, |
| | | // }) |
| | | } else if (state == 4) { |
| | | var nowTime = new Date().getTime(); |
| | | wx.setStorageSync('SERVER_TIME', nowTime) |
| | |
| | | polyline: [], |
| | | sendTitle: "司机已到达" |
| | | }) |
| | | this.getDriverLine({ |
| | | latitude: this.data.startLat, |
| | | longitude: this.data.startLon, |
| | | }, { |
| | | latitude: this.data.drivelat, |
| | | longitude: this.data.drivelon, |
| | | }) |
| | | // this.getDriverLine({ |
| | | // latitude: this.data.startLat, |
| | | // longitude: this.data.startLon, |
| | | // }, { |
| | | // latitude: this.data.drivelat, |
| | | // longitude: this.data.drivelon, |
| | | // }) |
| | | } else if (state == 5) { |
| | | //对路线进行规划 |
| | | this.getDriverLine({ |
| | | latitude: this.data.startLat, |
| | | longitude: this.data.startLon, |
| | | }, { |
| | | latitude: this.data.endLat, |
| | | longitude: this.data.endLon, |
| | | }) |
| | | // this.getDriverLine({ |
| | | // latitude: this.data.startLat, |
| | | // longitude: this.data.startLon, |
| | | // }, { |
| | | // latitude: this.data.endLat, |
| | | // longitude: this.data.endLon, |
| | | // }) |
| | | // this.setData({ |
| | | // endLocation: this.data.endLon + ',' + this.data.endLat, |
| | | // }) |
| | | // var points = [{ |
| | | // latitude: this.data.startLat, |
| | | // longitude: this.data.startLon, |
| | | // }, |
| | | // { |
| | | // latitude: this.data.endLat, |
| | | // longitude: this.data.endLon, |
| | | // }, |
| | | // ] |
| | | this.setData({ |
| | | endLocation: this.data.endLon + ',' + this.data.endLat, |
| | | }) |
| | | var points = [{ |
| | | latitude: this.data.startLat, |
| | | longitude: this.data.startLon, |
| | | }, |
| | | { |
| | | latitude: this.data.endLat, |
| | | longitude: this.data.endLon, |
| | | }, |
| | | ] |
| | | this.setData({ |
| | | points, |
| | | // points, |
| | | tsDrive: true, |
| | | closeOrder: true, |
| | | closeOrderAdovad: false, |
| | |
| | | }) |
| | | } |
| | | } else if (state == 9) { |
| | | console.log(11111111111111111111+'//////////////////////////'); |
| | | console.log(11111111111111111111 + '//////////////////////////'); |
| | | this.setData({ |
| | | sendTitle: "已取消" |
| | | }) |
| | |
| | | drivelon: resData.data.lon |
| | | }) |
| | | if (this.data.state == 2 || this.data.state == 3) { |
| | | var markers = [{ |
| | | iconPath: "../../img/map_car@3x.png", |
| | | id: 1, |
| | | latitude: resData.data.lat, |
| | | longitude: resData.data.lon, |
| | | width: 26, |
| | | height: 26, |
| | | }, { |
| | | iconPath: "../../img/start_icon.png", |
| | | id: 2, |
| | | latitude: this.data.startLat, |
| | | longitude: this.data.startLon, |
| | | width: 26, |
| | | height: 34, |
| | | callout: { |
| | | content: this.data.startAddress, |
| | | fontSize: 12, |
| | | borderRadius: 10, |
| | | padding: 10, |
| | | display: "ALWAYS" |
| | | } |
| | | }] |
| | | var points = [{ |
| | | latitude: this.data.startLat, |
| | | longitude: this.data.startLon, |
| | | }, |
| | | { |
| | | latitude: this.data.drivelat, |
| | | longitude: this.data.drivelon, |
| | | }, |
| | | ] |
| | | //对路线进行规划 |
| | | this.getDriverLine({ |
| | | latitude: resData.data.lat || this.data.drivelat, |
| | | longitude: resData.data.lon || this.data.drivelon, |
| | | }, { |
| | | latitude: this.data.startLat, |
| | | longitude: this.data.startLon |
| | | }) |
| | | this.setData({ |
| | | isShowTid: false, |
| | | reservationMileage: resData.data.reservationMileage, //司机距离距离 |
| | | reservationTime: resData.data.reservationTime, //距离预约地点的时间 |
| | | }) |
| | | this.setData({ |
| | | markers, |
| | | points |
| | | }) |
| | | // var markers = [{ |
| | | // iconPath: "../../img/map_car@3x.png", |
| | | // id: 1, |
| | | // latitude: resData.data.lat, |
| | | // longitude: resData.data.lon, |
| | | // width: 26, |
| | | // height: 26, |
| | | // }, { |
| | | // iconPath: "../../img/start_icon.png", |
| | | // id: 2, |
| | | // latitude: this.data.startLat, |
| | | // longitude: this.data.startLon, |
| | | // width: 26, |
| | | // height: 34, |
| | | // callout: { |
| | | // content: this.data.startAddress, |
| | | // fontSize: 12, |
| | | // borderRadius: 10, |
| | | // padding: 10, |
| | | // display: "ALWAYS" |
| | | // } |
| | | // }] |
| | | // var points = [{ |
| | | // latitude: this.data.startLat, |
| | | // longitude: this.data.startLon, |
| | | // }, |
| | | // { |
| | | // latitude: this.data.drivelat, |
| | | // longitude: this.data.drivelon, |
| | | // }, |
| | | // ] |
| | | // //对路线进行规划 |
| | | // this.getDriverLine({ |
| | | // latitude: resData.data.lat || this.data.drivelat, |
| | | // longitude: resData.data.lon || this.data.drivelon, |
| | | // }, { |
| | | // latitude: this.data.startLat, |
| | | // longitude: this.data.startLon |
| | | // }) |
| | | // this.setData({ |
| | | // isShowTid: false, |
| | | // reservationMileage: resData.data.reservationMileage, //司机距离距离 |
| | | // reservationTime: resData.data.reservationTime, //距离预约地点的时间 |
| | | // }) |
| | | // this.setData({ |
| | | // markers, |
| | | // points |
| | | // }) |
| | | } else if (this.data.state == 5) { |
| | | // console.log(resData,'resDataresDataresDataresData'); |
| | | clearInterval(this.setTimer) |
| | | var markers = [{ |
| | | iconPath: "../../img/map_car@3x.png", |
| | | id: 1, |
| | | latitude: resData.data.lat, |
| | | longitude: resData.data.lon, |
| | | width: 26, |
| | | height: 26, |
| | | }, { |
| | | iconPath: "../../img/end_icon.png", |
| | | id: 2, |
| | | latitude: this.data.endLat, |
| | | longitude: this.data.endLon, |
| | | width: 26, |
| | | height: 34, |
| | | }, { |
| | | iconPath: "../../img/start_icon.png", |
| | | id: 3, |
| | | latitude: this.data.startLat, |
| | | longitude: this.data.startLon, |
| | | width: 26, |
| | | height: 34, |
| | | }] |
| | | // var markers = [{ |
| | | // iconPath: "../../img/map_car@3x.png", |
| | | // id: 1, |
| | | // latitude: resData.data.lat, |
| | | // longitude: resData.data.lon, |
| | | // width: 26, |
| | | // height: 26, |
| | | // }, { |
| | | // iconPath: "../../img/end_icon.png", |
| | | // id: 2, |
| | | // latitude: this.data.endLat, |
| | | // longitude: this.data.endLon, |
| | | // width: 26, |
| | | // height: 34, |
| | | // }, { |
| | | // iconPath: "../../img/start_icon.png", |
| | | // id: 3, |
| | | // latitude: this.data.startLat, |
| | | // longitude: this.data.startLon, |
| | | // width: 26, |
| | | // height: 34, |
| | | // }] |
| | | this.setData({ |
| | | driveIng: false, |
| | | markers, |
| | | // markers, |
| | | points, |
| | | servedMileage: resData.data.servedMileage, //订单为服务中的服务距离 |
| | | laveTime: resData.data.laveTime, //订单为服务中的预计剩余时间 |
| | |
| | | servedTime: resData.data.servedTime, //订单为服务中的以服务时间 |
| | | }) |
| | | } else if (this.data.state == 7) {} else if (this.data.state == 4) { |
| | | var markers = [{ |
| | | iconPath: "../../img/map_car@3x.png", |
| | | id: 1, |
| | | latitude: resData.data.lat, |
| | | longitude: resData.data.lon, |
| | | width: 26, |
| | | height: 26, |
| | | }, { |
| | | iconPath: "../../img/start_icon.png", |
| | | id: 3, |
| | | latitude: this.data.startLat, |
| | | longitude: this.data.startLon, |
| | | width: 26, |
| | | height: 34, |
| | | callout: { |
| | | content: this.data.startAddress, |
| | | fontSize: 12, |
| | | borderRadius: 10, |
| | | padding: 10, |
| | | display: "ALWAYS" |
| | | } |
| | | }] |
| | | // var markers = [{ |
| | | // iconPath: "../../img/map_car@3x.png", |
| | | // id: 1, |
| | | // latitude: resData.data.lat, |
| | | // longitude: resData.data.lon, |
| | | // width: 26, |
| | | // height: 26, |
| | | // }, { |
| | | // iconPath: "../../img/start_icon.png", |
| | | // id: 3, |
| | | // latitude: this.data.startLat, |
| | | // longitude: this.data.startLon, |
| | | // width: 26, |
| | | // height: 34, |
| | | // callout: { |
| | | // content: this.data.startAddress, |
| | | // fontSize: 12, |
| | | // borderRadius: 10, |
| | | // padding: 10, |
| | | // display: "ALWAYS" |
| | | // } |
| | | // }] |
| | | this.setData({ |
| | | markers, |
| | | // markers, |
| | | waitTimeNow: true |
| | | }) |
| | | } |
| | |
| | | var markers = [{ |
| | | iconPath: "../../img/map_car@3x.png", |
| | | id: 1, |
| | | latitude: res.data.data.lat, |
| | | longitude: res.data.data.lon, |
| | | latitude: res.data.data.nextLatitude, |
| | | longitude: res.data.data.nextLongitude, |
| | | width: 26, |
| | | height: 26, |
| | | }, { |
| | | iconPath: "../../img/start_icon.png", |
| | | id: 2, |
| | | latitude: this.data.startLat, |
| | | longitude: this.data.startLon, |
| | | latitude: res.data.data.startLat, |
| | | longitude: res.data.data.startLon, |
| | | width: this.data.modeSelectId == 2 ? 30 : 26, |
| | | height: this.data.modeSelectId == 2 ? 38 : 34, |
| | | callout: { |
| | |
| | | var markers = [{ |
| | | iconPath: "../../img/map_car@3x.png", |
| | | id: 1, |
| | | latitude: res.data.data.lat, |
| | | longitude: res.data.data.lon, |
| | | latitude: res.data.data.nextLatitude, |
| | | longitude: res.data.data.nextLongitude, |
| | | width: 26, |
| | | height: 26, |
| | | }, { |
| | | iconPath: "../../img/start_icon.png", |
| | | id: 2, |
| | | latitude: this.data.startLat, |
| | | longitude: this.data.startLon, |
| | | latitude: res.data.data.startLat, |
| | | longitude: res.data.data.startLon, |
| | | width: this.data.modeSelectId == 2 ? 30 : 26, |
| | | height: this.data.modeSelectId == 2 ? 38 : 34, |
| | | callout: { |
| | |
| | | } |
| | | }] |
| | | var points = [{ |
| | | latitude: this.data.startLat, |
| | | longitude: this.data.startLon, |
| | | latitude: res.data.data.startLat, |
| | | longitude: res.data.data.startLon, |
| | | }, |
| | | { |
| | | latitude: res.data.data.lat, |
| | |
| | | ] |
| | | |
| | | this.getDriverLine({ |
| | | latitude: res.data.data.lat, |
| | | longitude: res.data.data.lon, |
| | | }, { |
| | | latitude: this.data.startLat, |
| | | longitude: this.data.startLon, |
| | | }) |
| | | latitude: res.data.data.lat, |
| | | longitude: res.data.data.lon, |
| | | }, { |
| | | latitude: res.data.data.startLat, |
| | | longitude: res.data.data.startLon, |
| | | }) |
| | | this.setData({ |
| | | reservationMileage: res.data.data.reservationMileage, //司机距离距离 |
| | | reservationTime: res.data.data.reservationTime, //距离预约地点的时间 |
| | |
| | | }) |
| | | } else if (res.data.data.state == 5 && app.globalData.state !== res.data.data.state) { |
| | | // console.log("------------------------------------------------------") |
| | | if (this.data.server5) { |
| | | |
| | | var points = [{ |
| | | latitude: this.data.startLat, |
| | | longitude: this.data.startLon, |
| | | }, |
| | | { |
| | | latitude: this.data.endLat, |
| | | longitude: this.data.endLon, |
| | | }, |
| | | ] |
| | | this.setData({ |
| | | points, |
| | | tsDrive: true, |
| | | driveIng: false, |
| | | closeOrder: true, |
| | | closeOrderAdovad: false, |
| | | sendTitle: "服务中" |
| | | }) |
| | | this.getDriverLine({ |
| | | latitude: this.data.startLat, |
| | | longitude: this.data.startLon, |
| | | }, { |
| | | latitude: res.data.data.lat, |
| | | longitude: res.data.data.lon, |
| | | }) |
| | | } |
| | | this.getDriveInfo(res.data.data.orderId || this.data.orderID) |
| | | clearInterval(this.setTimer) |
| | | clearInterval(this.setTimerTime) |
| | | // if (this.data.server5) { |
| | | var points = [{ |
| | | latitude: res.data.data.startLat, |
| | | longitude: res.data.data.startLon, |
| | | }, |
| | | { |
| | | latitude: res.data.data.endLat, |
| | | longitude: res.data.data.endLon, |
| | | }, |
| | | ] |
| | | this.mapCtx = wx.createMapContext("map4select"); |
| | | this.mapCtx.translateMarker({ |
| | | markerId: 1, |
| | | autoRotate: true, |
| | | duration: 3000, |
| | | destination: { |
| | | latitude: res.data.data.lat, |
| | | longitude: res.data.data.lon, |
| | | }, |
| | | }, { |
| | | markerId: 2, |
| | | autoRotate: true, |
| | | duration: 3000, |
| | | destination: { |
| | | latitude: this.data.endLat, |
| | | longitude: this.data.endLon, |
| | | }, |
| | | }) |
| | | // this.mapCtx.translateMarker({ |
| | | // markerId: 1, |
| | | // autoRotate: true, |
| | | // duration: 3000, |
| | | // destination: { |
| | | // latitude: res.data.data.lat, |
| | | // longitude: res.data.data.lon, |
| | | // }, |
| | | // }, { |
| | | // markerId: 2, |
| | | // autoRotate: true, |
| | | // duration: 3000, |
| | | // destination: { |
| | | // latitude: this.data.endLat, |
| | | // longitude: this.data.endLon, |
| | | // }, |
| | | // }) |
| | | var markers = [{ |
| | | iconPath: "../../img/map_car@3x.png", |
| | | id: "map4select", |
| | | latitude: res.data.data.lat, |
| | | longitude: res.data.data.lon, |
| | | id: 1, |
| | | latitude: res.data.data.nextLatitude, |
| | | longitude: res.data.data.nextLongitude, |
| | | width: 26, |
| | | height: 26, |
| | | }, { |
| | | iconPath: "../../img/end_icon.png", |
| | | id: "map", |
| | | latitude: this.data.endLat, |
| | | longitude: this.data.endLon, |
| | | id: 3, |
| | | latitude: res.data.data.endLat, |
| | | longitude: res.data.data.endLon, |
| | | width: 26, |
| | | height: 34, |
| | | }, { |
| | | iconPath: "../../img/start_icon.png", |
| | | id: "mapstart", |
| | | latitude: this.data.startLat, |
| | | longitude: this.data.startLon, |
| | | id: 2, |
| | | latitude: res.data.data.nextLatitude, |
| | | longitude: res.data.data.nextLongitude, |
| | | width: 26, |
| | | height: 34, |
| | | }] |
| | | this.setData({ |
| | | points, |
| | | driveIng: false, |
| | | markers, |
| | | server5: false, |
| | | tsDrive: true, |
| | | closeOrder: true, |
| | | closeOrderAdovad: false, |
| | | sendTitle: "服务中" |
| | | }) |
| | | |
| | | // } |
| | | this.getDriveInfo(res.data.data.orderId || this.data.orderID) |
| | | clearInterval(this.setTimer) |
| | | clearInterval(this.setTimerTime) |
| | | |
| | | this.setData({ |
| | | driveIng: false, |
| | | markers, |
| | |
| | | servedTime: res.data.data.servedTime, //订单为服务中的以服务时间 |
| | | |
| | | }) |
| | | //对路线进行规划 |
| | | this.getDriverLine({ |
| | | latitude: this.data.startLat, |
| | | longitude: this.data.startLon, |
| | | latitude: res.data.data.lat, |
| | | longitude: res.data.data.lon, |
| | | }, { |
| | | latitude: this.data.endLat, |
| | | longitude: this.data.endLon, |
| | | }) |
| | | //对路线进行规划 |
| | | // this.getDriverLine({ |
| | | |
| | | // }, { |
| | | // latitude: this.data.endLat, |
| | | // longitude: this.data.endLon, |
| | | // }) |
| | | |
| | | } else if (res.data.data.state == 6 && app.globalData.state !== res.data.data.state) { |
| | | // console.log("------------------------------------------------------") |
| | |
| | | var markers = [{ |
| | | iconPath: "../../img/map_car@3x.png", |
| | | id: 1, |
| | | latitude: res.data.data.lat, |
| | | longitude: res.data.data.lon, |
| | | latitude: res.data.data.nextLatitude, |
| | | longitude: res.data.data.nextLongitude, |
| | | width: 26, |
| | | height: 26, |
| | | }, { |
| | | iconPath: "../../img/start_icon.png", |
| | | id: 3, |
| | | latitude: this.data.startLat, |
| | | longitude: this.data.startLon, |
| | | latitude: res.data.data.nextLatitude, |
| | | longitude: res.data.data.nextLongitude, |
| | | width: this.data.modeSelectId == 2 ? 30 : 26, |
| | | height: this.data.modeSelectId == 2 ? 38 : 34, |
| | | callout: { |
| | |
| | | "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) |
| | | if (res.data.code == 200) { |
| | | this.setData({ |
| | | OrderInfo:res.data.data |
| | | OrderInfo: res.data.data |
| | | }) |
| | | if (res.data.data.endAddress == '') { |
| | | this.setData({ |
| | |
| | | latitude: res.data.data.endLat, |
| | | longitude: res.data.data.endLon, |
| | | }) |
| | | var points = [{ |
| | | latitude: this.data.startLat, |
| | | longitude: this.data.startLon, |
| | | }, |
| | | { |
| | | latitude: this.data.endLat, |
| | | longitude: this.data.endLon, |
| | | }, |
| | | ] |
| | | if (points[1] && !points[1].latitude) { |
| | | points.splice(1, 1) |
| | | } |
| | | // var points = [{ |
| | | // latitude: this.data.startLat, |
| | | // longitude: this.data.startLon, |
| | | // }, |
| | | // { |
| | | // latitude: this.data.endLat, |
| | | // longitude: this.data.endLon, |
| | | // }, |
| | | // ] |
| | | // if (points[1] && !points[1].latitude) { |
| | | // points.splice(1, 1) |
| | | // } |
| | | |
| | | this.setData({ |
| | | points, |
| | | // points, |
| | | tsDrive: true, |
| | | driveIng: false, |
| | | sendTitle: "服务中" |
| | |
| | | orderType: this.data.orderType |
| | | }) |
| | | .then((res2) => { |
| | | // console.log(res2) |
| | | var markers = [{ |
| | | iconPath: "../../img/map_car@3x.png", |
| | | id: 1, |
| | | latitude: res2.data.data.lat, |
| | | longitude: res2.data.data.lon, |
| | | width: 26, |
| | | height: 26, |
| | | }, { |
| | | iconPath: "../../img/start_icon.png", |
| | | id: 2, |
| | | latitude: this.data.startLat, |
| | | longitude: this.data.startLon, |
| | | width: this.data.modeSelectId == 2 ? 30 : 26, |
| | | height: this.data.modeSelectId == 2 ? 38 : 34, |
| | | callout: { |
| | | content: this.data.startAddress, |
| | | fontSize: this.data.modeSelectId == 2 ? 22 : 12, |
| | | borderRadius: this.data.modeSelectId == 2 ? 50 : 10, |
| | | padding: 10, |
| | | display: "ALWAYS" |
| | | } |
| | | }, { |
| | | iconPath: "../../img/end_icon.png", |
| | | id: 2, |
| | | latitude: this.data.endLat, |
| | | longitude: this.data.endLon, |
| | | width: 26, |
| | | height: 34, |
| | | }] |
| | | if (this.data.points.length == 1) { |
| | | markers.splice(markers.length - 1, 1) |
| | | } |
| | | console.log('////////////////////////////////////') |
| | | // var markers = [{ |
| | | // iconPath: "../../img/map_car@3x.png", |
| | | // id: 1, |
| | | // latitude: res2.data.data.lat, |
| | | // longitude: res2.data.data.lon, |
| | | // width: 26, |
| | | // height: 26, |
| | | // }, { |
| | | // iconPath: "../../img/start_icon.png", |
| | | // id: 2, |
| | | // latitude: this.data.startLat, |
| | | // longitude: this.data.startLon, |
| | | // width: this.data.modeSelectId == 2 ? 30 : 26, |
| | | // height: this.data.modeSelectId == 2 ? 38 : 34, |
| | | // callout: { |
| | | // content: this.data.startAddress, |
| | | // fontSize: this.data.modeSelectId == 2 ? 22 : 12, |
| | | // borderRadius: this.data.modeSelectId == 2 ? 50 : 10, |
| | | // padding: 10, |
| | | // display: "ALWAYS" |
| | | // } |
| | | // }, { |
| | | // iconPath: "../../img/end_icon.png", |
| | | // id: 2, |
| | | // latitude: this.data.endLat, |
| | | // longitude: this.data.endLon, |
| | | // width: 26, |
| | | // height: 34, |
| | | // }] |
| | | // if (this.data.points.length == 1) { |
| | | // markers.splice(markers.length - 1, 1) |
| | | // } |
| | | this.setData({ |
| | | markers, |
| | | // markers, |
| | | servedMileage: res2.data.data.servedMileage, //订单为服务中的服务距离 |
| | | laveTime: res2.data.data.laveTime, //订单为服务中的预计剩余时间 |
| | | laveMileage: res2.data.data.laveMileage, //订单为服务中的剩余服务距离 |
| | |
| | | }) |
| | | .then((res2) => { |
| | | // console.log(res2) |
| | | var markers = [{ |
| | | iconPath: "../../img/map_car@3x.png", |
| | | id: 1, |
| | | latitude: res2.data.data.lat, |
| | | longitude: res2.data.data.lon, |
| | | width: 26, |
| | | height: 26, |
| | | }, { |
| | | iconPath: "../../img/start_icon.png", |
| | | id: 2, |
| | | latitude: this.data.startLat, |
| | | longitude: this.data.startLon, |
| | | width: this.data.modeSelectId == 2 ? 30 : 26, |
| | | height: this.data.modeSelectId == 2 ? 38 : 34, |
| | | callout: { |
| | | content: this.data.startAddress, |
| | | fontSize: this.data.modeSelectId == 2 ? 22 : 12, |
| | | borderRadius: this.data.modeSelectId == 2 ? 50 : 10, |
| | | padding: 10, |
| | | display: "ALWAYS" |
| | | } |
| | | }] |
| | | this.getDriverLine({ |
| | | latitude: res2.data.data.lat, |
| | | longitude: res2.data.data.lon, |
| | | }, { |
| | | latitude: this.data.startLat, |
| | | longitude: this.data.startLon, |
| | | }) |
| | | // var markers = [{ |
| | | // iconPath: "../../img/map_car@3x.png", |
| | | // id: 1, |
| | | // latitude: res2.data.data.lat, |
| | | // longitude: res2.data.data.lon, |
| | | // width: 26, |
| | | // height: 26, |
| | | // }, { |
| | | // iconPath: "../../img/start_icon.png", |
| | | // id: 2, |
| | | // latitude: this.data.startLat, |
| | | // longitude: this.data.startLon, |
| | | // width: this.data.modeSelectId == 2 ? 30 : 26, |
| | | // height: this.data.modeSelectId == 2 ? 38 : 34, |
| | | // callout: { |
| | | // content: this.data.startAddress, |
| | | // fontSize: this.data.modeSelectId == 2 ? 22 : 12, |
| | | // borderRadius: this.data.modeSelectId == 2 ? 50 : 10, |
| | | // padding: 10, |
| | | // display: "ALWAYS" |
| | | // } |
| | | // }] |
| | | // this.getDriverLine({ |
| | | // latitude: res2.data.data.lat, |
| | | // longitude: res2.data.data.lon, |
| | | // }, { |
| | | // latitude: this.data.startLat, |
| | | // longitude: this.data.startLon, |
| | | // }) |
| | | this.setData({ |
| | | markers, |
| | | // markers, |
| | | isShowTid: false, |
| | | reservationMileage: res2.data.data.reservationMileage, //司机距离距离 |
| | | reservationTime: res2.data.data.reservationTime, //距离预约地点的时间 |
| | |
| | | .then((res1) => { |
| | | //29 晚 改 |
| | | if (res1.data.code == 200) { |
| | | var markers = [{ |
| | | iconPath: "../../img/map_car@3x.png", |
| | | id: 1, |
| | | latitude: res1.data.data.lat, |
| | | longitude: res1.data.data.lon, |
| | | width: 26, |
| | | height: 26, |
| | | }, { |
| | | iconPath: "../../img/start_icon.png", |
| | | id: 2, |
| | | latitude: this.data.startLat, |
| | | longitude: this.data.startLon, |
| | | width: this.data.modeSelectId == 2 ? 30 : 26, |
| | | height: this.data.modeSelectId == 2 ? 38 : 34, |
| | | callout: { |
| | | content: this.data.startAddress, |
| | | fontSize: this.data.modeSelectId == 2 ? 22 : 12, |
| | | borderRadius: this.data.modeSelectId == 2 ? 50 : 10, |
| | | padding: 10, |
| | | display: "ALWAYS" |
| | | } |
| | | }] |
| | | var points = [{ |
| | | latitude: this.data.startLat, |
| | | longitude: this.data.startLon, |
| | | }, |
| | | { |
| | | latitude: res1.data.data.lat, |
| | | longitude: res1.data.data.lon, |
| | | }, |
| | | ] |
| | | // var markers = [{ |
| | | // iconPath: "../../img/map_car@3x.png", |
| | | // id: 1, |
| | | // latitude: res1.data.data.lat, |
| | | // longitude: res1.data.data.lon, |
| | | // width: 26, |
| | | // height: 26, |
| | | // }, { |
| | | // iconPath: "../../img/start_icon.png", |
| | | // id: 2, |
| | | // latitude: this.data.startLat, |
| | | // longitude: this.data.startLon, |
| | | // width: this.data.modeSelectId == 2 ? 30 : 26, |
| | | // height: this.data.modeSelectId == 2 ? 38 : 34, |
| | | // callout: { |
| | | // content: this.data.startAddress, |
| | | // fontSize: this.data.modeSelectId == 2 ? 22 : 12, |
| | | // borderRadius: this.data.modeSelectId == 2 ? 50 : 10, |
| | | // padding: 10, |
| | | // display: "ALWAYS" |
| | | // } |
| | | // }] |
| | | // var points = [{ |
| | | // latitude: this.data.startLat, |
| | | // longitude: this.data.startLon, |
| | | // }, |
| | | // { |
| | | // latitude: res1.data.data.lat, |
| | | // longitude: res1.data.data.lon, |
| | | // }, |
| | | // ] |
| | | this.setData({ |
| | | markers, |
| | | points, |
| | | // markers, |
| | | // points, |
| | | isShowTid: false, |
| | | closeOrder: true, |
| | | tsDrive: false, |
| | |
| | | "query": "", |
| | | "launchMode": "default", |
| | | "scene": null |
| | | }, |
| | | { |
| | | "name": "", |
| | | "pathName": "pages/home/home", |
| | | "query": "", |
| | | "launchMode": "default", |
| | | "scene": null |
| | | } |
| | | ] |
| | | } |
| | |
| | | "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; |
| | | "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: "gcj02" |
| | | }, |
| | | 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: "gcj02" |
| | | }, |
| | | 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: "gcj02", |
| | | 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; |