@pisell/pisellos 2.1.145 → 2.1.147

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.
@@ -19,7 +19,7 @@ export declare class QuotationModule extends BaseModule implements Module {
19
19
  * Look up the quotation price for a specific product (+ optional variant) at a given datetime.
20
20
  * Returns the price as a string (e.g. "300.00"), or null if no quotation applies.
21
21
  *
22
- * Priority: iterates quotations already sorted by `sort` ascending (lowest = highest priority).
22
+ * Priority: iterates quotations already sorted by `sort` descending (highest = highest priority).
23
23
  * First matching quotation whose schedule covers `datetime` and whose product_data contains
24
24
  * the requested productId wins.
25
25
  */
@@ -89,7 +89,7 @@ export var QuotationModule = /*#__PURE__*/function (_BaseModule) {
89
89
  res = _context2.sent;
90
90
  list = (res === null || res === void 0 || (_data = res.data) === null || _data === void 0 ? void 0 : _data.list) || (res === null || res === void 0 ? void 0 : res.list) || [];
91
91
  list.sort(function (a, b) {
92
- return a.sort - b.sort;
92
+ return b.sort - a.sort;
93
93
  });
94
94
  this.store.list = list;
95
95
  case 9:
@@ -113,7 +113,7 @@ export var QuotationModule = /*#__PURE__*/function (_BaseModule) {
113
113
  * Look up the quotation price for a specific product (+ optional variant) at a given datetime.
114
114
  * Returns the price as a string (e.g. "300.00"), or null if no quotation applies.
115
115
  *
116
- * Priority: iterates quotations already sorted by `sort` ascending (lowest = highest priority).
116
+ * Priority: iterates quotations already sorted by `sort` descending (highest = highest priority).
117
117
  * First matching quotation whose schedule covers `datetime` and whose product_data contains
118
118
  * the requested productId wins.
119
119
  */
@@ -1349,7 +1349,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
1349
1349
  var resourceState = this.store.resource;
1350
1350
  var resourceSelectType = resourceState === null || resourceState === void 0 ? void 0 : resourceState.resourceSelectType;
1351
1351
 
1352
- // single 预约独占整张桌台,capacity form_record.capacity;其他情况(multiple / capacity / undefined)占 1 个容量位
1352
+ // collect_pax 时的资源占用兜底:single 独占整张桌台,其余模式占 1 个容量位。
1353
1353
  var resolveResourceCapacity = function resolveResourceCapacity() {
1354
1354
  if (resourceSelectType === 'single') {
1355
1355
  var _resourceState$table_;
@@ -1361,10 +1361,13 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
1361
1361
  return 1;
1362
1362
  };
1363
1363
  return function (payload, _ref3) {
1364
- var _tempOrder$resource_i, _ref4, _pickOriginal, _resourceState$table_2, _resourceState$relati, _tempOrder$metadata, _pickFirstCustomCapac;
1364
+ var _tempOrder$resource_i, _tempOrder$metadata, _ref4, _pickOriginal, _resourceState$table_2, _resourceState$relati, _pickFirstCustomCapac;
1365
1365
  var bookingUuid = _ref3.bookingUuid,
1366
1366
  tempOrder = _ref3.tempOrder;
1367
1367
  var resourceId = (_tempOrder$resource_i = tempOrder.resource_id) !== null && _tempOrder$resource_i !== void 0 ? _tempOrder$resource_i : resourceState === null || resourceState === void 0 ? void 0 : resourceState.relationId;
1368
+ var rawCollectPax = (_tempOrder$metadata = tempOrder.metadata) === null || _tempOrder$metadata === void 0 ? void 0 : _tempOrder$metadata.collect_pax;
1369
+ var hasCollectPaxForCapacity = rawCollectPax !== null && rawCollectPax !== undefined && rawCollectPax !== '';
1370
+ var resourceCapacityValue = hasCollectPaxForCapacity ? normalizeSubmitCollectPaxValue(rawCollectPax) : resolveResourceCapacity();
1368
1371
  var pickOriginal = function pickOriginal(value) {
1369
1372
  if (value && _typeof(value) === 'object' && !Array.isArray(value)) {
1370
1373
  var original = value.original;
@@ -1380,17 +1383,15 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
1380
1383
  main_field: mainField,
1381
1384
  form_id: resourceState.tableFormId,
1382
1385
  relation_id: (_resourceState$relati = resourceState.relationId) !== null && _resourceState$relati !== void 0 ? _resourceState$relati : resourceId,
1383
- capacity: resolveResourceCapacity(),
1386
+ capacity: resourceCapacityValue,
1384
1387
  metadata: _this5.buildScanOrderResourceMetadata({
1385
1388
  resourceState: resourceState,
1386
1389
  resourceName: mainField
1387
1390
  })
1388
1391
  } : undefined;
1389
1392
  var ruleProductUid = ruleProduct ? createUuidV4() : undefined;
1390
- // 默认 resolveResourceCapacity(single 为桌台容量,其余多为 1);有 collect_pax value 优先用人数
1391
- var rawCollectPax = (_tempOrder$metadata = tempOrder.metadata) === null || _tempOrder$metadata === void 0 ? void 0 : _tempOrder$metadata.collect_pax;
1392
- var hasCollectPaxForCapacity = rawCollectPax !== null && rawCollectPax !== undefined && rawCollectPax !== '';
1393
- var bookingCapacityValue = hasCollectPaxForCapacity ? normalizeSubmitCollectPaxValue(rawCollectPax) : resolveResourceCapacity();
1393
+ // collect_pax booking/resource capacity 都代表本次 pax;否则使用资源占用兜底值。
1394
+ var bookingCapacityValue = resourceCapacityValue;
1394
1395
  var bookingCapacityDimensionId = (_pickFirstCustomCapac = pickFirstCustomCapacityDimensionId(_this5.enabledReservationRuleProducts)) !== null && _pickFirstCustomCapac !== void 0 ? _pickFirstCustomCapac : 0;
1395
1396
  var nextBookings = (payload.bookings || []).map(function (booking, idx) {
1396
1397
  return _objectSpread(_objectSpread(_objectSpread({}, booking), {}, {
@@ -19,7 +19,7 @@ export declare class QuotationModule extends BaseModule implements Module {
19
19
  * Look up the quotation price for a specific product (+ optional variant) at a given datetime.
20
20
  * Returns the price as a string (e.g. "300.00"), or null if no quotation applies.
21
21
  *
22
- * Priority: iterates quotations already sorted by `sort` ascending (lowest = highest priority).
22
+ * Priority: iterates quotations already sorted by `sort` descending (highest = highest priority).
23
23
  * First matching quotation whose schedule covers `datetime` and whose product_data contains
24
24
  * the requested productId wins.
25
25
  */
@@ -52,7 +52,7 @@ var QuotationModule = class extends import_BaseModule.BaseModule {
52
52
  { useCache: false }
53
53
  );
54
54
  const list = ((_a = res == null ? void 0 : res.data) == null ? void 0 : _a.list) || (res == null ? void 0 : res.list) || [];
55
- list.sort((a, b) => a.sort - b.sort);
55
+ list.sort((a, b) => b.sort - a.sort);
56
56
  this.store.list = list;
57
57
  }
58
58
  getQuotationList() {
@@ -62,7 +62,7 @@ var QuotationModule = class extends import_BaseModule.BaseModule {
62
62
  * Look up the quotation price for a specific product (+ optional variant) at a given datetime.
63
63
  * Returns the price as a string (e.g. "300.00"), or null if no quotation applies.
64
64
  *
65
- * Priority: iterates quotations already sorted by `sort` ascending (lowest = highest priority).
65
+ * Priority: iterates quotations already sorted by `sort` descending (highest = highest priority).
66
66
  * First matching quotation whose schedule covers `datetime` and whose product_data contains
67
67
  * the requested productId wins.
68
68
  */
@@ -838,6 +838,9 @@ var _ScanOrderImpl = class extends import_BaseModule.BaseModule {
838
838
  return (payload, { bookingUuid, tempOrder }) => {
839
839
  var _a, _b;
840
840
  const resourceId = tempOrder.resource_id ?? (resourceState == null ? void 0 : resourceState.relationId);
841
+ const rawCollectPax = (_a = tempOrder.metadata) == null ? void 0 : _a.collect_pax;
842
+ const hasCollectPaxForCapacity = rawCollectPax !== null && rawCollectPax !== void 0 && rawCollectPax !== "";
843
+ const resourceCapacityValue = hasCollectPaxForCapacity ? (0, import_utils2.normalizeSubmitCollectPaxValue)(rawCollectPax) : resolveResourceCapacity();
841
844
  const pickOriginal = (value) => {
842
845
  if (value && typeof value === "object" && !Array.isArray(value)) {
843
846
  const original = value.original;
@@ -845,7 +848,7 @@ var _ScanOrderImpl = class extends import_BaseModule.BaseModule {
845
848
  }
846
849
  return void 0;
847
850
  };
848
- const mainField = pickOriginal(tempOrder.table_number) ?? pickOriginal((_a = resourceState == null ? void 0 : resourceState.table_form_record) == null ? void 0 : _a.name) ?? "";
851
+ const mainField = pickOriginal(tempOrder.table_number) ?? pickOriginal((_b = resourceState == null ? void 0 : resourceState.table_form_record) == null ? void 0 : _b.name) ?? "";
849
852
  const resourceEntry = resourceState && resourceId ? {
850
853
  relation_type: "form",
851
854
  like_status: "common",
@@ -853,16 +856,14 @@ var _ScanOrderImpl = class extends import_BaseModule.BaseModule {
853
856
  main_field: mainField,
854
857
  form_id: resourceState.tableFormId,
855
858
  relation_id: resourceState.relationId ?? resourceId,
856
- capacity: resolveResourceCapacity(),
859
+ capacity: resourceCapacityValue,
857
860
  metadata: this.buildScanOrderResourceMetadata({
858
861
  resourceState,
859
862
  resourceName: mainField
860
863
  })
861
864
  } : void 0;
862
865
  const ruleProductUid = ruleProduct ? (0, import_utils2.createUuidV4)() : void 0;
863
- const rawCollectPax = (_b = tempOrder.metadata) == null ? void 0 : _b.collect_pax;
864
- const hasCollectPaxForCapacity = rawCollectPax !== null && rawCollectPax !== void 0 && rawCollectPax !== "";
865
- const bookingCapacityValue = hasCollectPaxForCapacity ? (0, import_utils2.normalizeSubmitCollectPaxValue)(rawCollectPax) : resolveResourceCapacity();
866
+ const bookingCapacityValue = resourceCapacityValue;
866
867
  const bookingCapacityDimensionId = (0, import_utils.pickFirstCustomCapacityDimensionId)(this.enabledReservationRuleProducts) ?? 0;
867
868
  const nextBookings = (payload.bookings || []).map((booking, idx) => ({
868
869
  ...booking,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "2.1.145",
4
+ "version": "2.1.147",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",