修复bug

This commit is contained in:
weipengfei 2024-05-27 18:07:07 +08:00
parent 31ee110122
commit d8ee89ff09
1 changed files with 391 additions and 389 deletions

View File

@ -2,10 +2,9 @@
<view class="wrap">
<up-navbar placeholder :autoBack="true">
<template #center>
<view
style="display: flex;align-items: center;width: 100%;justify-content: flex-start;margin-left: 100rpx;">
<view class="tabs" :class="{'tabs-active': tabsActive==index}" v-for="(item, index) in list"
:key="index" @click="changeTab(index)">
<view style="display: flex;align-items: center;width: 100%;justify-content: flex-start;margin-left: 100rpx;">
<view class="tabs" :class="{'tabs-active': tabsActive==index}" v-for="(item, index) in list" :key="index"
@click="changeTab(index)">
{{item}}
</view>
</view>
@ -22,8 +21,7 @@
<view v-else @click="isAdmin=false;">完成</view>
</view>
<view v-if="cartList.length>0" class="list">
<view class="shop-item" v-for="(item, index) in cartList" :key="index"
@click="openGoodPopup(item)">
<view class="shop-item" v-for="(item, index) in cartList" :key="index" @click="openGoodPopup(item)">
<view class="shop-check" @click.stop="checkItem(item, !item.check)">
<image v-if="!item.check" src="@/static/icon/n-check.png"></image>
<image v-else src="@/static/icon/check.png"></image>
@ -57,8 +55,7 @@
<scroll-view scroll-y style="height: 100%;width: 100%;">
<view class="page-box1">
<view v-if="frequentlyList.length>0" class="list">
<view class="shop-item" v-for="(item, index) in frequentlyList" :key="index"
@click="openGoodPopup(item)">
<view class="shop-item" v-for="(item, index) in frequentlyList" :key="index" @click="openGoodPopup(item)">
<image class="shop-img" :src="item.imgs"></image>
<view class="shop-content" style="width: 490rpx;">
<view class="title">
@ -69,8 +66,7 @@
<view class="price-btn">
<view class="price">{{item.sell}}</view>
<view class="btn">
<up-button size="small" plain color="#20b128"
shape="circle">加入购物车</up-button>
<up-button size="small" plain color="#20b128" shape="circle">加入购物车</up-button>
</view>
</view>
</view>
@ -257,11 +253,17 @@
cartInfo.value.total_price = price.toFixed(2);
}
const changeAll = (flag = false) => {
let count = 0;
cartList.value.forEach(item => {
item.check = !flag;
if (!flag) count += item.sell * item.cart_num;
})
if (!flag) checkAll.value = cartInfo.value.count;
else checkAll.value = 0;
if (!flag) {
checkAll.value = cartInfo.value.count;
} else {
checkAll.value = 0;
}
cartInfo.value.total_price = count.toFixed(2);
}
//