@@ -29,9 +29,9 @@ App({ | |||
wx.setStorageSync('openid', e.data.data.openid) | |||
wx.setStorageSync('session_key', e.data.data.session_key) | |||
wx.setStorageSync('token', e.data.data.token) | |||
// if (this.globalData.openidSuccessFuc) { | |||
// this.globalData.openidSuccessFuc(); | |||
// } | |||
if (this.globalData.openidSuccessFuc) { | |||
this.globalData.openidSuccessFuc(); | |||
} | |||
} | |||
} | |||
}) |
@@ -18,8 +18,13 @@ Page({ | |||
*/ | |||
onLoad: function (options) { | |||
console.log(options.id) | |||
this.getTicketUser(options.id, 1) | |||
this.getCodeFn(options.id) | |||
if (app.globalData.openid) { | |||
this.getTicketUser(options.id, 1) | |||
this.getCodeFn(options.id) | |||
} else { | |||
this.globalData.openidSuccessFuc = this.getTicketUser; | |||
this.globalData.openidSuccessFuc = this.getCodeFn; | |||
} | |||
}, | |||
getTicketUser: function (id,from) {//获取优惠券信息 | |||
app.wxRequest(app.globalData.httpUrl + 'couponsell/detail', { coupon_sell_id: id, from: from}, e => { |
@@ -19,7 +19,11 @@ Page({ | |||
*/ | |||
onLoad: function (options) { | |||
console.log(options) | |||
this.getTicketUser(options.index,1) | |||
if (app.globalData.openid) { | |||
this.getTicketUser(options.index, 1) | |||
} else { | |||
this.globalData.openidSuccessFuc = this.getTicketUser; | |||
} | |||
}, | |||
getTicketUser:function(index,from){//获取优惠券信息 |
@@ -21,8 +21,13 @@ Page({ | |||
*/ | |||
onLoad: function (options) { | |||
console.log(options.id) | |||
if (app.globalData.openid) { | |||
this.getTicketUser(options.id, 2) | |||
} else { | |||
this.globalData.openidSuccessFuc = this.getTicketUser; | |||
} | |||
this.data.sellId = options.id; | |||
this.getTicketUser(options.id,2) | |||
}, | |||
getTicketUser: function (id, from) {//获取优惠券信息 | |||
app.wxRequest(app.globalData.httpUrl + 'couponsell/detail', { coupon_sell_id: id, from: from }, e => { |
@@ -8,7 +8,12 @@ Page({ | |||
}, | |||
//事件处理函数 | |||
onLoad: function () { | |||
this.getDataList(); | |||
if (app.globalData.openid){ | |||
this.getDataList(); | |||
}else{ | |||
this.globalData.openidSuccessFuc = this.getDataList; | |||
} | |||
}, | |||
getDataList:function(){ | |||
app.wxRequest(app.globalData.httpUrl + 'couponsell/list', {}, e => { |
@@ -28,8 +28,13 @@ Page({ | |||
* 生命周期函数--监听页面加载 | |||
*/ | |||
onLoad: function (options) { | |||
this.myTicket(); | |||
this.historyTicket(); | |||
if (app.globalData.openid) { | |||
this.myTicket(); | |||
this.historyTicket(); | |||
} else { | |||
this.globalData.openidSuccessFuc = this.myTicket; | |||
this.globalData.openidSuccessFuc = this.historyTicket; | |||
} | |||
}, | |||
myTicket:function(){//获取我的优惠券列表 | |||
app.wxRequest(app.globalData.httpUrl + 'couponbuy/validtype', {}, e => { |
@@ -23,11 +23,12 @@ Page({ | |||
this.setData({ | |||
ticketNum: options.number | |||
}) | |||
this.getTicketUser(options.shareId, options.number); | |||
// wx.showModal({ | |||
// title: "options.shareId=" + options.shareId + "&options.number=" + options.number, | |||
// content: '', | |||
// }) | |||
if (app.globalData.openid) { | |||
this.getTicketUser(options.shareId, options.number); | |||
} else { | |||
this.globalData.openidSuccessFuc = this.getTicketUser; | |||
} | |||
}, | |||
getTicketUser: function (id,number) {//获取赠送优惠券信息 | |||
@@ -39,10 +40,6 @@ 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:"此券已被领取" |
@@ -71,6 +71,18 @@ Page({ | |||
}, | |||
yesCodeFn:function(){//验证码接口 | |||
app.wxRequest(app.globalData.httpUrl + 'smscode', { user_phone: this.data.phone }, e => { | |||
console.log(e) | |||
if (e.code == 200) { | |||
wx.showToast({ | |||
title: e.message, | |||
icon: 'success', | |||
duration: 500 | |||
}) | |||
} | |||
}, this) | |||
}, | |||
sendTouch:function(){//发送验证码 | |||
if (!(/^1[3456789]\d{9}$/.test(this.data.phone))) { | |||
wx.showToast({ | |||
@@ -86,16 +98,13 @@ Page({ | |||
if (this.data.yesSend) { | |||
time = setInterval(this.setIntervalFn,1000) | |||
} | |||
app.wxRequest(app.globalData.httpUrl + 'smscode', { user_phone:this.data.phone}, e => { | |||
console.log(e) | |||
if(e.code==200){ | |||
wx.showToast({ | |||
title: e.message, | |||
icon: 'success', | |||
duration: 500 | |||
}) | |||
} | |||
}, this) | |||
if (app.globalData.openid) { | |||
this.yesCodeFn(); | |||
} else { | |||
this.globalData.openidSuccessFuc = this.yesCodeFn; | |||
} | |||
}, | |||
setIntervalFn:function(){//定时器 | |||
if (this.data.num > 0) { | |||
@@ -118,7 +127,14 @@ Page({ | |||
}) | |||
console.log(this.data.minter) | |||
}, | |||
registerFn:function(){//注册 | |||
registerBtn:function(){//点击按钮注册 | |||
if (app.globalData.openid) { | |||
this.registerFn(); | |||
} else { | |||
this.globalData.openidSuccessFuc = this.registerFn; | |||
} | |||
}, | |||
registerFn:function(){//注册接口 | |||
app.wxRequest(app.globalData.httpUrl + 'register', { user_phone: this.data.phone, code_num: this.data.phoneCode }, e => { | |||
console.log(e) | |||
if (e.code == 200) { |
@@ -10,6 +10,6 @@ | |||
<view class="sendBtn" wx:if="{{yesSend}}">{{minter}}</view> | |||
<input class="codeInt" type="number" bindinput="getCode" placeholder="验证码" placeholder-class="placeholderClass"></input> | |||
</view> | |||
<image bindtap="registerFn" class="registerBtn" src="../images/registerBtn.png"></image> | |||
<image bindtap="registerBtn" class="registerBtn" src="../images/registerBtn.png"></image> | |||
</view> | |||
</view> |
@@ -66,8 +66,14 @@ Page({ | |||
* 生命周期函数--监听页面加载 | |||
*/ | |||
onLoad: function (options) { | |||
this.getShopList(); | |||
this.searchShop(true); | |||
console.log(options) | |||
if (app.globalData.openid) { | |||
this.getShopList(); | |||
this.searchShop(true); | |||
} else { | |||
this.globalData.openidSuccessFuc = this.getShopList; | |||
this.globalData.openidSuccessFuc = this.searchShop; | |||
} | |||
}, | |||
getShopList:function(){//获取所有门店省市 |