item.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  1. <template>
  2. <view class="box-container">
  3. <view class="box-head">
  4. <view class="box-head-title">
  5. <image :src="$getImages(`${boxIcon}`)" class="box-head-img" />
  6. {{renderItem(item,'msgTypeName','--')}}
  7. </view>
  8. <view class="box-head-action">
  9. </view>
  10. </view>
  11. <view class="box-body" @click="handleDetaisl(item)">
  12. <u-row>
  13. <u-col :span="12">
  14. <!-- 保险到期 -->
  15. <template v-if="item.msgType == 1">
  16. <view class="item">
  17. <view class="label">
  18. 车辆{{item.objName}}保险到期时间为
  19. <text :class="{
  20. 'red': item.restDay < 0,
  21. 'orange': item.restDay >= 0,
  22. }">{{item.dueTime}}</text>
  23. </view>
  24. </view>
  25. <view class="item">
  26. <view class="label">
  27. 距离到期时间
  28. <text :class="{
  29. 'red': item.restDay < 0,
  30. 'orange': item.restDay >= 0,
  31. }">{{item.distanceDay}}</text>
  32. </view>
  33. </view>
  34. </template>
  35. <!-- 年检到期 -->
  36. <template v-else-if="item.msgType == 2">
  37. <view class="item">
  38. <view class="label">
  39. 车辆{{item.objName}}年检到期时间为
  40. <text :class="{
  41. 'red': item.restDay < 0,
  42. 'orange': item.restDay >= 0,
  43. }">{{item.dueTime}}</text>
  44. </view>
  45. </view>
  46. <view class="item">
  47. <view class="label">
  48. 距离到期时间
  49. <text :class="{
  50. 'red': item.restDay < 0,
  51. 'orange': item.restDay >= 0,
  52. }">{{item.distanceDay}}</text>
  53. </view>
  54. </view>
  55. </template>
  56. <!-- 保养到期 -->
  57. <template v-else-if="item.msgType == 3">
  58. <view class="item">
  59. <view class="label">
  60. 车辆{{item.objName}}保养到期时间为
  61. <text :class="{
  62. 'red': item.restDay < 0,
  63. 'orange': item.restDay >= 0,
  64. }">{{item.dueTime}}</text>
  65. </view>
  66. </view>
  67. <view class="item">
  68. <view class="label">
  69. 距离到期时间
  70. <text :class="{
  71. 'red': item.restDay < 0,
  72. 'orange': item.restDay >= 0,
  73. }">{{item.distanceDay}}</text>
  74. </view>
  75. </view>
  76. </template>
  77. <!-- 驾驶证到期 -->
  78. <template v-else-if="item.msgType == 4">
  79. <view class="item">
  80. <view class="label">
  81. {{item.objName}}驾驶证到期时间为
  82. <text :class="{
  83. 'red': item.restDay < 0,
  84. 'orange': item.restDay >= 0,
  85. }">{{item.dueTime}}</text>
  86. </view>
  87. </view>
  88. <view class="item">
  89. <view class="label">
  90. 距离到期时间
  91. <text :class="{
  92. 'red': item.restDay < 0,
  93. 'orange': item.restDay >= 0,
  94. }">{{item.distanceDay}}</text>
  95. </view>
  96. </view>
  97. </template>
  98. </u-col>
  99. </u-row>
  100. </view>
  101. <view class="box-footer">
  102. <u-row style="justify-content: flex-end;">
  103. <u-col :span="4" style="padding: 20rpx 30rpx;">
  104. <u-button type="primary"
  105. :custom-style="{
  106. width: '100%',
  107. height: '28px',
  108. }"
  109. plain
  110. shape="circle"
  111. @click="handleOper(item)">处理
  112. </u-button>
  113. </u-col>
  114. </u-row>
  115. </view>
  116. </view>
  117. </template>
  118. <script>
  119. import { renderItem } from '@/utils/gdtq'
  120. export default {
  121. components: {
  122. },
  123. props: {
  124. item: {
  125. type: Object,
  126. default: () => {}
  127. },
  128. },
  129. computed: {
  130. boxIcon() {
  131. if(this.item && this.item.msgType) {
  132. if(this.item.msgType == 1) {
  133. return '/assetsMobile/images/message/insurance.png'
  134. } else if(this.item.msgType == 2) {
  135. return '/assetsMobile/images/message/inspection.png'
  136. } else if(this.item.msgType == 3) {
  137. return '/assetsMobile/images/message/maintain.png'
  138. } else if(this.item.msgType == 4) {
  139. return '/assetsMobile/images/message/license.png'
  140. }
  141. } else {
  142. return ''
  143. }
  144. }
  145. },
  146. data() {
  147. return {}
  148. },
  149. methods: {
  150. handleOper(item) {
  151. this.$emit('handleOper',item)
  152. },
  153. handleDetaisl(item){
  154. return
  155. }
  156. },
  157. }
  158. </script>
  159. <style lang="scss" scoped>
  160. .box-container {
  161. background: #fff;
  162. margin: 20rpx 10rpx;
  163. border-radius: 20rpx;
  164. font-size: 24rpx;
  165. .box-head {
  166. border-bottom: 1px solid #ddd;
  167. padding: 20rpx;
  168. font-weight: 700;
  169. display: flex;
  170. justify-content: space-between;
  171. align-items: center;
  172. .box-head-title {
  173. flex: 1;
  174. font-size: 28rpx;
  175. display: flex;
  176. align-items: center;
  177. .box-head-img {
  178. flex-basis: 34rpx;
  179. flex-shrink: 0;
  180. width: 32rpx;
  181. height: 36rpx;
  182. margin-right: 10rpx;
  183. }
  184. }
  185. .box-head-action {
  186. flex-basis: 120rpx;
  187. }
  188. }
  189. .box-body {
  190. padding: 20rpx;
  191. .item {
  192. margin: 4rpx;
  193. display: flex;
  194. .label {
  195. }
  196. .value {
  197. flex: 1;
  198. }
  199. }
  200. }
  201. .box-footer {
  202. border-top: 1px solid #ddd;
  203. // padding: 20rpx;
  204. }
  205. }
  206. .primary {
  207. color: $uni-color-primary;
  208. }
  209. .red {
  210. color: #E44C4C;
  211. }
  212. .orange {
  213. color: #F7A254;
  214. }
  215. </style>