message.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  1. <template>
  2. <view class="notice clearfix" :style="{ paddingTop: CustomBar + 'px' }">
  3. <tui-skeleton
  4. v-if="skeletonShow"
  5. backgroundColor="#fafafa"
  6. borderRadius="10rpx"
  7. :isLoading="true"
  8. :loadingType="5"
  9. ></tui-skeleton>
  10. <view v-else>
  11. <view class="navbar-wrap" :style="{ height: CustomBar + 'px', paddingTop: StatusBar + 'px' }">
  12. <view
  13. class="navbar-text"
  14. :style="{ lineHeight: CustomBar - StatusBar + 'px;', fontSize: fontSizeSetting + 'px;' }"
  15. >
  16. 消息 <text @click="clearNews" class="iconfont icon-qingli"></text>
  17. </view>
  18. </view>
  19. <view class="container-notice">
  20. <view class="notice-cell" @click="$api.navigateTo('/pages/seller/notice/service/service?messageType=1')">
  21. <view class="notice-cell-icon">
  22. <image class="icon-image" :src="StaticUrl + 'icon/icon-notice-serve@2x.png'" mode=""></image>
  23. </view>
  24. <view class="notice-cell-text"> 服务通知 <text class="cell-text">官方</text> </view>
  25. <view class="notice-cell-badge" v-if="notificationCount > 0">
  26. <text class="uni-badge uni-badge-error uni-small uni-badge--small icon-num">
  27. {{ notificationCount | BadgeType }}
  28. </text>
  29. </view>
  30. </view>
  31. </view>
  32. </view>
  33. </view>
  34. </template>
  35. <script>
  36. import { mapState, mapMutations } from 'vuex'
  37. export default {
  38. data() {
  39. return {
  40. CustomBar: this.CustomBar,
  41. StatusBar: this.StatusBar,
  42. StaticUrl: this.$Static,
  43. notificationCount: 100,
  44. skeletonShow: false,
  45. clubId: 0,
  46. allCount:0,
  47. tradeCount: 0,
  48. accountCount: 0,
  49. promotionCount: 0
  50. }
  51. },
  52. filters: {
  53. BadgeType(value) {
  54. if (value) {
  55. return value > 99 ? '99+' : value
  56. }
  57. }
  58. },
  59. computed: {
  60. ...mapState(['hasLogin', 'userInfo'])
  61. },
  62. onPullDownRefresh() {
  63. //下拉刷新
  64. this.initData()
  65. uni.stopPullDownRefresh()
  66. },
  67. mounted() {
  68. this.initData()
  69. },
  70. methods: {
  71. ...mapMutations(['updateSellerNoticeNum']),
  72. initData() {
  73. this.updateSellerNoticeNum()
  74. },
  75. // 请求信息列表
  76. async getMessageList(){
  77. console.log(1111)
  78. },
  79. // 清理未读消息
  80. clearNews() {
  81. // 标记消息已读
  82. if(this.allCount == 0){
  83. this.$util.msg('暂无未读消息', 2000)
  84. return
  85. }
  86. this.UserService.authUpdateMessageAsRead({ commonId:this.clubId,messageType: '' })
  87. .then(response => {
  88. uni.vibrateShort({
  89. success: function() {
  90. console.log('success')
  91. }
  92. })
  93. this.initData()
  94. this.$util.msg('已将所有消息标记为已读', 2000)
  95. })
  96. .catch(error => {
  97. console.log('标记通知消息已读', error.msg)
  98. })
  99. },
  100. // 协销账户
  101. getUserAuthClubMessageCount() {
  102. //供应商详情
  103. this.UserService.getUserAuthClubMessageCount({ commonId: this.clubId })
  104. .then(response => {
  105. this.allCount = response.data.count
  106. this.tradeCount = response.data.tradeCount // 交易物流
  107. this.accountCount = response.data.account // 账户通知
  108. this.notificationCount = response.data.notificationCount // 服务通知
  109. this.promotionCount = response.data.promotionCount // 优惠促销
  110. this.skeletonShow = false //预加载圆圈隐藏
  111. })
  112. .catch(error => {
  113. this.$util.msg(error.msg, 2000)
  114. })
  115. this.skeletonShow = false
  116. },
  117. }
  118. }
  119. </script>
  120. <style lang="scss" scoped>
  121. .navbar-wrap {
  122. position: fixed;
  123. width: 100%;
  124. top: 0;
  125. z-index: 100000;
  126. box-sizing: border-box;
  127. background: #ffffff;
  128. .navbar-text {
  129. font-size: 30rpx;
  130. color: #000000;
  131. font-weight: 500;
  132. text-align: center;
  133. .iconfont {
  134. display: inline-block;
  135. width: 48rpx;
  136. height: 48rpx;
  137. border-radius: 50%;
  138. background-color: #f5f5f5;
  139. text-align: center;
  140. line-height: 48rpx;
  141. color: #666666;
  142. font-size: 30rpx;
  143. margin-left: 20rpx;
  144. }
  145. }
  146. }
  147. .container-notice {
  148. width: 100%;
  149. height: auto;
  150. box-sizing: border-box;
  151. padding: 0 24rpx;
  152. padding-top: 20rpx;
  153. .notice-cell {
  154. width: 100%;
  155. height: 130rpx;
  156. box-sizing: border-box;
  157. padding: 19rpx 0;
  158. border-bottom: 1px solid #e1e1e1;
  159. .notice-cell-icon {
  160. width: 92rpx;
  161. height: 92rpx;
  162. float: left;
  163. .icon-image {
  164. width: 92rpx;
  165. height: 92rpx;
  166. display: block;
  167. }
  168. }
  169. .notice-cell-text {
  170. width: 400rpx;
  171. height: 100%;
  172. line-height: 92rpx;
  173. font-size: 34rpx;
  174. text-align: left;
  175. margin-left: 24rpx;
  176. float: left;
  177. .cell-text {
  178. display: inline-block;
  179. height: 32rpx;
  180. padding: 0 11rpx;
  181. line-height: 32rpx;
  182. border-radius: 20rpx;
  183. text-align: center;
  184. border: 1px solid #FF5B00;
  185. font-size: 24rpx;
  186. color: #FF5B00;
  187. margin-left: 10rpx;
  188. }
  189. }
  190. .notice-cell-badge {
  191. width: 92rpx;
  192. height: 92rpx;
  193. float: right;
  194. box-sizing: border-box;
  195. padding: 25rpx 15rpx;
  196. text-align: right;
  197. }
  198. }
  199. }
  200. .uni-badge--small {
  201. -webkit-transform: scale(0.8);
  202. -ms-transform: scale(0.8);
  203. transform: scale(0.8);
  204. -webkit-transform-origin: center center;
  205. -ms-transform-origin: center center;
  206. transform-origin: center center;
  207. }
  208. .uni-badge {
  209. font-family: 'Helvetica Neue', Helvetica, sans-serif;
  210. -webkit-box-sizing: border-box;
  211. box-sizing: border-box;
  212. font-size: 12px;
  213. line-height: 1;
  214. display: inline-block;
  215. padding: 3px 6px;
  216. color: #333;
  217. border-radius: 100px;
  218. background-color: #f1f1f1;
  219. }
  220. .uni-badge-error {
  221. color: #fff;
  222. background-color: #ff2a2a;
  223. }
  224. </style>