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