小程序购物车实现uni-app

uni-app 小程序实现购物车,功能完整。

展示效果图

在这里插入图片描述
部分

<template>
	<view class="container">
		<!-- 空白页 -->
		<view v-if="empty===true || cartList =='' " class="empty">
			<image src="/static/emptyCart.png" mode="aspectFit"></image>
			<view v-if="hasLogin" class="empty-tips">
				空空如也
				<navigator class="navigator" v-if="hasLogin" url="../index/index" open-type="switchTab">随便逛逛></navigator>
			</view>
			<view v-else class="empty-tips">
				空空如也
				<view class="navigator" @click="navToLogin">去购物吧></view>
			</view>
		</view>
		<view v-else>
			<!-- 列表 -->
			<view class="cat_sp">
				<text>已加入商品</text>
			</view>
			<view class="cart-list">
				<block v-for="(item, index) in cartList"  :key="item" >
					<view
						class="cart-item" 
					>
						<view class="image-wrapper">
							<view v-if="item.upperShelves == 0"	 class="upperShelves"
							>
								<image style="width: 40rpx;height: 40rpx;" src="../../static/select.png" mode=""></image>
							</view>
							<view v-else
								class="yticon icon-xuanzhong2 checkbox"  
								:class="{checked: item.checked}"
								@click="check('item', index,item)"
							></view>
							<view class="position_sp" v-if="item.upperShelves == 0">
										<image :src="item.titlePicStr" @click="cats(item,index)"
											mode="aspectFill" 
											lazy-load 
											@load="onImageLoad('cartList', index)" 
											@error="onImageError('cartList', index)"
										>
									</image>
									<image class="LOVE_position_sp" src="../../static/xj.png" mode=""></image>
							</view>
							<image v-else :src="item.titlePicStr" @click="cats(item,index)"
								mode="aspectFill" 
								lazy-load 
								@load="onImageLoad('cartList', index)" 
								@error="onImageError('cartList', index)"
							></image>
						</view>
						<view class="item-right"
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值