const app = getApp();
// const commonUtil = require("../../utils/commonUtil");
// pages/company/company/index.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    storeInfo: {}
  },

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

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

  },
  goMap () {
    console.log("123")
    let that = this
    wx.openLocation({
      latitude: Number(that.data.storeInfo.lat),
      longitude: Number(that.data.storeInfo.lng),
      name: that.data.storeInfo.fullName,
      address: that.data.storeInfo.address,
      scale: 18
    })
  },
  /**
   * 生命周期函数--监听页面显示
   */
  onShow () {

  },
  /**
  * 获取企业信息
  */
  getInfo () {
    let that = this
    wx.request({
      url: app.globalData.ip + "/yishoudan/agency/getInfo",
      method: "get",
      header: app.globalData.headers,
      success: function (res) {
        console.log(res)
        let data = res.data.data
        if (res.data.status == 200) {
          data.agency.imgList = data.agency.imgs.split(',')
          that.setData({
            storeInfo: data.agency
          })
        }

      }
    })
  },
  /**
  * 拨打电话
  */
  makePhoneCall () {
    var that = this;
    if (!that.data.storeInfo.contactTel) {
      wx.showToast({
        title: '暂无联系方式',
        icon: 'none'
      })
      return
    }
    wx.makePhoneCall({
      phoneNumber: that.data.storeInfo.contactTel,
    });
  },
  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide () {

  },

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

  },

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

  },

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

  },

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

  }
})