replenishmentList.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  1. <template>
  2. <view class="pagesCons">
  3. <view class="utabs">
  4. <u-tabs-swiper ref="uTabs" :list="tabList" name="dispName" :current="current" @change="tabsChange" :is-scroll="false" swiperWidth="750"></u-tabs-swiper>
  5. </view>
  6. <swiper class="check-list" :current="swiperCurrent" @transition="transition" @change="swiperChange" @animationfinish="animationfinish">
  7. <swiper-item class="swiper-item" v-for="(tabs, index) in tabList" :key="index">
  8. <scroll-view scroll-y class="scroll-view" @scrolltolower="onreachBottom">
  9. <view
  10. class="check-order-list"
  11. v-if="index==current"
  12. v-for="(item,sindex) in list"
  13. :key="item.id+'-'+sindex"
  14. @click="viewRow(item)" >
  15. <view class="check-row">
  16. <view>{{item.shelfName}}</view>
  17. <view>
  18. <text :style="{color: item.billState=='FINISH'?$config('successColor'):item.billState=='CANCEL'?$config('infoColor'):$config('errorColor')}">{{item.billStateDictValue}}</text>
  19. </view>
  20. </view>
  21. <view class="check-col">
  22. <view>补货单号:{{item.replenishBillNo}}</view>
  23. <view>应发数量:{{item.totalQty}}</view>
  24. <view>{{item.createDate}}</view>
  25. </view>
  26. </view>
  27. <u-empty :src="`/static/${$config('themePath')}/def_no_data@3x.png`" icon-size="240" :text="noDataText" img-width="120" v-if="list.length==0 && status!='loading'" mode="list"></u-empty>
  28. <view v-if="index==current" style="padding: 20upx;">
  29. <u-loadmore :load-text="$config('loadText')" v-if="total>pageSize || status=='loading'" :status="status" />
  30. </view>
  31. </scroll-view>
  32. </swiper-item>
  33. </swiper>
  34. </view>
  35. </template>
  36. <script>
  37. import { shelfReplenishList } from '@/api/shelfReplenish'
  38. export default {
  39. components: {},
  40. data() {
  41. return {
  42. status: 'loadmore',
  43. noDataText: '暂无数据',
  44. tabList: [
  45. {
  46. dispName: '全部',
  47. typeId: 0,
  48. status: ''
  49. },
  50. {
  51. dispName: '待确认',
  52. typeId: 1,
  53. status: '',
  54. count: 12
  55. },
  56. {
  57. dispName: '待出库',
  58. typeId: 2,
  59. status: ''
  60. },
  61. {
  62. dispName: '待签收',
  63. typeId: 3,
  64. status: ''
  65. },
  66. {
  67. dispName: '已完成',
  68. typeId: 4,
  69. status: ''
  70. },
  71. {
  72. dispName: '已取消',
  73. typeId: 5,
  74. status: ''
  75. },
  76. ],
  77. current: 0,
  78. swiperCurrent: 0,
  79. pageNo: 1,
  80. pageSize: 6,
  81. list: [],
  82. total: 0,
  83. action:'swiperChange', // 操作类型,上划分页,或左右滑动
  84. }
  85. },
  86. onLoad() {
  87. // 监听整改完成后刷新事件
  88. uni.$on('refreshBL',this.getRow)
  89. this.getRow(1)
  90. },
  91. onUnload() {
  92. uni.$off('refreshBL',this.getRow)
  93. },
  94. methods:{
  95. // tabs通知swiper切换
  96. tabsChange(index) {
  97. this.swiperCurrent = index
  98. },
  99. swiperChange(event){
  100. this.action = 'swiperChange'
  101. this.status = 'loading'
  102. },
  103. // swiper-item左右移动,通知tabs的滑块跟随移动
  104. transition(e) {
  105. let dx = e.detail.dx
  106. this.$refs.uTabs.setDx(dx)
  107. },
  108. // 由于swiper的内部机制问题,快速切换swiper不会触发dx的连续变化,需要在结束时重置状态
  109. // swiper滑动结束,分别设置tabs和swiper的状态
  110. animationfinish(e) {
  111. let current = e.detail.current
  112. let isCurtab = this.current == current
  113. if(this.status!="nomore"){
  114. let loadData = this.action == 'swiperChange' ? !isCurtab : isCurtab
  115. if(loadData){
  116. this.$refs.uTabs.setFinishCurrent(current)
  117. this.swiperCurrent = current
  118. this.current = current
  119. this.resetPage()
  120. }
  121. }
  122. },
  123. // scroll-view到底部加载更多
  124. onreachBottom() {
  125. this.action = 'onreachBottom'
  126. if(this.list.length < this.total){
  127. this.resetPage()
  128. }else{
  129. this.status = "nomore"
  130. }
  131. },
  132. // 查询列表
  133. getRow (pageNo) {
  134. if (pageNo) {
  135. this.pageNo = pageNo
  136. }
  137. let params = {
  138. pageNo: this.pageNo,
  139. pageSize: this.pageSize,
  140. billState: this.tabList[this.current].status,
  141. }
  142. this.status = "loading"
  143. shelfReplenishList(params).then(res => {
  144. if (res.status == 200) {
  145. if(this.pageNo>1){
  146. this.list = this.list.concat(res.data.list || [])
  147. }else{
  148. this.list = res.data.list || []
  149. }
  150. this.total = res.data.count || 0
  151. } else {
  152. this.list = []
  153. this.total = 0
  154. this.noDataText = res.message
  155. }
  156. this.status = "loadmore"
  157. })
  158. },
  159. resetPage(){
  160. this.status = 'loading';
  161. // 上划分页
  162. if(this.action == 'onreachBottom'){
  163. this.pageNo += 1
  164. this.getRow()
  165. }
  166. // 左右切换tab
  167. if(this.action == 'swiperChange'){
  168. this.list = [];
  169. this.getRow(1);
  170. }
  171. },
  172. // 详细页
  173. viewRow(item){
  174. if(item.billState=='WAIT_CONFIRM'){ // 待确认
  175. uni.navigateTo({ url: "/pages/replenishmentManage/confirm?sn="+item.replenishBillSn })
  176. }else if(item.billState=='WAIT_OUT_STOCK'){ // 待出库
  177. uni.navigateTo({ url: "/pages/replenishmentManage/replenishmentList?sn="+item.replenishBillSn })
  178. }else if(item.billState=='WAIT_CHECK'){ // 待签收
  179. uni.navigateTo({ url: "/pages/replenishmentManage/signWarehousing?sn="+item.replenishBillSn })
  180. }else if(item.billState=='FINISH'){ // 已完成
  181. uni.navigateTo({ url: "/pages/replenishmentManage/detail?sn="+item.replenishBillSn+"&type=success" })
  182. }else if(item.billState=='CANCEL'){ // 已取消
  183. uni.navigateTo({ url: "/pages/replenishmentManage/detail?sn="+item.replenishBillSn+"&type=cancel" })
  184. }
  185. }
  186. }
  187. }
  188. </script>
  189. <style lang="scss">
  190. page {
  191. height: 100%;
  192. }
  193. .pagesCons{
  194. width: 100%;
  195. height: 100%;
  196. display: flex;
  197. flex-direction: column;
  198. .text-right {
  199. text-align: right;
  200. }
  201. .utabs{
  202. border-bottom: 1px solid #eee;
  203. }
  204. .check-list{
  205. flex: 1;
  206. .swiper-item{
  207. width: 100%;
  208. height: 100%;
  209. overflow: hidden;
  210. .scroll-view {
  211. width: 100%;
  212. height: 100%;
  213. overflow: auto;
  214. }
  215. }
  216. }
  217. // 列表样式
  218. .check-order-list{
  219. background: #ffffff;
  220. padding: 25upx 35upx;
  221. margin: 25upx;
  222. border-radius: 25upx;
  223. box-shadow: 1px 1px 3px #EEEEEE;
  224. .check-row{
  225. display: flex;
  226. justify-content: space-between;
  227. margin-bottom: 10rpx;
  228. >view{
  229. &:first-child{
  230. color: #222;
  231. font-size: 32rpx;
  232. width: 80%;
  233. }
  234. &:last-child{
  235. font-size: 28rpx;
  236. margin-top: 5rpx;
  237. }
  238. }
  239. }
  240. .check-col{
  241. > view{
  242. padding: 2rpx 0;
  243. color: #707070;
  244. font-size: 26rpx;
  245. }
  246. }
  247. }
  248. }
  249. </style>