猎豆优选小程序

verticalGood.vue 9.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  1. <!-- 纵向商品 -->
  2. <template>
  3. <view class="goods-item-wrap" @click="onClickGoodsItem(goodsItem)">
  4. <view class="tp-wrap">
  5. <u-lazy-load class="goods-item-img" :image="goodsItem.img" img-mode="aspectFit" height="300" border-radius="10" />
  6. </view>
  7. <view class="bm-wrap">
  8. <view class="title">
  9. <image class="shop-icon" v-if="goodsItem.shop_type == 0" src="/static/imgs/icon-tb.png" />
  10. <image class="shop-icon" v-else-if="goodsItem.shop_type == 1" src="/static/imgs/icon-tmall.png" />
  11. <image class="shop-icon" v-else-if="goodsItem.shop_type == 4" src="/static/imgs/jd-icon.png" />
  12. <image class="shop-icon" v-else-if="goodsItem.shop_type == 6" src="/static/imgs/pdd-icon.png" />
  13. <image class="shop-icon" v-else-if="goodsItem.shop_type == 5" src="/static/imgs/icon-dy.png" />
  14. <text>{{ goodsItem.title }}</text>
  15. </view>
  16. <!-- <view class="shop-wrap">
  17. <image class="shop-icon" v-if="goodsItem.shop_type == 0" src="/static/imgs/icon-tb.png" />
  18. <image class="shop-icon" v-else-if="goodsItem.shop_type == 1" src="/static/imgs/icon-tmall.png" />
  19. <text class="shop-name">{{ goodsItem.shop_title }}</text>
  20. </view> -->
  21. <view class="shop-wrap flex-center-between">
  22. <view class="flex-center">
  23. <image class="shop-icon" src="/static/imgs/shop.png" />
  24. <view class="shop-name" :style="goodsItem.volume > 100 ? 'max-width: 100rpx' : ''">{{ goodsItem.shop_title }}</view>
  25. </view>
  26. <view class="salesVolume" v-if="goodsItem.volume > 100" :style="{ width: goodsItem.shop_type == 5 ? '240rpx' : '' }">
  27. 销量{{ $NumberHandle({value:goodsItem.volume,comma:true}) }}+
  28. </view>
  29. </view>
  30. <view class="price-wrap">
  31. <text class="price">{{ goodsItem.discount_price }}</text>
  32. <text class="start-price">¥{{goodsItem.price }}</text>
  33. </view>
  34. <!-- <view class="price-wrap">
  35. <text class="price">¥{{ goodsItem.discount_price }}</text>
  36. <text class="sales2">¥{{goodsItem.price }}</text>
  37. <text class="sales">月销 {{ goodsItem.volume }}</text>
  38. </view> -->
  39. <view class="btm-wrap">
  40. <view v-if="goodsItem.coupon_price > 0 && goodInfo.shop_type != 5" class="coupon-wrap">
  41. <text class="label">券</text>
  42. <text class="value">¥{{ goodsItem.coupon_price }}</text>
  43. </view>
  44. <view v-if="user_level > 1 && goodsItem.commission_price > 0" class="coupon-wrap commission-wrap" :style="goodsItem.coupon_price > 0 ? 'margin-left:12rpx' : ''">
  45. <text class="label">返</text>
  46. <text class="value">¥{{ goodsItem.commission_price }}</text>
  47. </view>
  48. </view>
  49. <!-- <view class="footer-wrap">
  50. <view v-if="user_level > 1 && goodsItem.commission_price > 0" class="commission-wrap">
  51. <text>返 ¥{{ goodsItem.commission_price }}</text>
  52. </view>
  53. <view v-if="goodsItem.coupon_price > 0" class="coupon-wrap">
  54. <text class="label">券</text>
  55. <text class="value">{{ goodsItem.coupon_price }}元</text>
  56. </view>
  57. </view> -->
  58. </view>
  59. </view>
  60. </template>
  61. <script>
  62. const app = getApp()
  63. export default {
  64. name:"verticalGood",
  65. props:{
  66. goodsItem:{
  67. type: Object
  68. },
  69. path:{
  70. type: String,
  71. default: ''
  72. },
  73. category_id:{
  74. type: String | Number,
  75. default: ''
  76. }
  77. },
  78. data() {
  79. return {
  80. user_level: uni.getStorageSync('userInfo') ? uni.getStorageSync('userInfo').user_level : '', // 当前用户等级
  81. };
  82. },
  83. methods:{
  84. onClickGoodsItem(goodsItem) {
  85. try{ app.categoryNew_countBuy({shop_type: goodsItem.shop_type, type:0,path:this.path,category_id:this.category_id}) }catch(e){} ; // 数据上报
  86. if (goodsItem.shop_type == 4) { // 京东
  87. const { img = '', goods_id = '', coupon_price = '', discount_price = '', price = '', is_coupon = '', commission_rate = '', is_high_commission = '', coupon_end_time = '', coupon_start_time = ''} = goodsItem
  88. // 京东商品新增参数
  89. // volume = '', commission_price = '', shop = null,
  90. uni.navigateTo({
  91. // url: `/pages/subPackages/home/jdGoodsDetail?img=${encodeURIComponent(img)}&goods_id=${encodeURIComponent(goods_id)}&coupon_price=${encodeURIComponent(coupon_price)}&discount_price=${encodeURIComponent(discount_price)}&price=${encodeURIComponent(price)}&is_coupon=${encodeURIComponent(is_coupon)}&commission_rate=${encodeURIComponent(commission_rate)}&is_high_commission=${encodeURIComponent(is_high_commission)}&coupon_end_time=${encodeURIComponent(coupon_end_time)}&coupon_start_time=${encodeURIComponent(coupon_start_time)}&volume=${encodeURIComponent(volume)}&commission_price=${encodeURIComponent(commission_price)}&shop=${shop ? encodeURIComponent(JSON.stringify(shop)) : ''}`
  92. url: `/pages/subPackages/home/jdGoodsDetail?goods_id=${encodeURIComponent(goods_id)}`
  93. })
  94. }else if(goodsItem.shop_type == 6) { // 拼多多
  95. const { img = '', goods_id = '', coupon_price = '', discount_price = '', price = '', is_coupon = '', commission_rate = '', is_high_commission = '', coupon_end_time = '', coupon_start_time = '' } = goodsItem
  96. uni.navigateTo({
  97. url: `/pages/subPackages/pdd/goodsDetail?goods_id=${encodeURIComponent(goods_id)}`
  98. })
  99. }else if(goodsItem.shop_type == 5){ // 抖音
  100. const { goods_id = ''} = goodsItem
  101. uni.navigateTo({
  102. url: `/pages/subPackages/dy/goodsDetail?goods_id=${encodeURIComponent(goods_id)}`
  103. })
  104. }else {
  105. const { img = '', goods_id = '', coupon_price = '', discount_price = '', price = '', is_coupon = '', commission_rate = '', is_high_commission = '', coupon_end_time = '', coupon_start_time = '' } = goodsItem
  106. uni.navigateTo({
  107. url: `/pages/subPackages/home/goodsDetail?img=${encodeURIComponent(img)}&goods_id=${encodeURIComponent(goods_id)}&coupon_price=${encodeURIComponent(coupon_price)}&discount_price=${encodeURIComponent(discount_price)}&price=${encodeURIComponent(price)}&is_coupon=${encodeURIComponent(is_coupon)}&commission_rate=${encodeURIComponent(commission_rate)}&is_high_commission=${encodeURIComponent(is_high_commission)}&coupon_end_time=${encodeURIComponent(coupon_end_time)}&coupon_start_time=${encodeURIComponent(coupon_start_time)}`
  108. })
  109. }
  110. },
  111. }
  112. }
  113. </script>
  114. <style scoped lang="scss">
  115. .salesVolume{
  116. background: url('~@/static/imgs/huo-bg.png') no-repeat;
  117. background-size: 100%;
  118. width: 160rpx;
  119. line-height: 28rpx;
  120. color: #FF4040;
  121. font-size: 20rpx;
  122. line-height: 42rpx;
  123. text-align: center;
  124. padding-left: 16rpx;
  125. }
  126. .flex-center{
  127. display: flex;
  128. align-items: center;
  129. }
  130. .flex-center-between{
  131. display: flex;
  132. align-items: center;
  133. justify-content: space-between;
  134. }
  135. .goods-item-wrap {
  136. background-color: #fff;
  137. width: 340rpx;
  138. height: 586rpx;
  139. padding: 20rpx;
  140. border-radius: 12rpx;
  141. .tp-wrap {
  142. width: 300rpx;
  143. height: 300rpx;
  144. overflow: hidden;
  145. .goods-item-img {
  146. width: 100%;
  147. height: 100%;
  148. }
  149. }
  150. .bm-wrap {
  151. margin-top: 12rpx;
  152. .title {
  153. font-size: 30rpx;
  154. color: #1A1A1A;
  155. line-height: 42rpx;
  156. // 超出两行省略号
  157. word-break: break-all;
  158. overflow: hidden;
  159. -webkit-line-clamp: 2;
  160. text-overflow: ellipsis;
  161. display: -webkit-box;
  162. -webkit-box-orient: vertical;
  163. font-weight: bold;
  164. .shop-icon{
  165. width: 30rpx;
  166. height: 30rpx;
  167. border-radius: 6rpx;
  168. display: inline-block;
  169. margin-right: 6rpx;
  170. margin-top: -7rpx;
  171. vertical-align: middle;//解决图片下边框间隙问题
  172. }
  173. }
  174. .shop-wrap {
  175. margin-top: 8rpx;
  176. display: flex;
  177. align-items: center;
  178. .shop-icon {
  179. width: 26rpx;
  180. height: 26rpx;
  181. vertical-align: middle;//解决图片下边框间隙问题
  182. }
  183. .shop-name {
  184. margin-left: 6rpx;
  185. font-size: 24rpx;
  186. line-height: 34rpx;
  187. color: #AAAAAA;
  188. flex: 1;
  189. max-width: 240rpx;
  190. white-space: nowrap;
  191. overflow: hidden;
  192. text-overflow: ellipsis;
  193. }
  194. }
  195. .price-wrap {
  196. margin-top: 10rpx;
  197. display: flex;
  198. align-items: center;
  199. .price {
  200. font-size: 36rpx;
  201. line-height: 50rpx;
  202. color: #FF4040;
  203. font-weight: bold;
  204. }
  205. .start-price {
  206. margin-left: 10rpx;
  207. font-size: 24rpx;
  208. color: #999999;
  209. line-height: 34rpx;
  210. text-decoration: line-through;
  211. }
  212. }
  213. .btm-wrap {
  214. display: flex;
  215. align-items: center;
  216. margin-top: 10rpx;
  217. .coupon-wrap {
  218. display: flex;
  219. align-items: center;
  220. width: 144rpx;
  221. height: 36rpx;
  222. background-image: url("~@/static/imgs/bg-quan-small.png");
  223. background-repeat: no-repeat;
  224. background-size: 100% 100%;
  225. color: #FF4040;
  226. font-size: 25rpx;
  227. line-height: 36rpx;
  228. .label {
  229. width: 46rpx;
  230. text-align: center;
  231. }
  232. .value {
  233. flex: 1;
  234. text-align: center;
  235. }
  236. }
  237. .commission-wrap {
  238. background-image: url("~@/static/imgs/fan.png");
  239. color: #AE4300;
  240. }
  241. }
  242. }
  243. }
  244. </style>