store-check.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  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. <view class="filter">
  15. <u-input
  16. v-model="materialCode"
  17. :searchIcon="true"
  18. :border="true"
  19. placeholder="请输入物料名称或编码"
  20. @search="search"
  21. />
  22. </view>
  23. <view class="content">
  24. <view>
  25. <u-tabs-swiper ref="uTabs" :list="list" :current="current" @change="tabsChange" :is-scroll="false"
  26. swiperWidth="750"></u-tabs-swiper>
  27. </view>
  28. <swiper :current="swiperCurrent" @transition="transition" @animationfinish="animationfinish" style="height: calc(100% - 80rpx);">
  29. <swiper-item class="swiper-item" v-for="(item, index) in list" :key="index">
  30. <scroll-view scroll-y style="height: 100%;width: 100%;" @scrolltolower="loadMore(index)">
  31. <view class="list">
  32. <view class="item" v-for="(item, index) in (index === 0? data1 : data2)" :key="index">
  33. <view class="row">
  34. <view class="col">
  35. <view class="label">物料编码:</view>
  36. <view class="value">{{ item.materialCode }}</view>
  37. </view>
  38. <view class="col">
  39. <view class="label">物料类型:</view>
  40. <view class="value">{{ item.materialType }}</view>
  41. </view>
  42. </view>
  43. <view class="row">
  44. <view class="col">
  45. <view class="label">库存数量:</view>
  46. <view class="value">{{ item.oldQuantity }}</view>
  47. </view>
  48. <view class="col">
  49. <view class="label">所在仓库:</view>
  50. <view class="value">{{ item.saveHouse }}</view>
  51. </view>
  52. </view>
  53. <view class="row">
  54. <view class="col">
  55. <view class="label">申购数量:</view>
  56. <view class="value">{{ item.quantity }}</view>
  57. </view>
  58. <view class="col">
  59. <view class="label">放置区域:</view>
  60. <view class="value">{{ item.saveArea }}</view>
  61. </view>
  62. </view>
  63. </view>
  64. </view>
  65. <u-loadmore :status="index === 0? loadStatus1: loadStatus2" @loadmore="loadMore(index)" />
  66. </scroll-view>
  67. </swiper-item>
  68. </swiper>
  69. </view>
  70. <view class="btn">
  71. <my-fixed-button :customClick="true" @click="scan" text="扫码盘点"></my-fixed-button>
  72. </view>
  73. </view>
  74. </view>
  75. </template>
  76. <script>
  77. // #ifdef APP-PLUS
  78. // #endif
  79. export default {
  80. data() {
  81. return {
  82. pageIndex1: 1,
  83. pageIndex2: 1,
  84. materialCode: '',
  85. data1: [],
  86. data2: [],
  87. loadStatus1: 'loadmore',
  88. loadStatus2: 'loadmore',
  89. form: {},
  90. isReading: false,
  91. // 因为内部的滑动机制限制,请将tabs组件和swiper组件的current用不同变量赋值
  92. current: 0, // tabs组件的current值,表示当前活动的tab选项
  93. swiperCurrent: 0, // swiper组件的current值,表示当前那个swiper-item是活动的
  94. list: [{
  95. name: '待盘点'
  96. }, {
  97. name: '已盘点'
  98. }]
  99. };
  100. },
  101. methods: {
  102. search() {
  103. console.log(this.swiperCurrent)
  104. if(this.swiperCurrent === 0) {
  105. this.pageIndex1 = 1
  106. this.data1 = []
  107. this.getList(0)
  108. } else {
  109. this.pageIndex2 = 1
  110. this.data2 = []
  111. this.getList(1)
  112. }
  113. },
  114. // tabs通知swiper切换
  115. tabsChange(index) {
  116. this.swiperCurrent = index;
  117. },
  118. // swiper-item左右移动,通知tabs的滑块跟随移动
  119. transition(e) {
  120. let dx = e.detail.dx;
  121. this.$refs.uTabs.setDx(dx);
  122. },
  123. // 由于swiper的内部机制问题,快速切换swiper不会触发dx的连续变化,需要在结束时重置状态
  124. // swiper滑动结束,分别设置tabs和swiper的状态
  125. animationfinish(e) {
  126. let current = e.detail.current;
  127. this.$refs.uTabs.setFinishCurrent(current);
  128. this.swiperCurrent = current;
  129. this.current = current;
  130. },
  131. // scroll-view到底部加载更多
  132. loadMore(index) {
  133. if(index === 0) {
  134. this.pageIndex1++
  135. } else {
  136. this.pageIndex2++
  137. }
  138. this.getList(index)
  139. },
  140. /* 扫码盘点 */
  141. scan() {
  142. this.$utils.open('/pages/store-manage/store-check/store-check-scan')
  143. },
  144. getList(type) {
  145. this.$http.PeopleStorageCheckList({
  146. materialCode: this.materialCode,
  147. pageIndex: this['pageIndex' + (type + 1)],
  148. pageSize: this.pageSize,
  149. type
  150. }).then(res => {
  151. console.log(res)
  152. console.log(this.materialCode)
  153. if(res.code === 0) {
  154. console.log(type)
  155. this['data' + (type + 1)].push(...res.result.list)
  156. if(res.result.isLastPage) {
  157. this['loadStatus' + (type + 1)] = 'nomore'
  158. }else {
  159. this['loadStatus' + (type + 1)] = 'loadmore'
  160. }
  161. }
  162. })
  163. }
  164. },
  165. onLoad() {
  166. this.getList(0)
  167. this.getList(1)
  168. uni.$on('getlist', () => {
  169. this.getList(0)
  170. this.getList(1)
  171. })
  172. },
  173. onUnload() {
  174. uni.$off('getlist')
  175. }
  176. }
  177. </script>
  178. <style lang="scss" scoped>
  179. .container-wrap {
  180. overflow: hidden;
  181. .container {
  182. height: calc(100vh - var(--status-bar-height) - 44px);
  183. overflow: auto;
  184. .filter {
  185. padding: 10rpx;
  186. height: 90rpx;
  187. background-color: #FFFFFF;
  188. }
  189. .content {
  190. padding: 10rpx;
  191. height: calc(100% - 170rpx);
  192. overflow: auto;
  193. .list {
  194. margin-bottom: 10rpx;
  195. .item {
  196. padding: 20rpx;
  197. margin-bottom: 10rpx;
  198. background-color: #FFFFFF;
  199. border: 1rpx solid rgba(215, 215, 215, 1);
  200. border-radius: 10rpx;
  201. &:last-child {
  202. margin-bottom: 0;
  203. }
  204. .row {
  205. &.border {
  206. border-bottom: 1px solid rgba(215, 215, 215, 1);
  207. }
  208. }
  209. }
  210. }
  211. }
  212. .btn {
  213. height: 80rpx;
  214. width: 100%;
  215. position: fixed;
  216. bottom: 0;
  217. left: 0;
  218. }
  219. }
  220. }
  221. </style>