@pisell/pisellos 0.0.356 → 0.0.357

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.
@@ -1299,6 +1299,11 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
1299
1299
  var isMainProduct = flatItem.type === 'main'; // 单独购买
1300
1300
  var isBundleItem = flatItem.type === 'bundle'; // 套餐中购买
1301
1301
 
1302
+ // 主商品直接可用
1303
+ if (isMainProduct) {
1304
+ return true;
1305
+ }
1306
+
1302
1307
  // universal_discount: 单独购买和套餐中(子商品为原价)均可使用
1303
1308
  if (ruleType === 'universal_discount') {
1304
1309
  if (isMainProduct) {
@@ -342,7 +342,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
342
342
  };
343
343
  setOtherData(key: string, value: any): void;
344
344
  getOtherData(key: string): any;
345
- getProductTypeById(id: number): Promise<"normal" | "duration" | "session">;
345
+ getProductTypeById(id: number): Promise<"duration" | "session" | "normal">;
346
346
  /**
347
347
  * 提供给 UI 的方法,减轻 UI 层的计算压力,UI 层只需要传递 cartItemId 和 resourceCode 即返回对应的 renderList
348
348
  *
@@ -24,8 +24,9 @@ export var formatDefaultCapacitys = function formatDefaultCapacitys(_ref) {
24
24
  if ((capacity === null || capacity === void 0 ? void 0 : capacity.type) === 'package') {
25
25
  return (product_bundle || []).map(function (d) {
26
26
  var id = d.bundle_product_id;
27
+ var variantId = d.bundle_variant_id;
27
28
  var item = ((capacity === null || capacity === void 0 ? void 0 : capacity.package) || []).find(function (item) {
28
- return item.product_id === id;
29
+ return item.product_id === id || item.product_id === variantId;
29
30
  });
30
31
  return {
31
32
  id: id,
@@ -385,10 +385,15 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
385
385
  };
386
386
  var formatProduct = function formatProduct(items) {
387
387
  return items.map(function (item) {
388
+ var _item$is_charge_tax;
388
389
  return {
389
390
  product_id: item.product_id,
390
391
  product_variant_id: item.product_variant_id,
391
392
  quantity: item.num,
393
+ // 商品是否含税:1;0
394
+ is_charge_tax: (_item$is_charge_tax = item.is_charge_tax) !== null && _item$is_charge_tax !== void 0 ? _item$is_charge_tax : 0,
395
+ // 若商品不含税,计算得到的税费,单位(元)
396
+ tax_fee: item.tax_fee,
392
397
  // 整个商品折扣后的总金额
393
398
  selling_price: item.calculated_selling_price,
394
399
  // 整个商品折扣前的总金额
@@ -1003,6 +1003,9 @@ var RulesModule = class extends import_BaseModule.BaseModule {
1003
1003
  const ruleType = usageRules.type;
1004
1004
  const isMainProduct = flatItem.type === "main";
1005
1005
  const isBundleItem = flatItem.type === "bundle";
1006
+ if (isMainProduct) {
1007
+ return true;
1008
+ }
1006
1009
  if (ruleType === "universal_discount") {
1007
1010
  if (isMainProduct) {
1008
1011
  return true;
@@ -342,7 +342,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
342
342
  };
343
343
  setOtherData(key: string, value: any): void;
344
344
  getOtherData(key: string): any;
345
- getProductTypeById(id: number): Promise<"normal" | "duration" | "session">;
345
+ getProductTypeById(id: number): Promise<"duration" | "session" | "normal">;
346
346
  /**
347
347
  * 提供给 UI 的方法,减轻 UI 层的计算压力,UI 层只需要传递 cartItemId 和 resourceCode 即返回对应的 renderList
348
348
  *
@@ -47,8 +47,9 @@ var formatDefaultCapacitys = ({
47
47
  if ((capacity == null ? void 0 : capacity.type) === "package") {
48
48
  return (product_bundle || []).map((d) => {
49
49
  const id = d.bundle_product_id;
50
+ const variantId = d.bundle_variant_id;
50
51
  const item = ((capacity == null ? void 0 : capacity.package) || []).find(
51
- (item2) => item2.product_id === id
52
+ (item2) => item2.product_id === id || item2.product_id === variantId
52
53
  );
53
54
  return {
54
55
  id,
@@ -212,6 +212,10 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
212
212
  product_id: item.product_id,
213
213
  product_variant_id: item.product_variant_id,
214
214
  quantity: item.num,
215
+ // 商品是否含税:1;0
216
+ is_charge_tax: item.is_charge_tax ?? 0,
217
+ // 若商品不含税,计算得到的税费,单位(元)
218
+ tax_fee: item.tax_fee,
215
219
  // 整个商品折扣后的总金额
216
220
  selling_price: item.calculated_selling_price,
217
221
  // 整个商品折扣前的总金额
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "0.0.356",
4
+ "version": "0.0.357",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",