store-in-scan.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. <!-- 手动入库扫描添加 -->
  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. <!-- 扫描rfid -->
  15. <view class="reading">
  16. <view class="title">请扫描要入库的<br/>物料RFID标签</view>
  17. <u-image height="300rpx" mode="aspectFit" src="../../../static/images/rfid.png"></u-image>
  18. <view class="title" v-if="isReading">扫描中...</view>
  19. <view class="title" v-if="!isReading">扫描结果</view>
  20. </view>
  21. <!-- 扫描到RFID标签时,打开质检结果 -->
  22. <view v-if="!isReading" class="info">
  23. <view class="title">物料信息</view>
  24. <view class="row flex-start">
  25. <view class="label">
  26. 物料标签:
  27. </view>
  28. <view class="value">
  29. {{ data.rfidCode }}
  30. </view>
  31. </view>
  32. <view class="row flex-start">
  33. <view class="label">
  34. 物料编码:
  35. </view>
  36. <view class="value">
  37. {{ data.materialCode }}
  38. </view>
  39. </view>
  40. <view class="row flex-start">
  41. <view class="label">
  42. 物料名称:
  43. </view>
  44. <view class="value">
  45. {{ data.materialName }}
  46. </view>
  47. </view>
  48. <view class="row flex-start">
  49. <view class="label">
  50. 物料规格:
  51. </view>
  52. <view class="value">
  53. {{ data.spec }}
  54. </view>
  55. </view>
  56. <view class="row flex-start">
  57. <view class="label">
  58. 物料数量:
  59. </view>
  60. <view class="value">
  61. {{ data.quantity }}
  62. </view>
  63. </view>
  64. </view>
  65. <view class="btn" v-if="!isReading">
  66. <view class="row">
  67. <u-button throttleTime="300" type="primary" style="width: 100%;" @click="cfm">确定</u-button>
  68. </view>
  69. <view class="row">
  70. <u-button throttleTime="300" type="error" style="width: 100%;" @click="$utils.back()">取消</u-button>
  71. </view>
  72. </view>
  73. </view>
  74. </view>
  75. </template>
  76. <script>
  77. // #ifdef APP-PLUS
  78. // #endif
  79. export default {
  80. data() {
  81. return {
  82. rfidCode: '',
  83. isReading: true,
  84. data: {},
  85. isActive: true,
  86. };
  87. },
  88. methods: {
  89. cfm() {
  90. uni.$emit('scan-list', {
  91. ...this.data,
  92. takeQty: this.data.quantity,
  93. rfidCode: this.rfidCode
  94. })
  95. this.$utils.back()
  96. },
  97. getList() {
  98. this.$http.ScanRfidCodeStockTag({
  99. rfidCode: this.rfidCode,
  100. checkRfidType: 2,
  101. }).then(res => {
  102. console.log(res)
  103. if(res.code === 0) {
  104. this.isReading = false
  105. this.data = res.result
  106. } else {
  107. this.$msg.showToast(res.msg)
  108. if(this.isActive) {
  109. this.scanRfid()
  110. }
  111. }
  112. })
  113. },
  114. scanRfid() {
  115. this.$pda.uhfScan().then(res => {
  116. console.log(res)
  117. this.rfidCode = res[0].epc
  118. this.getList()
  119. console.log(this.rfidCode)
  120. }).catch(() => {
  121. this.$msg.showToast('未识别到有效RFID标签!')
  122. setTimeout(() => {
  123. this.$utils.back()
  124. }, 1000)
  125. })
  126. }
  127. },
  128. onLoad(option) {
  129. this.isActive = true
  130. this.scanRfid()
  131. },
  132. onUnload() {
  133. this.isActive = false
  134. this.$pda.uhfStop()
  135. }
  136. }
  137. </script>
  138. <style lang="scss" scoped>
  139. .container-wrap {
  140. overflow: hidden;
  141. .container {
  142. padding: 0 60rpx;
  143. padding-bottom: 80rpx;
  144. height: calc(100vh - var(--status-bar-height) - 44px);
  145. overflow: auto;
  146. .title {
  147. padding: 20rpx 0;
  148. font-size: 36rpx;
  149. font-weight: bold;
  150. text-align: center;
  151. }
  152. .reading {
  153. padding: 40rpx 0;
  154. }
  155. .info {
  156. padding: 20rpx 60rpx;
  157. border-radius: 10rpx ;
  158. background-color: #FFFFFF;
  159. .row {
  160. align-items: flex-start;
  161. .label {
  162. font-size: 32rpx;
  163. width: 160rpx;
  164. }
  165. .value {
  166. font-size: 32rpx;
  167. flex: 1;
  168. overflow: hidden;
  169. word-wrap: break-word;
  170. }
  171. }
  172. }
  173. .btn {
  174. margin-top: 20rpx;
  175. .row {
  176. padding: 0;
  177. padding-bottom: 10rpx;
  178. width: 100%;
  179. &:last-child {
  180. padding-bottom: 0;
  181. }
  182. }
  183. }
  184. }
  185. }
  186. </style>