|
|
@@ -9,7 +9,8 @@ Page({ |
|
|
|
yzm: '', |
|
|
|
flag: true, |
|
|
|
retry: false, |
|
|
|
time: 60 |
|
|
|
time: 60, |
|
|
|
couponId: null, |
|
|
|
}, |
|
|
|
getYZM(e) { |
|
|
|
this.setData({ |
|
|
@@ -18,23 +19,27 @@ Page({ |
|
|
|
}) |
|
|
|
}, |
|
|
|
next() { |
|
|
|
console.log(this.data.yzm) |
|
|
|
var that = this |
|
|
|
console.log(that.data.yzm) |
|
|
|
Http.get({ |
|
|
|
url: config.api.validationCode, |
|
|
|
data: { |
|
|
|
phone: this.data.phone, |
|
|
|
code: this.data.yzm, |
|
|
|
type: 1, |
|
|
|
appid: app.globalData.appId |
|
|
|
} |
|
|
|
}) |
|
|
|
.then(function(res){ |
|
|
|
|
|
|
|
},function(error){ |
|
|
|
wx.showToast({ |
|
|
|
title: error.data, |
|
|
|
url: config.api.validationCode, |
|
|
|
data: { |
|
|
|
phone: that.data.phone, |
|
|
|
code: that.data.yzm, |
|
|
|
type: 1, |
|
|
|
appid: app.globalData.appId |
|
|
|
} |
|
|
|
}) |
|
|
|
.then(res => { |
|
|
|
wx.redirectTo({ |
|
|
|
url: '../coupons/details/index?id=' + that.data.couponId + "&flag=pay", |
|
|
|
}) |
|
|
|
}) |
|
|
|
.catch(error => { |
|
|
|
wx.showToast({ |
|
|
|
title: error.data, |
|
|
|
}) |
|
|
|
}) |
|
|
|
}) |
|
|
|
}, |
|
|
|
send() { |
|
|
|
var phoneReg = /(^1[3|4|5|7|8]\d{9}$)|(^09\d{8}$)/; |
|
|
@@ -44,35 +49,36 @@ Page({ |
|
|
|
retry: true |
|
|
|
}) |
|
|
|
Http.get({ |
|
|
|
url: config.api.validationCode, |
|
|
|
data: { |
|
|
|
phone: this.data.phone, |
|
|
|
code: this.data.yzm, |
|
|
|
type: 1, |
|
|
|
appid: app.globalData.appId |
|
|
|
} |
|
|
|
}) |
|
|
|
.then(function(res){ |
|
|
|
console.log(res) |
|
|
|
var timer = setInterval(() => { |
|
|
|
this.data.time-- |
|
|
|
this.setData({ |
|
|
|
time: this.data.time |
|
|
|
}) |
|
|
|
if (this.data.time == 0) { |
|
|
|
clearInterval(timer) |
|
|
|
this.setData({ |
|
|
|
flag: true, |
|
|
|
retry: false, |
|
|
|
time: 60 |
|
|
|
}) |
|
|
|
url: config.api.sendValidationCode, |
|
|
|
data: { |
|
|
|
phone: this.data.phone, |
|
|
|
code: this.data.yzm, |
|
|
|
type: 1, |
|
|
|
appid: app.globalData.appId |
|
|
|
} |
|
|
|
}, 1000) |
|
|
|
}, function(error){ |
|
|
|
wx.showToast({ |
|
|
|
title: '请输入有效手机号', |
|
|
|
}) |
|
|
|
}) |
|
|
|
.then(res => { |
|
|
|
console.log(res) |
|
|
|
var timer = setInterval(() => { |
|
|
|
this.data.time-- |
|
|
|
this.setData({ |
|
|
|
time: this.data.time |
|
|
|
}) |
|
|
|
if (this.data.time == 0) { |
|
|
|
clearInterval(timer) |
|
|
|
this.setData({ |
|
|
|
flag: true, |
|
|
|
retry: false, |
|
|
|
time: 60 |
|
|
|
}) |
|
|
|
} |
|
|
|
}, 1000) |
|
|
|
}) |
|
|
|
.catch(error => { |
|
|
|
wx.showToast({ |
|
|
|
title: '请输入有效手机号', |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
}) |