猎豆优选小程序

verticalGood.vue 10KB

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