| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162 |
- <template>
- <view class="notice-page">
- <scroll-view scroll-y class="notice-scroll" @scrolltolower="loadMore" refresher-enabled
- :refresher-triggered="isRefreshing" @refresherrefresh="onRefresh">
- <block v-if="noticeList.length > 0">
- <!-- 时间分割线 -->
- <view class="notice-bar" v-for="(item, index) in noticeList" :key="index">
- <view class="time-divider">{{ item.time }}</view>
- <!-- 消息列表 -->
- <view class="notice-item flex-d">
- <!-- 通知图标 -->
- <view class="flex-a notice-header">
- <image src="../static/notice.png" style="width:44rpx;height:44rpx"></image>
- <view class="notice-title">通知</view>
- </view>
- <!-- 通知内容 -->
- <view class="notice-content">
- <view class="notice-text">
- <text>{{item.content}}</text>
- <text>\n您也可以随时在</text>
- <text class="notice-link" @click="goToOrder">【我的订单】</text>
- <text>中查看订单状态</text>
- </view>
- </view>
- </view>
- </view>
- </block>
- <!-- 空状态 -->
- <u-empty v-else mode="message" text="暂无消息"></u-empty>
- </scroll-view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- noticeList: [{
- id: 1,
- type: 'notice',
- content: '亲,您的订单已经收到,感谢您对我们的支持,我们将尽快为您发出',
- time: '2024-10-16 23:32:28'
- }],
- page: 1,
- pageSize: 10,
- isRefreshing: false,
- hasMore: true
- }
- },
- onLoad() {
- this.loadNotices()
- },
- methods: {
- // 加载消息列表
- loadNotices() {
- // 模拟数据
- const mockData = [{
- id: 1,
- type: 'notice',
- content: '亲,您的订单已经收到,感谢您对我们的支持,我们将尽快为您发出',
- time: '2024-10-16 23:32:28'
- }]
- // 实际开发时替换为接口调用
- setTimeout(() => {
- this.noticeList = [...this.noticeList, ...mockData]
- this.hasMore = mockData.length === this.pageSize
- this.isRefreshing = false
- }, 500)
- },
- // 下拉刷新
- onRefresh() {
- this.isRefreshing = true
- this.page = 1
- this.noticeList = []
- this.loadNotices()
- },
- // 加载更多
- loadMore() {
- if (!this.hasMore) return
- this.page++
- this.loadNotices()
- },
- // 跳转到订单页面
- goToOrder() {
- uni.navigateTo({
- url: '/pages-mine/pages/order-page'
- })
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .notice-page {
- min-height: 100vh;
- background-color: #F5F5F5;
- padding: 20rpx 0;
- .notice-scroll {
- height: 100vh;
- }
- .time-divider {
- text-align: center;
- font-family: PingFang SC;
- font-weight: 500;
- font-size: 26rpx;
- color: #333333;
- padding: 20rpx 0;
- }
- .notice-item {
- margin: 0 20rpx;
- padding: 30rpx;
- background: #FFFFFF;
- border-radius: 12rpx;
- .notice-icon {
- margin-right: 20rpx;
- padding-top: 6rpx;
- }
- .notice-header {
- border-bottom: 1px solid #f8f8f8;
- padding-bottom: 14rpx;
- }
- .notice-title {
- font-size: 30rpx;
- font-weight: bold;
- color: #333333;
- padding-left: 10rpx;
- font-family: PingFang SC;
- }
- .notice-content {
- padding-top: 14rpx;
- flex: 1;
- .notice-text {
- font-size: 28rpx;
- color: #666666;
- line-height: 1.6;
- .notice-link {
- color: #38C148;
- padding: 0 4rpx;
- }
- }
- }
- }
- }
- </style>
|