store-in-scan.vue 4.5 KB

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