123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261 |
- <template>
- <view class="pagesCons">
- <view class="utabs">
- <u-tabs-swiper ref="uTabs" :list="tabList" name="dispName" :current="current" @change="tabsChange" :is-scroll="false" swiperWidth="750"></u-tabs-swiper>
- </view>
- <swiper class="check-list" :current="swiperCurrent" @transition="transition" @change="swiperChange" @animationfinish="animationfinish">
- <swiper-item class="swiper-item" v-for="(tabs, index) in tabList" :key="index">
- <scroll-view scroll-y class="scroll-view" @scrolltolower="onreachBottom">
- <view
- class="check-order-list"
- v-if="index==current"
- v-for="(item,sindex) in 20"
- :key="item.id+'-'+sindex"
- @click="viewRow(item)" >
- <view class="check-row">
- <view>西安车领主常青二路数字货架</view>
- <view>
- <text :style="{color:$config('errorColor')}">待退库</text>
- </view>
- </view>
- <view class="check-col">
- <view>补货单号:BH202101010001</view>
- <view>应发数量:33</view>
- <view>2021-08-20 15:40:57</view>
- </view>
- </view>
- <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>
- <view v-if="index==current" style="padding: 20upx;">
- <u-loadmore :load-text="$config('loadText')" v-if="total>pageSize || status=='loading'" :status="status" />
- </view>
- </scroll-view>
- </swiper-item>
- </swiper>
- </view>
- </template>
- <script>
- import { shelfReplenishList } from '@/api/shelfReplenish.js'
- export default {
- components: {
- },
- data() {
- return {
- status: 'loadmore',
- noDataText: '暂无数据',
- tabList: [
- {
- dispName: '全部',
- typeId: 0,
- status: ''
- },
- {
- dispName: '待确认',
- typeId: 1,
- status: '',
- count: 12
- },
- {
- dispName: '待出库',
- typeId: 2,
- status: ''
- },
- {
- dispName: '待签收',
- typeId: 3,
- status: ''
- },
- {
- dispName: '已完成',
- typeId: 4,
- status: ''
- },
- {
- dispName: '已取消',
- typeId: 5,
- status: ''
- },
- ],
- current: 0,
- swiperCurrent: 0,
- pageNo: 1,
- pageSize: 6,
- list: [],
- total: 0,
- action:'swiperChange', // 操作类型,上划分页,或左右滑动
- }
- },
- onLoad() {
- // 监听整改完成后刷新事件
- uni.$on('refreshBL',this.getRow)
- this.getRow(1)
- },
- onUnload() {
- uni.$off('refreshBL',this.getRow)
- },
- methods:{
- // tabs通知swiper切换
- tabsChange(index) {
- this.swiperCurrent = index;
- },
- swiperChange(event){
- this.action = 'swiperChange'
- this.status = 'loading'
- },
- // swiper-item左右移动,通知tabs的滑块跟随移动
- transition(e) {
- let dx = e.detail.dx;
- this.$refs.uTabs.setDx(dx);
- },
- // 由于swiper的内部机制问题,快速切换swiper不会触发dx的连续变化,需要在结束时重置状态
- // swiper滑动结束,分别设置tabs和swiper的状态
- animationfinish(e) {
- let current = e.detail.current;
- let isCurtab = this.current == current
- if(this.status!="nomore"){
- let loadData = this.action == 'swiperChange' ? !isCurtab : isCurtab;
- if(loadData){
- this.$refs.uTabs.setFinishCurrent(current);
- this.swiperCurrent = current;
- this.current = current;
- this.resetPage();
- }
- }
- },
- // scroll-view到底部加载更多
- onreachBottom() {
- this.action = 'onreachBottom'
- if(this.list.length < this.total){
- this.resetPage()
- }else{
- this.status = "nomore"
- }
- },
- // 查询列表
- getRow (pageNo) {
- if (pageNo) {
- this.pageNo = pageNo
- }
- let params = {
- pageNo: this.pageNo,
- pageSize: this.pageSize,
- billState: this.tabList[this.current].status,
- }
- this.status = "loading"
- shelfReplenishList(params).then(res => {
- if (res.status == 200) {
- if(this.pageNo>1){
- this.list = this.list.concat(res.data.list || [])
- }else{
- this.list = res.data.list || []
- }
- this.total = res.data.count || 0
- } else {
- this.list = []
- this.total = 0
- this.noDataText = res.message
- }
- this.status = "loadmore"
- })
- },
- resetPage(){
- this.status = 'loading';
- // 上划分页
- if(this.action == 'onreachBottom'){
- this.pageNo += 1
- this.getRow()
- }
- // 左右切换tab
- if(this.action == 'swiperChange'){
- this.list = [];
- this.getRow(1);
- }
- },
- // 详细页
- viewRow(item){
- // 已完成的
- uni.navigateTo({
- url: "/pages/toDoList/backlogDetail?id="+item.id
- })
- },
- // 状态颜色处理
- clsStatus(status){
- if(status == 'CHECK_PENDING'){
- return 'dsh'
- }
- if(status == 'PENDING'){
- return 'dzg'
- }
- if(status == 'FINISHED'){
- return 'ywc'
- }
- if(status == 'EXPIRED'){
- return 'ygq'
- }
- }
- }
- }
- </script>
- <style lang="scss">
- page {
- height: 100%;
- }
- .pagesCons{
- width: 100%;
- height: 100%;
- display: flex;
- flex-direction: column;
- .text-right {
- text-align: right;
- }
- .utabs{
- border-bottom: 1px solid #eee;
- }
- .check-list{
- flex: 1;
- .swiper-item{
- width: 100%;
- height: 100%;
- overflow: hidden;
- .scroll-view {
- width: 100%;
- height: 100%;
- overflow: auto;
- }
- }
- }
-
- // 列表样式
- .check-order-list{
- background: #ffffff;
- padding: 25upx 35upx;
- margin: 25upx;
- border-radius: 25upx;
- box-shadow: 1px 1px 3px #EEEEEE;
- .check-row{
- display: flex;
- justify-content: space-between;
- margin-bottom: 10rpx;
- >view{
- &:first-child{
- color: #222;
- font-size: 32rpx;
- width: 80%;
- }
- &:last-child{
- font-size: 28rpx;
- margin-top: 5rpx;
- }
- }
- }
- .check-col{
- > view{
- padding: 2rpx 0;
- color: #707070;
- font-size: 26rpx;
- }
- }
- }
- }
- </style>
|