index.vue 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  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,index in 5" :key="index">
  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: '/pages/client/clientPackage/message/orderNotice/index',
  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: '/pages/client/clientPackage/message/evaluateNotice/index',
  87. numb:0
  88. },
  89. {
  90. id: '4',
  91. img: '/static/icon/tools.png',
  92. name: '点赞回复',
  93. text: '暂无点赞回复。',
  94. url: '/pages/client/clientPackage/message/LikeReply/index',
  95. numb:0
  96. },
  97. {
  98. id: '5',
  99. img: '/static/icon/tools.png',
  100. name: '优惠福利',
  101. text: '暂无优惠福利通知。',
  102. url: '/pages/client/clientPackage/message/benefits/index',
  103. numb:0
  104. },
  105. ],
  106. type: 'warning',
  107. value: 99999,
  108. flag: true,
  109. };
  110. },
  111. onShow() {
  112. /* 隐藏原生的tabbar */
  113. // uni.hideTabBar({
  114. // animation: false,
  115. // });
  116. this.handlerGetSystemNewInform()
  117. },
  118. computed: {
  119. totalHeight() {
  120. return uni.getSystemInfoSync().statusBarHeight + 44;
  121. },
  122. },
  123. methods: {
  124. // 获取订单详细通知 是否有系统新消息
  125. handlerGetSystemNewInform() {
  126. getIsHaveNewInform().then(res => {
  127. let { order , pay , comment , evaluate , coupon} = res.data
  128. this.orderList[0].numb = order
  129. order ? this.orderList[0].text = `您有${order}条订单信息` : this.orderList[0].text = '暂无订单通知'
  130. // this.orderList[1].numb = pay
  131. // pay ? this.orderList[1].text = `您有${pay}条订单信息` : this.orderList[1].text = '暂无支付通知'
  132. this.orderList[1].numb = comment
  133. comment ? this.orderList[1].text = `您有${comment}条订单信息` : this.orderList[2].text = '暂无评价通知'
  134. this.orderList[2].numb = evaluate
  135. evaluate ? this.orderList[2].text = `您有${evaluate}条订单信息` : this.orderList[3].text = '暂无点赞回复'
  136. this.orderList[3].numb = coupon
  137. coupon ? this.orderList[3].text = `您有${coupon}条订单信息` : this.orderList[4].text = '暂无优惠福利通知'
  138. })
  139. },
  140. changeInfo(index) {
  141. this.current = index.index;
  142. if(index == 0){
  143. this.handlerGetSystemNewInform()
  144. }
  145. },
  146. notification() {
  147. uni.navigateTo({
  148. url: `/pages/client/clientPackage/chatRoom/chat`,
  149. });
  150. },
  151. },
  152. };
  153. </script>
  154. <style lang="scss" scoped>
  155. .container {
  156. min-height: 100vh;
  157. background-color: #fff;
  158. .img {
  159. width: 90rpx;
  160. height: 90rpx;
  161. margin-right: 20rpx;
  162. position: relative;
  163. .dot {
  164. // width: 16rpx;
  165. height: 16rpx;
  166. // background-color: red;
  167. border-radius: 8rpx;
  168. position: absolute;
  169. top: -10rpx;
  170. right: -10rpx;
  171. }
  172. }
  173. .orderList {
  174. display: flex;
  175. padding: 30rpx 40rpx;
  176. justify-content: space-between;
  177. background-color: #fff;
  178. .orderItem {
  179. flex: 1;
  180. .order1 {
  181. font-size: 16px;
  182. margin-bottom: 10rpx;
  183. color: #232323;
  184. }
  185. .order2 {
  186. font-size: 12px;
  187. color: #9ca3af;
  188. }
  189. }
  190. }
  191. .message {
  192. display: flex;
  193. padding: 30rpx 40rpx;
  194. justify-content: space-between;
  195. .business {
  196. flex: 1;
  197. .businessItem {
  198. font-size: 16px;
  199. margin-bottom: 10rpx;
  200. color: #232323;
  201. }
  202. .messages {
  203. font-size: 12px;
  204. color: #9ca3af;
  205. }
  206. }
  207. .time {
  208. .timeItem {
  209. color: #9ca3af;
  210. font-size: 14px;
  211. margin-bottom: 8px;
  212. }
  213. }
  214. }
  215. }
  216. </style>