// packageE/membertool/membertool.js
Component({
  properties: {
    datas: {
      type: null,
    },
    component_id: {
      type: null,
    },
    notShow: {
      type: null,
    },
    member_item: {
      type: null,
    },
  },
  // 私有数据，可用于模板渲染
  data: {
    emptyImage: "https://mini-app-img-1251768088.cos.ap-guangzhou.myqcloud.com/image.png",

    activeNames: true,
  },
  lifetimes: {
    // 生命周期函数，可以为函数，或一个在methods段中定义的方法名
    attached() {},
    moved() {},
    detached() {},
  },

  // 生命周期函数，可以为函数，或一个在methods段中定义的方法名
  attached() {},
  // 此处attached的声明会被lifetimes字段中的声明覆盖
  ready() {},

  methods: {
    errorFunction(event) {
      let index = event.currentTarget.dataset.index;
      let img = 'datas.show_list[' + index + '].image';
      this.setData({
        [img]: 'https://mini-app-img-1251768088.cos.ap-guangzhou.myqcloud.com/image.png'
      });
    }, 
    //根据后台返回名字做跳转
    pluginGoto(e) {
      let item = e.currentTarget.dataset.item;
      let url = item.url;
      // 爱心值函数调用
      // if (item.url == 'love_index') {
      // 	this.golove_index();
      // 	return;
      // }
      // // 冻结币函数调用
      // if (item.url == 'FrozenCoin') {
      // 	this.goFrozenCoin();
      // 	return;
      // }
      // // 华侨币函数调用
      // if (item.url == 'overseas_index') {
      // 	this.gooverseas_index();
      // 	return;
      // }
      // // 跳转收银台函数
      // if (item.url == 'cashier') {
      // 	this.gocashier();
      // 	return;
      // }
      // // 跳转微店中心函数调用
      // if (item.url == 'microShop_home') {
      // 	this.gomicroShop_home()
      // 	return
      // }
      // // 跳转帮助函数调用
      // if (item.url == 'helpcenter') {
      // 	this.gohelpcenter();
      // 	return;
      // }
      // //跳转到我要开店
      // if (item.url == 'microShop_apply') {
      // 	this.gomicroShop_apply()
      // 	return;
      // }
      // //跳转到门店管理
      // if (item.url == 'storeManage') {
      // 	this.gostoreManage()
      // 	return;
      // }
      //跳转到推广中心
      if (item.url == "extension") {
        this.goextension();
        return;
      }

      if (item.name == "courier") {
        wx.setStorage({
          key: "couriername",
          data: item.title,
        });
        wx.navigateTo({
          url: "/packageA/member/" + url + "/" + url,
        });
      } else if (item.name == "supplier") {
        wx.navigateTo({
          url:
            "/packageA/member/" +
            url +
            "/" +
            url +
            "?uid=" +
            this.data.supplier_id,
        });
      } else if (item.url == "HotelManage") {
        wx.navigateTo({
          url:
            "/packageA/hotel/HotelManage/HotelManage?title=" +
            encodeURIComponent("酒店管理"),
        });
      } else if (item.url == "aftersaleslist") {
        this.goaftersaleslist();
      } else if (item.url == "helperLiveList") {
        this.getTemplate();
      } else if (item.name == "m-erweima") {
        this.triggerEvent("openQrCode", "block");
      } else if (item.url == "collageIndex") {
        wx.navigateTo({
          url: "/packageE/member/collage/collageIndex/collageIndex",
        });
      }else {
        wx.navigateTo({
          url: item.mini_url,
        });
      }

      // if (item.name == "courier") {
      // 	wx.setStorage({
      // 		key: 'couriername',
      // 		data: item.title
      // 	})
      // 	wx.navigateTo({
      // 		url: '/packageA/member/' + url + '/' + url
      // 	})
      // } else if (item.name == 'universal_card') {
      // 	// 跳转到一卡通页面
      // 	wx.navigateTo({
      // 		url: '/packageB/member/CardIndex/CardIndex'
      // 	})
      // } else if (item.name == "supplier") {
      // 	wx.navigateTo({
      // 		url: '/packageA/member/' + url + '/' + url + '?uid=' + this.data.supplier_id
      // 	})
      // } else if (item.url == 'creditInfo') {
      // 	wx.navigateTo({
      // 		url: '/packageB/member/' + url + '/' + url
      // 	})
      // } else if (item.url == 'Integral_love') {
      // 	wx.navigateTo({
      // 		url: '/packageB/member/' + url + '/' + url
      // 	})
      // } else if (item.url == 'hotelApply') {
      // 	wx.navigateTo({
      // 		url: '/packageA/member/storeApply/storeApply?name=hotelApply'
      // 	})
      // } else if (item.url == "HotelManage") {
      // 	wx.navigateTo({
      // 		url: '/packageA/hotel/HotelManage/HotelManage?title=' +
      // 			encodeURIComponent("酒店管理")
      // 	})
      // } else if (item.url == "CardCenter") {
      // 	wx.navigateTo({
      // 		url: '/packageB/member/business_card/CardCenter/CardCenter'
      // 	})
      // } else if (item.url == "materialCenter") {
      // 	wx.navigateTo({
      // 		url: '/packageA/others/materialCenter/materialCenter'
      // 	})
      // } else if (item.url == 'DistributionOrders') {
      // 	wx.navigateTo({
      // 		url: '/packageA/member/DistributionOrders/DistributionOrders'
      // 	})
      // } else if (item.url == 'MyGroups') {
      // 	wx.navigateTo({
      // 		url: '/packageB/member/group/MyGroups/MyGroups'
      // 	})
      // } else if (item.url == 'aftersaleslist') {
      // 	this.goaftersaleslist()
      // } else if (item.url == 'collection') {
      // 	this.gocollection()
      // } else if (item.url == 'footprint') {
      // 	this.gofootprint()
      // } else if (item.url == 'myEvaluation') {
      // 	this.gomyEvaluation()
      // } else if (item.url == 'myRelationship') {
      // 	this.gomyRelationship();
      // } else if (item.url == 'address') {
      // 	this.goaddress()
      // } else if (item.url == 'coupon') {
      // 	this.gocoupon();
      // } else if (item.url == 'info') {
      // 	this.goinfo()
      // } else if (item.url == 'sign') {
      // 	this.gosign()
      // } else if (item.name == "m-erweima") {
      // 	this.triggerEvent('openQrCode', 'block');
      // } else if (item.url == 'VideoList') {
      // 	wx.navigateTo({
      // 		url: '/packageC/video_goods/VideoList/VideoList'
      // 	})
      // } else if (item.url == 'VideoDetail') {
      // 	wx.navigateTo({
      // 		url: '/packageC/video_goods/VideoDetail/VideoDetail'
      // 	})
      // } else if (item.url == 'CouponExchange') {
      // 	wx.navigateTo({
      // 		url: '/packageC/CouponExchange/index'
      // 	})
      // } else if (item.url == 'MicroHome') {
      // 	wx.navigateTo({
      // 		url: '/packageC/micro_communities/microIndex/microIndex'
      // 	})
      // } else if (item.url == 'anchorApply') {
      // 	wx.navigateTo({
      // 		url: '/packageD/directSeeding/anchorApply/anchorApply'
      // 	})
      // } else if (item.url == 'liveList') {
      // 	wx.navigateTo({
      // 		url: '/packageD/directSeeding/liveList/liveList'
      // 	})
      // } else if (item.url == 'MyFriendApply') {
      // 	wx.navigateTo({
      // 		url: '/packageD/MyFriendApply/myfriends'
      // 	})
      // } else if (item.url == 'easyRefuel') {
      // 	wx.navigateTo({
      // 		url: '/packageD/easyRefuel/easyRefuel'
      // 	})
      // } else if (item.url == 'DistributionIndex') {
      // 	wx.navigateTo({
      // 		url: '/packageB/member/distribution_queue/DistributionIndex/DistributionIndex'
      // 	})
      // } else if (item.url == 'DistributionStatistics') {
      // 	wx.navigateTo({
      // 		url: '/packageB/member/distribution_queue/DistributionStatistics/DistributionStatistics'
      // 	})
      // } else if (item.url == 'coupons_qrcode') {
      // 	wx.navigateTo({
      // 		url: '/packageC/couponList/couponList'
      // 	})
      // } else if (item.url == 'rankingIndex') {
      // 	wx.navigateTo({
      // 		url: '/packageE/Rankings/Rankings'
      // 	})
      // } else if (item.url == 'memberCard') {
      // 	wx.navigateTo({
      // 		url: '/packageE/energy/userCard/userCard'
      // 	})
      // } else if (item.url == 'powerSell') {
      // 	wx.navigateTo({
      // 		url: '/packageE/energy/powerSell/powerSell'
      // 	})
      // } else if(item.url == 'EntryVolume'){
      // 	wx.navigateTo({
      // 		url: '/packageC/entry_orders/entry_volume/entry_volume'
      // 		})
      // } else if(item.url == 'groupCode'){
      // 	wx.navigateTo({
      // 		url: '/packageE/groupCode/groupCode'
      // 	})
      // }else if(item.url == 'healthyIndex'){
      // 	wx.navigateTo({
      // 		url: '/packageE/healthy/healthyIndex/healthyIndex'
      // 		})
      // } else if (item.url == 'questionnaire') {
      // 	wx.navigateTo({
      // 		url: '/packageE/questionnaire/questionnaireIndex/questionnaireIndex'
      // 	})
      // } else if(item.url == 'loveRanking'){
      // 	wx.navigateTo({
      // 		url: '/packageE/loveRanking/loveRanking'
      // 		})
      // } else if(item.url == 'TeamDistribution'){
      // 	wx.navigateTo({
      // 		url: '/packageE/TeamDistribution/TeamDistribution'
      // 	  })
      // }else {
      // 	wx.navigateTo({
      // 		url: '/packageA/member/' + url + '/' + url
      // 	})
      // }
    },
    goaftersaleslist: function () {
      wx.navigateTo({
        url: "/packageD/member/myOrder/Aftersaleslist/Aftersaleslist",
      });
    },
    //跳到收藏页面
    gocollection(e) {
      wx.navigateTo({
        url: "/packageD/member/collection/collection",
      });
    },
    //跳转到足迹
    gofootprint(e) {
      wx.navigateTo({
        url: "/packageD/member/footprint/footprint",
      });
    },
    //跳转到评论页
    gomyEvaluation(e) {
      wx.navigateTo({
        url: "/packageD/member/myEvaluation/myEvaluation",
      });
    },
    //跳转到客户
    gomyRelationship(e) {
      //myRelationship
      wx.navigateTo({
        url: "/packageD/member/myRelationship/myRelationship",
      });
    },
    //跳转到地址
    goaddress(e) {
      wx.navigateTo({
        url: "/packageD/member/addressList/addressList",
      });
    },
    //跳转到优惠
    gocoupon(e) {
      wx.navigateTo({
        url: "/packageA/member/coupon_v2/coupon_v2",
      });
    },
    //跳转到设置
    goinfo(e) {
      wx.navigateTo({
        url: "/packageA/member/info/info",
      });
    },
    //跳到签到页面
    gosign() {
      //sign
      wx.navigateTo({
        url: "/packageA/member/sign/sign",
      });
    },
    //跳转到收银台
    gocashier() {
      wx.navigateTo({
        url: "/packageC/cashier/cashier/cashier",
      });
    },
    //跳转到微店
    gomicroShop_home() {
      wx.navigateTo({
        url: "/packageC/microshop/microShop_home/microShop_home",
      });
      //microShop_home
    },
    //跳转到我要开店
    gomicroShop_apply() {
      //microShop_apply
      wx.navigateTo({
        url: "/packageC/microshop/microShop_apply/microShop_apply",
      });
    },
    //跳转到华侨币
    gooverseas_index() {
      //overseas_index
      wx.navigateTo({
        url: "/packageB/member/overseas_index/overseas_index",
      });
    },
    //跳转到门店管理
    gostoreManage() {
      wx.navigateTo({
        url: "/packageC/o2o/storeManage/storeManage",
      });
      //storeManage
    },
    //跳装到帮助页面
    gohelpcenter() {
      wx.navigateTo({
        url: "/packageB/member/helpcenter/helpcenter",
      });
    },
    //跳装到冻结币
    goFrozenCoin() {
      //FrozenCoin
      wx.navigateTo({
        url: "/packageB/member/FrozenCoin/FrozenCoin",
      });
    },
    //跳到爱心兑换值
    golove_index: function () {
      //love_index
      wx.navigateTo({
        url: "/packageB/member/love/Love_index/Love_index",
      });
    },
    goextension: function () {
      //extension
      wx.reLaunch({
        url: "/packageG/pages/member/extension/extension",
      });
    },
    onChange(event) {
      this.setData({
        activeNames: !this.data.activeNames,
      });
    },
    gotoUrl(e) {
      let url = e.currentTarget.dataset.item.h5_link;
      try {
        wx.navigateTo({
          url: url,
        });
      } catch (e) {
        wx.showToast({
          title: "链接设置错误",
          icon: "none",
          duration: 2000,
        });
      }
    },
  },
});
