shop-applet/components/barcode.vue

122 lines
2.5 KiB
Vue
Raw Normal View History

2023-12-17 13:29:54 +08:00
<template>
2023-12-18 17:55:45 +08:00
<view class="component text-center">
<view class="component-title">{{name}}</view>
<view class="component-code">
<tki-barcode ref="barcode" onval :val="code" :load-make="true" :opations="barOpations" />
</view>
<view class="example">{{code}}</view>
<!-- <view class="component-qr">
2023-12-17 13:29:54 +08:00
<tki-qrcode
ref="qrcode"
onval
:val="code"
:size="250"
:load-make="true"
:show-loading="false"/>
</view> -->
2023-12-18 17:55:45 +08:00
<!-- <view class="coupon-no-view">
2023-12-17 13:29:54 +08:00
<text>编号</text>
<text class="coupon-no">{{ code }}</text>
</view> -->
2023-12-18 17:55:45 +08:00
</view>
2023-12-17 13:29:54 +08:00
</template>
<script>
2023-12-18 17:55:45 +08:00
import tkiBarcode from '@/components/tki-barcode/tki-barcode'
import tkiQrcode from '@/components/tki-qrcode/tki-qrcode'
export default {
components: {
tkiBarcode,
tkiQrcode
},
data() {
return {
name: '',
code: '',
barOpations: {
height: 150,
displayValue: false
2023-12-17 13:29:54 +08:00
}
2023-12-18 17:55:45 +08:00
}
},
methods: {
init(val) {
this.name = val.name;
this.code = val.code // 生成一维码和二维码
// setTimeout(() => {
// this.code = '0987654321' // 5 秒后刷新一维码和二维码
// }, 5000)
}
2023-12-17 13:29:54 +08:00
}
2023-12-18 17:55:45 +08:00
}
2023-12-17 13:29:54 +08:00
</script>
<style lang="scss" scoped>
2023-12-18 17:55:45 +08:00
.component {
border-radius: 16rpx;
overflow: hidden;
display: flex;
flex-direction: column;
background: #FFFFFF;
flex: 1;
margin: 32rpx;
padding: 64rpx 32rpx;
&-title {
max-height: 112rpx;
font-size: 40rpx;
font-weight: 600;
line-height: 56rpx;
overflow: hidden;
2023-12-17 13:29:54 +08:00
}
2023-12-18 17:55:45 +08:00
&-code {
height: 150rpx;
margin: 32rpx 32rpx 0;
2023-12-17 13:29:54 +08:00
}
2023-12-18 17:55:45 +08:00
&-qr {
height: 250rpx;
margin-top: 36rpx;
2023-12-17 13:29:54 +08:00
}
2023-12-18 17:55:45 +08:00
.coupon-no-view {
margin: 0 18rpx;
height: 76rpx;
border-radius: 8rpx;
border: 2px solid #F5F5F5;
display: flex;
align-items: center;
padding: 0 24rpx;
margin-top: 36rpx;
text {
font-size: 24rpx;
font-weight: 400;
&:first-child {
color: #999999;
}
}
.coupon-no {
flex: 1;
text-align: left;
}
}
}
.component-title {
text-align: center;
font-size: 34rpx;
}
.example {
text-align: center;
letter-spacing: 12rpx;
/* 设置字符间距 */
font-weight: bold;
font-size: 32rpx;
}
2023-12-17 13:29:54 +08:00
</style>