@pisell/pisellos 2.3.67 → 2.3.68
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/core/index.d.ts +0 -7
- package/dist/core/index.js +65 -109
- package/dist/model/strategy/adapter/walletPass/evaluator.js +0 -1
- package/dist/model/strategy/adapter/walletPass/utils.js +0 -2
- package/dist/modules/BaseModule.d.ts +1 -0
- package/dist/modules/BaseModule.js +24 -28
- package/dist/modules/Customer/index.d.ts +4 -0
- package/dist/modules/Customer/index.js +91 -59
- package/dist/modules/Customer/types.d.ts +2 -0
- package/dist/modules/Order/index.d.ts +22 -2
- package/dist/modules/Order/index.js +313 -142
- package/dist/modules/Order/types.d.ts +13 -1
- package/dist/modules/Order/utils/orderCollectionIdentity.d.ts +15 -0
- package/dist/modules/Order/utils/orderCollectionIdentity.js +75 -0
- package/dist/modules/Order/utils.js +0 -1
- package/dist/modules/Payment/index.d.ts +4 -0
- package/dist/modules/Payment/index.js +14 -4
- package/dist/modules/Payment/walletpass.js +52 -18
- package/dist/modules/Quotation/index.d.ts +0 -6
- package/dist/modules/Quotation/index.js +19 -75
- package/dist/modules/Rules/index.js +46 -31
- package/dist/plugins/request.d.ts +0 -1
- package/dist/server/index.d.ts +2 -8
- package/dist/server/index.js +143 -212
- package/dist/server/modules/floor-plan/index.d.ts +0 -4
- package/dist/server/modules/floor-plan/index.js +98 -240
- package/dist/server/modules/menu/index.js +23 -48
- package/dist/server/modules/order/index.d.ts +8 -17
- package/dist/server/modules/order/index.js +453 -506
- package/dist/server/modules/products/index.d.ts +2 -8
- package/dist/server/modules/products/index.js +75 -167
- package/dist/server/modules/resource/index.js +13 -21
- package/dist/server/utils/small-ticket.js +2 -1
- package/dist/solution/BaseSales/index.d.ts +3 -1
- package/dist/solution/BaseSales/index.js +99 -82
- package/dist/solution/BaseSales/utils.js +31 -20
- package/dist/solution/BookingTicket/index.d.ts +6 -2
- package/dist/solution/BookingTicket/index.js +123 -75
- package/dist/solution/ScanOrder/utils.js +31 -20
- package/dist/solution/UnifiedBookingSales/index.d.ts +25 -0
- package/dist/solution/UnifiedBookingSales/index.js +640 -321
- package/dist/solution/UnifiedBookingSales/types.d.ts +7 -0
- package/lib/core/index.d.ts +0 -7
- package/lib/core/index.js +2 -20
- package/lib/model/strategy/adapter/walletPass/evaluator.js +0 -1
- package/lib/model/strategy/adapter/walletPass/utils.js +0 -1
- package/lib/modules/BaseModule.d.ts +1 -0
- package/lib/modules/BaseModule.js +24 -37
- package/lib/modules/Customer/index.d.ts +4 -0
- package/lib/modules/Customer/index.js +11 -0
- package/lib/modules/Customer/types.d.ts +2 -0
- package/lib/modules/Order/index.d.ts +22 -2
- package/lib/modules/Order/index.js +212 -54
- package/lib/modules/Order/types.d.ts +13 -1
- package/lib/modules/Order/utils/orderCollectionIdentity.d.ts +15 -0
- package/lib/modules/Order/utils/orderCollectionIdentity.js +70 -0
- package/lib/modules/Order/utils.js +0 -1
- package/lib/modules/Payment/index.d.ts +4 -0
- package/lib/modules/Payment/index.js +7 -0
- package/lib/modules/Payment/walletpass.js +27 -2
- package/lib/modules/Quotation/index.d.ts +0 -6
- package/lib/modules/Quotation/index.js +5 -49
- package/lib/modules/Rules/index.js +17 -1
- package/lib/plugins/request.d.ts +0 -1
- package/lib/server/index.d.ts +2 -8
- package/lib/server/index.js +20 -58
- package/lib/server/modules/floor-plan/index.d.ts +0 -4
- package/lib/server/modules/floor-plan/index.js +6 -54
- package/lib/server/modules/menu/index.js +5 -31
- package/lib/server/modules/order/index.d.ts +8 -17
- package/lib/server/modules/order/index.js +106 -199
- package/lib/server/modules/products/index.d.ts +2 -8
- package/lib/server/modules/products/index.js +24 -97
- package/lib/server/modules/resource/index.js +2 -7
- package/lib/server/utils/small-ticket.js +1 -1
- package/lib/solution/BaseSales/index.d.ts +3 -1
- package/lib/solution/BaseSales/index.js +29 -16
- package/lib/solution/BaseSales/utils.js +29 -18
- package/lib/solution/BookingTicket/index.d.ts +6 -2
- package/lib/solution/BookingTicket/index.js +53 -14
- package/lib/solution/ScanOrder/utils.js +29 -18
- package/lib/solution/UnifiedBookingSales/index.d.ts +25 -0
- package/lib/solution/UnifiedBookingSales/index.js +188 -0
- package/lib/solution/UnifiedBookingSales/types.d.ts +7 -0
- package/package.json +1 -1
|
@@ -579,6 +579,10 @@ export interface LoadSalesDetailParams {
|
|
|
579
579
|
* 存在时 loadSalesDetail 会跳过远端 lookup,直接复用 hydrate 后半段逻辑。
|
|
580
580
|
*/
|
|
581
581
|
preloadedSalesDetail?: Record<string, any>;
|
|
582
|
+
/**
|
|
583
|
+
* sessionStorage 快照复用详情 hydrate 时使用;不带该值时保持既有编辑订单语义。
|
|
584
|
+
*/
|
|
585
|
+
hydrateSource?: 'sessionStorage';
|
|
582
586
|
forceRemote?: boolean;
|
|
583
587
|
merge?: boolean;
|
|
584
588
|
}
|
|
@@ -749,8 +753,15 @@ export interface OrderModuleAPI {
|
|
|
749
753
|
removeProductFromOrder: (identity: OrderProductIdentity, options?: RemoveProductsFromOrderOptions) => Promise<OrderProduct[]>;
|
|
750
754
|
/** 批量删除购物车行,末尾仅触发一次促销重算与 summary 刷新 */
|
|
751
755
|
removeProductsFromOrder: (identities: OrderProductIdentity[], options?: RemoveProductsFromOrderOptions) => Promise<OrderProduct[]>;
|
|
752
|
-
/**
|
|
756
|
+
/** 在显式开启时保存当前 tempOrder 的 sessionStorage 会话快照。 */
|
|
753
757
|
persistTempOrder: () => void;
|
|
758
|
+
/**
|
|
759
|
+
* 删除当前 cacheId 的 tempOrder 会话快照,并阻止当前模块实例再次写入。
|
|
760
|
+
* 新模块实例初始化时会按 otherParams 重新启用持久化。
|
|
761
|
+
*/
|
|
762
|
+
clearSessionStoragePersistedTempOrder: () => void;
|
|
763
|
+
/** 取出一次待恢复的 sessionStorage tempOrder 快照。 */
|
|
764
|
+
consumeSessionStorageRestore: () => Record<string, any> | null;
|
|
754
765
|
/**
|
|
755
766
|
* 控制 IndexedDB 草稿(saveDraft)开关;localStorage tempOrder 持久化已废弃。
|
|
756
767
|
* BigSale 弹窗等场景传 false 可跳过 saveDraft。
|
|
@@ -808,6 +819,7 @@ export interface OrderModuleAPI {
|
|
|
808
819
|
saveDraft: () => Promise<void>;
|
|
809
820
|
hydrateTempOrderFromRecord: (record: Record<string, any>, options?: {
|
|
810
821
|
recalcOnHydrate?: boolean;
|
|
822
|
+
source?: 'salesDetail' | 'sessionStorage';
|
|
811
823
|
}) => Promise<OrderTempOrder>;
|
|
812
824
|
syncPaymentsToOrder: <T = any>(params: SyncPaymentsToOrderParams) => Promise<SyncPaymentsToOrderResult<T>>;
|
|
813
825
|
getSalesOrderByLookup: (params: SalesOrderLookupParams) => Promise<any>;
|
|
@@ -24,6 +24,16 @@ export interface NormalizeOrderCollectionsResult<T> {
|
|
|
24
24
|
stats: Record<OrderCollectionKind, OrderCollectionIdentityStats>;
|
|
25
25
|
uidRemaps: OrderCollectionUidRemap[];
|
|
26
26
|
}
|
|
27
|
+
export interface ProductLineIdentityRepair {
|
|
28
|
+
index: number;
|
|
29
|
+
from: string;
|
|
30
|
+
to: string;
|
|
31
|
+
}
|
|
32
|
+
export interface RepairDuplicateProductLineIdentitiesResult<T> {
|
|
33
|
+
products: T[];
|
|
34
|
+
productsByUid?: Record<string, Record<string, any>>;
|
|
35
|
+
repairs: ProductLineIdentityRepair[];
|
|
36
|
+
}
|
|
27
37
|
export declare function createUuidV4(): string;
|
|
28
38
|
export declare function isBlankOrderCollectionIdentity(value: unknown): boolean;
|
|
29
39
|
export declare function getOrderCollectionPersistentId(kind: OrderCollectionKind, item: unknown): string | null;
|
|
@@ -31,6 +41,11 @@ export declare function getOrderCollectionUid(kind: OrderCollectionKind, item: u
|
|
|
31
41
|
export declare function buildOrderCollectionFallbackUid(kind: OrderCollectionKind, persistentId: string | number): string;
|
|
32
42
|
export declare function getOrderCollectionReferenceUid(kind: OrderCollectionKind, item: unknown): string | null;
|
|
33
43
|
export declare function setOrderCollectionUid<T>(kind: OrderCollectionKind, item: T, uid: string): T;
|
|
44
|
+
/**
|
|
45
|
+
* Rules 会把同一商品按商品券拆成多条真实订单行。拆行结果会继承原商品 UID,
|
|
46
|
+
* 因此必须在通用 collection normalization 之前为后续行派生稳定身份,避免被折叠。
|
|
47
|
+
*/
|
|
48
|
+
export declare function repairDuplicateProductLineIdentities<T extends Record<string, any>>(products: T[] | null | undefined, productsByUid?: Record<string, Record<string, any>> | null): RepairDuplicateProductLineIdentitiesResult<T>;
|
|
34
49
|
/**
|
|
35
50
|
* 持久化行 ID 是服务端事实主键;只有至少一侧尚未持久化时,才允许用 runtime UID 对齐。
|
|
36
51
|
*/
|
|
@@ -74,6 +74,81 @@ export function setOrderCollectionUid(kind, item, uid) {
|
|
|
74
74
|
delete record[uidField];
|
|
75
75
|
return record;
|
|
76
76
|
}
|
|
77
|
+
function getGoodPassResourceId(product) {
|
|
78
|
+
var _ref, _ref2, _goodPass$discount$re, _goodPass$discount;
|
|
79
|
+
var goodPass = (product.discount_list || []).find(function (item) {
|
|
80
|
+
var _item$discount, _item$discount2;
|
|
81
|
+
var type = (item === null || item === void 0 ? void 0 : item.type) || (item === null || item === void 0 ? void 0 : item.tag) || (item === null || item === void 0 || (_item$discount = item.discount) === null || _item$discount === void 0 ? void 0 : _item$discount.type) || (item === null || item === void 0 || (_item$discount2 = item.discount) === null || _item$discount2 === void 0 ? void 0 : _item$discount2.tag);
|
|
82
|
+
return type === 'good_pass';
|
|
83
|
+
});
|
|
84
|
+
if (!goodPass) return null;
|
|
85
|
+
var resourceId = (_ref = (_ref2 = (_goodPass$discount$re = (_goodPass$discount = goodPass.discount) === null || _goodPass$discount === void 0 ? void 0 : _goodPass$discount.resource_id) !== null && _goodPass$discount$re !== void 0 ? _goodPass$discount$re : goodPass.resource_id) !== null && _ref2 !== void 0 ? _ref2 : goodPass.discount_id) !== null && _ref !== void 0 ? _ref : goodPass.id;
|
|
86
|
+
return isBlankOrderCollectionIdentity(resourceId) ? null : String(resourceId);
|
|
87
|
+
}
|
|
88
|
+
function buildSplitProductUid(originalUid, product, duplicateOrdinal) {
|
|
89
|
+
var encodedOriginalUid = encodeURIComponent(originalUid);
|
|
90
|
+
var resourceId = getGoodPassResourceId(product);
|
|
91
|
+
if (resourceId) {
|
|
92
|
+
return "os-split:product:".concat(encodedOriginalUid, ":good-pass:").concat(encodeURIComponent(resourceId), ":").concat(duplicateOrdinal);
|
|
93
|
+
}
|
|
94
|
+
return "os-split:product:".concat(encodedOriginalUid, ":duplicate:").concat(duplicateOrdinal);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Rules 会把同一商品按商品券拆成多条真实订单行。拆行结果会继承原商品 UID,
|
|
99
|
+
* 因此必须在通用 collection normalization 之前为后续行派生稳定身份,避免被折叠。
|
|
100
|
+
*/
|
|
101
|
+
export function repairDuplicateProductLineIdentities(products, productsByUid) {
|
|
102
|
+
var repairedProducts = cloneDeep(products || []);
|
|
103
|
+
var repairedProductsByUid = productsByUid ? cloneDeep(productsByUid) : undefined;
|
|
104
|
+
var occupiedUids = new Set(repairedProducts.map(function (product) {
|
|
105
|
+
return getOrderCollectionUid('product', product);
|
|
106
|
+
}).filter(function (uid) {
|
|
107
|
+
return Boolean(uid);
|
|
108
|
+
}));
|
|
109
|
+
Object.keys(repairedProductsByUid || {}).forEach(function (uid) {
|
|
110
|
+
return occupiedUids.add(uid);
|
|
111
|
+
});
|
|
112
|
+
var occurrences = new Map();
|
|
113
|
+
var repairs = [];
|
|
114
|
+
repairedProducts.forEach(function (product, index) {
|
|
115
|
+
var originalUid = getOrderCollectionUid('product', product);
|
|
116
|
+
if (!originalUid) return;
|
|
117
|
+
var occurrence = (occurrences.get(originalUid) || 0) + 1;
|
|
118
|
+
occurrences.set(originalUid, occurrence);
|
|
119
|
+
if (occurrence === 1) return;
|
|
120
|
+
var duplicateOrdinal = occurrence - 1;
|
|
121
|
+
var baseCandidate = buildSplitProductUid(originalUid, product, duplicateOrdinal);
|
|
122
|
+
var nextUid = baseCandidate;
|
|
123
|
+
var conflictOrdinal = 1;
|
|
124
|
+
while (occupiedUids.has(nextUid)) {
|
|
125
|
+
nextUid = "".concat(baseCandidate, ":conflict:").concat(conflictOrdinal);
|
|
126
|
+
conflictOrdinal += 1;
|
|
127
|
+
}
|
|
128
|
+
var repairedProduct = setOrderCollectionUid('product', product, nextUid);
|
|
129
|
+
repairedProduct.identity_key = nextUid;
|
|
130
|
+
repairedProducts[index] = repairedProduct;
|
|
131
|
+
occupiedUids.add(nextUid);
|
|
132
|
+
repairs.push({
|
|
133
|
+
index: index,
|
|
134
|
+
from: originalUid,
|
|
135
|
+
to: nextUid
|
|
136
|
+
});
|
|
137
|
+
var runtimeSource = repairedProductsByUid === null || repairedProductsByUid === void 0 ? void 0 : repairedProductsByUid[originalUid];
|
|
138
|
+
if (runtimeSource && repairedProductsByUid) {
|
|
139
|
+
repairedProductsByUid[nextUid] = _objectSpread(_objectSpread({}, cloneDeep(runtimeSource)), runtimeSource.rowKey !== undefined ? {
|
|
140
|
+
rowKey: nextUid
|
|
141
|
+
} : {});
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
return _objectSpread(_objectSpread({
|
|
145
|
+
products: repairedProducts
|
|
146
|
+
}, repairedProductsByUid ? {
|
|
147
|
+
productsByUid: repairedProductsByUid
|
|
148
|
+
} : {}), {}, {
|
|
149
|
+
repairs: repairs
|
|
150
|
+
});
|
|
151
|
+
}
|
|
77
152
|
|
|
78
153
|
/**
|
|
79
154
|
* 持久化行 ID 是服务端事实主键;只有至少一侧尚未持久化时,才允许用 runtime UID 对齐。
|
|
@@ -1401,7 +1401,6 @@ export function productRequiresFormSubject(tempOrder, product) {
|
|
|
1401
1401
|
}
|
|
1402
1402
|
export function resolveIsFormSubject(tempOrder, product) {
|
|
1403
1403
|
var _tempOrder$holder;
|
|
1404
|
-
debugger;
|
|
1405
1404
|
// 旧版预约维度的 holder 类型仍然生效;新版则从当前商品 holder_config 判断。
|
|
1406
1405
|
if ((tempOrder === null || tempOrder === void 0 || (_tempOrder$holder = tempOrder.holder) === null || _tempOrder$holder === void 0 ? void 0 : _tempOrder$holder.type) === 'form') return true;
|
|
1407
1406
|
if (product) return productRequiresFormSubject(tempOrder, product);
|
|
@@ -41,6 +41,10 @@ export declare class PaymentModule extends BaseModule implements Module, Payment
|
|
|
41
41
|
* paymentModule.updateOtherParams({ fatherModule: 'bookingTicket' });
|
|
42
42
|
*/
|
|
43
43
|
updateOtherParams(params: Record<string, any>): void;
|
|
44
|
+
/**
|
|
45
|
+
* 获取标准化后的宿主平台标识,供支付子能力做平台边界判断。
|
|
46
|
+
*/
|
|
47
|
+
getPlatform(): string;
|
|
44
48
|
private getPaymentNumberAppData;
|
|
45
49
|
/**
|
|
46
50
|
* 记录信息日志
|
|
@@ -231,6 +231,16 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
231
231
|
value: function updateOtherParams(params) {
|
|
232
232
|
this.otherParams = params || {};
|
|
233
233
|
}
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* 获取标准化后的宿主平台标识,供支付子能力做平台边界判断。
|
|
237
|
+
*/
|
|
238
|
+
}, {
|
|
239
|
+
key: "getPlatform",
|
|
240
|
+
value: function getPlatform() {
|
|
241
|
+
var _this$otherParams;
|
|
242
|
+
return String(((_this$otherParams = this.otherParams) === null || _this$otherParams === void 0 ? void 0 : _this$otherParams.platform) || '').trim().toLowerCase();
|
|
243
|
+
}
|
|
234
244
|
}, {
|
|
235
245
|
key: "getPaymentNumberAppData",
|
|
236
246
|
value: function getPaymentNumberAppData(key) {
|
|
@@ -247,10 +257,10 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
247
257
|
}, {
|
|
248
258
|
key: "logInfo",
|
|
249
259
|
value: function logInfo(title, metadata) {
|
|
250
|
-
var _this$
|
|
251
|
-
if ((_this$
|
|
252
|
-
var _this$
|
|
253
|
-
var fatherModule = this.core.getModule((_this$
|
|
260
|
+
var _this$otherParams2;
|
|
261
|
+
if ((_this$otherParams2 = this.otherParams) !== null && _this$otherParams2 !== void 0 && _this$otherParams2.fatherModule) {
|
|
262
|
+
var _this$otherParams3;
|
|
263
|
+
var fatherModule = this.core.getModule((_this$otherParams3 = this.otherParams) === null || _this$otherParams3 === void 0 ? void 0 : _this$otherParams3.fatherModule);
|
|
254
264
|
if (fatherModule) {
|
|
255
265
|
fatherModule.logInfo("".concat(title), metadata);
|
|
256
266
|
return;
|
|
@@ -5,15 +5,15 @@ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArra
|
|
|
5
5
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
6
6
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
7
7
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
8
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
9
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
10
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
8
11
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
9
12
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
10
13
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
11
14
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
12
15
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
13
16
|
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; }
|
|
14
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
15
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
16
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
17
17
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
18
18
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
19
19
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
@@ -104,6 +104,26 @@ function mergeWalletAssets() {
|
|
|
104
104
|
});
|
|
105
105
|
return merged;
|
|
106
106
|
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* 聚合接口不保证 recalculate_list 顺序;派生抵扣额依赖选择顺序,
|
|
110
|
+
* 因此已选资产必须先恢复为 selectedIds 的顺序再进入策略计算。
|
|
111
|
+
*/
|
|
112
|
+
function orderWalletAssetsByIds(assets, orderedIds) {
|
|
113
|
+
var assetByKey = new Map(assets.map(function (asset) {
|
|
114
|
+
return [getWalletAssetKey(asset), asset];
|
|
115
|
+
}));
|
|
116
|
+
var orderedKeys = new Set(orderedIds.map(function (id) {
|
|
117
|
+
return String(id);
|
|
118
|
+
}));
|
|
119
|
+
return [].concat(_toConsumableArray(orderedIds.map(function (id) {
|
|
120
|
+
return assetByKey.get(String(id));
|
|
121
|
+
}).filter(function (asset) {
|
|
122
|
+
return asset !== undefined;
|
|
123
|
+
})), _toConsumableArray(assets.filter(function (asset) {
|
|
124
|
+
return !orderedKeys.has(getWalletAssetKey(asset));
|
|
125
|
+
})));
|
|
126
|
+
}
|
|
107
127
|
function createInitialWalletAssetsState() {
|
|
108
128
|
return {
|
|
109
129
|
status: 'idle',
|
|
@@ -620,7 +640,6 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
620
640
|
vouchers: allList
|
|
621
641
|
});
|
|
622
642
|
recommended = res.recommended, transformList = res.transformList, noApplicableVoucher = res.noApplicableVoucher, recommendedAmount = res.recommendedAmount;
|
|
623
|
-
console.log(res, 'resres12');
|
|
624
643
|
this.walletRecommendList = recommended;
|
|
625
644
|
|
|
626
645
|
// 存储初始化数据到内存中,供 useWalletPass 使用
|
|
@@ -640,19 +659,19 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
640
659
|
noApplicableVoucher: noApplicableVoucher,
|
|
641
660
|
products: products || []
|
|
642
661
|
});
|
|
643
|
-
case
|
|
644
|
-
_context3.prev =
|
|
662
|
+
case 19:
|
|
663
|
+
_context3.prev = 19;
|
|
645
664
|
_context3.t0 = _context3["catch"](0);
|
|
646
665
|
this.paymentModule.logError('[WalletPass] 初始化钱包数据失败', _context3.t0, {
|
|
647
666
|
customer_id: baseParams.customer_id,
|
|
648
667
|
order_expect_amount: baseParams.order_expect_amount
|
|
649
668
|
});
|
|
650
669
|
throw _context3.t0;
|
|
651
|
-
case
|
|
670
|
+
case 23:
|
|
652
671
|
case "end":
|
|
653
672
|
return _context3.stop();
|
|
654
673
|
}
|
|
655
|
-
}, _callee3, this, [[0,
|
|
674
|
+
}, _callee3, this, [[0, 19]]);
|
|
656
675
|
}));
|
|
657
676
|
function initializeWalletDataAsync(_x3) {
|
|
658
677
|
return _initializeWalletDataAsync.apply(this, arguments);
|
|
@@ -669,7 +688,7 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
669
688
|
value: (function () {
|
|
670
689
|
var _aggregateRecalculateWalletAssetsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(businessData, selectedIds) {
|
|
671
690
|
var _this$paymentModule$w7, _this$paymentModule$w8;
|
|
672
|
-
var walletParams, customerId, requestParams, response, responseData, hasAggregateLists, recalculateList, customerWalletPassList, allList, walletPassEvaluator, evaluated, returnedSelectedKeys, authoritativeSelectedIds;
|
|
691
|
+
var walletParams, customerId, requestParams, response, responseData, hasAggregateLists, recalculateList, customerWalletPassList, orderedRecalculateList, allList, walletPassEvaluator, evaluated, returnedSelectedKeys, authoritativeSelectedIds;
|
|
673
692
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
674
693
|
while (1) switch (_context4.prev = _context4.next) {
|
|
675
694
|
case 0:
|
|
@@ -705,7 +724,8 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
705
724
|
case 11:
|
|
706
725
|
recalculateList = Array.isArray(responseData === null || responseData === void 0 ? void 0 : responseData.recalculate_list) ? responseData.recalculate_list : [];
|
|
707
726
|
customerWalletPassList = Array.isArray(responseData === null || responseData === void 0 ? void 0 : responseData.customer_wallet_pass_list) ? responseData.customer_wallet_pass_list : [];
|
|
708
|
-
|
|
727
|
+
orderedRecalculateList = orderWalletAssetsByIds(recalculateList, selectedIds);
|
|
728
|
+
allList = mergeWalletAssets(orderedRecalculateList, customerWalletPassList);
|
|
709
729
|
walletPassEvaluator = (_this$paymentModule$w7 = this.paymentModule.window) === null || _this$paymentModule$w7 === void 0 || (_this$paymentModule$w8 = _this$paymentModule$w7.getWalletPassEvaluator) === null || _this$paymentModule$w8 === void 0 ? void 0 : _this$paymentModule$w8.call(_this$paymentModule$w7);
|
|
710
730
|
evaluated = walletPassEvaluator !== null && walletPassEvaluator !== void 0 && walletPassEvaluator.getRecommendedVouchers ? walletPassEvaluator.getRecommendedVouchers({
|
|
711
731
|
orderTotalAmount: walletParams.order_wait_pay_amount,
|
|
@@ -749,7 +769,7 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
749
769
|
products: walletParams.products || [],
|
|
750
770
|
authoritativeSelectedIds: authoritativeSelectedIds
|
|
751
771
|
});
|
|
752
|
-
case
|
|
772
|
+
case 25:
|
|
753
773
|
case "end":
|
|
754
774
|
return _context4.stop();
|
|
755
775
|
}
|
|
@@ -831,7 +851,7 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
831
851
|
key: "getUserIdentificationCodeListAsync",
|
|
832
852
|
value: function () {
|
|
833
853
|
var _getUserIdentificationCodeListAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(params) {
|
|
834
|
-
var _newParams$products, _newParams$prepare_pa, _this$walletParams4, newParams, response, sortedData;
|
|
854
|
+
var _newParams$products, _newParams$prepare_pa, _this$walletParams4, newParams, platform, response, sortedData;
|
|
835
855
|
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
836
856
|
while (1) switch (_context6.prev = _context6.next) {
|
|
837
857
|
case 0:
|
|
@@ -844,6 +864,20 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
844
864
|
this.paymentModule.logInfo('[WalletPass] 商品列表为空,跳过获取用户识别码列表');
|
|
845
865
|
return _context6.abrupt("return", []);
|
|
846
866
|
case 5:
|
|
867
|
+
platform = this.paymentModule.getPlatform();
|
|
868
|
+
if (!(platform === 'pc' || platform === 'h5')) {
|
|
869
|
+
_context6.next = 11;
|
|
870
|
+
break;
|
|
871
|
+
}
|
|
872
|
+
this.userIdentificationCodes = [];
|
|
873
|
+
this.emitEvent(WalletPassHooks.OnUserIdentificationCodesUpdated, {
|
|
874
|
+
userIdentificationCodes: []
|
|
875
|
+
});
|
|
876
|
+
this.paymentModule.logInfo('[WalletPass] 用户端平台跳过获取用户识别码列表', {
|
|
877
|
+
platform: platform
|
|
878
|
+
});
|
|
879
|
+
return _context6.abrupt("return", []);
|
|
880
|
+
case 11:
|
|
847
881
|
if (typeof newParams.payment_order_id === 'string' && newParams.payment_order_id.startsWith('LOCAL_')) {
|
|
848
882
|
newParams.payment_order_id = undefined;
|
|
849
883
|
}
|
|
@@ -854,9 +888,9 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
854
888
|
filter_prepare_wallet_pass: newParams.filter_prepare_wallet_pass,
|
|
855
889
|
payment_order_id: (_this$walletParams4 = this.walletParams) === null || _this$walletParams4 === void 0 ? void 0 : _this$walletParams4.payment_order_id
|
|
856
890
|
});
|
|
857
|
-
_context6.next =
|
|
891
|
+
_context6.next = 15;
|
|
858
892
|
return this.paymentModule.request.post('/machinecode/prepare/deduction', newParams);
|
|
859
|
-
case
|
|
893
|
+
case 15:
|
|
860
894
|
response = _context6.sent;
|
|
861
895
|
// 对获取到的数据进行排序,将错误码为 500100、500200、500300 的项目排到最后
|
|
862
896
|
sortedData = sortUserIdentificationCodeList((response === null || response === void 0 ? void 0 : response.data) || []);
|
|
@@ -877,19 +911,19 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
877
911
|
})
|
|
878
912
|
});
|
|
879
913
|
return _context6.abrupt("return", this.userIdentificationCodes);
|
|
880
|
-
case
|
|
881
|
-
_context6.prev =
|
|
914
|
+
case 23:
|
|
915
|
+
_context6.prev = 23;
|
|
882
916
|
_context6.t0 = _context6["catch"](0);
|
|
883
917
|
this.paymentModule.logError('[WalletPass] 获取用户识别码列表失败', _context6.t0, {
|
|
884
918
|
customer_id: params.customer_id,
|
|
885
919
|
available: params.available
|
|
886
920
|
});
|
|
887
921
|
return _context6.abrupt("return", []);
|
|
888
|
-
case
|
|
922
|
+
case 27:
|
|
889
923
|
case "end":
|
|
890
924
|
return _context6.stop();
|
|
891
925
|
}
|
|
892
|
-
}, _callee6, this, [[0,
|
|
926
|
+
}, _callee6, this, [[0, 23]]);
|
|
893
927
|
}));
|
|
894
928
|
function getUserIdentificationCodeListAsync(_x7) {
|
|
895
929
|
return _getUserIdentificationCodeListAsync.apply(this, arguments);
|
|
@@ -9,8 +9,6 @@ export declare class QuotationModule extends BaseModule implements Module {
|
|
|
9
9
|
private request;
|
|
10
10
|
private store;
|
|
11
11
|
private scheduleResolver?;
|
|
12
|
-
private app;
|
|
13
|
-
private quotationListUpdatedListener?;
|
|
14
12
|
constructor(name?: string, version?: string);
|
|
15
13
|
initialize(core: PisellCore, options: ModuleOptions): Promise<void>;
|
|
16
14
|
loadQuotations(params?: {
|
|
@@ -18,7 +16,6 @@ export declare class QuotationModule extends BaseModule implements Module {
|
|
|
18
16
|
customer_id?: number | string;
|
|
19
17
|
}): Promise<void>;
|
|
20
18
|
getQuotationList(): QuotationItem[];
|
|
21
|
-
setQuotationListUpdatedListener(listener?: () => void): void;
|
|
22
19
|
getQuotationCustomerScopeInfo(): QuotationCustomerScopeInfo;
|
|
23
20
|
/**
|
|
24
21
|
* Look up the quotation price for a specific product (+ optional variant) at a given datetime.
|
|
@@ -63,9 +60,6 @@ export declare class QuotationModule extends BaseModule implements Module {
|
|
|
63
60
|
customer_id?: number | string;
|
|
64
61
|
}): Map<string, string | null>;
|
|
65
62
|
setScheduleResolver(resolver: (id: number) => ScheduleItem | undefined): void;
|
|
66
|
-
private applyQuotationResponse;
|
|
67
|
-
private notifyQuotationListUpdated;
|
|
68
|
-
private getQuotationCacheKeyData;
|
|
69
63
|
private isQuotationVisibleForCustomer;
|
|
70
64
|
private hasValidCustomerId;
|
|
71
65
|
private normalizeCustomerId;
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
2
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
3
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
5
|
-
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
6
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
7
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
8
4
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
9
5
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
10
6
|
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; }
|
|
@@ -40,15 +36,12 @@ export var QuotationModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
40
36
|
list: []
|
|
41
37
|
});
|
|
42
38
|
_defineProperty(_assertThisInitialized(_this), "scheduleResolver", void 0);
|
|
43
|
-
_defineProperty(_assertThisInitialized(_this), "app", void 0);
|
|
44
|
-
_defineProperty(_assertThisInitialized(_this), "quotationListUpdatedListener", void 0);
|
|
45
39
|
return _this;
|
|
46
40
|
}
|
|
47
41
|
_createClass(QuotationModule, [{
|
|
48
42
|
key: "initialize",
|
|
49
43
|
value: function () {
|
|
50
44
|
var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(core, options) {
|
|
51
|
-
var _core$getPlugin, _core$getPlugin$getAp;
|
|
52
45
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
53
46
|
while (1) switch (_context.prev = _context.next) {
|
|
54
47
|
case 0:
|
|
@@ -60,11 +53,10 @@ export var QuotationModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
60
53
|
}
|
|
61
54
|
throw new Error('QuotationModule 需要 request 插件支持');
|
|
62
55
|
case 4:
|
|
63
|
-
this.app = (_core$getPlugin = core.getPlugin('app')) === null || _core$getPlugin === void 0 || (_core$getPlugin$getAp = _core$getPlugin.getApp) === null || _core$getPlugin$getAp === void 0 ? void 0 : _core$getPlugin$getAp.call(_core$getPlugin);
|
|
64
56
|
this.store = {
|
|
65
57
|
list: []
|
|
66
58
|
};
|
|
67
|
-
case
|
|
59
|
+
case 5:
|
|
68
60
|
case "end":
|
|
69
61
|
return _context.stop();
|
|
70
62
|
}
|
|
@@ -79,8 +71,8 @@ export var QuotationModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
79
71
|
key: "loadQuotations",
|
|
80
72
|
value: function () {
|
|
81
73
|
var _loadQuotations = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(params) {
|
|
82
|
-
var
|
|
83
|
-
var query,
|
|
74
|
+
var _data;
|
|
75
|
+
var query, res, list;
|
|
84
76
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
85
77
|
while (1) switch (_context2.prev = _context2.next) {
|
|
86
78
|
case 0:
|
|
@@ -89,27 +81,19 @@ export var QuotationModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
89
81
|
if ((params === null || params === void 0 ? void 0 : params.channel) === 'online_store') {
|
|
90
82
|
query.channel = 'online-store';
|
|
91
83
|
}
|
|
92
|
-
|
|
93
|
-
applyRemoteUpdate = function applyRemoteUpdate(response) {
|
|
94
|
-
_this2.applyQuotationResponse(response);
|
|
95
|
-
if (initialResultApplied) {
|
|
96
|
-
_this2.notifyQuotationListUpdated();
|
|
97
|
-
}
|
|
98
|
-
};
|
|
99
|
-
_context2.next = 7;
|
|
84
|
+
_context2.next = 5;
|
|
100
85
|
return this.request.get('/quotation/available', query, {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
updateCache: true,
|
|
104
|
-
cacheKeyData: this.getQuotationCacheKeyData(query)
|
|
105
|
-
},
|
|
106
|
-
cacheUpdateChange: applyRemoteUpdate
|
|
86
|
+
useCache: false,
|
|
87
|
+
osServer: true
|
|
107
88
|
});
|
|
108
|
-
case
|
|
89
|
+
case 5:
|
|
109
90
|
res = _context2.sent;
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
91
|
+
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) || [];
|
|
92
|
+
list.sort(function (a, b) {
|
|
93
|
+
return b.sort - a.sort;
|
|
94
|
+
});
|
|
95
|
+
this.store.list = list;
|
|
96
|
+
case 9:
|
|
113
97
|
case "end":
|
|
114
98
|
return _context2.stop();
|
|
115
99
|
}
|
|
@@ -125,15 +109,10 @@ export var QuotationModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
125
109
|
value: function getQuotationList() {
|
|
126
110
|
return this.store.list;
|
|
127
111
|
}
|
|
128
|
-
}, {
|
|
129
|
-
key: "setQuotationListUpdatedListener",
|
|
130
|
-
value: function setQuotationListUpdatedListener(listener) {
|
|
131
|
-
this.quotationListUpdatedListener = listener;
|
|
132
|
-
}
|
|
133
112
|
}, {
|
|
134
113
|
key: "getQuotationCustomerScopeInfo",
|
|
135
114
|
value: function getQuotationCustomerScopeInfo() {
|
|
136
|
-
var
|
|
115
|
+
var _this2 = this;
|
|
137
116
|
var customerById = new Map();
|
|
138
117
|
var quotationScopes = this.store.list.filter(function (quotation) {
|
|
139
118
|
return Array.isArray(quotation.customer) && quotation.customer.length > 0;
|
|
@@ -143,7 +122,7 @@ export var QuotationModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
143
122
|
var localSeen = new Set();
|
|
144
123
|
var quotationCustomers = quotation.customer || [];
|
|
145
124
|
quotationCustomers.forEach(function (customer) {
|
|
146
|
-
var customerId =
|
|
125
|
+
var customerId = _this2.normalizeCustomerId(customer === null || customer === void 0 ? void 0 : customer.id);
|
|
147
126
|
if (!customerId || localSeen.has(customerId)) return;
|
|
148
127
|
localSeen.add(customerId);
|
|
149
128
|
customerIds.push(customerId);
|
|
@@ -268,41 +247,6 @@ export var QuotationModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
268
247
|
value: function setScheduleResolver(resolver) {
|
|
269
248
|
this.scheduleResolver = resolver;
|
|
270
249
|
}
|
|
271
|
-
}, {
|
|
272
|
-
key: "applyQuotationResponse",
|
|
273
|
-
value: function applyQuotationResponse(response) {
|
|
274
|
-
var _data;
|
|
275
|
-
var source = (response === null || response === void 0 || (_data = response.data) === null || _data === void 0 ? void 0 : _data.list) || (response === null || response === void 0 ? void 0 : response.list) || [];
|
|
276
|
-
this.store.list = _toConsumableArray(source).sort(function (a, b) {
|
|
277
|
-
return Number(b.sort || 0) - Number(a.sort || 0);
|
|
278
|
-
});
|
|
279
|
-
}
|
|
280
|
-
}, {
|
|
281
|
-
key: "notifyQuotationListUpdated",
|
|
282
|
-
value: function notifyQuotationListUpdated() {
|
|
283
|
-
try {
|
|
284
|
-
var _this$quotationListUp;
|
|
285
|
-
(_this$quotationListUp = this.quotationListUpdatedListener) === null || _this$quotationListUp === void 0 || _this$quotationListUp.call(this);
|
|
286
|
-
} catch (error) {
|
|
287
|
-
console.warn('[QuotationModule] 报价单后台更新回调失败', error);
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
}, {
|
|
291
|
-
key: "getQuotationCacheKeyData",
|
|
292
|
-
value: function getQuotationCacheKeyData(query) {
|
|
293
|
-
var shopId = '';
|
|
294
|
-
try {
|
|
295
|
-
var _this$app, _this$app$getStorage;
|
|
296
|
-
var storedCore = (_this$app = this.app) === null || _this$app === void 0 || (_this$app = _this$app.storage) === null || _this$app === void 0 || (_this$app$getStorage = _this$app.getStorage) === null || _this$app$getStorage === void 0 ? void 0 : _this$app$getStorage.call(_this$app, 'core');
|
|
297
|
-
var coreInfo = typeof storedCore === 'string' ? JSON.parse(storedCore || '{}') : storedCore || {};
|
|
298
|
-
shopId = String((coreInfo === null || coreInfo === void 0 ? void 0 : coreInfo.id) || '');
|
|
299
|
-
} catch (_unused) {
|
|
300
|
-
// 缓存隔离信息读取失败时仍按请求参数缓存。
|
|
301
|
-
}
|
|
302
|
-
return _objectSpread(_objectSpread({}, query), {}, {
|
|
303
|
-
shop_id: shopId
|
|
304
|
-
});
|
|
305
|
-
}
|
|
306
250
|
}, {
|
|
307
251
|
key: "isQuotationVisibleForCustomer",
|
|
308
252
|
value: function isQuotationVisibleForCustomer(quotation, customerId) {
|
|
@@ -329,17 +273,17 @@ export var QuotationModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
329
273
|
key: "isQuotationActiveAt",
|
|
330
274
|
value: function isQuotationActiveAt(quotation, datetime) {
|
|
331
275
|
var _quotation$schedule,
|
|
332
|
-
|
|
276
|
+
_this3 = this;
|
|
333
277
|
if (!((_quotation$schedule = quotation.schedule) !== null && _quotation$schedule !== void 0 && _quotation$schedule.length)) return false;
|
|
334
278
|
var scheduleItems = [];
|
|
335
279
|
quotation.schedule.forEach(function (s) {
|
|
336
|
-
var
|
|
337
|
-
var full = (
|
|
280
|
+
var _this3$scheduleResolv;
|
|
281
|
+
var full = (_this3$scheduleResolv = _this3.scheduleResolver) === null || _this3$scheduleResolv === void 0 ? void 0 : _this3$scheduleResolv.call(_this3, s.id);
|
|
338
282
|
if (full) {
|
|
339
283
|
scheduleItems.push(full);
|
|
340
284
|
return;
|
|
341
285
|
}
|
|
342
|
-
if (
|
|
286
|
+
if (_this3.scheduleResolver) {
|
|
343
287
|
return;
|
|
344
288
|
}
|
|
345
289
|
var fallbackSchedule = _objectSpread(_objectSpread({}, s), {}, {
|