Pārlūkot izejas kodu

[消费卡][修改]:[消费卡金额不足时,修改]

tags/广东版3.2.1
meo pirms 6 gadiem
vecāks
revīzija
b1893c5704
2 mainītis faili ar 74 papildinājumiem un 59 dzēšanām
  1. +73
    -58
      pages/scanPay/scanPay.js
  2. +1
    -1
      pages/scanPay/scanPay.wxml

+ 73
- 58
pages/scanPay/scanPay.js Parādīt failu

@@ -12,20 +12,20 @@ Page({
focus: true, focus: true,
inputValue: '', inputValue: '',
cardList: [], cardList: [],
arrays:[],
arrays: [],
showModel: false, showModel: false,
ids:""
ids: ""
}, },


/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
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),
cardid: options.cardid, cardid: options.cardid,
cardids:options.cardid,
cardids: options.cardid,
remainingAmount: options.remainingAmount, remainingAmount: options.remainingAmount,
remainingAmounts: options.remainingAmount, remainingAmounts: options.remainingAmount,
}) })
@@ -36,62 +36,76 @@ Page({
inputValue: e.detail.value inputValue: e.detail.value
}) })
}, },
gotoPayMoney: function (flags) {
suretoPay: function(e) {
let that = this; let that = this;
const startSoterAuthentication = () => {
wx.startSoterAuthentication({
requestAuthModes: [AUTH_MODE],
challenge: 'test',
authContent: '请验证已有的指纹以继续',
success: (res) => {
that.gotoPay()
},
fail: (err) => {
wx.hideLoading();
that.setData({
showModel:false,
cardid: that.data.cardids,
ids:"",
remainingAmount: that.data.remainingAmounts
})
}
})
}
const checkIsEnrolled = () => {
wx.checkIsSoterEnrolledInDevice({
checkAuthMode: AUTH_MODE,
success: (res) => {
console.log(res)
if (res.isEnrolled) {
startSoterAuthentication();
}else{
that.gotoPay();
}
},
fail: (err) => {
console.error(err)
}
})
}
wx.checkIsSupportSoterAuthentication({
if (e.currentTarget.dataset.sure == 'sure' && that.data.checked) {
wx.showLoading({
title: '加载中...',
})
that.gotoPayMoney();
} else {
wx.showModal({
title: '提醒',
content: '请选择消费卡',
showCancel: false
})
}
},
gotoPayMoney: function() {
let that = this;
const startSoterAuthentication = () => {
wx.startSoterAuthentication({
requestAuthModes: [AUTH_MODE],
challenge: 'test',
authContent: '请验证已有的指纹以继续',
success: (res) => {
that.gotoPay()
},
fail: (err) => {
wx.hideLoading();
that.setData({
showModel: false,
cardid: that.data.cardids,
ids: "",
remainingAmount: that.data.remainingAmounts
})
}
})
}
const checkIsEnrolled = () => {
wx.checkIsSoterEnrolledInDevice({
checkAuthMode: AUTH_MODE,
success: (res) => { success: (res) => {
console.log(res) console.log(res)
if(res.supportMode == []){
if (res.isEnrolled) {
startSoterAuthentication();
} else {
that.gotoPay(); that.gotoPay();
}else if(res.supportMode == ['fingerPrint']){
checkIsEnrolled()
}else if(res.supportMode = ['fingerPrint', 'facial'] ){
checkIsEnrolled()
} }
}, },
fail: (err) => { fail: (err) => {
console.error(err);
that.gotoPay();
console.error(err)
} }
}) })

}
wx.checkIsSupportSoterAuthentication({
success: (res) => {
console.log(res)
if (res.supportMode == []) {
that.gotoPay();
} else if (res.supportMode == ['fingerPrint']) {
checkIsEnrolled()
} else if (res.supportMode = ['fingerPrint', 'facial']) {
checkIsEnrolled()
}
},
fail: (err) => {
console.error(err);
that.gotoPay();
}
})
}, },
gotoPay: function () {
gotoPay: function() {
let that = this; let that = this;
console.log(that.data.cardid) console.log(that.data.cardid)
Http.post({ Http.post({
@@ -122,12 +136,12 @@ Page({
}) })
that.setData({ that.setData({
cardid: that.data.cardids, cardid: that.data.cardids,
ids:"",
ids: "",
remainingAmount: that.data.remainingAmounts remainingAmount: that.data.remainingAmounts
}) })
}) })
}, },
check:function(e){
check: function(e) {
let that = this; let that = this;
console.log(e.currentTarget.dataset.id) console.log(e.currentTarget.dataset.id)
if (e) { if (e) {
@@ -136,6 +150,7 @@ Page({
ids: e.currentTarget.dataset.id, ids: e.currentTarget.dataset.id,
cardid: e.currentTarget.dataset.id, cardid: e.currentTarget.dataset.id,
remainingAmount: e.currentTarget.dataset.remainingamount, remainingAmount: e.currentTarget.dataset.remainingamount,
checked: true
}) })
} }
} }
@@ -159,13 +174,13 @@ Page({
title: '加载中', title: '加载中',
}) })
console.log("222") console.log("222")
setTimeout(function(){
setTimeout(function() {
wx.hideLoading(); wx.hideLoading();
},1500)
}, 1500)
that.gotoPayMoney(); that.gotoPayMoney();
} }
}, },
gotonewcard: function () {
gotonewcard: function() {
wx.navigateTo({ wx.navigateTo({
url: '/pages/discountCardList/discountCardList' url: '/pages/discountCardList/discountCardList'
}) })
@@ -190,7 +205,7 @@ Page({
if (res.code == 200) { if (res.code == 200) {
let arrays = []; let arrays = [];
res.data.list.map(file => { res.data.list.map(file => {
if (file.remainingAmount / 100 >= that.data.inputValue){
if (file.remainingAmount / 100 >= that.data.inputValue) {
file.merchantVoList.map(files => { file.merchantVoList.map(files => {
if (files.id == that.data.merChant.id) { if (files.id == that.data.merChant.id) {
file.flag = true; file.flag = true;
@@ -215,11 +230,11 @@ Page({
}) })
}) })
}, },
showModel: function () {
showModel: function() {
this.setData({ this.setData({
showModel: false, showModel: false,
cardid: this.data.cardids, cardid: this.data.cardids,
ids:"",
ids: "",
remainingAmount: this.data.remainingAmounts remainingAmount: this.data.remainingAmounts
}) })
console.log(this.data.cardid) console.log(this.data.cardid)


+ 1
- 1
pages/scanPay/scanPay.wxml Parādīt failu

@@ -45,7 +45,7 @@
</scroll-view> </scroll-view>
</view> </view>
<view class='card-bottom'> <view class='card-bottom'>
<button type='primary' bindtap='gotoPayMoney' class='checkcard-box' wx:if="{{arrays.length>0}}">确认付款</button>
<button type='primary' bindtap='suretoPay' data-sure='sure' class='checkcard-box' wx:if="{{arrays.length>0}}">确认付款</button>
<button type='primary' bindtap='gotonewcard' class='checkcard-box' wx:if="{{arrays.length==0}}">购买新卡</button> <button type='primary' bindtap='gotonewcard' class='checkcard-box' wx:if="{{arrays.length==0}}">购买新卡</button>
</view> </view>
</view> </view>


Notiek ielāde…
Atcelt
Saglabāt