fourPayProject/51uni/homePages/notice/notice.vue

205 lines
3.6 KiB
Vue
Raw Normal View History

2025-03-31 10:23:28 +08:00
<template>
<view class="content">
<view class="container">
<headers :titles="titles"><uni-icons type="arrow-left" color="#fff" size="22px"></uni-icons></headers>
<view class="tab-box">
<view class="w-box" v-for="(item,index) in tablist" :key="index" @click="gettabindex(index)">
<view class="w-title" :class="{'t_' : tabindex == index }">{{item}}</view>
<view class="gang" :class="{'b_' : tabindex == index }"></view>
</view>
</view>
<view class="box_" v-for="(item,index) in dataList" :key="index" @click="goDetail(item.id)">
<view class="qiu" v-if="item.hasRead !=1&&item.hasRead !=9&&item.hasRead!=15"></view>
<view class="title_">{{item.title}}</view>
<view class="h-size">{{item.content}}</view>
<view class="h-size">{{item.createDate}}</view>
</view>
<u-loadmore :status="status" v-if="show == true" />
</view>
</view>
</template>
<script>
import headers from '../../components/header/headers.vue'
import request from '../../utils/request.js'
export default {
data() {
return {
titles: "通知",
tabindex: 0,
tablist: [
"收款信息",
"系统公告"
],
dataList: [],
page: 1,
limit: 10,
totalPage: 0,
type: 2,
show: false,
status: 'loading',
}
},
onShow() {
this.dataList = []
this.page = 1
this.getDataList()
},
onPullDownRefresh() {
this.page = 1,
this.limit = 10,
this.totalPage = 0,
this.dataList = [],
this.getDataList();
uni.stopPullDownRefresh()
},
onReachBottom() {
// 触底加载
if (this.page < this.totalPage) {
this.page++
this.getDataList()
} else {
uni.showToast({
title: '没有下一页数据',
icon: 'none'
})
}
},
components: {
headers
},
methods: {
getDataList() {
uni.showLoading({
title: '加载中'
});
request({
url: 'app/uaMer/notificationList',
method: 'post',
data: {
limit: this.limit,
page: this.page,
type: this.type
},
}).then(res => {
if (res.list) {
if (this.page != 1) {
this.dataList = this.dataList.concat(res.list)
} else {
this.dataList = res.list
}
this.totalPage = res.pages
}
}).finally(rrr => {
uni.hideLoading()
})
},
gettabindex(index) {
if (index == 0) {
this.type = 2
} else {
this.type = 1
}
this.tabindex = index
this.page = 1
this.getDataList()
},
goDetail(id) {
uni.navigateTo({
url: '/homePages/notice/Detail?id=' + id
})
},
goback() {
uni.navigateBack()
}
}
}
</script>
<style scoped lang="scss">
.content {
background: #f4f5f6;
height: 100vh;
}
.container {
width: 100%;
background: #f4f5f6;
box-sizing: border-box;
padding-top: 88px;
}
.tab-box {
width: 100%;
background: #fff;
height: 50px;
display: flex;
align-items: center;
justify-content: space-between;
}
.gang {
width: 20px;
height: 4px;
// background: #E4612E;
margin: 0 auto;
}
.t_ {
color: #E4612E !important;
}
.b_ {
background: #E4612E !important;
}
.w-box {
width: 50%;
height: 100%;
}
.w-title {
color: #9a9a9a;
margin: 10px auto;
text-align: center;
}
.box_ {
width: 95%;
box-sizing: border-box;
padding: 15px;
background: #fff;
margin: 10px auto;
position: relative;
border-radius: 20rpx;
}
.title_ {
font-size: 30rpx;
font-weight: bold;
margin-bottom: 5px;
}
.h-size {
font-size: 25rpx;
color: #9c9c9c;
margin-bottom: 5px;
}
.qiu {
width: 8px;
height: 8px;
border-radius: 50%;
background: #0099fa;
position: absolute;
right: 15px;
top: 15px;
}
</style>