@pisell/materials 6.11.97 → 6.11.98

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.
Files changed (42) hide show
  1. package/build/lowcode/assets-daily.json +11 -11
  2. package/build/lowcode/assets-dev.json +2 -2
  3. package/build/lowcode/assets-prod.json +11 -11
  4. package/build/lowcode/index.js +1 -1
  5. package/build/lowcode/meta.js +1 -1
  6. package/build/lowcode/preview.js +6 -6
  7. package/build/lowcode/render/default/view.css +1 -1
  8. package/build/lowcode/render/default/view.js +7 -7
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +7 -7
  11. package/es/components/buttonGroupPreview/index.js +2 -1
  12. package/es/components/pisellFind/index.d.ts +34 -12
  13. package/es/components/pisellFind/index.js +114 -18
  14. package/es/components/pisellRecordBoard/layouts/GridLayout/Grid.js +4 -2
  15. package/es/components/productCard/cartSkuCard/components/resources/index.less +4 -0
  16. package/es/components/productCard/lineItem/BookingLineItem.d.ts +2 -1
  17. package/es/components/productCard/lineItem/BookingLineItem.js +15 -6
  18. package/es/components/productCard/lineItem/components/Holders/index.d.ts +10 -0
  19. package/es/components/productCard/lineItem/components/Holders/index.js +74 -0
  20. package/es/components/productCard/lineItem/components/Holders/index.less +39 -0
  21. package/es/components/productCard/lineItem/index.d.ts +10 -8
  22. package/es/components/productCard/lineItem/index.js +61 -13
  23. package/es/components/productCard/lineItem/index.less +3 -3
  24. package/es/components/productCard/lineItem/types.d.ts +4 -0
  25. package/es/components/productCard/types.d.ts +1 -0
  26. package/lib/components/buttonGroupPreview/index.js +2 -1
  27. package/lib/components/pisellFind/index.d.ts +34 -12
  28. package/lib/components/pisellFind/index.js +80 -5
  29. package/lib/components/pisellRecordBoard/layouts/GridLayout/Grid.js +1 -1
  30. package/lib/components/productCard/cartSkuCard/components/resources/index.less +4 -0
  31. package/lib/components/productCard/lineItem/BookingLineItem.d.ts +2 -1
  32. package/lib/components/productCard/lineItem/BookingLineItem.js +14 -2
  33. package/lib/components/productCard/lineItem/components/Holders/index.d.ts +10 -0
  34. package/lib/components/productCard/lineItem/components/Holders/index.js +83 -0
  35. package/lib/components/productCard/lineItem/components/Holders/index.less +39 -0
  36. package/lib/components/productCard/lineItem/index.d.ts +10 -8
  37. package/lib/components/productCard/lineItem/index.js +51 -10
  38. package/lib/components/productCard/lineItem/index.less +3 -3
  39. package/lib/components/productCard/lineItem/types.d.ts +4 -0
  40. package/lib/components/productCard/types.d.ts +1 -0
  41. package/lowcode/pisell-find/meta.ts +19 -0
  42. package/package.json +3 -3
@@ -55,6 +55,40 @@ var translateText = (text, translationOriginal) => {
55
55
  if (!text) return "";
56
56
  return translationOriginal(text);
57
57
  };
58
+ function resolveLineItemUnitPrices(product) {
59
+ const metadata = (product == null ? void 0 : product.metadata) || {};
60
+ const promotion = metadata._promotion;
61
+ const optionSum = ((product == null ? void 0 : product.product_option_item) || []).reduce(
62
+ (sum, option) => {
63
+ const price = Number(option == null ? void 0 : option.price) || 0;
64
+ const num = Number(option == null ? void 0 : option.num) || 1;
65
+ return sum + price * num;
66
+ },
67
+ 0
68
+ );
69
+ const unitOriginal = (() => {
70
+ if (metadata.main_product_original_price != null && metadata.main_product_original_price !== "") {
71
+ return Number(metadata.main_product_original_price) - optionSum;
72
+ }
73
+ if ((promotion == null ? void 0 : promotion.originalPrice) != null && promotion.originalPrice !== "") {
74
+ return Number(promotion.originalPrice);
75
+ }
76
+ return Number((product == null ? void 0 : product.original_price) ?? (product == null ? void 0 : product.selling_price) ?? 0);
77
+ })();
78
+ const unitSelling = (() => {
79
+ if (metadata.main_product_selling_price != null && metadata.main_product_selling_price !== "") {
80
+ return Number(metadata.main_product_selling_price) - optionSum;
81
+ }
82
+ if ((promotion == null ? void 0 : promotion.inPromotion) && promotion.finalPrice != null && promotion.finalPrice !== "") {
83
+ return Number(promotion.finalPrice);
84
+ }
85
+ return Number((product == null ? void 0 : product.payment_price) ?? (product == null ? void 0 : product.selling_price) ?? unitOriginal);
86
+ })();
87
+ return {
88
+ unitSelling: Number.isFinite(unitSelling) ? unitSelling : 0,
89
+ unitOriginal: Number.isFinite(unitOriginal) ? unitOriginal : 0
90
+ };
91
+ }
58
92
  var convertBundleOption = (option, translationOriginal) => ({
59
93
  ...option,
60
94
  id: option.option_group_item_id,
@@ -90,11 +124,12 @@ var convertBundle = (bundle, translationOriginal) => {
90
124
  };
91
125
  };
92
126
  var convertProductToLineItemProduct = (product, translationOriginal, symbol) => {
93
- var _a, _b, _c, _d;
127
+ var _a, _b, _c, _d, _e, _f, _g, _h;
94
128
  const title = translateText(product.product_title || product.title, translationOriginal);
95
129
  const bundle = (product.product_bundle || []).map(
96
130
  (bundleItem) => convertBundle(bundleItem, translationOriginal)
97
131
  );
132
+ const { unitSelling, unitOriginal } = resolveLineItemUnitPrices(product);
98
133
  return {
99
134
  _id: ((_a = product.metadata) == null ? void 0 : _a.unique_identification_number) || product.order_detail_id || product.product_id,
100
135
  id: product.product_id,
@@ -107,11 +142,11 @@ var convertProductToLineItemProduct = (product, translationOriginal, symbol) =>
107
142
  image: product.cover,
108
143
  num: product.num ?? product.product_quantity ?? 1,
109
144
  quantity: product.num ?? product.product_quantity ?? 1,
110
- price: ((_b = product.metadata) == null ? void 0 : _b.source_product_price) ?? product.selling_price,
111
- total: product.payment_price ?? product.selling_price,
112
- origin_total: product.original_price,
113
- original_total: product.original_price,
114
- source_product_price: (_c = product.metadata) == null ? void 0 : _c.source_product_price,
145
+ price: unitSelling,
146
+ total: unitSelling,
147
+ origin_total: unitOriginal,
148
+ original_total: unitOriginal,
149
+ source_product_price: (_b = product.metadata) == null ? void 0 : _b.source_product_price,
115
150
  selling_price: product.selling_price,
116
151
  payment_price: product.payment_price,
117
152
  tax_fee: product.tax_fee,
@@ -123,20 +158,24 @@ var convertProductToLineItemProduct = (product, translationOriginal, symbol) =>
123
158
  product_option_string: product.product_sku ? translateText(product.product_sku.subtitle, translationOriginal) : "",
124
159
  discount_list: product.discount_list,
125
160
  promotions: product.promotions,
126
- isGift: Boolean(product.gift_card),
161
+ discount_reason: ((_e = (_d = (_c = product.discount_list) == null ? void 0 : _c.find((d) => (d == null ? void 0 : d.type) === "product")) == null ? void 0 : _d.discount) == null ? void 0 : _e.message) ?? ((_f = product.metadata) == null ? void 0 : _f.product_discount_reason),
162
+ // 促销赠品走 metadata._giftInfo;礼品卡走 gift_card(对齐 legacy formatProducts isGift)
163
+ isGift: Boolean(
164
+ product.gift_card || product.isGift || product._isGiftPromotion || ((_g = product.metadata) == null ? void 0 : _g._giftInfo) || product._giftInfo
165
+ ),
127
166
  giftData: product.giftData,
128
167
  _origin: product,
129
168
  _extend: {
130
169
  other: {
131
170
  product_id: product.product_id,
132
- option: (_d = product.product_sku) == null ? void 0 : _d.option,
171
+ option: (_h = product.product_sku) == null ? void 0 : _h.option,
133
172
  bundle: product.product_bundle,
134
173
  product_variant_id: product.product_variant_id,
135
174
  quantity: product.num ?? product.product_quantity ?? 1
136
175
  },
137
176
  note: product.note,
138
- total: product.payment_price,
139
- origin_total: product.original_price,
177
+ total: unitSelling,
178
+ origin_total: unitOriginal,
140
179
  payment_price: product.payment_price
141
180
  }
142
181
  };
@@ -159,6 +198,7 @@ var LineItem = (props) => {
159
198
  statusLoading = false,
160
199
  statusDisabled = false,
161
200
  isShowRelatedProduct = true,
201
+ holderOptions,
162
202
  onBookingStatusChange,
163
203
  onAction,
164
204
  onDelete,
@@ -234,6 +274,7 @@ var LineItem = (props) => {
234
274
  statusLoading,
235
275
  statusDisabled,
236
276
  isShowRelatedProduct,
277
+ holderOptions,
237
278
  onBookingStatusChange,
238
279
  onAction,
239
280
  onDelete,
@@ -18,10 +18,10 @@
18
18
  &__delete-btn {
19
19
  width: 34px;
20
20
  height: 34px;
21
- border: 1px solid rgba(255, 255, 255, 0.35);
21
+ border: 1px solid var(--Gray-300, #d0d5dd);
22
22
  border-radius: 8px;
23
- background: rgba(255, 255, 255, 0.12);
24
- color: #fff;
23
+ background: var(--Gray-100, #f2f4f7);
24
+ color: var(--Gray-500, #667085);
25
25
  cursor: pointer;
26
26
  padding: 0;
27
27
  display: inline-flex;
@@ -7,3 +7,7 @@ export interface LineItemStatusOption {
7
7
  color?: string;
8
8
  danger?: boolean;
9
9
  }
10
+ export interface LineItemHolderOption {
11
+ id: string | number;
12
+ label: ReactNode;
13
+ }
@@ -65,6 +65,7 @@ export declare type productType = {
65
65
  */
66
66
  export declare type ProductCardTypes = {
67
67
  dataSource: productType;
68
+ isFormSubject?: boolean;
68
69
  isShowImage?: boolean;
69
70
  isShowOriginalPrice?: boolean;
70
71
  isShowHolder?: boolean;
@@ -326,6 +326,20 @@ const PisellFindMeta = {
326
326
  setter: ['BoolSetter', 'VariableSetter'],
327
327
  defaultValue: false,
328
328
  },
329
+ {
330
+ name: 'enableScanner',
331
+ title: {
332
+ label: {
333
+ type: 'i18n',
334
+ 'en-US': 'Enable Scanner',
335
+ 'zh-CN': '开启扫码枪监听',
336
+ },
337
+ tip: '为 true 时通过 app.pubsub.subscribe("nativeScanResult") 订阅硬件扫码事件;切回 false 会自动 unsubscribe 不再接收回调',
338
+ },
339
+ propType: 'bool',
340
+ setter: ['BoolSetter', 'VariableSetter'],
341
+ defaultValue: false,
342
+ },
329
343
  ],
330
344
  },
331
345
  ],
@@ -353,6 +367,11 @@ const PisellFindMeta = {
353
367
  template:
354
368
  'onClose(${extParams}){\n// 查找面板关闭回调\nconsole.log("onClose");}',
355
369
  },
370
+ {
371
+ name: 'onScannerData',
372
+ template:
373
+ 'onScannerData(payload,${extParams}){\n// 扫码枪事件回调(nativeScanResult)\n// payload: { code: 写入输入框并触发 onSearch 的关键词, data: 原始扫描字符串 }\nconsole.log("onScannerData", payload);}',
374
+ },
356
375
  ],
357
376
  },
358
377
  component: {},
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pisell/materials",
3
- "version": "6.11.97",
3
+ "version": "6.11.98",
4
4
  "main": "./lib/index.js",
5
5
  "module": "./es/index.js",
6
6
  "types": "./lib/index.d.ts",
@@ -99,8 +99,8 @@
99
99
  "antd-mobile": "^5.38.1",
100
100
  "vod-js-sdk-v6": "^1.4.11",
101
101
  "@pisell/date-picker": "3.0.8",
102
- "@pisell/icon": "0.0.11",
103
- "@pisell/utils": "3.0.2"
102
+ "@pisell/utils": "3.0.2",
103
+ "@pisell/icon": "0.0.11"
104
104
  },
105
105
  "peerDependencies": {
106
106
  "react": "^18.0.0",