message.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387
  1. <template>
  2. <view class="content">
  3. <view class="navbar">
  4. <view v-for="(item, index) in tabList" :key="index" class="flex-sub"
  5. @click="tabClicks(item.state)">
  6. <view class="nav-item" :class="{ current: tabFromIndex === item.state }">{{ item.text }}<view class="ban" v-if="tabFromIndex === item.state"></view></view>
  7. <!-- <view class="text-center" style="margin-top: -30upx;">
  8. <image v-if="tabFromIndex === item.state " src="/static/upload/wx.png" style="width: 55upx;height: 16upx;margin-top: -5upx;"></image>
  9. </view> -->
  10. </view>
  11. </view>
  12. <!-- #ifdef H5 -->
  13. <view style="margin-top: 80upx;">
  14. <!-- #endif -->
  15. <!-- #ifndef H5 -->
  16. <view style="margin-top: 90upx;">
  17. <!-- #endif -->
  18. <view v-for="(item, index) in list" :key="index" class="item" @click="goDet(item)">
  19. <view class="flex justify-between"
  20. style="font-size: 30upx;width: 100%;overflow: hidden;text-overflow: ellipsis;white-space:nowrap">
  21. <view style="color: #333333;">{{ item.title }}</view>
  22. <view v-if="item.isSee == 0"
  23. style="height: 32rpx;width: 32rpx;border-radius: 100rpx;background-color: red;color: #FFF;text-align: center;">
  24. </view>
  25. </view>
  26. <view style="color: #999999;font-size: 28upx;margin-top: 10upx;">{{ item.content }}</view>
  27. <view style="margin-top: 10upx;color: #999999;font-size: 28upx;text-align: right;">{{ item.createAt }}
  28. </view>
  29. <view v-if="list.length-1!=index" style="width: 100%;height: 1rpx;background: #f5f5f5;margin-top: 30upx;"></view>
  30. </view>
  31. </view>
  32. <!-- <view v-if="list.length === 0" style="background: #1c1b20;text-align: center;padding-top: 140upx;color: #FFFFFF;">暂无消息</view> -->
  33. <empty v-if="list.length === 0" content="暂无消息" show="false" style="height: 100vh;"></empty>
  34. </view>
  35. </template>
  36. <script>
  37. import empty from '@/components/empty';
  38. export default {
  39. components: {
  40. empty
  41. },
  42. data() {
  43. return {
  44. tabFromIndex: 0,
  45. tabCurrentIndex: 0,
  46. fromInfo: 5,
  47. list: [],
  48. page: 1,
  49. limit: 10,
  50. scrollTop: false,
  51. tabList: [
  52. // {
  53. // state: 5,
  54. // text: '用户消息',
  55. // totalElements: 0
  56. // },
  57. // {
  58. // state: 6,
  59. // text: '订单消息',
  60. // totalElements: 0
  61. // }
  62. {
  63. state: 0,
  64. text: '全部',
  65. totalElements: 0
  66. },
  67. {
  68. state: 7,
  69. text: '订单消息',
  70. totalElements: 0
  71. },
  72. {
  73. state: 5,
  74. text: '系统通知',
  75. totalElements: 0
  76. },
  77. {
  78. state: 19,
  79. text: '乘客消息',
  80. totalElements: 0
  81. },
  82. {
  83. state: 20,
  84. text: '活动通知',
  85. totalElements: 0
  86. },
  87. ]
  88. };
  89. },
  90. onPageScroll: function(e) {
  91. this.scrollTop = e.scrollTop > 200;
  92. },
  93. onReachBottom: function() {
  94. this.page = this.page + 1;
  95. this.loadData();
  96. },
  97. onPullDownRefresh: function() {
  98. this.page = 1;
  99. this.loadData();
  100. },
  101. onLoad(options) {
  102. this.$queue.showLoading("加载中...")
  103. this.loadData();
  104. },
  105. methods: {
  106. goDet(item) {
  107. if(item.platform){
  108. if(item.title === '消息未读通知'){
  109. uni.navigateTo({
  110. url: '/my/kefu/im?chatConversationId=' + item.platform +
  111. '&byUserId=' + item.byUserId + '&ordersId=' + (item.ordersId ? item.ordersId : '')
  112. })
  113. }else{
  114. uni.navigateTo({
  115. url: '/pages/index/orderDet?indentNumber=' + item.ordersId + '&driverRouteId=' + item.platform
  116. })
  117. }
  118. }
  119. },
  120. //顶部渠道点击
  121. tabClicks(index) {
  122. this.list = [];
  123. this.page = 1;
  124. this.tabFromIndex = index;
  125. this.$queue.showLoading("加载中...")
  126. this.loadData();
  127. },
  128. //获取消息列表
  129. loadData() {
  130. let that = this;
  131. let number = 10;
  132. let token = this.$queue.getData('token');
  133. if (token) {
  134. let data = {
  135. page: this.page,
  136. limit: this.limit,
  137. state: this.tabFromIndex
  138. }
  139. this.$Request.getT('/app/message/selectMessageByUserId', data).then(res => {
  140. if (res.code === 0) {
  141. if (this.page == 1) {
  142. this.list = res.data.records
  143. } else {
  144. res.data.records.forEach(d => {
  145. this.list.push(d);
  146. });
  147. }
  148. }
  149. uni.hideLoading();
  150. uni.stopPullDownRefresh();
  151. });
  152. }
  153. }
  154. }
  155. };
  156. </script>
  157. <style lang="scss">
  158. page,
  159. page {
  160. background: #ffffff;
  161. }
  162. .content {
  163. background: #ffffff;
  164. height: 100%;
  165. }
  166. .swiper-box {
  167. height: calc(100% - 40px);
  168. }
  169. .list-scroll-content {
  170. height: 100%;
  171. }
  172. .navbar {
  173. display: flex;
  174. height: 40px;
  175. padding: 0 5px;
  176. // background: #1E1F31;
  177. // box-shadow: 0 1px 5px rgba(0, 0, 0, 0.06);
  178. color: #000000;
  179. position: relative;
  180. background: #FFFFFF;
  181. position: fixed;
  182. /* #ifdef H5 */
  183. top:80upx;
  184. /* #endif */
  185. /* #ifndef H5 */
  186. top: 0;
  187. /* #endif */
  188. left: 0;
  189. right: 0;
  190. z-index: 10;
  191. .nav-item {
  192. display: flex;
  193. justify-content: center;
  194. align-items: center;
  195. height: 100%;
  196. font-size: 15px;
  197. // color: #FFFFFF;
  198. position: relative;
  199. &.current {
  200. color: #00c18a;
  201. // &:after {
  202. // content: '';
  203. // position: absolute;
  204. // left: 50%;
  205. // bottom: 0;
  206. // transform: translateX(-50%);
  207. // width: 44px;
  208. // height: 0;
  209. // border-bottom: 2px solid #557EFD;
  210. // }
  211. }
  212. }
  213. }
  214. .uni-swiper-item {
  215. height: auto;
  216. }
  217. page {
  218. background-color: #F7F7F7;
  219. }
  220. .item {
  221. background: #FFFFFF;
  222. padding: 16rpx;
  223. margin: 16rpx;
  224. font-size: 28rpx;
  225. // box-shadow: 7px 9px 34px rgba(0, 0, 0, 0.1);
  226. border-radius: 16upx;
  227. }
  228. /* load-more */
  229. .uni-load-more {
  230. display: flex;
  231. flex-direction: row;
  232. height: 40px;
  233. align-items: center;
  234. justify-content: center;
  235. }
  236. .uni-load-more__text {
  237. font-size: 14px;
  238. // color: #999;
  239. }
  240. .uni-load-more__img {
  241. height: 24px;
  242. width: 24px;
  243. margin-right: 10px;
  244. }
  245. .uni-load-more__img>view {
  246. position: absolute;
  247. }
  248. .uni-load-more__img>view view {
  249. width: 6px;
  250. height: 2px;
  251. border-top-left-radius: 1px;
  252. border-bottom-left-radius: 1px;
  253. background: #999;
  254. position: absolute;
  255. opacity: 0.2;
  256. transform-origin: 50%;
  257. animation: load 1.56s ease infinite;
  258. }
  259. .uni-load-more__img>view view:nth-child(1) {
  260. transform: rotate(90deg);
  261. top: 2px;
  262. left: 9px;
  263. }
  264. .uni-load-more__img>view view:nth-child(2) {
  265. transform: rotate(180deg);
  266. top: 11px;
  267. right: 0;
  268. }
  269. .uni-load-more__img>view view:nth-child(3) {
  270. transform: rotate(270deg);
  271. bottom: 2px;
  272. left: 9px;
  273. }
  274. .uni-load-more__img>view view:nth-child(4) {
  275. top: 11px;
  276. left: 0;
  277. }
  278. .load1,
  279. .load2,
  280. .load3 {
  281. height: 24px;
  282. width: 24px;
  283. }
  284. .load2 {
  285. transform: rotate(30deg);
  286. }
  287. .load3 {
  288. transform: rotate(60deg);
  289. }
  290. .load1 view:nth-child(1) {
  291. animation-delay: 0s;
  292. }
  293. .load2 view:nth-child(1) {
  294. animation-delay: 0.13s;
  295. }
  296. .load3 view:nth-child(1) {
  297. animation-delay: 0.26s;
  298. }
  299. .load1 view:nth-child(2) {
  300. animation-delay: 0.39s;
  301. }
  302. .load2 view:nth-child(2) {
  303. animation-delay: 0.52s;
  304. }
  305. .load3 view:nth-child(2) {
  306. animation-delay: 0.65s;
  307. }
  308. .load1 view:nth-child(3) {
  309. animation-delay: 0.78s;
  310. }
  311. .load2 view:nth-child(3) {
  312. animation-delay: 0.91s;
  313. }
  314. .load3 view:nth-child(3) {
  315. animation-delay: 1.04s;
  316. }
  317. .load1 view:nth-child(4) {
  318. animation-delay: 1.17s;
  319. }
  320. .load2 view:nth-child(4) {
  321. animation-delay: 1.3s;
  322. }
  323. .load3 view:nth-child(4) {
  324. animation-delay: 1.43s;
  325. }
  326. .ban {
  327. width: 50%;
  328. height: 5rpx;
  329. background: #00c18a;
  330. opacity: 0.7;
  331. position: absolute;
  332. top: 62rpx;
  333. // margin-left: 25%;
  334. }
  335. @-webkit-keyframes load {
  336. 0% {
  337. opacity: 1;
  338. }
  339. 100% {
  340. opacity: 0.2;
  341. }
  342. }
  343. </style>