card.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. <template>
  2. <view >
  3. <view class="recommend-info" >
  4. <view class="goods-list">
  5. <view @click="showDetail(item)" class="list" v-for="(item,index) in list" :key="index">
  6. <view class="pictrue" >
  7. <!-- 入场记录 -->
  8. <image v-if="current==0" :src="item.enterImgPath?item.enterImgPath:'/static/index/noimg3.png'" mode="scaleToFill"></image>
  9. <!-- 出场记录 -->
  10. <image v-if="current==1" :src="item.outImgPath?item.outImgPath:'/static/index/noimg3.png'" mode="scaleToFill"></image>
  11. <view class="car">{{item.carNo}}</view>
  12. </view>
  13. <view class="content">
  14. <view>
  15. <u-icon style="margin-right: 15rpx;" name="clock-fill" color="#5064eb" size="34"></u-icon>
  16. <text>进:{{formatDate(item.enterTime)}}</text>
  17. </view>
  18. <!-- 出场时间 -->
  19. <view v-if="current==1" style="padding-top: 8rpx;">
  20. <text class="cuIcon-timefill base-color margin-right-10"></text>
  21. <text>出:{{formatDate(item.outTime)}}</text>
  22. </view>
  23. <!-- 入场车道 -->
  24. <view v-if="current==0" style="padding-top: 8rpx;">
  25. <u-icon style="margin-right: 10rpx;" name="map-fill" color="#5064eb" size="36"></u-icon>
  26. <text>{{item.enterGateName}}</text>
  27. </view>
  28. <view class="flex justify-center" style="margin: 20rpx 0 0;">
  29. <view class="cu-btn base-line round df" style="width: 70%;">
  30. 查看详情
  31. </view>
  32. </view>
  33. </view>
  34. </view>
  35. </view>
  36. </view>
  37. </view>
  38. </template>
  39. <script>
  40. export default {
  41. props:{
  42. list: {
  43. type: Array,
  44. default: () => {
  45. return []
  46. }
  47. },
  48. current: {
  49. type: Number,
  50. default: () => {
  51. return 0
  52. }
  53. },
  54. },
  55. data() {
  56. return {
  57. }
  58. },
  59. computed:{
  60. formatDate(){
  61. return val=>{
  62. if (this.$isEmpty(val)) {
  63. return '未知'
  64. }
  65. return this.$u.timeFormat(new Date(val).getTime(), 'mm-dd hh:MM:ss')
  66. }
  67. },
  68. },
  69. methods: {
  70. showDetail(item){
  71. uni.navigateTo({
  72. url:"/pages/index/car/detail?id="+item.id+"&current="+this.current
  73. })
  74. }
  75. }
  76. }
  77. </script>
  78. <style lang="scss" scoped>
  79. /* 为你推荐 */
  80. .recommend-info{
  81. width: 100%;
  82. .recommend-title{
  83. display: flex;
  84. align-items: center;
  85. justify-content: center;
  86. width: 100%;
  87. height: 100rpx;
  88. .title{
  89. display: flex;
  90. align-items: center;
  91. image{
  92. width: 416rpx;
  93. height: 40rpx;
  94. }
  95. }
  96. }
  97. .goods-list{
  98. display: flex;
  99. flex-wrap: wrap;
  100. justify-content: space-between;
  101. padding: 0 30rpx;
  102. .list{
  103. width: 49%;
  104. height: 540rpx;
  105. margin-bottom: 20rpx;
  106. background-color: #FFFFFF;
  107. border-radius: 10rpx;
  108. overflow: hidden;
  109. .pictrue{
  110. width: 100%;
  111. position: relative;
  112. image{
  113. border-top-right-radius: 12rpx;
  114. border-top-left-radius: 12rpx;
  115. height: 330rpx;
  116. }
  117. .car{
  118. position: absolute;
  119. bottom: 20rpx;
  120. left: 10rpx;
  121. color: #FFFFFF;
  122. }
  123. }
  124. .content{
  125. padding: 20rpx;
  126. text{
  127. padding: 10rpx 0;
  128. }
  129. }
  130. }
  131. }
  132. }
  133. </style>