敢为人鲜小程序前端代码仓库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

125 lines
2.0 KiB

5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
  1. <template>
  2. <view class="item" @click="$emit('click')"
  3. :style="{width}">
  4. <view class="item-image">
  5. <image :src="item.image &&
  6. item.image.split(',')[0]" mode="aspectFill">
  7. </image>
  8. </view>
  9. <view class="info">
  10. <view class="title"
  11. :style="{width : titleWidth}">
  12. {{ item.title }}
  13. </view>
  14. <view class="desc">
  15. {{ item.sku }}
  16. </view>
  17. <view class="price"
  18. v-if="[2].includes(item.type)">
  19. <view class="">
  20. 会员价<text>{{ item.vipPrice }}</text>
  21. </view>
  22. <view class="">
  23. 零售价<text>{{ item.price }}</text>
  24. </view>
  25. </view>
  26. <view class="price"
  27. v-else>
  28. <view class="">
  29. 价格<text>{{ item.price }}</text>
  30. </view>
  31. <view class="">
  32. 原价<text>{{ item.oldPrice }}</text>
  33. </view>
  34. </view>
  35. </view>
  36. </view>
  37. </template>
  38. <script>
  39. export default {
  40. props: {
  41. item: {
  42. default: {}
  43. },
  44. width : {
  45. default : '100%',
  46. },
  47. titleWidth : {
  48. default : '100px'
  49. },
  50. },
  51. data() {
  52. return {
  53. }
  54. },
  55. methods: {
  56. }
  57. }
  58. </script>
  59. <style scoped lang="scss">
  60. .item {
  61. padding: 10rpx 20rpx;
  62. align-items: center;
  63. margin-bottom: 20rpx;
  64. display: flex;
  65. box-sizing: border-box;
  66. border-bottom: 1rpx solid #00000012;
  67. background: white;
  68. .item-image {
  69. width: 140rpx;
  70. height: 140rpx;
  71. flex-shrink: 0;
  72. image {
  73. height: 100%;
  74. width: 100%;
  75. border-radius: 20rpx;
  76. }
  77. }
  78. .info {
  79. padding: 20rpx;
  80. color: #555;
  81. flex: 1;
  82. .title {
  83. width: 300rpx;
  84. font-size: 28rpx;
  85. font-weight: 900;
  86. overflow:hidden; //超出的文本隐藏
  87. text-overflow:ellipsis; //溢出用省略号显示
  88. white-space:nowrap; //溢出不换行
  89. }
  90. .desc {
  91. font-size: 22rpx;
  92. color: #777;
  93. margin-top: 10rpx;
  94. }
  95. .price {
  96. text-align: right;
  97. color: #f40;
  98. font-size: 26rpx;
  99. text{
  100. font-size: 30rpx;
  101. font-weight: 900;
  102. }
  103. &>view:nth-child(2){
  104. font-size: 22rpx;
  105. color: #777;
  106. text{
  107. font-size: 26rpx;
  108. font-weight: 900;
  109. }
  110. }
  111. }
  112. }
  113. }
  114. </style>