diy_service.js 1.5 KB
Component({
  properties: {
    // 这里定义了innerText属性,属性值可以在组件使用时指定
    object:{
      type: Object,
      value:null
    },
  },
  data: {
     iurl:getApp().globalData.setting.imghost
  },
  
  lifetimes: {
    attached: function() {
		 var th=this;
		 //----获取系统参数-----
		 getApp().getConfig2(function(e) {		 
     	    var json_d = JSON.parse(e.switch_list);
		    th.setData({ sys_switch:json_d,  })
		 })
	}
  },
  
  methods: {
	 berror:function(e){
			 var iurl=getApp().globalData.setting.imghost;
			 var ob={};
			 var txt="object.title_img";
		  	 ob[txt] = iurl +'/miniapp/images/logo.png';
			 this.setData(ob);
	},
	
	//-- 跳到绑定注册会员 --
	go_user:function(){
	    getApp().goto('/pages/togoin/togoin');
	   	return false;
	},

	//---------联系客服------------
	contactService: function() {
	  getApp().getConfig(function(t) {
	    if (t.store_tel == undefined) {
	      getApp().request.get("/api/weshop/store/get/" + os.stoid, {
	        isShowLoading: 1,
	        data: {},
	        success: function(rs) {
	          getApp().globalData.config = rs.data.data;
	          if (rs.data.data.store_tel == null && rs.data.data.store_tel == undefined) {
	            getApp().my_warnning("商家未设置电话", 0, th);
	            return false;
	          }	       		  
			  wx.makePhoneCall({ phoneNumber: rs.data.data.store_tel, })
	        }
	      })
	    } else {
	       wx.makePhoneCall({ phoneNumber: t.store_tel, })
	    }
	  });
	},
  }
})