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