t-goods-item.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. <template>
  2. <view class="tui-goods__item" :class="{ 'tui-full__item': isList }"
  3. @tap="detail(navigateTo+'?msid='+item.id+'&id='+item.goods_id)">
  4. <view class="tui-image__box" :class="{ 'tui-full__imgbox': isList }">
  5. <image class="tui-goods__img" :class="{ 'tui-full__img': isList }" :src="item.image" mode="widthFix">
  6. </image>
  7. </view>
  8. <view class="tui-goods__content" :class="{ 'tui-full__content': isList }">
  9. <view class="tui-goods__title">{{ item.title || '' }}</view>
  10. <view class="tui-tag__box" v-if="item.newGuest && !isList">
  11. <tui-tag plain size="24rpx" type="red" padding="8rpx 12rpx">新客专享</tui-tag>
  12. </view>
  13. <view class="tui-box__bottom">
  14. <view class="tui-price__box">
  15. <view class="tui-price">
  16. <view class="tui-price__small">¥</view>
  17. <view class="tui-price__large">{{ item.price }}</view>
  18. </view>
  19. <view v-if="item.goods.price>0" class="tui-price__original">¥{{ item.goods.price || '0.00' }}</view>
  20. </view>
  21. <view :style="{ opacity: item.subscribe && status==3 ? 0.5 : 1 }">
  22. <tui-button :width="status == 3 ? '146rpx' : '144rpx'" :height="status == 3 ? '60rpx' : '50rpx'"
  23. :size="status == 3 ? 26 : 24" :type="status == 1 ? 'gray' : 'danger'" :disabled="status == 1"
  24. :plain="status == 3">
  25. {{ status | getBtnText(item.subscribe) }}
  26. </tui-button>
  27. </view>
  28. </view>
  29. </view>
  30. <image v-if="item.newGuest && isList" src="/static/images/mall/img_seckill_newguest.png"
  31. class="tui-img__newguest" mode="widthFix"></image>
  32. </view>
  33. </template>
  34. <script>
  35. export default {
  36. name: 'tGoodsItem',
  37. props: {
  38. item: {
  39. type: Object,
  40. default () {
  41. return {};
  42. }
  43. },
  44. navigateTo: {
  45. type: String,
  46. default: '../goodsDetail/goodsDetail'
  47. },
  48. //是否为列表展示
  49. isList: {
  50. type: Boolean,
  51. default: false
  52. },
  53. //status:1-已结束,2-正在进行,3-即将开枪
  54. status: {
  55. type: Number,
  56. default: 2
  57. }
  58. },
  59. filters: {
  60. getBtnText(status, subscribe) {
  61. status = status || 1;
  62. let text = ['活动已结束', '立即抢购', '立即预约'][status - 1];
  63. if (status == 3 && subscribe) {
  64. text = '取消预约';
  65. }
  66. return text;
  67. }
  68. },
  69. computed: {
  70. },
  71. data() {
  72. return {};
  73. },
  74. methods: {
  75. detail(url) {
  76. //项目中应该传id
  77. this.tui.href(url)
  78. }
  79. }
  80. };
  81. </script>
  82. <style scoped>
  83. .tui-goods__item {
  84. width: 100%;
  85. padding: 20rpx 20rpx 36rpx;
  86. box-sizing: border-box;
  87. border-radius: 12rpx;
  88. background-color: #fff;
  89. margin-bottom: 4%;
  90. position: relative;
  91. }
  92. .tui-full__item {
  93. display: flex;
  94. margin-bottom: 20rpx !important;
  95. padding: 20rpx !important;
  96. }
  97. .tui-img__newguest {
  98. position: absolute;
  99. width: 96rpx;
  100. height: 32rpx;
  101. left: 0;
  102. top: 8rpx;
  103. }
  104. .tui-image__box {
  105. width: 100%;
  106. height: 300rpx;
  107. }
  108. .tui-full__imgbox {
  109. width: 240rpx !important;
  110. height: 240rpx !important;
  111. margin-right: 20rpx;
  112. }
  113. .tui-goods__img {
  114. max-width: 100%;
  115. max-height: 300rpx;
  116. display: block;
  117. border-radius: 8rpx;
  118. }
  119. .tui-full__img {
  120. max-height: 240rpx !important;
  121. }
  122. .tui-goods__content {
  123. width: 100%;
  124. padding-top: 16rpx;
  125. }
  126. .tui-full__content {
  127. height: 240rpx;
  128. display: flex;
  129. flex-direction: column;
  130. justify-content: space-between;
  131. padding-top: 0 !important;
  132. }
  133. .tui-goods__title {
  134. font-size: 26rpx;
  135. font-weight: 400;
  136. color: #333;
  137. word-break: break-all;
  138. overflow: hidden;
  139. text-overflow: ellipsis;
  140. display: -webkit-box;
  141. -webkit-box-orient: vertical;
  142. -webkit-line-clamp: 2;
  143. margin-bottom: 20rpx;
  144. }
  145. .tui-tag__box {
  146. display: flex;
  147. padding-bottom: 25rpx;
  148. }
  149. .tui-box__bottom {
  150. width: 100%;
  151. display: flex;
  152. align-items: center;
  153. justify-content: space-between;
  154. }
  155. .tui-price__box {
  156. display: flex;
  157. flex-direction: column;
  158. align-items: center;
  159. justify-content: center;
  160. }
  161. .tui-price {
  162. display: flex;
  163. align-items: flex-end;
  164. color: #eb0909;
  165. }
  166. .tui-price__small {
  167. font-size: 24rpx;
  168. line-height: 24rpx;
  169. }
  170. .tui-price__large {
  171. font-size: 34rpx;
  172. line-height: 32rpx;
  173. font-weight: 600;
  174. }
  175. .tui-price__original {
  176. font-size: 24rpx;
  177. line-height: 24rpx;
  178. text-decoration: line-through;
  179. color: #999;
  180. padding-top: 10rpx;
  181. }
  182. </style>