fix
pyt
2025-01-16 a14852bb2bd99e39d4634e90b4b114778046c116
fix
2个文件已修改
95 ■■■■■ 已修改文件
pages/home/home.js 95 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
project.config.json 补丁 | 查看 | 原始文档 | blame | 历史
pages/home/home.js
@@ -470,7 +470,10 @@
    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 };
    return {
      latitude: a_latitude,
      longitude: a_longitude
    };
  },
  //queryLogisticsNumber 获取首页小件物流订单数量
  async queryLogisticsNumber() {
@@ -788,8 +791,7 @@
    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.getLocal(wx.getStorageSync('latitude'), wx.getStorageSync('longitude'))
        this.setData({
          newCityName: "",
@@ -975,7 +977,8 @@
      endLon: '',
    })
    // this.getLocal(wx.getStorageSync('latitude'), wx.getStorageSync('longitude'))
    this.getLocal(wx.getStorageSync('userLocation').split(",")[1], wx.getStorageSync('userLocation').split(",")[0])
    // this.getLocal(wx.getStorageSync('userLocation').split(",")[1], wx.getStorageSync('userLocation').split(",")[0])
    this.getLocal(wx.getStorageSync('latitude'), wx.getStorageSync('longitude'))
  },
  // 获取隐私协议和用户协议
  getAgreement() {
@@ -1258,23 +1261,32 @@
              var bmap = new BaiduMap.BMapWX({
                ak: 'fi3HGJjW153NCNsaTb9FekxeX1Lj3auo' // 必填,您的key
              })
              wx.getLocation({
                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',
                success: (res) => {
                  console.log('---------------------------------------------', res);
                        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,
                            // 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.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)
@@ -1286,10 +1298,17 @@
                  that.openCity(res.originalData.result.addressComponent.adcode)
                  that.getadver2(wx.getStorageSync('adcode') || res.originalData.result.addressComponent.adcode)
                },
                fail(err) {
                  console.log(err)
                        fail: function (res) {
                          that.setData({
                            cityNameStart: "正在定位中"
                          })
                        },
                      })
                }
              })
                }
              })
            }
          },
        })
@@ -1430,8 +1449,8 @@
    if (!this.data.changePeople) this.data.changePeople = '选乘车人'
    let btnCarData = {
      endAddress: this.data.endAddress || '',
      endLat: this.data.nextLatitude || '',
      endLon: this.data.nextLongitude || '',
      endLat: JSON.parse(JSON.stringify(this.data.nextLatitude || '')),
      endLon: JSON.parse(JSON.stringify(this.data.nextLongitude || '')),
      orderSource: 3,
      orderType: this.data.isDj,
      passengers: this.data.changePeople,
@@ -1439,16 +1458,22 @@
      placementLat: this.data.latitude,
      placementLon: this.data.longitude,
      startAddress: this.data.changeStartName || this.data.cityNameStart,
      startLat: startLat,
      startLon: startLon,
      startLat: JSON.parse(JSON.stringify(startLat)),
      startLon: JSON.parse(JSON.stringify(startLon)),
      areaCode:wx.getStorageSync('adcode'),
      substitute: this.data.substitute, //代下单
      tipMoney: +this.data.tip.substr(0, this.data.tip.length - 1),
      travelTime: this.data.date,
      payManner:this.data.payModel=='线上计费'?1:2
      payManner: this.data.modeSelectId == 2 ? 3 : this.data.payModel == '线上计费' ? 1 : 2
    }
    console.log('wdawdad',btnCarData);
    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)) {
@@ -1542,6 +1567,10 @@
      }, 2000)
      app.showToastSuccess('参数错误', null, 'none', 1500)
    }
      },
    })
    console.log('wdawdad', btnCarData);
  },
  //下单按钮
  btnCar(e) {
@@ -1821,17 +1850,23 @@
  },
  //获取附近空闲司机
  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);
    unit.post(app.globalData.Url + '/base/driver/queryIdleDriver', {
        lat: lat,
        lon: lon,
            lat: res.data.result[0].y,
            lon: res.data.result[0].x,
        type: type
      })
      .then((res) => {
        console.log(res)
        this.setData({
          carNum: res.data.data.number
        })
      })
      },
    })
  },
  //选择车的类型 /base/openCity/queryBusiness
  queryBusiness(city, district, province) {
@@ -1960,11 +1995,13 @@
      ak: 'fi3HGJjW153NCNsaTb9FekxeX1Lj3auo' // 必填,您的key
    })
    let that = this;
    wx.request({
      url: `https://api.map.baidu.com/geoconv/v2/?coords=${longitude},${latitude}&model=1&ak=3mHKIXMArjgIkgADzOlTYp4XssNSNkwr`,
      success: function (res) {
    bmap.regeocoding({
      coordtype:'bd09ll',
      location: latitude + ',' + longitude,
          location: res.data.result[0].y + ',' + res.data.result[0].x,
      success: function (res) {
        console.log('454545d4454545451', res)
        //这里的res参数里有具体的城市数据
        var name = res.originalData.result.addressComponent
        that.setData({
@@ -1973,20 +2010,20 @@
          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
              latitude,
              longitude
        })
        that.queryBusiness(name.city, name.district, name.province)
        that.openCity(res.originalData.result.addressComponent.adcode)
      },
      fail: function (res) {
        console.log('////////////',res);
        that.setData({
          cityNameStart: "正在定位中"
        })
      },
      complete: function (res) {}
    });
        })
      }
    })
  },
  //选择要去的位置跳转
project.config.json