inventoryDetail.vue 6.4 KB

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