OfficeApp/subpkg/contract/contract.vue
weipengfei a3a990c241 优化
2023-08-01 16:43:13 +08:00

256 lines
6.5 KiB
Vue

<template>
<view class="">
<!-- <view class="tabs">
<view class="left">
<view class="item" :class="changeType==0?'active':''" @click="changeType=0">合同列表</view>
<view class="item" :class="changeType==1?'active':''" @click="changeType=1">已签订合同</view>
</view>
<view class="right">
<text>新增</text>
</view>
</view> -->
<view class="contract_list">
<view class="item" v-for="(item,index) in list" :key="item.id">
<view class="top">
<image src="../../static/img/contract/pdf.png" style="height: 140rpx; width: 140rpx;"></image>
<view class="text">
<view class="name">
<view class="title">
<text v-if="item.company">{{item.company.company_name}}</text>
</view>
</view>
<view class="date">
<!-- <text class="time">2023-04-27 2024-04-28 </text> -->
<view class="number">合同编号:{{item.contract_no}}</view>
<view class="number">合同类型:{{item.company.contract_type_name}}</view>
<text class="time">修改时间:{{item.update_time}}</text>
</view>
</view>
</view>
<u-line color="#999999FF"></u-line>
<view class="bottom">
<view class="left">已签订</view>
<!-- <view class="left red">已到期</view> -->
<button class="right" @click="naviTo('/subpkg/contractDetail/contractDetail?id='+item.id)">详情</button>
</view>
</view>
</view>
<u-loadmore :status="loadConfig.status" :loading-text="loadConfig.loadingText" :loadmore-text="loadConfig.loadmoreText" :nomore-text="loadConfig.nomoreText" />
</view>
</template>
<script>
import { contractList } from "@/api/contract.js"
export default {
data() {
return {
changeType: 0,
list: [],
loadConfig:{
page: 1,
limit: 15,
loadingText: '努力加载中',
loadmoreText: '轻轻上拉',
nomoreText: '我也是有底线的~~',
status: 'loadmore'
},
}
},
onLoad() {},
onShow() {
this.initLoadConfig()
this.initContractList()
},
onReady() {
uni.setNavigationBarColor({
frontColor: '#ffffff',
backgroundColor: '#3175f9'
})
},
methods: {
naviTo(url) {
url ?
uni.navigateTo({
url: url
}) : Toast('暂未开放')
},
initLoadConfig(){
this.loadConfig.page = 1;
this.loadConfig.status = "loadmore";
this.list = [];
},
async initContractList() {
try{
if(this.loadConfig.status=="nomore")return;
this.loadConfig.status="loading"
let res = await contractList({
page: this.loadConfig.page,
limit: this.loadConfig.limit
})
this.loadConfig.status="loadmore"
if(res.data.data.length<this.loadConfig.limit){
this.loadConfig.status="nomore"
}else {
this.loadConfig.page++;
}
this.list = [...this.list, ...res.data?.data]
}catch(e){
this.initLoadConfig();
this.loadConfig.status = "nomore"
}
}
},
onPullDownRefresh() {
uni.stopPullDownRefresh()
}
}
</script>
<style lang="scss">
.tabs {
height: 112rpx;
background-color: #fff;
display: flex;
justify-content: space-between;
align-items: center;
padding: 0 28rpx;
.left {
display: flex;
.item {
margin-right: 52.5rpx;
width: 175rpx;
height: 53rpx;
line-height: 53rpx;
text-align: center;
background-color: #F3F4F8FF;
border-radius: 35rpx 35rpx 35rpx 35rpx;
font-size: 28rpx;
font-weight: 400;
color: #999999;
}
.active {
background-color: #3274F9FF;
color: #FFFFFFFF;
}
}
.right {
font-size: 28rpx;
font-weight: 400;
color: #999999;
line-height: 0rpx;
-webkit-background-clip: text;
}
}
.contract_list {
display: flex;
flex-direction: column;
justify-content: space-between;
align-items: center;
padding: 28rpx;
.item {
width: 694rpx;
height: 263rpx;
padding: 28rpx;
margin-bottom: 28rpx;
background: #FFFFFF;
border-radius: 14rpx 14rpx 14rpx 14rpx;
display: flex;
flex-direction: column;
justify-content: space-between;
.top {
display: flex;
margin-bottom: 10rpx;
image {
width: 87.6rpx;
height: 87.6rpx;
margin-right: 28rpx;
}
.text {
flex: 1;
display: flex;
flex-direction: column;
justify-content: space-between;
.name {
display: flex;
justify-content: space-between;
align-items: flex-end;
.title {
font-size: 32rpx;
font-weight: 400;
color: #333333;
margin-right: 17.5rpx;
white-space: nowrap;
/* 禁止换行 */
overflow: hidden;
/* 溢出隐藏 */
text-overflow: ellipsis;
/* 使用省略号代表被截断的文本 */
// width: 100rpx;
flex: 1;
/* 设置元素宽度,根据需要进行调整 */
}
.number {
font-size: 25rpx;
font-weight: 400;
color: #3274F9;
}
}
.date {
font-size: 25rpx;
font-weight: 400;
color: #F9AA32;
.time {
color: #CCCCCCFF;
margin-right: 10rpx;
}
}
}
}
.bottom {
display: flex;
justify-content: space-between;
margin-top: 10rpx;
.left {
font-size: 28rpx;
font-weight: 400;
color: #34A853;
}
.red {
color: #F02828FF;
}
.right {
width: 158rpx;
height: 53rpx;
display: flex;
justify-content: center;
align-items: center;
background: #FFFFFF;
border-radius: 26rpx 26rpx 26rpx 26rpx;
opacity: 1;
border: 2rpx solid #3274F9;
font-size: 28rpx;
font-weight: 400;
color: #3274F9;
}
}
}
}
</style>