|
|
|
@ -22,9 +22,34 @@ |
|
|
|
|
</view> |
|
|
|
|
</view> |
|
|
|
|
</view> |
|
|
|
|
|
|
|
|
|
<view class="uni-form-item uni-columns" style="opacity: 0.9"> |
|
|
|
|
<input |
|
|
|
|
ref="inputRef" |
|
|
|
|
:focus="isAutoFocus" |
|
|
|
|
@focus="handleFocus" |
|
|
|
|
readonly |
|
|
|
|
v-model="quickScanData" |
|
|
|
|
@confirm="qucikScan" |
|
|
|
|
class="uni-input" |
|
|
|
|
focus |
|
|
|
|
placeholder="请扫描或输入票号" |
|
|
|
|
/> |
|
|
|
|
<image @click="qucikScan" src="@/static/images/index/icon_quick-check.svg"></image> |
|
|
|
|
</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="" /> |
|
|
|
|
<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"> |
|
|
|
@ -55,7 +80,9 @@ export default { |
|
|
|
|
return { |
|
|
|
|
menus: null, |
|
|
|
|
checkedNum: null, |
|
|
|
|
ticketNum: null |
|
|
|
|
ticketNum: null, |
|
|
|
|
quickScanData: null, |
|
|
|
|
isAutoFocus: false |
|
|
|
|
}; |
|
|
|
|
}, |
|
|
|
|
computed: { |
|
|
|
@ -63,6 +90,18 @@ export default { |
|
|
|
|
return uni.getSystemInfoSync().windowHeight; |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
// 当前页面的 onShow 生命周期 |
|
|
|
|
onShow() { |
|
|
|
|
// 需要配合 nextTick 或 setTimeout 保证 DOM 更新完成 |
|
|
|
|
this.$nextTick(() => { |
|
|
|
|
this.quickScanData = null; |
|
|
|
|
this.$refs.inputRef.focus(); // 通过 ref 获取 input 组件 |
|
|
|
|
}); |
|
|
|
|
// 或使用定时器 |
|
|
|
|
setTimeout(() => { |
|
|
|
|
this.isAutoFocus = true; // 触发 :focus 属性 |
|
|
|
|
}, 100); |
|
|
|
|
}, |
|
|
|
|
onLoad: function () { |
|
|
|
|
if (uni.getStorageSync('menu') && uni.getStorageSync('menu') != null) { |
|
|
|
|
this.menus = uni.getStorageSync('menu'); |
|
|
|
@ -72,6 +111,12 @@ export default { |
|
|
|
|
|
|
|
|
|
this.getIndexData(); |
|
|
|
|
|
|
|
|
|
// #ifdef APP-PLUS |
|
|
|
|
this.timer = setInterval(() => { |
|
|
|
|
uni.hideKeyboard(); |
|
|
|
|
}, 50); |
|
|
|
|
// #endif |
|
|
|
|
|
|
|
|
|
// // #ifdef APP-PLUS |
|
|
|
|
// globalEvent.addEventListener('myScanEvent', function (e) { |
|
|
|
|
// console.log(e); |
|
|
|
@ -90,6 +135,28 @@ export default { |
|
|
|
|
}, |
|
|
|
|
mounted() {}, |
|
|
|
|
methods: { |
|
|
|
|
handleFocus() { |
|
|
|
|
// 聚焦后关闭定时隐藏键盘逻辑(若采用方案一需注意) |
|
|
|
|
clearInterval(this.timer); |
|
|
|
|
}, |
|
|
|
|
//红外扫描 |
|
|
|
|
qucikScan() { |
|
|
|
|
console.log(this.quickScanData, 'qucikScan'); |
|
|
|
|
if (!this.quickScanData) { |
|
|
|
|
uni.showToast({ |
|
|
|
|
icon:'none', |
|
|
|
|
title: '请先扫描或输入票号', |
|
|
|
|
duration: 2000 |
|
|
|
|
}); |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
uni.redirectTo({ |
|
|
|
|
url: '/pages/checkResult/checkResult?result=' + this.quickScanData + '&quick=1', |
|
|
|
|
success() { |
|
|
|
|
this.quickScanData = null; |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
//跳转路由 |
|
|
|
|
btnClick(val) { |
|
|
|
|
switch (val) { |
|
|
|
@ -126,8 +193,8 @@ export default { |
|
|
|
|
// }) |
|
|
|
|
}, |
|
|
|
|
goList() { |
|
|
|
|
uni.removeStorageSync('ALL_TICKET') |
|
|
|
|
uni.removeStorageSync('EVENT') |
|
|
|
|
uni.removeStorageSync('ALL_TICKET'); |
|
|
|
|
uni.removeStorageSync('EVENT'); |
|
|
|
|
uni.navigateTo({ |
|
|
|
|
url: '/pages/ticketCheckingRecord' |
|
|
|
|
}); |
|
|
|
@ -217,8 +284,8 @@ export default { |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
scanCode() { |
|
|
|
|
uni.removeStorageSync('ALL_TICKET') |
|
|
|
|
uni.removeStorageSync('EVENT') |
|
|
|
|
uni.removeStorageSync('ALL_TICKET'); |
|
|
|
|
uni.removeStorageSync('EVENT'); |
|
|
|
|
uni.scanCode({ |
|
|
|
|
onlyFromCamera: true, |
|
|
|
|
scanType: ['qrCode'], |
|
|
|
@ -228,7 +295,7 @@ export default { |
|
|
|
|
console.log('条码类型:' + res.scanType); |
|
|
|
|
console.log('条码内容:' + res.result); |
|
|
|
|
uni.redirectTo({ |
|
|
|
|
url: '/pages/checkResult/checkResult?result='+res.result |
|
|
|
|
url: '/pages/checkResult/checkResult?result=' + res.result + '&quick=0' |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
@ -416,4 +483,23 @@ export default { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.uni-columns { |
|
|
|
|
display: flex; |
|
|
|
|
align-items: center; |
|
|
|
|
width: 90%; |
|
|
|
|
background-color: #fff; |
|
|
|
|
margin: 0 auto; |
|
|
|
|
justify-content: space-between; |
|
|
|
|
margin-bottom: 20px; |
|
|
|
|
border-radius: 10px; |
|
|
|
|
.uni-input { |
|
|
|
|
width: 70%; |
|
|
|
|
padding-left: 10px; |
|
|
|
|
} |
|
|
|
|
image { |
|
|
|
|
width: 15%; |
|
|
|
|
height: 35px; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
</style> |
|
|
|
|