inventoryDetail.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  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="inputChange" cancelButton="none" placeholder="搜索关键字"></uni-search-bar>
  5. <scroll-view scroll-y="true" class="scroll-Y" @scrolltolower="lower">
  6. <view class="order-list">
  7. <view class="item" v-for="(item, index) in listData" :key="index">
  8. <view class="title">
  9. <view class="s1">
  10. {{ item.onlyCode }}
  11. </view>
  12. </view>
  13. <view class="main">
  14. <view class="row">
  15. <view class="row-item">
  16. <text class="t1">批次号</text>
  17. <text class="t2">{{ item.batchNo }}</text>
  18. </view>
  19. <view class="row-item">
  20. <text class="t1">包装编码</text>
  21. <text class="t2">{{ item.packageNo }}</text>
  22. </view>
  23. </view>
  24. <view class="row">
  25. <view class="row-item">
  26. <text class="t1">包装数量</text>
  27. <text class="t2">{{ item.packingQuantity }}{{ item.packingUnit }}</text>
  28. </view>
  29. <view class="row-item">
  30. <text class="t1">存货周期</text>
  31. <text class="t2">{{ item.inventoryCycle }}天</text>
  32. </view>
  33. </view>
  34. <view class="row">
  35. <view class="row-item">
  36. <text class="t1">{{ item.productionDate ? '生产日期' : '采购日期' }}</text>
  37. <text class="t2">{{ item.productionDate || item.purchaseDate }}</text>
  38. </view>
  39. </view>
  40. <view class="row">
  41. <view class="row-item">
  42. <text class="t1">仓库</text>
  43. <text class="t2">{{ item.warehouseName }}</text>
  44. </view>
  45. </view>
  46. </view>
  47. </view>
  48. </view>
  49. <u-loadmore fontSize="32" iconSize="36" :status="status" style="margin-top: 20rpx" />
  50. </scroll-view>
  51. </view>
  52. </template>
  53. <script>
  54. import { getPackingList } from '@/api/warehouseManagement'
  55. export default {
  56. props: ['categoryCode', 'isInfo', 'dimension'],
  57. data() {
  58. return {
  59. page: 1,
  60. size: 20,
  61. isEnd: true,
  62. listData: [],
  63. status: 'loading',
  64. searchValue: '',
  65. timerId: ''
  66. }
  67. },
  68. created() {
  69. this.getData()
  70. },
  71. methods: {
  72. sortChange(type, e) {
  73. let order = e.order
  74. this.listData.sort((a, b) => {
  75. switch (order) {
  76. // 下降
  77. case 'descending':
  78. return a[type] - b[type]
  79. break
  80. // 上降
  81. case 'ascending':
  82. return b[type] - a[type]
  83. break
  84. // 正常
  85. case null:
  86. break
  87. default:
  88. break
  89. }
  90. })
  91. },
  92. // 触底
  93. lower() {
  94. console.log('lower')
  95. if (this.isEnd) {
  96. return
  97. }
  98. this.getMoreLists()
  99. },
  100. inputChange() {
  101. // 清除timer对应的延时器
  102. clearTimeout(this.timerId)
  103. // 重新启动一个延时器,并把timerId赋值给this.timer
  104. this.timerId = setTimeout(() => {
  105. // 如果500毫秒内,没有触发新的输入事件,则为搜索关键词赋值
  106. this.search()
  107. }, 500)
  108. },
  109. getData() {
  110. let par = {
  111. pageNum: this.page,
  112. size: this.size,
  113. categoryCode: this.categoryCode
  114. }
  115. if (this.searchValue !== '') {
  116. par.keyWord = this.searchValue
  117. }
  118. // par = this.URLSearchParams(par)
  119. getPackingList(par).then(res => {
  120. console.log('res----', res)
  121. this.listData = [...this.listData, ...res.list]
  122. let pages = res.count
  123. if (this.listData.length < pages) {
  124. this.isEnd = false
  125. this.status = 'loading'
  126. } else {
  127. this.isEnd = true
  128. this.status = 'nomore'
  129. }
  130. })
  131. },
  132. getMoreLists() {
  133. this.page++
  134. this.getData()
  135. },
  136. search() {
  137. this.page = 1
  138. this.listData = []
  139. this.status = 'loading'
  140. this.getData()
  141. }
  142. }
  143. }
  144. </script>
  145. <style lang="scss" scoped>
  146. .main-wrap {
  147. height: calc(100% - 176rpx);
  148. &.info {
  149. height: calc(100% - 236rpx);
  150. }
  151. }
  152. .scroll-Y {
  153. height: calc(100vh - 322rpx);
  154. }
  155. .order-list {
  156. .item {
  157. background-color: #fff;
  158. margin-bottom: 30rpx;
  159. margin-bottom: 30rpx;
  160. .title {
  161. display: flex;
  162. padding: 20rpx;
  163. justify-content: space-between;
  164. align-items: center;
  165. border-bottom: 1px solid #dedede;
  166. .s1 {
  167. color: #333333;
  168. font-size: 28rpx;
  169. font-weight: bold;
  170. }
  171. .s2 {
  172. font-size: 28rpx;
  173. font-weight: bold;
  174. color: #333333;
  175. }
  176. }
  177. .main {
  178. padding: 0 30rpx;
  179. .row {
  180. display: flex;
  181. align-items: center;
  182. justify-content: space-between;
  183. padding: 20rpx 0;
  184. border-bottom: 1px dashed #dedede;
  185. .row-item {
  186. .t1 {
  187. font-weight: bold;
  188. font-size: 28rpx;
  189. color: #333333;
  190. margin-right: 20rpx;
  191. }
  192. .t2 {
  193. font-size: 28rpx;
  194. color: #333333;
  195. }
  196. }
  197. }
  198. .ckmx {
  199. color: #70b603;
  200. font-size: 28rpx;
  201. font-weight: bold;
  202. padding: 20rpx;
  203. display: flex;
  204. justify-content: flex-end;
  205. }
  206. }
  207. }
  208. }
  209. </style>