goods_item_h.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  1. <!-- 商品组件:横向展示,一行一个,商品列表页面
  2. 点击进入商品详情页
  3. 加入购物车事件
  4. -->
  5. <template name="goodsCollectItemH">
  6. <view class="goods_h_item flex_row_start_start" @click="goGoodsDetail(goods_info)">
  7. <view class="goods-img" :style="{backgroundImage: 'url('+goods_info.goodsImage+')'}"></view>
  8. <view class="right flex_column_between_start">
  9. <view class="top flex_column_start_start" style="width: 100%;">
  10. <view class="goods-name">
  11. <rich-text :nodes="goods_info.goodsName"></rich-text>
  12. </view>
  13. <text class="goods-brief">{{goods_info.goodsBrief}}</text>
  14. </view>
  15. <view class="activity_con" v-if="goods_info.activityList&&goods_info.activityList.length>0">
  16. <block v-for="(item,index) in goods_info.activityList">
  17. <view class="act_label ladder_group" v-if="item.promotionType==105">
  18. {{item.promotionName}}
  19. </view>
  20. <view class="act_label discounts" v-if="item.promotionType==201||item.promotionType==202||item.promotionType==203||item.promotionType==204">
  21. {{item.promotionName}}
  22. </view>
  23. <view class="act_label secKill" v-if="item.promotionType==104">
  24. {{item.promotionName}}
  25. </view>
  26. <view class="act_label preSale" v-if="item.promotionType==103">
  27. {{item.promotionName}}
  28. </view>
  29. <view class="act_label spellGroup" v-if="item.promotionType==102">
  30. {{item.promotionName}}
  31. </view>
  32. </block>
  33. </view>
  34. <view class="goods-price flex_row_start_center">
  35. <view class="left flex_row_start_center">
  36. <view class="left_price flex_row_start_end">
  37. <text class="unit">¥</text>
  38. <text class="price_int">{{this.$getPartNumber(goods_info.goodsPrice,'int')}}</text>
  39. <text class="price_decimal">{{this.$getPartNumber(goods_info.goodsPrice,'decimal')}}</text>
  40. </view>
  41. <text class="sales">{{$formatW(goods_info.saleNum)}}人付款</text>
  42. </view>
  43. </view>
  44. <view class="store_enter" @click.stop="goStoreDetail(goods_info.storeId)">
  45. <text class="stroe_name">{{goods_info.storeName}}</text>
  46. <text class="store_enter_btn">进店</text>
  47. <image class="store_enter_image" :src="imgUrl+'/good_search/enter_store.png'" mode=""></image>
  48. </view>
  49. </view>
  50. </view>
  51. </template>
  52. <script>
  53. export default {
  54. name: "goodsCollectItemH",
  55. data() {
  56. return {
  57. imgUrl: getApp().globalData.imgUrl
  58. }
  59. },
  60. props: {
  61. goods_info: {
  62. type: Object,
  63. value: {}
  64. }
  65. },
  66. created() {
  67. },
  68. methods: {
  69. //跳转店铺详情页面
  70. goStoreDetail(vid) {
  71. uni.navigateTo({
  72. url: '/pages/store/shopHomePage?vid=' + vid
  73. })
  74. },
  75. //进入商品详情页
  76. goGoodsDetail(goods_info) {
  77. uni.navigateTo({
  78. url: '/pages/product/detail?productId=' + goods_info.defaultProductId + '&goodsId=' + goods_info.goodsId
  79. })
  80. },
  81. }
  82. }
  83. </script>
  84. <style lang='scss'>
  85. .goods_h_item {
  86. width: 100%;
  87. background: #fff;
  88. padding:20rpx;
  89. overflow: hidden;
  90. background: #fff;
  91. border-top: 1rpx solid #f5f5f5;
  92. /* &:first-child {
  93. padding-top: 20rpx;
  94. } */
  95. .goods-img {
  96. background-size: cover;
  97. background-position: center center;
  98. background-repeat: no-repeat;
  99. width: 290rpx;
  100. height: 290rpx;
  101. overflow: hidden;
  102. border-radius: 10rpx;
  103. background-color: #F8F6F7;
  104. flex-shrink: 0;
  105. }
  106. .right {
  107. height: 290rpx;
  108. padding: 10rpx 0 0rpx;
  109. width: 420rpx;
  110. .top {
  111. padding-left: 20rpx;
  112. }
  113. }
  114. .goods-name {
  115. font-size: 30rpx;
  116. color: $com-main-font-color;
  117. line-height: 38rpx;
  118. height: 76rpx;
  119. overflow: hidden;
  120. text-overflow: ellipsis;
  121. display: -webkit-box;
  122. -webkit-line-clamp: 2;
  123. -webkit-box-orient: vertical;
  124. word-break: break-word;
  125. }
  126. .goods-brief {
  127. color: $main-third-color;
  128. font-size: 24rpx;
  129. margin-top: 10rpx;
  130. overflow: hidden;
  131. text-overflow: ellipsis;
  132. white-space: nowrap;
  133. width: 100%;
  134. }
  135. .goods-price {
  136. padding: 0 20rpx;
  137. width: 100%;
  138. margin-top: 15rpx;
  139. .left {
  140. color: $main-color;
  141. .left_price {
  142. align-items: baseline;
  143. }
  144. .unit,
  145. .price_decimal {
  146. font-size: 24rpx;
  147. }
  148. .price_int {
  149. font-size: 34rpx;
  150. }
  151. .sales {
  152. color: $main-third-color;
  153. font-size: 22rpx;
  154. margin-left: 26rpx;
  155. margin-top: 2rpx;
  156. }
  157. }
  158. image {
  159. width: 42rpx;
  160. height: 42rpx;
  161. }
  162. }
  163. }
  164. .activity_con {
  165. display: flex;
  166. font-size: 22rpx;
  167. color: #ffffff;
  168. padding-left: 20rpx;
  169. .act_label{
  170. height: 32rpx;
  171. border-radius: 15rpx;
  172. line-height: 32rpx;
  173. padding: 0 10rpx;
  174. margin-left: 10rpx;
  175. }
  176. .ladder_group{
  177. background: linear-gradient(22deg, #FE901E 0%, #FEAD28 100%);
  178. }
  179. .discounts {
  180. background: linear-gradient(17deg, #AB32CC 0%, #D20FA6 100%);
  181. }
  182. .secKill{
  183. background: linear-gradient(to right, #fc5300, #ff1353);
  184. }
  185. .preSale{
  186. background: linear-gradient(to right, #a62fcd, #ff006c);
  187. }
  188. .act_label:nth-child(1) {
  189. margin-left: 0rpx;
  190. }
  191. .spellGroup{
  192. background: linear-gradient(to right, #ff6000, #ff9c00);
  193. }
  194. }
  195. .store_enter {
  196. display: flex;
  197. font-size: 24rpx;
  198. align-items: center;
  199. padding-left: 20rpx;
  200. }
  201. .stroe_name {
  202. max-width: 200rpx;
  203. white-space: nowrap;
  204. overflow: hidden;
  205. text-overflow: ellipsis;
  206. color: #666666;
  207. }
  208. .store_enter_btn {
  209. color: #333333;
  210. font-weight: bold;
  211. margin-left: 10rpx;
  212. }
  213. .store_enter_image {
  214. width: 11rpx;
  215. height: 19rpx;
  216. margin-left: 10rpx;
  217. }
  218. </style>