@yorkjs/hive-ui 2.3.1 → 2.3.2

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yorkjs/hive-ui",
3
- "version": "2.3.1",
3
+ "version": "2.3.2",
4
4
  "description": "Hive UI - Taro React component library",
5
5
  "main": "src/index.ts",
6
6
  "module": "src/index.ts",
@@ -36,6 +36,7 @@ export interface IProductCardLabels {
36
36
  multiple_spec?: string
37
37
  barcode_label?: string
38
38
  spec_label?: string
39
+ remaining_label?: string
39
40
  sold_out?: string
40
41
  offline?: string
41
42
  }
@@ -88,6 +89,10 @@ export interface IProductCardProps {
88
89
  salePrice: string | number
89
90
  /** 原价 (划线价) */
90
91
  originalPrice?: string | number
92
+ /** 剩余次数(次卡独立权益等场景) */
93
+ remainingCount?: number | string
94
+ /** 剩余次数对应的总次数(与 remainingCount 组成 剩余/总数) */
95
+ remainingTotal?: number | string
91
96
  /** 已购数量 (显示为 xN) */
92
97
  buyCount?: number
93
98
  /** 是否显示左侧勾选框 */
@@ -135,6 +140,8 @@ const ProductItem: React.FC<IProductCardProps> = (props) => {
135
140
  salePricePrefix,
136
141
  salePrice,
137
142
  originalPrice,
143
+ remainingCount,
144
+ remainingTotal,
138
145
  buyCount,
139
146
  showSoldOut = false,
140
147
  showOffline = false,
@@ -350,6 +357,29 @@ const ProductItem: React.FC<IProductCardProps> = (props) => {
350
357
  )
351
358
  : undefined
352
359
  }
360
+ {
361
+ remainingCount != null && remainingCount !== ''
362
+ ? (
363
+ <View className={styles['remaining-row']}>
364
+ <Text className={styles['remaining-label']}>
365
+ {labels.remaining_label}:
366
+ </Text>
367
+ <Text className={styles['remaining-value']}>
368
+ {remainingCount}
369
+ </Text>
370
+ {
371
+ remainingTotal != null && remainingTotal !== ''
372
+ ? (
373
+ <Text className={styles['remaining-total']}>
374
+ /{remainingTotal}
375
+ </Text>
376
+ )
377
+ : undefined
378
+ }
379
+ </View>
380
+ )
381
+ : undefined
382
+ }
353
383
  {
354
384
  customization
355
385
  ? (
@@ -26,6 +26,7 @@ let globalLabels: IProductCardLabels = {
26
26
  multiple_spec: '多规格',
27
27
  barcode_label: '条码',
28
28
  spec_label: '规格',
29
+ remaining_label: '剩余次数',
29
30
  sold_out: '售罄',
30
31
  offline: '已下架'
31
32
  }
@@ -205,6 +205,27 @@ $F_BUY_COUNT = 14PX // RN 14
205
205
  margin-top 5PX
206
206
  lineClamp(1)
207
207
 
208
+ .remaining-row
209
+ display flex
210
+ flex-direction row
211
+ align-items baseline
212
+ margin-top 5PX
213
+
214
+ .remaining-label
215
+ font-size $F_SPEC
216
+ color var(--textContent)
217
+ line-height 15PX
218
+
219
+ .remaining-value
220
+ font-size $F_SPEC
221
+ color var(--primary)
222
+ line-height 15PX
223
+
224
+ .remaining-total
225
+ font-size $F_SPEC
226
+ color var(--textContent)
227
+ line-height 15PX
228
+
208
229
  .customization-text
209
230
  font-size $F_CUSTOM
210
231
  color var(--textMuted)