shuntBackList.vue 5.8 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"
  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. },
  58. {
  59. dispName: '已完成',
  60. typeId: 2,
  61. status: ''
  62. },
  63. {
  64. dispName: '已取消',
  65. typeId: 3,
  66. status: ''
  67. },
  68. ],
  69. current: 0,
  70. swiperCurrent: 0,
  71. pageNo: 1,
  72. pageSize: 6,
  73. list: [],
  74. total: 0,
  75. action:'swiperChange', // 操作类型,上划分页,或左右滑动
  76. }
  77. },
  78. onLoad() {
  79. // 监听整改完成后刷新事件
  80. uni.$on('refreshBL',this.getRow)
  81. // this.getRow(1)
  82. },
  83. onUnload() {
  84. uni.$off('refreshBL',this.getRow)
  85. },
  86. methods:{
  87. // tabs通知swiper切换
  88. tabsChange(index) {
  89. this.swiperCurrent = index;
  90. },
  91. swiperChange(event){
  92. this.action = 'swiperChange'
  93. this.status = 'loading'
  94. },
  95. // swiper-item左右移动,通知tabs的滑块跟随移动
  96. transition(e) {
  97. let dx = e.detail.dx;
  98. this.$refs.uTabs.setDx(dx);
  99. },
  100. // 由于swiper的内部机制问题,快速切换swiper不会触发dx的连续变化,需要在结束时重置状态
  101. // swiper滑动结束,分别设置tabs和swiper的状态
  102. animationfinish(e) {
  103. let current = e.detail.current;
  104. let isCurtab = this.current == current
  105. if(this.status!="nomore"){
  106. let loadData = this.action == 'swiperChange' ? !isCurtab : isCurtab;
  107. if(loadData){
  108. this.$refs.uTabs.setFinishCurrent(current);
  109. this.swiperCurrent = current;
  110. this.current = current;
  111. this.resetPage();
  112. }
  113. }
  114. },
  115. // scroll-view到底部加载更多
  116. onreachBottom() {
  117. this.action = 'onreachBottom'
  118. if(this.list.length < this.total){
  119. this.resetPage()
  120. }else{
  121. this.status = "nomore"
  122. }
  123. },
  124. // 查询列表
  125. getRow (pageNo) {
  126. if (pageNo) {
  127. this.pageNo = pageNo
  128. }
  129. let params = {
  130. pageNo: this.pageNo,
  131. pageSize: this.pageSize,
  132. billState: this.tabList[this.current].status,
  133. }
  134. this.status = "loading"
  135. getBackLogList(params).then(res => {
  136. if (res.status == 200) {
  137. if(this.pageNo>1){
  138. this.list = this.list.concat(res.data.list || [])
  139. }else{
  140. this.list = res.data.list || []
  141. }
  142. this.total = res.data.count || 0
  143. } else {
  144. this.list = []
  145. this.total = 0
  146. this.noDataText = res.message
  147. }
  148. this.status = "loadmore"
  149. })
  150. },
  151. resetPage(){
  152. this.status = 'loading';
  153. // 上划分页
  154. if(this.action == 'onreachBottom'){
  155. this.pageNo += 1
  156. this.getRow()
  157. }
  158. // 左右切换tab
  159. if(this.action == 'swiperChange'){
  160. this.list = [];
  161. this.getRow(1);
  162. }
  163. },
  164. // 详细页
  165. viewRow(item){
  166. // 已完成的
  167. uni.navigateTo({
  168. url: "/pages/toDoList/backlogDetail?id="+item.id
  169. })
  170. },
  171. // 状态颜色处理
  172. clsStatus(status){
  173. if(status == 'CHECK_PENDING'){
  174. return 'dsh'
  175. }
  176. if(status == 'PENDING'){
  177. return 'dzg'
  178. }
  179. if(status == 'FINISHED'){
  180. return 'ywc'
  181. }
  182. if(status == 'EXPIRED'){
  183. return 'ygq'
  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>