123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242 |
- <template>
- <view class="pagesCons">
- <view class="tab-body">
- <view><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" style="height: 100%;width: 100%;overflow: hidden;" v-for="(tabs, index) in tabList" :key="index">
- <scroll-view scroll-y style="height: 100%;width: 100%;overflow: auto;" @scrolltolower="onreachBottom">
- <view class="check-order-list" v-for="(item, index) in list" :key="item.id">
- <view class="check-row" @click="viewRow(item)">
- <view class="createDate">{{ item.createDate }}</view>
- <view :class="clsStatus(item.status)">{{ item.status }}</view>
- </view>
- <view class="check-row" @click="viewRow(item)">
- <view>
- <view style="font-size: 30upx;margin-bottom: 10upx;">{{ item.name }}</view>
- <view style="color: #666666;">{{ item.storeName }}</view>
- </view>
- <view>
- <text v-if="item.status=='待处理'" style="color: #007AFF;">开始点检</text>
- <text v-if="item.status=='已完成'" style="color: #007AFF;">查看结果</text>
- <u-icon v-if="item.status!='已过期'" name="icon-xian-11" custom-prefix="xd-icon" size="28" color="#888888"></u-icon>
- </view>
- </view>
- </view>
- <u-empty :text="noDataText" img-width="120" v-if="list.length == 0 && status != 'loading'" mode="list"></u-empty>
- <view style="padding: 20upx;"><u-loadmore v-if="total > pageSize || status == 'loading'" :status="status" /></view>
- </scroll-view>
- </swiper-item>
- </swiper>
- </view>
- </view>
- </template>
- <script>
- import { getTaskList } from '@/api/task.js';
- import { getLookUpDatas, listLookUp } from '@/api/data';
- import { clzConfirm } from '@/libs/tools.js';
- export default {
- data() {
- return {
- status: 'loadmore',
- noDataText: '暂无数据',
- tabList: [
- {
- dispName: '待处理',
- code: 4
- },
- {
- dispName: '已完成',
- code: 3
- },
- {
- dispName: '已过期',
- code: 2
- },
- {
- dispName: '全部',
- code: 1
- }
- ],
- typeId:'1',
- current: 0,
- swiperCurrent: 0,
- pageNo: 1,
- pageSize: 10,
- list: [],
- total: 0
- };
- },
- onLoad() {
- this.getRow();
- },
- methods: {
- message(title) {
- uni.showToast({
- icon: 'none',
- title: title
- });
- },
- // tabs通知swiper切换
- tabsChange(index) {
- this.swiperCurrent = index;
- },
- swiperChange(event) {
- console.log(event.detail);
- this.list = [];
- 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;
- if (current != this.current) {
- this.$refs.uTabs.setFinishCurrent(current);
- this.swiperCurrent = current;
- this.current = current;
- this.getRow();
- }
- },
- // scroll-view到底部加载更多
- onreachBottom() {
- console.log(this.list.length, this.total);
- if (this.list.length < this.total) {
- this.pageNo += 1;
- this.getRow();
- } else {
- this.status = 'nomore';
- }
- },
- // 查询列表
- getRow(pageNo) {
- let _this = this;
- if (pageNo) {
- this.pageNo = pageNo;
- }
- this.typeId = this.tabList[this.swiperCurrent].code
- let params = {
- pageNo: this.pageNo,
- pageSize: this.pageSize,
- type: '点检任务', // 任务类型
- status: this.typeId=='1'?'':this.typeId // 任务状态
- };
- this.status = 'loading';
- getTaskList(params).then(res => {
- if (res.code == 200 || res.status == 204 || 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';
- });
- },
- //判断状态,待处理的跳转的开始点检页面,已完成的查看点检结果,已过期的不处理
- viewRow(item) {
- // 已完成的
- if(item.status == '已完成'){
- uni.navigateTo({
- url: '/pages/spotCheckCenter/spotCheckResult?id=' + item.id
- });
- }
- // 待处理,开始点检
- if(item.status == '待处理'){
-
- }
- },
- clsStatus(status){
- if(status == '待处理'){
- return 'dcl'
- }
- if(status == '已完成'){
- return 'ywc'
- }
- if(status == '已过期'){
- return 'ygq'
- }
- }
- }
- };
- </script>
- <style lang="scss" scoped>
- page {
- height: 100%;
- }
- .pagesCons {
- height: 100%;
- display: flex;
- flex-direction: column;
- .tab-body {
- .check-list {
- height: calc(100vh - 120px);
- }
- .check-order-list {
- background: #ffffff;
- padding: 10upx 20upx;
- margin: 25upx;
- border-radius: 6upx;
- box-shadow: 1px 1px 3px #eeeeee;
- .check-row {
- display: flex;
- align-items: center;
- padding: 20upx 10upx;
- font-size: 28upx;
- &:first-child {
- border-bottom: 1px dashed #f8f8f8;
- font-size: 26upx;
- }
- &:last-child {
- border-top: 1px dashed #f8f8f8;
- }
- > view {
- &:first-child {
- flex-grow: 1;
- }
- }
- .action {
- margin: 0 6rpx;
- padding: 0 20rpx;
- color: #fff;
- }
- .dcl {
- color: #f72525;
- }
- .ygq {
- color: #999;
- }
- .ywc {
- color: #10c71e;
- }
- .check-btns {
- width: '50%';
- display: flex;
- align-items: center;
- justify-content: flex-end;
- > view {
- margin-left: 35upx;
- font-size: 28upx;
- }
- }
- .u-tag {
- border-radius: 0;
- }
- .uni-icons {
- margin: 0 5upx;
- }
- }
- }
- }
- }
- </style>
|