hotrecommd.vue 5.32 KB
Newer Older
王建威's avatar
王建威 committed
1 2
<template>
	<view class="hot_main_content">
王建威's avatar
王建威 committed
3
		<view class="clearfix" style="padding: 28rpx 0 20rpx">
王建威's avatar
王建威 committed
4 5 6 7 8 9 10 11 12 13
			<view class="hot_head_left">
				<view>
					<text class="hot_title">
						<i v-if="style_setting.icon_url_show" class="hot_icon" :style="{'background-image':'url('+style_setting.icon_url+')'}"></i>
						{{style_setting.title}}
					</text>
					<text class="hot_sub_title">{{style_setting.sub_title}}</text>
				</view>
			</view>
			<view class="hot_cate_list">
王建威's avatar
王建威 committed
14 15 16 17
				<text class="hot_cate_item" v-for="(item, key) in cate_list" :key="key" @click="changeCate(key)" :class="key === hotIndex ? 'act' : ''" v-if="item.goods_list.length">
					<text>{{item.cate_name}}</text>
					<text>{{item.sub_title}}</text>
				</text>
王建威's avatar
王建威 committed
18 19
			</view>
		</view>
王建威's avatar
王建威 committed
20 21 22
		<view v-for="(val, key) in cate_list" :key="key" v-if="key === hotIndex">
			<view v-if="val.goods_list" class="flex_goods">
				<view class="hot_goods_item" v-for="(item, index) in val.goods_list" :key="index">
王建威's avatar
王建威 committed
23
					<image class="hot_goods_icon" v-if="style_setting.angle_sign" :src="style_setting.angle_sign_url"></image>
王建威's avatar
王建威 committed
24 25 26 27 28 29 30 31 32
					<image class="hot_goods_img" :src="item.default_image || $noGoodsImg" @click="$jumpGoodDetail(item.goods_id)"></image>
					<text class="hot_goods_name" v-if="style_setting.title_show">{{item.goods_name}}</text>
					<text class="hot_goods_subname" v-if="style_setting.sub_title_show">{{item.goods_subname || ' '}}</text>
					<view class="between_price">
						<view class="between_left" v-if="style_setting.price_show">
							<text class="hot_pro_price" v-if="isLogin">{{item.price}}</text>
							<!-- <text class="hot_price">{{item.price}}</text> -->
							<text class="hot_pro_price" v-else>登录显示价格</text>
						</view>
王建威's avatar
王建威 committed
33
						<i class="eosfont hot_cart_icon" v-if="style_setting.cart_show" @click="$addCart(item.spec_id, 1,isLogin)">&#xe7e6;</i>
王建威's avatar
王建威 committed
34 35 36
					</view>
				</view>
			</view>
王建威's avatar
王建威 committed
37
			<view v-else class="nogoods">暂无此类商品</view>
王建威's avatar
王建威 committed
38 39 40 41 42 43 44 45 46
		</view>
	</view>
</template>

<script>
	export default {
		props:{
			wrapper_props: {
				type: Object
王建威's avatar
王建威 committed
47 48 49 50
			},
			isLogin: {
				type: Number,
				default: 0
王建威's avatar
王建威 committed
51 52 53 54 55 56 57 58 59
			}
		},
		data() {
			return {
				style_setting: this.wrapper_props.style_setting,
				cate_list: this.wrapper_props.cate_list,
				hotIndex: 0
			}
		},
王建威's avatar
王建威 committed
60 61 62 63 64 65 66 67 68
		mounted() {
			var flag = true;
			this.cate_list.map((item, index) => {
				if(item.goods_list.length && flag) {
					this.hotIndex = index;
					flag = false;
				}
			});
		},
王建威's avatar
王建威 committed
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
		methods: {
			changeCate(index) {
				this.hotIndex = index
			}
		}
	}
</script>

<style lang="less" scoped>
	.clearfix::after {
		content: "";
		display: block;
		height: 0;
		clear:both;
		visibility: hidden;
	}
	.hot_main_content {
王建威's avatar
王建威 committed
86
		width: 702rpx;
王建威's avatar
王建威 committed
87 88 89 90 91 92 93 94 95 96 97 98
		margin: 0 auto;
	}
	.hot_head_left {
		display: inline-block;
		float: left;
	}
	.hot_icon {
		display: inline-block;
		width: 28rpx;
		height: 28rpx;
		background-repeat: no-repeat;
		background-size: 100% 100%;
王建威's avatar
王建威 committed
99
		margin-right: 8rpx;
王建威's avatar
王建威 committed
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118
	}
	.hot_title {
		font-size: 32rpx;
		font-family: PingFangSC-Medium,PingFang SC;
		font-weight: 500;
		color: #464646;
		line-height: 44rpx;
		display: block;
	}
	.hot_sub_title {
		font-size: 22rpx;
		color: #7c7c7c;
		line-height: 32rpx;
		display: block;
	}
	.hot_cate_list {
		white-space: nowrap;
		overflow: scroll;
		position: relative;
王建威's avatar
王建威 committed
119
		left: 20rpx;
王建威's avatar
王建威 committed
120
		height: 88rpx;
王建威's avatar
王建威 committed
121 122 123 124 125 126 127 128
	}
	.hot_cate_list::-webkit-scrollbar {
		display: none;
	}
	.hot_cate_item {
		width: 164rpx;
		display: inline-block;
		text-align: center;
王建威's avatar
王建威 committed
129
		position: relative;
王建威's avatar
王建威 committed
130 131 132 133 134 135 136 137 138 139 140 141 142
		margin-left: 10rpx;
		text:nth-of-type(1) {
			display: block;
			font-family: PingFangSC-Medium,PingFang SC;
			font-weight: 500;
			color: #464646;
			font-size: 32rpx;
		}
		text:nth-of-type(2) {
			display: block;
			font-size: 22rpx;
			color: #7C7C7C;
		}
王建威's avatar
王建威 committed
143 144 145 146 147 148 149 150 151 152
	}
	.hot_cate_item.act::after {
		content: '';
		width: 40rpx;
		height: 2px;
		border-radius: 1px;
		background: #000;
		position: absolute;
		left: 50%;
		margin-left: -20rpx;
王建威's avatar
王建威 committed
153
		bottom: -8rpx;
王建威's avatar
王建威 committed
154 155 156 157
	}
	.nogoods {
		padding: 40rpx;
		text-align: center;
王建威's avatar
王建威 committed
158 159 160 161 162 163 164 165 166
	}
	.flex_goods {
		display: flex;
		flex-wrap: wrap;
		justify-content: space-between;
		.hot_goods_item {
			position: relative;
			width: 346rpx;
			text-align: center;
王建威's avatar
王建威 committed
167
			margin-bottom: 20rpx;
王建威's avatar
王建威 committed
168
			background: #fff;
王建威's avatar
王建威 committed
169
			padding: 32rpx 0 24rpx;
王建威's avatar
王建威 committed
170
			border-radius: 16rpx;
王建威's avatar
王建威 committed
171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227
			.hot_goods_icon {
				position: absolute;
				left: 0;
				top: 0;
				width: 80rpx;
				height: 80rpx;
				z-index: 2;
			}
			.hot_goods_img {
				width: 280rpx;
				height: 280rpx;
			}
			.hot_goods_name, .hot_goods_subname {
				width: 280rpx;
				display: block;
				text-align: left;
				font-size: 26rpx;
				overflow: hidden;
				text-overflow: ellipsis;
				white-space: nowrap;
				margin: 0 auto;
			}
			.hot_goods_name {			
				color: #212121;
				margin-top: 16rpx;
			}
			.hot_goods_subname {
				color: #6e6e6e;
			}
		}
		.between_price {
			position: relative;
			width: 280rpx;
			height: 44rpx;
			margin: 12rpx auto 0;
			.between_left {
				position: absolute;
				left: 0;
			}
			text {
				display: block;
				text-align: left;
			}
			.hot_pro_price {
				font-size: 32rpx;
				font-family: PingFangSC-Regular,PingFang SC;
				font-weight: 400;
				color: #c3a070;
			}
			.hot_price {
				font-size: 24rpx;
				font-family: PingFangSC-Light,PingFang SC;
				font-weight: 300;
				color: #aeaeae;
				text-decoration: line-through;
			}
			.hot_cart_icon {
王建威's avatar
王建威 committed
228
				font-size: 30rpx;
王建威's avatar
王建威 committed
229 230
				position: absolute;
				right: 0;
王建威's avatar
王建威 committed
231
				top: 6rpx;
王建威's avatar
王建威 committed
232 233 234 235
			}
		}
	}
</style>