|
@@ -18,7 +18,7 @@ Page({ |
|
|
/** |
|
|
/** |
|
|
* 生命周期函数--监听页面加载 |
|
|
* 生命周期函数--监听页面加载 |
|
|
*/ |
|
|
*/ |
|
|
onLoad: function(options) { |
|
|
|
|
|
|
|
|
onLoad: function (options) { |
|
|
let that = this; |
|
|
let that = this; |
|
|
that.setData({ |
|
|
that.setData({ |
|
|
merChant: JSON.parse(options.merChant), |
|
|
merChant: JSON.parse(options.merChant), |
|
@@ -32,34 +32,140 @@ Page({ |
|
|
inputValue: e.detail.value |
|
|
inputValue: e.detail.value |
|
|
}) |
|
|
}) |
|
|
}, |
|
|
}, |
|
|
gotoPayMoney: function() { |
|
|
|
|
|
|
|
|
gotoPayMoney: function (flags) { |
|
|
let that = this; |
|
|
let that = this; |
|
|
// 卡余额充足的时候,才可以付钱 |
|
|
// 卡余额充足的时候,才可以付钱 |
|
|
if (that.data.inputValue != "" && Number(that.data.remainingAmount) >= Number(that.data.inputValue)) { |
|
|
|
|
|
Http.post({ |
|
|
|
|
|
url: config.api.cardPayOrder, |
|
|
|
|
|
data: { |
|
|
|
|
|
cardId: that.data.cardid, |
|
|
|
|
|
merchantCode: that.data.merChant.merchant_id, |
|
|
|
|
|
totalFee: that.data.inputValue |
|
|
|
|
|
|
|
|
// if(e){ |
|
|
|
|
|
// if(e.currentTarget.dataset.flags == 'check'){ |
|
|
|
|
|
// console.log("frhufr") |
|
|
|
|
|
// that.setData({ |
|
|
|
|
|
// ids: e.currentTarget.dataset.id, |
|
|
|
|
|
// cardid: e.currentTarget.dataset.id, |
|
|
|
|
|
// remainingAmount: e.currentTarget.dataset.remainingamount, |
|
|
|
|
|
// }) |
|
|
|
|
|
// const startSoterAuthentication = () => { |
|
|
|
|
|
// wx.startSoterAuthentication({ |
|
|
|
|
|
// requestAuthModes: [AUTH_MODE], |
|
|
|
|
|
// challenge: 'test', |
|
|
|
|
|
// authContent: '请验证已有的指纹以继续', |
|
|
|
|
|
// success: (res) => { |
|
|
|
|
|
// that.gotoPayMoney() |
|
|
|
|
|
// }, |
|
|
|
|
|
// fail: (err) => { |
|
|
|
|
|
|
|
|
|
|
|
// } |
|
|
|
|
|
// }) |
|
|
|
|
|
// } |
|
|
|
|
|
// const checkIsEnrolled = () => { |
|
|
|
|
|
// wx.checkIsSoterEnrolledInDevice({ |
|
|
|
|
|
// checkAuthMode: AUTH_MODE, |
|
|
|
|
|
// success: (res) => { |
|
|
|
|
|
// console.log(res) |
|
|
|
|
|
// if (parseInt(res.isEnrolled) <= 0) { |
|
|
|
|
|
// that.gotoPayMoney(); |
|
|
|
|
|
// return |
|
|
|
|
|
// } |
|
|
|
|
|
// startSoterAuthentication(); |
|
|
|
|
|
// }, |
|
|
|
|
|
// fail: (err) => { |
|
|
|
|
|
// console.error(err) |
|
|
|
|
|
// } |
|
|
|
|
|
// }) |
|
|
|
|
|
// } |
|
|
|
|
|
// wx.checkIsSupportSoterAuthentication({ |
|
|
|
|
|
// success: (res) => { |
|
|
|
|
|
// console.log(res) |
|
|
|
|
|
// checkIsEnrolled() |
|
|
|
|
|
// }, |
|
|
|
|
|
// fail: (err) => { |
|
|
|
|
|
// console.error(err); |
|
|
|
|
|
// that.gotoPayMoney(); |
|
|
|
|
|
// } |
|
|
|
|
|
// }) |
|
|
|
|
|
// } |
|
|
|
|
|
// } |
|
|
|
|
|
|
|
|
|
|
|
const startSoterAuthentication = () => { |
|
|
|
|
|
wx.startSoterAuthentication({ |
|
|
|
|
|
requestAuthModes: [AUTH_MODE], |
|
|
|
|
|
challenge: 'test', |
|
|
|
|
|
authContent: '请验证已有的指纹以继续', |
|
|
|
|
|
success: (res) => { |
|
|
|
|
|
that.gotoPay() |
|
|
|
|
|
}, |
|
|
|
|
|
fail: (err) => { |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
|
.then(res => { |
|
|
|
|
|
console.log(res); |
|
|
|
|
|
if(res.code==200){ |
|
|
|
|
|
wx.navigateTo({ |
|
|
|
|
|
url: `/pages/paySuccess/paySuccess?data=${JSON.stringify(res.data)}`, |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
const checkIsEnrolled = () => { |
|
|
|
|
|
wx.checkIsSoterEnrolledInDevice({ |
|
|
|
|
|
checkAuthMode: AUTH_MODE, |
|
|
|
|
|
success: (res) => { |
|
|
|
|
|
console.log(res) |
|
|
|
|
|
if (parseInt(res.isEnrolled) <= 0) { |
|
|
|
|
|
that.gotoPay(); |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
startSoterAuthentication(); |
|
|
|
|
|
}, |
|
|
|
|
|
fail: (err) => { |
|
|
|
|
|
console.error(err) |
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
|
.catch(err => { |
|
|
|
|
|
wx.showModal({ |
|
|
|
|
|
title: "抱歉", |
|
|
|
|
|
content: err.message, |
|
|
|
|
|
showCancel: false |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
wx.checkIsSupportSoterAuthentication({ |
|
|
|
|
|
success: (res) => { |
|
|
|
|
|
console.log(res) |
|
|
|
|
|
checkIsEnrolled() |
|
|
|
|
|
}, |
|
|
|
|
|
fail: (err) => { |
|
|
|
|
|
console.error(err); |
|
|
|
|
|
that.gotoPay(); |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
}, |
|
|
|
|
|
gotoPay: function () { |
|
|
|
|
|
let that = this; |
|
|
|
|
|
Http.post({ |
|
|
|
|
|
url: config.api.cardPayOrder, |
|
|
|
|
|
data: { |
|
|
|
|
|
cardId: that.data.cardid, |
|
|
|
|
|
merchantCode: that.data.merChant.merchant_id, |
|
|
|
|
|
totalFee: that.data.inputValue |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
.then(res => { |
|
|
|
|
|
if (res.code == 200) { |
|
|
|
|
|
that.setData({ |
|
|
|
|
|
showModel: false |
|
|
|
|
|
}) |
|
|
|
|
|
wx.navigateTo({ |
|
|
|
|
|
url: `/pages/paySuccess/paySuccess?data=${JSON.stringify(res.data)}`, |
|
|
}) |
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
.catch(err => { |
|
|
|
|
|
wx.showModal({ |
|
|
|
|
|
title: "抱歉", |
|
|
|
|
|
content: err.message, |
|
|
|
|
|
showCancel: false |
|
|
|
|
|
}) |
|
|
|
|
|
}) |
|
|
|
|
|
}, |
|
|
|
|
|
// 指纹识别 |
|
|
|
|
|
startAuth(e) { |
|
|
|
|
|
let that = this; |
|
|
|
|
|
if (e) { |
|
|
|
|
|
if (e.currentTarget.dataset.flags == 'check') { |
|
|
|
|
|
that.setData({ |
|
|
|
|
|
ids: e.currentTarget.dataset.id, |
|
|
|
|
|
cardid: e.currentTarget.dataset.id, |
|
|
|
|
|
remainingAmount: e.currentTarget.dataset.remainingamount, |
|
|
}) |
|
|
}) |
|
|
} else if (that.data.inputValue == "") { |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
if (that.data.inputValue == "" || that.data.inputValue == 0) { |
|
|
wx.showModal({ |
|
|
wx.showModal({ |
|
|
title: '抱歉', |
|
|
title: '抱歉', |
|
|
content: '请输入金额', |
|
|
content: '请输入金额', |
|
@@ -69,53 +175,12 @@ Page({ |
|
|
that.setData({ |
|
|
that.setData({ |
|
|
showModel: true |
|
|
showModel: true |
|
|
}) |
|
|
}) |
|
|
that.getList(); |
|
|
|
|
|
|
|
|
that.getList('notenogth'); |
|
|
|
|
|
} else if (that.data.inputValue != "" && Number(that.data.remainingAmount) >= Number(that.data.inputValue)) { |
|
|
|
|
|
that.gotoPayMoney(); |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
// 指纹识别 |
|
|
|
|
|
startAuth() { |
|
|
|
|
|
let that = this; |
|
|
|
|
|
const startSoterAuthentication = () => { |
|
|
|
|
|
wx.startSoterAuthentication({ |
|
|
|
|
|
requestAuthModes: [AUTH_MODE], |
|
|
|
|
|
challenge: 'test', |
|
|
|
|
|
authContent: '请验证已有的指纹以继续', |
|
|
|
|
|
success: (res) => { |
|
|
|
|
|
that.gotoPayMoney(); |
|
|
|
|
|
}, |
|
|
|
|
|
fail: (err) => { |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
const checkIsEnrolled = () => { |
|
|
|
|
|
wx.checkIsSoterEnrolledInDevice({ |
|
|
|
|
|
checkAuthMode: AUTH_MODE, |
|
|
|
|
|
success: (res) => { |
|
|
|
|
|
console.log(res) |
|
|
|
|
|
if (parseInt(res.isEnrolled) <= 0) { |
|
|
|
|
|
that.gotoPayMoney(); |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
startSoterAuthentication(); |
|
|
|
|
|
}, |
|
|
|
|
|
fail: (err) => { |
|
|
|
|
|
console.error(err) |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
wx.checkIsSupportSoterAuthentication({ |
|
|
|
|
|
success: (res) => { |
|
|
|
|
|
console.log(res) |
|
|
|
|
|
checkIsEnrolled() |
|
|
|
|
|
}, |
|
|
|
|
|
fail: (err) => { |
|
|
|
|
|
console.error(err); |
|
|
|
|
|
that.gotoPayMoney(); |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
}, |
|
|
|
|
|
gotonewcard: function() { |
|
|
|
|
|
|
|
|
gotonewcard: function () { |
|
|
wx.navigateTo({ |
|
|
wx.navigateTo({ |
|
|
url: '/pages/discountCardList/discountCardList' |
|
|
url: '/pages/discountCardList/discountCardList' |
|
|
}) |
|
|
}) |
|
@@ -159,45 +224,9 @@ Page({ |
|
|
}) |
|
|
}) |
|
|
}) |
|
|
}) |
|
|
}, |
|
|
}, |
|
|
check: function(e) { |
|
|
|
|
|
let ids = e.currentTarget.dataset.id; |
|
|
|
|
|
this.setData({ |
|
|
|
|
|
ids: ids, |
|
|
|
|
|
cardId: ids, |
|
|
|
|
|
remainingAmount: e.currentTarget.dataset.remainingamount |
|
|
|
|
|
}) |
|
|
|
|
|
}, |
|
|
|
|
|
showModel: function() { |
|
|
|
|
|
|
|
|
showModel: function () { |
|
|
this.setData({ |
|
|
this.setData({ |
|
|
showModel: false |
|
|
showModel: false |
|
|
}) |
|
|
}) |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 生命周期函数--监听页面隐藏 |
|
|
|
|
|
*/ |
|
|
|
|
|
onHide: function() { |
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 生命周期函数--监听页面卸载 |
|
|
|
|
|
*/ |
|
|
|
|
|
onUnload: function() { |
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 页面相关事件处理函数--监听用户下拉动作 |
|
|
|
|
|
*/ |
|
|
|
|
|
onPullDownRefresh: function() { |
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 页面上拉触底事件的处理函数 |
|
|
|
|
|
*/ |
|
|
|
|
|
onReachBottom: function() { |
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
|
}) |
|
|
}) |