@@ -77,7 +77,6 @@ App({ | |||
// }) | |||
}, | |||
getUserType:function(){//获取用户注册状态 | |||
this.wxRequest(this.globalData.httpUrl + 'getinfo',{},e=>{ | |||
// console.log(e) | |||
if(e.code==201){//未注册跳到注册页面 | |||
@@ -85,6 +84,7 @@ App({ | |||
url: '/pages/register/register' | |||
}) | |||
} else if (e.code == 202){//已注册 | |||
this.globalData.userInfo = e.data.user_phone | |||
if (this.globalData.present_id){ | |||
wx.reLaunch({ | |||
url: '/pages/receiveTicket/receiveTicket?shareId=' + this.globalData.present_id + "&number=" + this.globalData.number |
@@ -11,6 +11,7 @@ Page({ | |||
historyTicketArrows: false, | |||
getUser:false, | |||
getUserArr: [],//用户信息 | |||
userPhone:"",//用户手机号 | |||
mydeg: -90, | |||
historydeg: -90, | |||
historyArr: [],//优惠券使用记录列表 | |||
@@ -144,12 +145,14 @@ Page({ | |||
}, | |||
getUser:function(e){//点击登陆获取用户信息 | |||
console.log(e) | |||
console.log(app.globalData.userInfo) | |||
this.setData({ | |||
getUserArr: e.detail.userInfo | |||
}) | |||
if (this.data.getUserArr){ | |||
this.setData({ | |||
getUser: true | |||
getUser: true, | |||
userPhone: app.globalData.userInfo | |||
}) | |||
this.submitUser(); | |||
} |
@@ -9,7 +9,7 @@ | |||
</view> | |||
<button wx:if="{{!getUser}}" plain="true" size="mini" class="getUser" open-type="getUserInfo" bindgetuserinfo="getUser">登陆</button> | |||
<view class="userName">{{getUserArr.nickName}}</view> | |||
<view wx:if="{{getUser}}" class="userPhone">12345678910</view> | |||
<view wx:if="{{getUser}}" class="userPhone">{{userPhone}}</view> | |||
</view> | |||
<view class="myTicketAll"> |
@@ -39,6 +39,10 @@ Page({ | |||
yesGet: true | |||
}) | |||
} else if (e.code == 202){ | |||
wx.showModal({ | |||
title: this.data.ticketUser.nickname + this.data.ticketUser.user_phone, | |||
content: '', | |||
}) | |||
this.setData({ | |||
yesGet: false, | |||
titleWord:"此券已被领取" | |||
@@ -117,7 +121,7 @@ Page({ | |||
// "p1583474312b94" | |||
getTicketFn:function(){//点击领取优惠券 | |||
var id = this.data.presentId; | |||
app.wxRequest(app.globalData.httpUrl + 'couponbuy/receivepresen', { present_id: id }, e => { | |||
app.wxRequest(app.globalData.httpUrl + 'couponbuy/receivepresent', { present_id: id }, e => { | |||
console.log(e) | |||
if (e.code == 200) { | |||
wx.showToast({ | |||
@@ -129,10 +133,17 @@ Page({ | |||
url: '/pages/index/index' | |||
}) | |||
},500) | |||
}else{ | |||
wx.showToast({ | |||
title: e.message, | |||
duration: 500 | |||
}) | |||
} | |||
}, this,"POST") | |||
}, | |||
backIndex:function(){//优惠券已被领取,点击确定返回首页 | |||
wx.switchTab({ | |||
url: '/pages/index/index' | |||
}) | |||
}, | |||
}) |
@@ -123,6 +123,7 @@ Page({ | |||
console.log(e) | |||
if (e.code == 200) { | |||
clearInterval(time); | |||
app.globalData.userInfo = e.data.user_phone | |||
this.setData({ | |||
minter: 60, | |||
num: 60 |