// packageG/pages/customer_chat/customer_chat.js
var os = getApp().globalData.setting;
var ut = require("../../../utils/util.js");

Page({

  /**
   * 页面的初始数据
   */
  data: {
    chatUrl:'', // 聊天页面地址
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {
    let goods_id=options.goods_id;
    let type=options.type;
    let user_id=getApp().globalData.user_id;
    if(!user_id){
      ut.m_toast("请先登录")
      setTimeout(()=> {
          getApp().goto("/packageE/pages/togoin/togoin")
      },2000)
      return false;
    }

    let url= os.h5_host+"/mchat/mbchat/index?is_webview=1&goods_id="+goods_id+"&stoid="+os.stoid+"&user_id="+user_id;
    if(type)
      url= os.h5_host+"/mchat/mbchat/index?is_webview=1&card_id="+goods_id+"&stoid="+os.stoid+"&user_id="+user_id;

    console.log("chat"+url);
    this.setData({
      chatUrl:url
    })

  },


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

  },

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

  }

})