|
|
@@ -17,7 +17,7 @@ Page({ |
|
|
|
goHomeUrl: "", |
|
|
|
showCode: true, |
|
|
|
showTimeLine: true, |
|
|
|
expiredSeconds: 30 |
|
|
|
expiredSeconds: 0 |
|
|
|
}, |
|
|
|
phone: function (e) { |
|
|
|
console.log(e) |
|
|
@@ -44,26 +44,36 @@ Page({ |
|
|
|
* 生命周期函数--监听页面显示 |
|
|
|
*/ |
|
|
|
onShow: function () { |
|
|
|
|
|
|
|
this.ifPhoneInfo() |
|
|
|
let that = this; |
|
|
|
that.ifPhoneInfo() |
|
|
|
that.setData({ |
|
|
|
goHomeUrl: app.globalData.goHomeUrl, |
|
|
|
}) |
|
|
|
console.log("渲染开始") |
|
|
|
that.getDiscountInfo() |
|
|
|
}, |
|
|
|
|
|
|
|
refreshCode() { |
|
|
|
this.setData({ |
|
|
|
showCode: true |
|
|
|
}) |
|
|
|
this.getDiscountInfo() |
|
|
|
}, |
|
|
|
|
|
|
|
getDiscountInfo() { |
|
|
|
let that = this; |
|
|
|
Http.get({ |
|
|
|
url: config.api.getDiscountInfo, |
|
|
|
data: {} |
|
|
|
}) |
|
|
|
.then(res => { |
|
|
|
that.setData({ |
|
|
|
level: res.data.level ? res.data.level : '' |
|
|
|
}) |
|
|
|
that.qrcode(res.data.id); |
|
|
|
that.qrcode(res.data.dynamicId); |
|
|
|
that.setData({ |
|
|
|
memberId: res.data.id |
|
|
|
memberId: res.data.id, |
|
|
|
expiredSeconds: res.data.expiredSeconds, |
|
|
|
}) |
|
|
|
console.log(res.data.levelMerchantList) |
|
|
|
let discountMerchantList = []; |
|
|
|
res.data.levelMerchantList.map(file => { |
|
|
|
if (file.discount != 100) { |
|
|
@@ -73,6 +83,27 @@ Page({ |
|
|
|
that.setData({ |
|
|
|
discountMerchantList: discountMerchantList, |
|
|
|
}) |
|
|
|
if (that.data.expiredSeconds * 1) { |
|
|
|
const timer = setInterval(() => { |
|
|
|
const expiredSeconds = that.data.expiredSeconds |
|
|
|
if (expiredSeconds) { |
|
|
|
that.setData({ |
|
|
|
expiredSeconds: expiredSeconds - 1, |
|
|
|
}) |
|
|
|
} else { |
|
|
|
clearInterval(timer) |
|
|
|
that.setData({ |
|
|
|
showCode: false, |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
}, 1000); |
|
|
|
} |
|
|
|
}).catch(err => { |
|
|
|
console.log(err, 'err'); |
|
|
|
wx.showToast({ |
|
|
|
title: err.message, |
|
|
|
}) |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
@@ -85,7 +116,7 @@ Page({ |
|
|
|
/** |
|
|
|
* 二维码 |
|
|
|
*/ |
|
|
|
qrcode: function (memberId) { |
|
|
|
qrcode(memberId) { |
|
|
|
let that = this; |
|
|
|
var size = that.setCanvasSize(); |
|
|
|
let url = JSON.stringify({ |
|
|
|