cb-biz-ui 1.3.5 → 1.3.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.
@@ -26,8 +26,9 @@
26
26
  <view class="goods-card_info_title">
27
27
  <ui-overflow-hidden size="24rpx">
28
28
  <text class="text" :style="{ fontSize: textFontSize.title }">{{
29
- entity.name
30
- }}</text>
29
+ entity.name
30
+ }}
31
+ </text>
31
32
  </ui-overflow-hidden>
32
33
  </view>
33
34
  <view class="goods-card_info_tag" v-if="entity.hasDiscount">
@@ -36,21 +37,38 @@
36
37
  padding="6rpx 10rpx"
37
38
  :size="textFontSize.tag"
38
39
  plain
39
- ><view class="tag-box">
40
+ >
41
+ <view class="tag-box">
40
42
  <image
41
43
  class="icon icon_yh"
42
44
  src="https://shop-cdn.cbyzx.com/shop23n05y18abcd/img/5131a04c08bf4c80b73291f82186ce46.png"
43
45
  />
44
46
 
45
47
  <text>{{ getDiscount(entity.discount) }}</text>
46
- </view></ui-tag
48
+ </view>
49
+ </ui-tag>
50
+ <ui-tag
51
+ type="danger"
52
+ padding="6rpx 10rpx"
53
+ v-if="entity.purchaseLimitNum !== -1"
54
+ :size="textFontSize.tag"
55
+ plain
47
56
  >
57
+ <view class="tag-box">
58
+ <image
59
+ class="icon icon_yh"
60
+ src="https://shop-cdn.cbyzx.com/shop23n05y18abcd/img/0eb08f3800884600bde0cd670aecc869@.png@.webp"
61
+ />
62
+
63
+ <text>每人限{{entity.purchaseLimitNum}}份</text>
64
+ </view>
65
+ </ui-tag>
48
66
  </view>
49
67
  <view class="goods-card_info_sales-volume">
50
68
  <text
51
69
  class="goods-card_info_sales-volume_text"
52
70
  :style="{ fontSize: textFontSize.salesVolume }"
53
- >销量{{ ` ` }}{{ entity.saleCnt || 0 }}
71
+ >销量{{ ` ` }}{{ entity.saleCnt || 0 }}
54
72
  </text>
55
73
  </view>
56
74
  <view class="goods-card_info_price">
@@ -58,14 +76,14 @@
58
76
  class="goods-card_info_price_preferential-price"
59
77
  :style="{ fontSize: textFontSize.preferentialPrice }"
60
78
  >
61
- ¥{{ price }}/{{ entity?.unitTitle || '' }}
79
+ ¥{{ price }}/{{ entity?.unitTitle || "" }}
62
80
  </text>
63
81
  <text
64
82
  class="goods-card_info_price_price"
65
83
  v-if="entity.hasDiscount"
66
84
  :style="{ fontSize: textFontSize.price }"
67
85
  >
68
- ¥{{ entity.marketPriceShow }}/{{ entity.unitTitle || '' }}
86
+ ¥{{ entity.marketPriceShow }}/{{ entity.unitTitle || "" }}
69
87
  </text>
70
88
  </view>
71
89
  <view class="goods-card_info_status" v-if="errStatusText">
@@ -128,8 +146,8 @@
128
146
  </template>
129
147
 
130
148
  <script setup lang="ts">
131
- import { onMounted, reactive, computed } from 'vue';
132
- import type { GoodsDataType, changeValueType } from '../interface/types';
149
+ import { onMounted, reactive, computed } from "vue";
150
+ import type { GoodsDataType, changeValueType } from "../interface/types";
133
151
 
134
152
  interface IProps {
135
153
  entity: GoodsDataType;
@@ -140,19 +158,19 @@ interface IProps {
140
158
  goodMin?: number;
141
159
  imagePlaceholder?: string;
142
160
  imageMode?:
143
- | 'scaleToFill'
144
- | 'aspectFit'
145
- | 'aspectFill'
146
- | 'widthFix'
147
- | 'top'
148
- | 'bottom'
149
- | 'center'
150
- | 'left'
151
- | 'right'
152
- | 'top left'
153
- | 'top right'
154
- | 'bottom left'
155
- | 'bottom right';
161
+ | "scaleToFill"
162
+ | "aspectFit"
163
+ | "aspectFill"
164
+ | "widthFix"
165
+ | "top"
166
+ | "bottom"
167
+ | "center"
168
+ | "left"
169
+ | "right"
170
+ | "top left"
171
+ | "top right"
172
+ | "bottom left"
173
+ | "bottom right";
156
174
  textFontSize?: {
157
175
  title: string;
158
176
  tag: string;
@@ -162,35 +180,36 @@ interface IProps {
162
180
  numberBoxBg?: string;
163
181
  };
164
182
  }
183
+
165
184
  const props = withDefaults(defineProps<IProps>(), {
166
- imgWidth: '225rpx',
167
- imgHeight: '225rpx',
185
+ imgWidth: "225rpx",
186
+ imgHeight: "225rpx",
168
187
  goodMin: 0,
169
188
  goodsCount: 0,
170
189
  bezier: true,
171
190
  imagePlaceholder:
172
- 'https://shop-cdn.cbyzx.com/shop23n05y18abcd/img/3544375090854cd099d72edb09dce492.png',
173
- imageMode: 'aspectFill',
191
+ "https://shop-cdn.cbyzx.com/shop23n05y18abcd/img/3544375090854cd099d72edb09dce492.png",
192
+ imageMode: "aspectFill",
174
193
  textFontSize: {
175
- title: '24rpx',
176
- tag: '18rpx',
177
- salesVolume: '20rpx',
178
- preferentialPrice: '24rpx',
179
- price: '20rpx',
180
- numberBoxBg: '#fff'
194
+ title: "24rpx",
195
+ tag: "18rpx",
196
+ salesVolume: "20rpx",
197
+ preferentialPrice: "24rpx",
198
+ price: "20rpx",
199
+ numberBoxBg: "#fff"
181
200
  },
182
201
  entity: {
183
- goodSrc: '',
184
- title: '',
202
+ goodSrc: "",
203
+ title: "",
185
204
  preferentialPrice: 0,
186
205
  status: 0,
187
- unit: ''
206
+ unit: ""
188
207
  }
189
208
  });
190
209
 
191
210
  const emit = defineEmits<{
192
- (e: 'countChange', value: changeValueType, entity: GoodsDataType): void;
193
- (e: 'handleClick', entity: GoodsDataType): void;
211
+ (e: "countChange", value: changeValueType, entity: GoodsDataType): void;
212
+ (e: "handleClick", entity: GoodsDataType): void;
194
213
  }>();
195
214
 
196
215
  const price = computed(() => {
@@ -200,12 +219,12 @@ const price = computed(() => {
200
219
  });
201
220
  const errStatusText = computed(() => {
202
221
  if (props.entity.saleStatus === 20) {
203
- return '已失效';
222
+ return "已失效";
204
223
  }
205
224
  if (!props.entity.existInventory) {
206
- return '无货';
225
+ return "无货";
207
226
  }
208
- return '';
227
+ return "";
209
228
  });
210
229
 
211
230
  const state = reactive({
@@ -223,13 +242,13 @@ const change = (val: changeValueType) => {
223
242
  // if (val > props.entity.inventoryCapacity) {
224
243
  // triggerMax();
225
244
  // }
226
- emit('countChange', val, props.entity);
245
+ emit("countChange", val, props.entity);
227
246
  };
228
247
 
229
248
  const triggerMax = () => {
230
249
  uni.showModal({
231
- title: '提示',
232
- content: '库存不足,最大库存为' + props.entity.inventoryCapacity,
250
+ title: "提示",
251
+ content: "库存不足,最大库存为" + props.entity.inventoryCapacity,
233
252
  showCancel: false
234
253
  });
235
254
  };
@@ -241,7 +260,7 @@ const load = () => {
241
260
  };
242
261
 
243
262
  const itemTap = () => {
244
- emit('handleClick', props.entity);
263
+ emit("handleClick", props.entity);
245
264
  };
246
265
 
247
266
  onMounted(() => {
@@ -251,7 +270,7 @@ onMounted(() => {
251
270
  const addClick = () => {
252
271
  change({
253
272
  value: props.goodsCount + 1,
254
- type: 'plus',
273
+ type: "plus",
255
274
  index: 0,
256
275
  custom: {}
257
276
  });
@@ -31,6 +31,7 @@ export interface GoodsDataType {
31
31
  marketPriceShow: string;
32
32
  existInventory: boolean; // 是否有库存
33
33
  saleCnt: number; // 销量
34
+ purchaseLimitNum: number // 限购数量
34
35
  }
35
36
  export interface changeValueType {
36
37
  value: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cb-biz-ui",
3
- "version": "1.3.5",
3
+ "version": "1.3.6",
4
4
  "description": "cb-biz-ui",
5
5
  "main": "index.js",
6
6
  "keywords": [