123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224 |
- <!-- 归还入库 -->
- <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">
- <!-- 扫描rfid -->
- <view class="reading">
- <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>
- <!-- 扫描到RFID标签时,打开质检结果 -->
- <view v-if="!isReading" class="info">
- <view class="row flex-start">
- <view class="label">
- 物料编码:
- </view>
- <view class="value">
- {{ data.materialCode }}
- </view>
- </view>
- <view class="row flex-start">
- <view class="label">
- 物料名称:
- </view>
- <view class="value">
- {{ data.materialName }}
- </view>
- </view>
- <view class="row flex-start">
- <view class="label">
- 物料规格:
- </view>
- <view class="value">
- {{ data.spec }}
- </view>
- </view>
- <view class="row flex-start">
- <view class="label">
- 物料单位:
- </view>
- <view class="value">
- {{ data.unitName }}
- </view>
- </view>
- <view class="row" style="align-items: center;justify-content: flex-start;">
- <view class="col" style="align-items: center;">
- <view class="label">剩余长度:</view>
- <view class="value" style="background-color: #FFFFFF;">
- <u-input v-model="quantity" type="number" :border="true" placeholder="请输入面料长度"/>
- </view>
- <span style="margin-left: 10rpx;">米</span>
- </view>
- </view>
- <view class="btn flex-column-center" v-if="!isReading">
- <view class="row">
- <u-button throttleTime="300" type="primary" style="width: 100%;" @click="cfm(0)">确定并继续</u-button>
- </view>
- <view class="row">
- <view class="col">
- <u-button throttleTime="300" type="error" style="width: 100%;" @click="cfm(1)">确定并结束</u-button>
- </view>
- </view>
- </view>
- <view class="row" style="justify-content: flex-end;margin-top: 20rpx;">
- <a href="#" @tap="toNewTag">标签损坏?</a>
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- // #ifdef APP-PLUS
- // #endif
- export default {
- data() {
- return {
- quantity: '',
- isReading: true,
- rfidCode: '',
- data: {}
- };
- },
- methods: {
- toNewTag() {
- this.$utils.open('/pages/tag/tag')
- },
- getList() {
- this.$pda.uhfStop()
- this.$http.ScanRfidCodeStockTag({
- rfidCode: this.rfidCode,
- checkRfidType: 2,
- }).then(res => {
- console.log(res)
- if(res.code === 0) {
- this.isReading = false
- this.data = res.result
- } else {
- this.$msg.showToast(res.msg)
- this.isReading = true
- this.scanRfid()
- }
- })
- },
- cfm(type) {
- if(!this.quantity) {
- return this.$msg.showToast('剩余长度不能小于0!')
- }
- this.$http.SaveStockInBack({
- stockTagId: this.data.stockTagId,
- quantity: this.quantity
- }).then(res => {
- if(res.code === 0) {
- this.$msg.showToast(res.msg, 'success')
- setTimeout(() => {
- if(type === 0) {
- this.quantity = ''
- this.data = {}
- this.isReading = true
- this.$pda.uhfScan().then(res => {
- console.log(res)
- this.isReading = false
- this.rfidCode = res[0].epc
- this.getList()
- console.log(this.rfidCode)
- }).catch(() => {
- this.$msg.showToast('未识别到有效RFID标签!')
- setTimeout(() => {
- this.$utils.back()
- }, 1000)
- })
- } else if(type === 1) {
- this.$utils.back()
- }
- }, 1000)
- }
- })
- },
- /* 扫码贴标 */
- scanPaste() {
- this.$utils.uniScanCode().then(res => {
- console.log(res)
- })
- },
- scanRfid() {
- this.$pda.uhfScan().then(res => {
- console.log(res)
- this.rfidCode = res[0].epc
- this.getList()
- console.log(this.rfidCode)
- }).catch(() => {
- this.$msg.showToast('未识别到有效RFID标签!')
- setTimeout(() => {
- this.$utils.back()
- }, 1000)
- })
- }
- },
- onLoad(option) {
- console.log(option)
- this.scanRfid()
- },
- onUnload() {
- this.$pda.uhfStop()
- }
- }
- </script>
- <style lang="scss" scoped>
- .container-wrap {
- overflow: hidden;
- .container {
- padding: 0 10rpx;
- height: calc(100vh - var(--status-bar-height) - 44px);
- overflow: auto;
- .title {
- padding: 20rpx 0;
- font-size: 36rpx;
- font-weight: bold;
- text-align: center;
- }
- .reading {
- padding: 40rpx 0;
- }
- .info {
- padding: 20rpx 60rpx;
- border-radius: 10rpx ;
- .row {
- align-items: flex-start;
- .label {
- font-size: 32rpx;
- width: 160rpx;
- }
- .value {
- font-size: 32rpx;
- flex: 1;
- overflow: hidden;
- word-wrap: break-word;
- }
- }
- }
- .btn {
- margin-top: 20rpx;
- height: 180rpx;
- .row {
- padding: 0;
- padding-bottom: 20rpx;
- width: 100%;
- }
- }
- }
- }
- </style>
|