| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- <template>
- <view>
- <uni-nav-bar
- fixed="true"
- statusBar="true"
- left-icon="back"
- title="扫描设备"
- @clickLeft="back"
- ></uni-nav-bar>
- <view class="main">
- <view class="ts"> 请将红外设备对准条形码 </view>
- <view class="title" v-if="info"> 扫描结果: </view>
- <view class="content" v-if="info">
- {{ info }}
- </view>
- </view>
- <view class="fixed-bottom-bar">
- <view class="item s2" @click="back"> 返回 </view>
- <view class="item s1" @click="submit"> 确定 </view>
- </view>
- <ScanCode @scancodedate="cbScancodedate"></ScanCode>
- </view>
- </template>
- <script>
- import ScanCode from '@/components/ScanCode.vue'
- import { get, postJ, post } from '@/utils/api.js'
- export default {
- data () {
- return {
- info: null
- }
- },
- components: {
- ScanCode
- },
- /* onShow () {
- var _this = this
- uni.$off('scancodedate') // 每次进来先 移除全局自定义事件监听器
- uni.$on('scancodedate', function (data) {
- _this.info = data.code
- })
- }, */
- methods: {
- submit () {
- if (this.info) {
- uni.$emit('scancode', { code: this.info })
- //this.back()
- } else {
- uni.showToast({
- title: '请先扫描条形码',
- icon: 'none'
- })
- }
- },
- // 返回
- back () {
- uni.navigateBack({
- delta: 1
- })
- },
- cbScancodedate(data){
- this.info = data.code
- }
- }
- }
- </script>
- <style scoped lang="scss">
- .main {
- padding: 30rpx;
- padding-bottom: 81rpx;
- }
- .title {
- margin-top: 30rpx;
- }
- .fixed-bottom-bar {
- display: flex;
- position: fixed;
- bottom: 0;
- left: 0;
- width: 100%;
- height: 80rpx;
- box-sizing: border-box;
- border-top: 1px solid #f2f2f2;
- .item {
- flex: 1;
- height: 100%;
- line-height: 80rpx;
- text-align: center;
- &.s1 {
- background-color: #157a2c;
- color: #fff;
- }
- }
- }
- </style>
|