shuntBackList.vue 5.8 KB

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