|
@@ -1,6 +1,6 @@
|
|
|
<template>
|
|
|
<view>
|
|
|
- <u-navbar title="付款码">
|
|
|
+ <u-navbar title="付款码">
|
|
|
</u-navbar>
|
|
|
<view class="content">
|
|
|
<!-- 饭卡信息 -->
|
|
@@ -24,14 +24,13 @@
|
|
|
</view>
|
|
|
<!-- 二维码 -->
|
|
|
<view class="qr-code ">
|
|
|
- <view class="img">
|
|
|
+ <div class="img" ref="qrCodeDiv"></div>
|
|
|
+ <!-- <view class="img">
|
|
|
<img src="../../assets/img/qrCode.png" alt="">
|
|
|
<view class="qr-logo">
|
|
|
<img src="../../assets/img/qrLogo.png" alt="">
|
|
|
</view>
|
|
|
-
|
|
|
-
|
|
|
- </view>
|
|
|
+ </view> -->
|
|
|
<view class="hint">
|
|
|
将二维码对准摄像头,即可付款就餐
|
|
|
</view>
|
|
@@ -44,7 +43,7 @@
|
|
|
</view>
|
|
|
</view> -->
|
|
|
<!-- 我的消费记录 -->
|
|
|
- <view class="consumption-record">
|
|
|
+ <view class="consumption-record" @click="gotoUrl('pages/mine/myMealCard')">
|
|
|
<view class="icon">
|
|
|
<img src="../../assets/img/riLine-file-list-3-line@1x.png" alt="">
|
|
|
</view>
|
|
@@ -56,74 +55,122 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
-
|
|
|
+
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+ import QRCode from 'qrcodejs2'
|
|
|
+
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
|
|
|
}
|
|
|
},
|
|
|
+ onReady() {
|
|
|
+ this.getQrcode();
|
|
|
+ },
|
|
|
methods: {
|
|
|
-
|
|
|
+ getQrcode() {
|
|
|
+ this.$nextTick(() => {
|
|
|
+ let div = document.createElement('div');// 创建一个div,用来生成二维码
|
|
|
+ // 生成二维码
|
|
|
+ let qrcode = new QRCode(div, {
|
|
|
+ text: '123456789', // 你的扫码内容,填网址
|
|
|
+ width: 200, // 二维码宽度
|
|
|
+ height: 200, // 二维码高度
|
|
|
+ colorDark: "#333333", //二维码颜色
|
|
|
+ colorLight: "#ffffff", //二维码背景色
|
|
|
+ correctLevel: QRCode.CorrectLevel.H, //从上至下生成码密度越来越高 L - M - Q - H
|
|
|
+ // 容错率越高,越复杂
|
|
|
+ })
|
|
|
+ let logo = new Image();
|
|
|
+ logo.crossOrigin = 'Anonymous';
|
|
|
+ logo.src = require("@/assets/img/qrLogo.png") // 填入你本地log图片
|
|
|
+ // 生成log图
|
|
|
+ logo.onload = () => {
|
|
|
+ let container = this.$refs['qrCodeDiv'];
|
|
|
+ // 获取页面上的div,可以使用document.querySelector()等等方法,不类推了
|
|
|
+ if (container.innerHTML != "") {
|
|
|
+ // 获取页面div , 有则清空已存在的
|
|
|
+ container.innerHTML = ""
|
|
|
+ }
|
|
|
+ let qrImg = qrcode._el.getElementsByTagName('img')[0]; // 获取二维码
|
|
|
+ let canvas = qrcode._el.getElementsByTagName('canvas')[0]; // 获取canvas
|
|
|
+
|
|
|
+ let ctx = canvas.getContext("2d");
|
|
|
+ ctx.drawImage(logo, 200 * 0.5 - 22, 200 * 0.5 - 22, 56, 56); // 写入log
|
|
|
+ qrImg.src = canvas.toDataURL();
|
|
|
+ container.appendChild(qrcode._el);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
- page{
|
|
|
+ page {
|
|
|
background-color: #2A8EFB;
|
|
|
}
|
|
|
- /deep/.u-navbar{
|
|
|
+
|
|
|
+ /deep/.u-navbar {
|
|
|
background-color: #2A8EFB !important;
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
- /deep/.u-title{
|
|
|
+
|
|
|
+ /deep/.u-title {
|
|
|
color: #fff !important;
|
|
|
font-weight: bold !important;
|
|
|
}
|
|
|
- /deep/.uicon-nav-back{
|
|
|
+
|
|
|
+ /deep/.uicon-nav-back {
|
|
|
color: #fff !important
|
|
|
}
|
|
|
+
|
|
|
/deep/.u-border-bottom:after {
|
|
|
- border-bottom-width: 0px;
|
|
|
-}
|
|
|
+ border-bottom-width: 0px;
|
|
|
+ }
|
|
|
|
|
|
- .content{
|
|
|
+ .content {
|
|
|
border-radius: 24rpx;
|
|
|
background-color: rgba(255, 255, 255, 1);
|
|
|
- margin:48rpx 32rpx;
|
|
|
+ margin: 48rpx 32rpx;
|
|
|
+
|
|
|
// 饭卡信息
|
|
|
- .head{
|
|
|
+ .head {
|
|
|
padding: 32rpx 0;
|
|
|
margin: 0 32rpx;
|
|
|
display: flex;
|
|
|
justify-content: space-between;
|
|
|
align-items: center;
|
|
|
border-bottom: 1px solid rgba(232, 232, 232, 1);
|
|
|
- .person{
|
|
|
+
|
|
|
+ .person {
|
|
|
display: flex;
|
|
|
align-items: center;
|
|
|
- .photo{
|
|
|
+
|
|
|
+ .photo {
|
|
|
width: 48rpx;
|
|
|
height: 48rpx;
|
|
|
border-radius: 100rpx;
|
|
|
overflow: hidden;
|
|
|
- img{
|
|
|
+
|
|
|
+ img {
|
|
|
width: 100%;
|
|
|
height: 100%;
|
|
|
}
|
|
|
}
|
|
|
- .name{
|
|
|
+
|
|
|
+ .name {
|
|
|
color: rgba(51, 51, 51, 1);
|
|
|
font-size: 36rpx;
|
|
|
margin-left: 16rpx;
|
|
|
}
|
|
|
}
|
|
|
- .balance{
|
|
|
+
|
|
|
+ .balance {
|
|
|
display: flex;
|
|
|
align-items: center;
|
|
|
color: rgba(16, 16, 16, 1);
|
|
@@ -131,68 +178,81 @@
|
|
|
font-weight: bold;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
// 二维码
|
|
|
- .qr-code{
|
|
|
+ .qr-code {
|
|
|
padding: 80rpx 0;
|
|
|
-
|
|
|
- .img{
|
|
|
+
|
|
|
+ .img {
|
|
|
width: 400rpx;
|
|
|
height: 400rpx;
|
|
|
position: relative;
|
|
|
margin: 0 144rpx;
|
|
|
- img{
|
|
|
+
|
|
|
+ img {
|
|
|
width: 100%;
|
|
|
height: 100%;
|
|
|
}
|
|
|
}
|
|
|
- .qr-logo{
|
|
|
+
|
|
|
+ .qr-logo {
|
|
|
width: 112rpx;
|
|
|
height: 112rpx;
|
|
|
- position:absolute;
|
|
|
- top: 0;left:0;right:0;bottom:0;
|
|
|
+ position: absolute;
|
|
|
+ top: 0;
|
|
|
+ left: 0;
|
|
|
+ right: 0;
|
|
|
+ bottom: 0;
|
|
|
margin: auto;
|
|
|
-
|
|
|
- img{
|
|
|
+
|
|
|
+ img {
|
|
|
width: 100%;
|
|
|
height: 100%;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
// 付款中
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
- .hint{
|
|
|
+
|
|
|
+ .hint {
|
|
|
margin-top: 16rpx;
|
|
|
color: rgba(51, 51, 51, 1);
|
|
|
text-align: center;
|
|
|
}
|
|
|
+
|
|
|
//我的消费记录
|
|
|
- .consumption-record{
|
|
|
+ .consumption-record {
|
|
|
display: flex;
|
|
|
align-items: center;
|
|
|
padding: 32rpx 0;
|
|
|
margin: 0 32rpx;
|
|
|
border-top: 1px solid rgba(232, 232, 232, 1);
|
|
|
- .icon{
|
|
|
+
|
|
|
+ .icon {
|
|
|
width: 40rpx;
|
|
|
height: 40rpx;
|
|
|
-
|
|
|
- img{
|
|
|
+
|
|
|
+ img {
|
|
|
width: 100%;
|
|
|
height: 100%;
|
|
|
}
|
|
|
}
|
|
|
- .text{
|
|
|
+
|
|
|
+ .text {
|
|
|
color: rgba(51, 51, 51, 1);
|
|
|
font-size: 32rpx;
|
|
|
margin-left: 8rpx;
|
|
|
}
|
|
|
- .right{
|
|
|
+
|
|
|
+ .right {
|
|
|
margin-left: auto;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
// 付款中
|
|
|
- .paying{
|
|
|
+ .paying {
|
|
|
width: 160rpx;
|
|
|
height: 160rpx;
|
|
|
border-radius: 8px;
|
|
@@ -200,20 +260,21 @@
|
|
|
color: #fff;
|
|
|
padding: 22rpx 0;
|
|
|
text-align: center;
|
|
|
- position:absolute;
|
|
|
+ position: absolute;
|
|
|
top: 440rpx;
|
|
|
- left:0;
|
|
|
- right:0;
|
|
|
-
|
|
|
+ left: 0;
|
|
|
+ right: 0;
|
|
|
+
|
|
|
margin: auto;
|
|
|
-
|
|
|
- img{
|
|
|
+
|
|
|
+ img {
|
|
|
width: 72rpx;
|
|
|
height: 72rpx;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
// 透明
|
|
|
- .opacity{
|
|
|
+ .opacity {
|
|
|
opacity: 0.3;
|
|
|
}
|
|
|
-</style>
|
|
|
+</style>
|