【代码评审】购物车提交的校验、bgStyle 样式

pull/131/MERGE
YunaiV 2024-12-11 13:08:55 +08:00
parent 39869cd92d
commit 164589f634
3 changed files with 52 additions and 18 deletions

View File

@ -1,6 +1,10 @@
<template>
<s-layout :bgStyle="{ backgroundColor: '#fff' }" tabbar="/pages/index/cart" title="购物车">
<s-empty v-if="state.list.length === 0" icon="/static/cart-empty.png" text="购物车空空如也,快去逛逛吧~" />
<s-empty
v-if="state.list.length === 0"
icon="/static/cart-empty.png"
text="购物车空空如也,快去逛逛吧~"
/>
<!-- 头部 -->
<view v-if="state.list.length" class="cart-box ss-flex ss-flex-col ss-row-between">
@ -24,16 +28,35 @@
<view v-for="item in state.list" :key="item.id" class="goods-box ss-r-10 ss-m-b-14">
<view class="ss-flex ss-col-center">
<label class="check-box ss-flex ss-col-center ss-p-l-10" @tap="onSelectSingle(item.id)">
<radio :checked="state.selectedIds.includes(item.id)" color="var(--ui-BG-Main)"
style="transform: scale(0.8)" @tap.stop="onSelectSingle(item.id)" />
<radio
:checked="state.selectedIds.includes(item.id)"
color="var(--ui-BG-Main)"
style="transform: scale(0.8)"
@tap.stop="onSelectSingle(item.id)"
/>
</label>
<s-goods-item :img="item.spu.picUrl || item.goods.image" :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"
<s-goods-item
:img="item.spu.picUrl || item.goods.image"
: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
"
:title="item.spu.name"
:titleWidth="400" priceColor="#FF3000">
:titleWidth="400"
priceColor="#FF3000"
>
<template v-if="!state.editMode" v-slot:tool>
<su-number-box v-model="item.count" :max="item.sku.stock" :min="0" :step="1"
@change="onNumberChange($event, item)" />
<su-number-box
v-model="item.count"
:max="item.sku.stock"
:min="0"
:step="1"
@change="onNumberChange($event, item)"
/>
</template>
</s-goods-item>
</view>
@ -44,8 +67,12 @@
<view class="cart-footer ss-flex ss-col-center ss-row-between ss-p-x-30 border-bottom">
<view class="footer-left ss-flex ss-col-center">
<label class="check-box ss-flex ss-col-center ss-p-r-30" @tap="onSelectAll">
<radio :checked="state.isAllSelected" color="var(--ui-BG-Main)"
style="transform: scale(0.8)" @tap.stop="onSelectAll" />
<radio
:checked="state.isAllSelected"
color="var(--ui-BG-Main)"
style="transform: scale(0.8)"
@tap.stop="onSelectAll"
/>
<view class="ss-m-l-8"> 全选</view>
</label>
<text>合计</text>
@ -54,12 +81,18 @@
</view>
</view>
<view class="footer-right">
<button v-if="state.editMode" class="ss-reset-button ui-BG-Main-Gradient pay-btn ui-Shadow-Main"
@tap="onDelete">
<button
v-if="state.editMode"
class="ss-reset-button ui-BG-Main-Gradient pay-btn ui-Shadow-Main"
@tap="onDelete"
>
删除
</button>
<button v-else class="ss-reset-button ui-BG-Main-Gradient pay-btn ui-Shadow-Main"
@tap="onConfirm">
<button
v-else
class="ss-reset-button ui-BG-Main-Gradient pay-btn ui-Shadow-Main"
@tap="onConfirm"
>
去结算
{{ state.selectedIds?.length ? `(${state.selectedIds.length})` : '' }}
</button>
@ -135,6 +168,7 @@
}
let onlyExpress = false; //
let onlyPickup = false; //
// TODO @puhui999A B A B
const deliveryTypes = data.map((item) => item.deliveryTypes);
for (const deliveryType of deliveryTypes) {
//

View File

@ -153,6 +153,7 @@
});
// 1
// TODO puhui999 color~
const bgMain = computed(() => {
if (navbarMode.value === 'inner') {
return {

View File

@ -194,7 +194,6 @@ const bindBrokerageUser = async (val = undefined) => {
if (!!data || msg.includes('不能绑定自己')) {
uni.removeStorageSync('shareId');
}
} catch (e) {
console.error(e);
}