artificial-paste-scan.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. <!-- 手动贴标RFID扫描 -->
  2. <template>
  3. <view class="container-wrap">
  4. <uni-nav-bar title="扫描结果" :status-bar="true" background-color="#3F92F9" color="#FFF">
  5. <view slot="left">
  6. <u-icon name="account-fill" color="#FFF" size="35"></u-icon>
  7. <span style="padding: 0 5rpx;color: #FFFFFF;">{{ userInfo.name }}</span>
  8. </view>
  9. <view slot="right" @tap="$utils.back()">
  10. <span style="color: #FFFFFF;">返回</span>
  11. </view>
  12. </uni-nav-bar>
  13. <view class="container">
  14. <view class="title">物料信息</view>
  15. <view class="info">
  16. <view class="row flex-start">
  17. <view class="label">
  18. 合同编码:
  19. </view>
  20. <view class="value">
  21. {{ option.purchaseBillNo }}
  22. </view>
  23. </view>
  24. <view class="row flex-start">
  25. <view class="label">
  26. 入库单号:
  27. </view>
  28. <view class="value">
  29. {{ option.stockInOutBillNo }}
  30. </view>
  31. </view>
  32. <view class="row flex-start">
  33. <view class="label">
  34. 物料编码:
  35. </view>
  36. <view class="value">
  37. {{ option.materialCode }}
  38. </view>
  39. </view>
  40. <view class="row flex-start">
  41. <view class="label">
  42. 物料名称:
  43. </view>
  44. <view class="value">
  45. {{ option.materialName }}
  46. </view>
  47. </view>
  48. <view class="row flex-start">
  49. <view class="label">
  50. 物料规格:
  51. </view>
  52. <view class="value">
  53. {{ option.spec }}
  54. </view>
  55. </view>
  56. <view class="row flex-start">
  57. <view class="label">
  58. 物料单位:
  59. </view>
  60. <view class="value">
  61. {{ option.unitName }}
  62. </view>
  63. </view>
  64. </view>
  65. <view class="title">请扫描RFID标签</view>
  66. <u-image height="300rpx" mode="aspectFit" src="../../../static/images/rfid.png"></u-image>
  67. <view class="title" v-if="isReading">扫描中...</view>
  68. <view class="title" v-if="!isReading">扫描成功</view>
  69. <view class="btn" v-if="!isReading">
  70. <u-input v-model="quantity" placeholder="请输入面料长度" type="number" :border="true" style="width: 100%;margin-bottom: 20rpx;"/>
  71. <u-button throttleTime="300" type="primary" style="width: 100%;margin-bottom: 20rpx;" @click="bind">绑定并继续</u-button>
  72. <u-button throttleTime="300" type="primary" style="width: 100%;" @click="$utils.back(3)">取消</u-button>
  73. </view>
  74. </view>
  75. </view>
  76. </template>
  77. <script>
  78. // #ifdef APP-PLUS
  79. // #endif
  80. export default {
  81. data() {
  82. return {
  83. option: {},
  84. quantity: '',
  85. isReading: true,
  86. rfidCode: ''
  87. };
  88. },
  89. methods: {
  90. bind() {
  91. if(!this.quantity) {
  92. return this.$msg.showToast('请输入面料长度!')
  93. }
  94. this.$http.AddRfidCodeStockTag({
  95. materialCode: this.option.materialCode,
  96. rfidCode: this.rfidCode,
  97. stockInOutBillNo: this.option.stockInOutBillNo,
  98. purchaseBillNo: this.option.purchaseBillNo,
  99. quantity: this.quantity
  100. }).then(res => {
  101. console.log(res)
  102. if(res.code === 0) {
  103. this.$msg.showToast(res.msg || '绑定成功!')
  104. setTimeout(()=> {
  105. this.$utils.back()
  106. }, 2000)
  107. }
  108. })
  109. },
  110. /* 扫码贴标 */
  111. scanPaste() {
  112. this.$utils.uniScanCode().then(res => {
  113. console.log(res)
  114. })
  115. }
  116. },
  117. onLoad(option) {
  118. this.option = this.$utils.code2Object(option.data)
  119. this.$pda.uhfScan().then(res => {
  120. console.log(res)
  121. this.isReading = false
  122. this.rfidCode = res[0].epc
  123. console.log(this.rfidCode)
  124. }).catch(() => {
  125. this.$msg.showToast('未识别到有效RFID标签!')
  126. setTimeout(() => {
  127. this.$utils.back()
  128. }, 1000)
  129. })
  130. },
  131. onUnload() {
  132. this.$pda.uhfStop()
  133. }
  134. }
  135. </script>
  136. <style lang="scss" scoped>
  137. .container-wrap {
  138. background-color: #FFFFFF;
  139. overflow: hidden;
  140. .container {
  141. padding: 0 40rpx;
  142. height: calc(100vh - var(--status-bar-height) - 44px);
  143. overflow: auto;
  144. .title {
  145. padding: 20rpx 0;
  146. font-size: 36rpx;
  147. font-weight: bold;
  148. text-align: center;
  149. }
  150. .info {
  151. .row {
  152. .label {
  153. width: 160rpx;
  154. }
  155. .value {
  156. flex: 1;
  157. overflow: hidden;
  158. word-wrap: break-word;
  159. }
  160. }
  161. }
  162. }
  163. }
  164. </style>