service.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. <template>
  2. <view class="content">
  3. <view class="order-body">
  4. <view class="empty-body" v-if="loginState">
  5. <view class="imgs">
  6. <image src="/static/image/empty.png" mode="widthFix"></image>
  7. <view class="tip">请先登录</view>
  8. </view>
  9. <view class="re-btn" @click="reback">去登陆</view>
  10. </view>
  11. <block class="" v-else>
  12. <view class="page">
  13. <view class="list-item" v-for="(item,index) in dataList" :key="index" @click="$dialog.jumpUri('/pages/service/msg?poi='+item.poi_id+'&source=list',1)">
  14. <view class="avatar">
  15. <text class="round" v-if="item.last.num > 0"></text>
  16. <image :src="item.avatar" mode="widthFix"></image>
  17. </view>
  18. <view class="content">
  19. <view class="title">
  20. <text class="name">{{ item.poi_name }}</text>
  21. <text class="time">{{ item.last.create_at }}</text>
  22. </view>
  23. <view class="txt">
  24. <view class="desc" v-if="item.last.type=='text'">{{item.last.content}}</view>
  25. <view class="desc" v-if="item.last.type=='order'">[订单消息]</view>
  26. <view class="desc" v-if="item.last.type=='image'">[图片消息]</view>
  27. <view class="desc" v-if="item.last.type=='video'">[视频消息]</view>
  28. <view class="desc" v-if="item.last.type=='pay'">[支付消息]</view>
  29. <view class="desc" v-if="item.last.type=='address'">[地址消息]</view>
  30. </view>
  31. </view>
  32. </view>
  33. </view>
  34. </block>
  35. </view>
  36. </view>
  37. </template>
  38. <script>
  39. var app;
  40. import * as Api from "@/static/api/service.js";
  41. export default {
  42. data() {
  43. return {
  44. listState:false,
  45. dataList:[],
  46. loginState:true
  47. }
  48. },
  49. onShow() {
  50. var token = uni.getStorageSync("user_token")
  51. if (token) {
  52. this.loginState = false;
  53. }
  54. this.queryList(1,100)
  55. },
  56. onLoad() {
  57. app = this;
  58. },
  59. methods: {
  60. reback(){
  61. uni.navigateTo({
  62. url:"/pages/auth/login"
  63. })
  64. },
  65. queryList(pageNo, pageSize){
  66. var formData = {};
  67. var token = uni.getStorageSync("user_token")
  68. if (!token) {
  69. return false;
  70. }
  71. const tokenPoi = uni.getStorageSync("contact");
  72. console.log("tokenPoi",tokenPoi)
  73. formData.page = pageNo;
  74. formData.size = pageSize;
  75. formData.poi = tokenPoi.poi_id;
  76. app.listState = true;
  77. Api.list(formData).then((res)=>{
  78. app.listState = false;
  79. uni.hideLoading();
  80. if (res.code !== 1) {
  81. return app.$dialog.showSuccess(res.msg);
  82. }
  83. app.dataList = res.data.rows;
  84. })
  85. }
  86. }
  87. }
  88. </script>
  89. <style lang="scss" scoped>
  90. .empty-body{display: flex;align-items: center;justify-content: center;flex-direction: column;height: 100vh;}
  91. .empty-body .imgs{text-align: center;font-size: 28upx;color: #666;}
  92. .empty-body .imgs image{height: 160upx;width: 160upx;}
  93. .empty-body .imgs .tip{margin-top: 20upx;}
  94. .empty-body .re-btn{width: 180upx;height: 80upx;line-height: 80upx;text-align: center;font-size: 28upx;color: #fff;background-color: #007aff;border-radius: 10upx;margin-top: 60upx;}
  95. .page {
  96. padding: 0 32rpx;
  97. color: #333;
  98. }
  99. .list-item {
  100. display: flex;
  101. padding: 30rpx 0;
  102. border-bottom: 2upx solid #ccced3;
  103. .avatar {
  104. width: 90rpx;
  105. height: 90rpx;
  106. border-radius: 10rpx;
  107. margin-right: 20rpx;
  108. position: relative;
  109. .round {
  110. position: absolute;
  111. width: 14rpx;
  112. height: 14rpx;
  113. border-radius: 50%;
  114. background: #ef5656;
  115. top: -4rpx;
  116. right: -4rpx;
  117. z-index: 1;
  118. }
  119. image {
  120. width: 100%;
  121. height: 100%;
  122. border-radius: 10rpx;
  123. }
  124. }
  125. .content {
  126. flex: 1;
  127. .title {
  128. display: flex;
  129. justify-content: space-between;
  130. .name {
  131. font-weight: bold;
  132. }
  133. .time {
  134. color: #999;
  135. font-size: 24rpx;
  136. }
  137. }
  138. .txt {
  139. margin-top: 10rpx;
  140. overflow: hidden;
  141. text-overflow: ellipsis;
  142. display: -webkit-box;
  143. -webkit-line-clamp: 1;
  144. -webkit-box-orient: vertical;
  145. text-align: left;
  146. color: #999;
  147. font-size: 26rpx;
  148. }
  149. }
  150. }
  151. </style>