@pisell/pisellos 3.0.93 → 3.0.95
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.
- package/dist/modules/Cart/utils/changePrice.js +16 -9
- package/dist/modules/Holder/index.d.ts +48 -0
- package/dist/modules/Holder/index.js +640 -0
- package/dist/modules/Holder/types.d.ts +123 -0
- package/dist/modules/Holder/types.js +1 -0
- package/dist/modules/Holder/utils.d.ts +13 -0
- package/dist/modules/Holder/utils.js +34 -0
- package/dist/modules/Order/index.d.ts +1 -0
- package/dist/modules/Order/index.js +18 -1
- package/dist/modules/Order/types.d.ts +2 -0
- package/dist/modules/Order/utils.d.ts +10 -0
- package/dist/modules/Order/utils.js +35 -3
- package/dist/modules/Product/index.d.ts +1 -1
- package/dist/modules/Product/types.d.ts +7 -0
- package/dist/modules/index.d.ts +1 -0
- package/dist/modules/index.js +2 -1
- package/dist/plugins/window.d.ts +1 -0
- package/dist/solution/BookingByStep/index.d.ts +16 -1
- package/dist/solution/BookingByStep/index.js +276 -204
- package/dist/solution/BookingByStep/types.d.ts +2 -1
- package/dist/solution/BookingByStep/types.js +3 -1
- package/dist/solution/ScanOrder/types.d.ts +1 -0
- package/dist/solution/VenueBooking/index.d.ts +19 -0
- package/dist/solution/VenueBooking/index.js +978 -748
- package/dist/solution/VenueBooking/types.d.ts +2 -0
- package/dist/types/index.d.ts +1 -0
- package/lib/modules/Cart/utils/changePrice.js +13 -9
- package/lib/modules/Holder/index.d.ts +48 -0
- package/lib/modules/Holder/index.js +402 -0
- package/lib/modules/Holder/types.d.ts +123 -0
- package/lib/modules/Holder/types.js +17 -0
- package/lib/modules/Holder/utils.d.ts +13 -0
- package/lib/modules/Holder/utils.js +71 -0
- package/lib/modules/Order/index.d.ts +1 -0
- package/lib/modules/Order/index.js +14 -0
- package/lib/modules/Order/types.d.ts +2 -0
- package/lib/modules/Order/utils.d.ts +10 -0
- package/lib/modules/Order/utils.js +36 -5
- package/lib/modules/Product/index.d.ts +1 -1
- package/lib/modules/Product/types.d.ts +7 -0
- package/lib/modules/index.d.ts +1 -0
- package/lib/modules/index.js +3 -1
- package/lib/plugins/window.d.ts +1 -0
- package/lib/solution/BookingByStep/index.d.ts +16 -1
- package/lib/solution/BookingByStep/index.js +39 -0
- package/lib/solution/BookingByStep/types.d.ts +2 -1
- package/lib/solution/BookingByStep/types.js +5 -0
- package/lib/solution/ScanOrder/types.d.ts +1 -0
- package/lib/solution/VenueBooking/index.d.ts +19 -0
- package/lib/solution/VenueBooking/index.js +134 -16
- package/lib/solution/VenueBooking/types.d.ts +2 -0
- package/lib/types/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -23,8 +23,8 @@ function _updateAllCartItemPrice() {
|
|
|
23
23
|
_iterator = _createForOfIteratorHelper(cartItems);
|
|
24
24
|
_context2.prev = 1;
|
|
25
25
|
_loop = /*#__PURE__*/_regeneratorRuntime().mark(function _loop() {
|
|
26
|
-
var _item$_productOrigin, _bundle;
|
|
27
|
-
var item, targetProduct, cartProduct, productInfo, bundle, _productInfo$variant;
|
|
26
|
+
var _item$_productOrigin$, _item$_productOrigin, _item$_origin, _targetProduct$varian, _ref, _targetVariant$price, _ref2, _targetVariant$base_p, _item$_productOrigin2, _bundle;
|
|
27
|
+
var item, targetProduct, cartProduct, productInfo, variantId, targetVariant, bundle, _productInfo$variant;
|
|
28
28
|
return _regeneratorRuntime().wrap(function _loop$(_context) {
|
|
29
29
|
while (1) switch (_context.prev = _context.next) {
|
|
30
30
|
case 0:
|
|
@@ -40,10 +40,17 @@ function _updateAllCartItemPrice() {
|
|
|
40
40
|
if (!productInfo) {
|
|
41
41
|
productInfo = item._productOrigin;
|
|
42
42
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
43
|
+
|
|
44
|
+
// 查找选择的规格id
|
|
45
|
+
variantId = (_item$_productOrigin$ = item === null || item === void 0 || (_item$_productOrigin = item._productOrigin) === null || _item$_productOrigin === void 0 ? void 0 : _item$_productOrigin.product_variant_id) !== null && _item$_productOrigin$ !== void 0 ? _item$_productOrigin$ : item === null || item === void 0 || (_item$_origin = item._origin) === null || _item$_origin === void 0 || (_item$_origin = _item$_origin.product) === null || _item$_origin === void 0 ? void 0 : _item$_origin.product_variant_id;
|
|
46
|
+
targetVariant = targetProduct === null || targetProduct === void 0 || (_targetProduct$varian = targetProduct.variant) === null || _targetProduct$varian === void 0 ? void 0 : _targetProduct$varian.find(function (variant) {
|
|
47
|
+
return Number(variant.id) === Number(variantId);
|
|
48
|
+
});
|
|
49
|
+
bundle = item._bundleOrigin; // productInfo.price = targetProduct?.price;
|
|
50
|
+
// productInfo.base_price = targetProduct?.base_price;
|
|
51
|
+
productInfo.price = (_ref = (_targetVariant$price = targetVariant === null || targetVariant === void 0 ? void 0 : targetVariant.price) !== null && _targetVariant$price !== void 0 ? _targetVariant$price : targetProduct === null || targetProduct === void 0 ? void 0 : targetProduct.price) !== null && _ref !== void 0 ? _ref : productInfo.price;
|
|
52
|
+
productInfo.base_price = (_ref2 = (_targetVariant$base_p = targetVariant === null || targetVariant === void 0 ? void 0 : targetVariant.base_price) !== null && _targetVariant$base_p !== void 0 ? _targetVariant$base_p : targetProduct === null || targetProduct === void 0 ? void 0 : targetProduct.base_price) !== null && _ref2 !== void 0 ? _ref2 : productInfo.base_price;
|
|
53
|
+
productInfo.product_variant_id = (_item$_productOrigin2 = item._productOrigin) === null || _item$_productOrigin2 === void 0 ? void 0 : _item$_productOrigin2.product_variant_id;
|
|
47
54
|
bundle = (_bundle = bundle) === null || _bundle === void 0 ? void 0 : _bundle.map(function (n) {
|
|
48
55
|
var _targetProduct$bundle;
|
|
49
56
|
// 更新 bundle 的价格
|
|
@@ -75,8 +82,8 @@ function _updateAllCartItemPrice() {
|
|
|
75
82
|
// 如果有返回variant,则把对应variant的数据也补充进去
|
|
76
83
|
if (targetProduct !== null && targetProduct !== void 0 && targetProduct.variant) {
|
|
77
84
|
productInfo.variant = (_productInfo$variant = productInfo.variant) === null || _productInfo$variant === void 0 ? void 0 : _productInfo$variant.map(function (n) {
|
|
78
|
-
var _targetProduct$
|
|
79
|
-
var targetVariant = (_targetProduct$
|
|
85
|
+
var _targetProduct$varian2;
|
|
86
|
+
var targetVariant = (_targetProduct$varian2 = targetProduct.variant) === null || _targetProduct$varian2 === void 0 ? void 0 : _targetProduct$varian2.find(function (m) {
|
|
80
87
|
return m.id === n.id;
|
|
81
88
|
});
|
|
82
89
|
if (targetVariant) {
|
|
@@ -99,7 +106,7 @@ function _updateAllCartItemPrice() {
|
|
|
99
106
|
bundle: bundle,
|
|
100
107
|
options: item._optionsOrigin
|
|
101
108
|
});
|
|
102
|
-
case
|
|
109
|
+
case 17:
|
|
103
110
|
case "end":
|
|
104
111
|
return _context.stop();
|
|
105
112
|
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { Module, PisellCore, ModuleOptions } from '../../types';
|
|
2
|
+
import { BaseModule } from '../BaseModule';
|
|
3
|
+
import { IFormInfo, IFormRecord, IFormItemData, IFetchFormInfoParams, IFetchFormRecordsParams, IAddFormRecordParams, IAppendFormRecordParams, IEnsureFormDataParams, IEnsureFormByProductParams, IRefreshAllFormRecordsParams, HolderModuleAPI, HolderFormMap } from './types';
|
|
4
|
+
export * from './types';
|
|
5
|
+
export * from './utils';
|
|
6
|
+
export declare class HolderModule extends BaseModule implements Module, HolderModuleAPI {
|
|
7
|
+
protected defaultName: string;
|
|
8
|
+
protected defaultVersion: string;
|
|
9
|
+
private store;
|
|
10
|
+
private request;
|
|
11
|
+
private cacheId;
|
|
12
|
+
private openCache;
|
|
13
|
+
private fatherModule;
|
|
14
|
+
private isLoading;
|
|
15
|
+
private error;
|
|
16
|
+
/** 已加载过表单数据的 form_id 缓存标记 */
|
|
17
|
+
private loadedFormIds;
|
|
18
|
+
private window;
|
|
19
|
+
constructor(name?: string, version?: string);
|
|
20
|
+
initialize(core: PisellCore, options: ModuleOptions): Promise<void>;
|
|
21
|
+
/** 统一提交 formMap,仅此处触发 store changed */
|
|
22
|
+
private commitFormMap;
|
|
23
|
+
/** 通知 UI 刷新(数据未变但需要 re-read 的场景) */
|
|
24
|
+
private notifyFormMapChanged;
|
|
25
|
+
getHolderFormMap(): HolderFormMap;
|
|
26
|
+
getHolderFormData(formId: number | string): IFormItemData | undefined;
|
|
27
|
+
setFormData(formId: number | string, data: Partial<IFormItemData>): void;
|
|
28
|
+
private ensureFormItem;
|
|
29
|
+
private hasFormData;
|
|
30
|
+
private patchFormMap;
|
|
31
|
+
fetchFormInfo(params: IFetchFormInfoParams): Promise<IFormInfo | IFormInfo[]>;
|
|
32
|
+
fetchRecords(params: IFetchFormRecordsParams): Promise<any>;
|
|
33
|
+
ensureFormData(params: IEnsureFormDataParams): Promise<IFormItemData>;
|
|
34
|
+
ensureFormByProduct(params: IEnsureFormByProductParams): Promise<IFormItemData | null>;
|
|
35
|
+
addFormRecord(params: IAddFormRecordParams): Promise<any>;
|
|
36
|
+
/**
|
|
37
|
+
* UI 层自行请求添加接口后,将返回记录合并到 holderMap 对应 form_id 的 records 中
|
|
38
|
+
*/
|
|
39
|
+
appendFormRecord(params: IAppendFormRecordParams): IFormRecord;
|
|
40
|
+
removeFormRecord(formId: number | string, formRecordId: number): void;
|
|
41
|
+
clearFormData(formId?: number | string): void;
|
|
42
|
+
/**
|
|
43
|
+
* 登录后按当前 holderMap 批量刷新所有表单的 records。
|
|
44
|
+
* 遍历 holderMap,从 form.form 中读取 form_id、shop_id,结合 customer_id 重新拉取记录。
|
|
45
|
+
*/
|
|
46
|
+
refreshAllFormRecords(params?: IRefreshAllFormRecordsParams): Promise<HolderFormMap>;
|
|
47
|
+
storeChange(path?: string): void;
|
|
48
|
+
}
|