You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
199 lines
4.9 KiB
199 lines
4.9 KiB
<template>
|
|
<view>
|
|
<view class="tabs">
|
|
<u-tabs :list="tab_list" :is-scroll="false" :current="current" bg-color="#f6f6f6" active-color="#1833F2" @change="tabsChange"></u-tabs>
|
|
</view>
|
|
<swiper :style="{height: 'calc('+ windowHeight +'px - 110rpx)', width: '750rpx'}"
|
|
:current="current" @change="swiperChange">
|
|
<swiper-item v-for="(tabItem, tabIndex) in tab_list" :key="tabIndex">
|
|
<scroll-view class="lf-w-100 lf-h-100 lf-p-l-32 lf-p-r-32 lf-border-box"
|
|
:scroll-y="true" :refresher-enabled="true"
|
|
refresher-background="#f6f6f6"
|
|
@scrolltolower="scrolltolower"
|
|
:refresher-triggered="tabItem.isRefresher"
|
|
@refresherrefresh="onRefresherrefresh">
|
|
<view class="card" v-for="(item, index) in tabItem.list" :key="item.id" @click="$url('/pages/order/detail?q_sn='+ item.q_sn)">
|
|
<view class="lf-row-between item">
|
|
<view class="lf-color-gray">报价单号</view>
|
|
<view class="lf-color-black">{{ item.q_sn }}</view>
|
|
</view>
|
|
<view class="lf-row-between item">
|
|
<view class="lf-color-gray">批次号</view>
|
|
<view class="lf-color-black">{{ item.batch_sn }}</view>
|
|
</view>
|
|
<view class="lf-row-between item">
|
|
<view class="lf-color-gray">订单状态</view>
|
|
<view :class="stateClass(item.state)">{{ item.state }}</view>
|
|
</view>
|
|
<view class="lf-row-between item">
|
|
<view class="lf-color-gray">创建时间</view>
|
|
<view class="lf-color-black">{{ item.deadline_text }}</view>
|
|
</view>
|
|
</view>
|
|
<view class="loading-more">
|
|
<text v-if="tabItem.list.length" :class="{'loading-more-text': tabItem.loading_class}">{{ tabItem.loading_text }}</text>
|
|
<lf-nocontent v-else class="lf-m-t-50"></lf-nocontent>
|
|
</view>
|
|
</scroll-view>
|
|
</swiper-item>
|
|
</swiper>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
data(){
|
|
let _public = {
|
|
loading_class: true,
|
|
loading_text: '正在加载中...',
|
|
page: 1,
|
|
isPage: true,
|
|
isRefresher: false, // scroll-view下拉刷新状态,当前默认没有触发
|
|
}
|
|
return {
|
|
current: 0,
|
|
tab_list: [{
|
|
name: '全部',
|
|
state_name: '',
|
|
list: [],
|
|
..._public
|
|
},{
|
|
name: '审核中',
|
|
state_name: '待审核',
|
|
list: [],
|
|
..._public
|
|
},{
|
|
name: '已完成',
|
|
state_name: '已通过',
|
|
list: [],
|
|
..._public
|
|
}],
|
|
page_size: 10,
|
|
windowHeight: 0,
|
|
}
|
|
},
|
|
computed: {
|
|
stateClass(){
|
|
return function(val){
|
|
let class_name = {
|
|
'已通过': 'passed',
|
|
'待发起': 'wait',
|
|
'待审核': 'quoted-price',
|
|
'未通过': 'refuse'
|
|
}
|
|
return class_name[val];
|
|
}
|
|
}
|
|
},
|
|
onLoad(){
|
|
this.windowHeight = uni.getSystemInfoSync().windowHeight;
|
|
this.getData();
|
|
},
|
|
methods: {
|
|
getData(options){
|
|
let item = this.tab_list[this.current];
|
|
this.$http(this.API.API_SUPPLIER_QUOTATIONORDERLIST, {
|
|
state: this.current,
|
|
page: item.page,
|
|
page_size: this.page_size
|
|
}).then(res => {
|
|
let list = res.data.list || {};
|
|
if(options && options.refresh){
|
|
item.isRefresher = false;
|
|
}
|
|
item.isPage = this.$isRight(list.next_page_url); // 是否有下一页
|
|
if(!item.isPage){
|
|
item.loading_class = false;
|
|
item.loading_text = '已加载全部数据~'
|
|
}
|
|
if(item.page == 1){
|
|
item.list = list.data;
|
|
}else{
|
|
item.list.push(...list.data);
|
|
}
|
|
}).catch(err => {
|
|
if(options && options.refresh){
|
|
item.isRefresher = false;
|
|
}
|
|
})
|
|
},
|
|
tabsChange(current){
|
|
this.current = current;
|
|
if(this.tab_list[this.current].list.length <= 0){
|
|
this.getData();
|
|
}
|
|
},
|
|
swiperChange(event){
|
|
this.current = event.detail.current;
|
|
if(event.detail.source == '') return; // 如果是被动出发,没有事件类型则不做处理
|
|
if(this.tab_list[this.current].list.length <= 0){
|
|
this.getData();
|
|
}
|
|
},
|
|
// 滚动到底部
|
|
scrolltolower(){
|
|
let item = this.tab_list[this.current];
|
|
if(item.isPage){
|
|
item.page++;
|
|
this.getData();
|
|
}
|
|
},
|
|
// 下拉刷新
|
|
onRefresherrefresh(){
|
|
this.$u.throttle(() => {
|
|
let item = this.tab_list[this.current];
|
|
item.isRefresher = true;
|
|
item.page = 1;
|
|
item.isPage = true;
|
|
item.loading_class = true;
|
|
item.loading_text = '正在加载中...';
|
|
item.list = [];
|
|
this.getData({refresh: true});
|
|
}, 200);
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style>
|
|
page{
|
|
background-color: #f6f6f6;
|
|
}
|
|
</style>
|
|
<style lang="scss" scoped="scoped">
|
|
.card{
|
|
width: 100%;
|
|
height: max-content;
|
|
background-color: #FFFFFF;
|
|
border-radius: 20rpx;
|
|
padding: 0 20rpx;
|
|
box-sizing: border-box;
|
|
margin-bottom: 30rpx;
|
|
.item{
|
|
padding: 20rpx 0;
|
|
box-sizing: border-box;
|
|
width: 100%;
|
|
font-size: 28rpx;
|
|
&:last-child{
|
|
border-bottom: none;
|
|
}
|
|
}
|
|
}
|
|
|
|
// 已通过
|
|
.quoted-price{
|
|
color: #777777;
|
|
}
|
|
// 待发起
|
|
.wait{
|
|
color: #1833F2;
|
|
}
|
|
// 待审核
|
|
.passed{
|
|
color: #0BCE5F;
|
|
}
|
|
// 未通过
|
|
.refuse{
|
|
color: #FF0000;
|
|
}
|
|
</style>
|