|
|
@@ -31,7 +31,7 @@ Page({ |
|
|
|
}) |
|
|
|
.then(res => { |
|
|
|
wx.redirectTo({ |
|
|
|
url: '../coupon/detail/index?id=' + that.data.couponId + "&flag=pay", |
|
|
|
url: '/pages/coupon/detail/index?id=' + that.data.couponId + "&flag=pay", |
|
|
|
}) |
|
|
|
}) |
|
|
|
.catch(error => { |
|
|
@@ -40,11 +40,27 @@ Page({ |
|
|
|
}) |
|
|
|
}) |
|
|
|
}, |
|
|
|
//计时器 |
|
|
|
timerInfo() { |
|
|
|
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) |
|
|
|
}, |
|
|
|
send() { |
|
|
|
var phoneReg = /(^1[3|4|5|7|8]\d{9}$)|(^09\d{8}$)/; |
|
|
|
if (phoneReg.test(this.data.phone)) { |
|
|
|
this.setData({ |
|
|
|
flag: false, |
|
|
|
retry: true |
|
|
|
}) |
|
|
|
Http.get({ |
|
|
@@ -58,20 +74,14 @@ Page({ |
|
|
|
}) |
|
|
|
.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) |
|
|
|
that.timerInfo() |
|
|
|
if (res.code == 200) { |
|
|
|
console.log(res) |
|
|
|
} else { |
|
|
|
wx.showToast({ |
|
|
|
title: res.message |
|
|
|
}) |
|
|
|
} |
|
|
|
}) |
|
|
|
.catch(error => { |
|
|
|
wx.showToast({ |
|
|
|