@pisell/pisellos 2.3.93 → 2.3.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/model/strategy/adapter/itemRule/adapter.d.ts +4 -1
- package/dist/model/strategy/adapter/itemRule/adapter.js +135 -35
- package/dist/model/strategy/adapter/itemRule/evaluator.d.ts +8 -1
- package/dist/model/strategy/adapter/itemRule/evaluator.js +25 -1
- package/dist/model/strategy/adapter/itemRule/type.d.ts +44 -0
- package/dist/model/strategy/adapter/itemRule/type.js +19 -1
- package/dist/modules/Order/index.d.ts +18 -3
- package/dist/modules/Order/index.js +885 -485
- package/dist/modules/Order/salesNotes.d.ts +31 -0
- package/dist/modules/Order/salesNotes.js +492 -0
- package/dist/modules/Order/types.d.ts +91 -5
- package/dist/modules/Order/types.js +5 -0
- package/dist/modules/Order/utils.d.ts +12 -0
- package/dist/modules/Order/utils.js +75 -26
- package/dist/modules/ProductList/index.d.ts +2 -1
- package/dist/modules/ProductList/index.js +100 -20
- package/dist/modules/ProductList/types.d.ts +10 -0
- package/dist/modules/ResourcePlanner/planner.js +5 -3
- package/dist/modules/ResourcePlanner/types.d.ts +5 -0
- package/dist/server/index.d.ts +6 -0
- package/dist/server/index.js +43 -3
- package/dist/solution/BaseSales/index.d.ts +9 -1
- package/dist/solution/BaseSales/index.js +894 -706
- package/dist/solution/BookingByStep/index.d.ts +2 -2
- package/dist/solution/BookingTicket/utils/orderCustomer.js +3 -2
- package/dist/solution/RegisterAndLogin/config.d.ts +9 -3
- package/dist/solution/RegisterAndLogin/config.js +95 -40
- package/dist/solution/RegisterAndLogin/index.js +4 -1
- package/dist/solution/ScanOrder/index.d.ts +1 -0
- package/dist/solution/ScanOrder/index.js +31 -27
- package/dist/solution/ScanOrder/utils.d.ts +1 -0
- package/dist/solution/ScanOrder/utils.js +2 -0
- package/dist/solution/UnifiedBookingSales/index.d.ts +15 -2
- package/dist/solution/UnifiedBookingSales/index.js +767 -488
- package/dist/solution/UnifiedBookingSales/types.d.ts +14 -1
- package/dist/solution/VenueBooking/index.d.ts +1 -0
- package/dist/solution/VenueBooking/index.js +8 -4
- package/lib/model/strategy/adapter/itemRule/adapter.d.ts +4 -1
- package/lib/model/strategy/adapter/itemRule/adapter.js +73 -4
- package/lib/model/strategy/adapter/itemRule/evaluator.d.ts +8 -1
- package/lib/model/strategy/adapter/itemRule/evaluator.js +23 -1
- package/lib/model/strategy/adapter/itemRule/type.d.ts +44 -0
- package/lib/model/strategy/adapter/itemRule/type.js +19 -1
- package/lib/modules/Order/index.d.ts +18 -3
- package/lib/modules/Order/index.js +325 -28
- package/lib/modules/Order/salesNotes.d.ts +31 -0
- package/lib/modules/Order/salesNotes.js +382 -0
- package/lib/modules/Order/types.d.ts +91 -5
- package/lib/modules/Order/types.js +4 -0
- package/lib/modules/Order/utils.d.ts +12 -0
- package/lib/modules/Order/utils.js +68 -16
- package/lib/modules/ProductList/index.d.ts +2 -1
- package/lib/modules/ProductList/index.js +47 -2
- package/lib/modules/ProductList/types.d.ts +10 -0
- package/lib/modules/ResourcePlanner/planner.js +5 -3
- package/lib/modules/ResourcePlanner/types.d.ts +5 -0
- package/lib/server/index.d.ts +6 -0
- package/lib/server/index.js +37 -3
- package/lib/solution/BaseSales/index.d.ts +9 -1
- package/lib/solution/BaseSales/index.js +105 -1
- package/lib/solution/BookingByStep/index.d.ts +2 -2
- package/lib/solution/BookingTicket/utils/orderCustomer.js +2 -1
- package/lib/solution/RegisterAndLogin/config.d.ts +9 -3
- package/lib/solution/RegisterAndLogin/config.js +49 -8
- package/lib/solution/RegisterAndLogin/index.js +4 -1
- package/lib/solution/ScanOrder/index.d.ts +1 -0
- package/lib/solution/ScanOrder/index.js +5 -1
- package/lib/solution/ScanOrder/utils.d.ts +1 -0
- package/lib/solution/ScanOrder/utils.js +1 -0
- package/lib/solution/UnifiedBookingSales/index.d.ts +15 -2
- package/lib/solution/UnifiedBookingSales/index.js +140 -6
- package/lib/solution/UnifiedBookingSales/types.d.ts +14 -1
- package/lib/solution/VenueBooking/index.d.ts +1 -0
- package/lib/solution/VenueBooking/index.js +5 -1
- package/package.json +1 -1
|
@@ -34,7 +34,7 @@ import { BaseModule } from "../../modules/BaseModule";
|
|
|
34
34
|
import { BaseSalesHookNames } from "./types";
|
|
35
35
|
import { OrderModule } from "../../modules/Order";
|
|
36
36
|
import Decimal from 'decimal.js';
|
|
37
|
-
import { cloneDeep, mergeWith } from 'lodash-es';
|
|
37
|
+
import { cloneDeep, isEqual, mergeWith } from 'lodash-es';
|
|
38
38
|
import { createModule } from "../BookingByStep/types";
|
|
39
39
|
import { composeLinePrice, createUuidV4, ensureProductSku, getProductSkuOptions, resolveIsFormSubject, sumOptionUnitPrice } from "../../modules/Order/utils";
|
|
40
40
|
import { ensureOrderPaymentNumber, isIdentifiedPendingOrderPayment, isPendingOrderPayment, mergeOrderPaymentListsByIdentity, resolveOrderPaymentIdentity } from "../../modules/Order/payment-utils";
|
|
@@ -320,7 +320,66 @@ function mergeBaseSalesUniqueArray(currentValue, loadedValue, metadataKey) {
|
|
|
320
320
|
loadedValue.forEach(appendOrReplaceByUid);
|
|
321
321
|
return result;
|
|
322
322
|
}
|
|
323
|
+
|
|
324
|
+
// checkout / realtime snapshots may reorder protocol arrays or append persistence fields.
|
|
325
|
+
// Compare only the Sales Note protocol fields so a matching remote echo can acknowledge dirty state.
|
|
326
|
+
function normalizeBaseSalesNotesForComparison(value, options) {
|
|
327
|
+
var _options$unresolvedOr;
|
|
328
|
+
if (!Array.isArray(value)) return null;
|
|
329
|
+
var unresolvedOrderTargetUuid = String((_options$unresolvedOr = options === null || options === void 0 ? void 0 : options.unresolvedOrderTargetUuid) !== null && _options$unresolvedOr !== void 0 ? _options$unresolvedOr : '').trim();
|
|
330
|
+
return value.map(function (note) {
|
|
331
|
+
var _noteRecord$content;
|
|
332
|
+
if (!note || _typeof(note) !== 'object' || Array.isArray(note)) {
|
|
333
|
+
return cloneDeep(note);
|
|
334
|
+
}
|
|
335
|
+
var noteRecord = note;
|
|
336
|
+
var relations = Array.isArray(noteRecord.note_relations) ? noteRecord.note_relations.map(function (relation) {
|
|
337
|
+
var _relation$target_uuid;
|
|
338
|
+
if (!relation || _typeof(relation) !== 'object' || Array.isArray(relation)) {
|
|
339
|
+
return cloneDeep(relation);
|
|
340
|
+
}
|
|
341
|
+
var shouldResolveOrderTarget = relation.is_primary === 0 && relation.relation_type === 'related_to' && relation.target_type === 'order' && String((_relation$target_uuid = relation.target_uuid) !== null && _relation$target_uuid !== void 0 ? _relation$target_uuid : '').trim() === '' && unresolvedOrderTargetUuid.length > 0;
|
|
342
|
+
return {
|
|
343
|
+
uuid: relation.uuid,
|
|
344
|
+
relation_type: relation.relation_type,
|
|
345
|
+
target_type: relation.target_type,
|
|
346
|
+
target_uuid: shouldResolveOrderTarget ? unresolvedOrderTargetUuid : relation.target_uuid,
|
|
347
|
+
is_primary: relation.is_primary
|
|
348
|
+
};
|
|
349
|
+
}).sort(function (left, right) {
|
|
350
|
+
var _left$uuid, _right$uuid;
|
|
351
|
+
return String((_left$uuid = left === null || left === void 0 ? void 0 : left.uuid) !== null && _left$uuid !== void 0 ? _left$uuid : '').localeCompare(String((_right$uuid = right === null || right === void 0 ? void 0 : right.uuid) !== null && _right$uuid !== void 0 ? _right$uuid : ''));
|
|
352
|
+
}) : cloneDeep(noteRecord.note_relations);
|
|
353
|
+
return {
|
|
354
|
+
uuid: noteRecord.uuid,
|
|
355
|
+
note_type: noteRecord.note_type,
|
|
356
|
+
content: {
|
|
357
|
+
text: cloneDeep((_noteRecord$content = noteRecord.content) === null || _noteRecord$content === void 0 ? void 0 : _noteRecord$content.text)
|
|
358
|
+
},
|
|
359
|
+
importance: noteRecord.importance,
|
|
360
|
+
note_relations: relations
|
|
361
|
+
};
|
|
362
|
+
}).sort(function (left, right) {
|
|
363
|
+
var _left$uuid2, _right$uuid2;
|
|
364
|
+
return String((_left$uuid2 = left === null || left === void 0 ? void 0 : left.uuid) !== null && _left$uuid2 !== void 0 ? _left$uuid2 : '').localeCompare(String((_right$uuid2 = right === null || right === void 0 ? void 0 : right.uuid) !== null && _right$uuid2 !== void 0 ? _right$uuid2 : ''));
|
|
365
|
+
});
|
|
366
|
+
}
|
|
367
|
+
function areBaseSalesNotesEquivalent(currentValue, loadedValue, options) {
|
|
368
|
+
var currentNotes = normalizeBaseSalesNotesForComparison(currentValue, {
|
|
369
|
+
unresolvedOrderTargetUuid: options === null || options === void 0 ? void 0 : options.currentOrderTargetUuid
|
|
370
|
+
});
|
|
371
|
+
var loadedNotes = normalizeBaseSalesNotesForComparison(loadedValue);
|
|
372
|
+
return currentNotes !== null && loadedNotes !== null && isEqual(currentNotes, loadedNotes);
|
|
373
|
+
}
|
|
323
374
|
function mergeSalesDetailRecordWithTempOrder(currentTempOrder, loadedRecord, strategy) {
|
|
375
|
+
var _currentTempOrder$_ex, _normalizedLoadedReco;
|
|
376
|
+
var loadedHasSalesNotes = Object.prototype.hasOwnProperty.call(loadedRecord || {}, 'notes');
|
|
377
|
+
var hasDirtyLocalSalesNotes = (currentTempOrder === null || currentTempOrder === void 0 || (_currentTempOrder$_ex = currentTempOrder._extend) === null || _currentTempOrder$_ex === void 0 || (_currentTempOrder$_ex = _currentTempOrder$_ex.salesNotesState) === null || _currentTempOrder$_ex === void 0 ? void 0 : _currentTempOrder$_ex.dirty) === true;
|
|
378
|
+
var incomingSalesNotesMatchLocal = loadedHasSalesNotes && areBaseSalesNotesEquivalent(currentTempOrder === null || currentTempOrder === void 0 ? void 0 : currentTempOrder.notes, loadedRecord.notes, {
|
|
379
|
+
currentOrderTargetUuid: (loadedRecord === null || loadedRecord === void 0 ? void 0 : loadedRecord.shop_order_number) || (currentTempOrder === null || currentTempOrder === void 0 ? void 0 : currentTempOrder.shop_order_number)
|
|
380
|
+
});
|
|
381
|
+
var shouldAwaitAuthoritativeSalesNotes = strategy === 'authoritative-incoming' && hasDirtyLocalSalesNotes && (Number(loadedRecord === null || loadedRecord === void 0 ? void 0 : loadedRecord.need_sync) === 1 || !incomingSalesNotesMatchLocal);
|
|
382
|
+
var preserveDirtyLocalSalesNotes = hasDirtyLocalSalesNotes && (strategy === 'preserve-local' || shouldAwaitAuthoritativeSalesNotes);
|
|
324
383
|
var normalizedLoadedRecord = normalizeBaseSalesRecordCollections(loadedRecord || {}, {
|
|
325
384
|
ensureUid: false
|
|
326
385
|
});
|
|
@@ -332,6 +391,12 @@ function mergeSalesDetailRecordWithTempOrder(currentTempOrder, loadedRecord, str
|
|
|
332
391
|
});
|
|
333
392
|
var uidRemaps = [];
|
|
334
393
|
var mergedRecord = mergeWith(normalizedCurrentTempOrder, normalizedLoadedRecord, function (currentValue, loadedValue, key) {
|
|
394
|
+
if (key === 'notes') {
|
|
395
|
+
if (preserveDirtyLocalSalesNotes && Array.isArray(currentValue)) {
|
|
396
|
+
return cloneDeep(currentValue);
|
|
397
|
+
}
|
|
398
|
+
if (Array.isArray(loadedValue)) return cloneDeep(loadedValue);
|
|
399
|
+
}
|
|
335
400
|
var collectionKind = getBaseSalesOrderCollectionKind(key);
|
|
336
401
|
if (collectionKind && Array.isArray(loadedValue)) {
|
|
337
402
|
return mergeBaseSalesOrderCollection(collectionKind, Array.isArray(currentValue) ? currentValue : [], loadedValue, strategy, uidRemaps);
|
|
@@ -355,7 +420,23 @@ function mergeSalesDetailRecordWithTempOrder(currentTempOrder, loadedRecord, str
|
|
|
355
420
|
return undefined;
|
|
356
421
|
});
|
|
357
422
|
delete mergedRecord.request_unique_idempotency_token;
|
|
358
|
-
|
|
423
|
+
var normalizedMergedRecord = normalizeBaseSalesRecordCollections(applyOrderCollectionUidRemaps(mergedRecord, uidRemaps));
|
|
424
|
+
normalizedMergedRecord._extend = _objectSpread(_objectSpread({}, normalizedMergedRecord._extend || {}), {}, {
|
|
425
|
+
salesNotesState: preserveDirtyLocalSalesNotes ? {
|
|
426
|
+
loaded: true,
|
|
427
|
+
dirty: true
|
|
428
|
+
} : loadedHasSalesNotes ? {
|
|
429
|
+
loaded: true,
|
|
430
|
+
dirty: ((_normalizedLoadedReco = normalizedLoadedRecord._extend) === null || _normalizedLoadedReco === void 0 || (_normalizedLoadedReco = _normalizedLoadedReco.salesNotesState) === null || _normalizedLoadedReco === void 0 ? void 0 : _normalizedLoadedReco.dirty) === true
|
|
431
|
+
} : {
|
|
432
|
+
loaded: false,
|
|
433
|
+
dirty: false
|
|
434
|
+
}
|
|
435
|
+
});
|
|
436
|
+
if (!loadedHasSalesNotes && !preserveDirtyLocalSalesNotes) {
|
|
437
|
+
delete normalizedMergedRecord.notes;
|
|
438
|
+
}
|
|
439
|
+
return normalizedMergedRecord;
|
|
359
440
|
}
|
|
360
441
|
function filterPendingPaymentsFromLoadedSalesDetail(sourceRecord) {
|
|
361
442
|
if (!sourceRecord || _typeof(sourceRecord) !== 'object') return sourceRecord;
|
|
@@ -2089,6 +2170,101 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2089
2170
|
if (!this.store.order) return '';
|
|
2090
2171
|
return this.store.order.getTempOrderNote();
|
|
2091
2172
|
}
|
|
2173
|
+
}, {
|
|
2174
|
+
key: "getSalesNotes",
|
|
2175
|
+
value: function getSalesNotes() {
|
|
2176
|
+
if (!this.store.order) return [];
|
|
2177
|
+
return this.store.order.getSalesNotes();
|
|
2178
|
+
}
|
|
2179
|
+
}, {
|
|
2180
|
+
key: "createSalesNotesMutationSnapshot",
|
|
2181
|
+
value: function createSalesNotesMutationSnapshot() {
|
|
2182
|
+
if (!this.store.order) throw new Error('order 模块未初始化');
|
|
2183
|
+
return this.store.order.createSalesNotesMutationSnapshot();
|
|
2184
|
+
}
|
|
2185
|
+
}, {
|
|
2186
|
+
key: "restoreSalesNotesMutationSnapshot",
|
|
2187
|
+
value: function restoreSalesNotesMutationSnapshot(snapshot) {
|
|
2188
|
+
if (!this.store.order) throw new Error('order 模块未初始化');
|
|
2189
|
+
this.store.order.restoreSalesNotesMutationSnapshot(snapshot);
|
|
2190
|
+
}
|
|
2191
|
+
}, {
|
|
2192
|
+
key: "setSalesNote",
|
|
2193
|
+
value: function () {
|
|
2194
|
+
var _setSalesNote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(input) {
|
|
2195
|
+
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
|
2196
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
2197
|
+
case 0:
|
|
2198
|
+
if (this.store.order) {
|
|
2199
|
+
_context16.next = 2;
|
|
2200
|
+
break;
|
|
2201
|
+
}
|
|
2202
|
+
throw new Error('order 模块未初始化');
|
|
2203
|
+
case 2:
|
|
2204
|
+
return _context16.abrupt("return", this.store.order.setSalesNote(input));
|
|
2205
|
+
case 3:
|
|
2206
|
+
case "end":
|
|
2207
|
+
return _context16.stop();
|
|
2208
|
+
}
|
|
2209
|
+
}, _callee16, this);
|
|
2210
|
+
}));
|
|
2211
|
+
function setSalesNote(_x15) {
|
|
2212
|
+
return _setSalesNote.apply(this, arguments);
|
|
2213
|
+
}
|
|
2214
|
+
return setSalesNote;
|
|
2215
|
+
}()
|
|
2216
|
+
}, {
|
|
2217
|
+
key: "removeSalesNote",
|
|
2218
|
+
value: function () {
|
|
2219
|
+
var _removeSalesNote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(uuid) {
|
|
2220
|
+
return _regeneratorRuntime().wrap(function _callee17$(_context17) {
|
|
2221
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
2222
|
+
case 0:
|
|
2223
|
+
if (this.store.order) {
|
|
2224
|
+
_context17.next = 2;
|
|
2225
|
+
break;
|
|
2226
|
+
}
|
|
2227
|
+
throw new Error('order 模块未初始化');
|
|
2228
|
+
case 2:
|
|
2229
|
+
_context17.next = 4;
|
|
2230
|
+
return this.store.order.removeSalesNote(uuid);
|
|
2231
|
+
case 4:
|
|
2232
|
+
case "end":
|
|
2233
|
+
return _context17.stop();
|
|
2234
|
+
}
|
|
2235
|
+
}, _callee17, this);
|
|
2236
|
+
}));
|
|
2237
|
+
function removeSalesNote(_x16) {
|
|
2238
|
+
return _removeSalesNote.apply(this, arguments);
|
|
2239
|
+
}
|
|
2240
|
+
return removeSalesNote;
|
|
2241
|
+
}()
|
|
2242
|
+
}, {
|
|
2243
|
+
key: "clearSalesNotes",
|
|
2244
|
+
value: function () {
|
|
2245
|
+
var _clearSalesNotes = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18() {
|
|
2246
|
+
return _regeneratorRuntime().wrap(function _callee18$(_context18) {
|
|
2247
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
2248
|
+
case 0:
|
|
2249
|
+
if (this.store.order) {
|
|
2250
|
+
_context18.next = 2;
|
|
2251
|
+
break;
|
|
2252
|
+
}
|
|
2253
|
+
throw new Error('order 模块未初始化');
|
|
2254
|
+
case 2:
|
|
2255
|
+
_context18.next = 4;
|
|
2256
|
+
return this.store.order.clearSalesNotes();
|
|
2257
|
+
case 4:
|
|
2258
|
+
case "end":
|
|
2259
|
+
return _context18.stop();
|
|
2260
|
+
}
|
|
2261
|
+
}, _callee18, this);
|
|
2262
|
+
}));
|
|
2263
|
+
function clearSalesNotes() {
|
|
2264
|
+
return _clearSalesNotes.apply(this, arguments);
|
|
2265
|
+
}
|
|
2266
|
+
return clearSalesNotes;
|
|
2267
|
+
}()
|
|
2092
2268
|
}, {
|
|
2093
2269
|
key: "updateTempOrderNote",
|
|
2094
2270
|
value: function updateTempOrderNote(note) {
|
|
@@ -2119,6 +2295,18 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2119
2295
|
if (!this.store.order) throw new Error('order 模块未初始化');
|
|
2120
2296
|
return this.store.order.updateTempOrderDepositAmount(amount);
|
|
2121
2297
|
}
|
|
2298
|
+
}, {
|
|
2299
|
+
key: "setPickupReferenceMode",
|
|
2300
|
+
value: function setPickupReferenceMode(mode) {
|
|
2301
|
+
if (!this.store.order) throw new Error('order 模块未初始化');
|
|
2302
|
+
return this.store.order.updateTempOrderPickupReferenceMode(mode);
|
|
2303
|
+
}
|
|
2304
|
+
}, {
|
|
2305
|
+
key: "setServiceType",
|
|
2306
|
+
value: function setServiceType(serviceType) {
|
|
2307
|
+
if (!this.store.order) throw new Error('order 模块未初始化');
|
|
2308
|
+
return this.store.order.updateTempOrderServiceType(serviceType);
|
|
2309
|
+
}
|
|
2122
2310
|
}, {
|
|
2123
2311
|
key: "updateTempOrderContactsInfo",
|
|
2124
2312
|
value: function updateTempOrderContactsInfo(contactsInfo) {
|
|
@@ -2152,40 +2340,40 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2152
2340
|
}, {
|
|
2153
2341
|
key: "addNewOrder",
|
|
2154
2342
|
value: function () {
|
|
2155
|
-
var _addNewOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2343
|
+
var _addNewOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19() {
|
|
2156
2344
|
var tempOrder;
|
|
2157
|
-
return _regeneratorRuntime().wrap(function
|
|
2158
|
-
while (1) switch (
|
|
2345
|
+
return _regeneratorRuntime().wrap(function _callee19$(_context19) {
|
|
2346
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
2159
2347
|
case 0:
|
|
2160
|
-
|
|
2348
|
+
_context19.prev = 0;
|
|
2161
2349
|
if (this.store.order) {
|
|
2162
|
-
|
|
2350
|
+
_context19.next = 3;
|
|
2163
2351
|
break;
|
|
2164
2352
|
}
|
|
2165
2353
|
throw new Error('order 模块未初始化');
|
|
2166
2354
|
case 3:
|
|
2167
|
-
|
|
2355
|
+
_context19.next = 5;
|
|
2168
2356
|
return this.store.order.addNewOrder();
|
|
2169
2357
|
case 5:
|
|
2170
|
-
tempOrder =
|
|
2358
|
+
tempOrder = _context19.sent;
|
|
2171
2359
|
if (!(this.syncAppDataToTempOrder(tempOrder) && this.isTempOrderPersistEnabled())) {
|
|
2172
|
-
|
|
2360
|
+
_context19.next = 10;
|
|
2173
2361
|
break;
|
|
2174
2362
|
}
|
|
2175
2363
|
this.store.order.persistTempOrder();
|
|
2176
|
-
|
|
2364
|
+
_context19.next = 10;
|
|
2177
2365
|
return this.store.order.saveDraft();
|
|
2178
2366
|
case 10:
|
|
2179
|
-
return
|
|
2367
|
+
return _context19.abrupt("return", tempOrder);
|
|
2180
2368
|
case 13:
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
throw
|
|
2369
|
+
_context19.prev = 13;
|
|
2370
|
+
_context19.t0 = _context19["catch"](0);
|
|
2371
|
+
throw _context19.t0;
|
|
2184
2372
|
case 16:
|
|
2185
2373
|
case "end":
|
|
2186
|
-
return
|
|
2374
|
+
return _context19.stop();
|
|
2187
2375
|
}
|
|
2188
|
-
},
|
|
2376
|
+
}, _callee19, this, [[0, 13]]);
|
|
2189
2377
|
}));
|
|
2190
2378
|
function addNewOrder() {
|
|
2191
2379
|
return _addNewOrder.apply(this, arguments);
|
|
@@ -2195,22 +2383,22 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2195
2383
|
}, {
|
|
2196
2384
|
key: "saveDraft",
|
|
2197
2385
|
value: function () {
|
|
2198
|
-
var _saveDraft = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2199
|
-
return _regeneratorRuntime().wrap(function
|
|
2200
|
-
while (1) switch (
|
|
2386
|
+
var _saveDraft = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20() {
|
|
2387
|
+
return _regeneratorRuntime().wrap(function _callee20$(_context20) {
|
|
2388
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
2201
2389
|
case 0:
|
|
2202
2390
|
if (this.store.order) {
|
|
2203
|
-
|
|
2391
|
+
_context20.next = 2;
|
|
2204
2392
|
break;
|
|
2205
2393
|
}
|
|
2206
2394
|
throw new Error('order 模块未初始化');
|
|
2207
2395
|
case 2:
|
|
2208
|
-
return
|
|
2396
|
+
return _context20.abrupt("return", this.store.order.saveDraft());
|
|
2209
2397
|
case 3:
|
|
2210
2398
|
case "end":
|
|
2211
|
-
return
|
|
2399
|
+
return _context20.stop();
|
|
2212
2400
|
}
|
|
2213
|
-
},
|
|
2401
|
+
}, _callee20, this);
|
|
2214
2402
|
}));
|
|
2215
2403
|
function saveDraft() {
|
|
2216
2404
|
return _saveDraft.apply(this, arguments);
|
|
@@ -2221,14 +2409,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2221
2409
|
}, {
|
|
2222
2410
|
key: "restoreOrder",
|
|
2223
2411
|
value: function () {
|
|
2224
|
-
var _restoreOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2412
|
+
var _restoreOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21() {
|
|
2225
2413
|
var _this$store$payment, tempOrder, wallet;
|
|
2226
|
-
return _regeneratorRuntime().wrap(function
|
|
2227
|
-
while (1) switch (
|
|
2414
|
+
return _regeneratorRuntime().wrap(function _callee21$(_context21) {
|
|
2415
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
2228
2416
|
case 0:
|
|
2229
|
-
|
|
2417
|
+
_context21.prev = 0;
|
|
2230
2418
|
if (this.store.order) {
|
|
2231
|
-
|
|
2419
|
+
_context21.next = 3;
|
|
2232
2420
|
break;
|
|
2233
2421
|
}
|
|
2234
2422
|
throw new Error('scanOrder 解决方案需要 order 模块支持');
|
|
@@ -2240,37 +2428,37 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2240
2428
|
this.hasManualDiscountSelection = false;
|
|
2241
2429
|
wallet = (_this$store$payment = this.store.payment) === null || _this$store$payment === void 0 ? void 0 : _this$store$payment.wallet;
|
|
2242
2430
|
if (!wallet) {
|
|
2243
|
-
|
|
2431
|
+
_context21.next = 13;
|
|
2244
2432
|
break;
|
|
2245
2433
|
}
|
|
2246
2434
|
this.walletAssetsRefreshSequence += 1;
|
|
2247
2435
|
wallet.clearAllCache();
|
|
2248
|
-
|
|
2436
|
+
_context21.next = 13;
|
|
2249
2437
|
return this.publishWalletAssetsState(wallet.getWalletAssetsState());
|
|
2250
2438
|
case 13:
|
|
2251
|
-
|
|
2439
|
+
_context21.next = 15;
|
|
2252
2440
|
return this.effectsEmit('onTempOrderReplaced', {
|
|
2253
2441
|
tempOrder: tempOrder
|
|
2254
2442
|
});
|
|
2255
2443
|
case 15:
|
|
2256
2444
|
if (!(this.syncAppDataToTempOrder(tempOrder) && this.isTempOrderPersistEnabled())) {
|
|
2257
|
-
|
|
2445
|
+
_context21.next = 19;
|
|
2258
2446
|
break;
|
|
2259
2447
|
}
|
|
2260
2448
|
this.store.order.persistTempOrder();
|
|
2261
|
-
|
|
2449
|
+
_context21.next = 19;
|
|
2262
2450
|
return this.store.order.saveDraft();
|
|
2263
2451
|
case 19:
|
|
2264
|
-
return
|
|
2452
|
+
return _context21.abrupt("return", tempOrder);
|
|
2265
2453
|
case 22:
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
throw
|
|
2454
|
+
_context21.prev = 22;
|
|
2455
|
+
_context21.t0 = _context21["catch"](0);
|
|
2456
|
+
throw _context21.t0;
|
|
2269
2457
|
case 25:
|
|
2270
2458
|
case "end":
|
|
2271
|
-
return
|
|
2459
|
+
return _context21.stop();
|
|
2272
2460
|
}
|
|
2273
|
-
},
|
|
2461
|
+
}, _callee21, this, [[0, 22]]);
|
|
2274
2462
|
}));
|
|
2275
2463
|
function restoreOrder() {
|
|
2276
2464
|
return _restoreOrder.apply(this, arguments);
|
|
@@ -2284,22 +2472,22 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2284
2472
|
}, {
|
|
2285
2473
|
key: "clearOrderCartLines",
|
|
2286
2474
|
value: (function () {
|
|
2287
|
-
var _clearOrderCartLines = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2475
|
+
var _clearOrderCartLines = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22() {
|
|
2288
2476
|
var tempOrder;
|
|
2289
|
-
return _regeneratorRuntime().wrap(function
|
|
2290
|
-
while (1) switch (
|
|
2477
|
+
return _regeneratorRuntime().wrap(function _callee22$(_context22) {
|
|
2478
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
2291
2479
|
case 0:
|
|
2292
|
-
|
|
2480
|
+
_context22.prev = 0;
|
|
2293
2481
|
if (this.store.order) {
|
|
2294
|
-
|
|
2482
|
+
_context22.next = 3;
|
|
2295
2483
|
break;
|
|
2296
2484
|
}
|
|
2297
2485
|
throw new Error('order 模块未初始化');
|
|
2298
2486
|
case 3:
|
|
2299
|
-
|
|
2487
|
+
_context22.next = 5;
|
|
2300
2488
|
return this.store.order.clearOrderCartLines();
|
|
2301
2489
|
case 5:
|
|
2302
|
-
tempOrder =
|
|
2490
|
+
tempOrder = _context22.sent;
|
|
2303
2491
|
if (this.currentSalesDetail) {
|
|
2304
2492
|
this.currentSalesDetail = _objectSpread(_objectSpread({}, this.currentSalesDetail), {}, {
|
|
2305
2493
|
products: [],
|
|
@@ -2309,29 +2497,29 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2309
2497
|
discount_list: []
|
|
2310
2498
|
});
|
|
2311
2499
|
}
|
|
2312
|
-
|
|
2500
|
+
_context22.next = 9;
|
|
2313
2501
|
return this.effectsEmit('onTempOrderReplaced', {
|
|
2314
2502
|
tempOrder: tempOrder
|
|
2315
2503
|
});
|
|
2316
2504
|
case 9:
|
|
2317
2505
|
if (!(this.syncAppDataToTempOrder(tempOrder) && this.isTempOrderPersistEnabled())) {
|
|
2318
|
-
|
|
2506
|
+
_context22.next = 13;
|
|
2319
2507
|
break;
|
|
2320
2508
|
}
|
|
2321
2509
|
this.store.order.persistTempOrder();
|
|
2322
|
-
|
|
2510
|
+
_context22.next = 13;
|
|
2323
2511
|
return this.store.order.saveDraft();
|
|
2324
2512
|
case 13:
|
|
2325
|
-
return
|
|
2513
|
+
return _context22.abrupt("return", tempOrder);
|
|
2326
2514
|
case 16:
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
throw
|
|
2515
|
+
_context22.prev = 16;
|
|
2516
|
+
_context22.t0 = _context22["catch"](0);
|
|
2517
|
+
throw _context22.t0;
|
|
2330
2518
|
case 19:
|
|
2331
2519
|
case "end":
|
|
2332
|
-
return
|
|
2520
|
+
return _context22.stop();
|
|
2333
2521
|
}
|
|
2334
|
-
},
|
|
2522
|
+
}, _callee22, this, [[0, 16]]);
|
|
2335
2523
|
}));
|
|
2336
2524
|
function clearOrderCartLines() {
|
|
2337
2525
|
return _clearOrderCartLines.apply(this, arguments);
|
|
@@ -2348,32 +2536,32 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2348
2536
|
}, {
|
|
2349
2537
|
key: "getSummary",
|
|
2350
2538
|
value: function () {
|
|
2351
|
-
var _getSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2539
|
+
var _getSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23() {
|
|
2352
2540
|
var summary;
|
|
2353
|
-
return _regeneratorRuntime().wrap(function
|
|
2354
|
-
while (1) switch (
|
|
2541
|
+
return _regeneratorRuntime().wrap(function _callee23$(_context23) {
|
|
2542
|
+
while (1) switch (_context23.prev = _context23.next) {
|
|
2355
2543
|
case 0:
|
|
2356
|
-
|
|
2544
|
+
_context23.prev = 0;
|
|
2357
2545
|
if (this.store.order) {
|
|
2358
|
-
|
|
2546
|
+
_context23.next = 3;
|
|
2359
2547
|
break;
|
|
2360
2548
|
}
|
|
2361
2549
|
throw new Error('order 模块未初始化');
|
|
2362
2550
|
case 3:
|
|
2363
|
-
|
|
2551
|
+
_context23.next = 5;
|
|
2364
2552
|
return this.store.order.getOrderSummary();
|
|
2365
2553
|
case 5:
|
|
2366
|
-
summary =
|
|
2367
|
-
return
|
|
2554
|
+
summary = _context23.sent;
|
|
2555
|
+
return _context23.abrupt("return", summary);
|
|
2368
2556
|
case 9:
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
throw
|
|
2557
|
+
_context23.prev = 9;
|
|
2558
|
+
_context23.t0 = _context23["catch"](0);
|
|
2559
|
+
throw _context23.t0;
|
|
2372
2560
|
case 12:
|
|
2373
2561
|
case "end":
|
|
2374
|
-
return
|
|
2562
|
+
return _context23.stop();
|
|
2375
2563
|
}
|
|
2376
|
-
},
|
|
2564
|
+
}, _callee23, this, [[0, 9]]);
|
|
2377
2565
|
}));
|
|
2378
2566
|
function getSummary() {
|
|
2379
2567
|
return _getSummary.apply(this, arguments);
|
|
@@ -2501,14 +2689,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2501
2689
|
}, {
|
|
2502
2690
|
key: "loadDiscountConfig",
|
|
2503
2691
|
value: function () {
|
|
2504
|
-
var _loadDiscountConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2692
|
+
var _loadDiscountConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(params) {
|
|
2505
2693
|
var _this$getOrderIdentit, _tempOrder$customer, _tempOrder$_extend, _tempOrder$_extend2, _discountModule$getDi, _discountModule$getOr, _discountModule$getDi2;
|
|
2506
2694
|
var tempOrder, orderStore, discountModule, rulesModule, orderId, customerId, currentDiscountList, originalDiscountList, hasManualDiscountSelection, discountAction, discountConfigCacheKey, preparedDiscountList, _discountModule$setOr, nextDiscountList, shouldSkipAutoApplyFetchedDiscounts, _summary, _orderStore$summary, orderTotalAmount, result, _iterator3, _step3, _product$metadata5, _tempOrder$_extend3, _product$metadata$sou, _product$metadata6, _product$metadata7, _product$original_pri, product, productUid, runtimeOrigin, totalPerUnitDiscount, optionSum, sourcePrice, newSourceSellingPrice, newMainSellingPrice, summary;
|
|
2507
|
-
return _regeneratorRuntime().wrap(function
|
|
2508
|
-
while (1) switch (
|
|
2695
|
+
return _regeneratorRuntime().wrap(function _callee24$(_context24) {
|
|
2696
|
+
while (1) switch (_context24.prev = _context24.next) {
|
|
2509
2697
|
case 0:
|
|
2510
2698
|
if (this.store.order) {
|
|
2511
|
-
|
|
2699
|
+
_context24.next = 2;
|
|
2512
2700
|
break;
|
|
2513
2701
|
}
|
|
2514
2702
|
throw new Error('order 模块未初始化');
|
|
@@ -2528,18 +2716,18 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2528
2716
|
discountConfigCacheKey = [customerId, discountAction, Number(orderId) || 0].join(':');
|
|
2529
2717
|
preparedDiscountList = [];
|
|
2530
2718
|
if (!(customerId && customerId !== 1)) {
|
|
2531
|
-
|
|
2719
|
+
_context24.next = 25;
|
|
2532
2720
|
break;
|
|
2533
2721
|
}
|
|
2534
2722
|
if (!(this.discountConfigCacheKey === discountConfigCacheKey)) {
|
|
2535
|
-
|
|
2723
|
+
_context24.next = 19;
|
|
2536
2724
|
break;
|
|
2537
2725
|
}
|
|
2538
2726
|
preparedDiscountList = originalDiscountList;
|
|
2539
|
-
|
|
2727
|
+
_context24.next = 25;
|
|
2540
2728
|
break;
|
|
2541
2729
|
case 19:
|
|
2542
|
-
|
|
2730
|
+
_context24.next = 21;
|
|
2543
2731
|
return this.store.order.loadDiscountConfig({
|
|
2544
2732
|
customerId: customerId,
|
|
2545
2733
|
action: discountAction,
|
|
@@ -2547,16 +2735,16 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2547
2735
|
apply: false
|
|
2548
2736
|
});
|
|
2549
2737
|
case 21:
|
|
2550
|
-
preparedDiscountList =
|
|
2738
|
+
preparedDiscountList = _context24.sent;
|
|
2551
2739
|
this.discountConfigCacheKey = discountConfigCacheKey;
|
|
2552
|
-
|
|
2740
|
+
_context24.next = 25;
|
|
2553
2741
|
return discountModule === null || discountModule === void 0 || (_discountModule$setOr = discountModule.setOriginalDiscountList) === null || _discountModule$setOr === void 0 ? void 0 : _discountModule$setOr.call(discountModule, preparedDiscountList);
|
|
2554
2742
|
case 25:
|
|
2555
2743
|
if (!(hasManualDiscountSelection && currentDiscountList.length)) {
|
|
2556
|
-
|
|
2744
|
+
_context24.next = 27;
|
|
2557
2745
|
break;
|
|
2558
2746
|
}
|
|
2559
|
-
return
|
|
2747
|
+
return _context24.abrupt("return", {
|
|
2560
2748
|
productList: tempOrder.products || [],
|
|
2561
2749
|
discountList: currentDiscountList,
|
|
2562
2750
|
availableWalletIds: this.getAvailableWalletIds()
|
|
@@ -2564,7 +2752,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2564
2752
|
case 27:
|
|
2565
2753
|
nextDiscountList = this.mergeHistoricalDiscountList(preparedDiscountList || (discountModule === null || discountModule === void 0 || (_discountModule$getDi2 = discountModule.getDiscountList) === null || _discountModule$getDi2 === void 0 ? void 0 : _discountModule$getDi2.call(discountModule)) || [], tempOrder.products || []);
|
|
2566
2754
|
nextDiscountList = this.mergeCurrentDiscountSelectionState(nextDiscountList, currentDiscountList);
|
|
2567
|
-
|
|
2755
|
+
_context24.next = 31;
|
|
2568
2756
|
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
|
|
2569
2757
|
case 31:
|
|
2570
2758
|
shouldSkipAutoApplyFetchedDiscounts = this.shouldSkipAutoApplyFetchedDiscountsInEditMode({
|
|
@@ -2574,17 +2762,17 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2574
2762
|
nextDiscountList: nextDiscountList
|
|
2575
2763
|
});
|
|
2576
2764
|
if (!shouldSkipAutoApplyFetchedDiscounts) {
|
|
2577
|
-
|
|
2765
|
+
_context24.next = 40;
|
|
2578
2766
|
break;
|
|
2579
2767
|
}
|
|
2580
|
-
|
|
2768
|
+
_context24.next = 35;
|
|
2581
2769
|
return this.store.order.recalculateSummary({
|
|
2582
2770
|
createIfMissing: true
|
|
2583
2771
|
});
|
|
2584
2772
|
case 35:
|
|
2585
|
-
_summary =
|
|
2773
|
+
_summary = _context24.sent;
|
|
2586
2774
|
this.store.order.persistTempOrder();
|
|
2587
|
-
|
|
2775
|
+
_context24.next = 39;
|
|
2588
2776
|
return this.effectsEmit('onDiscountApplied', {
|
|
2589
2777
|
productList: tempOrder.products || [],
|
|
2590
2778
|
discountList: nextDiscountList,
|
|
@@ -2592,14 +2780,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2592
2780
|
tempOrder: tempOrder
|
|
2593
2781
|
});
|
|
2594
2782
|
case 39:
|
|
2595
|
-
return
|
|
2783
|
+
return _context24.abrupt("return", {
|
|
2596
2784
|
productList: tempOrder.products || [],
|
|
2597
2785
|
discountList: nextDiscountList,
|
|
2598
2786
|
availableWalletIds: this.getAvailableWalletIds()
|
|
2599
2787
|
});
|
|
2600
2788
|
case 40:
|
|
2601
2789
|
if (!rulesModule) {
|
|
2602
|
-
|
|
2790
|
+
_context24.next = 76;
|
|
2603
2791
|
break;
|
|
2604
2792
|
}
|
|
2605
2793
|
orderTotalAmount = Number(((_orderStore$summary = orderStore.summary) === null || _orderStore$summary === void 0 ? void 0 : _orderStore$summary.total_amount) || 0);
|
|
@@ -2619,21 +2807,21 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2619
2807
|
tempOrder.products = preserveManualProductDiscountProducts(tempOrder.products, result.productList);
|
|
2620
2808
|
}
|
|
2621
2809
|
_iterator3 = _createForOfIteratorHelper(tempOrder.products || []);
|
|
2622
|
-
|
|
2810
|
+
_context24.prev = 45;
|
|
2623
2811
|
_iterator3.s();
|
|
2624
2812
|
case 47:
|
|
2625
2813
|
if ((_step3 = _iterator3.n()).done) {
|
|
2626
|
-
|
|
2814
|
+
_context24.next = 62;
|
|
2627
2815
|
break;
|
|
2628
2816
|
}
|
|
2629
2817
|
product = _step3.value;
|
|
2630
2818
|
productUid = (_product$metadata5 = product.metadata) === null || _product$metadata5 === void 0 ? void 0 : _product$metadata5.unique_identification_number;
|
|
2631
2819
|
runtimeOrigin = productUid ? (_tempOrder$_extend3 = tempOrder._extend) === null || _tempOrder$_extend3 === void 0 || (_tempOrder$_extend3 = _tempOrder$_extend3.productsByUid) === null || _tempOrder$_extend3 === void 0 || (_tempOrder$_extend3 = _tempOrder$_extend3[productUid]) === null || _tempOrder$_extend3 === void 0 ? void 0 : _tempOrder$_extend3.origin : undefined;
|
|
2632
2820
|
if (!(runtimeOrigin !== null && runtimeOrigin !== void 0 && runtimeOrigin.isManualDiscount || isBaseSalesManualProductDiscountProduct(product))) {
|
|
2633
|
-
|
|
2821
|
+
_context24.next = 53;
|
|
2634
2822
|
break;
|
|
2635
2823
|
}
|
|
2636
|
-
return
|
|
2824
|
+
return _context24.abrupt("continue", 60);
|
|
2637
2825
|
case 53:
|
|
2638
2826
|
totalPerUnitDiscount = (product.discount_list || []).reduce(function (sum, pd) {
|
|
2639
2827
|
return sum + Number(pd.amount || 0);
|
|
@@ -2651,41 +2839,41 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2651
2839
|
bundle: product.product_bundle
|
|
2652
2840
|
});
|
|
2653
2841
|
case 60:
|
|
2654
|
-
|
|
2842
|
+
_context24.next = 47;
|
|
2655
2843
|
break;
|
|
2656
2844
|
case 62:
|
|
2657
|
-
|
|
2845
|
+
_context24.next = 67;
|
|
2658
2846
|
break;
|
|
2659
2847
|
case 64:
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
_iterator3.e(
|
|
2848
|
+
_context24.prev = 64;
|
|
2849
|
+
_context24.t0 = _context24["catch"](45);
|
|
2850
|
+
_iterator3.e(_context24.t0);
|
|
2663
2851
|
case 67:
|
|
2664
|
-
|
|
2852
|
+
_context24.prev = 67;
|
|
2665
2853
|
_iterator3.f();
|
|
2666
|
-
return
|
|
2854
|
+
return _context24.finish(67);
|
|
2667
2855
|
case 70:
|
|
2668
2856
|
if (!result.discountList) {
|
|
2669
|
-
|
|
2857
|
+
_context24.next = 76;
|
|
2670
2858
|
break;
|
|
2671
2859
|
}
|
|
2672
2860
|
nextDiscountList = this.mergeHistoricalDiscountList(result.discountList, tempOrder.products || []);
|
|
2673
2861
|
OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
|
|
2674
|
-
|
|
2862
|
+
_context24.next = 75;
|
|
2675
2863
|
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
|
|
2676
2864
|
case 75:
|
|
2677
2865
|
tempOrder.discount_list = nextDiscountList.filter(function (discount) {
|
|
2678
2866
|
return discount.isSelected;
|
|
2679
2867
|
});
|
|
2680
2868
|
case 76:
|
|
2681
|
-
|
|
2869
|
+
_context24.next = 78;
|
|
2682
2870
|
return this.store.order.recalculateSummary({
|
|
2683
2871
|
createIfMissing: true
|
|
2684
2872
|
});
|
|
2685
2873
|
case 78:
|
|
2686
|
-
summary =
|
|
2874
|
+
summary = _context24.sent;
|
|
2687
2875
|
this.store.order.persistTempOrder();
|
|
2688
|
-
|
|
2876
|
+
_context24.next = 82;
|
|
2689
2877
|
return this.effectsEmit('onDiscountApplied', {
|
|
2690
2878
|
productList: tempOrder.products || [],
|
|
2691
2879
|
discountList: nextDiscountList,
|
|
@@ -2693,18 +2881,18 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2693
2881
|
tempOrder: tempOrder
|
|
2694
2882
|
});
|
|
2695
2883
|
case 82:
|
|
2696
|
-
return
|
|
2884
|
+
return _context24.abrupt("return", {
|
|
2697
2885
|
productList: tempOrder.products || [],
|
|
2698
2886
|
discountList: nextDiscountList,
|
|
2699
2887
|
availableWalletIds: this.getAvailableWalletIds()
|
|
2700
2888
|
});
|
|
2701
2889
|
case 83:
|
|
2702
2890
|
case "end":
|
|
2703
|
-
return
|
|
2891
|
+
return _context24.stop();
|
|
2704
2892
|
}
|
|
2705
|
-
},
|
|
2893
|
+
}, _callee24, this, [[45, 64, 67, 70]]);
|
|
2706
2894
|
}));
|
|
2707
|
-
function loadDiscountConfig(
|
|
2895
|
+
function loadDiscountConfig(_x17) {
|
|
2708
2896
|
return _loadDiscountConfig.apply(this, arguments);
|
|
2709
2897
|
}
|
|
2710
2898
|
return loadDiscountConfig;
|
|
@@ -2719,14 +2907,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2719
2907
|
}, {
|
|
2720
2908
|
key: "bestDiscount",
|
|
2721
2909
|
value: function () {
|
|
2722
|
-
var _bestDiscount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2910
|
+
var _bestDiscount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(cb) {
|
|
2723
2911
|
var _discountModule$getOr2, _discountModule$getDi3;
|
|
2724
2912
|
var tempOrder, orderStore, discountModule, rulesModule, originalDiscountList, currentDiscountList, nextDiscountList, result, _orderStore$summary2, orderTotalAmount;
|
|
2725
|
-
return _regeneratorRuntime().wrap(function
|
|
2726
|
-
while (1) switch (
|
|
2913
|
+
return _regeneratorRuntime().wrap(function _callee25$(_context25) {
|
|
2914
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
2727
2915
|
case 0:
|
|
2728
2916
|
if (this.store.order) {
|
|
2729
|
-
|
|
2917
|
+
_context25.next = 2;
|
|
2730
2918
|
break;
|
|
2731
2919
|
}
|
|
2732
2920
|
throw new Error('order 模块未初始化');
|
|
@@ -2742,11 +2930,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2742
2930
|
productList: tempOrder.products || [],
|
|
2743
2931
|
discountList: nextDiscountList
|
|
2744
2932
|
};
|
|
2745
|
-
|
|
2933
|
+
_context25.next = 12;
|
|
2746
2934
|
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
|
|
2747
2935
|
case 12:
|
|
2748
2936
|
if (!rulesModule) {
|
|
2749
|
-
|
|
2937
|
+
_context25.next = 23;
|
|
2750
2938
|
break;
|
|
2751
2939
|
}
|
|
2752
2940
|
orderTotalAmount = Number(((_orderStore$summary2 = orderStore.summary) === null || _orderStore$summary2 === void 0 ? void 0 : _orderStore$summary2.total_amount) || 0);
|
|
@@ -2763,12 +2951,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2763
2951
|
tempOrder.products = preserveManualProductDiscountProducts(tempOrder.products, result.productList);
|
|
2764
2952
|
}
|
|
2765
2953
|
if (!result.discountList) {
|
|
2766
|
-
|
|
2954
|
+
_context25.next = 23;
|
|
2767
2955
|
break;
|
|
2768
2956
|
}
|
|
2769
2957
|
nextDiscountList = this.mergeHistoricalDiscountList(result.discountList, tempOrder.products || []);
|
|
2770
2958
|
OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
|
|
2771
|
-
|
|
2959
|
+
_context25.next = 21;
|
|
2772
2960
|
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
|
|
2773
2961
|
case 21:
|
|
2774
2962
|
tempOrder.discount_list = nextDiscountList.filter(function (discount) {
|
|
@@ -2779,13 +2967,13 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2779
2967
|
discountList: nextDiscountList
|
|
2780
2968
|
};
|
|
2781
2969
|
case 23:
|
|
2782
|
-
|
|
2970
|
+
_context25.next = 25;
|
|
2783
2971
|
return this.store.order.recalculateSummary({
|
|
2784
2972
|
createIfMissing: true
|
|
2785
2973
|
});
|
|
2786
2974
|
case 25:
|
|
2787
2975
|
this.store.order.persistTempOrder();
|
|
2788
|
-
|
|
2976
|
+
_context25.next = 28;
|
|
2789
2977
|
return this.effectsEmit('onDiscountApplied', {
|
|
2790
2978
|
productList: tempOrder.products || [],
|
|
2791
2979
|
discountList: nextDiscountList,
|
|
@@ -2794,14 +2982,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2794
2982
|
});
|
|
2795
2983
|
case 28:
|
|
2796
2984
|
cb === null || cb === void 0 || cb(result);
|
|
2797
|
-
return
|
|
2985
|
+
return _context25.abrupt("return", result);
|
|
2798
2986
|
case 30:
|
|
2799
2987
|
case "end":
|
|
2800
|
-
return
|
|
2988
|
+
return _context25.stop();
|
|
2801
2989
|
}
|
|
2802
|
-
},
|
|
2990
|
+
}, _callee25, this);
|
|
2803
2991
|
}));
|
|
2804
|
-
function bestDiscount(
|
|
2992
|
+
function bestDiscount(_x18) {
|
|
2805
2993
|
return _bestDiscount.apply(this, arguments);
|
|
2806
2994
|
}
|
|
2807
2995
|
return bestDiscount;
|
|
@@ -2830,41 +3018,41 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2830
3018
|
}, {
|
|
2831
3019
|
key: "replaceDiscountStoreLists",
|
|
2832
3020
|
value: (function () {
|
|
2833
|
-
var _replaceDiscountStoreLists = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3021
|
+
var _replaceDiscountStoreLists = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(params) {
|
|
2834
3022
|
var _store2;
|
|
2835
3023
|
var discountModule;
|
|
2836
|
-
return _regeneratorRuntime().wrap(function
|
|
2837
|
-
while (1) switch (
|
|
3024
|
+
return _regeneratorRuntime().wrap(function _callee26$(_context26) {
|
|
3025
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
2838
3026
|
case 0:
|
|
2839
3027
|
if (this.store.order) {
|
|
2840
|
-
|
|
3028
|
+
_context26.next = 2;
|
|
2841
3029
|
break;
|
|
2842
3030
|
}
|
|
2843
3031
|
throw new Error('order 模块未初始化');
|
|
2844
3032
|
case 2:
|
|
2845
3033
|
discountModule = (_store2 = this.store.order.store) === null || _store2 === void 0 ? void 0 : _store2.discount;
|
|
2846
3034
|
if (discountModule) {
|
|
2847
|
-
|
|
3035
|
+
_context26.next = 5;
|
|
2848
3036
|
break;
|
|
2849
3037
|
}
|
|
2850
|
-
return
|
|
3038
|
+
return _context26.abrupt("return");
|
|
2851
3039
|
case 5:
|
|
2852
3040
|
if (!params.originalDiscountList) {
|
|
2853
|
-
|
|
3041
|
+
_context26.next = 8;
|
|
2854
3042
|
break;
|
|
2855
3043
|
}
|
|
2856
|
-
|
|
3044
|
+
_context26.next = 8;
|
|
2857
3045
|
return discountModule.setOriginalDiscountList(params.originalDiscountList);
|
|
2858
3046
|
case 8:
|
|
2859
|
-
|
|
3047
|
+
_context26.next = 10;
|
|
2860
3048
|
return discountModule.setDiscountList(params.discountList);
|
|
2861
3049
|
case 10:
|
|
2862
3050
|
case "end":
|
|
2863
|
-
return
|
|
3051
|
+
return _context26.stop();
|
|
2864
3052
|
}
|
|
2865
|
-
},
|
|
3053
|
+
}, _callee26, this);
|
|
2866
3054
|
}));
|
|
2867
|
-
function replaceDiscountStoreLists(
|
|
3055
|
+
function replaceDiscountStoreLists(_x19) {
|
|
2868
3056
|
return _replaceDiscountStoreLists.apply(this, arguments);
|
|
2869
3057
|
}
|
|
2870
3058
|
return replaceDiscountStoreLists;
|
|
@@ -2872,34 +3060,34 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2872
3060
|
}, {
|
|
2873
3061
|
key: "scanPromotionCode",
|
|
2874
3062
|
value: function () {
|
|
2875
|
-
var _scanPromotionCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3063
|
+
var _scanPromotionCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(code, customerId) {
|
|
2876
3064
|
var raw, tempOrder;
|
|
2877
|
-
return _regeneratorRuntime().wrap(function
|
|
2878
|
-
while (1) switch (
|
|
3065
|
+
return _regeneratorRuntime().wrap(function _callee27$(_context27) {
|
|
3066
|
+
while (1) switch (_context27.prev = _context27.next) {
|
|
2879
3067
|
case 0:
|
|
2880
|
-
|
|
3068
|
+
_context27.prev = 0;
|
|
2881
3069
|
if (this.store.order) {
|
|
2882
|
-
|
|
3070
|
+
_context27.next = 3;
|
|
2883
3071
|
break;
|
|
2884
3072
|
}
|
|
2885
3073
|
throw new Error('order 模块未初始化');
|
|
2886
3074
|
case 3:
|
|
2887
|
-
|
|
3075
|
+
_context27.next = 5;
|
|
2888
3076
|
return this.store.order.scanCode(code, customerId);
|
|
2889
3077
|
case 5:
|
|
2890
|
-
raw =
|
|
3078
|
+
raw = _context27.sent;
|
|
2891
3079
|
if (!raw.isAvailable) {
|
|
2892
|
-
|
|
3080
|
+
_context27.next = 13;
|
|
2893
3081
|
break;
|
|
2894
3082
|
}
|
|
2895
|
-
|
|
3083
|
+
_context27.next = 9;
|
|
2896
3084
|
return this.store.order.recalculateSummary({
|
|
2897
3085
|
createIfMissing: true
|
|
2898
3086
|
});
|
|
2899
3087
|
case 9:
|
|
2900
3088
|
this.store.order.persistTempOrder();
|
|
2901
3089
|
tempOrder = this.store.order.ensureTempOrder();
|
|
2902
|
-
|
|
3090
|
+
_context27.next = 13;
|
|
2903
3091
|
return this.effectsEmit('onDiscountApplied', {
|
|
2904
3092
|
productList: tempOrder.products || [],
|
|
2905
3093
|
discountList: this.store.order.getDiscountList(),
|
|
@@ -2907,7 +3095,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2907
3095
|
tempOrder: tempOrder
|
|
2908
3096
|
});
|
|
2909
3097
|
case 13:
|
|
2910
|
-
return
|
|
3098
|
+
return _context27.abrupt("return", _objectSpread(_objectSpread({
|
|
2911
3099
|
isAvailable: raw.isAvailable
|
|
2912
3100
|
}, raw.isAccepted !== undefined ? {
|
|
2913
3101
|
isAccepted: raw.isAccepted
|
|
@@ -2917,16 +3105,16 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2917
3105
|
scannedDiscountList: raw.scannedDiscountList
|
|
2918
3106
|
}));
|
|
2919
3107
|
case 16:
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
throw
|
|
3108
|
+
_context27.prev = 16;
|
|
3109
|
+
_context27.t0 = _context27["catch"](0);
|
|
3110
|
+
throw _context27.t0;
|
|
2923
3111
|
case 19:
|
|
2924
3112
|
case "end":
|
|
2925
|
-
return
|
|
3113
|
+
return _context27.stop();
|
|
2926
3114
|
}
|
|
2927
|
-
},
|
|
3115
|
+
}, _callee27, this, [[0, 16]]);
|
|
2928
3116
|
}));
|
|
2929
|
-
function scanPromotionCode(
|
|
3117
|
+
function scanPromotionCode(_x20, _x21) {
|
|
2930
3118
|
return _scanPromotionCode.apply(this, arguments);
|
|
2931
3119
|
}
|
|
2932
3120
|
return scanPromotionCode;
|
|
@@ -2934,14 +3122,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2934
3122
|
}, {
|
|
2935
3123
|
key: "setDiscountSelected",
|
|
2936
3124
|
value: function () {
|
|
2937
|
-
var _setDiscountSelected = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3125
|
+
var _setDiscountSelected = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(params) {
|
|
2938
3126
|
var list, updated, tempOrder, orderStore, discountModule, rulesModule, nextDiscountList, _orderStore$summary3, orderTotalAmount, result, beforeSelectedIds, _iterator4, _step4, d, selectedResourceIds, filterSelectedDiscountDetails, _iterator5, _step5, _product$metadata8, _tempOrder$_extend4, _product$metadata$sou2, _product$metadata9, _product$metadata10, _product$original_pri2, product, productUid, runtimeOrigin, totalPerUnitDiscount, optionSum, sourcePrice, newSourceSellingPrice, newMainSellingPrice;
|
|
2939
|
-
return _regeneratorRuntime().wrap(function
|
|
2940
|
-
while (1) switch (
|
|
3127
|
+
return _regeneratorRuntime().wrap(function _callee28$(_context28) {
|
|
3128
|
+
while (1) switch (_context28.prev = _context28.next) {
|
|
2941
3129
|
case 0:
|
|
2942
|
-
|
|
3130
|
+
_context28.prev = 0;
|
|
2943
3131
|
if (this.store.order) {
|
|
2944
|
-
|
|
3132
|
+
_context28.next = 3;
|
|
2945
3133
|
break;
|
|
2946
3134
|
}
|
|
2947
3135
|
throw new Error('order 模块未初始化');
|
|
@@ -2959,7 +3147,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2959
3147
|
discountModule = orderStore.discount;
|
|
2960
3148
|
rulesModule = orderStore.rules;
|
|
2961
3149
|
nextDiscountList = updated;
|
|
2962
|
-
|
|
3150
|
+
_context28.next = 13;
|
|
2963
3151
|
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(updated);
|
|
2964
3152
|
case 13:
|
|
2965
3153
|
if (rulesModule) {
|
|
@@ -3021,21 +3209,21 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3021
3209
|
});
|
|
3022
3210
|
};
|
|
3023
3211
|
_iterator5 = _createForOfIteratorHelper(tempOrder.products);
|
|
3024
|
-
|
|
3212
|
+
_context28.prev = 17;
|
|
3025
3213
|
_iterator5.s();
|
|
3026
3214
|
case 19:
|
|
3027
3215
|
if ((_step5 = _iterator5.n()).done) {
|
|
3028
|
-
|
|
3216
|
+
_context28.next = 36;
|
|
3029
3217
|
break;
|
|
3030
3218
|
}
|
|
3031
3219
|
product = _step5.value;
|
|
3032
3220
|
productUid = (_product$metadata8 = product.metadata) === null || _product$metadata8 === void 0 ? void 0 : _product$metadata8.unique_identification_number;
|
|
3033
3221
|
runtimeOrigin = productUid ? (_tempOrder$_extend4 = tempOrder._extend) === null || _tempOrder$_extend4 === void 0 || (_tempOrder$_extend4 = _tempOrder$_extend4.productsByUid) === null || _tempOrder$_extend4 === void 0 || (_tempOrder$_extend4 = _tempOrder$_extend4[productUid]) === null || _tempOrder$_extend4 === void 0 ? void 0 : _tempOrder$_extend4.origin : undefined;
|
|
3034
3222
|
if (!(runtimeOrigin !== null && runtimeOrigin !== void 0 && runtimeOrigin.isManualDiscount || isBaseSalesManualProductDiscountProduct(product))) {
|
|
3035
|
-
|
|
3223
|
+
_context28.next = 25;
|
|
3036
3224
|
break;
|
|
3037
3225
|
}
|
|
3038
|
-
return
|
|
3226
|
+
return _context28.abrupt("continue", 34);
|
|
3039
3227
|
case 25:
|
|
3040
3228
|
product.discount_list = filterSelectedDiscountDetails(product.discount_list);
|
|
3041
3229
|
if (Array.isArray(product.product_bundle)) {
|
|
@@ -3071,28 +3259,28 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3071
3259
|
bundle: product.product_bundle
|
|
3072
3260
|
});
|
|
3073
3261
|
case 34:
|
|
3074
|
-
|
|
3262
|
+
_context28.next = 19;
|
|
3075
3263
|
break;
|
|
3076
3264
|
case 36:
|
|
3077
|
-
|
|
3265
|
+
_context28.next = 41;
|
|
3078
3266
|
break;
|
|
3079
3267
|
case 38:
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
_iterator5.e(
|
|
3268
|
+
_context28.prev = 38;
|
|
3269
|
+
_context28.t0 = _context28["catch"](17);
|
|
3270
|
+
_iterator5.e(_context28.t0);
|
|
3083
3271
|
case 41:
|
|
3084
|
-
|
|
3272
|
+
_context28.prev = 41;
|
|
3085
3273
|
_iterator5.f();
|
|
3086
|
-
return
|
|
3274
|
+
return _context28.finish(41);
|
|
3087
3275
|
case 44:
|
|
3088
3276
|
OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
|
|
3089
|
-
|
|
3277
|
+
_context28.next = 47;
|
|
3090
3278
|
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
|
|
3091
3279
|
case 47:
|
|
3092
3280
|
tempOrder.discount_list = (nextDiscountList || []).filter(function (d) {
|
|
3093
3281
|
return d.isSelected;
|
|
3094
3282
|
});
|
|
3095
|
-
|
|
3283
|
+
_context28.next = 50;
|
|
3096
3284
|
return this.store.order.recalculateSummary({
|
|
3097
3285
|
createIfMissing: true
|
|
3098
3286
|
});
|
|
@@ -3104,19 +3292,19 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3104
3292
|
selectedDiscountList: tempOrder.discount_list,
|
|
3105
3293
|
tempOrder: tempOrder
|
|
3106
3294
|
});
|
|
3107
|
-
|
|
3295
|
+
_context28.next = 57;
|
|
3108
3296
|
break;
|
|
3109
3297
|
case 54:
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
throw
|
|
3298
|
+
_context28.prev = 54;
|
|
3299
|
+
_context28.t1 = _context28["catch"](0);
|
|
3300
|
+
throw _context28.t1;
|
|
3113
3301
|
case 57:
|
|
3114
3302
|
case "end":
|
|
3115
|
-
return
|
|
3303
|
+
return _context28.stop();
|
|
3116
3304
|
}
|
|
3117
|
-
},
|
|
3305
|
+
}, _callee28, this, [[0, 54], [17, 38, 41, 44]]);
|
|
3118
3306
|
}));
|
|
3119
|
-
function setDiscountSelected(
|
|
3307
|
+
function setDiscountSelected(_x22) {
|
|
3120
3308
|
return _setDiscountSelected.apply(this, arguments);
|
|
3121
3309
|
}
|
|
3122
3310
|
return setDiscountSelected;
|
|
@@ -3124,23 +3312,23 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3124
3312
|
}, {
|
|
3125
3313
|
key: "applyDiscountCalculationResult",
|
|
3126
3314
|
value: function () {
|
|
3127
|
-
var _applyDiscountCalculationResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3315
|
+
var _applyDiscountCalculationResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(result) {
|
|
3128
3316
|
var tempOrder, orderStore, discountModule;
|
|
3129
|
-
return _regeneratorRuntime().wrap(function
|
|
3130
|
-
while (1) switch (
|
|
3317
|
+
return _regeneratorRuntime().wrap(function _callee29$(_context29) {
|
|
3318
|
+
while (1) switch (_context29.prev = _context29.next) {
|
|
3131
3319
|
case 0:
|
|
3132
|
-
|
|
3320
|
+
_context29.prev = 0;
|
|
3133
3321
|
if (this.store.order) {
|
|
3134
|
-
|
|
3322
|
+
_context29.next = 3;
|
|
3135
3323
|
break;
|
|
3136
3324
|
}
|
|
3137
3325
|
throw new Error('order 模块未初始化');
|
|
3138
3326
|
case 3:
|
|
3139
3327
|
if (result) {
|
|
3140
|
-
|
|
3328
|
+
_context29.next = 5;
|
|
3141
3329
|
break;
|
|
3142
3330
|
}
|
|
3143
|
-
return
|
|
3331
|
+
return _context29.abrupt("return");
|
|
3144
3332
|
case 5:
|
|
3145
3333
|
tempOrder = this.store.order.ensureTempOrder();
|
|
3146
3334
|
orderStore = this.store.order.store || {};
|
|
@@ -3149,24 +3337,24 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3149
3337
|
tempOrder.products = preserveManualProductDiscountProducts(tempOrder.products, result.productList);
|
|
3150
3338
|
}
|
|
3151
3339
|
if (!result.discountList) {
|
|
3152
|
-
|
|
3340
|
+
_context29.next = 14;
|
|
3153
3341
|
break;
|
|
3154
3342
|
}
|
|
3155
3343
|
OrderModule.populateSavedAmounts(tempOrder.products, result.discountList);
|
|
3156
|
-
|
|
3344
|
+
_context29.next = 13;
|
|
3157
3345
|
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(result.discountList);
|
|
3158
3346
|
case 13:
|
|
3159
3347
|
tempOrder.discount_list = result.discountList.filter(function (discount) {
|
|
3160
3348
|
return discount.isSelected;
|
|
3161
3349
|
});
|
|
3162
3350
|
case 14:
|
|
3163
|
-
|
|
3351
|
+
_context29.next = 16;
|
|
3164
3352
|
return this.store.order.recalculateSummary({
|
|
3165
3353
|
createIfMissing: true
|
|
3166
3354
|
});
|
|
3167
3355
|
case 16:
|
|
3168
3356
|
this.store.order.persistTempOrder();
|
|
3169
|
-
|
|
3357
|
+
_context29.next = 19;
|
|
3170
3358
|
return this.effectsEmit('onDiscountApplied', {
|
|
3171
3359
|
productList: tempOrder.products || [],
|
|
3172
3360
|
discountList: result.discountList || [],
|
|
@@ -3174,19 +3362,19 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3174
3362
|
tempOrder: tempOrder
|
|
3175
3363
|
});
|
|
3176
3364
|
case 19:
|
|
3177
|
-
|
|
3365
|
+
_context29.next = 24;
|
|
3178
3366
|
break;
|
|
3179
3367
|
case 21:
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
throw
|
|
3368
|
+
_context29.prev = 21;
|
|
3369
|
+
_context29.t0 = _context29["catch"](0);
|
|
3370
|
+
throw _context29.t0;
|
|
3183
3371
|
case 24:
|
|
3184
3372
|
case "end":
|
|
3185
|
-
return
|
|
3373
|
+
return _context29.stop();
|
|
3186
3374
|
}
|
|
3187
|
-
},
|
|
3375
|
+
}, _callee29, this, [[0, 21]]);
|
|
3188
3376
|
}));
|
|
3189
|
-
function applyDiscountCalculationResult(
|
|
3377
|
+
function applyDiscountCalculationResult(_x23) {
|
|
3190
3378
|
return _applyDiscountCalculationResult.apply(this, arguments);
|
|
3191
3379
|
}
|
|
3192
3380
|
return applyDiscountCalculationResult;
|
|
@@ -3194,18 +3382,18 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3194
3382
|
}, {
|
|
3195
3383
|
key: "submitScanOrder",
|
|
3196
3384
|
value: function () {
|
|
3197
|
-
var _submitScanOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3198
|
-
return _regeneratorRuntime().wrap(function
|
|
3199
|
-
while (1) switch (
|
|
3385
|
+
var _submitScanOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(params) {
|
|
3386
|
+
return _regeneratorRuntime().wrap(function _callee30$(_context30) {
|
|
3387
|
+
while (1) switch (_context30.prev = _context30.next) {
|
|
3200
3388
|
case 0:
|
|
3201
|
-
return
|
|
3389
|
+
return _context30.abrupt("return", this.submitSalesOrder(params));
|
|
3202
3390
|
case 1:
|
|
3203
3391
|
case "end":
|
|
3204
|
-
return
|
|
3392
|
+
return _context30.stop();
|
|
3205
3393
|
}
|
|
3206
|
-
},
|
|
3394
|
+
}, _callee30, this);
|
|
3207
3395
|
}));
|
|
3208
|
-
function submitScanOrder(
|
|
3396
|
+
function submitScanOrder(_x24) {
|
|
3209
3397
|
return _submitScanOrder.apply(this, arguments);
|
|
3210
3398
|
}
|
|
3211
3399
|
return submitScanOrder;
|
|
@@ -3219,14 +3407,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3219
3407
|
}, {
|
|
3220
3408
|
key: "submitSalesOrder",
|
|
3221
3409
|
value: (function () {
|
|
3222
|
-
var _submitSalesOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3410
|
+
var _submitSalesOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(params) {
|
|
3223
3411
|
var _params$smallTicketDa, _this$otherParams13, _this$otherParams14, _this$otherParams15, _this$otherParams16;
|
|
3224
3412
|
var inferredPaymentStatus, smallTicketDataFlag, enhancePayload, submitParams;
|
|
3225
|
-
return _regeneratorRuntime().wrap(function
|
|
3226
|
-
while (1) switch (
|
|
3413
|
+
return _regeneratorRuntime().wrap(function _callee31$(_context31) {
|
|
3414
|
+
while (1) switch (_context31.prev = _context31.next) {
|
|
3227
3415
|
case 0:
|
|
3228
3416
|
if (this.store.order) {
|
|
3229
|
-
|
|
3417
|
+
_context31.next = 2;
|
|
3230
3418
|
break;
|
|
3231
3419
|
}
|
|
3232
3420
|
throw new Error('BaseSales 解决方案需要 order 模块支持');
|
|
@@ -3253,14 +3441,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3253
3441
|
} : {}), enhancePayload !== undefined ? {
|
|
3254
3442
|
enhancePayload: enhancePayload
|
|
3255
3443
|
} : {});
|
|
3256
|
-
return
|
|
3444
|
+
return _context31.abrupt("return", this.shouldUseCheckoutSyncTask() ? this.store.order.submitTempOrder(submitParams) : this.store.order.submitTempOrderAsync(submitParams));
|
|
3257
3445
|
case 7:
|
|
3258
3446
|
case "end":
|
|
3259
|
-
return
|
|
3447
|
+
return _context31.stop();
|
|
3260
3448
|
}
|
|
3261
|
-
},
|
|
3449
|
+
}, _callee31, this);
|
|
3262
3450
|
}));
|
|
3263
|
-
function submitSalesOrder(
|
|
3451
|
+
function submitSalesOrder(_x25) {
|
|
3264
3452
|
return _submitSalesOrder.apply(this, arguments);
|
|
3265
3453
|
}
|
|
3266
3454
|
return submitSalesOrder;
|
|
@@ -3268,18 +3456,18 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3268
3456
|
}, {
|
|
3269
3457
|
key: "saveSalesOrderDraft",
|
|
3270
3458
|
value: function () {
|
|
3271
|
-
var _saveSalesOrderDraft = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3459
|
+
var _saveSalesOrderDraft = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(params) {
|
|
3272
3460
|
var _params$platform, _this$otherParams17, _this$otherParams18, _this$otherParams19, _params$channel, _params$type, _this$otherParams20;
|
|
3273
|
-
return _regeneratorRuntime().wrap(function
|
|
3274
|
-
while (1) switch (
|
|
3461
|
+
return _regeneratorRuntime().wrap(function _callee32$(_context32) {
|
|
3462
|
+
while (1) switch (_context32.prev = _context32.next) {
|
|
3275
3463
|
case 0:
|
|
3276
3464
|
if (this.store.order) {
|
|
3277
|
-
|
|
3465
|
+
_context32.next = 2;
|
|
3278
3466
|
break;
|
|
3279
3467
|
}
|
|
3280
3468
|
throw new Error('BaseSales 解决方案需要 order 模块支持');
|
|
3281
3469
|
case 2:
|
|
3282
|
-
return
|
|
3470
|
+
return _context32.abrupt("return", this.store.order.saveTempOrderAsDraft(_objectSpread({
|
|
3283
3471
|
cacheId: this.cacheId,
|
|
3284
3472
|
platform: (_params$platform = params === null || params === void 0 ? void 0 : params.platform) !== null && _params$platform !== void 0 ? _params$platform : (_this$otherParams17 = this.otherParams) === null || _this$otherParams17 === void 0 ? void 0 : _this$otherParams17.platform,
|
|
3285
3473
|
businessCode: (params === null || params === void 0 ? void 0 : params.businessCode) || ((_this$otherParams18 = this.otherParams) === null || _this$otherParams18 === void 0 ? void 0 : _this$otherParams18.businessCode) || ((_this$otherParams19 = this.otherParams) === null || _this$otherParams19 === void 0 ? void 0 : _this$otherParams19.business_code),
|
|
@@ -3290,11 +3478,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3290
3478
|
} : {})));
|
|
3291
3479
|
case 3:
|
|
3292
3480
|
case "end":
|
|
3293
|
-
return
|
|
3481
|
+
return _context32.stop();
|
|
3294
3482
|
}
|
|
3295
|
-
},
|
|
3483
|
+
}, _callee32, this);
|
|
3296
3484
|
}));
|
|
3297
|
-
function saveSalesOrderDraft(
|
|
3485
|
+
function saveSalesOrderDraft(_x26) {
|
|
3298
3486
|
return _saveSalesOrderDraft.apply(this, arguments);
|
|
3299
3487
|
}
|
|
3300
3488
|
return saveSalesOrderDraft;
|
|
@@ -3302,14 +3490,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3302
3490
|
}, {
|
|
3303
3491
|
key: "submitTempOrderAsync",
|
|
3304
3492
|
value: function () {
|
|
3305
|
-
var _submitTempOrderAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3493
|
+
var _submitTempOrderAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(params) {
|
|
3306
3494
|
var _params$smallTicketDa2, _this$otherParams21, _this$otherParams22, _this$otherParams23, _this$otherParams24;
|
|
3307
3495
|
var inferredPaymentStatus, smallTicketDataFlag, enhancePayload, submitParams;
|
|
3308
|
-
return _regeneratorRuntime().wrap(function
|
|
3309
|
-
while (1) switch (
|
|
3496
|
+
return _regeneratorRuntime().wrap(function _callee33$(_context33) {
|
|
3497
|
+
while (1) switch (_context33.prev = _context33.next) {
|
|
3310
3498
|
case 0:
|
|
3311
3499
|
if (this.store.order) {
|
|
3312
|
-
|
|
3500
|
+
_context33.next = 2;
|
|
3313
3501
|
break;
|
|
3314
3502
|
}
|
|
3315
3503
|
throw new Error('BaseSales 解决方案需要 order 模块支持');
|
|
@@ -3335,14 +3523,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3335
3523
|
} : {}), enhancePayload !== undefined ? {
|
|
3336
3524
|
enhancePayload: enhancePayload
|
|
3337
3525
|
} : {});
|
|
3338
|
-
return
|
|
3526
|
+
return _context33.abrupt("return", this.store.order.submitTempOrderAsync(submitParams));
|
|
3339
3527
|
case 7:
|
|
3340
3528
|
case "end":
|
|
3341
|
-
return
|
|
3529
|
+
return _context33.stop();
|
|
3342
3530
|
}
|
|
3343
|
-
},
|
|
3531
|
+
}, _callee33, this);
|
|
3344
3532
|
}));
|
|
3345
|
-
function submitTempOrderAsync(
|
|
3533
|
+
function submitTempOrderAsync(_x27) {
|
|
3346
3534
|
return _submitTempOrderAsync.apply(this, arguments);
|
|
3347
3535
|
}
|
|
3348
3536
|
return submitTempOrderAsync;
|
|
@@ -3368,14 +3556,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3368
3556
|
}, {
|
|
3369
3557
|
key: "printLocalOrderReceipt",
|
|
3370
3558
|
value: function () {
|
|
3371
|
-
var _printLocalOrderReceipt = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3559
|
+
var _printLocalOrderReceipt = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(lookup) {
|
|
3372
3560
|
var _this$otherParams26, _this$otherParams27, _this$otherParams28, _this$otherParams29;
|
|
3373
3561
|
var hasLookup, lookupPayload, context, payload, response, _this$store$order$app, _this$store$order5, _data;
|
|
3374
|
-
return _regeneratorRuntime().wrap(function
|
|
3375
|
-
while (1) switch (
|
|
3562
|
+
return _regeneratorRuntime().wrap(function _callee34$(_context34) {
|
|
3563
|
+
while (1) switch (_context34.prev = _context34.next) {
|
|
3376
3564
|
case 0:
|
|
3377
3565
|
if (this.store.order) {
|
|
3378
|
-
|
|
3566
|
+
_context34.next = 2;
|
|
3379
3567
|
break;
|
|
3380
3568
|
}
|
|
3381
3569
|
throw new Error('BaseSales 解决方案需要 order 模块支持');
|
|
@@ -3406,28 +3594,28 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3406
3594
|
channel: context.channel,
|
|
3407
3595
|
type: context.type
|
|
3408
3596
|
});
|
|
3409
|
-
|
|
3597
|
+
_context34.next = 8;
|
|
3410
3598
|
return this.request.post('/local/print-order', payload, {
|
|
3411
3599
|
osServer: true,
|
|
3412
3600
|
customToast: function customToast() {}
|
|
3413
3601
|
});
|
|
3414
3602
|
case 8:
|
|
3415
|
-
response =
|
|
3603
|
+
response = _context34.sent;
|
|
3416
3604
|
if (hasLookup) {
|
|
3417
|
-
|
|
3605
|
+
_context34.next = 12;
|
|
3418
3606
|
break;
|
|
3419
3607
|
}
|
|
3420
|
-
|
|
3608
|
+
_context34.next = 12;
|
|
3421
3609
|
return (_this$store$order$app = (_this$store$order5 = this.store.order).applyLocalPrintOrderNumbers) === null || _this$store$order$app === void 0 ? void 0 : _this$store$order$app.call(_this$store$order5, response === null || response === void 0 || (_data = response.data) === null || _data === void 0 ? void 0 : _data.order);
|
|
3422
3610
|
case 12:
|
|
3423
|
-
return
|
|
3611
|
+
return _context34.abrupt("return", response);
|
|
3424
3612
|
case 13:
|
|
3425
3613
|
case "end":
|
|
3426
|
-
return
|
|
3614
|
+
return _context34.stop();
|
|
3427
3615
|
}
|
|
3428
|
-
},
|
|
3616
|
+
}, _callee34, this);
|
|
3429
3617
|
}));
|
|
3430
|
-
function printLocalOrderReceipt(
|
|
3618
|
+
function printLocalOrderReceipt(_x28) {
|
|
3431
3619
|
return _printLocalOrderReceipt.apply(this, arguments);
|
|
3432
3620
|
}
|
|
3433
3621
|
return printLocalOrderReceipt;
|
|
@@ -3448,14 +3636,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3448
3636
|
}, {
|
|
3449
3637
|
key: "syncPaymentsToOrder",
|
|
3450
3638
|
value: function () {
|
|
3451
|
-
var _syncPaymentsToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3639
|
+
var _syncPaymentsToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35(params) {
|
|
3452
3640
|
var _ref36, _params$businessCode, _this$otherParams30, _this$otherParams31, _params$channel2;
|
|
3453
3641
|
var businessCode, channel, enhancePayload, syncParams, syncState, payments, syncResult, latestPayments, amountSnapshot, orderSnapshot, syncPayload;
|
|
3454
|
-
return _regeneratorRuntime().wrap(function
|
|
3455
|
-
while (1) switch (
|
|
3642
|
+
return _regeneratorRuntime().wrap(function _callee35$(_context35) {
|
|
3643
|
+
while (1) switch (_context35.prev = _context35.next) {
|
|
3456
3644
|
case 0:
|
|
3457
3645
|
if (this.store.order) {
|
|
3458
|
-
|
|
3646
|
+
_context35.next = 2;
|
|
3459
3647
|
break;
|
|
3460
3648
|
}
|
|
3461
3649
|
throw new Error('order 模块未初始化');
|
|
@@ -3474,14 +3662,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3474
3662
|
} : {});
|
|
3475
3663
|
syncState = this.store.order.getOrderSyncState();
|
|
3476
3664
|
if (!(params.submitWhenPaid && syncState === 'submitting')) {
|
|
3477
|
-
|
|
3665
|
+
_context35.next = 10;
|
|
3478
3666
|
break;
|
|
3479
3667
|
}
|
|
3480
3668
|
this.queueLatestAutoPaymentSync();
|
|
3481
|
-
return
|
|
3669
|
+
return _context35.abrupt("return", this.store.order.syncPaymentsToOrder(syncParams));
|
|
3482
3670
|
case 10:
|
|
3483
3671
|
payments = params.payments || [];
|
|
3484
|
-
|
|
3672
|
+
_context35.next = 13;
|
|
3485
3673
|
return this.effectsEmit(BaseSalesHookNames.onPaymentSyncStart, {
|
|
3486
3674
|
payments: payments,
|
|
3487
3675
|
params: syncParams,
|
|
@@ -3489,11 +3677,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3489
3677
|
orderSnapshot: this.store.order.getOrderSnapshot()
|
|
3490
3678
|
});
|
|
3491
3679
|
case 13:
|
|
3492
|
-
|
|
3493
|
-
|
|
3680
|
+
_context35.prev = 13;
|
|
3681
|
+
_context35.next = 16;
|
|
3494
3682
|
return this.store.order.syncPaymentsToOrder(syncParams);
|
|
3495
3683
|
case 16:
|
|
3496
|
-
syncResult =
|
|
3684
|
+
syncResult = _context35.sent;
|
|
3497
3685
|
latestPayments = this.store.order.getOrderPayments();
|
|
3498
3686
|
amountSnapshot = this.store.order.getOrderAmountSnapshot();
|
|
3499
3687
|
orderSnapshot = this.store.order.getOrderSnapshot();
|
|
@@ -3511,25 +3699,25 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3511
3699
|
depositAmount: syncResult.depositAmount,
|
|
3512
3700
|
orderExpectedAmount: syncResult.orderExpectedAmount
|
|
3513
3701
|
};
|
|
3514
|
-
|
|
3702
|
+
_context35.next = 23;
|
|
3515
3703
|
return this.effectsEmit(BaseSalesHookNames.onPaymentSyncEnd, syncPayload);
|
|
3516
3704
|
case 23:
|
|
3517
3705
|
if (!(syncResult.isDepositFullyPaid && !syncResult.isOrderFullyPaid)) {
|
|
3518
|
-
|
|
3706
|
+
_context35.next = 26;
|
|
3519
3707
|
break;
|
|
3520
3708
|
}
|
|
3521
|
-
|
|
3709
|
+
_context35.next = 26;
|
|
3522
3710
|
return this.effectsEmit(BaseSalesHookNames.onDepositPaymentSyncEnd, syncPayload);
|
|
3523
3711
|
case 26:
|
|
3524
3712
|
this.scheduleQueuedAutoPaymentSyncFlush(0);
|
|
3525
|
-
return
|
|
3713
|
+
return _context35.abrupt("return", syncResult);
|
|
3526
3714
|
case 30:
|
|
3527
|
-
|
|
3528
|
-
|
|
3529
|
-
|
|
3715
|
+
_context35.prev = 30;
|
|
3716
|
+
_context35.t0 = _context35["catch"](13);
|
|
3717
|
+
_context35.next = 34;
|
|
3530
3718
|
return this.effectsEmit(BaseSalesHookNames.onPaymentSyncEnd, {
|
|
3531
3719
|
ok: false,
|
|
3532
|
-
error:
|
|
3720
|
+
error: _context35.t0,
|
|
3533
3721
|
payments: this.store.order.getOrderPayments(),
|
|
3534
3722
|
params: syncParams,
|
|
3535
3723
|
amountSnapshot: this.store.order.getOrderAmountSnapshot(),
|
|
@@ -3537,14 +3725,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3537
3725
|
});
|
|
3538
3726
|
case 34:
|
|
3539
3727
|
this.scheduleQueuedAutoPaymentSyncFlush(0);
|
|
3540
|
-
throw
|
|
3728
|
+
throw _context35.t0;
|
|
3541
3729
|
case 36:
|
|
3542
3730
|
case "end":
|
|
3543
|
-
return
|
|
3731
|
+
return _context35.stop();
|
|
3544
3732
|
}
|
|
3545
|
-
},
|
|
3733
|
+
}, _callee35, this, [[13, 30]]);
|
|
3546
3734
|
}));
|
|
3547
|
-
function syncPaymentsToOrder(
|
|
3735
|
+
function syncPaymentsToOrder(_x29) {
|
|
3548
3736
|
return _syncPaymentsToOrder.apply(this, arguments);
|
|
3549
3737
|
}
|
|
3550
3738
|
return syncPaymentsToOrder;
|
|
@@ -3593,46 +3781,46 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3593
3781
|
}, {
|
|
3594
3782
|
key: "flushQueuedAutoPaymentSync",
|
|
3595
3783
|
value: function () {
|
|
3596
|
-
var _flushQueuedAutoPaymentSync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3784
|
+
var _flushQueuedAutoPaymentSync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36() {
|
|
3597
3785
|
var payments;
|
|
3598
|
-
return _regeneratorRuntime().wrap(function
|
|
3599
|
-
while (1) switch (
|
|
3786
|
+
return _regeneratorRuntime().wrap(function _callee36$(_context36) {
|
|
3787
|
+
while (1) switch (_context36.prev = _context36.next) {
|
|
3600
3788
|
case 0:
|
|
3601
3789
|
if (this.store.order) {
|
|
3602
|
-
|
|
3790
|
+
_context36.next = 2;
|
|
3603
3791
|
break;
|
|
3604
3792
|
}
|
|
3605
|
-
return
|
|
3793
|
+
return _context36.abrupt("return");
|
|
3606
3794
|
case 2:
|
|
3607
3795
|
if (!(!this.queuedAutoPaymentSync || this.autoPaymentSyncFlushing)) {
|
|
3608
|
-
|
|
3796
|
+
_context36.next = 4;
|
|
3609
3797
|
break;
|
|
3610
3798
|
}
|
|
3611
|
-
return
|
|
3799
|
+
return _context36.abrupt("return");
|
|
3612
3800
|
case 4:
|
|
3613
3801
|
if (!(this.store.order.getOrderSyncState() === 'submitting')) {
|
|
3614
|
-
|
|
3802
|
+
_context36.next = 7;
|
|
3615
3803
|
break;
|
|
3616
3804
|
}
|
|
3617
3805
|
this.scheduleQueuedAutoPaymentSyncFlush();
|
|
3618
|
-
return
|
|
3806
|
+
return _context36.abrupt("return");
|
|
3619
3807
|
case 7:
|
|
3620
3808
|
this.autoPaymentSyncFlushing = true;
|
|
3621
|
-
|
|
3809
|
+
_context36.prev = 8;
|
|
3622
3810
|
case 9:
|
|
3623
3811
|
if (!this.queuedAutoPaymentSync) {
|
|
3624
|
-
|
|
3812
|
+
_context36.next = 18;
|
|
3625
3813
|
break;
|
|
3626
3814
|
}
|
|
3627
3815
|
this.queuedAutoPaymentSync = false;
|
|
3628
3816
|
payments = this.store.order.getOrderPayments();
|
|
3629
3817
|
if (payments.length) {
|
|
3630
|
-
|
|
3818
|
+
_context36.next = 14;
|
|
3631
3819
|
break;
|
|
3632
3820
|
}
|
|
3633
|
-
return
|
|
3821
|
+
return _context36.abrupt("continue", 9);
|
|
3634
3822
|
case 14:
|
|
3635
|
-
|
|
3823
|
+
_context36.next = 16;
|
|
3636
3824
|
return this.syncPaymentsToOrder({
|
|
3637
3825
|
payments: payments,
|
|
3638
3826
|
paymentStatus: this.getPaymentStatusForSync(payments),
|
|
@@ -3640,29 +3828,29 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3640
3828
|
smallTicketDataFlag: 1
|
|
3641
3829
|
});
|
|
3642
3830
|
case 16:
|
|
3643
|
-
|
|
3831
|
+
_context36.next = 9;
|
|
3644
3832
|
break;
|
|
3645
3833
|
case 18:
|
|
3646
|
-
|
|
3834
|
+
_context36.next = 23;
|
|
3647
3835
|
break;
|
|
3648
3836
|
case 20:
|
|
3649
|
-
|
|
3650
|
-
|
|
3837
|
+
_context36.prev = 20;
|
|
3838
|
+
_context36.t0 = _context36["catch"](8);
|
|
3651
3839
|
this.logError('queued auto sync payments failed', {
|
|
3652
|
-
error:
|
|
3840
|
+
error: _context36.t0 instanceof Error ? _context36.t0.message : String(_context36.t0)
|
|
3653
3841
|
});
|
|
3654
3842
|
case 23:
|
|
3655
|
-
|
|
3843
|
+
_context36.prev = 23;
|
|
3656
3844
|
this.autoPaymentSyncFlushing = false;
|
|
3657
3845
|
if (this.queuedAutoPaymentSync) {
|
|
3658
3846
|
this.scheduleQueuedAutoPaymentSyncFlush(0);
|
|
3659
3847
|
}
|
|
3660
|
-
return
|
|
3848
|
+
return _context36.finish(23);
|
|
3661
3849
|
case 27:
|
|
3662
3850
|
case "end":
|
|
3663
|
-
return
|
|
3851
|
+
return _context36.stop();
|
|
3664
3852
|
}
|
|
3665
|
-
},
|
|
3853
|
+
}, _callee36, this, [[8, 20, 23, 27]]);
|
|
3666
3854
|
}));
|
|
3667
3855
|
function flushQueuedAutoPaymentSync() {
|
|
3668
3856
|
return _flushQueuedAutoPaymentSync.apply(this, arguments);
|
|
@@ -3686,35 +3874,35 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3686
3874
|
}, {
|
|
3687
3875
|
key: "addOrderPaymentAsync",
|
|
3688
3876
|
value: (function () {
|
|
3689
|
-
var _addOrderPaymentAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3877
|
+
var _addOrderPaymentAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37(payment) {
|
|
3690
3878
|
var paymentRecord, hasPaymentNumber, devicePrefix;
|
|
3691
|
-
return _regeneratorRuntime().wrap(function
|
|
3692
|
-
while (1) switch (
|
|
3879
|
+
return _regeneratorRuntime().wrap(function _callee37$(_context37) {
|
|
3880
|
+
while (1) switch (_context37.prev = _context37.next) {
|
|
3693
3881
|
case 0:
|
|
3694
3882
|
paymentRecord = payment;
|
|
3695
3883
|
hasPaymentNumber = String(paymentRecord.payment_number || '').trim() !== '';
|
|
3696
3884
|
if (!hasPaymentNumber) {
|
|
3697
|
-
|
|
3885
|
+
_context37.next = 6;
|
|
3698
3886
|
break;
|
|
3699
3887
|
}
|
|
3700
|
-
|
|
3701
|
-
|
|
3888
|
+
_context37.t0 = 'LOCAL';
|
|
3889
|
+
_context37.next = 9;
|
|
3702
3890
|
break;
|
|
3703
3891
|
case 6:
|
|
3704
|
-
|
|
3892
|
+
_context37.next = 8;
|
|
3705
3893
|
return this.getPaymentNumberDevicePrefixAsync();
|
|
3706
3894
|
case 8:
|
|
3707
|
-
|
|
3895
|
+
_context37.t0 = _context37.sent;
|
|
3708
3896
|
case 9:
|
|
3709
|
-
devicePrefix =
|
|
3710
|
-
return
|
|
3897
|
+
devicePrefix = _context37.t0;
|
|
3898
|
+
return _context37.abrupt("return", this.addOrderPaymentWithDevicePrefix(payment, devicePrefix));
|
|
3711
3899
|
case 11:
|
|
3712
3900
|
case "end":
|
|
3713
|
-
return
|
|
3901
|
+
return _context37.stop();
|
|
3714
3902
|
}
|
|
3715
|
-
},
|
|
3903
|
+
}, _callee37, this);
|
|
3716
3904
|
}));
|
|
3717
|
-
function addOrderPaymentAsync(
|
|
3905
|
+
function addOrderPaymentAsync(_x30) {
|
|
3718
3906
|
return _addOrderPaymentAsync.apply(this, arguments);
|
|
3719
3907
|
}
|
|
3720
3908
|
return addOrderPaymentAsync;
|
|
@@ -3783,7 +3971,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3783
3971
|
}, {
|
|
3784
3972
|
key: "updateOrderPayment",
|
|
3785
3973
|
value: (function () {
|
|
3786
|
-
var _updateOrderPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3974
|
+
var _updateOrderPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38(paymentIdentity, updates) {
|
|
3787
3975
|
var _result$payment, _result$payment2;
|
|
3788
3976
|
var options,
|
|
3789
3977
|
matchMode,
|
|
@@ -3800,13 +3988,13 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3800
3988
|
shouldSubmit,
|
|
3801
3989
|
syncResult,
|
|
3802
3990
|
_options$smallTicketD2,
|
|
3803
|
-
|
|
3804
|
-
return _regeneratorRuntime().wrap(function
|
|
3805
|
-
while (1) switch (
|
|
3991
|
+
_args38 = arguments;
|
|
3992
|
+
return _regeneratorRuntime().wrap(function _callee38$(_context38) {
|
|
3993
|
+
while (1) switch (_context38.prev = _context38.next) {
|
|
3806
3994
|
case 0:
|
|
3807
|
-
options =
|
|
3995
|
+
options = _args38.length > 2 && _args38[2] !== undefined ? _args38[2] : {};
|
|
3808
3996
|
if (this.store.order) {
|
|
3809
|
-
|
|
3997
|
+
_context38.next = 3;
|
|
3810
3998
|
break;
|
|
3811
3999
|
}
|
|
3812
4000
|
throw new Error('order 模块未初始化');
|
|
@@ -3815,15 +4003,15 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3815
4003
|
previousMatch = resolveOrderPaymentIdentity(this.store.order.getOrderPayments(), paymentIdentity, matchMode);
|
|
3816
4004
|
previousPayment = previousMatch === null || previousMatch === void 0 ? void 0 : previousMatch.payment;
|
|
3817
4005
|
if (!((previousPayment === null || previousPayment === void 0 ? void 0 : previousPayment.status) === 'paid' && !options.applyUpdatesWhenPaid)) {
|
|
3818
|
-
|
|
4006
|
+
_context38.next = 13;
|
|
3819
4007
|
break;
|
|
3820
4008
|
}
|
|
3821
4009
|
currentPayments = this.store.order.getOrderPayments();
|
|
3822
4010
|
if (!(options.submitWhenPaid && options.forceSubmitIfPaid)) {
|
|
3823
|
-
|
|
4011
|
+
_context38.next = 12;
|
|
3824
4012
|
break;
|
|
3825
4013
|
}
|
|
3826
|
-
|
|
4014
|
+
_context38.next = 11;
|
|
3827
4015
|
return this.syncPaymentsToOrder({
|
|
3828
4016
|
payments: currentPayments,
|
|
3829
4017
|
paymentStatus: this.getPaymentStatusForSync(currentPayments),
|
|
@@ -3831,9 +4019,9 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3831
4019
|
smallTicketDataFlag: (_options$smallTicketD = options.smallTicketDataFlag) !== null && _options$smallTicketD !== void 0 ? _options$smallTicketD : 1
|
|
3832
4020
|
});
|
|
3833
4021
|
case 11:
|
|
3834
|
-
_syncResult =
|
|
4022
|
+
_syncResult = _context38.sent;
|
|
3835
4023
|
case 12:
|
|
3836
|
-
return
|
|
4024
|
+
return _context38.abrupt("return", _objectSpread({
|
|
3837
4025
|
updated: false,
|
|
3838
4026
|
payment: previousPayment,
|
|
3839
4027
|
payments: currentPayments,
|
|
@@ -3842,44 +4030,44 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3842
4030
|
syncResult: _syncResult
|
|
3843
4031
|
} : {}));
|
|
3844
4032
|
case 13:
|
|
3845
|
-
|
|
4033
|
+
_context38.next = 15;
|
|
3846
4034
|
return this.store.order.updateOrderPayment(paymentIdentity, updates, {
|
|
3847
4035
|
matchBy: matchMode
|
|
3848
4036
|
});
|
|
3849
4037
|
case 15:
|
|
3850
|
-
result =
|
|
4038
|
+
result = _context38.sent;
|
|
3851
4039
|
if (!(options.persistDraft !== false)) {
|
|
3852
|
-
|
|
4040
|
+
_context38.next = 29;
|
|
3853
4041
|
break;
|
|
3854
4042
|
}
|
|
3855
|
-
|
|
3856
|
-
|
|
4043
|
+
_context38.prev = 17;
|
|
4044
|
+
_context38.next = 20;
|
|
3857
4045
|
return this.saveSalesOrderDraft();
|
|
3858
4046
|
case 20:
|
|
3859
|
-
draftResult =
|
|
3860
|
-
|
|
4047
|
+
draftResult = _context38.sent;
|
|
4048
|
+
_context38.next = 29;
|
|
3861
4049
|
break;
|
|
3862
4050
|
case 23:
|
|
3863
|
-
|
|
3864
|
-
|
|
3865
|
-
draftError =
|
|
4051
|
+
_context38.prev = 23;
|
|
4052
|
+
_context38.t0 = _context38["catch"](17);
|
|
4053
|
+
draftError = _context38.t0;
|
|
3866
4054
|
this.logError('updateOrderPayment: 保存支付草稿失败', {
|
|
3867
4055
|
paymentIdentity: paymentIdentity,
|
|
3868
|
-
error:
|
|
4056
|
+
error: _context38.t0 instanceof Error ? _context38.t0.message : String(_context38.t0)
|
|
3869
4057
|
});
|
|
3870
4058
|
if (options.submitWhenPaid) {
|
|
3871
|
-
|
|
4059
|
+
_context38.next = 29;
|
|
3872
4060
|
break;
|
|
3873
4061
|
}
|
|
3874
|
-
throw
|
|
4062
|
+
throw _context38.t0;
|
|
3875
4063
|
case 29:
|
|
3876
4064
|
becamePaid = (previousPayment === null || previousPayment === void 0 ? void 0 : previousPayment.status) !== 'paid' && ((_result$payment = result.payment) === null || _result$payment === void 0 ? void 0 : _result$payment.status) === 'paid';
|
|
3877
4065
|
shouldSubmit = Boolean(options.submitWhenPaid && ((_result$payment2 = result.payment) === null || _result$payment2 === void 0 ? void 0 : _result$payment2.status) === 'paid' && (becamePaid || options.forceSubmitIfPaid));
|
|
3878
4066
|
if (!shouldSubmit) {
|
|
3879
|
-
|
|
4067
|
+
_context38.next = 35;
|
|
3880
4068
|
break;
|
|
3881
4069
|
}
|
|
3882
|
-
|
|
4070
|
+
_context38.next = 34;
|
|
3883
4071
|
return this.syncPaymentsToOrder({
|
|
3884
4072
|
payments: result.payments,
|
|
3885
4073
|
paymentStatus: this.getPaymentStatusForSync(result.payments),
|
|
@@ -3887,9 +4075,9 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3887
4075
|
smallTicketDataFlag: (_options$smallTicketD2 = options.smallTicketDataFlag) !== null && _options$smallTicketD2 !== void 0 ? _options$smallTicketD2 : 1
|
|
3888
4076
|
});
|
|
3889
4077
|
case 34:
|
|
3890
|
-
syncResult =
|
|
4078
|
+
syncResult = _context38.sent;
|
|
3891
4079
|
case 35:
|
|
3892
|
-
return
|
|
4080
|
+
return _context38.abrupt("return", _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, result), draftResult !== undefined ? {
|
|
3893
4081
|
draftResult: draftResult
|
|
3894
4082
|
} : {}), draftError !== undefined ? {
|
|
3895
4083
|
draftError: draftError
|
|
@@ -3898,11 +4086,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3898
4086
|
} : {}));
|
|
3899
4087
|
case 36:
|
|
3900
4088
|
case "end":
|
|
3901
|
-
return
|
|
4089
|
+
return _context38.stop();
|
|
3902
4090
|
}
|
|
3903
|
-
},
|
|
4091
|
+
}, _callee38, this, [[17, 23]]);
|
|
3904
4092
|
}));
|
|
3905
|
-
function updateOrderPayment(
|
|
4093
|
+
function updateOrderPayment(_x31, _x32) {
|
|
3906
4094
|
return _updateOrderPayment.apply(this, arguments);
|
|
3907
4095
|
}
|
|
3908
4096
|
return updateOrderPayment;
|
|
@@ -3924,24 +4112,24 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3924
4112
|
}, {
|
|
3925
4113
|
key: "updateVoucherOrderPaymentsAsync",
|
|
3926
4114
|
value: function () {
|
|
3927
|
-
var _updateVoucherOrderPaymentsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3928
|
-
return _regeneratorRuntime().wrap(function
|
|
3929
|
-
while (1) switch (
|
|
4115
|
+
var _updateVoucherOrderPaymentsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39(payments, options) {
|
|
4116
|
+
return _regeneratorRuntime().wrap(function _callee39$(_context39) {
|
|
4117
|
+
while (1) switch (_context39.prev = _context39.next) {
|
|
3930
4118
|
case 0:
|
|
3931
4119
|
if (this.store.order) {
|
|
3932
|
-
|
|
4120
|
+
_context39.next = 2;
|
|
3933
4121
|
break;
|
|
3934
4122
|
}
|
|
3935
4123
|
throw new Error('order 模块未初始化');
|
|
3936
4124
|
case 2:
|
|
3937
|
-
return
|
|
4125
|
+
return _context39.abrupt("return", this.store.order.updateVoucherOrderPaymentsAsync(payments, options));
|
|
3938
4126
|
case 3:
|
|
3939
4127
|
case "end":
|
|
3940
|
-
return
|
|
4128
|
+
return _context39.stop();
|
|
3941
4129
|
}
|
|
3942
|
-
},
|
|
4130
|
+
}, _callee39, this);
|
|
3943
4131
|
}));
|
|
3944
|
-
function updateVoucherOrderPaymentsAsync(
|
|
4132
|
+
function updateVoucherOrderPaymentsAsync(_x33, _x34) {
|
|
3945
4133
|
return _updateVoucherOrderPaymentsAsync.apply(this, arguments);
|
|
3946
4134
|
}
|
|
3947
4135
|
return updateVoucherOrderPaymentsAsync;
|
|
@@ -4052,20 +4240,20 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4052
4240
|
}, {
|
|
4053
4241
|
key: "initWalletData",
|
|
4054
4242
|
value: function () {
|
|
4055
|
-
var _initWalletData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4243
|
+
var _initWalletData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40(params) {
|
|
4056
4244
|
var _snapshot$identity;
|
|
4057
4245
|
var snapshot, walletBusinessData, result;
|
|
4058
|
-
return _regeneratorRuntime().wrap(function
|
|
4059
|
-
while (1) switch (
|
|
4246
|
+
return _regeneratorRuntime().wrap(function _callee40$(_context40) {
|
|
4247
|
+
while (1) switch (_context40.prev = _context40.next) {
|
|
4060
4248
|
case 0:
|
|
4061
4249
|
if (this.store.order) {
|
|
4062
|
-
|
|
4250
|
+
_context40.next = 2;
|
|
4063
4251
|
break;
|
|
4064
4252
|
}
|
|
4065
4253
|
throw new Error('order 模块未初始化');
|
|
4066
4254
|
case 2:
|
|
4067
4255
|
if (this.store.payment) {
|
|
4068
|
-
|
|
4256
|
+
_context40.next = 4;
|
|
4069
4257
|
break;
|
|
4070
4258
|
}
|
|
4071
4259
|
throw new Error('payment 模块未初始化');
|
|
@@ -4073,10 +4261,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4073
4261
|
snapshot = this.store.order.getOrderSnapshot();
|
|
4074
4262
|
walletBusinessData = this.buildWalletInitBusinessData(params);
|
|
4075
4263
|
if (walletBusinessData) {
|
|
4076
|
-
|
|
4264
|
+
_context40.next = 8;
|
|
4077
4265
|
break;
|
|
4078
4266
|
}
|
|
4079
|
-
return
|
|
4267
|
+
return _context40.abrupt("return", {
|
|
4080
4268
|
walletRecommendList: [],
|
|
4081
4269
|
userIdentificationCodes: [],
|
|
4082
4270
|
transformList: [],
|
|
@@ -4084,11 +4272,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4084
4272
|
products: []
|
|
4085
4273
|
});
|
|
4086
4274
|
case 8:
|
|
4087
|
-
|
|
4275
|
+
_context40.next = 10;
|
|
4088
4276
|
return this.store.payment.wallet.initializeWalletDataFromBusinessAsync(walletBusinessData);
|
|
4089
4277
|
case 10:
|
|
4090
|
-
result =
|
|
4091
|
-
|
|
4278
|
+
result = _context40.sent;
|
|
4279
|
+
_context40.next = 13;
|
|
4092
4280
|
return this.core.effects.emit("".concat(this.name, ":onWalletDataInitialized"), {
|
|
4093
4281
|
orderId: snapshot === null || snapshot === void 0 || (_snapshot$identity = snapshot.identity) === null || _snapshot$identity === void 0 ? void 0 : _snapshot$identity.orderId,
|
|
4094
4282
|
customerId: walletBusinessData.customer_id,
|
|
@@ -4100,14 +4288,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4100
4288
|
timestamp: Date.now()
|
|
4101
4289
|
});
|
|
4102
4290
|
case 13:
|
|
4103
|
-
return
|
|
4291
|
+
return _context40.abrupt("return", result);
|
|
4104
4292
|
case 14:
|
|
4105
4293
|
case "end":
|
|
4106
|
-
return
|
|
4294
|
+
return _context40.stop();
|
|
4107
4295
|
}
|
|
4108
|
-
},
|
|
4296
|
+
}, _callee40, this);
|
|
4109
4297
|
}));
|
|
4110
|
-
function initWalletData(
|
|
4298
|
+
function initWalletData(_x35) {
|
|
4111
4299
|
return _initWalletData.apply(this, arguments);
|
|
4112
4300
|
}
|
|
4113
4301
|
return initWalletData;
|
|
@@ -4158,23 +4346,23 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4158
4346
|
}, {
|
|
4159
4347
|
key: "publishWalletAssetsState",
|
|
4160
4348
|
value: function () {
|
|
4161
|
-
var _publishWalletAssetsState = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4162
|
-
return _regeneratorRuntime().wrap(function
|
|
4163
|
-
while (1) switch (
|
|
4349
|
+
var _publishWalletAssetsState = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41(state) {
|
|
4350
|
+
return _regeneratorRuntime().wrap(function _callee41$(_context41) {
|
|
4351
|
+
while (1) switch (_context41.prev = _context41.next) {
|
|
4164
4352
|
case 0:
|
|
4165
|
-
|
|
4353
|
+
_context41.next = 2;
|
|
4166
4354
|
return this.effectsEmit(BaseSalesHookNames.onWalletAssetsStateChanged, {
|
|
4167
4355
|
state: state
|
|
4168
4356
|
});
|
|
4169
4357
|
case 2:
|
|
4170
|
-
return
|
|
4358
|
+
return _context41.abrupt("return", state);
|
|
4171
4359
|
case 3:
|
|
4172
4360
|
case "end":
|
|
4173
|
-
return
|
|
4361
|
+
return _context41.stop();
|
|
4174
4362
|
}
|
|
4175
|
-
},
|
|
4363
|
+
}, _callee41, this);
|
|
4176
4364
|
}));
|
|
4177
|
-
function publishWalletAssetsState(
|
|
4365
|
+
function publishWalletAssetsState(_x36) {
|
|
4178
4366
|
return _publishWalletAssetsState.apply(this, arguments);
|
|
4179
4367
|
}
|
|
4180
4368
|
return publishWalletAssetsState;
|
|
@@ -4182,26 +4370,26 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4182
4370
|
}, {
|
|
4183
4371
|
key: "syncSelectedWalletAssets",
|
|
4184
4372
|
value: function () {
|
|
4185
|
-
var _syncSelectedWalletAssets = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4373
|
+
var _syncSelectedWalletAssets = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42(state) {
|
|
4186
4374
|
var paymentMethods, methodByCode, preparePayments, selectedAssetById, voucherPayments, payments;
|
|
4187
|
-
return _regeneratorRuntime().wrap(function
|
|
4188
|
-
while (1) switch (
|
|
4375
|
+
return _regeneratorRuntime().wrap(function _callee42$(_context42) {
|
|
4376
|
+
while (1) switch (_context42.prev = _context42.next) {
|
|
4189
4377
|
case 0:
|
|
4190
4378
|
if (!(!this.store.order || !this.store.payment)) {
|
|
4191
|
-
|
|
4379
|
+
_context42.next = 2;
|
|
4192
4380
|
break;
|
|
4193
4381
|
}
|
|
4194
4382
|
throw new Error('订单或支付模块未初始化');
|
|
4195
4383
|
case 2:
|
|
4196
4384
|
paymentMethods = this.getPaymentMethods();
|
|
4197
4385
|
if (!(!paymentMethods.length && state.selectedItems.length)) {
|
|
4198
|
-
|
|
4386
|
+
_context42.next = 7;
|
|
4199
4387
|
break;
|
|
4200
4388
|
}
|
|
4201
|
-
|
|
4389
|
+
_context42.next = 6;
|
|
4202
4390
|
return this.getPaymentMethodsAsync();
|
|
4203
4391
|
case 6:
|
|
4204
|
-
paymentMethods =
|
|
4392
|
+
paymentMethods = _context42.sent;
|
|
4205
4393
|
case 7:
|
|
4206
4394
|
methodByCode = new Map(paymentMethods.map(function (method) {
|
|
4207
4395
|
return [String(method.code || '').toUpperCase(), method];
|
|
@@ -4243,19 +4431,19 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4243
4431
|
payments = this.updateVoucherOrderPayments(voucherPayments, {
|
|
4244
4432
|
status: 'payment_pending'
|
|
4245
4433
|
});
|
|
4246
|
-
|
|
4434
|
+
_context42.next = 14;
|
|
4247
4435
|
return this.store.order.recalculateSummary({
|
|
4248
4436
|
createIfMissing: true
|
|
4249
4437
|
});
|
|
4250
4438
|
case 14:
|
|
4251
|
-
return
|
|
4439
|
+
return _context42.abrupt("return", payments);
|
|
4252
4440
|
case 15:
|
|
4253
4441
|
case "end":
|
|
4254
|
-
return
|
|
4442
|
+
return _context42.stop();
|
|
4255
4443
|
}
|
|
4256
|
-
},
|
|
4444
|
+
}, _callee42, this);
|
|
4257
4445
|
}));
|
|
4258
|
-
function syncSelectedWalletAssets(
|
|
4446
|
+
function syncSelectedWalletAssets(_x37) {
|
|
4259
4447
|
return _syncSelectedWalletAssets.apply(this, arguments);
|
|
4260
4448
|
}
|
|
4261
4449
|
return syncSelectedWalletAssets;
|
|
@@ -4289,29 +4477,29 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4289
4477
|
}, {
|
|
4290
4478
|
key: "importWalletAssetsSnapshot",
|
|
4291
4479
|
value: (function () {
|
|
4292
|
-
var _importWalletAssetsSnapshot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4480
|
+
var _importWalletAssetsSnapshot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(snapshot) {
|
|
4293
4481
|
var state;
|
|
4294
|
-
return _regeneratorRuntime().wrap(function
|
|
4295
|
-
while (1) switch (
|
|
4482
|
+
return _regeneratorRuntime().wrap(function _callee43$(_context43) {
|
|
4483
|
+
while (1) switch (_context43.prev = _context43.next) {
|
|
4296
4484
|
case 0:
|
|
4297
4485
|
if (this.store.payment) {
|
|
4298
|
-
|
|
4486
|
+
_context43.next = 2;
|
|
4299
4487
|
break;
|
|
4300
4488
|
}
|
|
4301
4489
|
throw new Error('payment 模块未初始化');
|
|
4302
4490
|
case 2:
|
|
4303
4491
|
state = this.store.payment.wallet.importWalletAssetsSnapshot(snapshot);
|
|
4304
|
-
|
|
4492
|
+
_context43.next = 5;
|
|
4305
4493
|
return this.syncSelectedWalletAssets(state);
|
|
4306
4494
|
case 5:
|
|
4307
|
-
return
|
|
4495
|
+
return _context43.abrupt("return", this.publishWalletAssetsState(state));
|
|
4308
4496
|
case 6:
|
|
4309
4497
|
case "end":
|
|
4310
|
-
return
|
|
4498
|
+
return _context43.stop();
|
|
4311
4499
|
}
|
|
4312
|
-
},
|
|
4500
|
+
}, _callee43, this);
|
|
4313
4501
|
}));
|
|
4314
|
-
function importWalletAssetsSnapshot(
|
|
4502
|
+
function importWalletAssetsSnapshot(_x38) {
|
|
4315
4503
|
return _importWalletAssetsSnapshot.apply(this, arguments);
|
|
4316
4504
|
}
|
|
4317
4505
|
return importWalletAssetsSnapshot;
|
|
@@ -4323,20 +4511,20 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4323
4511
|
}, {
|
|
4324
4512
|
key: "refreshWalletAssets",
|
|
4325
4513
|
value: (function () {
|
|
4326
|
-
var _refreshWalletAssets = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4514
|
+
var _refreshWalletAssets = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44(params) {
|
|
4327
4515
|
var _previousState$custom, _businessData$custome;
|
|
4328
4516
|
var refreshSequence, wallet, businessData, emptyState, previousState, hasPreviousWalletContext, customerChanged, clearedState, refreshTask, state, committed;
|
|
4329
|
-
return _regeneratorRuntime().wrap(function
|
|
4330
|
-
while (1) switch (
|
|
4517
|
+
return _regeneratorRuntime().wrap(function _callee44$(_context44) {
|
|
4518
|
+
while (1) switch (_context44.prev = _context44.next) {
|
|
4331
4519
|
case 0:
|
|
4332
4520
|
if (this.store.order) {
|
|
4333
|
-
|
|
4521
|
+
_context44.next = 2;
|
|
4334
4522
|
break;
|
|
4335
4523
|
}
|
|
4336
4524
|
throw new Error('order 模块未初始化');
|
|
4337
4525
|
case 2:
|
|
4338
4526
|
if (this.store.payment) {
|
|
4339
|
-
|
|
4527
|
+
_context44.next = 4;
|
|
4340
4528
|
break;
|
|
4341
4529
|
}
|
|
4342
4530
|
throw new Error('payment 模块未初始化');
|
|
@@ -4345,7 +4533,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4345
4533
|
wallet = this.store.payment.wallet;
|
|
4346
4534
|
businessData = this.buildWalletInitBusinessData(params);
|
|
4347
4535
|
if (businessData) {
|
|
4348
|
-
|
|
4536
|
+
_context44.next = 12;
|
|
4349
4537
|
break;
|
|
4350
4538
|
}
|
|
4351
4539
|
wallet.clearAllCache();
|
|
@@ -4353,53 +4541,53 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4353
4541
|
this.updateVoucherOrderPayments([], {
|
|
4354
4542
|
status: 'payment_pending'
|
|
4355
4543
|
});
|
|
4356
|
-
return
|
|
4544
|
+
return _context44.abrupt("return", this.publishWalletAssetsState(emptyState));
|
|
4357
4545
|
case 12:
|
|
4358
4546
|
previousState = wallet.getWalletAssetsState();
|
|
4359
4547
|
hasPreviousWalletContext = previousState.status !== 'idle' || previousState.items.length > 0 || previousState.selectedIds.length > 0 || previousState.customerId !== undefined;
|
|
4360
4548
|
customerChanged = hasPreviousWalletContext && String((_previousState$custom = previousState.customerId) !== null && _previousState$custom !== void 0 ? _previousState$custom : '') !== String((_businessData$custome = businessData.customer_id) !== null && _businessData$custome !== void 0 ? _businessData$custome : '');
|
|
4361
4549
|
if (!customerChanged) {
|
|
4362
|
-
|
|
4550
|
+
_context44.next = 20;
|
|
4363
4551
|
break;
|
|
4364
4552
|
}
|
|
4365
4553
|
clearedState = wallet.clearWalletAssetSelection();
|
|
4366
4554
|
this.updateVoucherOrderPayments([], {
|
|
4367
4555
|
status: 'payment_pending'
|
|
4368
4556
|
});
|
|
4369
|
-
|
|
4557
|
+
_context44.next = 20;
|
|
4370
4558
|
return this.publishWalletAssetsState(clearedState);
|
|
4371
4559
|
case 20:
|
|
4372
4560
|
refreshTask = wallet.refreshWalletAssetsFromBusinessAsync(businessData, {
|
|
4373
4561
|
preserveSelection: (params === null || params === void 0 ? void 0 : params.preserveSelection) !== false && !customerChanged
|
|
4374
4562
|
});
|
|
4375
|
-
|
|
4563
|
+
_context44.next = 23;
|
|
4376
4564
|
return this.publishWalletAssetsState(wallet.getWalletAssetsState());
|
|
4377
4565
|
case 23:
|
|
4378
|
-
|
|
4566
|
+
_context44.next = 25;
|
|
4379
4567
|
return refreshTask;
|
|
4380
4568
|
case 25:
|
|
4381
|
-
state =
|
|
4569
|
+
state = _context44.sent;
|
|
4382
4570
|
if (!(refreshSequence !== this.walletAssetsRefreshSequence)) {
|
|
4383
|
-
|
|
4571
|
+
_context44.next = 28;
|
|
4384
4572
|
break;
|
|
4385
4573
|
}
|
|
4386
|
-
return
|
|
4574
|
+
return _context44.abrupt("return", wallet.getWalletAssetsState());
|
|
4387
4575
|
case 28:
|
|
4388
4576
|
if (state.status !== 'error') {
|
|
4389
4577
|
committed = this.getCommittedWalletAssets();
|
|
4390
4578
|
state = wallet.setCommittedWalletAssets(committed.ids, committed.assets);
|
|
4391
4579
|
}
|
|
4392
|
-
|
|
4580
|
+
_context44.next = 31;
|
|
4393
4581
|
return this.syncSelectedWalletAssets(state);
|
|
4394
4582
|
case 31:
|
|
4395
|
-
return
|
|
4583
|
+
return _context44.abrupt("return", this.publishWalletAssetsState(state));
|
|
4396
4584
|
case 32:
|
|
4397
4585
|
case "end":
|
|
4398
|
-
return
|
|
4586
|
+
return _context44.stop();
|
|
4399
4587
|
}
|
|
4400
|
-
},
|
|
4588
|
+
}, _callee44, this);
|
|
4401
4589
|
}));
|
|
4402
|
-
function refreshWalletAssets(
|
|
4590
|
+
function refreshWalletAssets(_x39) {
|
|
4403
4591
|
return _refreshWalletAssets.apply(this, arguments);
|
|
4404
4592
|
}
|
|
4405
4593
|
return refreshWalletAssets;
|
|
@@ -4407,13 +4595,13 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4407
4595
|
}, {
|
|
4408
4596
|
key: "selectWalletAsset",
|
|
4409
4597
|
value: (function () {
|
|
4410
|
-
var _selectWalletAsset = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4598
|
+
var _selectWalletAsset = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee45(params) {
|
|
4411
4599
|
var state;
|
|
4412
|
-
return _regeneratorRuntime().wrap(function
|
|
4413
|
-
while (1) switch (
|
|
4600
|
+
return _regeneratorRuntime().wrap(function _callee45$(_context45) {
|
|
4601
|
+
while (1) switch (_context45.prev = _context45.next) {
|
|
4414
4602
|
case 0:
|
|
4415
4603
|
if (this.store.payment) {
|
|
4416
|
-
|
|
4604
|
+
_context45.next = 2;
|
|
4417
4605
|
break;
|
|
4418
4606
|
}
|
|
4419
4607
|
throw new Error('payment 模块未初始化');
|
|
@@ -4422,17 +4610,17 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4422
4610
|
selected: params.selected,
|
|
4423
4611
|
source: params.source
|
|
4424
4612
|
});
|
|
4425
|
-
|
|
4613
|
+
_context45.next = 5;
|
|
4426
4614
|
return this.syncSelectedWalletAssets(state);
|
|
4427
4615
|
case 5:
|
|
4428
|
-
return
|
|
4616
|
+
return _context45.abrupt("return", this.publishWalletAssetsState(state));
|
|
4429
4617
|
case 6:
|
|
4430
4618
|
case "end":
|
|
4431
|
-
return
|
|
4619
|
+
return _context45.stop();
|
|
4432
4620
|
}
|
|
4433
|
-
},
|
|
4621
|
+
}, _callee45, this);
|
|
4434
4622
|
}));
|
|
4435
|
-
function selectWalletAsset(
|
|
4623
|
+
function selectWalletAsset(_x40) {
|
|
4436
4624
|
return _selectWalletAsset.apply(this, arguments);
|
|
4437
4625
|
}
|
|
4438
4626
|
return selectWalletAsset;
|
|
@@ -4440,29 +4628,29 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4440
4628
|
}, {
|
|
4441
4629
|
key: "updateWalletAssetAmount",
|
|
4442
4630
|
value: (function () {
|
|
4443
|
-
var _updateWalletAssetAmount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4631
|
+
var _updateWalletAssetAmount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee46(params) {
|
|
4444
4632
|
var state;
|
|
4445
|
-
return _regeneratorRuntime().wrap(function
|
|
4446
|
-
while (1) switch (
|
|
4633
|
+
return _regeneratorRuntime().wrap(function _callee46$(_context46) {
|
|
4634
|
+
while (1) switch (_context46.prev = _context46.next) {
|
|
4447
4635
|
case 0:
|
|
4448
4636
|
if (this.store.payment) {
|
|
4449
|
-
|
|
4637
|
+
_context46.next = 2;
|
|
4450
4638
|
break;
|
|
4451
4639
|
}
|
|
4452
4640
|
throw new Error('payment 模块未初始化');
|
|
4453
4641
|
case 2:
|
|
4454
4642
|
state = this.store.payment.wallet.updateWalletAssetAmount(params.assetId, params.amount);
|
|
4455
|
-
|
|
4643
|
+
_context46.next = 5;
|
|
4456
4644
|
return this.syncSelectedWalletAssets(state);
|
|
4457
4645
|
case 5:
|
|
4458
|
-
return
|
|
4646
|
+
return _context46.abrupt("return", this.publishWalletAssetsState(state));
|
|
4459
4647
|
case 6:
|
|
4460
4648
|
case "end":
|
|
4461
|
-
return
|
|
4649
|
+
return _context46.stop();
|
|
4462
4650
|
}
|
|
4463
|
-
},
|
|
4651
|
+
}, _callee46, this);
|
|
4464
4652
|
}));
|
|
4465
|
-
function updateWalletAssetAmount(
|
|
4653
|
+
function updateWalletAssetAmount(_x41) {
|
|
4466
4654
|
return _updateWalletAssetAmount.apply(this, arguments);
|
|
4467
4655
|
}
|
|
4468
4656
|
return updateWalletAssetAmount;
|
|
@@ -4470,13 +4658,13 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4470
4658
|
}, {
|
|
4471
4659
|
key: "scanWalletAsset",
|
|
4472
4660
|
value: (function () {
|
|
4473
|
-
var _scanWalletAsset = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4661
|
+
var _scanWalletAsset = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee47(code) {
|
|
4474
4662
|
var wallet, businessData, result;
|
|
4475
|
-
return _regeneratorRuntime().wrap(function
|
|
4476
|
-
while (1) switch (
|
|
4663
|
+
return _regeneratorRuntime().wrap(function _callee47$(_context47) {
|
|
4664
|
+
while (1) switch (_context47.prev = _context47.next) {
|
|
4477
4665
|
case 0:
|
|
4478
4666
|
if (this.store.payment) {
|
|
4479
|
-
|
|
4667
|
+
_context47.next = 2;
|
|
4480
4668
|
break;
|
|
4481
4669
|
}
|
|
4482
4670
|
throw new Error('payment 模块未初始化');
|
|
@@ -4486,28 +4674,28 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4486
4674
|
if (businessData) {
|
|
4487
4675
|
wallet.generateWalletParams(businessData);
|
|
4488
4676
|
}
|
|
4489
|
-
|
|
4677
|
+
_context47.next = 7;
|
|
4490
4678
|
return wallet.scanWalletAssetAsync(code);
|
|
4491
4679
|
case 7:
|
|
4492
|
-
result =
|
|
4680
|
+
result = _context47.sent;
|
|
4493
4681
|
if (!(result.type === 'normalCode')) {
|
|
4494
|
-
|
|
4682
|
+
_context47.next = 13;
|
|
4495
4683
|
break;
|
|
4496
4684
|
}
|
|
4497
|
-
|
|
4685
|
+
_context47.next = 11;
|
|
4498
4686
|
return this.syncSelectedWalletAssets(result.state);
|
|
4499
4687
|
case 11:
|
|
4500
|
-
|
|
4688
|
+
_context47.next = 13;
|
|
4501
4689
|
return this.publishWalletAssetsState(result.state);
|
|
4502
4690
|
case 13:
|
|
4503
|
-
return
|
|
4691
|
+
return _context47.abrupt("return", result);
|
|
4504
4692
|
case 14:
|
|
4505
4693
|
case "end":
|
|
4506
|
-
return
|
|
4694
|
+
return _context47.stop();
|
|
4507
4695
|
}
|
|
4508
|
-
},
|
|
4696
|
+
}, _callee47, this);
|
|
4509
4697
|
}));
|
|
4510
|
-
function scanWalletAsset(
|
|
4698
|
+
function scanWalletAsset(_x42) {
|
|
4511
4699
|
return _scanWalletAsset.apply(this, arguments);
|
|
4512
4700
|
}
|
|
4513
4701
|
return scanWalletAsset;
|
|
@@ -4515,27 +4703,27 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4515
4703
|
}, {
|
|
4516
4704
|
key: "clearWalletAssetSelection",
|
|
4517
4705
|
value: (function () {
|
|
4518
|
-
var _clearWalletAssetSelection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4706
|
+
var _clearWalletAssetSelection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee48() {
|
|
4519
4707
|
var state;
|
|
4520
|
-
return _regeneratorRuntime().wrap(function
|
|
4521
|
-
while (1) switch (
|
|
4708
|
+
return _regeneratorRuntime().wrap(function _callee48$(_context48) {
|
|
4709
|
+
while (1) switch (_context48.prev = _context48.next) {
|
|
4522
4710
|
case 0:
|
|
4523
4711
|
if (this.store.payment) {
|
|
4524
|
-
|
|
4712
|
+
_context48.next = 2;
|
|
4525
4713
|
break;
|
|
4526
4714
|
}
|
|
4527
4715
|
throw new Error('payment 模块未初始化');
|
|
4528
4716
|
case 2:
|
|
4529
4717
|
state = this.store.payment.wallet.clearWalletAssetSelection();
|
|
4530
|
-
|
|
4718
|
+
_context48.next = 5;
|
|
4531
4719
|
return this.syncSelectedWalletAssets(state);
|
|
4532
4720
|
case 5:
|
|
4533
|
-
return
|
|
4721
|
+
return _context48.abrupt("return", this.publishWalletAssetsState(state));
|
|
4534
4722
|
case 6:
|
|
4535
4723
|
case "end":
|
|
4536
|
-
return
|
|
4724
|
+
return _context48.stop();
|
|
4537
4725
|
}
|
|
4538
|
-
},
|
|
4726
|
+
}, _callee48, this);
|
|
4539
4727
|
}));
|
|
4540
4728
|
function clearWalletAssetSelection() {
|
|
4541
4729
|
return _clearWalletAssetSelection.apply(this, arguments);
|
|
@@ -4565,35 +4753,35 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4565
4753
|
}, {
|
|
4566
4754
|
key: "getPaymentMethodsAsync",
|
|
4567
4755
|
value: (function () {
|
|
4568
|
-
var _getPaymentMethodsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4756
|
+
var _getPaymentMethodsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee49() {
|
|
4569
4757
|
var response, paymentMethods;
|
|
4570
|
-
return _regeneratorRuntime().wrap(function
|
|
4571
|
-
while (1) switch (
|
|
4758
|
+
return _regeneratorRuntime().wrap(function _callee49$(_context49) {
|
|
4759
|
+
while (1) switch (_context49.prev = _context49.next) {
|
|
4572
4760
|
case 0:
|
|
4573
|
-
|
|
4574
|
-
|
|
4761
|
+
_context49.prev = 0;
|
|
4762
|
+
_context49.next = 3;
|
|
4575
4763
|
return this.request.get('/pay/custom-payment/all', {
|
|
4576
4764
|
filterPaymentMethods: true
|
|
4577
4765
|
}, {
|
|
4578
4766
|
osServer: true
|
|
4579
4767
|
});
|
|
4580
4768
|
case 3:
|
|
4581
|
-
response =
|
|
4769
|
+
response = _context49.sent;
|
|
4582
4770
|
paymentMethods = (response === null || response === void 0 ? void 0 : response.data) || [];
|
|
4583
4771
|
this.paymentMethodsCache = Array.isArray(paymentMethods) ? _toConsumableArray(paymentMethods) : [];
|
|
4584
|
-
return
|
|
4772
|
+
return _context49.abrupt("return", this.getPaymentMethods());
|
|
4585
4773
|
case 9:
|
|
4586
|
-
|
|
4587
|
-
|
|
4774
|
+
_context49.prev = 9;
|
|
4775
|
+
_context49.t0 = _context49["catch"](0);
|
|
4588
4776
|
this.logWarning('getPaymentMethodsAsync: 获取支付方式列表失败,使用缓存列表', {
|
|
4589
|
-
error:
|
|
4777
|
+
error: _context49.t0 instanceof Error ? _context49.t0.message : String(_context49.t0)
|
|
4590
4778
|
});
|
|
4591
|
-
return
|
|
4779
|
+
return _context49.abrupt("return", this.getPaymentMethods());
|
|
4592
4780
|
case 13:
|
|
4593
4781
|
case "end":
|
|
4594
|
-
return
|
|
4782
|
+
return _context49.stop();
|
|
4595
4783
|
}
|
|
4596
|
-
},
|
|
4784
|
+
}, _callee49, this, [[0, 9]]);
|
|
4597
4785
|
}));
|
|
4598
4786
|
function getPaymentMethodsAsync() {
|
|
4599
4787
|
return _getPaymentMethodsAsync.apply(this, arguments);
|
|
@@ -4636,14 +4824,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4636
4824
|
}, {
|
|
4637
4825
|
key: "getCashPaymentConfig",
|
|
4638
4826
|
value: (function () {
|
|
4639
|
-
var _getCashPaymentConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4827
|
+
var _getCashPaymentConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee50() {
|
|
4640
4828
|
var _this$store$order11, _this$store$order11$g, _this$store$order12, _this$store$order12$g, _this$otherParams33;
|
|
4641
4829
|
var paymentMethods, paymentMethod, amountSnapshot, pendingWalletAmount, amountDue, currency, recommendedAmounts;
|
|
4642
|
-
return _regeneratorRuntime().wrap(function
|
|
4643
|
-
while (1) switch (
|
|
4830
|
+
return _regeneratorRuntime().wrap(function _callee50$(_context50) {
|
|
4831
|
+
while (1) switch (_context50.prev = _context50.next) {
|
|
4644
4832
|
case 0:
|
|
4645
4833
|
if (this.store.payment) {
|
|
4646
|
-
|
|
4834
|
+
_context50.next = 2;
|
|
4647
4835
|
break;
|
|
4648
4836
|
}
|
|
4649
4837
|
throw new Error('payment 模块未初始化');
|
|
@@ -4651,13 +4839,13 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4651
4839
|
paymentMethods = this.getPaymentMethods();
|
|
4652
4840
|
paymentMethod = this.findCashPaymentMethod(paymentMethods);
|
|
4653
4841
|
if (paymentMethod) {
|
|
4654
|
-
|
|
4842
|
+
_context50.next = 9;
|
|
4655
4843
|
break;
|
|
4656
4844
|
}
|
|
4657
|
-
|
|
4845
|
+
_context50.next = 7;
|
|
4658
4846
|
return this.getPaymentMethodsAsync();
|
|
4659
4847
|
case 7:
|
|
4660
|
-
paymentMethods =
|
|
4848
|
+
paymentMethods = _context50.sent;
|
|
4661
4849
|
paymentMethod = this.findCashPaymentMethod(paymentMethods);
|
|
4662
4850
|
case 9:
|
|
4663
4851
|
amountSnapshot = (_this$store$order11 = this.store.order) === null || _this$store$order11 === void 0 || (_this$store$order11$g = _this$store$order11.getOrderAmountSnapshot) === null || _this$store$order11$g === void 0 ? void 0 : _this$store$order11$g.call(_this$store$order11);
|
|
@@ -4665,7 +4853,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4665
4853
|
amountDue = Decimal.max(new Decimal((amountSnapshot === null || amountSnapshot === void 0 ? void 0 : amountSnapshot.amountGap) || 0).minus(pendingWalletAmount), 0).toDecimalPlaces(2).toNumber();
|
|
4666
4854
|
currency = ((_this$store$order12 = this.store.order) === null || _this$store$order12 === void 0 || (_this$store$order12$g = _this$store$order12.getTempOrder) === null || _this$store$order12$g === void 0 || (_this$store$order12$g = _this$store$order12$g.call(_this$store$order12)) === null || _this$store$order12$g === void 0 ? void 0 : _this$store$order12$g.currency_code) || ((_this$otherParams33 = this.otherParams) === null || _this$otherParams33 === void 0 ? void 0 : _this$otherParams33.currency) || 'USD';
|
|
4667
4855
|
recommendedAmounts = amountDue > 0 ? this.store.payment.cash.getRecommendedAmount(amountDue, currency) : [];
|
|
4668
|
-
return
|
|
4856
|
+
return _context50.abrupt("return", {
|
|
4669
4857
|
available: Boolean(paymentMethod && amountDue > 0),
|
|
4670
4858
|
paymentMethod: paymentMethod,
|
|
4671
4859
|
amountDue: amountDue,
|
|
@@ -4673,9 +4861,9 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4673
4861
|
});
|
|
4674
4862
|
case 15:
|
|
4675
4863
|
case "end":
|
|
4676
|
-
return
|
|
4864
|
+
return _context50.stop();
|
|
4677
4865
|
}
|
|
4678
|
-
},
|
|
4866
|
+
}, _callee50, this);
|
|
4679
4867
|
}));
|
|
4680
4868
|
function getCashPaymentConfig() {
|
|
4681
4869
|
return _getCashPaymentConfig.apply(this, arguments);
|
|
@@ -4692,14 +4880,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4692
4880
|
}, {
|
|
4693
4881
|
key: "confirmWalletPayment",
|
|
4694
4882
|
value: (function () {
|
|
4695
|
-
var _confirmWalletPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4883
|
+
var _confirmWalletPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee51() {
|
|
4696
4884
|
var _this$store$order$get3, _this$store$order13, _this$store$order$get4, _this$store$order$get5, _this$store$order14;
|
|
4697
4885
|
var beforePayments, pendingWalletAmount, amountSnapshot, effectiveAmountDue, beforePaymentStatus, submitResult, restoredTempOrder, committed, walletState, latestAmountSnapshot;
|
|
4698
|
-
return _regeneratorRuntime().wrap(function
|
|
4699
|
-
while (1) switch (
|
|
4886
|
+
return _regeneratorRuntime().wrap(function _callee51$(_context51) {
|
|
4887
|
+
while (1) switch (_context51.prev = _context51.next) {
|
|
4700
4888
|
case 0:
|
|
4701
4889
|
if (this.store.order) {
|
|
4702
|
-
|
|
4890
|
+
_context51.next = 2;
|
|
4703
4891
|
break;
|
|
4704
4892
|
}
|
|
4705
4893
|
throw new Error('order 模块未初始化');
|
|
@@ -4707,7 +4895,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4707
4895
|
beforePayments = cloneDeep(this.store.order.getOrderPayments());
|
|
4708
4896
|
pendingWalletAmount = this.getPendingWalletPaymentAmount(beforePayments);
|
|
4709
4897
|
if (!pendingWalletAmount.lte(0)) {
|
|
4710
|
-
|
|
4898
|
+
_context51.next = 6;
|
|
4711
4899
|
break;
|
|
4712
4900
|
}
|
|
4713
4901
|
throw new Error('当前订单没有待确认的 Wallet 支付');
|
|
@@ -4715,74 +4903,74 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4715
4903
|
amountSnapshot = (_this$store$order$get3 = (_this$store$order13 = this.store.order).getOrderAmountSnapshot) === null || _this$store$order$get3 === void 0 ? void 0 : _this$store$order$get3.call(_this$store$order13);
|
|
4716
4904
|
effectiveAmountDue = Decimal.max(new Decimal((amountSnapshot === null || amountSnapshot === void 0 ? void 0 : amountSnapshot.amountGap) || 0).minus(pendingWalletAmount), 0);
|
|
4717
4905
|
if (!effectiveAmountDue.gt(0.01)) {
|
|
4718
|
-
|
|
4906
|
+
_context51.next = 10;
|
|
4719
4907
|
break;
|
|
4720
4908
|
}
|
|
4721
4909
|
throw new Error('Wallet 支付尚未覆盖全部待支付金额');
|
|
4722
4910
|
case 10:
|
|
4723
4911
|
beforePaymentStatus = (_this$store$order$get4 = this.store.order.getTempOrder()) === null || _this$store$order$get4 === void 0 ? void 0 : _this$store$order$get4.payment_status;
|
|
4724
|
-
|
|
4725
|
-
|
|
4912
|
+
_context51.prev = 11;
|
|
4913
|
+
_context51.next = 14;
|
|
4726
4914
|
return this.submitSalesOrder({
|
|
4727
4915
|
smallTicketDataFlag: 1,
|
|
4728
4916
|
confirmPendingVoucherPayments: true
|
|
4729
4917
|
});
|
|
4730
4918
|
case 14:
|
|
4731
|
-
submitResult =
|
|
4919
|
+
submitResult = _context51.sent;
|
|
4732
4920
|
if (!isRejectedSalesSubmitResult(submitResult)) {
|
|
4733
|
-
|
|
4921
|
+
_context51.next = 17;
|
|
4734
4922
|
break;
|
|
4735
4923
|
}
|
|
4736
4924
|
throw new Error(getSalesSubmitErrorMessage(submitResult, 'Wallet 支付确认失败'));
|
|
4737
4925
|
case 17:
|
|
4738
|
-
|
|
4926
|
+
_context51.next = 27;
|
|
4739
4927
|
break;
|
|
4740
4928
|
case 19:
|
|
4741
|
-
|
|
4742
|
-
|
|
4929
|
+
_context51.prev = 19;
|
|
4930
|
+
_context51.t0 = _context51["catch"](11);
|
|
4743
4931
|
this.store.order.setOrderPayments(beforePayments);
|
|
4744
4932
|
restoredTempOrder = this.store.order.getTempOrder();
|
|
4745
4933
|
if (restoredTempOrder && beforePaymentStatus !== undefined) {
|
|
4746
4934
|
restoredTempOrder.payment_status = beforePaymentStatus;
|
|
4747
4935
|
this.store.order.persistTempOrder();
|
|
4748
4936
|
}
|
|
4749
|
-
|
|
4937
|
+
_context51.next = 26;
|
|
4750
4938
|
return this.store.order.recalculateSummary({
|
|
4751
4939
|
createIfMissing: true
|
|
4752
4940
|
});
|
|
4753
4941
|
case 26:
|
|
4754
|
-
throw
|
|
4942
|
+
throw _context51.t0;
|
|
4755
4943
|
case 27:
|
|
4756
4944
|
if (!this.store.payment) {
|
|
4757
|
-
|
|
4945
|
+
_context51.next = 38;
|
|
4758
4946
|
break;
|
|
4759
4947
|
}
|
|
4760
|
-
|
|
4948
|
+
_context51.prev = 28;
|
|
4761
4949
|
committed = this.getCommittedWalletAssets();
|
|
4762
4950
|
walletState = this.store.payment.wallet.setCommittedWalletAssets(committed.ids, committed.assets);
|
|
4763
|
-
|
|
4951
|
+
_context51.next = 33;
|
|
4764
4952
|
return this.publishWalletAssetsState(walletState);
|
|
4765
4953
|
case 33:
|
|
4766
|
-
|
|
4954
|
+
_context51.next = 38;
|
|
4767
4955
|
break;
|
|
4768
4956
|
case 35:
|
|
4769
|
-
|
|
4770
|
-
|
|
4957
|
+
_context51.prev = 35;
|
|
4958
|
+
_context51.t1 = _context51["catch"](28);
|
|
4771
4959
|
this.logWarning('confirmWalletPayment: Wallet committed 状态同步失败', {
|
|
4772
|
-
error:
|
|
4960
|
+
error: _context51.t1 instanceof Error ? _context51.t1.message : String(_context51.t1)
|
|
4773
4961
|
});
|
|
4774
4962
|
case 38:
|
|
4775
4963
|
latestAmountSnapshot = (_this$store$order$get5 = (_this$store$order14 = this.store.order).getOrderAmountSnapshot) === null || _this$store$order$get5 === void 0 ? void 0 : _this$store$order$get5.call(_this$store$order14);
|
|
4776
|
-
return
|
|
4964
|
+
return _context51.abrupt("return", {
|
|
4777
4965
|
submitResult: submitResult,
|
|
4778
4966
|
payments: this.store.order.getOrderPayments(),
|
|
4779
4967
|
isOrderFullyPaid: new Decimal((latestAmountSnapshot === null || latestAmountSnapshot === void 0 ? void 0 : latestAmountSnapshot.amountGap) || 0).lte(0)
|
|
4780
4968
|
});
|
|
4781
4969
|
case 40:
|
|
4782
4970
|
case "end":
|
|
4783
|
-
return
|
|
4971
|
+
return _context51.stop();
|
|
4784
4972
|
}
|
|
4785
|
-
},
|
|
4973
|
+
}, _callee51, this, [[11, 19], [28, 35]]);
|
|
4786
4974
|
}));
|
|
4787
4975
|
function confirmWalletPayment() {
|
|
4788
4976
|
return _confirmWalletPayment.apply(this, arguments);
|
|
@@ -4797,38 +4985,38 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4797
4985
|
}, {
|
|
4798
4986
|
key: "payCash",
|
|
4799
4987
|
value: (function () {
|
|
4800
|
-
var _payCash = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4988
|
+
var _payCash = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee52(params) {
|
|
4801
4989
|
var _this$store$order$get6, _params$actualPaidAmo, _this$otherParams34, _this$window, _this$window$postMess;
|
|
4802
4990
|
var amount, config, paymentMethod, roundingAmount, effectivePaymentAmount, beforePayments, beforePaymentStatus, uniquePaymentNumber, paymentTimestamp, actualPaidAmount, changeAmount, shopWalletPassId, payments, payment, syncResult, committed, walletState, restoredTempOrder;
|
|
4803
|
-
return _regeneratorRuntime().wrap(function
|
|
4804
|
-
while (1) switch (
|
|
4991
|
+
return _regeneratorRuntime().wrap(function _callee52$(_context52) {
|
|
4992
|
+
while (1) switch (_context52.prev = _context52.next) {
|
|
4805
4993
|
case 0:
|
|
4806
4994
|
if (this.store.order) {
|
|
4807
|
-
|
|
4995
|
+
_context52.next = 2;
|
|
4808
4996
|
break;
|
|
4809
4997
|
}
|
|
4810
4998
|
throw new Error('order 模块未初始化');
|
|
4811
4999
|
case 2:
|
|
4812
5000
|
amount = Number(params.amount || 0);
|
|
4813
5001
|
if (!(!Number.isFinite(amount) || amount <= 0)) {
|
|
4814
|
-
|
|
5002
|
+
_context52.next = 5;
|
|
4815
5003
|
break;
|
|
4816
5004
|
}
|
|
4817
5005
|
throw new Error('现金支付金额必须大于 0');
|
|
4818
5006
|
case 5:
|
|
4819
|
-
|
|
5007
|
+
_context52.next = 7;
|
|
4820
5008
|
return this.getCashPaymentConfig();
|
|
4821
5009
|
case 7:
|
|
4822
|
-
config =
|
|
5010
|
+
config = _context52.sent;
|
|
4823
5011
|
paymentMethod = config.paymentMethod;
|
|
4824
5012
|
if (paymentMethod) {
|
|
4825
|
-
|
|
5013
|
+
_context52.next = 11;
|
|
4826
5014
|
break;
|
|
4827
5015
|
}
|
|
4828
5016
|
throw new Error('未找到可用的 CASHMANUAL 支付方式');
|
|
4829
5017
|
case 11:
|
|
4830
5018
|
if (!(config.amountDue <= 0)) {
|
|
4831
|
-
|
|
5019
|
+
_context52.next = 13;
|
|
4832
5020
|
break;
|
|
4833
5021
|
}
|
|
4834
5022
|
throw new Error('当前订单没有待支付金额');
|
|
@@ -4836,7 +5024,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4836
5024
|
roundingAmount = Number(params.roundingAmount || 0);
|
|
4837
5025
|
effectivePaymentAmount = new Decimal(amount).minus(roundingAmount);
|
|
4838
5026
|
if (!effectivePaymentAmount.gt(new Decimal(config.amountDue).plus(0.01))) {
|
|
4839
|
-
|
|
5027
|
+
_context52.next = 17;
|
|
4840
5028
|
break;
|
|
4841
5029
|
}
|
|
4842
5030
|
throw new Error('现金支付金额超过当前待支付金额');
|
|
@@ -4849,7 +5037,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4849
5037
|
changeAmount = Number(params.changeAmount || 0);
|
|
4850
5038
|
shopWalletPassId = (_this$otherParams34 = this.otherParams) === null || _this$otherParams34 === void 0 ? void 0 : _this$otherParams34.shop_wallet_pass_id;
|
|
4851
5039
|
if (!(!Number.isFinite(actualPaidAmount) || actualPaidAmount + 0.01 < amount)) {
|
|
4852
|
-
|
|
5040
|
+
_context52.next = 26;
|
|
4853
5041
|
break;
|
|
4854
5042
|
}
|
|
4855
5043
|
throw new Error('顾客实收现金不能小于支付金额');
|
|
@@ -4884,8 +5072,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4884
5072
|
var _item$metadata2;
|
|
4885
5073
|
return (item === null || item === void 0 || (_item$metadata2 = item.metadata) === null || _item$metadata2 === void 0 ? void 0 : _item$metadata2.unique_payment_number) === uniquePaymentNumber;
|
|
4886
5074
|
});
|
|
4887
|
-
|
|
4888
|
-
|
|
5075
|
+
_context52.prev = 29;
|
|
5076
|
+
_context52.next = 32;
|
|
4889
5077
|
return this.syncPaymentsToOrder({
|
|
4890
5078
|
payments: payments,
|
|
4891
5079
|
submitWhenPaid: true,
|
|
@@ -4893,50 +5081,50 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4893
5081
|
confirmPendingVoucherPayments: true
|
|
4894
5082
|
});
|
|
4895
5083
|
case 32:
|
|
4896
|
-
syncResult =
|
|
5084
|
+
syncResult = _context52.sent;
|
|
4897
5085
|
if (!isRejectedSalesSubmitResult(syncResult.submitResult)) {
|
|
4898
|
-
|
|
5086
|
+
_context52.next = 35;
|
|
4899
5087
|
break;
|
|
4900
5088
|
}
|
|
4901
5089
|
throw new Error(getSalesSubmitErrorMessage(syncResult.submitResult, '订单提交失败'));
|
|
4902
5090
|
case 35:
|
|
4903
5091
|
if (!this.store.payment) {
|
|
4904
|
-
|
|
5092
|
+
_context52.next = 40;
|
|
4905
5093
|
break;
|
|
4906
5094
|
}
|
|
4907
5095
|
committed = this.getCommittedWalletAssets();
|
|
4908
5096
|
walletState = this.store.payment.wallet.setCommittedWalletAssets(committed.ids, committed.assets);
|
|
4909
|
-
|
|
5097
|
+
_context52.next = 40;
|
|
4910
5098
|
return this.publishWalletAssetsState(walletState);
|
|
4911
5099
|
case 40:
|
|
4912
|
-
return
|
|
5100
|
+
return _context52.abrupt("return", {
|
|
4913
5101
|
payment: payment || {},
|
|
4914
5102
|
payments: this.store.order.getOrderPayments(),
|
|
4915
5103
|
syncResult: syncResult,
|
|
4916
5104
|
isOrderFullyPaid: syncResult.isOrderFullyPaid
|
|
4917
5105
|
});
|
|
4918
5106
|
case 43:
|
|
4919
|
-
|
|
4920
|
-
|
|
5107
|
+
_context52.prev = 43;
|
|
5108
|
+
_context52.t0 = _context52["catch"](29);
|
|
4921
5109
|
this.store.order.setOrderPayments(beforePayments);
|
|
4922
5110
|
restoredTempOrder = this.store.order.getTempOrder();
|
|
4923
5111
|
if (restoredTempOrder && beforePaymentStatus !== undefined) {
|
|
4924
5112
|
restoredTempOrder.payment_status = beforePaymentStatus;
|
|
4925
5113
|
this.store.order.persistTempOrder();
|
|
4926
5114
|
}
|
|
4927
|
-
|
|
5115
|
+
_context52.next = 50;
|
|
4928
5116
|
return this.store.order.recalculateSummary({
|
|
4929
5117
|
createIfMissing: true
|
|
4930
5118
|
});
|
|
4931
5119
|
case 50:
|
|
4932
|
-
throw
|
|
5120
|
+
throw _context52.t0;
|
|
4933
5121
|
case 51:
|
|
4934
5122
|
case "end":
|
|
4935
|
-
return
|
|
5123
|
+
return _context52.stop();
|
|
4936
5124
|
}
|
|
4937
|
-
},
|
|
5125
|
+
}, _callee52, this, [[29, 43]]);
|
|
4938
5126
|
}));
|
|
4939
|
-
function payCash(
|
|
5127
|
+
function payCash(_x43) {
|
|
4940
5128
|
return _payCash.apply(this, arguments);
|
|
4941
5129
|
}
|
|
4942
5130
|
return payCash;
|
|
@@ -4952,21 +5140,21 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4952
5140
|
}, {
|
|
4953
5141
|
key: "commitPaymentMethodPayment",
|
|
4954
5142
|
value: (function () {
|
|
4955
|
-
var _commitPaymentMethodPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5143
|
+
var _commitPaymentMethodPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee53(params) {
|
|
4956
5144
|
var _this$store$order$get7, _this$store$order15, _this$store$order$get8, _params$metadata, _params$originAmount;
|
|
4957
5145
|
var amount, paymentMethods, findPaymentMethod, paymentMethod, amountSnapshot, pendingWalletAmount, amountDue, beforePayments, beforePaymentStatus, paymentTimestamp, metadata, serviceCharge, serviceFee, payments, payment, syncResult, committed, walletState, restoredTempOrder;
|
|
4958
|
-
return _regeneratorRuntime().wrap(function
|
|
4959
|
-
while (1) switch (
|
|
5146
|
+
return _regeneratorRuntime().wrap(function _callee53$(_context53) {
|
|
5147
|
+
while (1) switch (_context53.prev = _context53.next) {
|
|
4960
5148
|
case 0:
|
|
4961
5149
|
if (this.store.order) {
|
|
4962
|
-
|
|
5150
|
+
_context53.next = 2;
|
|
4963
5151
|
break;
|
|
4964
5152
|
}
|
|
4965
5153
|
throw new Error('order 模块未初始化');
|
|
4966
5154
|
case 2:
|
|
4967
5155
|
amount = Number(params.amount || 0);
|
|
4968
5156
|
if (!(!Number.isFinite(amount) || amount <= 0)) {
|
|
4969
|
-
|
|
5157
|
+
_context53.next = 5;
|
|
4970
5158
|
break;
|
|
4971
5159
|
}
|
|
4972
5160
|
throw new Error('支付金额必须大于 0');
|
|
@@ -4982,17 +5170,17 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4982
5170
|
};
|
|
4983
5171
|
paymentMethod = findPaymentMethod();
|
|
4984
5172
|
if (paymentMethod) {
|
|
4985
|
-
|
|
5173
|
+
_context53.next = 13;
|
|
4986
5174
|
break;
|
|
4987
5175
|
}
|
|
4988
|
-
|
|
5176
|
+
_context53.next = 11;
|
|
4989
5177
|
return this.getPaymentMethodsAsync();
|
|
4990
5178
|
case 11:
|
|
4991
|
-
paymentMethods =
|
|
5179
|
+
paymentMethods = _context53.sent;
|
|
4992
5180
|
paymentMethod = findPaymentMethod();
|
|
4993
5181
|
case 13:
|
|
4994
5182
|
if (paymentMethod) {
|
|
4995
|
-
|
|
5183
|
+
_context53.next = 15;
|
|
4996
5184
|
break;
|
|
4997
5185
|
}
|
|
4998
5186
|
throw new Error("\u672A\u627E\u5230\u53EF\u7528\u7684\u652F\u4ED8\u65B9\u5F0F\uFF1A".concat(params.paymentMethodCode || params.paymentMethodId || ''));
|
|
@@ -5001,13 +5189,13 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5001
5189
|
pendingWalletAmount = this.getPendingWalletPaymentAmount();
|
|
5002
5190
|
amountDue = Decimal.max(new Decimal((amountSnapshot === null || amountSnapshot === void 0 ? void 0 : amountSnapshot.amountGap) || 0).minus(pendingWalletAmount), 0);
|
|
5003
5191
|
if (!amountDue.lte(0)) {
|
|
5004
|
-
|
|
5192
|
+
_context53.next = 20;
|
|
5005
5193
|
break;
|
|
5006
5194
|
}
|
|
5007
5195
|
throw new Error('当前订单没有待支付金额');
|
|
5008
5196
|
case 20:
|
|
5009
5197
|
if (!new Decimal(amount).gt(amountDue.plus(0.01))) {
|
|
5010
|
-
|
|
5198
|
+
_context53.next = 22;
|
|
5011
5199
|
break;
|
|
5012
5200
|
}
|
|
5013
5201
|
throw new Error('支付金额超过当前待支付金额');
|
|
@@ -5046,8 +5234,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5046
5234
|
var _item$metadata3;
|
|
5047
5235
|
return (item === null || item === void 0 || (_item$metadata3 = item.metadata) === null || _item$metadata3 === void 0 ? void 0 : _item$metadata3.unique_payment_number) === metadata.unique_payment_number;
|
|
5048
5236
|
});
|
|
5049
|
-
|
|
5050
|
-
|
|
5237
|
+
_context53.prev = 30;
|
|
5238
|
+
_context53.next = 33;
|
|
5051
5239
|
return this.syncPaymentsToOrder({
|
|
5052
5240
|
payments: payments,
|
|
5053
5241
|
submitWhenPaid: true,
|
|
@@ -5055,50 +5243,50 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5055
5243
|
confirmPendingVoucherPayments: true
|
|
5056
5244
|
});
|
|
5057
5245
|
case 33:
|
|
5058
|
-
syncResult =
|
|
5246
|
+
syncResult = _context53.sent;
|
|
5059
5247
|
if (!isRejectedSalesSubmitResult(syncResult.submitResult)) {
|
|
5060
|
-
|
|
5248
|
+
_context53.next = 36;
|
|
5061
5249
|
break;
|
|
5062
5250
|
}
|
|
5063
5251
|
throw new Error(getSalesSubmitErrorMessage(syncResult.submitResult, '订单提交失败'));
|
|
5064
5252
|
case 36:
|
|
5065
5253
|
if (!this.store.payment) {
|
|
5066
|
-
|
|
5254
|
+
_context53.next = 41;
|
|
5067
5255
|
break;
|
|
5068
5256
|
}
|
|
5069
5257
|
committed = this.getCommittedWalletAssets();
|
|
5070
5258
|
walletState = this.store.payment.wallet.setCommittedWalletAssets(committed.ids, committed.assets);
|
|
5071
|
-
|
|
5259
|
+
_context53.next = 41;
|
|
5072
5260
|
return this.publishWalletAssetsState(walletState);
|
|
5073
5261
|
case 41:
|
|
5074
|
-
return
|
|
5262
|
+
return _context53.abrupt("return", {
|
|
5075
5263
|
payment: payment || {},
|
|
5076
5264
|
payments: this.store.order.getOrderPayments(),
|
|
5077
5265
|
syncResult: syncResult,
|
|
5078
5266
|
isOrderFullyPaid: syncResult.isOrderFullyPaid
|
|
5079
5267
|
});
|
|
5080
5268
|
case 44:
|
|
5081
|
-
|
|
5082
|
-
|
|
5269
|
+
_context53.prev = 44;
|
|
5270
|
+
_context53.t0 = _context53["catch"](30);
|
|
5083
5271
|
this.store.order.setOrderPayments(beforePayments);
|
|
5084
5272
|
restoredTempOrder = this.store.order.getTempOrder();
|
|
5085
5273
|
if (restoredTempOrder && beforePaymentStatus !== undefined) {
|
|
5086
5274
|
restoredTempOrder.payment_status = beforePaymentStatus;
|
|
5087
5275
|
this.store.order.persistTempOrder();
|
|
5088
5276
|
}
|
|
5089
|
-
|
|
5277
|
+
_context53.next = 51;
|
|
5090
5278
|
return this.store.order.recalculateSummary({
|
|
5091
5279
|
createIfMissing: true
|
|
5092
5280
|
});
|
|
5093
5281
|
case 51:
|
|
5094
|
-
throw
|
|
5282
|
+
throw _context53.t0;
|
|
5095
5283
|
case 52:
|
|
5096
5284
|
case "end":
|
|
5097
|
-
return
|
|
5285
|
+
return _context53.stop();
|
|
5098
5286
|
}
|
|
5099
|
-
},
|
|
5287
|
+
}, _callee53, this, [[30, 44]]);
|
|
5100
5288
|
}));
|
|
5101
|
-
function commitPaymentMethodPayment(
|
|
5289
|
+
function commitPaymentMethodPayment(_x44) {
|
|
5102
5290
|
return _commitPaymentMethodPayment.apply(this, arguments);
|
|
5103
5291
|
}
|
|
5104
5292
|
return commitPaymentMethodPayment;
|
|
@@ -5113,40 +5301,40 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5113
5301
|
}, {
|
|
5114
5302
|
key: "roundAmount",
|
|
5115
5303
|
value: (function () {
|
|
5116
|
-
var _roundAmount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5304
|
+
var _roundAmount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee54(params) {
|
|
5117
5305
|
var _cashManualPayment$me, _this$otherParams$ord2, _this$otherParams$ord3;
|
|
5118
5306
|
var amount, cashManualPayment;
|
|
5119
|
-
return _regeneratorRuntime().wrap(function
|
|
5120
|
-
while (1) switch (
|
|
5307
|
+
return _regeneratorRuntime().wrap(function _callee54$(_context54) {
|
|
5308
|
+
while (1) switch (_context54.prev = _context54.next) {
|
|
5121
5309
|
case 0:
|
|
5122
5310
|
amount = params.amount;
|
|
5123
5311
|
cashManualPayment = this.paymentMethodsCache.find(function (paymentMethod) {
|
|
5124
5312
|
return paymentMethod.code === 'CASHMANUAL';
|
|
5125
5313
|
});
|
|
5126
5314
|
if (cashManualPayment !== null && cashManualPayment !== void 0 && (_cashManualPayment$me = cashManualPayment.metadata) !== null && _cashManualPayment$me !== void 0 && _cashManualPayment$me.order_rounding_switch) {
|
|
5127
|
-
|
|
5315
|
+
_context54.next = 4;
|
|
5128
5316
|
break;
|
|
5129
5317
|
}
|
|
5130
|
-
return
|
|
5318
|
+
return _context54.abrupt("return", {
|
|
5131
5319
|
originalAmount: amount.toString(),
|
|
5132
5320
|
roundedAmount: amount.toString(),
|
|
5133
5321
|
roundingDifference: '0.00'
|
|
5134
5322
|
});
|
|
5135
5323
|
case 4:
|
|
5136
5324
|
if (this.payment) {
|
|
5137
|
-
|
|
5325
|
+
_context54.next = 6;
|
|
5138
5326
|
break;
|
|
5139
5327
|
}
|
|
5140
5328
|
throw new Error('payment 模块未初始化');
|
|
5141
5329
|
case 6:
|
|
5142
|
-
return
|
|
5330
|
+
return _context54.abrupt("return", this.payment.roundAmountAsync(amount, (_this$otherParams$ord2 = this.otherParams.order_rounding_setting) === null || _this$otherParams$ord2 === void 0 ? void 0 : _this$otherParams$ord2.interval, (_this$otherParams$ord3 = this.otherParams.order_rounding_setting) === null || _this$otherParams$ord3 === void 0 ? void 0 : _this$otherParams$ord3.type));
|
|
5143
5331
|
case 7:
|
|
5144
5332
|
case "end":
|
|
5145
|
-
return
|
|
5333
|
+
return _context54.stop();
|
|
5146
5334
|
}
|
|
5147
|
-
},
|
|
5335
|
+
}, _callee54, this);
|
|
5148
5336
|
}));
|
|
5149
|
-
function roundAmount(
|
|
5337
|
+
function roundAmount(_x45) {
|
|
5150
5338
|
return _roundAmount.apply(this, arguments);
|
|
5151
5339
|
}
|
|
5152
5340
|
return roundAmount;
|
|
@@ -5161,49 +5349,49 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5161
5349
|
}, {
|
|
5162
5350
|
key: "sendCustomerPayLink",
|
|
5163
5351
|
value: (function () {
|
|
5164
|
-
var _sendCustomerPayLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5352
|
+
var _sendCustomerPayLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee55(params) {
|
|
5165
5353
|
var orderIds, _ref41, _ref42, _submitResult$data$or, _submitResult$data, _submitResult$data2, submitResult, orderId;
|
|
5166
|
-
return _regeneratorRuntime().wrap(function
|
|
5167
|
-
while (1) switch (
|
|
5354
|
+
return _regeneratorRuntime().wrap(function _callee55$(_context55) {
|
|
5355
|
+
while (1) switch (_context55.prev = _context55.next) {
|
|
5168
5356
|
case 0:
|
|
5169
5357
|
if (this.store.order) {
|
|
5170
|
-
|
|
5358
|
+
_context55.next = 2;
|
|
5171
5359
|
break;
|
|
5172
5360
|
}
|
|
5173
5361
|
throw new Error('order 模块未初始化');
|
|
5174
5362
|
case 2:
|
|
5175
5363
|
orderIds = params.order_ids || params.orderIds || [];
|
|
5176
5364
|
if (!(!orderIds.length || params.submitBeforeSend)) {
|
|
5177
|
-
|
|
5365
|
+
_context55.next = 11;
|
|
5178
5366
|
break;
|
|
5179
5367
|
}
|
|
5180
|
-
|
|
5368
|
+
_context55.next = 6;
|
|
5181
5369
|
return this.submitSalesOrder({
|
|
5182
5370
|
smallTicketDataFlag: 1
|
|
5183
5371
|
});
|
|
5184
5372
|
case 6:
|
|
5185
|
-
submitResult =
|
|
5373
|
+
submitResult = _context55.sent;
|
|
5186
5374
|
orderId = (_ref41 = (_ref42 = (_submitResult$data$or = submitResult === null || submitResult === void 0 || (_submitResult$data = submitResult.data) === null || _submitResult$data === void 0 ? void 0 : _submitResult$data.order_id) !== null && _submitResult$data$or !== void 0 ? _submitResult$data$or : submitResult === null || submitResult === void 0 ? void 0 : submitResult.order_id) !== null && _ref42 !== void 0 ? _ref42 : submitResult === null || submitResult === void 0 || (_submitResult$data2 = submitResult.data) === null || _submitResult$data2 === void 0 ? void 0 : _submitResult$data2.id) !== null && _ref41 !== void 0 ? _ref41 : submitResult === null || submitResult === void 0 ? void 0 : submitResult.id;
|
|
5187
5375
|
if (orderId) {
|
|
5188
|
-
|
|
5376
|
+
_context55.next = 10;
|
|
5189
5377
|
break;
|
|
5190
5378
|
}
|
|
5191
5379
|
throw new Error('本地订单提交云端失败,无法发送支付链接');
|
|
5192
5380
|
case 10:
|
|
5193
5381
|
orderIds = [orderId];
|
|
5194
5382
|
case 11:
|
|
5195
|
-
return
|
|
5383
|
+
return _context55.abrupt("return", this.store.order.sendCustomerPayLink({
|
|
5196
5384
|
emails: params.emails,
|
|
5197
5385
|
notify_action: params.notify_action,
|
|
5198
5386
|
order_ids: orderIds
|
|
5199
5387
|
}));
|
|
5200
5388
|
case 12:
|
|
5201
5389
|
case "end":
|
|
5202
|
-
return
|
|
5390
|
+
return _context55.stop();
|
|
5203
5391
|
}
|
|
5204
|
-
},
|
|
5392
|
+
}, _callee55, this);
|
|
5205
5393
|
}));
|
|
5206
|
-
function sendCustomerPayLink(
|
|
5394
|
+
function sendCustomerPayLink(_x46) {
|
|
5207
5395
|
return _sendCustomerPayLink.apply(this, arguments);
|
|
5208
5396
|
}
|
|
5209
5397
|
return sendCustomerPayLink;
|
|
@@ -5216,20 +5404,20 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5216
5404
|
}, {
|
|
5217
5405
|
key: "calculateProductBookingPrice",
|
|
5218
5406
|
value: function () {
|
|
5219
|
-
var _calculateProductBookingPrice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5407
|
+
var _calculateProductBookingPrice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee56(params) {
|
|
5220
5408
|
var _params$customer_id;
|
|
5221
5409
|
var useCustomerUserPricing, quotation, customerId, channel, _yield$this$resolvePr, _yield$this$resolvePr2, authoritativeProduct, product;
|
|
5222
|
-
return _regeneratorRuntime().wrap(function
|
|
5223
|
-
while (1) switch (
|
|
5410
|
+
return _regeneratorRuntime().wrap(function _callee56$(_context56) {
|
|
5411
|
+
while (1) switch (_context56.prev = _context56.next) {
|
|
5224
5412
|
case 0:
|
|
5225
5413
|
useCustomerUserPricing = this.isCustomerUserPriceQuery();
|
|
5226
5414
|
quotation = useCustomerUserPricing ? undefined : this.store.quotation;
|
|
5227
5415
|
customerId = (_params$customer_id = params.customer_id) !== null && _params$customer_id !== void 0 ? _params$customer_id : this.getCurrentOrderCustomerId();
|
|
5228
|
-
|
|
5416
|
+
_context56.next = 5;
|
|
5229
5417
|
return this.prepareProductPriceQueryContext(customerId);
|
|
5230
5418
|
case 5:
|
|
5231
5419
|
channel = this.getPriceQueryChannel(params.channel);
|
|
5232
|
-
|
|
5420
|
+
_context56.next = 8;
|
|
5233
5421
|
return this.resolveProductsForPriceQuery({
|
|
5234
5422
|
priceQueries: [params],
|
|
5235
5423
|
schedule: this.getPriceQuerySchedule(params),
|
|
@@ -5237,22 +5425,22 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5237
5425
|
channel: channel
|
|
5238
5426
|
});
|
|
5239
5427
|
case 8:
|
|
5240
|
-
_yield$this$resolvePr =
|
|
5428
|
+
_yield$this$resolvePr = _context56.sent;
|
|
5241
5429
|
_yield$this$resolvePr2 = _slicedToArray(_yield$this$resolvePr, 1);
|
|
5242
5430
|
authoritativeProduct = _yield$this$resolvePr2[0];
|
|
5243
5431
|
product = this.mergeProductForPriceQuery(params.product, authoritativeProduct);
|
|
5244
5432
|
if (useCustomerUserPricing) {
|
|
5245
|
-
|
|
5433
|
+
_context56.next = 15;
|
|
5246
5434
|
break;
|
|
5247
5435
|
}
|
|
5248
|
-
|
|
5436
|
+
_context56.next = 15;
|
|
5249
5437
|
return this.loadQuotationForPriceQuery({
|
|
5250
5438
|
quotation: quotation,
|
|
5251
5439
|
customer_id: customerId,
|
|
5252
5440
|
channel: channel
|
|
5253
5441
|
});
|
|
5254
5442
|
case 15:
|
|
5255
|
-
return
|
|
5443
|
+
return _context56.abrupt("return", calculateBaseSalesProductBookingPrice(_objectSpread(_objectSpread({}, params), {}, {
|
|
5256
5444
|
channel: channel,
|
|
5257
5445
|
product: product,
|
|
5258
5446
|
fallback_price: authoritativeProduct ? undefined : params.fallback_price,
|
|
@@ -5261,11 +5449,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5261
5449
|
})));
|
|
5262
5450
|
case 16:
|
|
5263
5451
|
case "end":
|
|
5264
|
-
return
|
|
5452
|
+
return _context56.stop();
|
|
5265
5453
|
}
|
|
5266
|
-
},
|
|
5454
|
+
}, _callee56, this);
|
|
5267
5455
|
}));
|
|
5268
|
-
function calculateProductBookingPrice(
|
|
5456
|
+
function calculateProductBookingPrice(_x47) {
|
|
5269
5457
|
return _calculateProductBookingPrice.apply(this, arguments);
|
|
5270
5458
|
}
|
|
5271
5459
|
return calculateProductBookingPrice;
|
|
@@ -5349,17 +5537,17 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5349
5537
|
}, {
|
|
5350
5538
|
key: "calculateProductBookingPrices",
|
|
5351
5539
|
value: function () {
|
|
5352
|
-
var _calculateProductBookingPrices = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5540
|
+
var _calculateProductBookingPrices = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee58(paramsList) {
|
|
5353
5541
|
var _this18 = this;
|
|
5354
5542
|
var useCustomerUserPricing, quotation, currentOrderCustomerId, resolvedChannels, authoritativeProducts, groups, quotationContexts;
|
|
5355
|
-
return _regeneratorRuntime().wrap(function
|
|
5356
|
-
while (1) switch (
|
|
5543
|
+
return _regeneratorRuntime().wrap(function _callee58$(_context58) {
|
|
5544
|
+
while (1) switch (_context58.prev = _context58.next) {
|
|
5357
5545
|
case 0:
|
|
5358
5546
|
if (paramsList.length) {
|
|
5359
|
-
|
|
5547
|
+
_context58.next = 2;
|
|
5360
5548
|
break;
|
|
5361
5549
|
}
|
|
5362
|
-
return
|
|
5550
|
+
return _context58.abrupt("return", []);
|
|
5363
5551
|
case 2:
|
|
5364
5552
|
useCustomerUserPricing = this.isCustomerUserPriceQuery();
|
|
5365
5553
|
quotation = useCustomerUserPricing ? undefined : this.store.quotation;
|
|
@@ -5386,20 +5574,20 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5386
5574
|
group.indices.push(index);
|
|
5387
5575
|
groups.set(groupKey, group);
|
|
5388
5576
|
});
|
|
5389
|
-
|
|
5577
|
+
_context58.next = 11;
|
|
5390
5578
|
return Promise.all(Array.from(groups.values()).map( /*#__PURE__*/function () {
|
|
5391
|
-
var _ref43 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5579
|
+
var _ref43 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee57(group) {
|
|
5392
5580
|
var priceQueries, resolvedProducts;
|
|
5393
|
-
return _regeneratorRuntime().wrap(function
|
|
5394
|
-
while (1) switch (
|
|
5581
|
+
return _regeneratorRuntime().wrap(function _callee57$(_context57) {
|
|
5582
|
+
while (1) switch (_context57.prev = _context57.next) {
|
|
5395
5583
|
case 0:
|
|
5396
|
-
|
|
5584
|
+
_context57.next = 2;
|
|
5397
5585
|
return _this18.prepareProductPriceQueryContext(group.customerId);
|
|
5398
5586
|
case 2:
|
|
5399
5587
|
priceQueries = group.indices.map(function (index) {
|
|
5400
5588
|
return paramsList[index];
|
|
5401
5589
|
});
|
|
5402
|
-
|
|
5590
|
+
_context57.next = 5;
|
|
5403
5591
|
return _this18.resolveProductsForPriceQuery({
|
|
5404
5592
|
priceQueries: priceQueries,
|
|
5405
5593
|
schedule: group.schedule,
|
|
@@ -5407,23 +5595,23 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5407
5595
|
channel: group.channel
|
|
5408
5596
|
});
|
|
5409
5597
|
case 5:
|
|
5410
|
-
resolvedProducts =
|
|
5598
|
+
resolvedProducts = _context57.sent;
|
|
5411
5599
|
group.indices.forEach(function (originalIndex, groupIndex) {
|
|
5412
5600
|
authoritativeProducts[originalIndex] = resolvedProducts[groupIndex] || null;
|
|
5413
5601
|
});
|
|
5414
5602
|
case 7:
|
|
5415
5603
|
case "end":
|
|
5416
|
-
return
|
|
5604
|
+
return _context57.stop();
|
|
5417
5605
|
}
|
|
5418
|
-
},
|
|
5606
|
+
}, _callee57);
|
|
5419
5607
|
}));
|
|
5420
|
-
return function (
|
|
5608
|
+
return function (_x49) {
|
|
5421
5609
|
return _ref43.apply(this, arguments);
|
|
5422
5610
|
};
|
|
5423
5611
|
}()));
|
|
5424
5612
|
case 11:
|
|
5425
5613
|
if (useCustomerUserPricing) {
|
|
5426
|
-
|
|
5614
|
+
_context58.next = 16;
|
|
5427
5615
|
break;
|
|
5428
5616
|
}
|
|
5429
5617
|
quotationContexts = new Map();
|
|
@@ -5437,14 +5625,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5437
5625
|
customer_id: (_params$customer_id3 = params.customer_id) !== null && _params$customer_id3 !== void 0 ? _params$customer_id3 : currentOrderCustomerId
|
|
5438
5626
|
});
|
|
5439
5627
|
});
|
|
5440
|
-
|
|
5628
|
+
_context58.next = 16;
|
|
5441
5629
|
return Promise.all(Array.from(quotationContexts.values()).map(function (context) {
|
|
5442
5630
|
return _this18.loadQuotationForPriceQuery(_objectSpread({
|
|
5443
5631
|
quotation: quotation
|
|
5444
5632
|
}, context));
|
|
5445
5633
|
}));
|
|
5446
5634
|
case 16:
|
|
5447
|
-
return
|
|
5635
|
+
return _context58.abrupt("return", paramsList.map(function (params, index) {
|
|
5448
5636
|
var _params$customer_id4;
|
|
5449
5637
|
var productInput = params.product || {};
|
|
5450
5638
|
var authoritativeProduct = authoritativeProducts[index];
|
|
@@ -5461,11 +5649,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5461
5649
|
}));
|
|
5462
5650
|
case 17:
|
|
5463
5651
|
case "end":
|
|
5464
|
-
return
|
|
5652
|
+
return _context58.stop();
|
|
5465
5653
|
}
|
|
5466
|
-
},
|
|
5654
|
+
}, _callee58, this);
|
|
5467
5655
|
}));
|
|
5468
|
-
function calculateProductBookingPrices(
|
|
5656
|
+
function calculateProductBookingPrices(_x48) {
|
|
5469
5657
|
return _calculateProductBookingPrices.apply(this, arguments);
|
|
5470
5658
|
}
|
|
5471
5659
|
return calculateProductBookingPrices;
|
|
@@ -5473,34 +5661,34 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5473
5661
|
}, {
|
|
5474
5662
|
key: "addProductToOrder",
|
|
5475
5663
|
value: function () {
|
|
5476
|
-
var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5664
|
+
var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee59(product, booking, options) {
|
|
5477
5665
|
var products;
|
|
5478
|
-
return _regeneratorRuntime().wrap(function
|
|
5479
|
-
while (1) switch (
|
|
5666
|
+
return _regeneratorRuntime().wrap(function _callee59$(_context59) {
|
|
5667
|
+
while (1) switch (_context59.prev = _context59.next) {
|
|
5480
5668
|
case 0:
|
|
5481
|
-
|
|
5669
|
+
_context59.prev = 0;
|
|
5482
5670
|
if (this.store.order) {
|
|
5483
|
-
|
|
5671
|
+
_context59.next = 3;
|
|
5484
5672
|
break;
|
|
5485
5673
|
}
|
|
5486
5674
|
throw new Error('order 模块未初始化');
|
|
5487
5675
|
case 3:
|
|
5488
|
-
|
|
5676
|
+
_context59.next = 5;
|
|
5489
5677
|
return this.store.order.addProductToOrder(product, booking, options);
|
|
5490
5678
|
case 5:
|
|
5491
|
-
products =
|
|
5492
|
-
return
|
|
5679
|
+
products = _context59.sent;
|
|
5680
|
+
return _context59.abrupt("return", products);
|
|
5493
5681
|
case 9:
|
|
5494
|
-
|
|
5495
|
-
|
|
5496
|
-
throw
|
|
5682
|
+
_context59.prev = 9;
|
|
5683
|
+
_context59.t0 = _context59["catch"](0);
|
|
5684
|
+
throw _context59.t0;
|
|
5497
5685
|
case 12:
|
|
5498
5686
|
case "end":
|
|
5499
|
-
return
|
|
5687
|
+
return _context59.stop();
|
|
5500
5688
|
}
|
|
5501
|
-
},
|
|
5689
|
+
}, _callee59, this, [[0, 9]]);
|
|
5502
5690
|
}));
|
|
5503
|
-
function addProductToOrder(
|
|
5691
|
+
function addProductToOrder(_x50, _x51, _x52) {
|
|
5504
5692
|
return _addProductToOrder.apply(this, arguments);
|
|
5505
5693
|
}
|
|
5506
5694
|
return addProductToOrder;
|
|
@@ -5508,34 +5696,34 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5508
5696
|
}, {
|
|
5509
5697
|
key: "updateOrderProduct",
|
|
5510
5698
|
value: function () {
|
|
5511
|
-
var _updateOrderProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5699
|
+
var _updateOrderProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee60(params) {
|
|
5512
5700
|
var products;
|
|
5513
|
-
return _regeneratorRuntime().wrap(function
|
|
5514
|
-
while (1) switch (
|
|
5701
|
+
return _regeneratorRuntime().wrap(function _callee60$(_context60) {
|
|
5702
|
+
while (1) switch (_context60.prev = _context60.next) {
|
|
5515
5703
|
case 0:
|
|
5516
|
-
|
|
5704
|
+
_context60.prev = 0;
|
|
5517
5705
|
if (this.store.order) {
|
|
5518
|
-
|
|
5706
|
+
_context60.next = 3;
|
|
5519
5707
|
break;
|
|
5520
5708
|
}
|
|
5521
5709
|
throw new Error('order 模块未初始化');
|
|
5522
5710
|
case 3:
|
|
5523
|
-
|
|
5711
|
+
_context60.next = 5;
|
|
5524
5712
|
return this.store.order.updateOrderProduct(params);
|
|
5525
5713
|
case 5:
|
|
5526
|
-
products =
|
|
5527
|
-
return
|
|
5714
|
+
products = _context60.sent;
|
|
5715
|
+
return _context60.abrupt("return", products);
|
|
5528
5716
|
case 9:
|
|
5529
|
-
|
|
5530
|
-
|
|
5531
|
-
throw
|
|
5717
|
+
_context60.prev = 9;
|
|
5718
|
+
_context60.t0 = _context60["catch"](0);
|
|
5719
|
+
throw _context60.t0;
|
|
5532
5720
|
case 12:
|
|
5533
5721
|
case "end":
|
|
5534
|
-
return
|
|
5722
|
+
return _context60.stop();
|
|
5535
5723
|
}
|
|
5536
|
-
},
|
|
5724
|
+
}, _callee60, this, [[0, 9]]);
|
|
5537
5725
|
}));
|
|
5538
|
-
function updateOrderProduct(
|
|
5726
|
+
function updateOrderProduct(_x53) {
|
|
5539
5727
|
return _updateOrderProduct.apply(this, arguments);
|
|
5540
5728
|
}
|
|
5541
5729
|
return updateOrderProduct;
|
|
@@ -5543,34 +5731,34 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5543
5731
|
}, {
|
|
5544
5732
|
key: "updateOrderProducts",
|
|
5545
5733
|
value: function () {
|
|
5546
|
-
var _updateOrderProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5734
|
+
var _updateOrderProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee61(paramsList) {
|
|
5547
5735
|
var products;
|
|
5548
|
-
return _regeneratorRuntime().wrap(function
|
|
5549
|
-
while (1) switch (
|
|
5736
|
+
return _regeneratorRuntime().wrap(function _callee61$(_context61) {
|
|
5737
|
+
while (1) switch (_context61.prev = _context61.next) {
|
|
5550
5738
|
case 0:
|
|
5551
|
-
|
|
5739
|
+
_context61.prev = 0;
|
|
5552
5740
|
if (this.store.order) {
|
|
5553
|
-
|
|
5741
|
+
_context61.next = 3;
|
|
5554
5742
|
break;
|
|
5555
5743
|
}
|
|
5556
5744
|
throw new Error('order 模块未初始化');
|
|
5557
5745
|
case 3:
|
|
5558
|
-
|
|
5746
|
+
_context61.next = 5;
|
|
5559
5747
|
return this.store.order.updateOrderProducts(paramsList);
|
|
5560
5748
|
case 5:
|
|
5561
|
-
products =
|
|
5562
|
-
return
|
|
5749
|
+
products = _context61.sent;
|
|
5750
|
+
return _context61.abrupt("return", products);
|
|
5563
5751
|
case 9:
|
|
5564
|
-
|
|
5565
|
-
|
|
5566
|
-
throw
|
|
5752
|
+
_context61.prev = 9;
|
|
5753
|
+
_context61.t0 = _context61["catch"](0);
|
|
5754
|
+
throw _context61.t0;
|
|
5567
5755
|
case 12:
|
|
5568
5756
|
case "end":
|
|
5569
|
-
return
|
|
5757
|
+
return _context61.stop();
|
|
5570
5758
|
}
|
|
5571
|
-
},
|
|
5759
|
+
}, _callee61, this, [[0, 9]]);
|
|
5572
5760
|
}));
|
|
5573
|
-
function updateOrderProducts(
|
|
5761
|
+
function updateOrderProducts(_x54) {
|
|
5574
5762
|
return _updateOrderProducts.apply(this, arguments);
|
|
5575
5763
|
}
|
|
5576
5764
|
return updateOrderProducts;
|
|
@@ -5578,34 +5766,34 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5578
5766
|
}, {
|
|
5579
5767
|
key: "updateOrderProductQuantity",
|
|
5580
5768
|
value: function () {
|
|
5581
|
-
var _updateOrderProductQuantity = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5769
|
+
var _updateOrderProductQuantity = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee62(params) {
|
|
5582
5770
|
var products;
|
|
5583
|
-
return _regeneratorRuntime().wrap(function
|
|
5584
|
-
while (1) switch (
|
|
5771
|
+
return _regeneratorRuntime().wrap(function _callee62$(_context62) {
|
|
5772
|
+
while (1) switch (_context62.prev = _context62.next) {
|
|
5585
5773
|
case 0:
|
|
5586
|
-
|
|
5774
|
+
_context62.prev = 0;
|
|
5587
5775
|
if (this.store.order) {
|
|
5588
|
-
|
|
5776
|
+
_context62.next = 3;
|
|
5589
5777
|
break;
|
|
5590
5778
|
}
|
|
5591
5779
|
throw new Error('order 模块未初始化');
|
|
5592
5780
|
case 3:
|
|
5593
|
-
|
|
5781
|
+
_context62.next = 5;
|
|
5594
5782
|
return this.store.order.updateOrderProductQuantity(params);
|
|
5595
5783
|
case 5:
|
|
5596
|
-
products =
|
|
5597
|
-
return
|
|
5784
|
+
products = _context62.sent;
|
|
5785
|
+
return _context62.abrupt("return", products);
|
|
5598
5786
|
case 9:
|
|
5599
|
-
|
|
5600
|
-
|
|
5601
|
-
throw
|
|
5787
|
+
_context62.prev = 9;
|
|
5788
|
+
_context62.t0 = _context62["catch"](0);
|
|
5789
|
+
throw _context62.t0;
|
|
5602
5790
|
case 12:
|
|
5603
5791
|
case "end":
|
|
5604
|
-
return
|
|
5792
|
+
return _context62.stop();
|
|
5605
5793
|
}
|
|
5606
|
-
},
|
|
5794
|
+
}, _callee62, this, [[0, 9]]);
|
|
5607
5795
|
}));
|
|
5608
|
-
function updateOrderProductQuantity(
|
|
5796
|
+
function updateOrderProductQuantity(_x55) {
|
|
5609
5797
|
return _updateOrderProductQuantity.apply(this, arguments);
|
|
5610
5798
|
}
|
|
5611
5799
|
return updateOrderProductQuantity;
|
|
@@ -5628,12 +5816,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5628
5816
|
}, {
|
|
5629
5817
|
key: "setOrderProductLineNote",
|
|
5630
5818
|
value: (function () {
|
|
5631
|
-
var _setOrderProductLineNote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5819
|
+
var _setOrderProductLineNote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee63(identity, note) {
|
|
5632
5820
|
var params, products;
|
|
5633
|
-
return _regeneratorRuntime().wrap(function
|
|
5634
|
-
while (1) switch (
|
|
5821
|
+
return _regeneratorRuntime().wrap(function _callee63$(_context63) {
|
|
5822
|
+
while (1) switch (_context63.prev = _context63.next) {
|
|
5635
5823
|
case 0:
|
|
5636
|
-
|
|
5824
|
+
_context63.prev = 0;
|
|
5637
5825
|
params = {
|
|
5638
5826
|
product_id: identity.product_id,
|
|
5639
5827
|
product_variant_id: identity.product_variant_id,
|
|
@@ -5648,22 +5836,22 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5648
5836
|
params.product_sku = identity.product_sku;
|
|
5649
5837
|
}
|
|
5650
5838
|
if (identity.product_bundle !== undefined) params.product_bundle = identity.product_bundle;
|
|
5651
|
-
|
|
5839
|
+
_context63.next = 7;
|
|
5652
5840
|
return this.updateOrderProduct(params);
|
|
5653
5841
|
case 7:
|
|
5654
|
-
products =
|
|
5655
|
-
return
|
|
5842
|
+
products = _context63.sent;
|
|
5843
|
+
return _context63.abrupt("return", products);
|
|
5656
5844
|
case 11:
|
|
5657
|
-
|
|
5658
|
-
|
|
5659
|
-
throw
|
|
5845
|
+
_context63.prev = 11;
|
|
5846
|
+
_context63.t0 = _context63["catch"](0);
|
|
5847
|
+
throw _context63.t0;
|
|
5660
5848
|
case 14:
|
|
5661
5849
|
case "end":
|
|
5662
|
-
return
|
|
5850
|
+
return _context63.stop();
|
|
5663
5851
|
}
|
|
5664
|
-
},
|
|
5852
|
+
}, _callee63, this, [[0, 11]]);
|
|
5665
5853
|
}));
|
|
5666
|
-
function setOrderProductLineNote(
|
|
5854
|
+
function setOrderProductLineNote(_x56, _x57) {
|
|
5667
5855
|
return _setOrderProductLineNote.apply(this, arguments);
|
|
5668
5856
|
}
|
|
5669
5857
|
return setOrderProductLineNote;
|
|
@@ -5678,32 +5866,32 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5678
5866
|
}, {
|
|
5679
5867
|
key: "removeProductsFromOrder",
|
|
5680
5868
|
value: (function () {
|
|
5681
|
-
var _removeProductsFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5682
|
-
return _regeneratorRuntime().wrap(function
|
|
5683
|
-
while (1) switch (
|
|
5869
|
+
var _removeProductsFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee64(identities, options) {
|
|
5870
|
+
return _regeneratorRuntime().wrap(function _callee64$(_context64) {
|
|
5871
|
+
while (1) switch (_context64.prev = _context64.next) {
|
|
5684
5872
|
case 0:
|
|
5685
|
-
|
|
5873
|
+
_context64.prev = 0;
|
|
5686
5874
|
if (this.store.order) {
|
|
5687
|
-
|
|
5875
|
+
_context64.next = 3;
|
|
5688
5876
|
break;
|
|
5689
5877
|
}
|
|
5690
5878
|
throw new Error('order 模块未初始化');
|
|
5691
5879
|
case 3:
|
|
5692
|
-
|
|
5880
|
+
_context64.next = 5;
|
|
5693
5881
|
return this.store.order.removeProductsFromOrder(identities, options);
|
|
5694
5882
|
case 5:
|
|
5695
|
-
return
|
|
5883
|
+
return _context64.abrupt("return", _context64.sent);
|
|
5696
5884
|
case 8:
|
|
5697
|
-
|
|
5698
|
-
|
|
5699
|
-
throw
|
|
5885
|
+
_context64.prev = 8;
|
|
5886
|
+
_context64.t0 = _context64["catch"](0);
|
|
5887
|
+
throw _context64.t0;
|
|
5700
5888
|
case 11:
|
|
5701
5889
|
case "end":
|
|
5702
|
-
return
|
|
5890
|
+
return _context64.stop();
|
|
5703
5891
|
}
|
|
5704
|
-
},
|
|
5892
|
+
}, _callee64, this, [[0, 8]]);
|
|
5705
5893
|
}));
|
|
5706
|
-
function removeProductsFromOrder(
|
|
5894
|
+
function removeProductsFromOrder(_x58, _x59) {
|
|
5707
5895
|
return _removeProductsFromOrder.apply(this, arguments);
|
|
5708
5896
|
}
|
|
5709
5897
|
return removeProductsFromOrder;
|
|
@@ -5711,18 +5899,18 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5711
5899
|
}, {
|
|
5712
5900
|
key: "removeProductFromOrder",
|
|
5713
5901
|
value: function () {
|
|
5714
|
-
var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5715
|
-
return _regeneratorRuntime().wrap(function
|
|
5716
|
-
while (1) switch (
|
|
5902
|
+
var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee65(identity, options) {
|
|
5903
|
+
return _regeneratorRuntime().wrap(function _callee65$(_context65) {
|
|
5904
|
+
while (1) switch (_context65.prev = _context65.next) {
|
|
5717
5905
|
case 0:
|
|
5718
|
-
return
|
|
5906
|
+
return _context65.abrupt("return", this.removeProductsFromOrder([identity], options));
|
|
5719
5907
|
case 1:
|
|
5720
5908
|
case "end":
|
|
5721
|
-
return
|
|
5909
|
+
return _context65.stop();
|
|
5722
5910
|
}
|
|
5723
|
-
},
|
|
5911
|
+
}, _callee65, this);
|
|
5724
5912
|
}));
|
|
5725
|
-
function removeProductFromOrder(
|
|
5913
|
+
function removeProductFromOrder(_x60, _x61) {
|
|
5726
5914
|
return _removeProductFromOrder.apply(this, arguments);
|
|
5727
5915
|
}
|
|
5728
5916
|
return removeProductFromOrder;
|
|
@@ -5772,23 +5960,23 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5772
5960
|
}, {
|
|
5773
5961
|
key: "applyPromotion",
|
|
5774
5962
|
value: (function () {
|
|
5775
|
-
var _applyPromotion = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5776
|
-
return _regeneratorRuntime().wrap(function
|
|
5777
|
-
while (1) switch (
|
|
5963
|
+
var _applyPromotion = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee66() {
|
|
5964
|
+
return _regeneratorRuntime().wrap(function _callee66$(_context66) {
|
|
5965
|
+
while (1) switch (_context66.prev = _context66.next) {
|
|
5778
5966
|
case 0:
|
|
5779
5967
|
if (this.store.order) {
|
|
5780
|
-
|
|
5968
|
+
_context66.next = 2;
|
|
5781
5969
|
break;
|
|
5782
5970
|
}
|
|
5783
5971
|
throw new Error('order 模块未初始化');
|
|
5784
5972
|
case 2:
|
|
5785
|
-
|
|
5973
|
+
_context66.next = 4;
|
|
5786
5974
|
return this.store.order.applyPromotion();
|
|
5787
5975
|
case 4:
|
|
5788
5976
|
case "end":
|
|
5789
|
-
return
|
|
5977
|
+
return _context66.stop();
|
|
5790
5978
|
}
|
|
5791
|
-
},
|
|
5979
|
+
}, _callee66, this);
|
|
5792
5980
|
}));
|
|
5793
5981
|
function applyPromotion() {
|
|
5794
5982
|
return _applyPromotion.apply(this, arguments);
|
|
@@ -5815,18 +6003,18 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5815
6003
|
}, {
|
|
5816
6004
|
key: "getProductList",
|
|
5817
6005
|
value: function () {
|
|
5818
|
-
var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
6006
|
+
var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee67() {
|
|
5819
6007
|
var _this$otherParams35;
|
|
5820
6008
|
var menu_list_ids, _this$store$products, res;
|
|
5821
|
-
return _regeneratorRuntime().wrap(function
|
|
5822
|
-
while (1) switch (
|
|
6009
|
+
return _regeneratorRuntime().wrap(function _callee67$(_context67) {
|
|
6010
|
+
while (1) switch (_context67.prev = _context67.next) {
|
|
5823
6011
|
case 0:
|
|
5824
6012
|
// 可以直接通过配置里的 menu 读取
|
|
5825
6013
|
menu_list_ids = ((_this$otherParams35 = this.otherParams) === null || _this$otherParams35 === void 0 || (_this$otherParams35 = _this$otherParams35.dineInConfig) === null || _this$otherParams35 === void 0 ? void 0 : _this$otherParams35['menu.associated_menus'].map(function (n) {
|
|
5826
6014
|
return Number(n.value);
|
|
5827
6015
|
})) || [];
|
|
5828
|
-
|
|
5829
|
-
|
|
6016
|
+
_context67.prev = 1;
|
|
6017
|
+
_context67.next = 4;
|
|
5830
6018
|
return (_this$store$products = this.store.products) === null || _this$store$products === void 0 ? void 0 : _this$store$products.loadProducts({
|
|
5831
6019
|
menu_list_ids: menu_list_ids,
|
|
5832
6020
|
cacheId: this.cacheId,
|
|
@@ -5834,17 +6022,17 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5834
6022
|
schedule_datetime: dayjs().format('YYYY-MM-DD HH:mm:ss')
|
|
5835
6023
|
});
|
|
5836
6024
|
case 4:
|
|
5837
|
-
res =
|
|
5838
|
-
return
|
|
6025
|
+
res = _context67.sent;
|
|
6026
|
+
return _context67.abrupt("return", res);
|
|
5839
6027
|
case 8:
|
|
5840
|
-
|
|
5841
|
-
|
|
5842
|
-
throw
|
|
6028
|
+
_context67.prev = 8;
|
|
6029
|
+
_context67.t0 = _context67["catch"](1);
|
|
6030
|
+
throw _context67.t0;
|
|
5843
6031
|
case 11:
|
|
5844
6032
|
case "end":
|
|
5845
|
-
return
|
|
6033
|
+
return _context67.stop();
|
|
5846
6034
|
}
|
|
5847
|
-
},
|
|
6035
|
+
}, _callee67, this, [[1, 8]]);
|
|
5848
6036
|
}));
|
|
5849
6037
|
function getProductList() {
|
|
5850
6038
|
return _getProductList.apply(this, arguments);
|
|
@@ -5859,33 +6047,33 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5859
6047
|
}, {
|
|
5860
6048
|
key: "setOtherParams",
|
|
5861
6049
|
value: function () {
|
|
5862
|
-
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
6050
|
+
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee68(params) {
|
|
5863
6051
|
var _this$otherParams36;
|
|
5864
6052
|
var _ref44,
|
|
5865
6053
|
_ref44$cover,
|
|
5866
6054
|
cover,
|
|
5867
|
-
|
|
5868
|
-
return _regeneratorRuntime().wrap(function
|
|
5869
|
-
while (1) switch (
|
|
6055
|
+
_args68 = arguments;
|
|
6056
|
+
return _regeneratorRuntime().wrap(function _callee68$(_context68) {
|
|
6057
|
+
while (1) switch (_context68.prev = _context68.next) {
|
|
5870
6058
|
case 0:
|
|
5871
|
-
_ref44 =
|
|
6059
|
+
_ref44 = _args68.length > 1 && _args68[1] !== undefined ? _args68[1] : {}, _ref44$cover = _ref44.cover, cover = _ref44$cover === void 0 ? false : _ref44$cover;
|
|
5872
6060
|
if (cover) {
|
|
5873
6061
|
this.otherParams = _objectSpread({}, params);
|
|
5874
6062
|
} else {
|
|
5875
6063
|
this.otherParams = _objectSpread(_objectSpread({}, this.otherParams), params);
|
|
5876
6064
|
}
|
|
5877
6065
|
this.cacheId = (_this$otherParams36 = this.otherParams) === null || _this$otherParams36 === void 0 ? void 0 : _this$otherParams36.cacheId;
|
|
5878
|
-
|
|
6066
|
+
_context68.next = 5;
|
|
5879
6067
|
return this.syncOtherParamsToSubModules(params, {
|
|
5880
6068
|
cover: cover
|
|
5881
6069
|
});
|
|
5882
6070
|
case 5:
|
|
5883
6071
|
case "end":
|
|
5884
|
-
return
|
|
6072
|
+
return _context68.stop();
|
|
5885
6073
|
}
|
|
5886
|
-
},
|
|
6074
|
+
}, _callee68, this);
|
|
5887
6075
|
}));
|
|
5888
|
-
function setOtherParams(
|
|
6076
|
+
function setOtherParams(_x62) {
|
|
5889
6077
|
return _setOtherParams.apply(this, arguments);
|
|
5890
6078
|
}
|
|
5891
6079
|
return setOtherParams;
|