125 lines
2.7 KiB
Vue
125 lines
2.7 KiB
Vue
|
<template>
|
|||
|
<view class="content">
|
|||
|
<view class="container">
|
|||
|
<headers :titles="titles"><u-icon name="arrow-left" color="#fff" size="22"></u-icon></headers>
|
|||
|
<view class="img-box">
|
|||
|
<view class="title_">请扫码支付</view>
|
|||
|
<canvas id="qrcode" canvas-id="qrcode" style="width: 200px;height: 200px; margin: 15px auto;"></canvas>
|
|||
|
<view class="z-size">
|
|||
|
<view class="" @click="setAmount">设置金额</view>
|
|||
|
<view class="">保存图片</view>
|
|||
|
</view>
|
|||
|
</view>
|
|||
|
|
|||
|
</view>
|
|||
|
</view>
|
|||
|
</template>
|
|||
|
|
|||
|
<script>
|
|||
|
import headers from '../../components/header/headers.vue'
|
|||
|
import UQRCode from '../../uni_modules/Sansnn-uQRCode/js_sdk/uqrcode/uqrcode.js';
|
|||
|
export default {
|
|||
|
data() {
|
|||
|
return {
|
|||
|
titles: "刷卡支付",
|
|||
|
orderNo:"",
|
|||
|
qrCode:"",
|
|||
|
}
|
|||
|
},
|
|||
|
onLoad(e) {
|
|||
|
this.orderNo = e.orderNo
|
|||
|
this.qrCode = uni.getStorageSync("qrCode")
|
|||
|
console.log(this.qrCode);
|
|||
|
this.onReady()
|
|||
|
|
|||
|
},
|
|||
|
onShow() {
|
|||
|
// this.actList = ["1", "1", "1", "1", "1", ]
|
|||
|
// this.status = "nomore" 底部刷新结束
|
|||
|
},
|
|||
|
onPullDownRefresh() {
|
|||
|
console.log("刷新");
|
|||
|
uni.stopPullDownRefresh()
|
|||
|
},
|
|||
|
onReachBottom() {
|
|||
|
// this.show = true
|
|||
|
setTimeout(() => {
|
|||
|
console.log("加载执行");
|
|||
|
}, 2000)
|
|||
|
},
|
|||
|
components: {
|
|||
|
headers
|
|||
|
},
|
|||
|
methods: {
|
|||
|
// 设置金额
|
|||
|
setAmount() {
|
|||
|
uni.navigateTo({
|
|||
|
url: "/pagesHome/PaymentCode/SetUpCode?orderNo="+this.orderNo
|
|||
|
})
|
|||
|
},
|
|||
|
onReady() {
|
|||
|
// 获取uQRCode实例
|
|||
|
var qr = new UQRCode();
|
|||
|
// 设置二维码内容
|
|||
|
qr.data = this.qrCode;
|
|||
|
// 设置二维码大小,必须与canvas设置的宽高一致
|
|||
|
qr.size = 200;
|
|||
|
// 调用制作二维码方法
|
|||
|
qr.make();
|
|||
|
// 获取canvas上下文
|
|||
|
var canvasContext = uni.createCanvasContext('qrcode', this); // 如果是组件,this必须传入
|
|||
|
// 设置uQRCode实例的canvas上下文
|
|||
|
qr.canvasContext = canvasContext;
|
|||
|
// 调用绘制方法将二维码图案绘制到canvas上
|
|||
|
qr.drawCanvas();
|
|||
|
},
|
|||
|
goback() {
|
|||
|
uni.navigateBack()
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
</script>
|
|||
|
|
|||
|
<style scoped lang="scss">
|
|||
|
.content {
|
|||
|
background: #0864e9;
|
|||
|
// background: linear-gradient(180deg, #B2D2FC 0%, #B2D2FC 14%, rgba(255, 255, 255, 0.84) 24%, rgba(255, 255, 255, 0.84) 100%);
|
|||
|
height: 100vh;
|
|||
|
}
|
|||
|
|
|||
|
.container {
|
|||
|
width: 100%;
|
|||
|
background: #0864e9;
|
|||
|
box-sizing: border-box;
|
|||
|
padding-top: 88px;
|
|||
|
}
|
|||
|
|
|||
|
.img-box {
|
|||
|
width: 95%;
|
|||
|
height: 300px;
|
|||
|
background: #FFFFFF;
|
|||
|
border-radius: 8px;
|
|||
|
margin: 15px auto;
|
|||
|
box-sizing: border-box;
|
|||
|
padding: 15px;
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
.title_ {
|
|||
|
width: 100%;
|
|||
|
text-align: center;
|
|||
|
font-weight: bold;
|
|||
|
font-size: 16px;
|
|||
|
color: #333333;
|
|||
|
margin-bottom: 15px;
|
|||
|
}
|
|||
|
|
|||
|
.z-size {
|
|||
|
width: 200px;
|
|||
|
display: flex;
|
|||
|
align-items: center;
|
|||
|
justify-content: space-between;
|
|||
|
margin: 0 auto;
|
|||
|
}
|
|||
|
</style>
|