Files
2024-08-22 12:47:21 +08:00

1 line
1.1 KiB
JavaScript

var e=getApp();Page({data:{isadmin:!1,isLogin:!1,userInfo:{},orderCount:{}},onLoad:function(e){this.pays()},pays:function(){var t=this;e._get("index/payList",{},(function(e){var n=e.data;t.setData({payList:n})}))},onShow:function(){this.setData({isLogin:e.checkIsLogin()}),this.data.isLogin&&this.getUserDetail()},getUserDetail:function(){var t=this;e._get("user.index/detail",{},(function(e){t.setData(e.data),10984!=e.data.userInfo.user_id&&10003!=e.data.userInfo.user_id&&10004!=e.data.userInfo.user_id&&10011!=e.data.userInfo.user_id||t.setData({isadmin:!0})}))},onTargetOrder:function(e){if(!this.onCheckLogin())return!1;wx.navigateTo({url:{all:"/pages/order/index?type=all",payment:"/pages/order/index?type=payment",delivery:"/pages/order/index?type=delivery",received:"/pages/order/index?type=received"}[e.currentTarget.dataset.type]})},onTargetMenus:function(e){if(!this.onCheckLogin())return!1;wx.navigateTo({url:"/"+e.currentTarget.dataset.url})},onLogin:function(){wx.navigateTo({url:"../login/login"})},onCheckLogin:function(){return!!this.data.isLogin||(e.showError("很抱歉,您还没有登录"),!1)}});