@pisell/pisellos 2.1.173 → 2.1.175

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 (60) hide show
  1. package/dist/modules/Holder/index.d.ts +48 -0
  2. package/dist/modules/Holder/index.js +640 -0
  3. package/dist/modules/Holder/types.d.ts +123 -0
  4. package/dist/modules/Holder/types.js +1 -0
  5. package/dist/modules/Holder/utils.d.ts +13 -0
  6. package/dist/modules/Holder/utils.js +34 -0
  7. package/dist/modules/OpenData/types.d.ts +1 -0
  8. package/dist/modules/Order/index.d.ts +1 -0
  9. package/dist/modules/Order/index.js +18 -1
  10. package/dist/modules/Order/types.d.ts +2 -0
  11. package/dist/modules/Order/utils.d.ts +10 -0
  12. package/dist/modules/Order/utils.js +35 -3
  13. package/dist/modules/Product/types.d.ts +7 -0
  14. package/dist/modules/ProductList/index.js +13 -6
  15. package/dist/modules/Rules/index.js +2 -1
  16. package/dist/modules/index.d.ts +1 -0
  17. package/dist/modules/index.js +2 -1
  18. package/dist/plugins/window.d.ts +1 -0
  19. package/dist/solution/BookingByStep/index.d.ts +17 -2
  20. package/dist/solution/BookingByStep/index.js +276 -204
  21. package/dist/solution/BookingByStep/types.d.ts +2 -1
  22. package/dist/solution/BookingByStep/types.js +3 -1
  23. package/dist/solution/ScanOrder/index.d.ts +5 -5
  24. package/dist/solution/ScanOrder/index.js +59 -6
  25. package/dist/solution/ScanOrder/types.d.ts +7 -0
  26. package/dist/solution/VenueBooking/index.d.ts +19 -0
  27. package/dist/solution/VenueBooking/index.js +978 -748
  28. package/dist/solution/VenueBooking/types.d.ts +2 -0
  29. package/dist/types/index.d.ts +1 -0
  30. package/lib/model/strategy/adapter/promotion/index.js +49 -0
  31. package/lib/modules/Holder/index.d.ts +48 -0
  32. package/lib/modules/Holder/index.js +402 -0
  33. package/lib/modules/Holder/types.d.ts +123 -0
  34. package/lib/modules/Holder/types.js +17 -0
  35. package/lib/modules/Holder/utils.d.ts +13 -0
  36. package/lib/modules/Holder/utils.js +71 -0
  37. package/lib/modules/OpenData/types.d.ts +1 -0
  38. package/lib/modules/Order/index.d.ts +1 -0
  39. package/lib/modules/Order/index.js +14 -0
  40. package/lib/modules/Order/types.d.ts +2 -0
  41. package/lib/modules/Order/utils.d.ts +10 -0
  42. package/lib/modules/Order/utils.js +36 -5
  43. package/lib/modules/Product/types.d.ts +7 -0
  44. package/lib/modules/ProductList/index.js +8 -1
  45. package/lib/modules/Rules/index.js +1 -1
  46. package/lib/modules/index.d.ts +1 -0
  47. package/lib/modules/index.js +3 -1
  48. package/lib/plugins/window.d.ts +1 -0
  49. package/lib/solution/BookingByStep/index.d.ts +17 -2
  50. package/lib/solution/BookingByStep/index.js +39 -0
  51. package/lib/solution/BookingByStep/types.d.ts +2 -1
  52. package/lib/solution/BookingByStep/types.js +5 -0
  53. package/lib/solution/ScanOrder/index.d.ts +5 -5
  54. package/lib/solution/ScanOrder/index.js +56 -6
  55. package/lib/solution/ScanOrder/types.d.ts +7 -0
  56. package/lib/solution/VenueBooking/index.d.ts +19 -0
  57. package/lib/solution/VenueBooking/index.js +134 -16
  58. package/lib/solution/VenueBooking/types.d.ts +2 -0
  59. package/lib/types/index.d.ts +1 -0
  60. package/package.json +1 -1
@@ -0,0 +1,123 @@
1
+ import { ProductData } from '../Product/types';
2
+ /**
3
+ * 商品 holder 配置
4
+ */
5
+ export interface IHolderConfig {
6
+ required?: number;
7
+ resource_id: number;
8
+ status?: string;
9
+ [key: string]: any;
10
+ }
11
+ /**
12
+ * 表单记录
13
+ */
14
+ export interface IFormRecord {
15
+ form_id: number;
16
+ form_record_id: number;
17
+ main_field: string;
18
+ customer_cover?: string;
19
+ created_at?: string;
20
+ customer_id?: number;
21
+ [key: string]: any;
22
+ }
23
+ /**
24
+ * 表单配置/定义
25
+ */
26
+ export interface IFormInfo {
27
+ form_id: number;
28
+ name: string;
29
+ fields?: Record<string, any>[];
30
+ [key: string]: any;
31
+ }
32
+ /**
33
+ * 单个 form_id 下的数据结构
34
+ */
35
+ export interface IFormItemData {
36
+ records: IFormRecord[];
37
+ form: IFormInfo | Record<string, any>;
38
+ }
39
+ /**
40
+ * form_id 为 key 的 map 结构,如 948: { records: [], form: {} }
41
+ */
42
+ export type HolderFormMap = Record<string, IFormItemData>;
43
+ /**
44
+ * Holder 模块 reactive store,仅 holderMap 会触发 changed 事件
45
+ */
46
+ export interface HolderState {
47
+ holderMap: HolderFormMap;
48
+ }
49
+ export interface IFetchFormInfoParams {
50
+ url?: string;
51
+ query: {
52
+ form_id: string | number;
53
+ };
54
+ useCache?: boolean;
55
+ }
56
+ export interface IFetchFormRecordsParams {
57
+ url?: string;
58
+ query: {
59
+ customer_id?: number;
60
+ form_id: string | number;
61
+ shop_id: string | number;
62
+ num?: number;
63
+ skip?: number;
64
+ [key: string]: any;
65
+ };
66
+ useCache?: boolean;
67
+ }
68
+ export interface IAddFormRecordParams {
69
+ url?: string;
70
+ body: {
71
+ form_id: number;
72
+ shop_id: number | string;
73
+ customer_id?: number;
74
+ [key: string]: any;
75
+ };
76
+ }
77
+ /**
78
+ * UI 层自行调用添加接口后,将返回记录写入 holderMap
79
+ */
80
+ export interface IAppendFormRecordParams {
81
+ /** 接口返回的 data,或完整响应 { data: {...} } */
82
+ record: IFormRecord | Record<string, any>;
83
+ /** 可选,未传则从 record.form_id 读取 */
84
+ form_id?: number | string;
85
+ }
86
+ export interface IEnsureFormDataParams {
87
+ form_id: number | string;
88
+ shop_id: number | string;
89
+ customer_id?: number;
90
+ useCache?: boolean;
91
+ forceRefresh?: boolean;
92
+ formInfoUrl?: string;
93
+ recordsUrl?: string;
94
+ skip?: number;
95
+ num?: number;
96
+ }
97
+ export interface IEnsureFormByProductParams {
98
+ product: ProductData | Record<string, any>;
99
+ customer_id?: number;
100
+ shop_id?: number | string;
101
+ useCache?: boolean;
102
+ }
103
+ export interface IRefreshAllFormRecordsParams {
104
+ customer_id?: number;
105
+ useCache?: boolean;
106
+ recordsUrl?: string;
107
+ num?: number;
108
+ skip?: number;
109
+ }
110
+ export interface HolderModuleAPI {
111
+ getHolderFormMap: () => HolderFormMap;
112
+ getHolderFormData: (formId: number | string) => IFormItemData | undefined;
113
+ setFormData: (formId: number | string, data: Partial<IFormItemData>) => void;
114
+ fetchFormInfo: (params: IFetchFormInfoParams) => Promise<IFormInfo | IFormInfo[]>;
115
+ fetchRecords: (params: IFetchFormRecordsParams) => Promise<IFormRecord[]>;
116
+ ensureFormData: (params: IEnsureFormDataParams) => Promise<IFormItemData>;
117
+ ensureFormByProduct: (params: IEnsureFormByProductParams) => Promise<IFormItemData | null>;
118
+ addFormRecord: (params: IAddFormRecordParams) => Promise<IFormRecord>;
119
+ appendFormRecord: (params: IAppendFormRecordParams) => IFormRecord;
120
+ removeFormRecord: (formId: number | string, formRecordId: number) => void;
121
+ clearFormData: (formId?: number | string) => void;
122
+ refreshAllFormRecords: (params?: IRefreshAllFormRecordsParams) => Promise<HolderFormMap>;
123
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,13 @@
1
+ import { ProductData } from '../Product/types';
2
+ import { IFormItemData, IHolderConfig } from './types';
3
+ export declare function getProductHolderConfig(product?: ProductData | Record<string, any> | null): IHolderConfig | null;
4
+ export declare function getFormIdFromHolderConfig(config: IHolderConfig): number;
5
+ export declare function normalizeFormId(formId: number | string): number;
6
+ export declare function createEmptyFormItemData(): {
7
+ records: any[];
8
+ form: Record<string, any>;
9
+ };
10
+ export declare function resolveFormMetaFromHolderItem(mapKey: string, item: IFormItemData): {
11
+ form_id: number | string;
12
+ shop_id: number | string;
13
+ } | null;
@@ -0,0 +1,34 @@
1
+ export function getProductHolderConfig(product) {
2
+ var _product$holder_confi, _product$origin;
3
+ if (!product) return null;
4
+ var config = (_product$holder_confi = product === null || product === void 0 ? void 0 : product.holder_config) !== null && _product$holder_confi !== void 0 ? _product$holder_confi : product === null || product === void 0 || (_product$origin = product.origin) === null || _product$origin === void 0 ? void 0 : _product$origin.holder_config;
5
+ if (config !== null && config !== void 0 && config.status && (config === null || config === void 0 ? void 0 : config.status) !== 'enable') return null;
6
+ if (!(config !== null && config !== void 0 && config.resource_id)) return null;
7
+ return config;
8
+ }
9
+ export function getFormIdFromHolderConfig(config) {
10
+ return Number(config === null || config === void 0 ? void 0 : config.resource_id);
11
+ }
12
+ export function normalizeFormId(formId) {
13
+ return Number(formId);
14
+ }
15
+ export function createEmptyFormItemData() {
16
+ return {
17
+ records: [],
18
+ form: {}
19
+ };
20
+ }
21
+ export function resolveFormMetaFromHolderItem(mapKey, item) {
22
+ var _ref, _ref2, _nestedForm$id, _nestedForm$shop_id;
23
+ var formInfo = item.form || {};
24
+ var nestedForm = formInfo.form || {};
25
+ var form_id = normalizeFormId((_ref = (_ref2 = (_nestedForm$id = nestedForm.id) !== null && _nestedForm$id !== void 0 ? _nestedForm$id : formInfo.form_id) !== null && _ref2 !== void 0 ? _ref2 : formInfo.id) !== null && _ref !== void 0 ? _ref : mapKey);
26
+ var shop_id = (_nestedForm$shop_id = nestedForm.shop_id) !== null && _nestedForm$shop_id !== void 0 ? _nestedForm$shop_id : formInfo.shop_id;
27
+ if (shop_id === undefined || shop_id === null || shop_id === '') {
28
+ return null;
29
+ }
30
+ return {
31
+ form_id: form_id,
32
+ shop_id: shop_id
33
+ };
34
+ }
@@ -33,6 +33,7 @@ export interface OpenDataConfig {
33
33
  'sale.sale_number_prefix'?: string | null;
34
34
  'sale.enabled_item_rules'?: number[];
35
35
  'fulfillment.enable_pickup'?: boolean;
36
+ 'fulfillment.handover_mode'?: string[] | null;
36
37
  'fulfillment.overdue_reminder'?: boolean;
37
38
  'fulfillment.manual_input_type'?: string;
38
39
  'fulfillment.enable_auto_complete'?: boolean;
@@ -57,6 +57,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
57
57
  private getTempOrderStorageKey;
58
58
  private restoreTempOrderFromStorage;
59
59
  persistTempOrder(): void;
60
+ notifyTempOrderChanged(): void;
60
61
  private createDefaultTempOrderInstance;
61
62
  ensureTempOrder(): ScanOrderTempOrder;
62
63
  restoreOrder(): ScanOrderTempOrder;
@@ -25,7 +25,7 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
25
25
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
26
26
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
27
27
  import { BaseModule } from "../BaseModule";
28
- import { generateDuration, getAllDiscountList, mergeRelationForms, buildSubmitPayload, createDefaultTempOrder, createDefaultOrderRulesHooks, createEmptySummary, createUuidV4, formatDateTime, filterProductsForScanOrderMore, isTempOrder } from "./utils";
28
+ import { generateDuration, getAllDiscountList, mergeRelationForms, ensureCartItemOriginHolder, buildSubmitPayload, createDefaultTempOrder, createDefaultOrderRulesHooks, createEmptySummary, createUuidV4, formatDateTime, filterProductsForScanOrderMore, isTempOrder } from "./utils";
29
29
  import { isNormalProduct } from "../Product/utils";
30
30
  import dayjs from 'dayjs';
31
31
  import { buildProductLineFingerprint, getProductIdentityIndex, getSafeProductNum, isIdentityMatch, normalizeOrderProduct } from "../../solution/ScanOrder/utils";
@@ -439,6 +439,16 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
439
439
  if (!this.window) return;
440
440
  this.window.localStorage.setItem(key, JSON.stringify(this.store.tempOrder));
441
441
  }
442
+ }, {
443
+ key: "notifyTempOrderChanged",
444
+ value: function notifyTempOrderChanged() {
445
+ if (!this.store.tempOrder) return;
446
+ this.store.tempOrder = _objectSpread(_objectSpread({}, this.store.tempOrder), {}, {
447
+ products: _toConsumableArray(this.store.tempOrder.products),
448
+ bookings: this.store.tempOrder.bookings ? _toConsumableArray(this.store.tempOrder.bookings) : []
449
+ });
450
+ this.persistTempOrder();
451
+ }
442
452
 
443
453
  // ─── TempOrder: 创建 & 获取 ───
444
454
  }, {
@@ -860,6 +870,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
860
870
  }, {
861
871
  key: "createOrder",
862
872
  value: function createOrder(params) {
873
+ var _this2 = this;
863
874
  var order = _objectSpread({
864
875
  type: (params === null || params === void 0 ? void 0 : params.type) || 'appointment_booking',
865
876
  // 要从外面拿,virtual
@@ -877,6 +888,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
877
888
  var is_deposit = 0; // 是否存在定金,0 不存在,1 存在
878
889
  if (params.cartItems.length > 0) {
879
890
  params.cartItems.forEach(function (item) {
891
+ var _params$extraData;
880
892
  if (!item._origin.duration) {
881
893
  var _generateDuration = generateDuration(item),
882
894
  duration = _generateDuration.duration,
@@ -887,6 +899,11 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
887
899
  var discountList = getAllDiscountList(item);
888
900
  item._origin.product.discount_list = discountList;
889
901
 
902
+ // 为预约补齐 holder 信息
903
+ if (params !== null && params !== void 0 && (_params$extraData = params.extraData) !== null && _params$extraData !== void 0 && _params$extraData.is_add_holder_info) {
904
+ ensureCartItemOriginHolder(item, _this2.window);
905
+ }
906
+
890
907
  // 购物车是否为普通商品
891
908
  if (isNormalProduct(item._origin)) {
892
909
  var _order$relation_forms;
@@ -235,6 +235,8 @@ export interface OrderModuleAPI {
235
235
  updateProductInOrder: (params: UpdateProductInOrderParams) => Promise<ScanOrderOrderProduct[]>;
236
236
  removeProductFromOrder: (identity: ScanOrderOrderProductIdentity) => Promise<ScanOrderOrderProduct[]>;
237
237
  persistTempOrder: () => void;
238
+ /** 提交 tempOrder 变更并触发 `{moduleName}:changed` 事件 */
239
+ notifyTempOrderChanged: () => void;
238
240
  submitTempOrder: <T = any>(params?: {
239
241
  cacheId?: string;
240
242
  platform?: string;
@@ -2,6 +2,7 @@ import Decimal from 'decimal.js';
2
2
  import { CartItem } from "../Cart";
3
3
  import type { ScanOrderSubmitPayload, ScanOrderSubmitProduct, ScanOrderSummary, ScanOrderTempOrder } from '../../solution/ScanOrder/types';
4
4
  import type { RulesParamsHooks } from '../Rules/types';
5
+ import type { WindowPlugin } from '../../plugins';
5
6
  /**
6
7
  * 把"含 option 的主商品单价"与 bundle 合成"单行 composite 单价"。
7
8
  *
@@ -86,6 +87,15 @@ export declare const mergeRelationForms: (relationForms: {
86
87
  form_id: number;
87
88
  form_record_ids: number[];
88
89
  }[];
90
+ export interface CartOrderHolder {
91
+ customer_id?: number;
92
+ form_id: number | string;
93
+ form_record: (number | string)[] | null;
94
+ }
95
+ /**
96
+ * 为购物车行补齐订单所需的 holder 信息(与 cartAccount 结构保持一致)
97
+ */
98
+ export declare function ensureCartItemOriginHolder(cartItem: CartItem, window?: WindowPlugin): void;
89
99
  export declare const getAllDiscountList: (cartItem: CartItem) => any;
90
100
  export declare function createUuidV4(): string;
91
101
  export declare function isTempOrder(data: any): data is ScanOrderTempOrder;
@@ -18,6 +18,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
18
18
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
19
19
  import dayjs from "dayjs";
20
20
  import Decimal from 'decimal.js';
21
+ import { getProductHolderConfig } from "../Holder/utils";
21
22
  import { buildProductLineFingerprint, createEmptySummary } from "../../solution/ScanOrder/utils";
22
23
  /**
23
24
  * 把"含 option 的主商品单价"与 bundle 合成"单行 composite 单价"。
@@ -259,10 +260,41 @@ export var mergeRelationForms = function mergeRelationForms(relationForms) {
259
260
  return item.form_record_ids.length > 0;
260
261
  }); // 过滤掉没有有效记录的表单
261
262
  };
263
+ function getCustomerIdFromStorage(window) {
264
+ try {
265
+ var _window$getLocalStora;
266
+ var customer = JSON.parse((window === null || window === void 0 || (_window$getLocalStora = window.getLocalStorage) === null || _window$getLocalStora === void 0 ? void 0 : _window$getLocalStora.call(window, 'customer')) || '{}');
267
+ var customerId = Number(customer === null || customer === void 0 ? void 0 : customer.id);
268
+ return Number.isFinite(customerId) && customerId > 0 ? customerId : undefined;
269
+ } catch (_unused) {
270
+ return undefined;
271
+ }
272
+ }
273
+
274
+ /**
275
+ * 为购物车行补齐订单所需的 holder 信息(与 cartAccount 结构保持一致)
276
+ */
277
+ export function ensureCartItemOriginHolder(cartItem, window) {
278
+ var _cartItem$_origin, _cartItem$_productIni;
279
+ if (cartItem !== null && cartItem !== void 0 && (_cartItem$_origin = cartItem._origin) !== null && _cartItem$_origin !== void 0 && _cartItem$_origin.holder) {
280
+ return;
281
+ }
282
+ var holderConfig = getProductHolderConfig((_cartItem$_productIni = cartItem === null || cartItem === void 0 ? void 0 : cartItem._productInit) !== null && _cartItem$_productIni !== void 0 ? _cartItem$_productIni : cartItem === null || cartItem === void 0 ? void 0 : cartItem._productOrigin);
283
+ var formRecordId = cartItem === null || cartItem === void 0 ? void 0 : cartItem.holder_id;
284
+ if (!(holderConfig !== null && holderConfig !== void 0 && holderConfig.resource_id) || formRecordId == null) {
285
+ return;
286
+ }
287
+ cartItem._origin.holder = {
288
+ customer_id: getCustomerIdFromStorage(window),
289
+ form_id: holderConfig.resource_id,
290
+ form_record: [formRecordId]
291
+ };
292
+ }
293
+ ;
262
294
  export var getAllDiscountList = function getAllDiscountList(cartItem) {
263
- var _cartItem$_origin, _cartItem$_origin2;
264
- var discountList = (cartItem === null || cartItem === void 0 || (_cartItem$_origin = cartItem._origin) === null || _cartItem$_origin === void 0 || (_cartItem$_origin = _cartItem$_origin.product) === null || _cartItem$_origin === void 0 ? void 0 : _cartItem$_origin.discount_list) || [];
265
- ((cartItem === null || cartItem === void 0 || (_cartItem$_origin2 = cartItem._origin) === null || _cartItem$_origin2 === void 0 || (_cartItem$_origin2 = _cartItem$_origin2.product) === null || _cartItem$_origin2 === void 0 ? void 0 : _cartItem$_origin2.product_bundle) || []).forEach(function (item) {
295
+ var _cartItem$_origin2, _cartItem$_origin3;
296
+ var discountList = (cartItem === null || cartItem === void 0 || (_cartItem$_origin2 = cartItem._origin) === null || _cartItem$_origin2 === void 0 || (_cartItem$_origin2 = _cartItem$_origin2.product) === null || _cartItem$_origin2 === void 0 ? void 0 : _cartItem$_origin2.discount_list) || [];
297
+ ((cartItem === null || cartItem === void 0 || (_cartItem$_origin3 = cartItem._origin) === null || _cartItem$_origin3 === void 0 || (_cartItem$_origin3 = _cartItem$_origin3.product) === null || _cartItem$_origin3 === void 0 ? void 0 : _cartItem$_origin3.product_bundle) || []).forEach(function (item) {
266
298
  discountList = [].concat(_toConsumableArray(discountList), _toConsumableArray((item === null || item === void 0 ? void 0 : item.discount_list) || []));
267
299
  item.discount_list = undefined;
268
300
  });
@@ -189,6 +189,13 @@ export interface ProductData {
189
189
  };
190
190
  /** 购物车行键,用于唯一标识购物车中的商品,用于相同 SKU商品合并 */
191
191
  rowKey?: string;
192
+ /** holder 表单配置 */
193
+ holder_config?: {
194
+ required?: number;
195
+ resource_id?: number;
196
+ status?: string;
197
+ [key: string]: any;
198
+ };
192
199
  }
193
200
  /**
194
201
  * 商品媒体信息接口
@@ -86,7 +86,7 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
86
86
  value: function () {
87
87
  var _loadProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(_ref) {
88
88
  var _this$core, _this$otherParams, _this$otherParams2;
89
- var _ref$category_ids, category_ids, _ref$product_ids, product_ids, _ref$collection, collection, _ref$menu_list_ids, menu_list_ids, paramsCustomerId, _ref$with_count, with_count, schedule_datetime, schedule_date, cacheId, with_schedule, userPlugin, customer_id, _userPlugin$get, _platform, productsData, sortedList;
89
+ var _ref$category_ids, category_ids, _ref$product_ids, product_ids, _ref$collection, collection, _ref$menu_list_ids, menu_list_ids, paramsCustomerId, _ref$with_count, with_count, schedule_datetime, schedule_date, cacheId, with_schedule, userPlugin, customer_id, _userPlugin$get, _platform, channelMap, saleChannel, productsData, sortedList;
90
90
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
91
91
  while (1) switch (_context3.prev = _context3.next) {
92
92
  case 0:
@@ -110,8 +110,15 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
110
110
  } catch (error) {
111
111
  console.error(error);
112
112
  }
113
- _platform = (_this$core = this.core) === null || _this$core === void 0 || (_this$core = _this$core.context) === null || _this$core === void 0 ? void 0 : _this$core.platform; // 如果没传schedule_date,则从
114
- _context3.next = 7;
113
+ _platform = (_this$core = this.core) === null || _this$core === void 0 || (_this$core = _this$core.context) === null || _this$core === void 0 ? void 0 : _this$core.platform;
114
+ channelMap = {
115
+ online_store: 'online-store',
116
+ scan_to_order: 'online-store',
117
+ scan_to_order_2: 'online-store',
118
+ scan_to_order_3: 'online-store'
119
+ };
120
+ saleChannel = channelMap[(_this$otherParams = this.otherParams) === null || _this$otherParams === void 0 ? void 0 : _this$otherParams.channel] || ((_this$otherParams2 = this.otherParams) === null || _this$otherParams2 === void 0 ? void 0 : _this$otherParams2.channel); // 如果没传schedule_date,则从
121
+ _context3.next = 9;
115
122
  return this.request.post("/product/query", {
116
123
  open_quotation: 1,
117
124
  open_bundle: 0,
@@ -129,7 +136,7 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
129
136
  with_count: with_count,
130
137
  // client_schedule_ids: schedule_ids,
131
138
  schedule_date: schedule_date,
132
- application_code: _platform === 'shop' ? ((_this$otherParams = this.otherParams) === null || _this$otherParams === void 0 ? void 0 : _this$otherParams.channel) === 'online_store' ? 'online-store' : (_this$otherParams2 = this.otherParams) === null || _this$otherParams2 === void 0 ? void 0 : _this$otherParams2.channel : 'online-store',
139
+ application_code: _platform === 'shop' ? saleChannel : 'online-store',
133
140
  with_schedule: with_schedule,
134
141
  schedule_datetime: schedule_datetime,
135
142
  is_eject: 1
@@ -137,7 +144,7 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
137
144
  useCache: true,
138
145
  customToast: function customToast() {}
139
146
  });
140
- case 7:
147
+ case 9:
141
148
  productsData = _context3.sent;
142
149
  sortedList = (productsData.data.list || []).slice().sort(function (a, b) {
143
150
  return Number(b.sort) - Number(a.sort);
@@ -150,7 +157,7 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
150
157
  // }
151
158
  this.addProduct(sortedList);
152
159
  return _context3.abrupt("return", sortedList);
153
- case 11:
160
+ case 13:
154
161
  case "end":
155
162
  return _context3.stop();
156
163
  }
@@ -1850,7 +1850,8 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
1850
1850
  // 套餐适用范围配置
1851
1851
  var packageScope = usageRules === null || usageRules === void 0 ? void 0 : usageRules.package_scope;
1852
1852
  var _ref9 = packageScope || {},
1853
- scopeType = _ref9.type,
1853
+ _ref9$type = _ref9.type,
1854
+ scopeType = _ref9$type === void 0 ? 'product_all' : _ref9$type,
1854
1855
  _ref9$exclude_bundle_ = _ref9.exclude_bundle_product_ids,
1855
1856
  exclude_bundle_product_ids = _ref9$exclude_bundle_ === void 0 ? [] : _ref9$exclude_bundle_,
1856
1857
  _ref9$include_bundle_ = _ref9.include_bundle_product_ids,
@@ -16,3 +16,4 @@ export * from './Schedule';
16
16
  export * from './Quotation';
17
17
  export * from './ScanOrderLogger';
18
18
  export * from './OpenData';
19
+ export * from './Holder';
@@ -15,4 +15,5 @@ export * from "./SalesSummary";
15
15
  export * from "./Schedule";
16
16
  export * from "./Quotation";
17
17
  export * from "./ScanOrderLogger";
18
- export * from "./OpenData";
18
+ export * from "./OpenData";
19
+ export * from "./Holder";
@@ -14,6 +14,7 @@ export interface WindowPlugin extends Plugin {
14
14
  document: Partial<Document>;
15
15
  history: History;
16
16
  interaction?: any;
17
+ getLocalStorage?: (key: string) => string | null;
17
18
  }
18
19
  /**
19
20
  * 简单的 Storage 接口实现
@@ -10,6 +10,7 @@ import { ITime } from '../../modules/Date/types';
10
10
  import dayjs from 'dayjs';
11
11
  import { LoadScheduleAvailableDateParams } from '../../modules/Schedule/types';
12
12
  import { IHolder, IFetchHolderAccountsParams } from '../../modules/AccountList/types';
13
+ import { IAppendFormRecordParams } from '../../modules/Holder/types';
13
14
  export declare class BookingByStepImpl extends BaseModule implements Module {
14
15
  protected defaultName: string;
15
16
  protected defaultVersion: string;
@@ -126,6 +127,20 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
126
127
  * @param params
127
128
  */
128
129
  fetchHolderAccountsAsync(params: IFetchHolderAccountsParams): Promise<void>;
130
+ /**
131
+ * 获取 holder 表单 map
132
+ */
133
+ getHolderFormMap(): import("../../modules").HolderFormMap;
134
+ /**
135
+ * 登录后或外部触发时,按当前 holderMap 批量刷新所有表单的 records
136
+ */
137
+ refreshAllHolderFormRecords(params?: {
138
+ customer_id?: number;
139
+ }): Promise<import("../../modules").HolderFormMap>;
140
+ /**
141
+ * 添加表单记录
142
+ */
143
+ appendFormRecord(params: IAppendFormRecordParams): import("../../modules").IFormRecord;
129
144
  setDateRange(dateRange: ITime[]): Promise<void>;
130
145
  clearDateRange(): void;
131
146
  getDateRange(): Promise<ITime[]>;
@@ -310,7 +325,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
310
325
  date: string;
311
326
  status: string;
312
327
  week: string;
313
- weekNum: 0 | 1 | 2 | 5 | 4 | 3 | 6;
328
+ weekNum: 0 | 2 | 1 | 5 | 4 | 3 | 6;
314
329
  }[]>;
315
330
  submitTimeSlot(timeSlots: TimeSliceItem): void;
316
331
  private getScheduleDataByIds;
@@ -329,7 +344,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
329
344
  count: number;
330
345
  left: number;
331
346
  summaryCount: number;
332
- status: "sold_out" | "lots_of_space" | "filling_up_fast";
347
+ status: "lots_of_space" | "filling_up_fast" | "sold_out";
333
348
  }[];
334
349
  /**
335
350
  * 找到多个资源的公共可用时间段