message.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  1. <template>
  2. <view class="container">
  3. <view>
  4. <u-navbar :autoBack="true" leftIconSize="0">
  5. <view slot="center">
  6. <u-tabs :list="list" lineWidth="60" :current="current" @change="changeInfo" />
  7. </view>
  8. </u-navbar>
  9. <view :style="{ marginTop: totalHeight + 'px' }">
  10. <view v-if="current == 0">
  11. <view class="orderList" v-for="item in orderList" :key="item.id" @tap="$Router.push(item.url)">
  12. <view class="img">
  13. <image :src="item.img" style="width: 45px; height: 45px" />
  14. <view class="dot">
  15. <u-badge type="warning" max="99" :value="item.numb"></u-badge>
  16. </view>
  17. </view>
  18. <view class="orderItem">
  19. <view class="order1">{{ item.name }}</view>
  20. <view class="order2">{{ item.text }}</view>
  21. </view>
  22. <u-icon name="arrow-right"></u-icon>
  23. </view>
  24. </view>
  25. <!-- 消息通知 -->
  26. <view v-if="current == 1">
  27. <view class="message" @click="notification" v-for="item in 5" :key="item">
  28. <view class="img">
  29. <image src="/static/icon/tools.png" style="width: 45px; height: 45px" />
  30. </view>
  31. <view class="business">
  32. <view class="businessItem">商家</view>
  33. <view class="messages">您好,请问有什么需要帮助的吗?</view>
  34. </view>
  35. <view class="time">
  36. <view class="timeItem">17:00</view>
  37. <u-badge numberType="overflow" :type="type" max="99" :value="value" />
  38. </view>
  39. </view>
  40. </view>
  41. </view>
  42. </view>
  43. <tabbar currentTab="clientMessage" />
  44. </view>
  45. </template>
  46. <script>
  47. import { getIsHaveNewInform } from '@/api/client/message.js';
  48. export default {
  49. data() {
  50. return {
  51. list: [{
  52. id: 1,
  53. name: '系统通知',
  54. }
  55. // ,
  56. // {
  57. // id: 2,
  58. // name: '消息通知',
  59. // badge: {
  60. // value: 5,
  61. // },
  62. // },
  63. ],
  64. current: 0,
  65. orderList: [{
  66. id: '1',
  67. img: '/static/icon/tools.png',
  68. name: '订单通知',
  69. text: '暂无订单通知。',
  70. url: '/pagesMessage/orderNotify',
  71. numb:0
  72. },
  73. // {
  74. // id: '3',
  75. // img: '/static/icon/tools.png',
  76. // name: '支付通知',
  77. // text: '暂无支付通知。',
  78. // url: '/pages/client/clientPackage/message/orderNotice/index',
  79. // numb:0
  80. // },
  81. {
  82. id: '2',
  83. img: '/static/icon/tools.png',
  84. name: '评价通知',
  85. text: '暂无评价通知。',
  86. url: '/pagesMessage/commentNotify',
  87. numb:0
  88. },
  89. {
  90. id: '4',
  91. img: '/static/icon/tools.png',
  92. name: '点赞回复',
  93. text: '暂无点赞回复。',
  94. url: '/pagesMessage/kudosNotify',
  95. numb:0
  96. },
  97. {
  98. id: '5',
  99. img: '/static/icon/tools.png',
  100. name: '优惠福利',
  101. text: '暂无优惠福利通知。',
  102. url: '/pagesMessage/benefitsNotify',
  103. numb:0
  104. },
  105. ],
  106. type: 'warning',
  107. value: 99999,
  108. flag: true,
  109. };
  110. },
  111. onShow() {
  112. this.handlerGetSystemNewInform()
  113. },
  114. computed: {
  115. totalHeight() {
  116. return uni.getSystemInfoSync().statusBarHeight + 44;
  117. },
  118. },
  119. methods: {
  120. // 获取订单详细通知 是否有系统新消息
  121. handlerGetSystemNewInform() {
  122. getIsHaveNewInform().then(res => {
  123. let { order , comment , evaluate , coupon} = res.data
  124. this.orderList[0].numb = order
  125. order ? this.orderList[0].text = `您有${order}条订单信息` : this.orderList[0].text = '暂无订单通知'
  126. // this.orderList[1].numb = pay
  127. // pay ? this.orderList[1].text = `您有${pay}条订单信息` : this.orderList[1].text = '暂无支付通知'
  128. this.orderList[1].numb = comment
  129. comment ? this.orderList[1].text = `您有${comment}条订单信息` : this.orderList[1].text = '暂无评价通知'
  130. this.orderList[2].numb = evaluate
  131. evaluate ? this.orderList[2].text = `您有${evaluate}条订单信息` : this.orderList[2].text = '暂无点赞回复'
  132. this.orderList[3].numb = coupon
  133. coupon ? this.orderList[3].text = `您有${coupon}条订单信息` : this.orderList[3].text = '暂无优惠福利通知'
  134. })
  135. },
  136. changeInfo(index) {
  137. this.current = index.index;
  138. if(index == 0){
  139. this.handlerGetSystemNewInform()
  140. }
  141. },
  142. notification() {
  143. // uni.navigateTo({
  144. // url: `/pages/client/clientPackage/chatRoom/chat`,
  145. // });
  146. },
  147. },
  148. };
  149. </script>
  150. <style lang="scss" scoped>
  151. .container {
  152. min-height: 100vh;
  153. background-color: #fff;
  154. .img {
  155. width: 90rpx;
  156. height: 90rpx;
  157. margin-right: 20rpx;
  158. position: relative;
  159. .dot {
  160. // width: 16rpx;
  161. height: 16rpx;
  162. // background-color: red;
  163. border-radius: 8rpx;
  164. position: absolute;
  165. top: -10rpx;
  166. right: -10rpx;
  167. }
  168. }
  169. .orderList {
  170. display: flex;
  171. padding: 30rpx 40rpx;
  172. justify-content: space-between;
  173. background-color: #fff;
  174. .orderItem {
  175. flex: 1;
  176. .order1 {
  177. font-size: 16px;
  178. margin-bottom: 10rpx;
  179. color: #232323;
  180. }
  181. .order2 {
  182. font-size: 12px;
  183. color: #9ca3af;
  184. }
  185. }
  186. }
  187. .message {
  188. display: flex;
  189. padding: 30rpx 40rpx;
  190. justify-content: space-between;
  191. .business {
  192. flex: 1;
  193. .businessItem {
  194. font-size: 16px;
  195. margin-bottom: 10rpx;
  196. color: #232323;
  197. }
  198. .messages {
  199. font-size: 12px;
  200. color: #9ca3af;
  201. }
  202. }
  203. .time {
  204. .timeItem {
  205. color: #9ca3af;
  206. font-size: 14px;
  207. margin-bottom: 8px;
  208. }
  209. }
  210. }
  211. }
  212. </style>