// components/servicemodal/servicemodal.js
Component({

  /**
   * Component properties
   */
  properties: {
    show_hide_button: {
      type: Boolean,
      value: false,
    },
    wechat_channel: {
      type: Boolean,
      value: false,
    },
  },

  /**
   * Component initial data
   */
  data: {
    qr_url: 'https://emblem-resources.oss-accelerate.aliyuncs.com/service-qr2.png',
    title: '',
  },

  /**
   * Component methods
   */
  methods: {
    close() {
      console.log('servic modal close');
      this.triggerEvent('hide', {}, {});
    }
  },

  attached() {
    var gd = getApp().globalData;
    var tid = gd.tenant_id || '';
    var qr_url = gd.server_url + "/api/v1/service-qr/?tenant=" + tid;
    var title = '';
    console.log(qr_url);
    if (this.properties.wechat_channel) {
      qr_url = "https://emblem-resources.oss-accelerate.aliyuncs.com/wechat-channel.png"
      title = "长按识别二维码，关注公众号"
    } else {
      title = "长按识别二维码，添加人工客服"
    }
    this.setData({
      qr_url,
      title,
    });
  }
})
