123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277 |
- <!-- 横向商品 -->
- <template>
- <view class="goods-item-wrap" @click="onClickGoodsItem(goodInfo)">
- <view class="lt-wrap">
- <u-lazy-load class="goods-item-img" :image="goodInfo.img" img-mode="widthFix" border-radius="10" />
- </view>
- <view class="rt-wrap">
- <view class="title">
- <image class="shop-icon" v-if="goodInfo.shop_type == 0" src="https://ld.726p.com/ldyx_static/imgs/icon-tb.png" />
- <image class="shop-icon" v-else-if="goodInfo.shop_type == 1" src="https://ld.726p.com/ldyx_static/imgs/icon-tmall.png" />
- <image class="shop-icon" v-else-if="goodInfo.shop_type == 4" src="https://ld.726p.com/ldyx_static/imgs/jd-icon.png" />
- <image class="shop-icon" v-else-if="goodInfo.shop_type == 6" src="https://ld.726p.com/ldyx_static/imgs/pdd-icon.png" />
- <image class="shop-icon" v-else-if="goodInfo.shop_type == 5" src="https://ld.726p.com/ldyx_static/imgs/icon-dy.png" />
- <image class="shop-icon" v-else-if="goodInfo.shop_type == 7" src="https://ld.726p.com/ldyx_static/imgs/icon-wph.png" />
- <text>{{ goodInfo.title }}</text>
- </view>
- <view class="shop-wrap flex-center-between">
- <view class="flex-center">
- <image class="shop-icon" src="https://ld.726p.com/ldyx_static/imgs/shop.png" />
- <view class="shop-name" :style="goodInfo.volume > 100 ? 'max-width: 260rpx' : ''">{{ goodInfo.shop_title }}</view>
- </view>
- <view class="salesVolume" v-if="goodInfo.volume > 100">
- 销量{{ $NumberHandle({value:goodInfo.volume,comma:true}) }}+
- </view>
- </view>
- <view class="price-wrap">
- <view>
- <text class="price">{{ goodInfo.discount_price }}</text>
- <text class="start-price">¥{{goodInfo.price }}</text>
- </view>
- <view v-if="user_level > 1 && goodInfo.commission_price > 0" class="coupon-wrap commission-wrap">
- <text class="label">返</text>
- <text class="value">¥{{ goodInfo.commission_price }}</text>
- </view>
- </view>
- <view class="btm-wrap">
- <!-- <view v-if="goodInfo.coupon_price > 0 && goodInfo.shop_type != 5" class="coupon-wrap">
- <image class="label-img" src="/static/imgs/icon-quan.png" />
- <text class="label">券</text>
- <text class="value">¥{{ goodInfo.coupon_price }}</text>
- </view> -->
- <!-- <view v-if="user_level > 1 && goodInfo.commission_price > 0" class="coupon-wrap commission-wrap">
- <text class="label">返</text>
- <text class="value">¥{{ goodInfo.commission_price }}</text>
- </view> -->
- </view>
- </view>
- </view>
- </template>
- <script>
- const app = getApp()
- export default {
- name:"horizontalGood",
- props:{
- goodInfo:{
- type: Object
- },
- path:{
- type: String,
- default: ''
- }
- },
- data() {
- return {
- user_level: uni.getStorageSync('userInfo') ? uni.getStorageSync('userInfo').user_level : '', // 当前用户等级
- };
- },
- methods:{
- onClickGoodsItem(goodsItem) {
- try{ app.categoryNew_countBuy({shop_type: goodsItem.shop_type, type:0,path:this.path}) }catch(e){} ; // 数据上报
- if (goodsItem.shop_type == 4) { // 京东
- const { goods_id = ''} = goodsItem
- uni.navigateTo({
- url: `/pages/subPackages/home/jdGoodsDetail?goods_id=${encodeURIComponent(goods_id)}`
- })
- } else if (goodsItem.shop_type == 6) { // 拼多多
- const { goods_id = ''} = goodsItem
- if(!goods_id){
- uni.showToast({ title: 'goods_id错误', icon: 'none' })
- return
- }
- uni.navigateTo({
- url: `/pages/subPackages/pdd/goodsDetail?goods_id=${encodeURIComponent(goods_id)}`
- })
- } else if (goodsItem.shop_type == 5) { // 抖音
- const { goods_id = ''} = goodsItem
- uni.navigateTo({
- url: `/pages/subPackages/dy/goodsDetail?goods_id=${encodeURIComponent(goods_id)}`
- })
- } else if (goodsItem.shop_type == 7) { // 唯品会
- const { goods_id = ''} = goodsItem
- uni.navigateTo({
- url: `/pages/subPackages/wph/goodsDetail?goods_id=${encodeURIComponent(goods_id)}`
- })
- } else {
- const { img = '', goods_id = '', coupon_price = '', discount_price = '', price = '', is_coupon = '', commission_rate = '', is_high_commission = '', coupon_end_time = '', coupon_start_time = '' } = goodsItem
- uni.navigateTo({
- 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)}`
- })
- }
- },
- }
- }
- </script>
- <style scoped lang="scss">
- .salesVolume{
- background: url('https://ld.726p.com/ldyx_static/imgs/huo-bg.png') no-repeat;
- background-size: 100%;
- width: 160rpx;
- line-height: 28rpx;
- color: #FF4040;
- font-size: 20rpx;
- line-height: 42rpx;
- text-align: center;
- padding-left: 10rpx;
- }
- .flex-center{
- display: flex;
- align-items: center;
- }
- .flex-center-between{
- display: flex;
- align-items: center;
- justify-content: space-between;
- }
- .goods-item-wrap {
- padding: 28rpx;
- display: flex;
- align-items: center;
- background-color: #fff;
- .lt-wrap {
- width: 220rpx;
- height: 220rpx;
- border-radius: 10rpx;
- overflow: hidden;
- .goods-item-img {
- width: 100%;
- height: 100%;
- vertical-align: middle; // 解决图片下边框缝隙问题
- }
- }
- .rt-wrap {
- margin-left: 20rpx;
- flex: 1;
- .title {
- font-size: 30rpx;
- color: #1A1A1A;
- line-height: 42rpx;
- // 超出两行省略号
- word-break: break-all;
- overflow: hidden;
- -webkit-line-clamp: 2;
- text-overflow: ellipsis;
- display: -webkit-box;
- -webkit-box-orient: vertical;
- font-weight: bold;
- .shop-icon{
- width: 30rpx;
- height: 30rpx;
- border-radius: 6rpx;
- display: inline-block;
- margin-right: 6rpx;
- margin-top: -7rpx;
- vertical-align: middle;//解决图片下边框间隙问题
- }
- }
- .shop-wrap {
- margin-top: 8rpx;
- display: flex;
- align-items: center;
- .shop-icon {
- width: 26rpx;
- height: 26rpx;
- vertical-align: middle;//解决图片下边框间隙问题
- }
- .shop-name {
- margin-left: 6rpx;
- font-size: 24rpx;
- line-height: 34rpx;
- color: #AAAAAA;
- flex: 1;
- max-width: 400rpx;
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
- }
- }
- .price-wrap {
- margin-top: 10rpx;
- display: flex;
- align-items: center;
- justify-content: space-between;
- .price {
- font-size: 36rpx;
- line-height: 50rpx;
- color: #FF4040;
- font-weight: bold;
- }
- .start-price {
- margin-left: 10rpx;
- font-size: 24rpx;
- color: #999999;
- line-height: 34rpx;
- text-decoration: line-through;
- }
- .coupon-wrap {
- display: flex;
- align-items: center;
- width: 144rpx;
- height: 36rpx;
- background-image: url("https://ld.726p.com/ldyx_static/imgs/bg-quan-small.png");
- background-repeat: no-repeat;
- background-size: 100% 100%;
- color: #FF4040;
- font-size: 25rpx;
- line-height: 36rpx;
- .label-img {
- width: 40rpx;
- height: 40rpx;
- }
- .label {
- width: 46rpx;
- text-align: center;
- }
- .value {
- flex: 1;
- text-align: center;
- }
- }
- .commission-wrap {
- background-image: url("https://ld.726p.com/ldyx_static/imgs/fan.png");
- color: #AE4300;
- margin-left: 12rpx;
- }
- }
- .btm-wrap {
- display: flex;
- align-items: center;
- margin-top: 10rpx;
- .coupon-wrap {
- display: flex;
- align-items: center;
- width: 144rpx;
- height: 36rpx;
- background-image: url("https://ld.726p.com/ldyx_static/imgs/bg-quan-small.png");
- background-repeat: no-repeat;
- background-size: 100% 100%;
- color: #FF4040;
- font-size: 25rpx;
- line-height: 36rpx;
- .label-img {
- width: 40rpx;
- height: 40rpx;
- }
- .label {
- width: 46rpx;
- text-align: center;
- }
- .value {
- flex: 1;
- text-align: center;
- }
- }
- .commission-wrap {
- background-image: url("https://ld.726p.com/ldyx_static/imgs/fan.png");
- color: #AE4300;
- margin-left: 12rpx;
- }
- }
- }
- }
- </style>
|