bugfix:购物车界面,金额展示不正确

pull/40/MERGE
YunaiV 2024-03-01 18:54:36 +08:00
parent d815fd5e3f
commit d51ebca23b
1 changed files with 8 additions and 12 deletions

View File

@ -28,12 +28,11 @@
style="transform: scale(0.8)" @tap.stop="onSelectSingle(item.id)" /> style="transform: scale(0.8)" @tap.stop="onSelectSingle(item.id)" />
</label> </label>
<s-goods-item :title="item.spu.name" :img="item.spu.picUrl || item.goods.image" <s-goods-item :title="item.spu.name" :img="item.spu.picUrl || item.goods.image"
:price="item.sku.price/100" :price="item.sku.price"
:skuText="item.sku.properties.length>1? item.sku.properties.reduce((items2,items)=>items2.valueName+' '+items.valueName):item.sku.properties[0].valueName" :skuText="item.sku.properties.length>1? item.sku.properties.reduce((items2,items)=>items2.valueName+' '+items.valueName):item.sku.properties[0].valueName"
priceColor="#FF3000" :titleWidth="400"> priceColor="#FF3000" :titleWidth="400">
<template v-if="!state.editMode" v-slot:tool> <template v-if="!state.editMode" v-slot:tool>
<su-number-box :min="0" :max="item.sku.stock" :step="1" v-model="item.count" <su-number-box :min="0" :max="item.sku.stock" :step="1" v-model="item.count" @change="onNumberChange($event, item)" />
@change="onNumberChange($event, item)"></su-number-box>
</template> </template>
</s-goods-item> </s-goods-item>
</view> </view>
@ -50,7 +49,7 @@
</label> </label>
<text>合计</text> <text>合计</text>
<view class="text-price price-text"> <view class="text-price price-text">
{{ state.totalPriceSelected }} {{ fen2yuan(state.totalPriceSelected) }}
</view> </view>
</view> </view>
<view class="footer-right"> <view class="footer-right">
@ -72,11 +71,8 @@
<script setup> <script setup>
import sheep from '@/sheep'; import sheep from '@/sheep';
import { import { computed, reactive } from 'vue';
computed, import { fen2yuan } from '../../sheep/hooks/useGoods';
reactive,
unref
} from 'vue';
const sys_navBar = sheep.$platform.navbar; const sys_navBar = sheep.$platform.navbar;
const cart = sheep.$store('cart'); const cart = sheep.$store('cart');
@ -89,11 +85,12 @@
isAllSelected: computed(() => cart.isAllSelected), isAllSelected: computed(() => cart.isAllSelected),
totalPriceSelected: computed(() => cart.totalPriceSelected), totalPriceSelected: computed(() => cart.totalPriceSelected),
}); });
// //
function onSelectSingle(id) { function onSelectSingle(id) {
console.log('单选')
cart.selectSingle(id); cart.selectSingle(id);
} }
// //
function onSelectAll() { function onSelectAll() {
cart.selectAll(!state.isAllSelected); cart.selectAll(!state.isAllSelected);
@ -105,7 +102,6 @@
let goods_list = []; let goods_list = [];
state.selectedList = state.list.filter((item) => state.selectedIds.includes(item.id)); state.selectedList = state.list.filter((item) => state.selectedIds.includes(item.id));
state.selectedList.map((item) => { state.selectedList.map((item) => {
console.log(item, '便利');
// //
items.push({ items.push({
skuId: item.sku.id, skuId: item.sku.id,