scanView.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. <template>
  2. <view class="mainBox">
  3. <uni-nav-bar
  4. fixed="true"
  5. statusBar="true"
  6. left-icon="back"
  7. title="扫码结果"
  8. @clickLeft="back"
  9. >
  10. </uni-nav-bar>
  11. <view class="scan-view">
  12. <view class="title">{{ infoData.assetName }}</view>
  13. <view class="code">({{ infoData.assetCode }})</view>
  14. <view class="content-wrapper">
  15. <view>
  16. <view class="label">货位</view>
  17. <view class="content">{{
  18. `${infoData.warehouseDetail.warehouseName || ''}-${
  19. infoData.warehouseDetail.areaName || ''
  20. }-${infoData.warehouseDetail.shelfCode || ''}-${
  21. infoData.warehouseDetail.cargoSpaceCode || ''
  22. }`
  23. }}</view>
  24. </view>
  25. <view>
  26. <view class="label">类型</view>
  27. <view class="content">{{ infoData.assetTypeDESC }}</view>
  28. </view>
  29. <view v-for="(item, index) in tableHeader" :key="index">
  30. <view class="label">{{ item.label }}</view>
  31. <view class="content">{{ infoData.information[item.prop] }}</view>
  32. </view>
  33. <view v-if="!infoData.information.isUnpack">
  34. <view class="label">最小单元</view>
  35. <view class="content"
  36. >{{ infoData.warehouseDetail.measurementUnit
  37. }}{{ infoData.information.measuringUnit
  38. }}{{
  39. infoData.information.isUnpack
  40. ? ''
  41. : `/${infoData.information.packingUnit}`
  42. }}</view
  43. >
  44. </view>
  45. <view>
  46. <view class="label">批次码</view>
  47. <view class="content">{{ infoData.warehouseDetail.batchNum }}</view>
  48. </view>
  49. <view>
  50. <view class="label">包装编码</view>
  51. <view class="content">{{ infoData.warehouseDetail.num }}</view>
  52. </view>
  53. <view>
  54. <view class="label">入库天数</view>
  55. <view class="content">{{ infoData.warehouseDetail.day }}</view>
  56. </view>
  57. <view>
  58. <view class="label">{{
  59. infoData.warehouseDetail.procurementTime ? '采购日期' : '生产日期'
  60. }}</view>
  61. <view class="content">{{
  62. infoData.warehouseDetail.manufactureTime ||
  63. infoData.warehouseDetail.procurementTime
  64. }}</view>
  65. </view>
  66. <view>
  67. <view class="label">过期日期</view>
  68. <view class="content">{{
  69. infoData.warehouseDetail.expirationTime
  70. }}</view>
  71. </view>
  72. </view>
  73. </view>
  74. <view class="footer">
  75. <u-button type="success" @click="confirm">确认添加</u-button>
  76. <u-button @click="cancel">取消</u-button>
  77. </view>
  78. </view>
  79. </template>
  80. <script>
  81. import { tableHeader } from '../common'
  82. export default {
  83. data () {
  84. return {
  85. emitName: '',
  86. infoData: {
  87. information: {},
  88. warehouseDetail: {}
  89. }
  90. }
  91. },
  92. onLoad ({ emitName, key }) {
  93. this.emitName = emitName
  94. this.key = key
  95. this.infoData = uni.getStorageSync(key) || {}
  96. console.log(key, this.infoData)
  97. this.infoData.warehouseDetail = this.infoData.warehouseDetail || {}
  98. this.infoData.information = this.infoData.information || {}
  99. },
  100. computed: {
  101. tableHeader () {
  102. return tableHeader(this.infoData.assetType)
  103. }
  104. },
  105. methods: {
  106. confirm () {
  107. if (this.emitName) {
  108. uni.$emit(this.emitName, this.infoData)
  109. }
  110. this.cancel()
  111. },
  112. cancel () {
  113. uni.navigateBack({
  114. delta: 1
  115. })
  116. }
  117. }
  118. }
  119. </script>
  120. <style lang="scss" scoped>
  121. .mainBox {
  122. background-color: $page-bg;
  123. }
  124. .title {
  125. padding-top: 30rpx;
  126. font-size: 40rpx;
  127. color: #333;
  128. font-weight: bold;
  129. text-align: center;
  130. }
  131. .code {
  132. font-weight: bold;
  133. text-align: center;
  134. color: #333;
  135. margin-bottom: 40rpx;
  136. }
  137. .scan-view {
  138. padding-bottom: 220rpx;
  139. .content-wrapper {
  140. > view {
  141. display: flex;
  142. align-items: center;
  143. margin-bottom: 20rpx;
  144. }
  145. .label {
  146. width: 40%;
  147. text-align: right;
  148. }
  149. .content {
  150. box-sizing: border-box;
  151. padding-left: 20rpx;
  152. flex: 1;
  153. text-align: left;
  154. }
  155. }
  156. }
  157. .footer {
  158. position: fixed;
  159. bottom: 0;
  160. width: 100vw;
  161. background: #fff;
  162. padding: 20rpx;
  163. box-sizing: border-box;
  164. .u-button {
  165. width: 100% !important;
  166. & + .u-button {
  167. margin-top: 10rpx;
  168. }
  169. }
  170. }
  171. </style>