details.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. <template>
  2. <view class="page">
  3. <service-widget @btnClick="btn_click"></service-widget>
  4. <view class="message dis f-c" v-for="(item,index) in dataList" :key="index">
  5. <view class="time dis j-c a-c">{{item.createTime}}</view>
  6. <view class="content dis f-c">
  7. <view class="dis f-c j-s" style="border-bottom: 1px solid #f2f2f2;padding-bottom: 6px;">
  8. <text>消息编号:{{item.id}}</text>
  9. </view>
  10. <view class="dis f-c j-s" style="border-bottom: 1px solid #f2f2f2;padding: 10px 0;">
  11. <text> <text style="color: rgba(35,40,50,0.6);">消息内容:</text>
  12. {{item.content}}</text>
  13. </view>
  14. <view class="details">
  15. <u-section title="查看详情" sub-title="" :show-line="false"></u-section>
  16. </view>
  17. </view>
  18. </view>
  19. <u-loadmore v-if="dataList.length>0" :status="status" />
  20. </view>
  21. </template>
  22. <script>
  23. export default {
  24. data() {
  25. return {
  26. msgType: "",
  27. dataList: [],
  28. pageRequest: {
  29. pageNum: 1,
  30. pageSize: 20,
  31. },
  32. status: 'loadmore',
  33. pages: 0, //订单总页数
  34. }
  35. },
  36. onShow() {
  37. },
  38. onReachBottom() {
  39. if (this.pageRequest.pageNum >= this.pages) return;
  40. this.status = 'loading';
  41. this.pageRequest.pageNum = ++this.pageRequest.pageNum;
  42. setTimeout(async () => {
  43. let res = await this.$http.post('/api/message/getUserMessageList', {
  44. msgType: this.msgType,
  45. ...this.pageRequest
  46. });
  47. if (res.code == '200') {
  48. this.pageResult = [...this.pageResult, ...res.data.records];
  49. }
  50. if (this.pageRequest.pageNum >= this.pages) this.status = 'nomore';
  51. else this.status = 'loading';
  52. }, 1000)
  53. },
  54. onPullDownRefresh() {
  55. // 执行刷新逻辑
  56. this.list(1, 20);
  57. },
  58. onLoad(params) {
  59. if (params.msgType) {
  60. this.msgType = params.msgType;
  61. this.list(1, 20);
  62. }
  63. },
  64. methods: {
  65. btn_click() {
  66. uni.navigateTo({
  67. url: '/pages/chat/chat'
  68. })
  69. },
  70. async list(page, size) {
  71. this.pageRequest.pageNum = page;
  72. this.pageRequest.pageSize = size;
  73. let res = await this.$http.post('/api/message/getUserMessageList', {
  74. msgType: this.msgType,
  75. ...this.pageRequest
  76. });
  77. if (res.code == '200') {
  78. this.dataList = res.data.records;
  79. this.pages = res.data.pages;
  80. uni.stopPullDownRefresh();
  81. }
  82. }
  83. }
  84. }
  85. </script>
  86. <style lang="scss" scoped>
  87. .page {
  88. padding: 16px;
  89. background: #F8FAFE;
  90. }
  91. .message {
  92. width: 100%;
  93. cursor: pointer;
  94. .time {
  95. width: 100%;
  96. font-size: 14px;
  97. color: rgba(35, 40, 50, 0.6);
  98. }
  99. .content {
  100. width: 100%;
  101. background: #FFFFFF;
  102. box-shadow: 0px 4px 10px 0px #DAE3F4;
  103. border-radius: 6px;
  104. margin: 15px 0;
  105. padding: 6px 16px 16px 16px;
  106. >view:nth-child(1) {
  107. color: #232832;
  108. font-size: 14px;
  109. font-weight: bold;
  110. }
  111. >view:nth-child(2) {
  112. color: #232832;
  113. font-size: 14px;
  114. }
  115. }
  116. .details {
  117. padding-top: 16px;
  118. }
  119. }
  120. </style>