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