purchase-let/pages/cart/cart.vue

200 lines
5.0 KiB
Vue
Raw Normal View History

2024-04-25 18:02:30 +08:00
<template>
<view>
<up-navbar placeholder>
<template #left>
<view style="display: flex;">
<view class="tabs" :class="{'tabs-active': tabsActive==index}" v-for="(item, index) in list"
@click="changeTab(index)">
{{item}}
</view>
</view>
</template>
</up-navbar>
<swiper class="swiper-box" :current="swiperCurrent" @animationfinish="animationfinish">
<swiper-item class="swiper-item">
<scroll-view scroll-y style="height: 100%;width: 100%;">
<view class="page-box1">
<view class="total">
<view>共计<text style="color: #20B128;">3</text></view>
<view v-if="true">管理</view>
<view v-else>完成</view>
</view>
<view class="list">
<view class="shop-item" v-for="(item, index) in 20" :key="index">
<view class="shop-check">
<image v-if="index%3==0" src="@/static/icon/n-check.png"></image>
<image v-else src="@/static/icon/check.png"></image>
</view>
<image class="shop-img" src="https://cdn.uviewui.com/uview/album/1.jpg"></image>
<view class="shop-content">
<view class="title">
<view class="name u-line-2">好吃的瓜果</view>
<view class="tip u-line-1">香味辛辣|葱香味浓|调味增香香味辛辣|葱香味浓|调味增香</view>
</view>
<view class="price-btn">
<view class="price">12.00</view>
<view class="btn">
<u--icon name="minus-circle-fill" size="20" color="#20b128"></u--icon>
<view class="num">{{1}}</view>
<u--icon name="plus-circle-fill" size="20" color="#20b128"></u--icon>
</view>
</view>
</view>
</view>
</view>
<view style="width: 100%;height: 200rpx;"></view>
</view>
</scroll-view>
</swiper-item>
</swiper>
<view class="cart-btn">
</view>
</view>
</template>
<script setup>
import { ref } from 'vue';
// 创建响应式数据
const list = ref(['购物车', '常买', '收藏']);
const tabsActive = ref(0)
// 定义方法
const changeTab = (e) => {
tabsActive.value = e;
}
const swiperCurrent = ref(0);
const animationfinish = ({ detail: { current } }) => {
swiperCurrent.value = current;
tabsActive.value = current;
}
</script>
<style lang="scss">
.tabs {
color: #444444;
font-size: 32rpx;
margin-right: 30rpx;
}
.tabs-active {
color: #20B128;
font-size: 34rpx;
transition: 300ms;
}
.swiper-box {
flex: 1;
height: calc(100vh - var(--window-top) - var(--window-bottom));
/* #ifdef H5 */
height: calc(100vh - 96px);
/* #endif */
width: 100%;
.swiper-item {
height: 100%;
}
}
.page-box1{
position: relative;
.total{
padding: 0 20rpx;
display: flex;
justify-content: space-between;
position: fixed;
top: var(--window-top);
left: 0;
right: 0;
background-color: #eee;
z-index: 100;
height: 60rpx;
line-height: 60rpx;
font-size: 26rpx;
color: #444;
}
.list{
margin: 20rpx;
margin-top: 80rpx;
border-radius: 20rpx;
overflow: hidden;
.shop-item {
padding: 20rpx;
border-bottom: 1rpx solid #eee;
background-color: #fff;
display: flex;
.shop-check{
width: 60rpx;
height: 160rpx;
display: flex;
align-items: center;
image{
width: 40rpx;
height: 40rpx;
}
}
.shop-img {
height: 160rpx;
width: 160rpx;
margin-right: 20rpx;
border-radius: 14rpx;
}
.shop-content {
width: 430rpx;
display: flex;
flex-direction: column;
justify-content: space-between;
.title {
.name {
font-size: 28rpx;
}
.tip {
color: #999;
font-size: 24rpx;
margin: 12rpx 0;
}
}
.price {
font-size: 30rpx;
font-weight: bold;
color: #F55726;
}
.price-btn {
display: flex;
justify-content: space-between;
.btn {
display: flex;
align-items: center;
.num {
width: 60rpx;
text-align: center;
}
}
}
}
}
}
}
.cart-btn{
// width: 100%;
// height: 50px;
// background-color: pink;
// position: fixed;
// left: 0;
// bottom: var(--window-bottom);
}
</style>