goods_history_item_h.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. <!-- 商品组件:横向展示,一行一个,商品列表页面
  2. 点击进入商品详情页
  3. 加入购物车事件
  4. -->
  5. <template name="goodsItemH">
  6. <view class="history_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.goodsImage+')'}"></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="{top:isWeiXinBrower?'20rpx':'92rpx'}">
  25. <view class="share_btn operate_btn" @click.stop="goShare(goods_info)" v-if="isWeiXinBrower">分享</view>
  26. <view class="delete_btn operate_btn" @click.stop="delGoods(goods_info.logId)">删除</view>
  27. </view>
  28. <!-- #endif -->
  29. <!-- #ifndef H5 -->
  30. <view class="operate_wrap" :style="{top:isWeiXinBrower?'92rpx':'20rpx'}">
  31. <view class="share_btn operate_btn" @click.stop="goShare(goods_info)">分享</view>
  32. <view class="delete_btn operate_btn" @click.stop="delGoods(goods_info.logId)">删除</view>
  33. </view>
  34. <!-- #endif -->
  35. </view>
  36. </template>
  37. <script>
  38. export default {
  39. name: "goodsItemH",
  40. data() {
  41. return {
  42. is_show_btn:false, //是否展示
  43. followId:'',
  44. startX:'',
  45. startY:'',
  46. }
  47. },
  48. props: {
  49. goods_info: {
  50. type: Object,
  51. value: {}
  52. },
  53. item_index: {
  54. type: Number,
  55. val: 0,
  56. },
  57. goods_index: {
  58. type: Number,
  59. val: 0,
  60. },
  61. isWeiXinBrower:{
  62. type:Boolean
  63. },
  64. left:{
  65. type:Boolean
  66. }
  67. },
  68. watch:{
  69. goods_info(newVal){
  70. },
  71. },
  72. methods: {
  73. //进入商品详情页
  74. goGoodsDetail(goods_info) {
  75. uni.navigateTo({
  76. url: '/pages/product/detail?productId=' + goods_info.productId + '&goodsId='+ goods_info.goodsId
  77. })
  78. },
  79. //删除足迹商品
  80. delGoods(id) {
  81. this.$emit("delGoods",this.item_index, this.goods_index,id);
  82. },
  83. //分享商品
  84. goShare(goods_info){
  85. this.$emit("goShare",goods_info)
  86. },
  87. }
  88. }
  89. </script>
  90. <style lang='scss'>
  91. .history_wrap{
  92. position:relative;
  93. transition: all 0.3s;
  94. }
  95. .goods_h_item {
  96. width: 100%;
  97. background: #fff;
  98. padding: 0 20rpx 20rpx;
  99. overflow: hidden;
  100. background: #fff;
  101. width: 750rpx;
  102. &:first-child {
  103. padding-top: 20rpx;
  104. }
  105. .goods-img {
  106. background-size: cover;
  107. background-position: center center;
  108. background-repeat: no-repeat;
  109. width: 290rpx;
  110. height: 290rpx;
  111. overflow: hidden;
  112. border-radius: 10rpx;
  113. background-color: #F8F6F7;
  114. flex-shrink: 0;
  115. }
  116. .right {
  117. height: 290rpx;
  118. padding: 10rpx 0 30rpx;
  119. width: 420rpx;
  120. .top {
  121. padding-left: 20rpx;
  122. }
  123. }
  124. .goods-name {
  125. font-size: 30rpx;
  126. color: $com-main-font-color;
  127. line-height: 38rpx;
  128. height: 76rpx;
  129. overflow: hidden;
  130. text-overflow: ellipsis;
  131. display: -webkit-box;
  132. -webkit-line-clamp: 2;
  133. -webkit-box-orient: vertical;
  134. word-break: break-word;
  135. }
  136. .goods-brief {
  137. color: $main-third-color;
  138. font-size: 24rpx;
  139. margin-top: 10rpx;
  140. overflow: hidden;
  141. text-overflow: ellipsis;
  142. white-space: nowrap;
  143. width: 100%;
  144. }
  145. .goods-price {
  146. padding: 0 20rpx;
  147. width: 100%;
  148. margin-top: 15rpx;
  149. .left {
  150. color: $main-color;
  151. align-items: baseline;
  152. .unit,
  153. .price_decimal {
  154. font-size: 24rpx;
  155. }
  156. .price_int {
  157. font-size: 38rpx;
  158. line-height: 38rpx;
  159. }
  160. }
  161. .iconfont {
  162. font-size: 45rpx;
  163. color: $main-font-color;
  164. }
  165. image {
  166. width: 42rpx;
  167. height: 42rpx;
  168. }
  169. }
  170. }
  171. .operate_wrap{
  172. position:absolute;
  173. width:160rpx;
  174. display: flex;
  175. flex-direction: column;
  176. right: -160rpx;
  177. top:20rpx;
  178. .operate_btn{
  179. width:160rpx;
  180. height:145rpx;
  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: #FF0D24;
  191. }
  192. }
  193. </style>