index.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. <template>
  2. <div class="secureselftest">
  3. <div class="toReadItem" v-for="item in msgList" @tap="showDialog(item)" >
  4. <div class="readTitle">【{{item.type}}】</div>
  5. <div class="readInfo">{{item.title}}</div>
  6. <div class="readTime">2024-04-25 09:00</div>
  7. </div>
  8. <van-dialog
  9. use-slot
  10. title="消息提醒"
  11. :show="show"
  12. :show-cancel-button="false"
  13. confirm-button-text="我知道了"
  14. confirm-button-color="rgba(87, 107, 149, 1)"
  15. @confirm="confirm"
  16. width="640rpx"
  17. >
  18. <div class="dialogBox">
  19. <div class="dialogInfoTitle">{{ title }}</div>
  20. <div class="dialogInfo">
  21. <div class="infoRow">
  22. <span class="infoTitle">合同编号:</span>
  23. <span class="infoMsg">{{ contractForm.contractNo }}</span>
  24. </div>
  25. <div class="infoRow">
  26. <span class="infoTitle">关联载体:</span>
  27. <span class="infoMsg">{{ contractForm.houseName }}</span>
  28. </div>
  29. <div class="infoRow">
  30. <span class="infoTitle">合同起止日期:</span>
  31. <span class="infoMsg">{{ contractForm.startDate }} ~ {{contractForm.endDate}}</span>
  32. </div>
  33. </div>
  34. </div>
  35. </van-dialog>
  36. </div>
  37. </template>
  38. <script>
  39. import { getUserLocalStorageInfo, readListAll, userRead, getContractById } from "@/js_sdk/http.js"
  40. export default {
  41. onShow(){
  42. this.getList()
  43. },
  44. data(){
  45. return{
  46. msgList:[
  47. // {type:'合同到期提醒',info:'xxxxsssSSXX企业名称XXXX企业的合同即将到期请尽快续约.'}
  48. ],
  49. show:false,
  50. id: '',
  51. contractForm: {
  52. },
  53. title: ''
  54. }
  55. },
  56. methods:{
  57. getList(){
  58. this.msgList = []
  59. const data = {
  60. userId: getUserLocalStorageInfo().userId,
  61. types: '1'
  62. }
  63. readListAll(data).then(res=>{
  64. res.forEach(item=>{
  65. const json = this.getItemJson(item)
  66. this.msgList.push(json)
  67. })
  68. })
  69. },
  70. getItemJson(item){
  71. item.type = item.readType == '1' ? '合同到期提醒' : '未知'
  72. return item;
  73. },
  74. showDialog(item){
  75. if (item.type === '合同到期提醒'){
  76. this.show = true
  77. this.title = item.title
  78. this.id = item.id
  79. const data = {
  80. id: item.routeParam.replace('id=','')
  81. }
  82. getContractById(data).then(res=>{
  83. this.contractForm = res
  84. })
  85. }
  86. },
  87. confirm(){
  88. const data = {
  89. id:this.id,
  90. userId: getUserLocalStorageInfo().userId
  91. }
  92. userRead(data).then(res=>{
  93. this.show = false
  94. this.getList()
  95. })
  96. }
  97. }
  98. }
  99. </script>
  100. <style lang="scss">
  101. .secureselftest{
  102. .toReadItem{
  103. margin-top: 24rpx;
  104. margin-left: 32rpx;
  105. display: flex;
  106. flex-direction: column;
  107. background: white;
  108. width: 686rpx;
  109. padding: 32rpx;
  110. box-sizing: border-box;
  111. border-radius: 16rpx;
  112. .readTitle{
  113. color: rgba(3, 101, 249, 1);
  114. font-size: 28rpx;
  115. }
  116. .readInfo{
  117. color: rgba(51, 51, 51, 1);
  118. font-size: 28rpx;
  119. line-height: 42rpx;
  120. padding: 16rpx 0;
  121. }
  122. .readTime{
  123. color: rgba(102, 102, 102, 1);
  124. font-size: 28rpx;
  125. }
  126. }
  127. .dialogBox{
  128. padding: 36rpx 24rpx;
  129. .dialogInfoTitle{
  130. color:rgba(53, 53, 53, 1);
  131. font-size: 32rpx;
  132. line-height: 48rpx;
  133. margin-bottom: 32rpx;
  134. }
  135. .dialogInfo{
  136. background: rgba(245, 247, 250, 1);
  137. border-radius: 8rpx;
  138. width: 592rpx;
  139. padding: 20rpx 16rpx;
  140. box-sizing: border-box;
  141. .infoRow{
  142. display: flex;
  143. align-items: center;
  144. line-height: 50rpx;
  145. }
  146. .infoTitle{
  147. width: 196rpx;
  148. font-size: 28rpx;
  149. color: rgba(51, 51, 51, 1);
  150. }
  151. .infoMsg{
  152. color:rgba(102, 102, 102, 1);
  153. font-size: 28rpx;
  154. }
  155. }
  156. }
  157. }
  158. </style>