@pisell/pisellos 2.1.113 → 2.1.115

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.
@@ -18,6 +18,14 @@ interface Formattitle {
18
18
  interface PackageSubItemUsageRules {
19
19
  type: 'universal_discount' | 'package_exclusive' | 'single_item_promo' | 'custom_usage_rules';
20
20
  rules: ("original_price" | "markup_price")[];
21
+ package_scope?: {
22
+ type: 'all_packages' | 'specific_packages';
23
+ exclude_bundle_product_ids: number[];
24
+ include_bundle_product_ids: number[];
25
+ filter: 0 | 1;
26
+ rule: any[];
27
+ rule_type: 'and' | 'or';
28
+ };
21
29
  }
22
30
  interface Limitedrelationproductdata {
23
31
  id: number;
@@ -1831,6 +1831,16 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
1831
1831
  return true;
1832
1832
  }
1833
1833
  var ruleType = usageRules.type;
1834
+ // 套餐适用范围配置
1835
+ var packageScope = usageRules === null || usageRules === void 0 ? void 0 : usageRules.package_scope;
1836
+ var _ref9 = packageScope || {},
1837
+ scopeType = _ref9.type,
1838
+ _ref9$exclude_bundle_ = _ref9.exclude_bundle_product_ids,
1839
+ exclude_bundle_product_ids = _ref9$exclude_bundle_ === void 0 ? [] : _ref9$exclude_bundle_,
1840
+ _ref9$include_bundle_ = _ref9.include_bundle_product_ids,
1841
+ include_bundle_product_ids = _ref9$include_bundle_ === void 0 ? [] : _ref9$include_bundle_,
1842
+ _ref9$filter = _ref9.filter,
1843
+ filter = _ref9$filter === void 0 ? 0 : _ref9$filter;
1834
1844
  var isMainProduct = flatItem.type === 'main'; // 单独购买
1835
1845
  var isBundleItem = flatItem.type === 'bundle'; // 套餐中购买
1836
1846
 
@@ -1845,10 +1855,12 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
1845
1855
  return true; // 单独购买时可用
1846
1856
  }
1847
1857
  if (isBundleItem) {
1848
- var _flatItem$bundleItem9, _flatItem$bundleItem10;
1858
+ var _flatItem$bundleItem9, _flatItem$bundleItem10, _flatItem$originProdu, _flatItem$bundleItem11;
1849
1859
  // 套餐中购买时,判断是否为原价
1850
1860
  var priceType = (_flatItem$bundleItem9 = flatItem.bundleItem) === null || _flatItem$bundleItem9 === void 0 ? void 0 : _flatItem$bundleItem9.price_type;
1851
1861
  var priceTypeExt = (_flatItem$bundleItem10 = flatItem.bundleItem) === null || _flatItem$bundleItem10 === void 0 ? void 0 : _flatItem$bundleItem10.price_type_ext;
1862
+ // 主商品id
1863
+ var mainProductId = (flatItem === null || flatItem === void 0 || (_flatItem$originProdu = flatItem.originProduct) === null || _flatItem$originProdu === void 0 ? void 0 : _flatItem$originProdu.product_id) || (flatItem === null || flatItem === void 0 || (_flatItem$bundleItem11 = flatItem.bundleItem) === null || _flatItem$bundleItem11 === void 0 ? void 0 : _flatItem$bundleItem11.product_id) || 0;
1852
1864
  // original_price 对应:
1853
1865
  // 1. price_type: "markup" && price_type_ext: "product_price"
1854
1866
  // markup_price 对应:
@@ -1860,16 +1872,43 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
1860
1872
 
1861
1873
  // 检查 rules
1862
1874
  if (rules.length > 0) {
1863
- // 检查原价
1864
- if (isOriginalPrice && rules.includes('original_price')) {
1865
- return true;
1875
+ var _isOriginalPrice = isOriginalPrice && rules.includes('original_price');
1876
+ var _isMarkupPrice = isMarkupPrice && rules.includes('markup_price');
1877
+ // 价格是否符合规则:原价或加价
1878
+ var isPriceValid = _isOriginalPrice || _isMarkupPrice;
1879
+ // 套餐适用范围校验
1880
+ var isScopeValid = false;
1881
+
1882
+ // 排除套餐判断
1883
+ if (scopeType === 'all_packages') {
1884
+ // 所有套餐可用
1885
+ if (!filter) {
1886
+ isScopeValid = true;
1887
+ } else {
1888
+ isScopeValid = !exclude_bundle_product_ids.includes(Number(mainProductId));
1889
+ }
1866
1890
  }
1867
1891
 
1868
- // 检查加价
1869
- if (isMarkupPrice && rules.includes('markup_price')) {
1892
+ // 包含套餐判断
1893
+ if (scopeType === 'specific_packages') {
1894
+ isScopeValid = include_bundle_product_ids.includes(Number(mainProductId));
1895
+ }
1896
+
1897
+ // 价格和套餐适用范围都符合,则可用
1898
+ if (isPriceValid && isScopeValid) {
1870
1899
  return true;
1871
1900
  }
1872
1901
 
1902
+ // 检查原价
1903
+ // if (isOriginalPrice && rules.includes('original_price')) {
1904
+ // return true;
1905
+ // }
1906
+
1907
+ // 检查加价
1908
+ // if (isMarkupPrice && rules.includes('markup_price')) {
1909
+ // return true;
1910
+ // }
1911
+
1873
1912
  // 如果都不匹配,则不可用
1874
1913
  return false;
1875
1914
  }
@@ -1886,29 +1925,29 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
1886
1925
  return false; // 单独购买时不可用
1887
1926
  }
1888
1927
  if (isBundleItem) {
1889
- var _flatItem$bundleItem11, _flatItem$bundleItem12;
1928
+ var _flatItem$bundleItem12, _flatItem$bundleItem13;
1890
1929
  // 套餐中购买时,判断是否为原价
1891
- var _priceType = (_flatItem$bundleItem11 = flatItem.bundleItem) === null || _flatItem$bundleItem11 === void 0 ? void 0 : _flatItem$bundleItem11.price_type;
1892
- var _priceTypeExt = (_flatItem$bundleItem12 = flatItem.bundleItem) === null || _flatItem$bundleItem12 === void 0 ? void 0 : _flatItem$bundleItem12.price_type_ext;
1930
+ var _priceType = (_flatItem$bundleItem12 = flatItem.bundleItem) === null || _flatItem$bundleItem12 === void 0 ? void 0 : _flatItem$bundleItem12.price_type;
1931
+ var _priceTypeExt = (_flatItem$bundleItem13 = flatItem.bundleItem) === null || _flatItem$bundleItem13 === void 0 ? void 0 : _flatItem$bundleItem13.price_type_ext;
1893
1932
 
1894
1933
  // original_price 对应:
1895
1934
  // 1. price_type: "markup" && price_type_ext: "product_price"
1896
1935
  // markup_price 对应:
1897
1936
  // price_type: "markup" && price_type_ext: ""
1898
1937
  /** 原价 */
1899
- var _isOriginalPrice = _priceType === 'markup' && _priceTypeExt === 'product_price';
1938
+ var _isOriginalPrice2 = _priceType === 'markup' && _priceTypeExt === 'product_price';
1900
1939
  /** 加价 */
1901
- var _isMarkupPrice = _priceType === 'markup' && (_priceTypeExt === '' || !_priceTypeExt);
1940
+ var _isMarkupPrice2 = _priceType === 'markup' && (_priceTypeExt === '' || !_priceTypeExt);
1902
1941
 
1903
1942
  // 检查 rules
1904
1943
  if (rules.length > 0) {
1905
1944
  // 检查原价
1906
- if (_isOriginalPrice && rules.includes('original_price')) {
1945
+ if (_isOriginalPrice2 && rules.includes('original_price')) {
1907
1946
  return true;
1908
1947
  }
1909
1948
 
1910
1949
  // 检查加价
1911
- if (_isMarkupPrice && rules.includes('markup_price')) {
1950
+ if (_isMarkupPrice2 && rules.includes('markup_price')) {
1912
1951
  return true;
1913
1952
  }
1914
1953
 
@@ -1917,7 +1956,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
1917
1956
  }
1918
1957
 
1919
1958
  // 原价包括:price_type: "markup" && price_type_ext: "product_price"
1920
- return _isOriginalPrice;
1959
+ return _isOriginalPrice2;
1921
1960
  }
1922
1961
  return false;
1923
1962
  }
@@ -115,7 +115,7 @@ export declare class BookingTicketImpl extends BaseModule implements Module {
115
115
  * 获取当前的客户搜索条件
116
116
  * @returns 当前搜索条件
117
117
  */
118
- getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
118
+ getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "num" | "skip">;
119
119
  /**
120
120
  * 获取客户列表状态(包含滚动加载相关状态)
121
121
  * @returns 客户状态
@@ -124,7 +124,7 @@ export var searchProduct = /*#__PURE__*/function () {
124
124
  skip: 1,
125
125
  num: 20,
126
126
  status: 'published',
127
- with: ['variantGroup'],
127
+ with: ['variantGroup.variantItem', 'optionGroup.optionItem'],
128
128
  with_count: ['bundleGroup', 'optionGroup'],
129
129
  exclude_extension_type: ['product_party', 'product_event', 'product_series_event', 'product_package_ticket', 'ticket', 'event_item']
130
130
  };
@@ -18,6 +18,14 @@ interface Formattitle {
18
18
  interface PackageSubItemUsageRules {
19
19
  type: 'universal_discount' | 'package_exclusive' | 'single_item_promo' | 'custom_usage_rules';
20
20
  rules: ("original_price" | "markup_price")[];
21
+ package_scope?: {
22
+ type: 'all_packages' | 'specific_packages';
23
+ exclude_bundle_product_ids: number[];
24
+ include_bundle_product_ids: number[];
25
+ filter: 0 | 1;
26
+ rule: any[];
27
+ rule_type: 'and' | 'or';
28
+ };
21
29
  }
22
30
  interface Limitedrelationproductdata {
23
31
  id: number;
@@ -1388,7 +1388,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
1388
1388
  * @returns 是否可用
1389
1389
  */
1390
1390
  checkPackageSubItemUsageRules(discount, flatItem) {
1391
- var _a, _b, _c, _d;
1391
+ var _a, _b, _c, _d, _e, _f;
1392
1392
  const limitedData = discount.limited_relation_product_data;
1393
1393
  const usageRules = limitedData == null ? void 0 : limitedData.package_sub_item_usage_rules;
1394
1394
  const rules = ["original_price", ...(usageRules == null ? void 0 : usageRules.rules) || []];
@@ -1396,6 +1396,8 @@ var RulesModule = class extends import_BaseModule.BaseModule {
1396
1396
  return true;
1397
1397
  }
1398
1398
  const ruleType = usageRules.type;
1399
+ const packageScope = usageRules == null ? void 0 : usageRules.package_scope;
1400
+ const { type: scopeType, exclude_bundle_product_ids = [], include_bundle_product_ids = [], filter = 0 } = packageScope || {};
1399
1401
  const isMainProduct = flatItem.type === "main";
1400
1402
  const isBundleItem = flatItem.type === "bundle";
1401
1403
  if (isMainProduct) {
@@ -1408,13 +1410,25 @@ var RulesModule = class extends import_BaseModule.BaseModule {
1408
1410
  if (isBundleItem) {
1409
1411
  const priceType = (_a = flatItem.bundleItem) == null ? void 0 : _a.price_type;
1410
1412
  const priceTypeExt = (_b = flatItem.bundleItem) == null ? void 0 : _b.price_type_ext;
1413
+ const mainProductId = ((_c = flatItem == null ? void 0 : flatItem.originProduct) == null ? void 0 : _c.product_id) || ((_d = flatItem == null ? void 0 : flatItem.bundleItem) == null ? void 0 : _d.product_id) || 0;
1411
1414
  const isOriginalPrice = priceType === "markup" && priceTypeExt === "product_price";
1412
1415
  const isMarkupPrice = priceType === "markup" && (priceTypeExt === "" || !priceTypeExt);
1413
1416
  if (rules.length > 0) {
1414
- if (isOriginalPrice && rules.includes("original_price")) {
1415
- return true;
1417
+ const _isOriginalPrice = isOriginalPrice && rules.includes("original_price");
1418
+ const _isMarkupPrice = isMarkupPrice && rules.includes("markup_price");
1419
+ const isPriceValid = _isOriginalPrice || _isMarkupPrice;
1420
+ let isScopeValid = false;
1421
+ if (scopeType === "all_packages") {
1422
+ if (!filter) {
1423
+ isScopeValid = true;
1424
+ } else {
1425
+ isScopeValid = !exclude_bundle_product_ids.includes(Number(mainProductId));
1426
+ }
1416
1427
  }
1417
- if (isMarkupPrice && rules.includes("markup_price")) {
1428
+ if (scopeType === "specific_packages") {
1429
+ isScopeValid = include_bundle_product_ids.includes(Number(mainProductId));
1430
+ }
1431
+ if (isPriceValid && isScopeValid) {
1418
1432
  return true;
1419
1433
  }
1420
1434
  return false;
@@ -1428,8 +1442,8 @@ var RulesModule = class extends import_BaseModule.BaseModule {
1428
1442
  return false;
1429
1443
  }
1430
1444
  if (isBundleItem) {
1431
- const priceType = (_c = flatItem.bundleItem) == null ? void 0 : _c.price_type;
1432
- const priceTypeExt = (_d = flatItem.bundleItem) == null ? void 0 : _d.price_type_ext;
1445
+ const priceType = (_e = flatItem.bundleItem) == null ? void 0 : _e.price_type;
1446
+ const priceTypeExt = (_f = flatItem.bundleItem) == null ? void 0 : _f.price_type_ext;
1433
1447
  const isOriginalPrice = priceType === "markup" && priceTypeExt === "product_price";
1434
1448
  const isMarkupPrice = priceType === "markup" && (priceTypeExt === "" || !priceTypeExt);
1435
1449
  if (rules.length > 0) {
@@ -115,7 +115,7 @@ export declare class BookingTicketImpl extends BaseModule implements Module {
115
115
  * 获取当前的客户搜索条件
116
116
  * @returns 当前搜索条件
117
117
  */
118
- getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
118
+ getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "num" | "skip">;
119
119
  /**
120
120
  * 获取客户列表状态(包含滚动加载相关状态)
121
121
  * @returns 客户状态
@@ -88,7 +88,7 @@ var searchProduct = async (request, code) => {
88
88
  skip: 1,
89
89
  num: 20,
90
90
  status: "published",
91
- with: ["variantGroup"],
91
+ with: ["variantGroup.variantItem", "optionGroup.optionItem"],
92
92
  with_count: ["bundleGroup", "optionGroup"],
93
93
  exclude_extension_type: [
94
94
  "product_party",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "2.1.113",
4
+ "version": "2.1.115",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",