message copy.vue 6.1 KB

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