productItem.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. <template>
  2. <div class="product-item-box">
  3. <div class="product-item" @click="clickItem">
  4. <div class="product-item-image" :style="'background-image: url('+imageUrl(item.listDisplayImage)+');'">
  5. </div>
  6. <div class="product-content">
  7. <div class="product-item-title hui-ellipsis">{{item.name}}</div>
  8. <div class="space" v-if="item.subtitle">{{item.subtitle}}</div>
  9. <div class="bottom">
  10. <div class="organization">
  11. <i class="el-icon-user-solid"></i>
  12. <span>{{item.organizationName}}</span>
  13. </div>
  14. <div class="pirce">
  15. <span class="number">{{item.price}}</span>
  16. <span class="unit">元/次</span>
  17. </div>
  18. </div>
  19. </div>
  20. </div>
  21. </div>
  22. </template>
  23. <script>
  24. import Crypto from '@/uitls/crypto'
  25. export default {
  26. props: ['item'],
  27. methods: {
  28. imageUrl(data) {
  29. if (data && JSON.parse(data)[0]) return JSON.parse(data)[0].url;
  30. return 'https://assets.api.uizard.io/api/cdn/stream/c05650d2-192b-4a56-ae97-05638f53804c.png';
  31. },
  32. clickItem() {
  33. let id = Crypto.AES.encrypt(String(this.item.id), 'bosshand');
  34. this.$router.push('/website/serveDetail?sign=' + encodeURIComponent(id));
  35. }
  36. }
  37. }
  38. </script>
  39. <style lang="scss">
  40. .product-item-box {
  41. width: 25%;
  42. padding: 10px;
  43. }
  44. .product-item {
  45. width: 100%;
  46. background: $--color-white;
  47. border-radius: 8px;
  48. box-sizing: border-box;
  49. position: relative;
  50. cursor: pointer;
  51. box-shadow: 0px 1px 12px rgba(3, 3, 3, 0.1);
  52. overflow: hidden;
  53. padding: 15px;
  54. box-sizing: border-box;
  55. .product-item-image {
  56. width: 100%;
  57. height: 160px;
  58. overflow: hidden;
  59. border-radius: 8px;
  60. background-repeat: no-repeat;
  61. background-size: cover;
  62. background-position: center center;
  63. }
  64. .product-content {
  65. padding-top: 15px;
  66. }
  67. .product-item-title {
  68. font-size: 16px;
  69. font-weight: 600;
  70. }
  71. .bottom {
  72. display: flex;
  73. justify-content: space-between;
  74. align-items: flex-end;
  75. }
  76. .space {
  77. color: $--color-text-regular;
  78. font-size: $--font-size-small;
  79. margin: 7px 0;
  80. -webkit-line-clamp: 2;
  81. display: -webkit-box;
  82. -webkit-box-orient: vertical;
  83. overflow: hidden;
  84. text-overflow: ellipsis;
  85. }
  86. .organization {
  87. color: $--color-text-regular;
  88. font-size: $--font-size-small;
  89. opacity: 0.7;
  90. line-height: 14px;
  91. }
  92. .pirce {
  93. color: $--color-danger;
  94. display: flex;
  95. align-items: end;
  96. .number {
  97. font-size: 20px;
  98. font-weight: 600;
  99. height: 20px;
  100. }
  101. .unit {
  102. height: 15px;
  103. font-size: 12px;
  104. }
  105. }
  106. }
  107. </style>