message.vue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309
  1. <template>
  2. <view>
  3. <u-navbar title="消息" title-color="#101010" ></u-navbar>
  4. <!-- 消息列表 -->
  5. <view class="message-list" v-if="list.length">
  6. <view class="message-item" @click="messageList1()" >
  7. <view class="icon icon2">
  8. <image class="img" src="@/assets/img/antFill-account-book.svg" mode=""></image>
  9. <view class="dot" >
  10. </view>
  11. </view>
  12. <view class="content">
  13. <view class="title">
  14. <view class="title-name">
  15. 账单提醒
  16. </view>
  17. <view class="title-time">
  18. {{list[0].createTime}}
  19. </view>
  20. </view>
  21. <view class="value">
  22. {{list[0].name}}
  23. </view>
  24. </view>
  25. </view>
  26. </view>
  27. <view class="message-list" v-if="messageList.length" >
  28. <view class="message-item" v-for="(item,i) in messageList" :key="i"
  29. v-show="item.message"
  30. @click="gotoUrl('/pages/message/messageList?type='+item.typeId)" >
  31. <view class="icon">
  32. <image class="img" src="@/assets/img/antFill-notification.svg" mode=""></image>
  33. <view class="dot" v-if="item.unReadtNum">
  34. </view>
  35. </view>
  36. <view class="content">
  37. <view class="title">
  38. <view class="title-name">
  39. {{item.typeName}}
  40. </view>
  41. <view class="title-time" v-if="item.message">
  42. {{item.message.createTime}}
  43. </view>
  44. </view>
  45. <view class="value" v-if="item.message">
  46. {{item.message.content}}
  47. </view>
  48. </view>
  49. </view>
  50. <!-- <view class="message-item">
  51. <view class="icon icon2">
  52. <image class="img" src="@/assets/img/antFill-account-book.svg" mode=""></image>
  53. </view>
  54. <view class="content">
  55. <view class="title">
  56. <view class="title-name">
  57. 余额提醒
  58. </view>
  59. <view class="title-time">
  60. 01-02
  61. </view>
  62. </view>
  63. <view class="value">
  64. 租户您好,贵司账户余额不足100元,请尽快充值充值
  65. </view>
  66. </view>
  67. </view> -->
  68. <!--
  69. <view class="message-item">
  70. <view class="icon icon3">
  71. <image class="img" src="@/assets/img/fas fa-bell.svg" mode=""></image>
  72. </view>
  73. <view class="content">
  74. <view class="title">
  75. <view class="title-name">
  76. 故障报警
  77. </view>
  78. <view class="title-time">
  79. 01-02
  80. </view>
  81. </view>
  82. <view class="value">
  83. 本园区11楼所在楼层电表网络故障,我们会尽快处处处处
  84. </view>
  85. </view>
  86. </view>
  87. <view class="message-item">
  88. <view class="icon icon4">
  89. <image class="img" src="@/assets/img/fas fa-exclamation-triangle Copy 1.svg" mode=""></image>
  90. </view>
  91. <view class="content">
  92. <view class="title">
  93. <view class="title-name">
  94. 断电通知
  95. </view>
  96. <view class="title-time">
  97. 01-02
  98. </view>
  99. </view>
  100. <view class="value">
  101. 租户您好,截止2月18日0时,贵司账户余额已不足足足足足
  102. </view>
  103. </view>
  104. </view>
  105. <view class="message-item">
  106. <view class="icon icon5">
  107. <image class="img" src="@/assets/img/fas fa-chart-pie.svg" mode=""></image>
  108. </view>
  109. <view class="content">
  110. <view class="title">
  111. <view class="title-name">
  112. 电费月度账单
  113. </view>
  114. <view class="title-time">
  115. 01-02
  116. </view>
  117. </view>
  118. <view class="value">
  119. 截止2024年01月,您家电表止码8652,用电12888888
  120. </view>
  121. </view>
  122. </view>
  123. <view class="message-item">
  124. <view class="icon icon6">
  125. <image class="img" src="@/assets/img/md-watch_later.svg" mode=""></image>
  126. </view>
  127. <view class="content">
  128. <view class="title">
  129. <view class="title-name">
  130. 租约到期提醒
  131. </view>
  132. <view class="title-time">
  133. 01-02
  134. </view>
  135. </view>
  136. <view class="value">
  137. 用户您好,您的租约即将于2月14日到期,如需续续续
  138. </view>
  139. </view>
  140. </view>-->
  141. </view>
  142. <u-divider :isnone="list.length==0&&messageList.length==0" nonetext="没有找到相关内容"
  143. border-color="#CFD2D5">已经到底了</u-divider>
  144. <Tabbar :current="1" :prefetchNum="prefetchNum" ></Tabbar>
  145. </view>
  146. </template>
  147. <script>
  148. import * as API from '@/apis/pagejs/message.js'
  149. import Tabbar from '@/components/Tabbar.vue'
  150. export default {
  151. components: {
  152. Tabbar
  153. },
  154. data() {
  155. return {
  156. list:[],
  157. messageList:[],
  158. prefetchNum:0
  159. }
  160. },
  161. onLoad() {
  162. this.getBillList()
  163. this.prefetch()
  164. },
  165. methods: {
  166. prefetch(){
  167. API.prefetch({
  168. }).then((response) => {
  169. //this.prefetchNum=response.data
  170. this.getMessageTypeList()
  171. }).catch(error => {
  172. //uni.hideLoading();
  173. })
  174. },
  175. messageList1(){
  176. if(this.list.length==1){
  177. this.gotoUrl('/pages/deductionRecord/billPush?site=1&id='+this.list[0].id)
  178. }else{
  179. this.gotoUrl('/pages/message/messageList?type=1')
  180. }
  181. },
  182. getMessageTypeList(){
  183. uni.showLoading({
  184. mask:true,title:'加载中...'
  185. })
  186. API.messageTypeList().then((response) => {
  187. uni.hideLoading();
  188. this.messageList=response.data.typeList;
  189. }).catch(error => {
  190. uni.hideLoading();
  191. })
  192. },
  193. getBillList(){
  194. uni.showLoading({
  195. mask:true,title:'加载中...'
  196. })
  197. API.billList().then((response) => {
  198. uni.hideLoading();
  199. this.list=response.data.data;
  200. }).catch(error => {
  201. uni.hideLoading();
  202. })
  203. }
  204. }
  205. }
  206. </script>
  207. <style lang="scss" scoped>
  208. .message-list{
  209. background-color: #fff;
  210. .message-item{
  211. display: flex;
  212. padding: 32rpx;
  213. border-bottom: 1px solid rgba(240,240,240,1);
  214. .icon{
  215. width: 96rpx;
  216. height: 96rpx;
  217. border-radius: 12px;
  218. display: flex;
  219. align-items: center;
  220. justify-content: center;
  221. position: relative;
  222. background: linear-gradient(180.4deg, rgba(127,213,151,1) 2.1%,rgba(67,176,116,1) 101.21%);
  223. .img{
  224. width: 56rpx;
  225. height: 56rpx;
  226. }
  227. .dot{
  228. width: 20rpx;
  229. height: 20rpx;
  230. border-radius:999px;
  231. background-color: rgba(255,0,0,1);
  232. position: absolute;
  233. top:-6rpx;
  234. right:-6rpx;
  235. }
  236. }
  237. .icon2{
  238. background: linear-gradient(180deg, rgba(121,172,255,1) 0%,rgba(57,132,255,1) 100%);
  239. color: rgba(255,255,255,1);
  240. }
  241. .icon3{
  242. background: linear-gradient(180.29deg, rgba(255,214,125,1) 0.9%,rgba(255,150,0,1) 100.4%);
  243. }
  244. .icon4{
  245. background: linear-gradient(180.29deg, rgba(255,124,112,1) 0.9%,rgba(255,79,63,1) 100.4%);
  246. }
  247. .icon5{
  248. background: linear-gradient(178.44deg, rgba(122,232,227,1) 3.96%,rgba(57,182,182,1) 100.6%);
  249. }
  250. .icon6{
  251. background: linear-gradient(179.2deg, rgba(168,178,238,1) 6.28%,rgba(123,123,240,1) 96.94%);
  252. }
  253. .content{
  254. flex:1;
  255. margin-left: 24rpx;
  256. display: flex;
  257. flex-direction: column;
  258. justify-content: space-between;
  259. .title{
  260. display: flex;
  261. justify-content: space-between;
  262. align-items: center;
  263. .title-name{
  264. color: rgb(16,16,16);
  265. font-size: 32rpx;
  266. }
  267. .title-time{
  268. color: rgb(140,140,140);
  269. font-size: 24rpx;
  270. }
  271. }
  272. .value{
  273. width: 560rpx;
  274. white-space: nowrap;
  275. overflow: hidden;
  276. text-overflow: ellipsis;
  277. margin-top: 10rpx;
  278. font-size: 24rpx
  279. }
  280. }
  281. }
  282. }
  283. </style>