From 95766f3f7aa867f32ce9bcd34cf2473a65fac670 Mon Sep 17 00:00:00 2001 From: meo <18801474720@163.com> Date: Mon, 7 Jan 2019 19:47:08 +0800 Subject: [PATCH] =?UTF-8?q?[=E4=BD=BF=E7=94=A8=E6=B6=88=E8=B4=B9=E5=8D=A1]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/order/detail/index.wxss | 3 +- pages/scanPay/scanPay.js | 235 +++++++++++++++++++--------------- pages/scanPay/scanPay.wxml | 4 +- pages/scanPay/scanPay.wxss | 1 + 4 files changed, 136 insertions(+), 107 deletions(-) diff --git a/pages/order/detail/index.wxss b/pages/order/detail/index.wxss index d52acea..1546101 100644 --- a/pages/order/detail/index.wxss +++ b/pages/order/detail/index.wxss @@ -166,8 +166,7 @@ page { } .classif > view:nth-child(6) text:nth-child(2) { - color: #ff3434; - font-weight: bold; + color: #666; } .spcode { diff --git a/pages/scanPay/scanPay.js b/pages/scanPay/scanPay.js index 0097ce9..44603d9 100644 --- a/pages/scanPay/scanPay.js +++ b/pages/scanPay/scanPay.js @@ -18,7 +18,7 @@ Page({ /** * 生命周期函数--监听页面加载 */ - onLoad: function(options) { + onLoad: function (options) { let that = this; that.setData({ merChant: JSON.parse(options.merChant), @@ -32,34 +32,140 @@ Page({ inputValue: e.detail.value }) }, - gotoPayMoney: function() { + gotoPayMoney: function (flags) { 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({ title: '抱歉', content: '请输入金额', @@ -69,53 +175,12 @@ Page({ that.setData({ 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({ 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({ showModel: false }) }, - - /** - * 生命周期函数--监听页面隐藏 - */ - onHide: function() { - - }, - - /** - * 生命周期函数--监听页面卸载 - */ - onUnload: function() { - - }, - - /** - * 页面相关事件处理函数--监听用户下拉动作 - */ - onPullDownRefresh: function() { - - }, - - /** - * 页面上拉触底事件的处理函数 - */ - onReachBottom: function() { - - }, }) \ No newline at end of file diff --git a/pages/scanPay/scanPay.wxml b/pages/scanPay/scanPay.wxml index 4a80057..7e51847 100644 --- a/pages/scanPay/scanPay.wxml +++ b/pages/scanPay/scanPay.wxml @@ -17,12 +17,12 @@ - + - {{item.title}} + {{item.id}} 余额:{{item.remainingAmount/100}}元 diff --git a/pages/scanPay/scanPay.wxss b/pages/scanPay/scanPay.wxss index 94dbfea..8f2eba7 100644 --- a/pages/scanPay/scanPay.wxss +++ b/pages/scanPay/scanPay.wxss @@ -102,6 +102,7 @@ top: 0; bottom: 0; margin: auto; + z-index: 100; } .card-items{ position: relative;