| | |
| | | const QRCode = require('qrcode'); |
| | | const app = getApp(); |
| | | let $api = require('../../../utils/ajaxFn.js') |
| | | var timer; |
| | | Page({ |
| | | data: { |
| | | timer:'', |
| | | userStyle: {}, |
| | | imgSrc: '', |
| | | rateList: [ |
| | |
| | | //根据字符串生成svn格式的二维码 |
| | | QRCode.toString(res.data.body.payQrCodeUrl, { type: 'svg' }, function (err, url) { |
| | | let str = 'data:image/svg+xml;base64,' + Buffer(url).toString('base64'); |
| | | console.log(str) |
| | | self.setData({ |
| | | imgSrc: str, |
| | | orderId:res.data.body.orderId, |
| | |
| | | { name: '客户还款总额', rate: res.data.body.repayAmt }, |
| | | { name: '客户月还款额', rate: res.data.body.monthAmt }, |
| | | { name: '还款期数', rate: res.data.body.term + '期' } |
| | | ], |
| | | timer:setInterval(this.getStatus(),5000) |
| | | ] |
| | | }) |
| | | timer = setInterval(()=>{ |
| | | self.getStatus() |
| | | },5000) |
| | | }); |
| | | |
| | | }, |
| | |
| | | (res)=>{ |
| | | let body = res.data.body.orderStatus |
| | | if(body==1){ |
| | | clearInterval(this.data.timer) |
| | | clearInterval(timer) |
| | | my.showToast({ |
| | | type: 'none', |
| | | content: '支付成功', |
| | |
| | | }) |
| | | } |
| | | if(body==2){ |
| | | clearInterval(this.data.timer) |
| | | clearInterval(timer) |
| | | my.showToast({ |
| | | type: 'none', |
| | | content: '支付超时', |
| | |
| | | orderId:this.data.orderId |
| | | } |
| | | ) |
| | | } |
| | | }, |
| | | onUnload() { |
| | | // 页面隐藏 |
| | | console.log(111) |
| | | clearInterval(timer) |
| | | }, |
| | | }); |
| | |
| | | let $api = require('../../../utils/ajaxFn.js') |
| | | const QRCode = require('qrcode'); |
| | | const app = getApp(); |
| | | var timer ; |
| | | Page({ |
| | | data: { |
| | | userStyle:{}, |
| | |
| | | }, |
| | | getCode() { |
| | | let self = this; |
| | | // QRCode.toString('https://qr.alipay.com/bax09171hgnaiptzucxe8034',{type: 'svg'}, function (err, url) { |
| | | // let str = 'data:image/svg+xml;base64,' + Buffer(url).toString('base64'); |
| | | // console.log(str); |
| | | |
| | | // self.setData({ |
| | | // imgSrc: str |
| | | // }) |
| | | // }); |
| | | $api.ajax( |
| | | '/sib/xcx/order/createDmf', |
| | | 'POST', |
| | | (res) => { |
| | | let myurl = String(res.data.body.payQrCodeUrl) |
| | | //根据字符串生成svn格式的二维码 |
| | | QRCode.toString(res.data.body.payQrCodeUrl, {type: 'svg'}, function (err, url) { |
| | | QRCode.toString(myurl, {type: 'svg'}, function (err, url) { |
| | | let str = 'data:image/svg+xml;base64,' + Buffer(url).toString('base64'); |
| | | console.log(str) |
| | | self.setData({ |
| | | imgSrc: str, |
| | | orderId:res.data.body.orderId, |
| | | rateList: [ |
| | | { name: '支付费率', rate: res.data.body.payRate + '%' } |
| | | ], |
| | | timer:setInterval(this.getStatus(),5000) |
| | | ] |
| | | }) |
| | | timer = setInterval(()=>{ |
| | | self.getStatus() |
| | | },5000) |
| | | }); |
| | | |
| | | }, |
| | |
| | | (res)=>{ |
| | | let body = res.data.body.orderStatus |
| | | if(body==1){ |
| | | clearInterval(this.data.timer) |
| | | clearInterval(timer) |
| | | my.showToast({ |
| | | type: 'none', |
| | | content: '支付成功', |
| | |
| | | }) |
| | | } |
| | | if(body==2){ |
| | | clearInterval(this.data.timer) |
| | | clearInterval(timer) |
| | | my.showToast({ |
| | | type: 'none', |
| | | content: '支付超时', |
| | |
| | | orderId:this.data.orderId |
| | | } |
| | | ) |
| | | } |
| | | }, |
| | | onUnload() { |
| | | // 页面隐藏 |
| | | console.log(111) |
| | | clearInterval(timer) |
| | | }, |
| | | }); |
| | |
| | | str = str + data[key] |
| | | } |
| | | var params = {...data} |
| | | console.log(needLogin) |
| | | // console.log(needLogin) |
| | | if(needLogin){ |
| | | console.log('验签字符串',str+my.getStorageSync ({ key: 'sessionId' }).data.sessionId) |
| | | // console.log('验签字符串',str+my.getStorageSync ({ key: 'sessionId' }).data.sessionId) |
| | | let sessionId = my.getStorageSync ({ key: 'sessionId' }).data.sessionId |
| | | // params.sessionId = sessionId |
| | | params.jttechSign = md5.hex_md5(str+sessionId) |