cb-biz-ui 1.7.4 → 1.7.5

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
- <scroll-view
4
- scroll-y
5
- :style="{ height: height }"
6
- :show-scrollbar="false"
7
- :enhanced="true"
8
- >
9
- <view class="shopping-cart" v-if="list.length">
10
- <ui-checkbox-group
11
- @change="buyChange"
12
- :formFieldStyle="{
13
- padding: 0
14
- }"
15
- formFieldPadding="0"
16
- formFieldBackground="#f5f5f5"
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-slide-view
24
- :threshold="20"
25
- :right-options="actions"
26
- @click="(index) => slideOptions(index, item)"
27
- >
28
- <view class="ui-goods-item">
29
- <ui-label width="50rpx" min-height="100%" class="ui-checkbox">
30
- <ui-checkbox
31
- :trigger-group="false"
32
- borderColor="#6D7278"
33
- :color="primaryColor"
34
- :scaleRatio="0.8"
35
- :value="item.id"
36
- :checked="item.selected"
37
- :disabled="
38
- item.skuInfo.inventoryCapacity === 0 ||
39
- item.skuInfo.saleStatus !== 10
40
- "
41
- ></ui-checkbox>
42
- </ui-label>
43
-
44
- <view class="goods-card_box bottom-1px-border">
45
- <goods-card
46
- imgWidth="239rpx"
47
- imgHeight="239rpx"
48
- image-placeholder="https://shop-cdn.cbyzx.com/shop23n05y18abcd/img/50fbba9d9b4e4184b9ab7e2fbb43c645.png"
49
- :textFontSize="props.goodTextStyles"
50
- :goodsCount="item.count"
51
- :add-btn-bg-color="primaryColor"
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
- </ui-slide-view>
60
- </view>
61
- </ui-checkbox-group>
62
- </view>
63
- <view v-else>
64
- <ui-no-data :fixed="false" marginTop="250" :imgUrl="nullDataUrl">
65
- <text class="tui-color__black">购物车暂无商品~</text>
66
- </ui-no-data>
67
- </view>
68
- </scroll-view>
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.list.filter((v) => v.selected);
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
- ><text class="buy-num">已选购</text>
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
- >¥{{ priceData.platformPriceTotalShow }}</text
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,26 @@
29
27
  padding="27rpx 70rpx"
30
28
  :background="primaryColor"
31
29
  :loading="loading"
32
- @click="btnPay"
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 type { priceDataType } from '../interface/types';
39
-
37
+ import type { priceDataType, cartItemListType } from '../interface/types';
40
38
  interface IProps {
41
- selectCount: number;
42
- isAll: boolean;
39
+ list: cartItemListType[];
43
40
  priceData: priceDataType;
44
41
  loading: boolean;
45
42
  primaryColor: string;
46
43
  }
47
44
  const emit = defineEmits<{
48
- (e: 'buyPlay'): void;
49
- (e: 'checkAll'): void;
45
+ (e: 'buyPlay', item: cartItemListType[]): void;
46
+ (e: 'checkGoods', value: number[]): void;
47
+ (e: 'calcHandle', itemList: cartItemListType[]): void;
50
48
  }>();
51
49
  const props = withDefaults(defineProps<IProps>(), {
52
- selectCount: 0,
53
- isAll: false,
54
50
  priceData: {
55
51
  discountTotal: 0,
56
52
  discountTotalShow: '0.00',
@@ -61,12 +57,38 @@ const props = withDefaults(defineProps<IProps>(), {
61
57
  },
62
58
  primaryColor: '#6D7278'
63
59
  });
64
- const btnPay = () => {
65
- emit('buyPlay');
60
+ const isAll = computed(() => {
61
+ const availableList =
62
+ props?.list?.filter(
63
+ (v) => v.skuInfo.existInventory && v.skuInfo.saleStatus === 10
64
+ ) || [];
65
+ const selected = availableList.filter((v) => v.selected);
66
+ return selected.length === availableList.length && availableList.length !== 0;
67
+ });
68
+
69
+ const selectCount = computed(() => {
70
+ return props?.list?.filter((v) => v.selected).length || 0;
71
+ });
72
+
73
+ const buyPlayMethod = () => {
74
+ emit(
75
+ 'buyPlay',
76
+ props.list.filter((v) => v.selected)
77
+ );
66
78
  };
67
79
 
68
80
  const checkAll = (e) => {
69
- emit('checkAll');
81
+ const availableList = props.list.filter(
82
+ (v) => v.skuInfo.existInventory && v.skuInfo.saleStatus === 10
83
+ );
84
+ emit('checkGoods', isAll.value ? [] : availableList.map((v) => v.id));
85
+ setTimeout(() => {
86
+ calcHandle();
87
+ }, 0);
88
+ };
89
+ const calcHandle = () => {
90
+ const itemList = props.list.filter((v) => v.selected);
91
+ emit('calcHandle', itemList);
70
92
  };
71
93
  </script>
72
94
  <style scoped lang="scss">
@@ -83,7 +105,6 @@ const checkAll = (e) => {
83
105
  padding: 0 29rpx;
84
106
  box-sizing: border-box;
85
107
  font-size: 24rpx;
86
- z-index: 9999;
87
108
  &::before {
88
109
  content: ' ';
89
110
  width: 100%;
@@ -49,3 +49,4 @@
49
49
  }
50
50
 
51
51
  }
52
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cb-biz-ui",
3
- "version": "1.7.4",
3
+ "version": "1.7.5",
4
4
  "description": "cb-biz-ui",
5
5
  "main": "index.js",
6
6
  "keywords": [