182 lines
3.9 KiB
Vue
182 lines
3.9 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="box-">
|
|||
|
<view class="title_">扫码成为京博加油站会员</view>
|
|||
|
<view
|
|||
|
style="background: #fff;width: 215px; height: 220px; border-radius: 8px ; margin: 15px auto; box-sizing: border-box; padding-top: 10px; ">
|
|||
|
<canvas id="qrcode" canvas-id="qrcode" style="width: 200px;height: 200px; margin: 0px auto; ">
|
|||
|
<!-- <image url="https://cdn.uviewui.com/uview/resources/18496183264.png"></image> -->
|
|||
|
|
|||
|
</canvas>
|
|||
|
|
|||
|
</view>
|
|||
|
|
|||
|
<view class="title_">扫码识别领取会员卡</view>
|
|||
|
</view>
|
|||
|
|
|||
|
<view class="p-bottom">
|
|||
|
<view class="anniu" @click="goback()">
|
|||
|
手动添加
|
|||
|
</view>
|
|||
|
</view>
|
|||
|
|
|||
|
</view>
|
|||
|
</view>
|
|||
|
</template>
|
|||
|
|
|||
|
<script>
|
|||
|
import request from "../../utils/request";
|
|||
|
import config from '@/config'
|
|||
|
|
|||
|
import headers from '../../components/header/headers.vue'
|
|||
|
import UQRCode from '../../uni_modules/Sansnn-uQRCode/js_sdk/uqrcode/uqrcode.js';
|
|||
|
export default {
|
|||
|
data() {
|
|||
|
return {
|
|||
|
titles: "新增会员",
|
|||
|
storeId: '',
|
|||
|
collectionImg: '',
|
|||
|
baseUrl: config.baseUrl,
|
|||
|
|
|||
|
}
|
|||
|
},
|
|||
|
onShow() {
|
|||
|
|
|||
|
// this.actList = ["1", "1", "1", "1", "1", ]
|
|||
|
// this.status = "nomore" 底部刷新结束
|
|||
|
|
|||
|
this.getQRCodeInfoByStoreId()
|
|||
|
},
|
|||
|
onPullDownRefresh() {
|
|||
|
console.log("刷新");
|
|||
|
uni.stopPullDownRefresh()
|
|||
|
},
|
|||
|
onReachBottom() {
|
|||
|
// this.show = true
|
|||
|
setTimeout(() => {
|
|||
|
console.log("加载执行");
|
|||
|
}, 2000)
|
|||
|
},
|
|||
|
components: {
|
|||
|
headers
|
|||
|
},
|
|||
|
methods: {
|
|||
|
getQRCodeInfoByStoreId() {
|
|||
|
request({
|
|||
|
url: 'business/storeInformation/qrCode/createStoreQrCodeByPos',
|
|||
|
method: 'post',
|
|||
|
data: {
|
|||
|
type: 0
|
|||
|
}
|
|||
|
}).then((res) => {
|
|||
|
|
|||
|
if (res.code == 200) {
|
|||
|
this.collectionImg = res.data;
|
|||
|
console.log("res", res)
|
|||
|
this.onReady2()
|
|||
|
} else {
|
|||
|
uni.showToast({
|
|||
|
title: res.data,
|
|||
|
icon: "none"
|
|||
|
})
|
|||
|
}
|
|||
|
|
|||
|
})
|
|||
|
},
|
|||
|
onReady2() {
|
|||
|
|
|||
|
// 获取uQRCode实例
|
|||
|
var qr = new UQRCode();
|
|||
|
// 设置二维码内容
|
|||
|
qr.data = "https://uqrcode.cn/doc";
|
|||
|
// 设置二维码大小,必须与canvas设置的宽高一致
|
|||
|
qr.size = 200;
|
|||
|
// 调用制作二维码方法
|
|||
|
qr.make();
|
|||
|
// 获取canvas上下文
|
|||
|
// var canvasContext = uni.createCanvasContext('qrcode', this); // 如果是组件,this必须传入
|
|||
|
// // 设置uQRCode实例的canvas上下文
|
|||
|
// qr.canvasContext = canvasContext;
|
|||
|
// // 调用绘制方法将二维码图案绘制到canvas上
|
|||
|
// qr.drawCanvas();
|
|||
|
const url = this.baseUrl + this.collectionImg
|
|||
|
// const url = ""
|
|||
|
console.log("this.collectionImg()", url)
|
|||
|
|
|||
|
const ctx = uni.createCanvasContext('qrcode', this);
|
|||
|
ctx.drawImage(url, 0, 0, 200, 200);
|
|||
|
ctx.draw(true, () => {})
|
|||
|
},
|
|||
|
goback() {
|
|||
|
uni.navigateTo({
|
|||
|
url: '/pagesHome/AddVip/AddVip'
|
|||
|
})
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
</script>
|
|||
|
|
|||
|
<style scoped lang="scss">
|
|||
|
.content {
|
|||
|
background: #fff;
|
|||
|
// 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: #fff;
|
|||
|
box-sizing: border-box;
|
|||
|
padding-top: 88px;
|
|||
|
}
|
|||
|
|
|||
|
.img-box {
|
|||
|
image {
|
|||
|
width: 100%;
|
|||
|
height: 100%;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
.p-bottom {
|
|||
|
width: 100%;
|
|||
|
height: 68px;
|
|||
|
background: #fff;
|
|||
|
position: fixed;
|
|||
|
bottom: 0px;
|
|||
|
left: 0px;
|
|||
|
}
|
|||
|
|
|||
|
.anniu {
|
|||
|
height: 40px;
|
|||
|
background: #0864E9;
|
|||
|
width: 80%;
|
|||
|
display: flex;
|
|||
|
align-items: center;
|
|||
|
justify-content: center;
|
|||
|
color: #fff;
|
|||
|
border-radius: 50px;
|
|||
|
margin: 5px auto;
|
|||
|
}
|
|||
|
|
|||
|
.box- {
|
|||
|
width: 95%;
|
|||
|
margin: 15px auto;
|
|||
|
border-radius: 8px;
|
|||
|
background: #0864E9;
|
|||
|
height: 400px;
|
|||
|
box-sizing: border-box;
|
|||
|
padding-top: 15px;
|
|||
|
}
|
|||
|
|
|||
|
.title_ {
|
|||
|
text-align: center;
|
|||
|
width: 100%;
|
|||
|
font-weight: bold;
|
|||
|
font-size: 16px;
|
|||
|
color: #FFFFFF;
|
|||
|
margin-bottom: 15px;
|
|||
|
}
|
|||
|
</style>
|