<!-- 手动贴标RFID扫描 --> <template> <view class="container-wrap"> <uni-nav-bar title="扫描结果" :status-bar="true" background-color="#3F92F9" color="#FFF"> <view slot="left"> <u-icon name="account-fill" color="#FFF" size="35"></u-icon> <span style="padding: 0 5rpx;color: #FFFFFF;">{{ userInfo.name }}</span> </view> <view slot="right" @tap="$utils.back()"> <span style="color: #FFFFFF;">返回</span> </view> </uni-nav-bar> <view class="container"> <view class="title">物料信息</view> <view class="info"> <view class="row flex-start"> <view class="label"> 合同编码: </view> <view class="value"> {{ option.purchaseBillNo }} </view> </view> <view class="row flex-start"> <view class="label"> 入库单号: </view> <view class="value"> {{ option.stockInOutBillNo }} </view> </view> <view class="row flex-start"> <view class="label"> 物料编码: </view> <view class="value"> {{ option.materialCode }} </view> </view> <view class="row flex-start"> <view class="label"> 物料名称: </view> <view class="value"> {{ option.materialName }} </view> </view> <view class="row flex-start"> <view class="label"> 物料规格: </view> <view class="value"> {{ option.spec }} </view> </view> <view class="row flex-start"> <view class="label"> 物料单位: </view> <view class="value"> {{ option.unitName }} </view> </view> </view> <view class="title">请扫描RFID标签</view> <u-image height="300rpx" mode="aspectFit" src="../../../static/images/rfid.png"></u-image> <view class="title" v-if="isReading">扫描中...</view> <view class="title" v-if="!isReading">扫描成功</view> <view class="btn" v-if="!isReading"> <u-input v-model="quantity" placeholder="请输入面料长度" type="number" :border="true" style="width: 100%;margin-bottom: 20rpx;"/> <u-button throttleTime="300" type="primary" style="width: 100%;margin-bottom: 20rpx;" @click="bind">绑定并继续</u-button> <u-button throttleTime="300" type="primary" style="width: 100%;" @click="$utils.back(3)">取消</u-button> </view> </view> </view> </template> <script> // #ifdef APP-PLUS // #endif export default { data() { return { option: {}, quantity: '', isReading: true, rfidCode: '' }; }, methods: { bind() { if(!this.quantity) { return this.$msg.showToast('请输入面料长度!') } this.$http.AddRfidCodeStockTag({ materialCode: this.option.materialCode, rfidCode: this.rfidCode, stockInOutBillNo: this.option.stockInOutBillNo, purchaseBillNo: this.option.purchaseBillNo, quantity: this.quantity }).then(res => { console.log(res) if(res.code === 0) { this.$msg.showToast(res.msg || '绑定成功!') setTimeout(()=> { this.$utils.back() }, 2000) } }) }, /* 扫码贴标 */ scanPaste() { this.$utils.uniScanCode().then(res => { console.log(res) }) } }, onLoad(option) { this.option = this.$utils.code2Object(option.data) this.$pda.uhfScan().then(res => { console.log(res) this.isReading = false this.rfidCode = res[0].epc console.log(this.rfidCode) }).catch(() => { this.$msg.showToast('未识别到有效RFID标签!') setTimeout(() => { this.$utils.back() }, 1000) }) }, onUnload() { this.$pda.uhfStop() } } </script> <style lang="scss" scoped> .container-wrap { background-color: #FFFFFF; overflow: hidden; .container { padding: 0 40rpx; height: calc(100vh - var(--status-bar-height) - 44px); overflow: auto; .title { padding: 20rpx 0; font-size: 36rpx; font-weight: bold; text-align: center; } .info { .row { .label { width: 160rpx; } .value { flex: 1; overflow: hidden; word-wrap: break-word; } } } } } </style>