NoticeList.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. <template><page-meta :root-font-size="fontSize+'px'"></page-meta>
  2. <seller-base :show="false"><view style="position: absolute;top:0;right:0;left:0;bottom:0" class="scroll-view-wrapper div container">
  3. <view class="div common-header-wrap">
  4. <view class="status-holder"></view>
  5. <view :style="'height:'+navHeight+'px'"></view>
  6. <view class="common-header-holder"></view>
  7. <view class="common-header-fixed">
  8. <title-header />
  9. <uni-nav-bar title="通知消息" class="common-header" left-icon="back" @clickLeft="goBack()">
  10. </uni-nav-bar>
  11. </view>
  12. </view>
  13. <view class="scroll-view div" style="position:relative">
  14. <scroll-view style="position: absolute;top:0;right:0;left:0;bottom:0" class="div" v-infinite-scroll="loadMore" infinite-scroll-disabled="loading" infinite-scroll-distance="10">
  15. <view
  16. class="div body"
  17. v-if="notice_list && notice_list.length"
  18. >
  19. <view
  20. class="div notice-message-body"
  21. v-for="(item, index) in notice_list"
  22. :key="item.storemsg_id"
  23. >
  24. <view class="p">{{$moment.unix(item.storemsg_addtime).format('YYYY-MM-DD HH:mm')}}</view>
  25. <view class="div notice-track">
  26. <view class="div notice-status">
  27. <view class="p title">{{ item.storemt_name }}</view>
  28. <view class="p content">{{ item.storemsg_content }}</view>
  29. </view>
  30. </view>
  31. </view>
  32. </view>
  33. <empty-record v-else-if="notice_list && !notice_list.length"></empty-record>
  34. </scroll-view>
  35. </view>
  36. </view>
  37. </seller-base>
  38. </template>
  39. <script>
  40. import {getFontSize} from '@/util/common'
  41. import TitleHeader from '../../TitleHeader'
  42. import SellerBase from '../SellerBase'
  43. import { getNoticeList } from '../../../api/sellerNotice'
  44. import EmptyRecord from '../../EmptyRecord'
  45. export default {
  46. name: 'NoticeList',
  47. components:{
  48. TitleHeader,
  49. SellerBase,
  50. EmptyRecord
  51. },
  52. computed:{
  53. fontSize(){
  54. return getFontSize()
  55. },
  56. },
  57. data(){
  58. return {
  59. navHeight: 0,
  60. params: { 'page': 0, 'per_page': 10 },
  61. loading: false, // 是否加载更多
  62. isMore: true, // 是否有更多
  63. message_type_text: ['私信', '系统消息', '留言'],
  64. notice_list: false,
  65. }
  66. },
  67. created () {
  68. this.loadMore()
  69. },
  70. mounted(){
  71. // #ifdef MP-WEIXIN
  72. this.navHeight = uni.getMenuButtonBoundingClientRect().height
  73. // #endif
  74. },
  75. methods:{
  76. goBack(){uni.navigateBack({delta:1})},
  77. loadMore () {
  78. this.loading = true
  79. this.params.page = ++this.params.page
  80. if (this.isMore) {
  81. this.loading = false
  82. this.getNoticeList(true)
  83. }
  84. },
  85. getNoticeList () {
  86. uni.showLoading({ title: '加载中' })
  87. getNoticeList(this.params).then(res => {
  88. uni.hideLoading()
  89. if (res.result.hasmore) {
  90. this.isMore = true
  91. } else {
  92. this.isMore = false
  93. }
  94. let temp = res.result.notice_list
  95. if (temp) {
  96. if (!this.notice_list) {
  97. this.notice_list = temp
  98. } else {
  99. this.notice_list = this.notice_list.concat(temp)
  100. }
  101. }
  102. }).catch(function (error) {
  103. uni.hideLoading()
  104. uni.showToast({icon:'none',title: error.message})
  105. })
  106. }
  107. }
  108. }
  109. </script>
  110. <style scoped lang="scss">
  111. .scroll-view-wrapper{display: flex;flex-direction: column;}
  112. .scroll-view{flex:1}
  113. .container {
  114. display: flex;
  115. flex-direction: column;
  116. justify-content: flex-start;
  117. align-items: stretch;
  118. .header {
  119. border-bottom: 1px solid #e8eaed;
  120. position: fixed;
  121. width: 100%;
  122. z-index: 1;
  123. }
  124. .body {
  125. width: 100%;
  126. .notice-message-body {
  127. width: 100%;
  128. height: 100%;
  129. > .p {
  130. text-align: center;
  131. margin-top: 1rem;
  132. margin-bottom: 0.5rem;
  133. font-size:$fontSize;
  134. color: #7c7f88;
  135. }
  136. .notice-track {
  137. display: flex;
  138. justify-content: space-between;
  139. align-items: center;
  140. height: 100%;
  141. background: rgba(255, 255, 255, 1);
  142. border-radius: 0.1rem;
  143. margin:0 0.5rem;
  144. .notice-status {
  145. display: flex;
  146. justify-content: space-between;
  147. align-items: center;
  148. flex-wrap: wrap;
  149. margin: 0.6rem 0.75rem 0.7rem 0.75rem;
  150. .title {
  151. font-size:$subFontSize;
  152. color: #333;
  153. margin:0 0 0.7rem 0;
  154. }
  155. .content {
  156. font-size:$fontSize;
  157. color: #666;
  158. width: 100%;
  159. height: 100%;
  160. }
  161. }
  162. .arrow-right {
  163. width:0.25rem;
  164. height: 0.5rem;
  165. margin-right: 0.6rem;
  166. margin-left: 0.65rem;
  167. }
  168. }
  169. }
  170. }
  171. }
  172. </style>