cb-biz-ui 1.7.4 → 1.7.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,93 +1,70 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<view>
|
|
3
|
-
<
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
>
|
|
18
|
-
<view
|
|
19
|
-
class="ui-cart-cell ui-mtop"
|
|
20
|
-
v-for="item in list"
|
|
21
|
-
:key="item.id"
|
|
2
|
+
<view style="height: 100%">
|
|
3
|
+
<view class="shopping-cart" v-if="list.length">
|
|
4
|
+
<ui-checkbox-group
|
|
5
|
+
@change="buyChange"
|
|
6
|
+
:formFieldStyle="{
|
|
7
|
+
padding: 0
|
|
8
|
+
}"
|
|
9
|
+
formFieldPadding="0"
|
|
10
|
+
formFieldBackground="#f5f5f5"
|
|
11
|
+
>
|
|
12
|
+
<view class="ui-cart-cell ui-mtop" v-for="item in list" :key="item.id">
|
|
13
|
+
<ui-slide-view
|
|
14
|
+
:threshold="20"
|
|
15
|
+
:right-options="actions"
|
|
16
|
+
@click="(index) => slideOptions(index, item)"
|
|
22
17
|
>
|
|
23
|
-
<ui-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
:bezier="false"
|
|
53
|
-
@countChange="(val) => countChange(val, item)"
|
|
54
|
-
@handleClick="(goodsInfo) => goDetails(goodsInfo, item)"
|
|
55
|
-
:entity="item.skuInfo"
|
|
56
|
-
/>
|
|
57
|
-
</view>
|
|
18
|
+
<view class="ui-goods-item">
|
|
19
|
+
<ui-label width="50rpx" min-height="100%" class="ui-checkbox">
|
|
20
|
+
<ui-checkbox
|
|
21
|
+
:trigger-group="false"
|
|
22
|
+
borderColor="#6D7278"
|
|
23
|
+
:color="primaryColor"
|
|
24
|
+
:scaleRatio="0.8"
|
|
25
|
+
:value="item.id"
|
|
26
|
+
:checked="item.selected"
|
|
27
|
+
:disabled="
|
|
28
|
+
item.skuInfo.inventoryCapacity === 0 ||
|
|
29
|
+
item.skuInfo.saleStatus !== 10
|
|
30
|
+
"
|
|
31
|
+
></ui-checkbox>
|
|
32
|
+
</ui-label>
|
|
33
|
+
|
|
34
|
+
<view class="goods-card_box bottom-1px-border">
|
|
35
|
+
<goods-card
|
|
36
|
+
imgWidth="239rpx"
|
|
37
|
+
imgHeight="239rpx"
|
|
38
|
+
image-placeholder="https://shop-cdn.cbyzx.com/shop23n05y18abcd/img/50fbba9d9b4e4184b9ab7e2fbb43c645.png"
|
|
39
|
+
:textFontSize="props.goodTextStyles"
|
|
40
|
+
:goodsCount="item.count"
|
|
41
|
+
:add-btn-bg-color="primaryColor"
|
|
42
|
+
:bezier="false"
|
|
43
|
+
@countChange="(val) => countChange(val, item)"
|
|
44
|
+
@handleClick="(goodsInfo) => goDetails(goodsInfo, item)"
|
|
45
|
+
:entity="item.skuInfo"
|
|
46
|
+
/>
|
|
58
47
|
</view>
|
|
59
|
-
</
|
|
60
|
-
</view>
|
|
61
|
-
</
|
|
62
|
-
</
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
</
|
|
68
|
-
</
|
|
48
|
+
</view>
|
|
49
|
+
</ui-slide-view>
|
|
50
|
+
</view>
|
|
51
|
+
</ui-checkbox-group>
|
|
52
|
+
</view>
|
|
53
|
+
<view v-else>
|
|
54
|
+
<ui-no-data :fixed="false" marginTop="250" :imgUrl="nullDataUrl">
|
|
55
|
+
<text class="tui-color__black">购物车暂无商品~</text>
|
|
56
|
+
</ui-no-data>
|
|
57
|
+
</view>
|
|
69
58
|
<!--tabbar-->
|
|
70
|
-
<shopping-cart-tabbar
|
|
71
|
-
:selectCount="selectCount"
|
|
72
|
-
:is-all="isAll"
|
|
73
|
-
:loading="payLoading"
|
|
74
|
-
:priceData="props.priceData"
|
|
75
|
-
:primaryColor="primaryColor"
|
|
76
|
-
@buyPlay="buyPlay"
|
|
77
|
-
@checkAll="checkAll"
|
|
78
|
-
/>
|
|
79
59
|
</view>
|
|
80
60
|
</template>
|
|
81
61
|
<script setup lang="ts">
|
|
82
|
-
import { computed } from 'vue';
|
|
83
62
|
import { onReady } from '@dcloudio/uni-app';
|
|
84
63
|
import GoodsCard from '../cb-goods-card/cb-goods-card.vue';
|
|
85
|
-
import ShoppingCartTabbar from '../cb-shopping-cart-tabbar/cb-shopping-cart-tabbar.vue';
|
|
86
64
|
import type {
|
|
87
65
|
changeValueType,
|
|
88
66
|
cartItemListType,
|
|
89
|
-
skuInfoType
|
|
90
|
-
priceDataType
|
|
67
|
+
skuInfoType
|
|
91
68
|
} from '../interface/types';
|
|
92
69
|
|
|
93
70
|
const emit = defineEmits<{
|
|
@@ -103,7 +80,6 @@ interface IProps {
|
|
|
103
80
|
height: string;
|
|
104
81
|
list: cartItemListType[];
|
|
105
82
|
nullDataUrl: string;
|
|
106
|
-
priceData: priceDataType;
|
|
107
83
|
goodTextStyles: {
|
|
108
84
|
title: string;
|
|
109
85
|
tag: string;
|
|
@@ -119,14 +95,6 @@ interface IProps {
|
|
|
119
95
|
const props = withDefaults(defineProps<IProps>(), {
|
|
120
96
|
height: '100%',
|
|
121
97
|
list: [],
|
|
122
|
-
priceData: {
|
|
123
|
-
discountTotal: 0,
|
|
124
|
-
discountTotalShow: '0.00',
|
|
125
|
-
marketPriceTotal: 0,
|
|
126
|
-
marketPriceTotalShow: '0.00',
|
|
127
|
-
platformPriceTotal: 0,
|
|
128
|
-
platformPriceTotalShow: '0.00'
|
|
129
|
-
},
|
|
130
98
|
goodTextStyles: {
|
|
131
99
|
title: '27rpx',
|
|
132
100
|
tag: '18rpx',
|
|
@@ -147,19 +115,6 @@ const actions = [
|
|
|
147
115
|
}
|
|
148
116
|
];
|
|
149
117
|
|
|
150
|
-
const isAll = computed(() => {
|
|
151
|
-
const availableList =
|
|
152
|
-
props?.list?.filter(
|
|
153
|
-
(v) => v.skuInfo.existInventory && v.skuInfo.saleStatus === 10
|
|
154
|
-
) || [];
|
|
155
|
-
const selected = availableList.filter((v) => v.selected);
|
|
156
|
-
return selected.length === availableList.length && availableList.length !== 0;
|
|
157
|
-
});
|
|
158
|
-
|
|
159
|
-
const selectCount = computed(() => {
|
|
160
|
-
return props.list.filter((v) => v.selected).length;
|
|
161
|
-
});
|
|
162
|
-
|
|
163
118
|
const countChange = (val: changeValueType, item: cartItemListType) => {
|
|
164
119
|
emit('countChange', val, item);
|
|
165
120
|
setTimeout(() => {
|
|
@@ -172,7 +127,7 @@ const goDetails = (goodsInfo: skuInfoType, item: cartItemListType) => {
|
|
|
172
127
|
};
|
|
173
128
|
|
|
174
129
|
const calcHandle = () => {
|
|
175
|
-
const itemList = props
|
|
130
|
+
const itemList = props?.list?.filter((v) => v.selected) || [];
|
|
176
131
|
emit('calcHandle', itemList);
|
|
177
132
|
};
|
|
178
133
|
|
|
@@ -183,13 +138,6 @@ const slideOptions = (val: { index: number }, data: cartItemListType) => {
|
|
|
183
138
|
}, 0);
|
|
184
139
|
};
|
|
185
140
|
|
|
186
|
-
const buyPlay = () => {
|
|
187
|
-
emit(
|
|
188
|
-
'buyPlay',
|
|
189
|
-
props.list.filter((v) => v.selected)
|
|
190
|
-
);
|
|
191
|
-
};
|
|
192
|
-
|
|
193
141
|
const buyChange = (e) => {
|
|
194
142
|
emit('checkGoods', e.detail.value);
|
|
195
143
|
setTimeout(() => {
|
|
@@ -197,16 +145,6 @@ const buyChange = (e) => {
|
|
|
197
145
|
}, 0);
|
|
198
146
|
};
|
|
199
147
|
|
|
200
|
-
const checkAll = (e) => {
|
|
201
|
-
const availableList = props.list.filter(
|
|
202
|
-
(v) => v.skuInfo.existInventory && v.skuInfo.saleStatus === 10
|
|
203
|
-
);
|
|
204
|
-
emit('checkGoods', isAll.value ? [] : availableList.map((v) => v.id));
|
|
205
|
-
setTimeout(() => {
|
|
206
|
-
calcHandle();
|
|
207
|
-
}, 0);
|
|
208
|
-
};
|
|
209
|
-
|
|
210
148
|
onReady(() => {});
|
|
211
149
|
|
|
212
150
|
// watch(
|
|
@@ -11,14 +11,12 @@
|
|
|
11
11
|
></ui-checkbox>
|
|
12
12
|
</ui-label>
|
|
13
13
|
<view class="ui-total-price">
|
|
14
|
-
<view class="top"
|
|
15
|
-
|
|
14
|
+
<view class="top">
|
|
15
|
+
<text class="buy-num">已选购</text>
|
|
16
16
|
<text class="buy-count">{{ selectCount }}件</text>
|
|
17
17
|
<text class="reduction-tip">优惠后合计</text>
|
|
18
|
-
<text class="ui-bold"
|
|
19
|
-
|
|
20
|
-
></view
|
|
21
|
-
>
|
|
18
|
+
<text class="ui-bold">¥{{ priceData.platformPriceTotalShow }}</text>
|
|
19
|
+
</view>
|
|
22
20
|
<text class="reduction">共减¥{{ priceData.discountTotalShow }}</text>
|
|
23
21
|
</view>
|
|
24
22
|
</view>
|
|
@@ -29,28 +27,27 @@
|
|
|
29
27
|
padding="27rpx 70rpx"
|
|
30
28
|
:background="primaryColor"
|
|
31
29
|
:loading="loading"
|
|
32
|
-
@click="
|
|
33
|
-
>去结算</ui-form-button
|
|
30
|
+
@click="buyPlayMethod"
|
|
34
31
|
>
|
|
32
|
+
去结算
|
|
33
|
+
</ui-form-button>
|
|
35
34
|
</view>
|
|
36
35
|
</template>
|
|
37
36
|
<script setup lang="ts">
|
|
38
|
-
import
|
|
39
|
-
|
|
37
|
+
import { computed } from 'vue';
|
|
38
|
+
import type { priceDataType, cartItemListType } from '../interface/types';
|
|
40
39
|
interface IProps {
|
|
41
|
-
|
|
42
|
-
isAll: boolean;
|
|
40
|
+
list: cartItemListType[];
|
|
43
41
|
priceData: priceDataType;
|
|
44
42
|
loading: boolean;
|
|
45
43
|
primaryColor: string;
|
|
46
44
|
}
|
|
47
45
|
const emit = defineEmits<{
|
|
48
|
-
(e: 'buyPlay'): void;
|
|
49
|
-
(e: '
|
|
46
|
+
(e: 'buyPlay', item: cartItemListType[]): void;
|
|
47
|
+
(e: 'checkGoods', value: number[]): void;
|
|
48
|
+
(e: 'calcHandle', itemList: cartItemListType[]): void;
|
|
50
49
|
}>();
|
|
51
50
|
const props = withDefaults(defineProps<IProps>(), {
|
|
52
|
-
selectCount: 0,
|
|
53
|
-
isAll: false,
|
|
54
51
|
priceData: {
|
|
55
52
|
discountTotal: 0,
|
|
56
53
|
discountTotalShow: '0.00',
|
|
@@ -61,12 +58,38 @@ const props = withDefaults(defineProps<IProps>(), {
|
|
|
61
58
|
},
|
|
62
59
|
primaryColor: '#6D7278'
|
|
63
60
|
});
|
|
64
|
-
const
|
|
65
|
-
|
|
61
|
+
const isAll = computed(() => {
|
|
62
|
+
const availableList =
|
|
63
|
+
props?.list?.filter(
|
|
64
|
+
(v) => v.skuInfo.existInventory && v.skuInfo.saleStatus === 10
|
|
65
|
+
) || [];
|
|
66
|
+
const selected = availableList.filter((v) => v.selected);
|
|
67
|
+
return selected.length === availableList.length && availableList.length !== 0;
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
const selectCount = computed(() => {
|
|
71
|
+
return props?.list?.filter((v) => v.selected).length || 0;
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
const buyPlayMethod = () => {
|
|
75
|
+
emit(
|
|
76
|
+
'buyPlay',
|
|
77
|
+
props.list.filter((v) => v.selected)
|
|
78
|
+
);
|
|
66
79
|
};
|
|
67
80
|
|
|
68
81
|
const checkAll = (e) => {
|
|
69
|
-
|
|
82
|
+
const availableList = props.list.filter(
|
|
83
|
+
(v) => v.skuInfo.existInventory && v.skuInfo.saleStatus === 10
|
|
84
|
+
);
|
|
85
|
+
emit('checkGoods', isAll.value ? [] : availableList.map((v) => v.id));
|
|
86
|
+
setTimeout(() => {
|
|
87
|
+
calcHandle();
|
|
88
|
+
}, 0);
|
|
89
|
+
};
|
|
90
|
+
const calcHandle = () => {
|
|
91
|
+
const itemList = props.list.filter((v) => v.selected);
|
|
92
|
+
emit('calcHandle', itemList);
|
|
70
93
|
};
|
|
71
94
|
</script>
|
|
72
95
|
<style scoped lang="scss">
|
|
@@ -83,7 +106,6 @@ const checkAll = (e) => {
|
|
|
83
106
|
padding: 0 29rpx;
|
|
84
107
|
box-sizing: border-box;
|
|
85
108
|
font-size: 24rpx;
|
|
86
|
-
z-index: 9999;
|
|
87
109
|
&::before {
|
|
88
110
|
content: ' ';
|
|
89
111
|
width: 100%;
|