freight-web/src/pagesReceive/payList.vue

199 lines
4.4 KiB
Vue

<template>
<view class="search-box">
<view class="search">
<u-search
placeholder="请输入供应商名称"
v-model="keyword"
bgColor="#fff"
clearable
:showAction="false"
placeholderColor="#C1C1C1"
@search="handleSearch()"
@clear="handleSearch()"
></u-search>
</view>
<view @click="handleCalendar()">
<up-icon name="calendar" size="26"></up-icon>
</view>
</view>
<view class="fullTime" v-if="filterState.startTime">
{{ filterState.startTime }} - {{ filterState.endTime }}
</view>
<view class="card-box">
<page-view
@loadList="
(v) => {
getList(v);
}
"
:noMoreData="pageList.noMoreData"
:list="pageList.list"
:height="40"
:isLoading="pageList.isLoading"
>
<block v-for="(item, index) in pageList.list" :key="index">
<view class="c-layout">
<Detail :currentOrder="item" @refresh="handleSearch"/>
</view>
<u-gap
height="10"
bgColor="#f8f8f8"
v-if="index < pageList.list.length - 1"
></u-gap>
</block>
</page-view>
</view>
<!-- 时间弹框 -->
<TimeDialog
ref="timeDialog"
:show="filterState.showTime"
@handleDialog="(v:boolean) => {filterState.showTime = false}"
@changeTime="changeTime"
/>
</template>
<script setup lang="ts">
import { ReceiveApi } from "@/services/index";
import { onLoad } from "@dcloudio/uni-app";
import PageView from "@/components/PageView/index.vue";
import { ScaleStatus } from "@/utils/enum";
import TimeDialog from "@/components/Dialog/TimeDialog.vue";
import Detail from "./components/detail.vue";
import {formatStartAndEndTime} from "@/utils";
// 筛选条件
const filterState = reactive({
showTime: false,
startTime: "",
endTime: "",
});
const handleCalendar = () => {
filterState.showTime = true;
};
const changeTime = (obj: any) => {
filterState.startTime = obj.startTime;
filterState.endTime = obj.endTime;
resetPageList();
getList();
};
// scaleStatus
const pageList: PageResult<Order> = reactive({
isLoading: false,
noMoreData: false,
total: 0,
list: [],
pageNum: 1,
pageSize: 100,
});
const keyword = ref("");
const resetPageList = () => {
pageList.noMoreData = false;
pageList.total = 0;
pageList.list = [];
pageList.pageNum = 1;
pageList.pageSize = 100;
};
const handleSearch = () => {
resetPageList();
getList();
};
const getList = (v?: boolean) => {
if (v) {
if (Math.ceil(pageList.total / pageList.pageSize) > pageList.pageNum) {
pageList.pageNum++;
} else {
pageList.noMoreData = true;
return;
}
}
pageList.isLoading = true;
ReceiveApi.getOrderPage({
pageSize: pageList.pageSize,
pageNumber: pageList.pageNum,
scaleStatus: ScaleStatus.Paid,
userName: keyword.value,
startTime: formatStartAndEndTime(filterState.startTime, 's'),
endTime: formatStartAndEndTime(filterState.endTime, 'e'),
}).then((res: any) => {
if (res.code === 200) {
pageList.isLoading = false;
pageList.list = pageList.list.concat(
res.data.list.map((item: any) => {
return { ...item, isChecked: false };
})
);
pageList.total = (res.data as any).total;
}
});
};
onMounted(() => {
getList();
});
onLoad((option) => {});
</script>
<style lang="scss" scoped>
.search-box {
display: flex;
align-items: center;
justify-content: space-between;
padding: 0rpx 22rpx;
margin-top: 30rpx;
view + view {
margin-left: 22rpx;
}
}
.search {
box-shadow: 0rpx 3rpx 16rpx 5rpx rgba(0, 0, 0, 0.2);
border-radius: 28rpx;
background: rgba(255, 255, 255, 0.86);
margin: 0px auto;
font-weight: 400;
font-size: 26rpx;
color: #c1c1c1;
flex: 1;
> view {
line-height: 60rpx;
text-align: center;
display: flex;
justify-content: center;
}
text {
margin-left: 15rpx;
}
}
.fullTime {
font-size: 26rpx;
padding: 22rpx 22rpx 0rpx 22rpx;
color: #606266;
}
.card-box {
.c-tab {
font-family: Source Han Sans CN;
font-weight: 400;
font-size: 26rpx;
color: #999999;
line-height: 41rpx;
display: flex;
align-items: center;
justify-content: space-around;
border-bottom: 1rpx solid rgba(233, 233, 233, 0.76);
text {
padding: 16rpx;
}
.active {
color: $u-primary;
border-bottom: 5rpx solid $u-primary;
border-radius: 5rpx;
}
}
.c-layout {
}
}
</style>