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.
 
 
 
 
 
 

93 lines
2.1 KiB

<template>
<uni-popup ref="popup">
<view class="popup_box">
<view class="pop_title">
扫描信息
<text class="fr" @click="closeScanPopup()">关闭</text>
</view>
<!-- 以下应是tab切换格式此处只有一个选项卡 -->
<view class="pop_tab">
<view class="uni-flex uni-row">
<view v-for="(tab, index) in tabBars" :key="tab.id" class="uni-tab-item" :id="tab.id"
:data-current="index" :class="tabIndex == index ? 'tab_tit tab_tit_active' : 'tab_tit'"
@click="ontabtap">
{{ tab.name }}
</view>
</view>
<!-- 选中效果class 为tab_tit_active -->
<view class="tab_info">
<win-com-scan @getScanResult="getScanResult" :placeholder="placeholder"></win-com-scan>
</view>
</view>
</view>
</uni-popup>
</template>
<script>
import winComScan from '@/mycomponents/wincom/winComScan.vue'
export default {
name: 'winScanReceipt',
components: {
winComScan
},
props: {
title: {
type: String,
default: ''
},
},
data() {
return {
code: '',
type: 'ASN',
tabIndex: 0,
tabBars: [{
name: '扫描发货单',
id: 1
},
{
name: '扫描到货单',
id: 2
}
],
placeholder: '扫描发货单'
}
},
created() {
},
methods: {
openScanPopup() {
this.$refs.popup.open('bottom')
},
closeScanPopup() {
this.$refs.popup.close()
},
ontabtap(e) {
let index = e.target.dataset.current || e.currentTarget.dataset.current;
this.tabIndex = index;
if (this.tabIndex === 0) this.placeholder = '发货单';
else if (this.tabIndex === 1) this.placeholder = '到货单';
},
getScanResult(result) {
if (result.data.scanType === 'qrcode') {
this.code = result.data.itemCode;
} else if (result.data.scanType === 'barcode') {
this.code = result.data.code;
}
this.callBack();
},
callBack() {
if (this.tabIndex === 0) this.type = 'ASN';
else if (this.tabIndex === 1) this.type = 'ArriveNotice';
this.closeScanPopup();
this.$emit("getScanCode", this.type, this.code);
}
}
}
</script>
<style>
</style>