goods_collect_item_h.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  1. <!-- 商品组件:横向展示,一行一个,商品列表页面
  2. 点击进入商品详情页
  3. 加入购物车事件
  4. -->
  5. <template name="goodsItemH">
  6. <view class="collection_wrap" :style="{left:left == true?'-160rpx':'0'}">
  7. <view class="goods_h_item flex_row_start_start" @click="goGoodsDetail(goods_info)">
  8. <view class="goods-img" :style="{backgroundImage: 'url('+goods_info.productImage+')'}"></view>
  9. <view class="right flex_column_between_start">
  10. <view class="top flex_column_start_start" style="width: 100%;">
  11. <text class="goods-name">{{goods_info.goodsName}}</text>
  12. <text class="goods-brief">{{goods_info.goodsBrief}}</text>
  13. </view>
  14. <view class="goods-price flex_row_between_center">
  15. <view class="left flex_row_start_end">
  16. <text class="unit">¥</text>
  17. <text class="price_int">{{this.$getPartNumber(goods_info.productPrice,'int')}}</text>
  18. <text class="price_decimal">{{this.$getPartNumber(goods_info.productPrice,'decimal')}}</text>
  19. </view>
  20. </view>
  21. </view>
  22. </view>
  23. <!-- #ifdef H5 -->
  24. <view class="operate_wrap" :style="{paddingTop:isWeiXinBrower?'20rpx':'74rpx'}">
  25. <view class="to_shop_btn operate_btn" @click.stop="toShopDetail(goods_info.storeId)">去店铺</view>
  26. <view class="share_btn operate_btn" @click.stop="goShare(goods_info)" v-if="isWeiXinBrower">分享</view>
  27. <view class="delete_btn operate_btn" @click.stop="delGoods(goods_info.productId)">删除</view>
  28. </view>
  29. <!-- #endif -->
  30. <!-- #ifndef H5 -->
  31. <view class="operate_wrap">
  32. <view class="to_shop_btn operate_btn" @click.stop="toShopDetail(goods_info.storeId)">去店铺</view>
  33. <view class="share_btn operate_btn" @click.stop="goShare(goods_info)">分享</view>
  34. <view class="delete_btn operate_btn" @click.stop="delGoods(goods_info.productId)">删除</view>
  35. </view>
  36. <!-- #endif -->
  37. </view>
  38. </template>
  39. <script>
  40. export default {
  41. name: "goodsItemH",
  42. data() {
  43. return {
  44. is_show_btn:false, //是否展示
  45. followId:'',
  46. startX:'',
  47. startY:'',
  48. }
  49. },
  50. props: {
  51. goods_info: {
  52. type: Object,
  53. value: {}
  54. },
  55. isWeiXinBrower:{
  56. type:Boolean
  57. },
  58. left:{
  59. type:Boolean
  60. }
  61. },
  62. methods: {
  63. //分享商品
  64. goShare(goods_info){
  65. this.$emit("goShare",goods_info)
  66. },
  67. //进入商品详情页
  68. goGoodsDetail(goods_info) {
  69. uni.navigateTo({
  70. url: '/pages/product/detail?productId=' + goods_info.productId + '&goodsId='+goods_info.goodsId
  71. })
  72. },
  73. //删除收藏商品
  74. delGoods(id) {
  75. this.$emit("delGoods", id);
  76. },
  77. toShopDetail(storeId){
  78. uni.navigateTo({
  79. url: '/pages/store/shopHomePage?vid=' + storeId
  80. })
  81. }
  82. }
  83. }
  84. </script>
  85. <style lang='scss'>
  86. .collection_wrap{
  87. position:relative;
  88. transition: all 0.3s;
  89. }
  90. .goods_h_item {
  91. width: 750rpx;
  92. background: #fff;
  93. padding: 0 20rpx 20rpx;
  94. overflow: hidden;
  95. background: #fff;
  96. /* position: absolute; */
  97. &:first-child {
  98. padding-top: 20rpx;
  99. }
  100. border-bottom: 2px solid #f5f5f5;
  101. .goods-img {
  102. background-size: contain;
  103. background-position: center center;
  104. background-repeat: no-repeat;
  105. width: 290rpx;
  106. height: 290rpx;
  107. overflow: hidden;
  108. border-radius: 10rpx;
  109. background-color: #F8F6F7;
  110. flex-shrink: 0;
  111. }
  112. .right {
  113. height: 290rpx;
  114. padding: 10rpx 0 30rpx;
  115. width: 420rpx;
  116. .top {
  117. padding-left: 20rpx;
  118. }
  119. }
  120. .goods-name {
  121. font-size: 30rpx;
  122. color: $com-main-font-color;
  123. line-height: 38rpx;
  124. height: 76rpx;
  125. overflow: hidden;
  126. text-overflow: ellipsis;
  127. display: -webkit-box;
  128. -webkit-line-clamp: 2;
  129. -webkit-box-orient: vertical;
  130. word-break: break-word;
  131. }
  132. .goods-brief {
  133. color: $main-third-color;
  134. font-size: 24rpx;
  135. margin-top: 10rpx;
  136. overflow: hidden;
  137. text-overflow: ellipsis;
  138. white-space: nowrap;
  139. width: 100%;
  140. }
  141. .goods-price {
  142. padding: 0 20rpx;
  143. width: 100%;
  144. margin-top: 15rpx;
  145. .left {
  146. color: $main-color;
  147. align-items: baseline;
  148. .unit,
  149. .price_decimal {
  150. font-size: 24rpx;
  151. }
  152. .price_int {
  153. font-size: 38rpx;
  154. line-height: 38rpx;
  155. }
  156. }
  157. .iconfont {
  158. font-size: 45rpx;
  159. color: $main-font-color;
  160. }
  161. image {
  162. width: 42rpx;
  163. height: 42rpx;
  164. }
  165. }
  166. }
  167. .operate_wrap{
  168. position:absolute;
  169. width:160rpx;
  170. height:330rpx;
  171. display: flex;
  172. flex-direction: column;
  173. right: -162rpx;
  174. top:0;
  175. padding-top:20rpx;
  176. background-color: #fff;
  177. box-sizing: border-box;
  178. .operate_btn{
  179. width:160rpx;
  180. height:96rpx;
  181. font-size:28rpx;
  182. color:#fff;
  183. display: flex;
  184. justify-content: center;
  185. align-items: center;
  186. background: #FF9518;
  187. transition: all 0.3s;
  188. }
  189. .share_btn{
  190. background: #FF9518;
  191. }
  192. .to_shop_btn{
  193. background: #FDBF19;
  194. border-top-right-radius: 10rpx;
  195. }
  196. .delete_btn{
  197. background: #FF0D24;
  198. border-bottom-right-radius: 10rpx;
  199. }
  200. }
  201. </style>