// packageA/member/order/orderLogisticsDetails/orderLogisticsDetails.js
var app = getApp();
Page({

  /**
   * 页面的初始数据
   */
  data: {
    details:{},
    markers:[],
    circles:[]
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.getDetails(options.id);
  },

  getDetails(id){
    let urlStr = app.getNetAddresss("plugin.city-delivery.frontend.order.getDeliveryMessage");
    app._postNetWork({
      url: urlStr,
      data:{order_id:id},
      success: (resdata) => {
        var res = resdata.data;
        if (res.result == 1) {
          this.setData({
            details:res.data
          },()=>{
            this.setMap();
          });
          
        }
      }
    });
  },

  setMap(){
    let details = this.data.details;
    //let iconPath = "https://mini-app-img-1251768088.cos.ap-guangzhou.myqcloud.com/orderLogisticsDetails_position.png";
    let iconPath = "./orderLogisticsDetails_position.png";
    let marker = {
      longitude:details.another_order.rider_lng,
      latitude:details.another_order.rider_lat,
      width:33,
      height:45,
      iconPath
    };
    let circle = {
      longitude:details.another_order.rider_lng,
      latitude:details.another_order.rider_lat,
      fillColor:"#67b5ec4D",
      color:"#67b5ec",
      radius:50
    };
    this.setData({
      markers:[marker],
      circles:[circle]
    });
  },
  makePhoneCall(){
    wx.makePhoneCall({
      phoneNumber: this.data.details.another_order.rider_phone //仅为示例，并非真实的电话号码
    });
  },
  

  setClipboardData(){
    wx.setClipboardData({
      data: this.data.details.another_order.another_order_sn
    });
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
});