class.vue 4.7 KB
<template>
	<view class="conetnt">
		<view class="inputBox">
			<input type="text" value="搜索" @input="bindInput" />
		</view>
		<view class="selectBox">
			<view :class="selectIndex==0?'selectItem selectItemActive':'selectItem'" @click="selectTopClick(0)">
				全部
			</view>
			<view :class="selectIndex==1?'selectItem selectItemActive':'selectItem'" @click="selectTopClick(1)">
				价格
				<image src="../../static/ic_17@2x.png" mode=""></image>
			</view>
			<view :class="selectIndex==2?'selectItem selectItemActive':'selectItem'" @click="selectTopClick(2)">
				销量
				<image src="../../static/ic_17@2x.png" mode=""></image>
			</view>
		</view>
		<!-- 分类 -->
		<view class="classBox">
			<view class="leftBox">
				<view :class="leftIndex==index?'leftItem leftActive':'leftItem'" v-for="(item,index) in leftList"
					:key="idnex" @click="leftClick(index)">
					{{item.title}}
				</view>
			</view>
			<view class="rightBox">
				<view :class="index==rightList.length-1?'rightItem lastItem':'rightItem'"
					v-for="(item,index) in rightList" :key="index">
					<view class="itemImg">
						<image :src="item.image" mode=""></image>
					</view>
					<view class="itemRight">
						<view class="goodName">
							{{item.title}}
						</view>
						<view class="goodDeatil">
							{{item.detail}}
						</view>
						<view class="goodPrice">
							<view class="price">
								<text style="font-size: 20rpx;">¥</text>
								{{item.price}}
							</view>
							<view class="cartImg" @click="addCart">
								<image src="../../static/ic_18@2x.png" mode=""></image>
							</view>
						</view>
					</view>
				</view>
			</view>
		</view>
		<!-- 购物车弹框 -->
		<view class="cartBox" v-if="cartShow">
			<view class="cartGoodBox">
				<view class="cartGoodInner">
					<view class="cartImg">
						<image src="../../static/ic_10@2x.png" mode="" class="cartImage"></image>
					</view>
					<view class="cartName">
						科麦斯无油静音空吗压力麦斯无油静音空吗压
						<view class="cartPrice">
							<text style="font-size: 20rpx;color:#FE0E1F;margin-right: -2rpx;">¥</text>50
						</view>
					</view>
				</view>
				<view class="specificationBox" v-for="(item,index) in typeList" :key="index">
					<view class="" style="font-size: 28rpx;">
						{{item.title}}
					</view>
					<view class="" style="display: flex;flex-wrap: wrap;">
						<view class="specificalItem" v-for="(items,indexs) in item.list" :key="indexs">
							{{items}}
						</view>
					</view>
				</view>
				<view class="countBox">
					<view class="" style="font-size: 28rpx;">
						数量
					</view>
					<view class="" style="display: flex;">
						<view class="reduceImg">
							-
						</view>
						<view class="countNum">
							6
						</view>
						<view class="addImg">
							+
						</view>
					</view>
				</view>
				<view class="addCartBtn" @click="addCartConfrim">
					加入购物车
				</view>
			</view>
		</view>
		<view class="masks" v-if="mask" @click="closeMask">

		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				cartShow: false, //购物车弹框
				mask: false, //遮罩层
				selectIndex: 0, //头部
				leftIndex: 0, //左分类
				leftList: [{
					id: '1',
					title: '电动工具'
				}, {
					id: '1',
					title: '电动工具'
				}, {
					id: '1',
					title: '电动工具'
				}, {
					id: '1',
					title: '电动工具'
				}, {
					id: '1',
					title: '电动工具'
				}],
				rightList: [{
					image: '../../static/ic_10@2x.png',
					title: '科麦斯无油静音空吗压 力小型气550W-8L科麦斯无油静音空吗压 力小型气550W-8L',
					detail: '工业级/无油/无压',
					price: '50'
				}, {
					image: '../../static/ic_10@2x.png',
					title: '科麦斯无油静音空吗压 力小型气550W-8L科麦斯无油静音空吗压 力小型气550W-8L',
					detail: '工业级/无油/无压',
					price: '50'
				}],
				// 购物车规格
				typeList: [{
					title: '型号',
					list: ['55W-8L经典款标配:整机', '550W-8L:黑色钢款', '1600W-30L黑金刚:8个压头', '750W-8L黑金刚款']
				}]
			}
		},
		methods: {
			selectTopClick(index) {
				this.selectIndex = index
				console.log(index)
			},
			leftClick(index) {
				this.leftIndex = index
			},
			//加入购物车弹窗
			addCart() {
				this.mask = true
				this.cartShow = true
			},
			//关闭遮罩层s
			closeMask() {
				this.mask = false
				this.cartShow = false
			},
			//确定加入购物车
			addCartConfrim() {
				this.mask = false
				this.cartShow = false
			},
			//数量增加
			addCount() {

			},
			//数量减少
			reduce() {

			}
		}
	}
</script>

<style>
	@import url("/common/class.css");
</style>