back-in-store.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  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">请扫描要归还的物料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="row flex-start">
  24. <view class="label">
  25. 物料编码:
  26. </view>
  27. <view class="value">
  28. {{ data.materialCode }}
  29. </view>
  30. </view>
  31. <view class="row flex-start">
  32. <view class="label">
  33. 物料名称:
  34. </view>
  35. <view class="value">
  36. {{ data.materialName }}
  37. </view>
  38. </view>
  39. <view class="row flex-start">
  40. <view class="label">
  41. 物料规格:
  42. </view>
  43. <view class="value">
  44. {{ data.spec }}
  45. </view>
  46. </view>
  47. <view class="row flex-start">
  48. <view class="label">
  49. 物料单位:
  50. </view>
  51. <view class="value">
  52. {{ data.unitName }}
  53. </view>
  54. </view>
  55. <view class="row" style="align-items: center;justify-content: flex-start;">
  56. <view class="col" style="align-items: center;">
  57. <view class="label">剩余长度:</view>
  58. <view class="value" style="background-color: #FFFFFF;">
  59. <u-input v-model="quantity" type="number" :border="true" placeholder="请输入面料长度"/>
  60. </view>
  61. <span style="margin-left: 10rpx;">米</span>
  62. </view>
  63. </view>
  64. <view class="btn flex-column-center" v-if="!isReading">
  65. <view class="row">
  66. <u-button throttleTime="300" type="primary" style="width: 100%;" @click="cfm(0)">确定并继续</u-button>
  67. </view>
  68. <view class="row">
  69. <view class="col">
  70. <u-button throttleTime="300" type="error" style="width: 100%;" @click="cfm(1)">确定并结束</u-button>
  71. </view>
  72. </view>
  73. </view>
  74. <view class="row" style="justify-content: flex-end;margin-top: 20rpx;">
  75. <a href="#" @tap="toNewTag">标签损坏?</a>
  76. </view>
  77. </view>
  78. </view>
  79. </view>
  80. </template>
  81. <script>
  82. // #ifdef APP-PLUS
  83. // #endif
  84. export default {
  85. data() {
  86. return {
  87. quantity: '',
  88. isReading: true,
  89. rfidCode: '',
  90. data: {}
  91. };
  92. },
  93. methods: {
  94. toNewTag() {
  95. this.$utils.open('/pages/tag/tag')
  96. },
  97. getList() {
  98. this.$pda.uhfStop()
  99. this.$http.ScanRfidCodeStockTag({
  100. rfidCode: this.rfidCode,
  101. checkRfidType: 2,
  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. this.isReading = true
  110. this.scanRfid()
  111. }
  112. })
  113. },
  114. cfm(type) {
  115. if(!this.quantity) {
  116. return this.$msg.showToast('剩余长度不能小于0!')
  117. }
  118. this.$http.SaveStockInBack({
  119. stockTagId: this.data.stockTagId,
  120. quantity: this.quantity
  121. }).then(res => {
  122. if(res.code === 0) {
  123. this.$msg.showToast(res.msg, 'success')
  124. setTimeout(() => {
  125. if(type === 0) {
  126. this.quantity = ''
  127. this.data = {}
  128. this.isReading = true
  129. this.$pda.uhfScan().then(res => {
  130. console.log(res)
  131. this.isReading = false
  132. this.rfidCode = res[0].epc
  133. this.getList()
  134. console.log(this.rfidCode)
  135. }).catch(() => {
  136. this.$msg.showToast('未识别到有效RFID标签!')
  137. setTimeout(() => {
  138. this.$utils.back()
  139. }, 1000)
  140. })
  141. } else if(type === 1) {
  142. this.$utils.back()
  143. }
  144. }, 1000)
  145. }
  146. })
  147. },
  148. /* 扫码贴标 */
  149. scanPaste() {
  150. this.$utils.uniScanCode().then(res => {
  151. console.log(res)
  152. })
  153. },
  154. scanRfid() {
  155. this.$pda.uhfScan().then(res => {
  156. console.log(res)
  157. this.rfidCode = res[0].epc
  158. this.getList()
  159. console.log(this.rfidCode)
  160. }).catch(() => {
  161. this.$msg.showToast('未识别到有效RFID标签!')
  162. setTimeout(() => {
  163. this.$utils.back()
  164. }, 1000)
  165. })
  166. }
  167. },
  168. onLoad(option) {
  169. console.log(option)
  170. this.scanRfid()
  171. },
  172. onUnload() {
  173. this.$pda.uhfStop()
  174. }
  175. }
  176. </script>
  177. <style lang="scss" scoped>
  178. .container-wrap {
  179. overflow: hidden;
  180. .container {
  181. padding: 0 10rpx;
  182. height: calc(100vh - var(--status-bar-height) - 44px);
  183. overflow: auto;
  184. .title {
  185. padding: 20rpx 0;
  186. font-size: 36rpx;
  187. font-weight: bold;
  188. text-align: center;
  189. }
  190. .reading {
  191. padding: 40rpx 0;
  192. }
  193. .info {
  194. padding: 20rpx 60rpx;
  195. border-radius: 10rpx ;
  196. .row {
  197. align-items: flex-start;
  198. .label {
  199. font-size: 32rpx;
  200. width: 160rpx;
  201. }
  202. .value {
  203. font-size: 32rpx;
  204. flex: 1;
  205. overflow: hidden;
  206. word-wrap: break-word;
  207. }
  208. }
  209. }
  210. .btn {
  211. margin-top: 20rpx;
  212. height: 180rpx;
  213. .row {
  214. padding: 0;
  215. padding-bottom: 20rpx;
  216. width: 100%;
  217. }
  218. }
  219. }
  220. }
  221. </style>