123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299 |
- <!-- 报废申请-扫描标签 -->
- <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">请扫描要退货的<br/>物料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="title">物料信息</view>
- <view class="row flex-start">
- <view class="label">
- 物料标签:
- </view>
- <view class="value">
- {{ data.rfidCode }}
- </view>
- </view>
- <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.supplierName }}
- </view>
- </view>
- <view class="row flex-start">
- <view class="label">
- 合同批次:
- </view>
- <view class="value">
- {{ data.batchNo }}
- </view>
- </view>
- <view class="row flex-start">
- <view class="label">
- 数量:
- </view>
- <view class="value">
- {{ data.quantity }}
- </view>
- </view>
- <view class="row flex-start">
- <view class="label">
- 金额:
- </view>
- <view class="value">
- {{ data.amount }}
- </view>
- </view>
- <view class="row flex-start">
- <view class="label">
- 申请原因:
- </view>
- <view class="value">
- {{ data.applyReason }}
- </view>
- </view>
- <view class="row flex-start">
- <view class="value">
- <u-input v-model="applyReason" type="textarea" :border="true" height="150"/>
- </view>
- </view>
- </view>
- <view v-if="!isReading" class="row" style="justify-content: flex-start;">
- <u-upload
- ref="uUpload"
- :size-type="['compressed']"
- @on-remove="onRemove"
- :before-upload="beforeUpload">
- </u-upload>
- </view>
- <view class="btn" v-if="!isReading">
- <view class="row">
- <u-button throttleTime="300" type="primary" style="width: 100%;" @click="cfm">确定</u-button>
- </view>
- <view class="row">
- <u-button throttleTime="300" type="error" style="width: 100%;" @click="$utils.back()">取消</u-button>
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- // #ifdef APP-PLUS
- // #endif
- export default {
- data() {
- return {
- rfidCode: '',
- isReading: true,
- data: {},
- isActive: true,
- applyReason: '',
- uploadList: []
- };
- },
- methods: {
- beforeUpload(index, list) {
- console.log('upload list -------------')
- console.log(list)
- console.log(index)
- uni.compressImage({
- src: list[index].url,
- quality: 50,
- width: '60%',
- height: '60%',
- success: res => {
- plus.io.resolveLocalFileSystemURL(res.tempFilePath,
- (entry) => {
- entry.file(file => {
- let reader = new plus.io.FileReader();
- reader.onloadend = ( e ) => {
- this.$http.UploadBase64({
- fileBase64: e.target.result,
- fileName: file.name,
- floder: 'ytjImg',
- }).then(res => {
- console.log(res)
- if(res.code === 0) {
- // this.form.imageUrl = res.result
- this.uploadList.push(res.result)
- } else {
- this.uploadList.push(null)
- }
- }).catch(() => {
- this.uploadList.push(null)
- })
- };
- reader.readAsDataURL( file );
- })
- },
- (e) => {
- console.log(e)
- })
- }
- })
- return false
- },
- onRemove(index) {
- // this.form.imageUrl = ''
- this.uploadList.splice(index, 1)
- },
- cfm() {
- if(this.uploadList.find(item => item === null) === null) {
- this.$msg.showToast('存在上传失败图片 正在重新上传')
- this.$refs['uUpload'].reUpload()
- this.uploadList = []
- return
- }
- if(!this.applyReason) {
- return this.$msg.showToast('请输入申请原因')
- }
- uni.$emit('scan-list', {
- ...this.data,
- takeQty: this.data.quantity,
- rfidCode: this.rfidCode,
- imageUrls: this.uploadList.join(','),
- applyReason: this.applyReason
- })
- this.$utils.back()
- },
- getList() {
- this.$http.ScanRfidCodeStockTag({
- rfidCode: this.rfidCode,
- checkRfidType: 1,
- }).then(res => {
- console.log(res)
- if(res.code === 0) {
- this.isReading = false
- this.data = res.result
- } else {
- this.$msg.showToast(res.msg)
- if(this.isActive) {
- this.scanRfid()
- }
- }
- })
- },
- 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) {
- this.isActive = true
- this.scanRfid()
- },
- onUnload() {
- this.isActive = false
- this.$pda.uhfStop()
- }
- }
- </script>
- <style lang="scss" scoped>
- .container-wrap {
- overflow: hidden;
- .container {
- padding: 0 60rpx;
- padding-bottom: 200rpx;
- 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 ;
- background-color: #FFFFFF;
- .row {
- align-items: flex-start;
- .label {
- font-size: 32rpx;
- width: 160rpx;
- }
- .value {
- font-size: 32rpx;
- flex: 1;
- overflow: hidden;
- word-wrap: break-word;
- }
- }
- }
- .btn {
- padding: 0 60rpx;
- position: fixed;
- bottom: 20rpx;
- left: 0;
- width: 100%;
- z-index: 9999;
- .row {
- padding: 0;
- width: 100%;
- &:last-child {
- padding-bottom: 0;
- }
- }
- }
- }
- /deep/ .u-add-wrap {
- background-color: #FFFFFF;
- }
- }
- </style>
|