960 lines
26 KiB
JavaScript
960 lines
26 KiB
JavaScript
var WxParse = null;
|
||
var app = getApp()
|
||
var that = null
|
||
var that0 = null
|
||
var sopenFrame = null
|
||
Page({
|
||
data: {
|
||
avatarUrl: "",
|
||
NCName: "您还没有登录,请先登录!",
|
||
UserName: "",
|
||
uLevel: "普通会员",
|
||
serverHidden: true,
|
||
authorizeHidden: true,
|
||
authorizetitle: "确认授权",
|
||
myagentHidden: true,
|
||
servermsg: "",
|
||
IFagent: 0,
|
||
uLevel1: "",
|
||
sjuLevel: 0,
|
||
sjuLevel0: 0,
|
||
dluLevel: 0,
|
||
tgyuLevel: 0,
|
||
IFYGM: 0,
|
||
xjjye: "0.00",
|
||
btjye: "0.00",
|
||
tgmeye: 0,
|
||
jhmye: 0,
|
||
xjye: "0.00",
|
||
mfye: "0.00",
|
||
gxzye: "0.00",
|
||
zzedye: "0.00",
|
||
ggzye: "0.00",
|
||
yjhsjnum: 0,
|
||
ordercount: 0,
|
||
ordercount0: 0,
|
||
ordercount1: 0,
|
||
ordercount2: 0,
|
||
logout: "安全退出",
|
||
yqm: "",
|
||
ifshowzzjf: 1,
|
||
voucherNum:0.00, //兑换券数量
|
||
isSignToday:false //今天是否已签到
|
||
},
|
||
onShow: function () {
|
||
if (typeof this.getTabBar === 'function' && this.getTabBar()) {
|
||
that0 = this;
|
||
var userId = wx.getStorageSync("userId")
|
||
var userInfodata = wx.getStorageSync("userInfo")
|
||
var sel = 3;
|
||
var ifsel = 0;
|
||
if (userId && userInfodata) {
|
||
var userInfo = JSON.parse(userInfodata)
|
||
ifsel = userInfo.bdshEnable;
|
||
that0.GetSignInfo();
|
||
}
|
||
|
||
if (ifsel == 1) {
|
||
sel = 3;
|
||
that0.getTabBar().setData({
|
||
"list": [{
|
||
"pagePath": "/pages/index/index",
|
||
"text": "首页",
|
||
"iconPath": "/images/footer-icon-01.png",
|
||
"selectedIconPath": "/images/footer-icon-01-active.png"
|
||
},
|
||
{
|
||
"pagePath": "/pages/news/index",
|
||
"iconPath": "/images/footer-icon-05.png",
|
||
"selectedIconPath": "/images/footer-icon-05-active.png",
|
||
"text": "资讯"
|
||
},
|
||
{
|
||
"pagePath": "/pages/my/index",
|
||
"text": "我的",
|
||
"iconPath": "/images/footer-icon-04.png",
|
||
"selectedIconPath": "/images/footer-icon-04-active.png"
|
||
}
|
||
]
|
||
})
|
||
} else {
|
||
that0.getTabBar().setData({
|
||
"list": [{
|
||
"pagePath": "/pages/index/index",
|
||
"text": "首页",
|
||
"iconPath": "/images/footer-icon-01.png",
|
||
"selectedIconPath": "/images/footer-icon-01-active.png"
|
||
},
|
||
{
|
||
"pagePath": "/pages/news/index",
|
||
"iconPath": "/images/footer-icon-05.png",
|
||
"selectedIconPath": "/images/footer-icon-05-active.png",
|
||
"text": "资讯"
|
||
},
|
||
{
|
||
"pagePath": "/pages/business/index",
|
||
"iconPath": "/images/footer-icon-02.png",
|
||
"selectedIconPath": "/images/footer-icon-02-active.png",
|
||
"text": "门店"
|
||
},
|
||
{
|
||
"pagePath": "/pages/my/index",
|
||
"text": "我的",
|
||
"iconPath": "/images/footer-icon-04.png",
|
||
"selectedIconPath": "/images/footer-icon-04-active.png"
|
||
}
|
||
]
|
||
})
|
||
}
|
||
that0.getTabBar().setData({
|
||
selected: sel
|
||
})
|
||
}
|
||
},
|
||
|
||
onLoad: function () {
|
||
WxParse = require('../../wxParse/wxParse.js');
|
||
that = this
|
||
wx.setBackgroundColor({
|
||
backgroundColor: "#00B050",
|
||
})
|
||
that.rdata(0)
|
||
|
||
sopenFrame = setInterval(function () {
|
||
if (app.globalData.IFRefreshmy == 1) {
|
||
app.globalData.IFRefreshmy = 0
|
||
that.rdata(0)
|
||
}
|
||
}, 1000);
|
||
},
|
||
onPullDownRefresh: function () {
|
||
//在当前页面显示导航条加载动画
|
||
wx.showNavigationBarLoading();
|
||
//显示 loading 提示框。需主动调用 wx.hideLoading 才能关闭提示框
|
||
wx.showLoading({
|
||
title: '刷新中...',
|
||
})
|
||
app.globalData.IFRefreshindex = 1
|
||
that.rdata(1)
|
||
},
|
||
rdata: function (t) {
|
||
var servermsg = wx.getStorageSync("servermsg")
|
||
if (servermsg) {
|
||
WxParse.wxParse('servermsg', 'html', servermsg, that)
|
||
}
|
||
|
||
var userId = wx.getStorageSync("userId")
|
||
var LoginId = wx.getStorageSync("LoginId")
|
||
var userInfodata = wx.getStorageSync("userInfo")
|
||
|
||
if (userId && LoginId && userInfodata) {
|
||
var userInfo = JSON.parse(userInfodata)
|
||
var UserPic = (userInfo.UserPic == "" ? "../../images/logo.png" : userInfo.UserPic)
|
||
var NCName = userInfo.RealName;
|
||
var userlist = [{
|
||
icon: '../../images/iconfont-user.png',
|
||
url: '../myusers/index',
|
||
text: '我的会员'
|
||
}, {
|
||
icon: '../../images/iconfont-user.png',
|
||
url: '../myskusers/index',
|
||
text: '我的锁客'
|
||
}, {
|
||
icon: '../../images/iconfont-tgm.png',
|
||
url: '../mytgm/index',
|
||
text: '我的邀请码'
|
||
}, {
|
||
icon: '../../images/iconfont-favorite.png',
|
||
url: '../myfavorite/index',
|
||
text: '我的收藏'
|
||
}, {
|
||
icon: '../../images/iconfont-kefu.png',
|
||
url: '../mykf/index',
|
||
text: '联系客服'
|
||
}, {
|
||
icon: '../../images/iconfont-set.png',
|
||
url: '../myto/index',
|
||
text: '个人设置'
|
||
}];
|
||
if (userInfo.id > 68 && userInfo.bdshEnable == 0) {
|
||
userlist = [
|
||
{
|
||
icon: '../../images/iconfont-online.png',
|
||
url: (userInfo.sjuLevel0 == 2 ? '../mybusiness0/index' : (userInfo.sjuLevel0 == 1 ? '' : '../appbusiness0/index')),
|
||
text: (userInfo.sjuLevel0 == 2 ? '事业部管理' : (userInfo.sjuLevel0 == 1 ? '申请线上供应链正在审核中...' : '申请门店'))
|
||
},
|
||
{
|
||
icon: '../../images/iconfont-user.png',
|
||
url: '../myusers/index',
|
||
text: '我的会员'
|
||
}, {
|
||
icon: '../../images/iconfont-user.png',
|
||
url: '../myskusers/index',
|
||
text: '我的锁客'
|
||
}, {
|
||
icon: '../../images/iconfont-tgm.png',
|
||
url: '../mytgm/index',
|
||
text: '我的邀请码'
|
||
}, {
|
||
icon: '../../images/iconfont-favorite.png',
|
||
url: '../myfavorite/index',
|
||
text: '我的收藏'
|
||
}, {
|
||
icon: '../../images/iconfont-kefu.png',
|
||
url: '../mykf/index',
|
||
text: '联系客服'
|
||
}, {
|
||
icon: '../../images/iconfont-set.png',
|
||
url: '../myto/index',
|
||
text: '个人设置'
|
||
}
|
||
];
|
||
}
|
||
if ((userInfo.ifyjhsj > 0 || userInfo.sjuLevel > 0) && userInfo.id > 68 && userInfo.bdshEnable == 0) {
|
||
userlist = [{
|
||
icon: '../../images/iconfont-offline.png',
|
||
url: (userInfo.sjuLevel == 2 ? '../mybusiness/index' : (userInfo.sjuLevel == 1 ? '正在审核中,请等待审核再来' : '../appbusiness/index')),
|
||
text: (userInfo.sjuLevel == 2 ? '联盟商家管理' : (userInfo.sjuLevel == 1 ? '申请线下商家正在审核中...' : '申请线下商家(联盟商家)'))
|
||
},
|
||
/*
|
||
{
|
||
icon: '../../images/iconfont-online.png',
|
||
url:(userInfo.sjuLevel0==2?'../mybusiness0/index':(userInfo.sjuLevel0==1?'正在审核中,请等待审核再来':'../appbusiness0/index')),
|
||
text: (userInfo.sjuLevel0==2?'事业部管理':(userInfo.sjuLevel0==1?'申请线上供应链正在审核中...':'申请线上供应链(事业部)'))
|
||
},
|
||
*/
|
||
{
|
||
icon: '../../images/iconfont-user.png',
|
||
url: '../myusers/index',
|
||
text: '我的会员'
|
||
}, {
|
||
icon: '../../images/iconfont-user.png',
|
||
url: '../myskusers/index',
|
||
text: '我的锁客'
|
||
}, {
|
||
icon: '../../images/iconfont-tgm.png',
|
||
url: '../mytgm/index',
|
||
text: '我的邀请码'
|
||
}, {
|
||
icon: '../../images/iconfont-favorite.png',
|
||
url: '../myfavorite/index',
|
||
text: '我的收藏'
|
||
}, {
|
||
icon: '../../images/iconfont-kefu.png',
|
||
url: '../mykf/index',
|
||
text: '联系客服'
|
||
}, {
|
||
icon: '../../images/iconfont-set.png',
|
||
url: '../myto/index',
|
||
text: '个人设置'
|
||
}
|
||
]
|
||
|
||
}
|
||
that.setData({
|
||
userListInfo: userlist
|
||
})
|
||
|
||
that.setData({
|
||
avatarUrl: (UserPic != "" ? UserPic : ""),
|
||
NCName: NCName,
|
||
UserName: userInfo.UserName,
|
||
uLevel: userInfo.uLevel,
|
||
uLevel1: userInfo.uLevel1,
|
||
sjuLevel: userInfo.sjuLevel,
|
||
sjuLevel0: userInfo.sjuLevel0,
|
||
dluLevel: userInfo.dluLevel,
|
||
tgyuLevel: userInfo.tgyuLevel,
|
||
IFYGM: userInfo.IFYGM,
|
||
xjjye: userInfo.xjjye,
|
||
btjye: userInfo.btjye,
|
||
tgmeye: userInfo.tgmeye,
|
||
jhmye: userInfo.jhmye,
|
||
xjye: userInfo.xjye,
|
||
mfye: userInfo.mfye,
|
||
gxzye: userInfo.gxzye,
|
||
zzedye: userInfo.zzedye,
|
||
ggzye: userInfo.ggzye,
|
||
yjhsjnum: userInfo.yjhsjnum,
|
||
ifshowzzjf: userInfo.ifshowzzjf,
|
||
loadingHidden: true
|
||
})
|
||
|
||
} else {
|
||
|
||
that.setData({
|
||
userListInfo: [{
|
||
icon: '../../images/iconfont-user.png',
|
||
url: '../myusers/index',
|
||
text: '我的会员'
|
||
}, {
|
||
icon: '../../images/iconfont-tgm.png',
|
||
url: '../mytgm/index',
|
||
text: '我的邀请码'
|
||
}, {
|
||
icon: '../../images/iconfont-favorite.png',
|
||
url: '../myfavorite/index',
|
||
text: '我的收藏'
|
||
}, {
|
||
icon: '../../images/iconfont-kefu.png',
|
||
text: '联系客服'
|
||
}, {
|
||
icon: '../../images/iconfont-set.png',
|
||
url: '../myto/index',
|
||
text: '个人设置'
|
||
}],
|
||
|
||
avatarUrl: "",
|
||
NCName: "您还没有登录,请先登录!",
|
||
uLevel: "普通会员",
|
||
IFYGM: 0,
|
||
sjuLevel: 0,
|
||
sjuLevel0: 0,
|
||
dluLevel: 0,
|
||
tgyuLevel: 0,
|
||
xjjye: "0.00",
|
||
tgmeye: 0,
|
||
jhmye: 0,
|
||
xjye: "0.00",
|
||
mfye: "0.00",
|
||
gxzye: "0.00",
|
||
zzedye: "0.00",
|
||
ggzye: "0.00",
|
||
ordercount: 0,
|
||
ordercount0: 0,
|
||
ordercount1: 0,
|
||
ordercount2: 0,
|
||
loadingHidden: true
|
||
})
|
||
|
||
}
|
||
if (t == 1) {
|
||
//隐藏loading 提示框
|
||
wx.hideLoading();
|
||
//隐藏导航条加载动画
|
||
wx.hideNavigationBarLoading();
|
||
//停止下拉刷新
|
||
wx.stopPullDownRefresh();
|
||
}
|
||
},
|
||
gotourl: function (e) {
|
||
var userId = wx.getStorageSync("userId")
|
||
var LoginId = wx.getStorageSync("LoginId")
|
||
var userInfodata = wx.getStorageSync("userInfo")
|
||
if (userId && LoginId && userInfodata) {
|
||
var index = e.currentTarget.dataset.id
|
||
if (index != 30) {
|
||
var userInfo = JSON.parse(userInfodata)
|
||
var url = that.data.userListInfo[index].url;
|
||
var b = true;
|
||
if (url == "正在审核中,请等待审核再来") {
|
||
wx.showToast({
|
||
title: url,
|
||
icon: "none",
|
||
duration: 3000
|
||
})
|
||
b = false;
|
||
}
|
||
if (b) {
|
||
wx.navigateTo({
|
||
url: url
|
||
})
|
||
}
|
||
} else {
|
||
that.setData({
|
||
serverHidden: false
|
||
})
|
||
}
|
||
} else {
|
||
wx.navigateTo({
|
||
url: "../login/index"
|
||
})
|
||
}
|
||
},
|
||
gouserinfo: function (e) {
|
||
var userId = wx.getStorageSync("userId")
|
||
var LoginId = wx.getStorageSync("LoginId")
|
||
var userInfodata = wx.getStorageSync("userInfo")
|
||
if (userId && LoginId && userInfodata) {
|
||
wx.navigateTo({
|
||
url: "../myto/index"
|
||
})
|
||
} else {
|
||
wx.navigateTo({
|
||
url: "../login/index"
|
||
})
|
||
}
|
||
},
|
||
onhuazhuan: function (e) {
|
||
var userId = wx.getStorageSync("userId")
|
||
var LoginId = wx.getStorageSync("LoginId")
|
||
var userInfodata = wx.getStorageSync("userInfo")
|
||
if (userId && LoginId && userInfodata) {
|
||
wx.navigateTo({
|
||
url: "../zhuanhuan/index"
|
||
})
|
||
} else {
|
||
wx.navigateTo({
|
||
url: "../login/index"
|
||
})
|
||
}
|
||
},
|
||
onduihuan: function (e) {
|
||
var userId = wx.getStorageSync("userId")
|
||
var LoginId = wx.getStorageSync("LoginId")
|
||
var userInfodata = wx.getStorageSync("userInfo")
|
||
if (userId && LoginId && userInfodata) {
|
||
wx.navigateTo({
|
||
url: "../duihuan/index"
|
||
})
|
||
} else {
|
||
wx.navigateTo({
|
||
url: "../login/index"
|
||
})
|
||
}
|
||
},
|
||
onkttgy: function (e) {
|
||
var userId = wx.getStorageSync("userId")
|
||
var LoginId = wx.getStorageSync("LoginId")
|
||
var userInfodata = wx.getStorageSync("userInfo")
|
||
var t = e.currentTarget.dataset.id
|
||
if (userId && LoginId && userInfodata) {
|
||
wx.navigateTo({
|
||
url: "../kttgy/index?t=" + t
|
||
})
|
||
} else {
|
||
wx.navigateTo({
|
||
url: "../login/index"
|
||
})
|
||
}
|
||
},
|
||
onauthorize: function () {
|
||
|
||
wx.authorize({
|
||
scope: 'scope.userInfo',
|
||
success() {
|
||
that.getUserInfoto(1)
|
||
}
|
||
})
|
||
that.setData({
|
||
authorizeHidden: true
|
||
})
|
||
},
|
||
closeauth: function (e) {
|
||
|
||
that.setData({
|
||
authorizeHidden: true
|
||
})
|
||
},
|
||
closemyagent: function (e) {
|
||
|
||
that.setData({
|
||
myagentHidden: true
|
||
})
|
||
},
|
||
getUserInfoto: function (t) {
|
||
wx.getUserInfo({
|
||
success: function (res1) {
|
||
|
||
|
||
var userInfo = res1.userInfo
|
||
var nickName = userInfo.nickName
|
||
var avatarUrl = userInfo.avatarUrl
|
||
var gender = userInfo.gender //性别 0:未知、1:男、2:女
|
||
var province = userInfo.province
|
||
var city = userInfo.city
|
||
var country = userInfo.country
|
||
that.setData({
|
||
authorizetitle: "授权中..."
|
||
})
|
||
var userId = wx.getStorageSync("userId")
|
||
var LoginId = wx.getStorageSync("LoginId")
|
||
wx.request({
|
||
url: app.globalData.apiurl + "/xapiajax.ashx",
|
||
data: {
|
||
action: "updateWxUserInfo",
|
||
userId: (!userId ? "" : userId),
|
||
LoginId: (!LoginId ? "" : LoginId),
|
||
ncname: nickName,
|
||
avatar: avatarUrl,
|
||
gender: gender,
|
||
province: province,
|
||
city: city,
|
||
country: country
|
||
},
|
||
method: "POST",
|
||
dataType: "json",
|
||
header: {
|
||
"content-type": "application/x-www-form-urlencoded" // 默认值
|
||
},
|
||
success(res2) {
|
||
wx.setStorageSync('userInfo', JSON.stringify(res2.data.userInfo))
|
||
app.globalData.IFRefreshmy = 1
|
||
if (t == 1) {
|
||
wx.showToast({
|
||
title: "授权成功",
|
||
icon: "success",
|
||
duration: 3000
|
||
})
|
||
|
||
}
|
||
that.setData({
|
||
authorizeHidden: true,
|
||
authorizetitle: "确认授权",
|
||
avatar: res2.data.avatar
|
||
})
|
||
}
|
||
|
||
})
|
||
}
|
||
})
|
||
},
|
||
closeserver: function (e) {
|
||
that.setData({
|
||
serverHidden: true
|
||
})
|
||
},
|
||
inserver: function (e) {
|
||
|
||
},
|
||
inauth: function (e) {
|
||
|
||
},
|
||
onnews: function (e) {
|
||
var t = e.currentTarget.dataset.id
|
||
if (t == 2) {
|
||
wx.navigateTo({
|
||
url: "../news/index"
|
||
})
|
||
} else {
|
||
wx.navigateTo({
|
||
url: "../news/index"
|
||
})
|
||
}
|
||
},
|
||
onWithdrawal: function (e) {
|
||
var userId = wx.getStorageSync("userId")
|
||
var LoginId = wx.getStorageSync("LoginId")
|
||
var userInfodata = wx.getStorageSync("userInfo")
|
||
var ifdl = true;
|
||
if (!userId || !LoginId) {
|
||
ifdl = false;
|
||
wx.navigateTo({
|
||
url: "../login/index"
|
||
})
|
||
} else {
|
||
var userInfo = JSON.parse(userInfodata);
|
||
if (userInfo.Phone == "") {
|
||
ifdl = false;
|
||
wx.showToast({
|
||
title: "您还没有绑定手机号",
|
||
icon: "none",
|
||
duration: 2000
|
||
})
|
||
wx.navigateTo({
|
||
url: "../myphone/index"
|
||
})
|
||
}
|
||
}
|
||
if (ifdl) {
|
||
var t = e.currentTarget.dataset.id
|
||
wx.navigateTo({
|
||
url: "../withdrawal/index?t=" + t
|
||
})
|
||
}
|
||
},
|
||
onincome: function (e) {
|
||
var userId = wx.getStorageSync("userId")
|
||
var LoginId = wx.getStorageSync("LoginId")
|
||
var userInfodata = wx.getStorageSync("userInfo")
|
||
var ifdl = true;
|
||
if (!userId || !LoginId) {
|
||
ifdl = false;
|
||
wx.navigateTo({
|
||
url: "../login/index"
|
||
})
|
||
} else {
|
||
var userInfo = JSON.parse(userInfodata);
|
||
if (userInfo.Phone == "") {
|
||
ifdl = false;
|
||
wx.showToast({
|
||
title: "您还没有绑定手机号",
|
||
icon: "none",
|
||
duration: 2000
|
||
})
|
||
wx.navigateTo({
|
||
url: "../myphone/index"
|
||
})
|
||
}
|
||
}
|
||
if (ifdl) {
|
||
wx.navigateTo({
|
||
url: "../myincome/index"
|
||
})
|
||
}
|
||
},
|
||
oncz: function (e) {
|
||
var userId = wx.getStorageSync("userId")
|
||
var LoginId = wx.getStorageSync("LoginId")
|
||
var userInfodata = wx.getStorageSync("userInfo")
|
||
var ifdl = true;
|
||
if (!userId || !LoginId) {
|
||
ifdl = false;
|
||
wx.navigateTo({
|
||
url: "../login/index"
|
||
})
|
||
} else {
|
||
var userInfo = JSON.parse(userInfodata);
|
||
if (userInfo.Phone == "") {
|
||
ifdl = false;
|
||
wx.showToast({
|
||
title: "您还没有绑定手机号",
|
||
icon: "none",
|
||
duration: 2000
|
||
})
|
||
wx.navigateTo({
|
||
url: "../myphone/index"
|
||
})
|
||
}
|
||
}
|
||
if (ifdl) {
|
||
wx.navigateTo({
|
||
url: "../chongzhi/index"
|
||
})
|
||
}
|
||
},
|
||
onzz: function (e) {
|
||
var userId = wx.getStorageSync("userId")
|
||
var LoginId = wx.getStorageSync("LoginId")
|
||
var userInfodata = wx.getStorageSync("userInfo")
|
||
var t = e.currentTarget.dataset.id
|
||
var ifdl = true;
|
||
if (!userId || !LoginId) {
|
||
ifdl = false;
|
||
wx.navigateTo({
|
||
url: "../login/index"
|
||
})
|
||
} else {
|
||
var userInfo = JSON.parse(userInfodata);
|
||
if (userInfo.Phone == "") {
|
||
ifdl = false;
|
||
wx.showToast({
|
||
title: "您还没有绑定手机号",
|
||
icon: "none",
|
||
duration: 2000
|
||
})
|
||
wx.navigateTo({
|
||
url: "../myphone/index"
|
||
})
|
||
}
|
||
}
|
||
if (ifdl) {
|
||
wx.navigateTo({
|
||
url: "../zhuanzhang/index?t=" + t
|
||
})
|
||
}
|
||
},
|
||
onzh: function (e) {
|
||
var userId = wx.getStorageSync("userId")
|
||
var LoginId = wx.getStorageSync("LoginId")
|
||
var userInfodata = wx.getStorageSync("userInfo")
|
||
var ifdl = true;
|
||
if (!userId || !LoginId) {
|
||
ifdl = false;
|
||
wx.navigateTo({
|
||
url: "../login/index"
|
||
})
|
||
} else {
|
||
var userInfo = JSON.parse(userInfodata);
|
||
if (userInfo.Phone == "") {
|
||
ifdl = false;
|
||
wx.showToast({
|
||
title: "您还没有绑定手机号",
|
||
icon: "none",
|
||
duration: 2000
|
||
})
|
||
wx.navigateTo({
|
||
url: "../myphone/index"
|
||
})
|
||
}
|
||
}
|
||
if (ifdl) {
|
||
wx.navigateTo({
|
||
url: "../zhuanhuan/index"
|
||
})
|
||
}
|
||
},
|
||
onbalance: function (e) {
|
||
var userId = wx.getStorageSync("userId")
|
||
var LoginId = wx.getStorageSync("LoginId")
|
||
var userInfodata = wx.getStorageSync("userInfo")
|
||
var ifdl = true;
|
||
if (!userId || !LoginId) {
|
||
ifdl = false;
|
||
wx.navigateTo({
|
||
url: "../login/index"
|
||
})
|
||
} else {
|
||
var userInfo = JSON.parse(userInfodata);
|
||
if (userInfo.Phone == "") {
|
||
ifdl = false;
|
||
wx.showToast({
|
||
title: "您还没有绑定手机号",
|
||
icon: "none",
|
||
duration: 2000
|
||
})
|
||
wx.navigateTo({
|
||
url: "../myphone/index"
|
||
})
|
||
}
|
||
}
|
||
if (ifdl) {
|
||
var t = e.currentTarget.dataset.id
|
||
if (t == 9) {
|
||
wx.navigateTo({
|
||
url: "../zzjf/index"
|
||
})
|
||
} else {
|
||
wx.navigateTo({
|
||
url: "../mybalance/index?t=" + t
|
||
})
|
||
}
|
||
}
|
||
},
|
||
onSignInList:function(e)
|
||
{
|
||
console.log("跳转到兑换券记录列表");
|
||
wx.navigateTo({
|
||
url: "../checkin_log/index"
|
||
})
|
||
},
|
||
onbonus: function (e) {
|
||
var userId = wx.getStorageSync("userId")
|
||
var LoginId = wx.getStorageSync("LoginId")
|
||
var userInfodata = wx.getStorageSync("userInfo")
|
||
var ifdl = true;
|
||
if (!userId || !LoginId) {
|
||
ifdl = false;
|
||
wx.navigateTo({
|
||
url: "../login/index"
|
||
})
|
||
} else {
|
||
var userInfo = JSON.parse(userInfodata);
|
||
if (userInfo.Phone == "") {
|
||
ifdl = false;
|
||
wx.showToast({
|
||
title: "您还没有绑定手机号",
|
||
icon: "none",
|
||
duration: 2000
|
||
})
|
||
wx.navigateTo({
|
||
url: "../myphone/index"
|
||
})
|
||
}
|
||
}
|
||
if (ifdl) {
|
||
var t = e.currentTarget.dataset.id
|
||
|
||
wx.navigateTo({
|
||
url: "../mybonus/index?t=" + t
|
||
})
|
||
}
|
||
},
|
||
onpt: function (e) {
|
||
var userId = wx.getStorageSync("userId")
|
||
var LoginId = wx.getStorageSync("LoginId")
|
||
var userInfodata = wx.getStorageSync("userInfo")
|
||
var ifdl = true;
|
||
if (!userId || !LoginId) {
|
||
ifdl = false;
|
||
wx.navigateTo({
|
||
url: "../login/index"
|
||
})
|
||
} else {
|
||
var userInfo = JSON.parse(userInfodata);
|
||
if (userInfo.Phone == "") {
|
||
ifdl = false;
|
||
wx.showToast({
|
||
title: "您还没有绑定手机号",
|
||
icon: "none",
|
||
duration: 2000
|
||
})
|
||
wx.navigateTo({
|
||
url: "../myphone/index"
|
||
})
|
||
}
|
||
}
|
||
if (ifdl) {
|
||
var t = e.currentTarget.dataset.id
|
||
|
||
wx.navigateTo({
|
||
url: "../mypt/index?t=" + t
|
||
})
|
||
}
|
||
},
|
||
onorder: function (e) {
|
||
var userId = wx.getStorageSync("userId")
|
||
var LoginId = wx.getStorageSync("LoginId")
|
||
var userInfodata = wx.getStorageSync("userInfo")
|
||
var ifdl = true;
|
||
if (!userId || !LoginId) {
|
||
ifdl = false;
|
||
wx.navigateTo({
|
||
url: "../login/index"
|
||
})
|
||
} else {
|
||
var userInfo = JSON.parse(userInfodata);
|
||
if (userInfo.Phone == "") {
|
||
ifdl = false;
|
||
wx.showToast({
|
||
title: "您还没有绑定手机号",
|
||
icon: "none",
|
||
duration: 2000
|
||
})
|
||
wx.navigateTo({
|
||
url: "../myphone/index"
|
||
})
|
||
}
|
||
}
|
||
if (ifdl) {
|
||
var nav = e.currentTarget.dataset.id
|
||
var t = e.currentTarget.dataset.index
|
||
wx.navigateTo({
|
||
url: "../myorder/index?t=" + t + "&nav=" + nav
|
||
})
|
||
}
|
||
},
|
||
logout: function (e) {
|
||
var userId = wx.getStorageSync("userId")
|
||
var LoginId = wx.getStorageSync("LoginId")
|
||
if (userId && LoginId) {
|
||
wx.showModal({
|
||
title: '安全提示',
|
||
content: '您确认要退出系统吗?',
|
||
success(res0) {
|
||
if (res0.confirm) {
|
||
that.setData({
|
||
logout: "请稍候..."
|
||
})
|
||
|
||
wx.request({
|
||
url: app.globalData.apiurl + "/xapiajax.ashx",
|
||
data: {
|
||
action: "logout",
|
||
userId: (!userId ? "" : userId),
|
||
LoginId: (!LoginId ? "" : LoginId)
|
||
},
|
||
method: "POST",
|
||
dataType: "json",
|
||
header: {
|
||
"content-type": "application/x-www-form-urlencoded" // 默认值
|
||
},
|
||
success(res) {
|
||
|
||
wx.removeStorageSync('userId')
|
||
wx.removeStorageSync('LoginId')
|
||
wx.removeStorageSync('userInfo')
|
||
app.globalData.IFLogin = 0
|
||
app.globalData.IFRefreshmy = 1
|
||
app.globalData.IFRefreshindex = 1
|
||
|
||
sopenFrame = setInterval(function () {
|
||
clearInterval(sopenFrame);
|
||
that.setData({
|
||
logout: "安全退出"
|
||
})
|
||
wx.navigateBack({})
|
||
wx.navigateTo({
|
||
url: "../login/index"
|
||
})
|
||
}, 1000)
|
||
|
||
|
||
}
|
||
})
|
||
}
|
||
}
|
||
})
|
||
} else {
|
||
wx.navigateTo({
|
||
url: "../login/index"
|
||
})
|
||
}
|
||
},
|
||
copy: function (e) {
|
||
var font = e.currentTarget.dataset.font
|
||
wx.setClipboardData({
|
||
data: font,
|
||
success: function (res) {
|
||
wx.showToast({
|
||
title: "复制成功"
|
||
})
|
||
}
|
||
})
|
||
},
|
||
onSignIn : function(e){
|
||
console.log("开始签到");
|
||
var that = this
|
||
var userId = wx.getStorageSync("userId")
|
||
if (userId) {
|
||
wx.request({
|
||
url: app.globalData.apiurl + "/api/api.ashx?action=user_sign_in",
|
||
data: { userId: (!userId ? "" : userId) },
|
||
method: "POST",
|
||
dataType: "json",
|
||
header: {"content-type": "application/x-www-form-urlencoded"},
|
||
success(res) {
|
||
if(res.data.status==1)
|
||
{
|
||
that.setData({
|
||
isSignToday: true,
|
||
voucherNum: res.data.point
|
||
})
|
||
console.log("签到成功");
|
||
wx.showToast({
|
||
title: res.data.msg,
|
||
icon: "success",
|
||
duration: 3000
|
||
})
|
||
}else{
|
||
console.log("签到失败");
|
||
wx.showToast({
|
||
title: res.data.msg,
|
||
icon: "success",
|
||
duration: 3000
|
||
})
|
||
}
|
||
}
|
||
})
|
||
}
|
||
},
|
||
GetSignInfo: function (e) {
|
||
var that = this
|
||
var userId = wx.getStorageSync("userId")
|
||
var userInfodata = wx.getStorageSync("userInfo")
|
||
if (userId && userInfodata) {
|
||
wx.request({
|
||
url: app.globalData.apiurl + "/api/api.ashx?action=user_sign_info",
|
||
data: { userId: (!userId ? "" : userId) },
|
||
method: "POST",
|
||
dataType: "json",
|
||
header: {"content-type": "application/x-www-form-urlencoded"},
|
||
success(res) {
|
||
if(res.data.status==1)
|
||
{
|
||
that.setData({
|
||
isSignToday: true,
|
||
voucherNum: res.data.point
|
||
})
|
||
}else{
|
||
that.setData({
|
||
isSignToday: false,
|
||
voucherNum: res.data.point
|
||
})
|
||
}
|
||
}
|
||
})
|
||
}
|
||
},
|
||
catchyqm: function (e) {}
|
||
}) |