recommend_item_v.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. <!-- 推荐商品组件 -->
  2. <template name="goodsItemV">
  3. <view class="goods_v_item flex_column_start_start" @click="goGoodsDetail(goods_info)" :style="{width:'calc((750rpx - '+page_margin*4+'rpx - '+goods_margin*2+'rpx)/2)',borderRadius:border_radius+'px',border:border_style == 'border_eee'?'1rpx solid #eee':'',boxShadow:border_style == 'card-shadow'?'rgba(93, 113, 127, 0.08) 0px 2px 8px':''}">
  4. <view class="goods_desc_top" :style="{height:height+'px'}">
  5. <view class="goods-img" :style="{backgroundImage: 'url('+(goods_info.mainImage||goods_info.goodsImage)+')',width:'calc((750rpx - '+page_margin*4+'rpx - '+goods_margin*2+'rpx)/2)',borderTopLeftRadius:border_radius+'px',borderTopRightRadius:border_radius+'px'}"></view>
  6. <text class="goods-name">{{goods_info.goodsName}}</text>
  7. <view class="goods_des">{{goods_info.goodsBrief}}</view>
  8. </view>
  9. <view class="goods_desc_bottom">
  10. <view class="goods_price" v-if="goods_info.marketPrice">
  11. <text>¥</text>
  12. <text>{{this.$getPartNumber(goods_info.marketPrice,'int')}}</text>
  13. <text>{{this.$getPartNumber(goods_info.marketPrice,'decimal')}}</text>
  14. </view>
  15. <view class="goods_price_point" v-if="goods_info.integralPrice || goods_info.cashPrice">
  16. <text v-if="goods_info.integralPrice">{{goods_info.integralPrice}}{{$L('积分')}}</text>
  17. <text v-if="goods_info.integralPrice && goods_info.cashPrice">+</text>
  18. <text v-if="goods_info.cashPrice && (goods_info.integralPrice.toString().length + goods_info.cashPrice.toString().length) <= 14">¥{{filters.toFix(goods_info.cashPrice)}}</text>
  19. <text v-if="(goods_info.integralPrice.toString().length + goods_info.cashPrice.toString().length) > 14">¥...</text>
  20. </view>
  21. </view>
  22. </view>
  23. </template>
  24. <script module="filters" lang="wxs" src="../../../utils/filter.wxs"></script>
  25. <script>
  26. import {
  27. mapState,
  28. } from 'vuex';
  29. export default {
  30. name: "goodsItemV",
  31. data() {
  32. return {
  33. imgUrl: getApp().globalData.imgUrl,
  34. icon2:getApp().globalData.imgUrl+'index/add2.png',
  35. icon3:getApp().globalData.imgUrl+'index/add.png',
  36. icon4:getApp().globalData.imgUrl+'index/add3.png',
  37. icon5:getApp().globalData.imgUrl+'index/stop.png',
  38. icon_url:'', //加车图标
  39. goods_pic:'' , //商品图片
  40. goods_sale:'' //销量
  41. }
  42. },
  43. computed: {
  44. ...mapState(['userInfo'])
  45. },
  46. props: {
  47. goods_info: {
  48. type: Object,
  49. value: {}
  50. },
  51. icon_type:{
  52. type:Number,
  53. },
  54. border_radius:{
  55. type:Number
  56. },
  57. border_style:{
  58. type:String
  59. },
  60. // 商品边距
  61. goods_margin:{
  62. type:Number,
  63. default:10
  64. },
  65. // 页面边距
  66. page_margin:{
  67. type:Number,
  68. default:10
  69. },
  70. height:{
  71. type:Number,
  72. default:258
  73. }
  74. },
  75. methods: {
  76. //进入商品详情页
  77. goGoodsDetail(goods_info) {
  78. uni.navigateTo({
  79. url: '/standard/point/product/detail?productId=' + (goods_info.defaultProductId?goods_info.defaultProductId:goods_info.productId)
  80. })
  81. }
  82. },
  83. }
  84. </script>
  85. <style lang='scss'>
  86. .goods_v_item {
  87. background: #fff;
  88. border-radius: 14rpx;
  89. overflow: hidden;
  90. margin-bottom: 20rpx;
  91. width: 345rpx;
  92. height: 589rpx;
  93. display: flex;
  94. flex-direction: column;
  95. justify-content: space-between;
  96. padding: 0 0 20rpx;
  97. box-sizing: border-box;
  98. &{
  99. margin-right:0 !important;
  100. }
  101. .goods_desc_top{
  102. .goods-img {
  103. background-size: cover;
  104. background-position: center center;
  105. background-repeat: no-repeat;
  106. width: 345rpx;
  107. height: 345rpx;
  108. overflow: hidden;
  109. background-color: #fff;
  110. }
  111. .goods-name {
  112. height: 80rpx;
  113. margin-top: 20rpx;
  114. font-size: 28rpx;
  115. color: $com-main-font-color;
  116. line-height: 40rpx;
  117. overflow: hidden;
  118. text-overflow: ellipsis;
  119. display: -webkit-box;
  120. -webkit-line-clamp: 2;
  121. -webkit-box-orient: vertical;
  122. word-break: break-word;
  123. padding: 0 20rpx;
  124. }
  125. .goods_des{
  126. font-size: 24rpx;
  127. font-family: PingFang SC;
  128. font-weight: 500;
  129. color: #888888;
  130. line-height: 36rpx;
  131. padding: 0 20rpx;
  132. box-sizing: border-box;
  133. width: 355rpx;
  134. overflow: hidden;
  135. text-overflow:ellipsis;
  136. white-space: nowrap;
  137. }
  138. }
  139. .goods_desc_bottom{
  140. padding-left: 20rpx;
  141. .goods_price{
  142. font-size: 24rpx;
  143. font-family: PingFang SC;
  144. font-weight: 500;
  145. text-decoration: line-through;
  146. color: #999999;
  147. margin-bottom: 20rpx;
  148. }
  149. .goods_price_point{
  150. height: 35rpx;
  151. background: $point-good-price-color;
  152. border-radius: 18px;
  153. padding: 0 13rpx;
  154. font-size: 24rpx;
  155. font-family: PingFang SC;
  156. font-weight: 500;
  157. color: #FFFFFF;
  158. line-height: 35rpx;
  159. white-space: nowrap;
  160. }
  161. }
  162. }
  163. </style>