day-check.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  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="over" 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. over () {
  110. this.$utils.back()
  111. // this.$http.SubmitEveryDayCheckFlow({
  112. // recordDetailId: this.data2.map(item => item.id)
  113. // }).then(res => {
  114. // if (res.code === 0) {
  115. // this.$msg.showToast(res.msg || '操作成功!')
  116. // setTimeout(() => {
  117. // this.$utils.back()
  118. // }, 1000)
  119. // }
  120. // })
  121. },
  122. search() {
  123. console.log(this.swiperCurrent)
  124. if(this.swiperCurrent === 0) {
  125. this.pageIndex1 = 1
  126. this.data1 = []
  127. this.getList(0)
  128. } else {
  129. this.pageIndex2 = 1
  130. this.data2 = []
  131. this.getList(1)
  132. }
  133. },
  134. // tabs通知swiper切换
  135. tabsChange(index) {
  136. this.swiperCurrent = index;
  137. },
  138. // swiper-item左右移动,通知tabs的滑块跟随移动
  139. transition(e) {
  140. let dx = e.detail.dx;
  141. this.$refs.uTabs.setDx(dx);
  142. },
  143. // 由于swiper的内部机制问题,快速切换swiper不会触发dx的连续变化,需要在结束时重置状态
  144. // swiper滑动结束,分别设置tabs和swiper的状态
  145. animationfinish(e) {
  146. let current = e.detail.current;
  147. this.$refs.uTabs.setFinishCurrent(current);
  148. this.swiperCurrent = current;
  149. this.current = current;
  150. },
  151. // scroll-view到底部加载更多
  152. loadMore(index) {
  153. if(index === 0) {
  154. this.pageIndex1++
  155. } else {
  156. this.pageIndex2++
  157. }
  158. this.getList(index)
  159. },
  160. /* 扫码盘点 */
  161. scan(item, index) {
  162. this.currentIndex = index
  163. if(!item.isCompleteCheck) {
  164. this.$utils.open(`/pages/store-manage/day-check/day-check-scan?data=${ JSON.stringify(item) }`)
  165. }
  166. },
  167. getList(type) {
  168. this.$http.EveryDayStorageCheckList({
  169. keyWord: this.materialCode,
  170. pageIndex: this['pageIndex' + (type + 1)],
  171. pageSize: this.pageSize,
  172. isCompleteCheck: !!type
  173. }).then(res => {
  174. if(res.code === 0) {
  175. this['data' + (type + 1)].push(...res.result.list)
  176. if(res.result.isLastPage) {
  177. this['loadStatus' + (type + 1)] = 'nomore'
  178. }else {
  179. this['loadStatus' + (type + 1)] = 'loadmore'
  180. }
  181. }
  182. })
  183. }
  184. },
  185. onShow() {
  186. this.data1 = []
  187. this.data2 = []
  188. this.pageIndex1 = 1
  189. this.pageIndex2 = 1
  190. this.getList(0)
  191. this.getList(1)
  192. },
  193. onLoad() {
  194. // this.getList(0)
  195. // this.getList(1)
  196. // uni.$on('getlist', (res) => {
  197. // this.data1 = []
  198. // this.data2 = []
  199. // this.pageIndex1 = 1
  200. // this.pageIndex2 = 1
  201. // this.getList(0)
  202. // this.getList(1)
  203. // })
  204. },
  205. onUnload() {
  206. uni.$off('getlist')
  207. }
  208. }
  209. </script>
  210. <style lang="scss" scoped>
  211. .container-wrap {
  212. overflow: hidden;
  213. .container {
  214. height: calc(100vh - var(--status-bar-height) - 44px);
  215. overflow: auto;
  216. .filter {
  217. padding: 10rpx;
  218. height: 90rpx;
  219. background-color: #FFFFFF;
  220. }
  221. .content {
  222. padding: 10rpx;
  223. height: calc(100% - 90rpx);
  224. overflow: auto;
  225. .list {
  226. margin-bottom: 10rpx;
  227. .item {
  228. padding: 20rpx;
  229. margin-bottom: 10rpx;
  230. background-color: #FFFFFF;
  231. border: 1rpx solid rgba(215, 215, 215, 1);
  232. border-radius: 10rpx;
  233. &:last-child {
  234. margin-bottom: 0;
  235. }
  236. .row {
  237. &.border {
  238. border-bottom: 1px solid rgba(215, 215, 215, 1);
  239. }
  240. }
  241. }
  242. }
  243. }
  244. .btn {
  245. height: 80rpx;
  246. width: 100%;
  247. position: fixed;
  248. bottom: 0;
  249. left: 0;
  250. }
  251. }
  252. }
  253. </style>