inventoryDetail.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. <template>
  2. <!-- 库存明细 -->
  3. <view class="main-wrap" :class="{ info: isInfo }">
  4. <uni-search-bar class="uni-search-bar" @confirm="search" v-model="searchValue" @input="search" cancelButton="none"
  5. placeholder="搜索关键字">
  6. </uni-search-bar>
  7. <scroll-view scroll-y="true" class="scroll-Y" @scrolltolower="lower">
  8. <view class="order-list">
  9. <view class="item" v-for="(item, index) in listData" :key="index">
  10. <view class="title">
  11. <view class="s1">
  12. {{ item.onlyCode }}
  13. </view>
  14. </view>
  15. <view class="main">
  16. <view class="row">
  17. <view class="row-item">
  18. <text class="t1">批次号</text>
  19. <text class="t2">{{ item.batchNum }}</text>
  20. </view>
  21. <view class="row-item">
  22. <text class="t1">包装编码</text>
  23. <text class="t2">{{ item.num }}</text>
  24. </view>
  25. </view>
  26. <view class="row">
  27. <view class="row-item" v-if="!baseInfo.isUnpack">
  28. <text class="t1">最小包装单位</text>
  29. <text class="t2">{{ item.measurementUnit }}{{ item.unit }} /{{
  30. item.minPackUnit
  31. }}</text>
  32. </view>
  33. <view class="row-item">
  34. <text class="t1">入库天数</text>
  35. <text class="t2">{{ item.day }}</text>
  36. </view>
  37. </view>
  38. <view class="row">
  39. <view class="row-item">
  40. <text class="t1">{{
  41. item.manufactureTime ? '生产日期' : '采购日期'
  42. }}</text>
  43. <text class="t2">{{
  44. item.manufactureTime || item.procurementTime
  45. }}</text>
  46. </view>
  47. </view>
  48. <view class="row">
  49. <view class="row-item">
  50. <text class="t1">过期时间</text>
  51. <text class="t2">{{ item.expirationTime }}</text>
  52. </view>
  53. </view>
  54. <view class="row">
  55. <view class="row-item">
  56. <text class="t1">货位</text>
  57. <text class="t2">{{
  58. `${item.warehouseName}-${item.areaName}-${item.shelfCode}-${item.cargoSpaceCode}`
  59. }}</text>
  60. </view>
  61. </view>
  62. </view>
  63. </view>
  64. </view>
  65. <u-loadmore :status="status" style="margin-top: 20rpx" />
  66. </scroll-view>
  67. </view>
  68. </template>
  69. <script>
  70. let [page, size, isEnd] = [1, 20, true]
  71. import {
  72. post,
  73. get
  74. } from '@/utils/api.js'
  75. export default {
  76. props: ['batchNum', 'inventoryCode', 'isInfo', 'baseInfo'],
  77. data() {
  78. return {
  79. listData: [],
  80. status: 'loading',
  81. searchValue: ''
  82. }
  83. },
  84. created() {
  85. this.getData()
  86. },
  87. methods: {
  88. sortChange(type, e) {
  89. let order = e.order
  90. this.listData.sort((a, b) => {
  91. switch (order) {
  92. // 下降
  93. case 'descending':
  94. return a[type] - b[type]
  95. break
  96. // 上降
  97. case 'ascending':
  98. return b[type] - a[type]
  99. break
  100. // 正常
  101. case null:
  102. break
  103. default:
  104. break
  105. }
  106. })
  107. },
  108. // 触底
  109. lower() {
  110. console.log('lower')
  111. if (isEnd) {
  112. return
  113. }
  114. this.getMoreLists()
  115. },
  116. getData() {
  117. let par = {
  118. page,
  119. size,
  120. batchNum: this.batchNum,
  121. inventoryCode: this.inventoryCode
  122. }
  123. if (this.searchValue !== '') {
  124. par.key = this.searchValue
  125. }
  126. par = this.URLSearchParams(par)
  127. get(this.apiUrl + '/InventoryBook/select/inventoryDetails?' + par).then(
  128. res => {
  129. if (res.success) {
  130. this.listData = [...this.listData, ...res.data.records]
  131. let pages = res.data.pages
  132. console.log('lower', page < page)
  133. if (page < pages) {
  134. isEnd = false
  135. } else {
  136. isEnd = true
  137. this.status = 'nomore'
  138. }
  139. }
  140. }
  141. )
  142. },
  143. getMoreLists() {
  144. page++
  145. this.getData()
  146. },
  147. search() {
  148. this.page = 1
  149. this.listData = []
  150. this.status = 'loading'
  151. this.getData()
  152. }
  153. }
  154. }
  155. </script>
  156. <style lang="scss" scoped>
  157. .main-wrap {
  158. height: calc(100% - 176rpx);
  159. &.info {
  160. height: calc(100% - 236rpx);
  161. }
  162. }
  163. .scroll-Y {
  164. height: calc(100vh - 112rpx);
  165. //height:100%;
  166. }
  167. .order-list {
  168. .item {
  169. background-color: #fff;
  170. margin-bottom: 30rpx;
  171. margin-bottom: 30rpx;
  172. .title {
  173. display: flex;
  174. padding: 20rpx;
  175. justify-content: space-between;
  176. align-items: center;
  177. border-bottom: 1px solid #dedede;
  178. .s1 {
  179. color: #333333;
  180. font-size: 28rpx;
  181. font-weight: bold;
  182. }
  183. .s2 {
  184. font-size: 28rpx;
  185. font-weight: bold;
  186. color: #333333;
  187. }
  188. }
  189. .main {
  190. padding: 0 30rpx;
  191. .row {
  192. display: flex;
  193. align-items: center;
  194. justify-content: space-between;
  195. padding: 20rpx 0;
  196. border-bottom: 1px dashed #dedede;
  197. .row-item {
  198. .t1 {
  199. font-weight: bold;
  200. font-size: 28rpx;
  201. color: #333333;
  202. margin-right: 20rpx;
  203. }
  204. .t2 {
  205. font-size: 28rpx;
  206. color: #333333;
  207. }
  208. }
  209. }
  210. .ckmx {
  211. color: #70b603;
  212. font-size: 28rpx;
  213. font-weight: bold;
  214. padding: 20rpx;
  215. display: flex;
  216. justify-content: flex-end;
  217. }
  218. }
  219. }
  220. }
  221. </style>