// packageF/timeAppointment/AppointmentUserDe/AppointmentUserDe.js
var behavior = require('../common.js');
var app = getApp();
Page({
  behaviors: [behavior],
  /**
   * 页面的初始数据
   */
  data: {
    tapShow:false,

    cservice_info: [],
    goods: [],
    obj_info: [],
    store_info: [],


    showServicePopup: false,
  },

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

  setTapShow(){
    this.setData({
      tapShow:!this.data.tapShow
    });
  },

  openService(){
    this.setData({
      showServicePopup:!this.data.showServicePopup
    });
  },

  gotoGoods(evt){
    let id = evt.currentTarget.dataset.id;
    wx.navigateTo({
      url: '/packageA/detail_v2/detail_v2?id='+id,
    });
  },

  goToAdress() {
    let latitude = this.data.store_info.lat;
    let longitude = this.data.store_info.lng;
    let store_name = this.data.store_info.name;
    let point = app.BMapTransqqMap(parseFloat(longitude), parseFloat(latitude));
    console.log(point);
    wx.openLocation({
      latitude: point.lat,
      longitude: point.lng,
      scale: 18,
      name: store_name
    });
  },

  getData(id){
    let urlStr = app.getNetAddresss("plugin.reserve-simple.frontend.obj.detail");
    app._getNetWork({
      url: urlStr,
      data:{id},
      success: (resdata) => {
        var res = resdata.data;
        if (res.result != 1) return app.tips(res.msg);
        this.setData({
          obj_info:res.data.obj_info,
          cservice_info: res.data.cservice,
          store_info:res.data.store_info,
          goods:res.data.goods_list
        });
      }
    });
  },

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

  },

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

  },

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

  },

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

  },

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

  },

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

  },

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

  }
});