store-out-scan.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  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. timer: null,
  86. isActive: true,
  87. };
  88. },
  89. methods: {
  90. cfm() {
  91. uni.$emit('scan-list', {
  92. ...this.data,
  93. takeQty: this.data.quantity,
  94. rfidCode: this.rfidCode
  95. })
  96. this.$utils.back()
  97. },
  98. getList() {
  99. this.$http.ScanRfidCodeStockTag({
  100. rfidCode: this.rfidCode,
  101. checkRfidType: 1,
  102. }).then(res => {
  103. console.log(res)
  104. if(res.code === 0) {
  105. this.isReading = false
  106. this.data = res.result
  107. } else {
  108. this.$msg.showToast(res.msg)
  109. if(this.isActive) {
  110. this.scanRfid()
  111. }
  112. }
  113. })
  114. },
  115. scanRfid() {
  116. this.$pda.uhfScan().then(res => {
  117. console.log(res)
  118. this.rfidCode = res[0].epc
  119. this.getList()
  120. console.log(this.rfidCode)
  121. }).catch(() => {
  122. this.$msg.showToast('未识别到有效RFID标签!')
  123. this.timer = setTimeout(() => {
  124. this.$utils.back()
  125. }, 1000)
  126. })
  127. }
  128. },
  129. onLoad(option) {
  130. this.isActive = true
  131. this.scanRfid()
  132. },
  133. onUnload() {
  134. this.isActive = false
  135. clearTimeout(this.timer)
  136. this.$pda.uhfStop()
  137. }
  138. }
  139. </script>
  140. <style lang="scss" scoped>
  141. .container-wrap {
  142. overflow: hidden;
  143. .container {
  144. padding: 0 60rpx;
  145. padding-bottom: 80rpx;
  146. height: calc(100vh - var(--status-bar-height) - 44px);
  147. overflow: auto;
  148. .title {
  149. padding: 20rpx 0;
  150. font-size: 36rpx;
  151. font-weight: bold;
  152. text-align: center;
  153. }
  154. .reading {
  155. padding: 40rpx 0;
  156. }
  157. .info {
  158. padding: 20rpx 60rpx;
  159. border-radius: 10rpx ;
  160. background-color: #FFFFFF;
  161. .row {
  162. align-items: flex-start;
  163. .label {
  164. font-size: 32rpx;
  165. width: 160rpx;
  166. }
  167. .value {
  168. font-size: 32rpx;
  169. flex: 1;
  170. overflow: hidden;
  171. word-wrap: break-word;
  172. }
  173. }
  174. }
  175. .btn {
  176. margin-top: 20rpx;
  177. .row {
  178. padding: 0;
  179. padding-bottom: 10rpx;
  180. width: 100%;
  181. &:last-child {
  182. padding-bottom: 0;
  183. }
  184. }
  185. }
  186. }
  187. }
  188. </style>