notice.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. <template>
  2. <view class="notice-page">
  3. <page-scroll
  4. url="/token/message/mymsg"
  5. :immediate="true"
  6. @updateList="handleUpdateList"
  7. ref="pageRef"
  8. slotEmpty
  9. emptyText="暂无消息"
  10. >
  11. <!-- 时间分割线 -->
  12. <view class="notice-bar" v-for="(item, index) in noticeList" :key="index">
  13. <view class="time-divider">{{ item.createTime }}</view>
  14. <!-- 消息列表 -->
  15. <view class="notice-item flex-d">
  16. <!-- 通知图标 -->
  17. <view class="flex-a notice-header">
  18. <image src="../static/notice.png" style="width: 44rpx; height: 44rpx"></image>
  19. <view class="notice-title">通知</view>
  20. </view>
  21. <!-- 通知内容 -->
  22. <view class="notice-content">
  23. <view class="notice-text">
  24. <text>{{ item.messageInfo }}</text>
  25. <!-- <text>\n您也可以随时在</text>
  26. <text class="notice-link" @click="goToOrder">【我的订单】</text>
  27. <text>中查看订单状态</text> -->
  28. </view>
  29. </view>
  30. </view>
  31. </view>
  32. </page-scroll>
  33. </view>
  34. </template>
  35. <script>
  36. import pageScroll from "@/components/pageScroll/index.vue";
  37. export default {
  38. components: {
  39. pageScroll,
  40. },
  41. data() {
  42. return {
  43. noticeList: [],
  44. };
  45. },
  46. // #ifdef MP-ALIPAY
  47. onPullDownRefresh() {
  48. this.$refs.pageRef?.loadData(true)
  49. },
  50. // #endif
  51. methods: {
  52. // 处理列表更新
  53. handleUpdateList(list = []) {
  54. this.noticeList = list;
  55. },
  56. // 格式化时间
  57. formatTime(time) {
  58. if (!time) return "";
  59. return time.replace("T", " ").substring(0, 19);
  60. },
  61. // 跳转到订单页面
  62. goToOrder() {
  63. uni.navigateTo({
  64. url: "/pages-mine/pages/order-page",
  65. });
  66. },
  67. },
  68. };
  69. </script>
  70. <style lang="scss" scoped>
  71. .notice-page {
  72. min-height: 100vh;
  73. background-color: #f5f5f5;
  74. padding: 20rpx 0;
  75. .time-divider {
  76. text-align: center;
  77. font-family: PingFang SC;
  78. font-weight: 500;
  79. font-size: 26rpx;
  80. color: #333333;
  81. padding: 20rpx 0;
  82. }
  83. .notice-item {
  84. margin: 0 20rpx;
  85. padding: 30rpx;
  86. background: #ffffff;
  87. border-radius: 12rpx;
  88. .notice-icon {
  89. margin-right: 20rpx;
  90. padding-top: 6rpx;
  91. }
  92. .notice-header {
  93. border-bottom: 1px solid #f8f8f8;
  94. padding-bottom: 14rpx;
  95. }
  96. .notice-title {
  97. font-size: 30rpx;
  98. font-weight: bold;
  99. color: #333333;
  100. padding-left: 10rpx;
  101. font-family: PingFang SC;
  102. }
  103. .notice-content {
  104. padding-top: 14rpx;
  105. flex: 1;
  106. .notice-text {
  107. font-size: 28rpx;
  108. color: #666666;
  109. line-height: 1.6;
  110. .notice-link {
  111. color: #38c148;
  112. padding: 0 4rpx;
  113. }
  114. }
  115. }
  116. }
  117. }
  118. </style>