You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
419 lines
9.7 KiB
419 lines
9.7 KiB
<template>
|
|
<view class="content m-content" :style="{ height: `${windowHeight}px` }">
|
|
<profile></profile>
|
|
<view class="m-top-bg">
|
|
<image src="/static/images/index/head-bg.png" alt="" />
|
|
</view>
|
|
<view class="m-head">
|
|
<view class="m-tips">今日数据</view>
|
|
<view class="m-head-content">
|
|
<view class="m-nums people">{{ checkedNum }}</view>
|
|
<view class="m-text">
|
|
<image src="/static/images/index/icon_people-number.png" alt="" />
|
|
总检票人数(人)
|
|
</view>
|
|
</view>
|
|
<view class="m-drived-colum"></view>
|
|
<view class="m-head-content">
|
|
<view class="m-nums seal">{{ ticketNum }}</view>
|
|
<view class="m-text">
|
|
<image src="/static/images/index/icon_sheet-number.png" alt="" />
|
|
总售票张数(张)
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="btn-group">
|
|
<view class="m-btn" :class="item.name == '扫码检票' ? 'one' : item.name == '手持售票' ? 'two' : 'three'" @click="btnClick(item.name)" v-for="(item, index) in menus">
|
|
<image class="btn-img" :src="item.name == '扫码检票' ? '/static/images/index/icon_vote-check.png': item.name == '手持售票'? '/static/images/index/icon_vote-sell.png': '/static/images/index/icon_record.png'" alt="" />
|
|
<view class="m-btn-text">{{ item.name }}</view>
|
|
</view>
|
|
<!-- <view class="m-btn" @click="getSN">
|
|
<img src="/static/images/index/icon_vote-sell.png" alt="" />
|
|
<view class="m-btn-text">手持售票</view>
|
|
</view>
|
|
<view class="m-btn" @click="goList">
|
|
<img src="/static/images/index/icon_record.png" alt="" />
|
|
<view class="m-btn-text">检票记录</view>
|
|
</view> -->
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
// // #ifdef APP-PLUS
|
|
// var DCSunmiScanModule = uni.requireNativePlugin('DC-SunmiScan-Module');
|
|
// var globalEvent = uni.requireNativePlugin('globalEvent');
|
|
// // #endif
|
|
|
|
import profile from '../components/m-user-head/profile.vue';
|
|
import { getIndexData } from '@/api/seal/seal.js';
|
|
export default {
|
|
components: {
|
|
profile
|
|
},
|
|
data() {
|
|
return {
|
|
menus: null,
|
|
checkedNum: null,
|
|
ticketNum: null
|
|
};
|
|
},
|
|
computed: {
|
|
windowHeight() {
|
|
return uni.getSystemInfoSync().windowHeight;
|
|
}
|
|
},
|
|
onLoad: function () {
|
|
if (uni.getStorageSync('menu') && uni.getStorageSync('menu') != null) {
|
|
this.menus = uni.getStorageSync('menu');
|
|
} else {
|
|
this.menus = [];
|
|
}
|
|
|
|
this.getIndexData();
|
|
|
|
// // #ifdef APP-PLUS
|
|
// globalEvent.addEventListener('myScanEvent', function (e) {
|
|
// console.log(e);
|
|
// if (e.requestCode == 1 && e.data && e.data.VALUE) {
|
|
// //识别成功
|
|
// // self.initSample(e.data.VALUE);
|
|
// }
|
|
// });
|
|
// DCSunmiScanModule.registerReceiver();
|
|
// // #endif
|
|
},
|
|
onUnload() {
|
|
// // #ifdef APP-PLUS
|
|
// globalEvent.removeEventListener('myScanEvent');
|
|
// // #endif
|
|
},
|
|
mounted() {},
|
|
methods: {
|
|
//跳转路由
|
|
btnClick(val) {
|
|
switch (val) {
|
|
case '扫码检票':
|
|
this.scanCode();
|
|
break;
|
|
case '手持售票':
|
|
this.sealTicket();
|
|
break;
|
|
case '检票记录':
|
|
this.goList();
|
|
break;
|
|
}
|
|
},
|
|
//今日数据
|
|
getIndexData() {
|
|
let this_ = this;
|
|
getIndexData()
|
|
.then((res) => {
|
|
this_.checkedNum = res.data.checkedNum;
|
|
this_.ticketNum = res.data.ticketNum;
|
|
})
|
|
.catch((err) => {
|
|
console.log(err);
|
|
});
|
|
},
|
|
goNFC() {
|
|
const getSN = uni.requireNativePlugin('Mi-GetSN');
|
|
getSN.getSN((snCode) => {
|
|
console.log(snCode);
|
|
});
|
|
// uni.navigateTo({
|
|
// url:'/pages/NFC/NFC'
|
|
// })
|
|
},
|
|
goList() {
|
|
uni.removeStorageSync('ALL_TICKET')
|
|
uni.removeStorageSync('EVENT')
|
|
uni.navigateTo({
|
|
url: '/pages/ticketCheckingRecord'
|
|
});
|
|
},
|
|
sealTicket() {
|
|
uni.navigateTo({
|
|
url: '/pages/shoppingTrolley/shoppingTrolley'
|
|
});
|
|
},
|
|
print(val) {
|
|
console.log(val, '1');
|
|
const sunmi_print = uni.requireNativePlugin('Sunmi-Print-Inner');
|
|
console.log(sunmi_print);
|
|
//使用前连接打印机
|
|
sunmi_print.connect((res) => {
|
|
if (res.connect == 'hello') {
|
|
console.log('打印机成功连接');
|
|
//空白行分割之前打印内容(类似走空白)
|
|
sunmi_print.printDividingline({
|
|
style: '4',
|
|
height: '50'
|
|
});
|
|
//虚线分割线
|
|
sunmi_print.printDividingline({
|
|
style: '3',
|
|
height: '3'
|
|
});
|
|
//空白行分割之后的打印内容(类似走空白)
|
|
sunmi_print.printDividingline({
|
|
style: '4',
|
|
height: '30'
|
|
});
|
|
sunmi_print.printText({
|
|
text: '这是打印的头部',
|
|
align: 1,
|
|
size: 30,
|
|
bold: true,
|
|
underline: false,
|
|
compact: true,
|
|
skip: true
|
|
});
|
|
sunmi_print.printQrCode({
|
|
text: 'SC202408081557067846785_0',
|
|
size: 15,
|
|
errorlevel: 0,
|
|
align: 1
|
|
});
|
|
sunmi_print.printText({
|
|
text: '这是打印的底部',
|
|
align: 1,
|
|
size: 30,
|
|
bold: true,
|
|
underline: false,
|
|
compact: true,
|
|
skip: true
|
|
});
|
|
//空白行分割之前打印内容(类似走空白)
|
|
sunmi_print.printDividingline({
|
|
style: '4',
|
|
height: '30'
|
|
});
|
|
//虚线分割线
|
|
sunmi_print.printDividingline({
|
|
style: '3',
|
|
height: '3'
|
|
});
|
|
//空白行分割之后的打印内容(类似走空白)
|
|
sunmi_print.printDividingline({
|
|
style: '4',
|
|
height: '50'
|
|
});
|
|
}
|
|
});
|
|
console.log(val, '2');
|
|
},
|
|
getInfo() {
|
|
uni.getSystemInfo({
|
|
success: function (res) {
|
|
console.log(res);
|
|
},
|
|
fail: function (err) {
|
|
console.log(err);
|
|
},
|
|
complete: function (res) {
|
|
console.log(res);
|
|
}
|
|
});
|
|
},
|
|
scanCode() {
|
|
uni.removeStorageSync('ALL_TICKET')
|
|
uni.removeStorageSync('EVENT')
|
|
uni.scanCode({
|
|
onlyFromCamera: true,
|
|
scanType: ['qrCode'],
|
|
autoDecodeCharset: true,
|
|
hideAlbum: true,
|
|
success: function (res) {
|
|
console.log('条码类型:' + res.scanType);
|
|
console.log('条码内容:' + res.result);
|
|
uni.redirectTo({
|
|
url: '/pages/checkResult/checkResult?result='+res.result
|
|
});
|
|
}
|
|
});
|
|
|
|
// // #ifdef APP-PLUS
|
|
// var main = plus.android.runtimeMainActivity();
|
|
// DCSunmiScanModule.openCameraByScan(main);
|
|
// // #endif
|
|
}
|
|
}
|
|
};
|
|
</script>
|
|
|
|
<style scoped lang="scss">
|
|
.content {
|
|
justify-content: center;
|
|
background-image: url('/static/images/index/bg.png');
|
|
background-repeat: no-repeat;
|
|
background-size: cover;
|
|
overflow: hidden;
|
|
|
|
.m-top-bg {
|
|
position: absolute;
|
|
top: 0;
|
|
width: 100%;
|
|
z-index: 0;
|
|
|
|
image {
|
|
width: 100%;
|
|
}
|
|
}
|
|
|
|
.m-head {
|
|
width: 90%;
|
|
background-image: url('/static/images/index/top-bg.png');
|
|
background-repeat: no-repeat;
|
|
background-size: 100% 100%;
|
|
padding-top: 100upx;
|
|
position: relative;
|
|
left: 50%;
|
|
transform: translateX(-50%);
|
|
margin-top: 110upx;
|
|
display: flex;
|
|
|
|
.m-tips {
|
|
position: absolute;
|
|
left: 40upx;
|
|
top: 130upx;
|
|
background: #2277f0;
|
|
border-radius: 24upx;
|
|
border: 1upx solid #ffffff;
|
|
color: #fff;
|
|
padding: 5upx 15upx;
|
|
}
|
|
.m-drived-colum {
|
|
width: 2%;
|
|
border-left: #fff 2upx dashed;
|
|
height: 90upx;
|
|
position: relative;
|
|
top: 140upx;
|
|
}
|
|
|
|
.m-head-content {
|
|
width: 49%;
|
|
height: 340upx;
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
padding-top: 140upx;
|
|
|
|
.m-nums {
|
|
font-family: Source Han Sans SC;
|
|
font-weight: bold;
|
|
font-size: 60upx;
|
|
color: #ffffff;
|
|
line-height: 60upx;
|
|
font-style: italic;
|
|
position: relative;
|
|
}
|
|
.m-nums::after {
|
|
content: '';
|
|
width: 150%;
|
|
height: 18upx;
|
|
background-repeat: no-repeat;
|
|
position: absolute;
|
|
bottom: 0;
|
|
left: -10upx;
|
|
background-size: cover;
|
|
z-index: -1;
|
|
}
|
|
.people::after {
|
|
background-image: url('/static/images/index/green.png');
|
|
}
|
|
.seal::after {
|
|
background-image: url('/static/images/index/orange.png');
|
|
}
|
|
|
|
.m-text {
|
|
margin-top: 10upx;
|
|
display: flex;
|
|
align-items: center;
|
|
font-family: Source Han Sans SC;
|
|
font-weight: 400;
|
|
font-size: 28upx;
|
|
color: #ffffff;
|
|
line-height: 60upx;
|
|
text-shadow: 0px 2upx 5upx rgba(34, 119, 240, 0.75);
|
|
|
|
image {
|
|
width: 28upx;
|
|
height: 28upx;
|
|
margin-right: 10upx;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
.btn-group {
|
|
margin: 0 5%;
|
|
display: flex;
|
|
flex-wrap: wrap;
|
|
|
|
.m-btn {
|
|
width: 45%;
|
|
background: rgba(255, 255, 255, 0.3);
|
|
box-shadow: 0px 6upx 14upx 0px rgba(0, 0, 0, 0.03);
|
|
border-radius: 36upx;
|
|
border: 2upx solid #ffffff;
|
|
margin: 0 2.5%;
|
|
margin-bottom: 25upx;
|
|
padding: 40upx 0 40upx 32upx;
|
|
display: flex;
|
|
align-items: center;
|
|
font-family: Source Han Sans SC;
|
|
font-weight: 800;
|
|
font-size: 34upx;
|
|
color: #1b1b1b;
|
|
|
|
image {
|
|
width: 100upx;
|
|
height: 100upx;
|
|
padding: 20upx;
|
|
margin-right: 30upx;
|
|
border-radius: 32upx;
|
|
}
|
|
|
|
.m-btn-text {
|
|
position: relative;
|
|
}
|
|
.m-btn-text::after {
|
|
content: '';
|
|
width: 50%;
|
|
height: 8upx;
|
|
position: absolute;
|
|
bottom: -20upx;
|
|
left: 0;
|
|
}
|
|
}
|
|
.m-btn.one image {
|
|
background: linear-gradient(90deg, #5097fa 0%, #2277f0 100%);
|
|
box-shadow: 0px 12upx 36upx 0px rgba(34, 119, 240, 0.5);
|
|
}
|
|
.one .m-btn-text::after {
|
|
background: linear-gradient(90deg, #2277f0 0%, #5097fa 100%);
|
|
box-shadow: 0px 3upx 7upx 0upx rgba(34, 119, 240, 0.5);
|
|
border-radius: 4upx;
|
|
}
|
|
.m-btn.two image {
|
|
background: linear-gradient(0deg, #fa9a50 0%, #f07b22 100%);
|
|
box-shadow: 0px 12upx 36upx 0px rgba(240, 123, 34, 0.5);
|
|
}
|
|
.two .m-btn-text::after {
|
|
background: linear-gradient(90deg, #f07b22 0%, #fa9a50 100%);
|
|
box-shadow: 0px 3upx 7upx 0px rgba(240, 123, 34, 0.5);
|
|
border-radius: 4upx;
|
|
}
|
|
.m-btn.three image {
|
|
background: linear-gradient(90deg, #41d9b3 0%, #09b388 100%);
|
|
box-shadow: 0px 12upx 36upx 0px rgba(9, 178, 136, 0.5);
|
|
}
|
|
.three .m-btn-text::after {
|
|
background: linear-gradient(90deg, #09b288 0%, #41d9b3 100%);
|
|
box-shadow: 0px 3upx 7upx 0px rgba(9, 178, 136, 0.5);
|
|
border-radius: 4upx;
|
|
}
|
|
}
|
|
}
|
|
</style>
|
|
|