// packageE/appointment/mine/mine.js
const app = getApp();
Page({

  /**
   * 页面的初始数据
   */
  data: {
    mine: {},
    carousels: [],
    projects: [],
    workers: [],
    appointmentLang: {},
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.setData({
      appointmentLang: wx.getStorageSync('yz_basic_info').lang.appointment
    });
    this.getMine();
  },

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

  },

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

  },

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

  },

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

  },

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

  },

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

  },

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

  },
  toIndex() {
    wx.navigateTo({
      url: '/packageE/appointment/appointment_index'
    });
  },
  toList() {
    var str = JSON.stringify(this.data.appointmentLang);
    wx.navigateTo({
      url: '/packageE/appointment/ProjectList/ProjectList?appointmentLang=' + str,
    });
  },
  toclient() {
    wx.navigateTo({
      url: '/packageE/appointment/client/project/project'
    });
  },
  toAppiontment() {
    wx.navigateTo({
      url: '/packageE/appointment/client/appointment/appointment'
    });
  },
  toStore() {
    wx.navigateTo({
      url: "/packageE/appointment/technician/appointment_project/appointment_project?name=store"
    });
  },
  noStore() {
    wx.navigateTo({
      url: "/packageE/appointment/technician/appointment_project/appointment_project"
    });
  },
  toStoreTec() {
    wx.navigateTo({
      url: "/packageE/appointment/manager/stores_technician/stores_technician?store_id=" + this.data.mine.store_id
    });
  },
  toextension() {
    wx.navigateTo({
      url: "/packageG/pages/member/extension/extension"
    });
  },
  toWorker() {
    wx.navigateTo({
      url: "/packageE/appointment/technician/work_day/TechnicianWork/TechnicianWork?worker_id=" + this.data.mine.worker_id
    });
  },
  getMine() {
    let that = this;
    let urlStr = app.getNetAddresss("plugin.appointment.frontend.member.get-info");
    app._getNetWork({
      url: urlStr,
      data: {},
      success: function (resdata) {
        var res = resdata.data;
        if (res.result == 1) {
          that.setData({
            mine: res.data
          });
        } else {
          wx.showToast({
            icon: 'none',
            title: res.msg,
            duration: 1500
          });
        }
      },
      fail: function (res) {
        console.log(res);
      }
    });
  }
});