MenuBox.js 2.01 KB
Component({
  data: {},
  properties: {
    menuList: {
      type: Array,
      value: []
    },
    boxType: Number,//0 省心出行  1养车服务
  },
  methods: {
    toJump(e) {
      const { item } = e.currentTarget.dataset
      console.log(item);
      const { boxType } = this.data
      if (boxType == 1) {
        this.jump(e)
      } else if (boxType == 0) {
        this.toNewPage(e)
      }
    },
    // 养车服务跳转
    jump(e) {
      let {
        url,
        item
      } = e.currentTarget.dataset
      if (item.tabBar) {
        wx.p.router.getPageInstance().changeTabBar({
          detail: 2
        })
        return
      }
      if (url) wx.p.router.go(`${url}`)
      if (item) {
        if (item.h5) wx.p.router.jumpH5(item.h5)
        else {
          if (item.url == 'navigation') wx.p.router.go(item.url)
          else {
            if (item.url) wx.p.router.go(item.url, item)
            else wx.showModal({
              content: '即将上线,敬请期待',
              confirmText: '知道了',
              showCancel: false,
              confirmColor: '#F13C3D'
            })
          }
        }
      }
    },
    // 省心出行
    toNewPage(e) {
      const { item } = e.currentTarget.dataset
      let url = '',para={}
      if (item.supplier == 'GL_ROAD_RESCUE') {
        url = '/packageEquity/pages/road/index/index'
      } else if (item.appearance == 1) {
         para = {
          supplier: item.supplier,
          brandName: item.brandName,
          location: true
        }
        const temp = JSON.stringify(para)
        url = '/packageSaveMoney/pages/detail/detail'
      } else if (item.appearance == 2) {
         para = {
          supplier: item.supplier,
          brandName: item.brandName,
          icon: item.equityIcon
        }
        const temp = JSON.stringify(para)
        url = '/packageSaveMoney/pages/chargeDetail/chargeDetail'
      }
      wx.p.router.go(url, {param:para,notIntercept:true})
      // wx.navigateTo({
      //   url
      // })
    }
  }
})