@pisell/pisellos 2.2.265 → 2.2.267
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/promotion/index.js +0 -9
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +5 -3
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +6 -3
- package/dist/modules/Order/index.d.ts +8 -27
- package/dist/modules/Order/index.js +490 -743
- package/dist/modules/Order/types.d.ts +1 -33
- package/dist/modules/Order/utils/orderCollectionIdentity.js +2 -7
- package/dist/modules/Order/utils.js +5 -8
- package/dist/modules/Payment/index.d.ts +0 -2
- package/dist/modules/Payment/index.js +50 -79
- package/dist/modules/Payment/types.d.ts +27 -29
- package/dist/modules/Payment/types.js +3 -5
- package/dist/server/index.d.ts +0 -16
- package/dist/server/index.js +1036 -1933
- package/dist/server/modules/order/index.d.ts +4 -49
- package/dist/server/modules/order/index.js +695 -1574
- package/dist/server/modules/order/types.d.ts +3 -11
- package/dist/server/modules/order/types.js +1 -1
- package/dist/solution/BaseSales/index.d.ts +11 -42
- package/dist/solution/BaseSales/index.js +385 -676
- package/dist/solution/BaseSales/utils/cartPromotion.js +5 -3
- package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +1 -6
- package/dist/solution/BookingTicket/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.js +1 -2
- package/dist/solution/BookingTicket/utils/addProductDecision.js +6 -0
- package/dist/solution/BookingTicket/utils/weighingProductSku.d.ts +5 -0
- package/dist/solution/BookingTicket/utils/weighingProductSku.js +45 -0
- package/dist/solution/Sales/index.d.ts +0 -1
- package/dist/solution/Sales/index.js +2 -10
- package/lib/model/strategy/adapter/promotion/index.js +0 -49
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +2 -1
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +2 -1
- package/lib/modules/Order/index.d.ts +8 -27
- package/lib/modules/Order/index.js +69 -184
- package/lib/modules/Order/types.d.ts +1 -33
- package/lib/modules/Order/utils/orderCollectionIdentity.js +0 -3
- package/lib/modules/Order/utils.js +3 -5
- package/lib/modules/Payment/index.d.ts +0 -2
- package/lib/modules/Payment/index.js +13 -34
- package/lib/modules/Payment/types.d.ts +27 -29
- package/lib/modules/Payment/types.js +3 -3
- package/lib/server/index.d.ts +0 -16
- package/lib/server/index.js +18 -670
- package/lib/server/modules/order/index.d.ts +4 -49
- package/lib/server/modules/order/index.js +66 -657
- package/lib/server/modules/order/types.d.ts +3 -11
- package/lib/solution/BaseSales/index.d.ts +11 -42
- package/lib/solution/BaseSales/index.js +35 -214
- package/lib/solution/BaseSales/utils/cartPromotion.js +5 -2
- package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +1 -6
- package/lib/solution/BookingTicket/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.js +1 -2
- package/lib/solution/BookingTicket/utils/addProductDecision.js +4 -0
- package/lib/solution/BookingTicket/utils/weighingProductSku.d.ts +5 -0
- package/lib/solution/BookingTicket/utils/weighingProductSku.js +63 -0
- package/lib/solution/Sales/index.d.ts +0 -1
- package/lib/solution/Sales/index.js +3 -5
- package/package.json +2 -2
- package/dist/modules/Order/payment-utils.d.ts +0 -26
- package/dist/modules/Order/payment-utils.js +0 -225
- package/dist/utils/payment-number.d.ts +0 -9
- package/dist/utils/payment-number.js +0 -69
- package/lib/modules/Order/payment-utils.d.ts +0 -26
- package/lib/modules/Order/payment-utils.js +0 -224
- package/lib/utils/payment-number.d.ts +0 -9
- package/lib/utils/payment-number.js +0 -64
|
@@ -37,8 +37,6 @@ import Decimal from 'decimal.js';
|
|
|
37
37
|
import { cloneDeep, 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
|
-
import { ensureOrderPaymentNumber, isIdentifiedPendingOrderPayment, isPendingOrderPayment, mergeOrderPaymentListsByIdentity, resolveOrderPaymentIdentity } from "../../modules/Order/payment-utils";
|
|
41
|
-
import { resolvePaymentNumberDevicePrefix, resolvePaymentNumberDevicePrefixFromDeviceId } from "../../utils/payment-number";
|
|
42
40
|
import { applyOrderCollectionUidRemaps, getOrderCollectionPersistentId, getOrderCollectionReferenceUid, getOrderCollectionUid, isSameOrderCollectionItem, mergeOrderCollectionItems, normalizeOrderCollection, normalizeOrderCollections, setOrderCollectionUid } from "../../modules/Order/utils/orderCollectionIdentity";
|
|
43
41
|
import dayjs from 'dayjs';
|
|
44
42
|
export * from "./types";
|
|
@@ -74,10 +72,6 @@ function preserveManualProductDiscountProducts(previousProducts, nextProducts) {
|
|
|
74
72
|
function isBaseSalesHistoricalDiscountEntry(discount) {
|
|
75
73
|
return Boolean((discount === null || discount === void 0 ? void 0 : discount.isEditMode) || (discount === null || discount === void 0 ? void 0 : discount.isDisabled) || (discount === null || discount === void 0 ? void 0 : discount.order_discount_id) != null);
|
|
76
74
|
}
|
|
77
|
-
function getBaseSalesUniqueArrayMetadataKey(key) {
|
|
78
|
-
if (key === 'products' || key === 'bookings') return 'unique_identification_number';
|
|
79
|
-
return null;
|
|
80
|
-
}
|
|
81
75
|
var BASE_SALES_PERSISTENT_ID_FIELD_BY_KIND = {
|
|
82
76
|
product: 'order_detail_id',
|
|
83
77
|
booking: 'schedule_event_id',
|
|
@@ -149,15 +143,6 @@ function mergeBaseSalesCollectionItem(kind, currentItem, incomingItem, uidRemaps
|
|
|
149
143
|
return kind === 'product' ? mergeBaseSalesProductSnapshotFields(currentItem, mergedItem) : mergedItem;
|
|
150
144
|
}
|
|
151
145
|
function mergeBaseSalesOrderCollection(kind, currentValue, incomingValue, strategy, uidRemaps) {
|
|
152
|
-
if (kind === 'payment') {
|
|
153
|
-
return mergeOrderPaymentListsByIdentity(currentValue, incomingValue, strategy === 'preserve-local' ? {
|
|
154
|
-
preserveUnmatchedExisting: true
|
|
155
|
-
} : {
|
|
156
|
-
preserveUnmatchedExistingWhen: function preserveUnmatchedExistingWhen(payment) {
|
|
157
|
-
return isIdentifiedPendingOrderPayment(payment) || !getOrderCollectionPersistentId('payment', payment);
|
|
158
|
-
}
|
|
159
|
-
});
|
|
160
|
-
}
|
|
161
146
|
var currentItems = normalizeOrderCollection(kind, currentValue, {
|
|
162
147
|
ensureUid: false
|
|
163
148
|
}).items;
|
|
@@ -204,34 +189,6 @@ function normalizeBaseSalesRecordCollections(sourceRecord, options) {
|
|
|
204
189
|
}
|
|
205
190
|
return normalizedRecord;
|
|
206
191
|
}
|
|
207
|
-
function getBaseSalesMetadataUid(item, metadataKey) {
|
|
208
|
-
var _item$metadata$metada, _item$metadata;
|
|
209
|
-
var uid = (_item$metadata$metada = item === null || item === void 0 || (_item$metadata = item.metadata) === null || _item$metadata === void 0 ? void 0 : _item$metadata[metadataKey]) !== null && _item$metadata$metada !== void 0 ? _item$metadata$metada : item === null || item === void 0 ? void 0 : item[metadataKey];
|
|
210
|
-
if (uid === undefined || uid === null || uid === '') return null;
|
|
211
|
-
return String(uid);
|
|
212
|
-
}
|
|
213
|
-
function mergeBaseSalesUniqueArray(currentValue, loadedValue, metadataKey) {
|
|
214
|
-
var result = [];
|
|
215
|
-
var indexByUid = new Map();
|
|
216
|
-
var appendOrReplaceByUid = function appendOrReplaceByUid(item) {
|
|
217
|
-
var clonedItem = cloneDeep(item);
|
|
218
|
-
var uid = getBaseSalesMetadataUid(clonedItem, metadataKey);
|
|
219
|
-
if (!uid) {
|
|
220
|
-
result.push(clonedItem);
|
|
221
|
-
return;
|
|
222
|
-
}
|
|
223
|
-
var existingIndex = indexByUid.get(uid);
|
|
224
|
-
if (existingIndex !== undefined) {
|
|
225
|
-
result[existingIndex] = clonedItem;
|
|
226
|
-
return;
|
|
227
|
-
}
|
|
228
|
-
indexByUid.set(uid, result.length);
|
|
229
|
-
result.push(clonedItem);
|
|
230
|
-
};
|
|
231
|
-
currentValue.forEach(appendOrReplaceByUid);
|
|
232
|
-
loadedValue.forEach(appendOrReplaceByUid);
|
|
233
|
-
return result;
|
|
234
|
-
}
|
|
235
192
|
function mergeSalesDetailRecordWithTempOrder(currentTempOrder, loadedRecord, strategy) {
|
|
236
193
|
var normalizedLoadedRecord = normalizeBaseSalesRecordCollections(loadedRecord || {}, {
|
|
237
194
|
ensureUid: false
|
|
@@ -249,15 +206,6 @@ function mergeSalesDetailRecordWithTempOrder(currentTempOrder, loadedRecord, str
|
|
|
249
206
|
return mergeBaseSalesOrderCollection(collectionKind, Array.isArray(currentValue) ? currentValue : [], loadedValue, strategy, uidRemaps);
|
|
250
207
|
}
|
|
251
208
|
if (Array.isArray(currentValue) && Array.isArray(loadedValue)) {
|
|
252
|
-
if (key === 'payments' || key === 'payment') {
|
|
253
|
-
return mergeOrderPaymentListsByIdentity(currentValue, loadedValue, {
|
|
254
|
-
preserveUnmatchedExisting: true
|
|
255
|
-
});
|
|
256
|
-
}
|
|
257
|
-
var metadataKey = getBaseSalesUniqueArrayMetadataKey(key);
|
|
258
|
-
if (metadataKey) {
|
|
259
|
-
return mergeBaseSalesUniqueArray(currentValue, loadedValue, metadataKey);
|
|
260
|
-
}
|
|
261
209
|
return [].concat(_toConsumableArray(cloneDeep(currentValue)), _toConsumableArray(cloneDeep(loadedValue)));
|
|
262
210
|
}
|
|
263
211
|
if (Array.isArray(loadedValue)) return cloneDeep(loadedValue);
|
|
@@ -269,22 +217,6 @@ function mergeSalesDetailRecordWithTempOrder(currentTempOrder, loadedRecord, str
|
|
|
269
217
|
delete mergedRecord.request_unique_idempotency_token;
|
|
270
218
|
return normalizeBaseSalesRecordCollections(applyOrderCollectionUidRemaps(mergedRecord, uidRemaps));
|
|
271
219
|
}
|
|
272
|
-
function filterPendingPaymentsFromLoadedSalesDetail(sourceRecord) {
|
|
273
|
-
if (!sourceRecord || _typeof(sourceRecord) !== 'object') return sourceRecord;
|
|
274
|
-
var record = _objectSpread({}, sourceRecord);
|
|
275
|
-
if (Array.isArray(sourceRecord.payments)) {
|
|
276
|
-
record.payments = sourceRecord.payments.filter(function (payment) {
|
|
277
|
-
return !isPendingOrderPayment(payment);
|
|
278
|
-
});
|
|
279
|
-
}
|
|
280
|
-
// 兼容少量历史详情数据使用的单数 payment 字段。
|
|
281
|
-
if (Array.isArray(sourceRecord.payment)) {
|
|
282
|
-
record.payment = sourceRecord.payment.filter(function (payment) {
|
|
283
|
-
return !isPendingOrderPayment(payment);
|
|
284
|
-
});
|
|
285
|
-
}
|
|
286
|
-
return record;
|
|
287
|
-
}
|
|
288
220
|
export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
289
221
|
_inherits(BaseSalesImpl, _BaseModule);
|
|
290
222
|
var _super = _createSuper(BaseSalesImpl);
|
|
@@ -1148,24 +1080,6 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1148
1080
|
var coreData = app === null || app === void 0 || (_app$models = app.models) === null || _app$models === void 0 || (_app$models$getStore = _app$models.getStore) === null || _app$models$getStore === void 0 || (_app$models$getStore$ = (_app$models$getStore$2 = _app$models$getStore.call(_app$models)).getDataByModel) === null || _app$models$getStore$ === void 0 ? void 0 : _app$models$getStore$.call(_app$models$getStore$2, 'core', 'core');
|
|
1149
1081
|
return coreData === null || coreData === void 0 ? void 0 : coreData[key];
|
|
1150
1082
|
}
|
|
1151
|
-
}, {
|
|
1152
|
-
key: "getPaymentNumberDevicePrefixSync",
|
|
1153
|
-
value: function getPaymentNumberDevicePrefixSync() {
|
|
1154
|
-
var _this7 = this;
|
|
1155
|
-
if (!this.appPlugin) return 'LOCAL';
|
|
1156
|
-
return resolvePaymentNumberDevicePrefixFromDeviceId(function (key) {
|
|
1157
|
-
return _this7.getAppData(key);
|
|
1158
|
-
});
|
|
1159
|
-
}
|
|
1160
|
-
}, {
|
|
1161
|
-
key: "getPaymentNumberDevicePrefixAsync",
|
|
1162
|
-
value: function getPaymentNumberDevicePrefixAsync() {
|
|
1163
|
-
var _this8 = this;
|
|
1164
|
-
if (!this.appPlugin) return Promise.resolve('LOCAL');
|
|
1165
|
-
return resolvePaymentNumberDevicePrefix(function (key) {
|
|
1166
|
-
return _this8.getAppData(key);
|
|
1167
|
-
});
|
|
1168
|
-
}
|
|
1169
1083
|
}, {
|
|
1170
1084
|
key: "syncAppDataToTempOrder",
|
|
1171
1085
|
value: function syncAppDataToTempOrder(tempOrder) {
|
|
@@ -1209,7 +1123,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1209
1123
|
value: function () {
|
|
1210
1124
|
var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(core) {
|
|
1211
1125
|
var _this$otherParams4,
|
|
1212
|
-
|
|
1126
|
+
_this7 = this,
|
|
1213
1127
|
_this$otherParams5;
|
|
1214
1128
|
var options,
|
|
1215
1129
|
app,
|
|
@@ -1242,24 +1156,24 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1242
1156
|
targetCacheData = this.readSessionCacheData();
|
|
1243
1157
|
moduleNames = this.getRegisteredModuleNames();
|
|
1244
1158
|
moduleNames.forEach(function (step) {
|
|
1245
|
-
var reusedModule =
|
|
1159
|
+
var reusedModule = _this7.getReusableSharedSubModule(step);
|
|
1246
1160
|
if (reusedModule) {
|
|
1247
|
-
|
|
1248
|
-
|
|
1161
|
+
_this7.store[step] = reusedModule;
|
|
1162
|
+
_this7.reusedSharedSubModuleNames.add(step);
|
|
1249
1163
|
return;
|
|
1250
1164
|
}
|
|
1251
|
-
var targetModule =
|
|
1165
|
+
var targetModule = _this7.createSubModule(step);
|
|
1252
1166
|
if (!targetModule) {
|
|
1253
1167
|
throw new Error("\u6A21\u5757 ".concat(step, " \u4E0D\u5B58\u5728"));
|
|
1254
1168
|
}
|
|
1255
|
-
var hooks =
|
|
1256
|
-
|
|
1257
|
-
|
|
1169
|
+
var hooks = _this7.getSubModuleHooks(step);
|
|
1170
|
+
_this7.store[step] = targetModule;
|
|
1171
|
+
_this7.core.registerModule(targetModule, _objectSpread(_objectSpread({
|
|
1258
1172
|
initialState: (targetCacheData === null || targetCacheData === void 0 ? void 0 : targetCacheData[targetModule.name]) || {}
|
|
1259
1173
|
}, hooks ? {
|
|
1260
1174
|
hooks: hooks
|
|
1261
1175
|
} : {}), {}, {
|
|
1262
|
-
otherParams:
|
|
1176
|
+
otherParams: _this7.buildSubModuleOtherParams()
|
|
1263
1177
|
}));
|
|
1264
1178
|
});
|
|
1265
1179
|
if (!(this.store.schedule && !this.isScheduleListLoaded(this.store.schedule))) {
|
|
@@ -1293,15 +1207,15 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1293
1207
|
value: function () {
|
|
1294
1208
|
var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
|
|
1295
1209
|
var _this$serverOrderChan2,
|
|
1296
|
-
|
|
1210
|
+
_this8 = this;
|
|
1297
1211
|
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
1298
1212
|
while (1) switch (_context12.prev = _context12.next) {
|
|
1299
1213
|
case 0:
|
|
1300
1214
|
(_this$serverOrderChan2 = this.serverOrderChangeUnsubscribe) === null || _this$serverOrderChan2 === void 0 || _this$serverOrderChan2.call(this);
|
|
1301
1215
|
this.serverOrderChangeUnsubscribe = null;
|
|
1302
1216
|
Object.keys(this.store).forEach(function (key) {
|
|
1303
|
-
if (
|
|
1304
|
-
var sub =
|
|
1217
|
+
if (_this8.reusedSharedSubModuleNames.has(key)) return;
|
|
1218
|
+
var sub = _this8.store[key];
|
|
1305
1219
|
if (sub && typeof sub.destroy === 'function') {
|
|
1306
1220
|
try {
|
|
1307
1221
|
sub.destroy();
|
|
@@ -1339,7 +1253,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1339
1253
|
key: "loadSalesDetail",
|
|
1340
1254
|
value: (function () {
|
|
1341
1255
|
var _loadSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(orderIdOrParams) {
|
|
1342
|
-
var loadSequence, _ref17, _ref18, _ref19, _ref20, _params$orderId, params, externalSaleNumber, preloadedSalesDetail, lookup, loadedRecord, message, remoteRecord, currentTempOrder,
|
|
1256
|
+
var loadSequence, _ref17, _ref18, _ref19, _ref20, _params$orderId, params, externalSaleNumber, preloadedSalesDetail, lookup, loadedRecord, message, remoteRecord, currentTempOrder, record;
|
|
1343
1257
|
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
1344
1258
|
while (1) switch (_context13.prev = _context13.next) {
|
|
1345
1259
|
case 0:
|
|
@@ -1388,40 +1302,39 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1388
1302
|
message = loadedRecord && (loadedRecord.message || loadedRecord.msg) || "\u52A0\u8F7D\u9500\u552E\u8BE6\u60C5\u5931\u8D25: ".concat(lookup);
|
|
1389
1303
|
throw new Error(message);
|
|
1390
1304
|
case 22:
|
|
1391
|
-
remoteRecord =
|
|
1305
|
+
remoteRecord = preloadedSalesDetail !== null && preloadedSalesDetail !== void 0 ? preloadedSalesDetail : loadedRecord.data;
|
|
1392
1306
|
currentTempOrder = params.merge ? this.store.order.getTempOrder() : null;
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
_context13.next = 28;
|
|
1307
|
+
record = params.merge ? mergeSalesDetailRecordWithTempOrder(currentTempOrder, remoteRecord, 'preserve-local') : remoteRecord;
|
|
1308
|
+
_context13.next = 27;
|
|
1396
1309
|
return this.hydrateLatestLoadedSalesDetail(record, loadSequence);
|
|
1397
|
-
case
|
|
1310
|
+
case 27:
|
|
1398
1311
|
return _context13.abrupt("return", _context13.sent);
|
|
1399
|
-
case
|
|
1400
|
-
_context13.prev =
|
|
1312
|
+
case 28:
|
|
1313
|
+
_context13.prev = 28;
|
|
1401
1314
|
this.salesDetailLoadInFlightCount = Math.max(0, this.salesDetailLoadInFlightCount - 1);
|
|
1402
1315
|
if (!(this.salesDetailLoadInFlightCount === 0)) {
|
|
1403
|
-
_context13.next =
|
|
1316
|
+
_context13.next = 39;
|
|
1404
1317
|
break;
|
|
1405
1318
|
}
|
|
1406
|
-
_context13.prev =
|
|
1407
|
-
_context13.next =
|
|
1319
|
+
_context13.prev = 31;
|
|
1320
|
+
_context13.next = 34;
|
|
1408
1321
|
return this.drainQueuedServerOrderChanges();
|
|
1409
|
-
case
|
|
1410
|
-
_context13.next =
|
|
1322
|
+
case 34:
|
|
1323
|
+
_context13.next = 39;
|
|
1411
1324
|
break;
|
|
1412
|
-
case
|
|
1413
|
-
_context13.prev =
|
|
1414
|
-
_context13.t1 = _context13["catch"](
|
|
1325
|
+
case 36:
|
|
1326
|
+
_context13.prev = 36;
|
|
1327
|
+
_context13.t1 = _context13["catch"](31);
|
|
1415
1328
|
this.logError('drain queued server order changes failed', {
|
|
1416
1329
|
error: _context13.t1 instanceof Error ? _context13.t1.message : String(_context13.t1)
|
|
1417
1330
|
});
|
|
1331
|
+
case 39:
|
|
1332
|
+
return _context13.finish(28);
|
|
1418
1333
|
case 40:
|
|
1419
|
-
return _context13.finish(29);
|
|
1420
|
-
case 41:
|
|
1421
1334
|
case "end":
|
|
1422
1335
|
return _context13.stop();
|
|
1423
1336
|
}
|
|
1424
|
-
}, _callee13, this, [[4,,
|
|
1337
|
+
}, _callee13, this, [[4,, 28, 40], [31, 36]]);
|
|
1425
1338
|
}));
|
|
1426
1339
|
function loadSalesDetail(_x11) {
|
|
1427
1340
|
return _loadSalesDetail.apply(this, arguments);
|
|
@@ -1849,10 +1762,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1849
1762
|
}, {
|
|
1850
1763
|
key: "getHistoricalProductDiscountList",
|
|
1851
1764
|
value: function getHistoricalProductDiscountList(products) {
|
|
1852
|
-
var
|
|
1765
|
+
var _this9 = this;
|
|
1853
1766
|
var historyDiscountList = [];
|
|
1854
1767
|
products.forEach(function (item) {
|
|
1855
|
-
if (!
|
|
1768
|
+
if (!_this9.isPersistedOrderProduct(item)) return;
|
|
1856
1769
|
(item.discount_list || []).forEach(function (discount) {
|
|
1857
1770
|
var _discount$discount, _discount$metadata, _discount$discount2, _discount$discount3, _discount$discount4;
|
|
1858
1771
|
var discountId = ((_discount$discount = discount.discount) === null || _discount$discount === void 0 ? void 0 : _discount$discount.resource_id) || discount.id;
|
|
@@ -1912,11 +1825,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1912
1825
|
}, {
|
|
1913
1826
|
key: "shouldSkipAutoApplyFetchedDiscountsInEditMode",
|
|
1914
1827
|
value: function shouldSkipAutoApplyFetchedDiscountsInEditMode(params) {
|
|
1915
|
-
var
|
|
1828
|
+
var _this10 = this;
|
|
1916
1829
|
if (params.discountAction !== 'edit') return false;
|
|
1917
1830
|
if (!params.products.length) return false;
|
|
1918
1831
|
var hasDraftProduct = params.products.some(function (product) {
|
|
1919
|
-
return !
|
|
1832
|
+
return !_this10.isPersistedOrderProduct(product);
|
|
1920
1833
|
});
|
|
1921
1834
|
if (hasDraftProduct) return false;
|
|
1922
1835
|
var hasSelectedDiscount = params.currentDiscountList.some(function (discount) {
|
|
@@ -2719,10 +2632,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2719
2632
|
return submitSalesOrder;
|
|
2720
2633
|
}())
|
|
2721
2634
|
}, {
|
|
2722
|
-
key: "
|
|
2635
|
+
key: "submitTempOrderAsync",
|
|
2723
2636
|
value: function () {
|
|
2724
|
-
var
|
|
2725
|
-
var
|
|
2637
|
+
var _submitTempOrderAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(params) {
|
|
2638
|
+
var _this$otherParams10, _this$otherParams11, _this$otherParams12, _this$otherParams13;
|
|
2639
|
+
var inferredPaymentStatus, submitParams;
|
|
2726
2640
|
return _regeneratorRuntime().wrap(function _callee28$(_context28) {
|
|
2727
2641
|
while (1) switch (_context28.prev = _context28.next) {
|
|
2728
2642
|
case 0:
|
|
@@ -2731,49 +2645,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2731
2645
|
break;
|
|
2732
2646
|
}
|
|
2733
2647
|
throw new Error('BaseSales 解决方案需要 order 模块支持');
|
|
2734
|
-
case 2:
|
|
2735
|
-
return _context28.abrupt("return", this.store.order.saveTempOrderAsDraft(_objectSpread({
|
|
2736
|
-
cacheId: this.cacheId,
|
|
2737
|
-
platform: (_params$platform = params === null || params === void 0 ? void 0 : params.platform) !== null && _params$platform !== void 0 ? _params$platform : (_this$otherParams10 = this.otherParams) === null || _this$otherParams10 === void 0 ? void 0 : _this$otherParams10.platform,
|
|
2738
|
-
businessCode: (_ref22 = (_params$businessCode = params === null || params === void 0 ? void 0 : params.businessCode) !== null && _params$businessCode !== void 0 ? _params$businessCode : (_this$otherParams11 = this.otherParams) === null || _this$otherParams11 === void 0 ? void 0 : _this$otherParams11.businessCode) !== null && _ref22 !== void 0 ? _ref22 : (_this$otherParams12 = this.otherParams) === null || _this$otherParams12 === void 0 ? void 0 : _this$otherParams12.business_code,
|
|
2739
|
-
channel: (_params$channel = params === null || params === void 0 ? void 0 : params.channel) !== null && _params$channel !== void 0 ? _params$channel : this.getSubmitOrderSalesChannel(),
|
|
2740
|
-
type: (_params$type = params === null || params === void 0 ? void 0 : params.type) !== null && _params$type !== void 0 ? _params$type : (_this$otherParams13 = this.otherParams) === null || _this$otherParams13 === void 0 ? void 0 : _this$otherParams13.type
|
|
2741
|
-
}, (params === null || params === void 0 ? void 0 : params.enhancePayload) !== undefined ? {
|
|
2742
|
-
enhancePayload: params.enhancePayload
|
|
2743
|
-
} : {})));
|
|
2744
|
-
case 3:
|
|
2745
|
-
case "end":
|
|
2746
|
-
return _context28.stop();
|
|
2747
|
-
}
|
|
2748
|
-
}, _callee28, this);
|
|
2749
|
-
}));
|
|
2750
|
-
function saveSalesOrderDraft(_x22) {
|
|
2751
|
-
return _saveSalesOrderDraft.apply(this, arguments);
|
|
2752
|
-
}
|
|
2753
|
-
return saveSalesOrderDraft;
|
|
2754
|
-
}()
|
|
2755
|
-
}, {
|
|
2756
|
-
key: "submitTempOrderAsync",
|
|
2757
|
-
value: function () {
|
|
2758
|
-
var _submitTempOrderAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(params) {
|
|
2759
|
-
var _this$otherParams14, _this$otherParams15, _this$otherParams16, _this$otherParams17;
|
|
2760
|
-
var inferredPaymentStatus, submitParams;
|
|
2761
|
-
return _regeneratorRuntime().wrap(function _callee29$(_context29) {
|
|
2762
|
-
while (1) switch (_context29.prev = _context29.next) {
|
|
2763
|
-
case 0:
|
|
2764
|
-
if (this.store.order) {
|
|
2765
|
-
_context29.next = 2;
|
|
2766
|
-
break;
|
|
2767
|
-
}
|
|
2768
|
-
throw new Error('BaseSales 解决方案需要 order 模块支持');
|
|
2769
2648
|
case 2:
|
|
2770
2649
|
inferredPaymentStatus = this.getSubmitPaymentStatus(params === null || params === void 0 ? void 0 : params.paymentStatus);
|
|
2771
2650
|
submitParams = _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
2772
2651
|
cacheId: this.cacheId,
|
|
2773
|
-
platform: (_this$
|
|
2774
|
-
businessCode: ((_this$
|
|
2652
|
+
platform: (_this$otherParams10 = this.otherParams) === null || _this$otherParams10 === void 0 ? void 0 : _this$otherParams10.platform,
|
|
2653
|
+
businessCode: ((_this$otherParams11 = this.otherParams) === null || _this$otherParams11 === void 0 ? void 0 : _this$otherParams11.businessCode) || ((_this$otherParams12 = this.otherParams) === null || _this$otherParams12 === void 0 ? void 0 : _this$otherParams12.business_code),
|
|
2775
2654
|
channel: this.getSubmitOrderSalesChannel(),
|
|
2776
|
-
type: (_this$
|
|
2655
|
+
type: (_this$otherParams13 = this.otherParams) === null || _this$otherParams13 === void 0 ? void 0 : _this$otherParams13.type
|
|
2777
2656
|
}, (params === null || params === void 0 ? void 0 : params.payments) !== undefined ? {
|
|
2778
2657
|
payments: params.payments
|
|
2779
2658
|
} : {}), inferredPaymentStatus !== undefined ? {
|
|
@@ -2785,14 +2664,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2785
2664
|
} : {}), (params === null || params === void 0 ? void 0 : params.enhancePayload) !== undefined ? {
|
|
2786
2665
|
enhancePayload: params.enhancePayload
|
|
2787
2666
|
} : {});
|
|
2788
|
-
return
|
|
2667
|
+
return _context28.abrupt("return", this.store.order.submitTempOrderAsync(submitParams));
|
|
2789
2668
|
case 5:
|
|
2790
2669
|
case "end":
|
|
2791
|
-
return
|
|
2670
|
+
return _context28.stop();
|
|
2792
2671
|
}
|
|
2793
|
-
},
|
|
2672
|
+
}, _callee28, this);
|
|
2794
2673
|
}));
|
|
2795
|
-
function submitTempOrderAsync(
|
|
2674
|
+
function submitTempOrderAsync(_x22) {
|
|
2796
2675
|
return _submitTempOrderAsync.apply(this, arguments);
|
|
2797
2676
|
}
|
|
2798
2677
|
return submitTempOrderAsync;
|
|
@@ -2800,14 +2679,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2800
2679
|
}, {
|
|
2801
2680
|
key: "printLocalOrderReceipt",
|
|
2802
2681
|
value: function () {
|
|
2803
|
-
var _printLocalOrderReceipt = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2804
|
-
var _this$
|
|
2682
|
+
var _printLocalOrderReceipt = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(lookup) {
|
|
2683
|
+
var _this$otherParams14, _this$otherParams15, _this$otherParams16, _this$otherParams17;
|
|
2805
2684
|
var hasLookup, lookupPayload, context, payload, response, _this$store$order$app, _this$store$order5, _data;
|
|
2806
|
-
return _regeneratorRuntime().wrap(function
|
|
2807
|
-
while (1) switch (
|
|
2685
|
+
return _regeneratorRuntime().wrap(function _callee29$(_context29) {
|
|
2686
|
+
while (1) switch (_context29.prev = _context29.next) {
|
|
2808
2687
|
case 0:
|
|
2809
2688
|
if (this.store.order) {
|
|
2810
|
-
|
|
2689
|
+
_context29.next = 2;
|
|
2811
2690
|
break;
|
|
2812
2691
|
}
|
|
2813
2692
|
throw new Error('BaseSales 解决方案需要 order 模块支持');
|
|
@@ -2819,10 +2698,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2819
2698
|
external_sale_number: lookup
|
|
2820
2699
|
};
|
|
2821
2700
|
context = {
|
|
2822
|
-
platform: (_this$
|
|
2823
|
-
businessCode: ((_this$
|
|
2701
|
+
platform: (_this$otherParams14 = this.otherParams) === null || _this$otherParams14 === void 0 ? void 0 : _this$otherParams14.platform,
|
|
2702
|
+
businessCode: ((_this$otherParams15 = this.otherParams) === null || _this$otherParams15 === void 0 ? void 0 : _this$otherParams15.businessCode) || ((_this$otherParams16 = this.otherParams) === null || _this$otherParams16 === void 0 ? void 0 : _this$otherParams16.business_code),
|
|
2824
2703
|
channel: this.getSubmitOrderSalesChannel(),
|
|
2825
|
-
type: (_this$
|
|
2704
|
+
type: (_this$otherParams17 = this.otherParams) === null || _this$otherParams17 === void 0 ? void 0 : _this$otherParams17.type
|
|
2826
2705
|
};
|
|
2827
2706
|
payload = hasLookup ? _objectSpread(_objectSpread({}, lookupPayload), {}, {
|
|
2828
2707
|
lookup_order_from_db: 1,
|
|
@@ -2838,28 +2717,28 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2838
2717
|
channel: context.channel,
|
|
2839
2718
|
type: context.type
|
|
2840
2719
|
});
|
|
2841
|
-
|
|
2720
|
+
_context29.next = 8;
|
|
2842
2721
|
return this.request.post('/local/print-order', payload, {
|
|
2843
2722
|
osServer: true,
|
|
2844
2723
|
customToast: function customToast() {}
|
|
2845
2724
|
});
|
|
2846
2725
|
case 8:
|
|
2847
|
-
response =
|
|
2726
|
+
response = _context29.sent;
|
|
2848
2727
|
if (hasLookup) {
|
|
2849
|
-
|
|
2728
|
+
_context29.next = 12;
|
|
2850
2729
|
break;
|
|
2851
2730
|
}
|
|
2852
|
-
|
|
2731
|
+
_context29.next = 12;
|
|
2853
2732
|
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);
|
|
2854
2733
|
case 12:
|
|
2855
|
-
return
|
|
2734
|
+
return _context29.abrupt("return", response);
|
|
2856
2735
|
case 13:
|
|
2857
2736
|
case "end":
|
|
2858
|
-
return
|
|
2737
|
+
return _context29.stop();
|
|
2859
2738
|
}
|
|
2860
|
-
},
|
|
2739
|
+
}, _callee29, this);
|
|
2861
2740
|
}));
|
|
2862
|
-
function printLocalOrderReceipt(
|
|
2741
|
+
function printLocalOrderReceipt(_x23) {
|
|
2863
2742
|
return _printLocalOrderReceipt.apply(this, arguments);
|
|
2864
2743
|
}
|
|
2865
2744
|
return printLocalOrderReceipt;
|
|
@@ -2880,20 +2759,20 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2880
2759
|
}, {
|
|
2881
2760
|
key: "syncPaymentsToOrder",
|
|
2882
2761
|
value: function () {
|
|
2883
|
-
var _syncPaymentsToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2884
|
-
var
|
|
2762
|
+
var _syncPaymentsToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(params) {
|
|
2763
|
+
var _ref22, _params$businessCode, _this$otherParams18, _this$otherParams19, _params$channel;
|
|
2885
2764
|
var businessCode, channel, syncParams, syncState, payments, syncResult, latestPayments, amountSnapshot, orderSnapshot, syncPayload;
|
|
2886
|
-
return _regeneratorRuntime().wrap(function
|
|
2887
|
-
while (1) switch (
|
|
2765
|
+
return _regeneratorRuntime().wrap(function _callee30$(_context30) {
|
|
2766
|
+
while (1) switch (_context30.prev = _context30.next) {
|
|
2888
2767
|
case 0:
|
|
2889
2768
|
if (this.store.order) {
|
|
2890
|
-
|
|
2769
|
+
_context30.next = 2;
|
|
2891
2770
|
break;
|
|
2892
2771
|
}
|
|
2893
2772
|
throw new Error('order 模块未初始化');
|
|
2894
2773
|
case 2:
|
|
2895
|
-
businessCode = (
|
|
2896
|
-
channel = (_params$
|
|
2774
|
+
businessCode = (_ref22 = (_params$businessCode = params.businessCode) !== null && _params$businessCode !== void 0 ? _params$businessCode : (_this$otherParams18 = this.otherParams) === null || _this$otherParams18 === void 0 ? void 0 : _this$otherParams18.businessCode) !== null && _ref22 !== void 0 ? _ref22 : (_this$otherParams19 = this.otherParams) === null || _this$otherParams19 === void 0 ? void 0 : _this$otherParams19.business_code;
|
|
2775
|
+
channel = (_params$channel = params.channel) !== null && _params$channel !== void 0 ? _params$channel : this.getSubmitOrderSalesChannel();
|
|
2897
2776
|
syncParams = _objectSpread(_objectSpread(_objectSpread({}, params), businessCode !== undefined ? {
|
|
2898
2777
|
businessCode: businessCode
|
|
2899
2778
|
} : {}), channel !== undefined ? {
|
|
@@ -2901,14 +2780,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2901
2780
|
} : {});
|
|
2902
2781
|
syncState = this.store.order.getOrderSyncState();
|
|
2903
2782
|
if (!(params.submitWhenPaid && syncState === 'submitting')) {
|
|
2904
|
-
|
|
2783
|
+
_context30.next = 9;
|
|
2905
2784
|
break;
|
|
2906
2785
|
}
|
|
2907
2786
|
this.queueLatestAutoPaymentSync();
|
|
2908
|
-
return
|
|
2787
|
+
return _context30.abrupt("return", this.store.order.syncPaymentsToOrder(syncParams));
|
|
2909
2788
|
case 9:
|
|
2910
2789
|
payments = params.payments || [];
|
|
2911
|
-
|
|
2790
|
+
_context30.next = 12;
|
|
2912
2791
|
return this.effectsEmit(BaseSalesHookNames.onPaymentSyncStart, {
|
|
2913
2792
|
payments: payments,
|
|
2914
2793
|
params: syncParams,
|
|
@@ -2916,11 +2795,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2916
2795
|
orderSnapshot: this.store.order.getOrderSnapshot()
|
|
2917
2796
|
});
|
|
2918
2797
|
case 12:
|
|
2919
|
-
|
|
2920
|
-
|
|
2798
|
+
_context30.prev = 12;
|
|
2799
|
+
_context30.next = 15;
|
|
2921
2800
|
return this.store.order.syncPaymentsToOrder(syncParams);
|
|
2922
2801
|
case 15:
|
|
2923
|
-
syncResult =
|
|
2802
|
+
syncResult = _context30.sent;
|
|
2924
2803
|
latestPayments = this.store.order.getOrderPayments();
|
|
2925
2804
|
amountSnapshot = this.store.order.getOrderAmountSnapshot();
|
|
2926
2805
|
orderSnapshot = this.store.order.getOrderSnapshot();
|
|
@@ -2938,25 +2817,25 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2938
2817
|
depositAmount: syncResult.depositAmount,
|
|
2939
2818
|
orderExpectedAmount: syncResult.orderExpectedAmount
|
|
2940
2819
|
};
|
|
2941
|
-
|
|
2820
|
+
_context30.next = 22;
|
|
2942
2821
|
return this.effectsEmit(BaseSalesHookNames.onPaymentSyncEnd, syncPayload);
|
|
2943
2822
|
case 22:
|
|
2944
2823
|
if (!(syncResult.isDepositFullyPaid && !syncResult.isOrderFullyPaid)) {
|
|
2945
|
-
|
|
2824
|
+
_context30.next = 25;
|
|
2946
2825
|
break;
|
|
2947
2826
|
}
|
|
2948
|
-
|
|
2827
|
+
_context30.next = 25;
|
|
2949
2828
|
return this.effectsEmit(BaseSalesHookNames.onDepositPaymentSyncEnd, syncPayload);
|
|
2950
2829
|
case 25:
|
|
2951
2830
|
this.scheduleQueuedAutoPaymentSyncFlush(0);
|
|
2952
|
-
return
|
|
2831
|
+
return _context30.abrupt("return", syncResult);
|
|
2953
2832
|
case 29:
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
|
|
2833
|
+
_context30.prev = 29;
|
|
2834
|
+
_context30.t0 = _context30["catch"](12);
|
|
2835
|
+
_context30.next = 33;
|
|
2957
2836
|
return this.effectsEmit(BaseSalesHookNames.onPaymentSyncEnd, {
|
|
2958
2837
|
ok: false,
|
|
2959
|
-
error:
|
|
2838
|
+
error: _context30.t0,
|
|
2960
2839
|
payments: this.store.order.getOrderPayments(),
|
|
2961
2840
|
params: syncParams,
|
|
2962
2841
|
amountSnapshot: this.store.order.getOrderAmountSnapshot(),
|
|
@@ -2964,14 +2843,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2964
2843
|
});
|
|
2965
2844
|
case 33:
|
|
2966
2845
|
this.scheduleQueuedAutoPaymentSyncFlush(0);
|
|
2967
|
-
throw
|
|
2846
|
+
throw _context30.t0;
|
|
2968
2847
|
case 35:
|
|
2969
2848
|
case "end":
|
|
2970
|
-
return
|
|
2849
|
+
return _context30.stop();
|
|
2971
2850
|
}
|
|
2972
|
-
},
|
|
2851
|
+
}, _callee30, this, [[12, 29]]);
|
|
2973
2852
|
}));
|
|
2974
|
-
function syncPaymentsToOrder(
|
|
2853
|
+
function syncPaymentsToOrder(_x24) {
|
|
2975
2854
|
return _syncPaymentsToOrder.apply(this, arguments);
|
|
2976
2855
|
}
|
|
2977
2856
|
return syncPaymentsToOrder;
|
|
@@ -3008,58 +2887,58 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3008
2887
|
}, {
|
|
3009
2888
|
key: "scheduleQueuedAutoPaymentSyncFlush",
|
|
3010
2889
|
value: function scheduleQueuedAutoPaymentSyncFlush() {
|
|
3011
|
-
var
|
|
2890
|
+
var _this11 = this;
|
|
3012
2891
|
var delay = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 100;
|
|
3013
2892
|
if (!this.queuedAutoPaymentSync) return;
|
|
3014
2893
|
if (this.autoPaymentSyncTimer) return;
|
|
3015
2894
|
this.autoPaymentSyncTimer = setTimeout(function () {
|
|
3016
|
-
|
|
3017
|
-
void
|
|
2895
|
+
_this11.autoPaymentSyncTimer = null;
|
|
2896
|
+
void _this11.flushQueuedAutoPaymentSync();
|
|
3018
2897
|
}, delay);
|
|
3019
2898
|
}
|
|
3020
2899
|
}, {
|
|
3021
2900
|
key: "flushQueuedAutoPaymentSync",
|
|
3022
2901
|
value: function () {
|
|
3023
|
-
var _flushQueuedAutoPaymentSync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2902
|
+
var _flushQueuedAutoPaymentSync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31() {
|
|
3024
2903
|
var payments;
|
|
3025
|
-
return _regeneratorRuntime().wrap(function
|
|
3026
|
-
while (1) switch (
|
|
2904
|
+
return _regeneratorRuntime().wrap(function _callee31$(_context31) {
|
|
2905
|
+
while (1) switch (_context31.prev = _context31.next) {
|
|
3027
2906
|
case 0:
|
|
3028
2907
|
if (this.store.order) {
|
|
3029
|
-
|
|
2908
|
+
_context31.next = 2;
|
|
3030
2909
|
break;
|
|
3031
2910
|
}
|
|
3032
|
-
return
|
|
2911
|
+
return _context31.abrupt("return");
|
|
3033
2912
|
case 2:
|
|
3034
2913
|
if (!(!this.queuedAutoPaymentSync || this.autoPaymentSyncFlushing)) {
|
|
3035
|
-
|
|
2914
|
+
_context31.next = 4;
|
|
3036
2915
|
break;
|
|
3037
2916
|
}
|
|
3038
|
-
return
|
|
2917
|
+
return _context31.abrupt("return");
|
|
3039
2918
|
case 4:
|
|
3040
2919
|
if (!(this.store.order.getOrderSyncState() === 'submitting')) {
|
|
3041
|
-
|
|
2920
|
+
_context31.next = 7;
|
|
3042
2921
|
break;
|
|
3043
2922
|
}
|
|
3044
2923
|
this.scheduleQueuedAutoPaymentSyncFlush();
|
|
3045
|
-
return
|
|
2924
|
+
return _context31.abrupt("return");
|
|
3046
2925
|
case 7:
|
|
3047
2926
|
this.autoPaymentSyncFlushing = true;
|
|
3048
|
-
|
|
2927
|
+
_context31.prev = 8;
|
|
3049
2928
|
case 9:
|
|
3050
2929
|
if (!this.queuedAutoPaymentSync) {
|
|
3051
|
-
|
|
2930
|
+
_context31.next = 18;
|
|
3052
2931
|
break;
|
|
3053
2932
|
}
|
|
3054
2933
|
this.queuedAutoPaymentSync = false;
|
|
3055
2934
|
payments = this.store.order.getOrderPayments();
|
|
3056
2935
|
if (payments.length) {
|
|
3057
|
-
|
|
2936
|
+
_context31.next = 14;
|
|
3058
2937
|
break;
|
|
3059
2938
|
}
|
|
3060
|
-
return
|
|
2939
|
+
return _context31.abrupt("continue", 9);
|
|
3061
2940
|
case 14:
|
|
3062
|
-
|
|
2941
|
+
_context31.next = 16;
|
|
3063
2942
|
return this.syncPaymentsToOrder({
|
|
3064
2943
|
payments: payments,
|
|
3065
2944
|
paymentStatus: this.getPaymentStatusForSync(payments),
|
|
@@ -3067,91 +2946,44 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3067
2946
|
smallTicketDataFlag: 1
|
|
3068
2947
|
});
|
|
3069
2948
|
case 16:
|
|
3070
|
-
|
|
2949
|
+
_context31.next = 9;
|
|
3071
2950
|
break;
|
|
3072
2951
|
case 18:
|
|
3073
|
-
|
|
2952
|
+
_context31.next = 23;
|
|
3074
2953
|
break;
|
|
3075
2954
|
case 20:
|
|
3076
|
-
|
|
3077
|
-
|
|
2955
|
+
_context31.prev = 20;
|
|
2956
|
+
_context31.t0 = _context31["catch"](8);
|
|
3078
2957
|
this.logError('queued auto sync payments failed', {
|
|
3079
|
-
error:
|
|
2958
|
+
error: _context31.t0 instanceof Error ? _context31.t0.message : String(_context31.t0)
|
|
3080
2959
|
});
|
|
3081
2960
|
case 23:
|
|
3082
|
-
|
|
2961
|
+
_context31.prev = 23;
|
|
3083
2962
|
this.autoPaymentSyncFlushing = false;
|
|
3084
2963
|
if (this.queuedAutoPaymentSync) {
|
|
3085
2964
|
this.scheduleQueuedAutoPaymentSyncFlush(0);
|
|
3086
2965
|
}
|
|
3087
|
-
return
|
|
2966
|
+
return _context31.finish(23);
|
|
3088
2967
|
case 27:
|
|
3089
2968
|
case "end":
|
|
3090
|
-
return
|
|
2969
|
+
return _context31.stop();
|
|
3091
2970
|
}
|
|
3092
|
-
},
|
|
2971
|
+
}, _callee31, this, [[8, 20, 23, 27]]);
|
|
3093
2972
|
}));
|
|
3094
2973
|
function flushQueuedAutoPaymentSync() {
|
|
3095
2974
|
return _flushQueuedAutoPaymentSync.apply(this, arguments);
|
|
3096
2975
|
}
|
|
3097
2976
|
return flushQueuedAutoPaymentSync;
|
|
3098
|
-
}()
|
|
3099
|
-
/**
|
|
3100
|
-
* 同步兼容入口。无法等待 IoT 短号时,按调用当下的 device_id 或 LOCAL 生成。
|
|
3101
|
-
*/
|
|
2977
|
+
}() /** 追加单个支付项到当前订单。 */
|
|
3102
2978
|
}, {
|
|
3103
2979
|
key: "addOrderPayment",
|
|
3104
2980
|
value: function addOrderPayment(payment) {
|
|
3105
|
-
var
|
|
3106
|
-
return this.addOrderPaymentWithDevicePrefix(payment, hasPaymentNumber ? 'LOCAL' : this.getPaymentNumberDevicePrefixSync());
|
|
3107
|
-
}
|
|
3108
|
-
|
|
3109
|
-
/** 创建新支付项时读取最新设备短号,不缓存运行时设备信息。 */
|
|
3110
|
-
}, {
|
|
3111
|
-
key: "addOrderPaymentAsync",
|
|
3112
|
-
value: (function () {
|
|
3113
|
-
var _addOrderPaymentAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(payment) {
|
|
3114
|
-
var paymentRecord, hasPaymentNumber, devicePrefix;
|
|
3115
|
-
return _regeneratorRuntime().wrap(function _callee33$(_context33) {
|
|
3116
|
-
while (1) switch (_context33.prev = _context33.next) {
|
|
3117
|
-
case 0:
|
|
3118
|
-
paymentRecord = payment;
|
|
3119
|
-
hasPaymentNumber = String(paymentRecord.payment_number || '').trim() !== '';
|
|
3120
|
-
if (!hasPaymentNumber) {
|
|
3121
|
-
_context33.next = 6;
|
|
3122
|
-
break;
|
|
3123
|
-
}
|
|
3124
|
-
_context33.t0 = 'LOCAL';
|
|
3125
|
-
_context33.next = 9;
|
|
3126
|
-
break;
|
|
3127
|
-
case 6:
|
|
3128
|
-
_context33.next = 8;
|
|
3129
|
-
return this.getPaymentNumberDevicePrefixAsync();
|
|
3130
|
-
case 8:
|
|
3131
|
-
_context33.t0 = _context33.sent;
|
|
3132
|
-
case 9:
|
|
3133
|
-
devicePrefix = _context33.t0;
|
|
3134
|
-
return _context33.abrupt("return", this.addOrderPaymentWithDevicePrefix(payment, devicePrefix));
|
|
3135
|
-
case 11:
|
|
3136
|
-
case "end":
|
|
3137
|
-
return _context33.stop();
|
|
3138
|
-
}
|
|
3139
|
-
}, _callee33, this);
|
|
3140
|
-
}));
|
|
3141
|
-
function addOrderPaymentAsync(_x26) {
|
|
3142
|
-
return _addOrderPaymentAsync.apply(this, arguments);
|
|
3143
|
-
}
|
|
3144
|
-
return addOrderPaymentAsync;
|
|
3145
|
-
}())
|
|
3146
|
-
}, {
|
|
3147
|
-
key: "addOrderPaymentWithDevicePrefix",
|
|
3148
|
-
value: function addOrderPaymentWithDevicePrefix(payment, devicePrefix) {
|
|
3149
|
-
var _this$otherParams24,
|
|
2981
|
+
var _this$otherParams20,
|
|
3150
2982
|
_paymentRecord$paymen,
|
|
3151
2983
|
_paymentRecord$create,
|
|
3152
|
-
|
|
2984
|
+
_ref23,
|
|
3153
2985
|
_paymentRecord$origin,
|
|
3154
|
-
|
|
2986
|
+
_this12 = this;
|
|
3155
2987
|
if (!this.store.order) throw new Error('order 模块未初始化');
|
|
3156
2988
|
var paymentRecord = payment;
|
|
3157
2989
|
var paymentAmount = new Decimal(paymentRecord.amount || 0);
|
|
@@ -3162,26 +2994,25 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3162
2994
|
return this.store.order.getOrderPayments();
|
|
3163
2995
|
}
|
|
3164
2996
|
var metadata = paymentRecord.metadata && _typeof(paymentRecord.metadata) === 'object' ? _objectSpread({}, paymentRecord.metadata) : {};
|
|
3165
|
-
var shopWalletPassId = (_this$
|
|
2997
|
+
var shopWalletPassId = (_this$otherParams20 = this.otherParams) === null || _this$otherParams20 === void 0 ? void 0 : _this$otherParams20.shop_wallet_pass_id;
|
|
3166
2998
|
if (shopWalletPassId !== undefined && shopWalletPassId !== null) {
|
|
3167
2999
|
metadata.shop_wallet_pass_id = shopWalletPassId;
|
|
3168
3000
|
}
|
|
3169
|
-
|
|
3001
|
+
if (!metadata.unique_payment_number) {
|
|
3002
|
+
metadata.unique_payment_number = createUuidV4();
|
|
3003
|
+
}
|
|
3170
3004
|
var paymentTimestamp = dayjs().format('YYYY-MM-DD HH:mm:ss');
|
|
3171
3005
|
var paymentTime = (_paymentRecord$paymen = paymentRecord.payment_time) !== null && _paymentRecord$paymen !== void 0 ? _paymentRecord$paymen : paymentTimestamp;
|
|
3172
3006
|
var createdAt = (_paymentRecord$create = paymentRecord.created_at) !== null && _paymentRecord$create !== void 0 ? _paymentRecord$create : paymentTimestamp;
|
|
3173
3007
|
var serviceCharge = paymentRecord.service_charge && _typeof(paymentRecord.service_charge) === 'object' ? paymentRecord.service_charge : null;
|
|
3174
|
-
var calculatedServiceFee = serviceCharge ? new Decimal((
|
|
3175
|
-
var payments = this.store.order.addOrderPayment(_objectSpread(_objectSpread(_objectSpread({},
|
|
3008
|
+
var calculatedServiceFee = serviceCharge ? new Decimal((_ref23 = (_paymentRecord$origin = paymentRecord.origin_amount) !== null && _paymentRecord$origin !== void 0 ? _paymentRecord$origin : paymentRecord.amount) !== null && _ref23 !== void 0 ? _ref23 : 0).times(serviceCharge.percentage || 0).plus(serviceCharge.amount || 0).toDecimalPlaces(2).toFixed(2) : undefined;
|
|
3009
|
+
var payments = this.store.order.addOrderPayment(_objectSpread(_objectSpread(_objectSpread({}, paymentRecord), calculatedServiceFee !== undefined ? {
|
|
3176
3010
|
service_fee: calculatedServiceFee
|
|
3177
3011
|
} : {}), {}, {
|
|
3178
3012
|
metadata: metadata,
|
|
3179
3013
|
payment_time: paymentTime,
|
|
3180
3014
|
created_at: createdAt
|
|
3181
3015
|
}));
|
|
3182
|
-
if (paymentRecord.status === 'payment_pending') {
|
|
3183
|
-
return payments;
|
|
3184
|
-
}
|
|
3185
3016
|
var amountSnapshot = this.store.order.getOrderAmountSnapshot();
|
|
3186
3017
|
var syncState = this.store.order.getOrderSyncState();
|
|
3187
3018
|
if (amountSnapshot) {
|
|
@@ -3195,7 +3026,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3195
3026
|
submitWhenPaid: true,
|
|
3196
3027
|
smallTicketDataFlag: 1
|
|
3197
3028
|
}).catch(function (error) {
|
|
3198
|
-
|
|
3029
|
+
_this12.logError('auto sync payments failed', {
|
|
3199
3030
|
error: error instanceof Error ? error.message : String(error)
|
|
3200
3031
|
});
|
|
3201
3032
|
});
|
|
@@ -3206,131 +3037,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3206
3037
|
/** 更新当前订单中的指定支付项。 */
|
|
3207
3038
|
}, {
|
|
3208
3039
|
key: "updateOrderPayment",
|
|
3209
|
-
value:
|
|
3210
|
-
|
|
3211
|
-
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
previousPayment,
|
|
3216
|
-
_this$store$order$get2,
|
|
3217
|
-
currentPayments,
|
|
3218
|
-
_syncResult,
|
|
3219
|
-
_options$smallTicketD,
|
|
3220
|
-
result,
|
|
3221
|
-
draftResult,
|
|
3222
|
-
draftError,
|
|
3223
|
-
becamePaid,
|
|
3224
|
-
shouldSubmit,
|
|
3225
|
-
syncResult,
|
|
3226
|
-
_options$smallTicketD2,
|
|
3227
|
-
_args34 = arguments;
|
|
3228
|
-
return _regeneratorRuntime().wrap(function _callee34$(_context34) {
|
|
3229
|
-
while (1) switch (_context34.prev = _context34.next) {
|
|
3230
|
-
case 0:
|
|
3231
|
-
options = _args34.length > 2 && _args34[2] !== undefined ? _args34[2] : {};
|
|
3232
|
-
if (this.store.order) {
|
|
3233
|
-
_context34.next = 3;
|
|
3234
|
-
break;
|
|
3235
|
-
}
|
|
3236
|
-
throw new Error('order 模块未初始化');
|
|
3237
|
-
case 3:
|
|
3238
|
-
matchMode = options.matchBy === 'compat' || options.matchBy === 'legacy' ? 'compat' : 'payment_number';
|
|
3239
|
-
previousMatch = resolveOrderPaymentIdentity(this.store.order.getOrderPayments(), paymentIdentity, matchMode);
|
|
3240
|
-
previousPayment = previousMatch === null || previousMatch === void 0 ? void 0 : previousMatch.payment;
|
|
3241
|
-
if (!((previousPayment === null || previousPayment === void 0 ? void 0 : previousPayment.status) === 'paid' && !options.applyUpdatesWhenPaid)) {
|
|
3242
|
-
_context34.next = 13;
|
|
3243
|
-
break;
|
|
3244
|
-
}
|
|
3245
|
-
currentPayments = this.store.order.getOrderPayments();
|
|
3246
|
-
if (!(options.submitWhenPaid && options.forceSubmitIfPaid)) {
|
|
3247
|
-
_context34.next = 12;
|
|
3248
|
-
break;
|
|
3249
|
-
}
|
|
3250
|
-
_context34.next = 11;
|
|
3251
|
-
return this.syncPaymentsToOrder({
|
|
3252
|
-
payments: currentPayments,
|
|
3253
|
-
paymentStatus: this.getPaymentStatusForSync(currentPayments),
|
|
3254
|
-
submitWhenPaid: true,
|
|
3255
|
-
smallTicketDataFlag: (_options$smallTicketD = options.smallTicketDataFlag) !== null && _options$smallTicketD !== void 0 ? _options$smallTicketD : 1
|
|
3256
|
-
});
|
|
3257
|
-
case 11:
|
|
3258
|
-
_syncResult = _context34.sent;
|
|
3259
|
-
case 12:
|
|
3260
|
-
return _context34.abrupt("return", _objectSpread({
|
|
3261
|
-
updated: false,
|
|
3262
|
-
payment: previousPayment,
|
|
3263
|
-
payments: currentPayments,
|
|
3264
|
-
summary: ((_this$store$order$get2 = this.store.order.getOrderAmountSnapshot()) === null || _this$store$order$get2 === void 0 ? void 0 : _this$store$order$get2.summary) || null
|
|
3265
|
-
}, _syncResult !== undefined ? {
|
|
3266
|
-
syncResult: _syncResult
|
|
3267
|
-
} : {}));
|
|
3268
|
-
case 13:
|
|
3269
|
-
_context34.next = 15;
|
|
3270
|
-
return this.store.order.updateOrderPayment(paymentIdentity, updates, {
|
|
3271
|
-
matchBy: matchMode
|
|
3272
|
-
});
|
|
3273
|
-
case 15:
|
|
3274
|
-
result = _context34.sent;
|
|
3275
|
-
if (!(options.persistDraft !== false)) {
|
|
3276
|
-
_context34.next = 29;
|
|
3277
|
-
break;
|
|
3278
|
-
}
|
|
3279
|
-
_context34.prev = 17;
|
|
3280
|
-
_context34.next = 20;
|
|
3281
|
-
return this.saveSalesOrderDraft();
|
|
3282
|
-
case 20:
|
|
3283
|
-
draftResult = _context34.sent;
|
|
3284
|
-
_context34.next = 29;
|
|
3285
|
-
break;
|
|
3286
|
-
case 23:
|
|
3287
|
-
_context34.prev = 23;
|
|
3288
|
-
_context34.t0 = _context34["catch"](17);
|
|
3289
|
-
draftError = _context34.t0;
|
|
3290
|
-
this.logError('updateOrderPayment: 保存支付草稿失败', {
|
|
3291
|
-
paymentIdentity: paymentIdentity,
|
|
3292
|
-
error: _context34.t0 instanceof Error ? _context34.t0.message : String(_context34.t0)
|
|
3293
|
-
});
|
|
3294
|
-
if (options.submitWhenPaid) {
|
|
3295
|
-
_context34.next = 29;
|
|
3296
|
-
break;
|
|
3297
|
-
}
|
|
3298
|
-
throw _context34.t0;
|
|
3299
|
-
case 29:
|
|
3300
|
-
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';
|
|
3301
|
-
shouldSubmit = Boolean(options.submitWhenPaid && ((_result$payment2 = result.payment) === null || _result$payment2 === void 0 ? void 0 : _result$payment2.status) === 'paid' && (becamePaid || options.forceSubmitIfPaid));
|
|
3302
|
-
if (!shouldSubmit) {
|
|
3303
|
-
_context34.next = 35;
|
|
3304
|
-
break;
|
|
3305
|
-
}
|
|
3306
|
-
_context34.next = 34;
|
|
3307
|
-
return this.syncPaymentsToOrder({
|
|
3308
|
-
payments: result.payments,
|
|
3309
|
-
paymentStatus: this.getPaymentStatusForSync(result.payments),
|
|
3310
|
-
submitWhenPaid: true,
|
|
3311
|
-
smallTicketDataFlag: (_options$smallTicketD2 = options.smallTicketDataFlag) !== null && _options$smallTicketD2 !== void 0 ? _options$smallTicketD2 : 1
|
|
3312
|
-
});
|
|
3313
|
-
case 34:
|
|
3314
|
-
syncResult = _context34.sent;
|
|
3315
|
-
case 35:
|
|
3316
|
-
return _context34.abrupt("return", _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, result), draftResult !== undefined ? {
|
|
3317
|
-
draftResult: draftResult
|
|
3318
|
-
} : {}), draftError !== undefined ? {
|
|
3319
|
-
draftError: draftError
|
|
3320
|
-
} : {}), syncResult !== undefined ? {
|
|
3321
|
-
syncResult: syncResult
|
|
3322
|
-
} : {}));
|
|
3323
|
-
case 36:
|
|
3324
|
-
case "end":
|
|
3325
|
-
return _context34.stop();
|
|
3326
|
-
}
|
|
3327
|
-
}, _callee34, this, [[17, 23]]);
|
|
3328
|
-
}));
|
|
3329
|
-
function updateOrderPayment(_x27, _x28) {
|
|
3330
|
-
return _updateOrderPayment.apply(this, arguments);
|
|
3331
|
-
}
|
|
3332
|
-
return updateOrderPayment;
|
|
3333
|
-
}() /** 删除当前订单中的指定支付项。 */)
|
|
3040
|
+
value: function updateOrderPayment(paymentIdentity, updates) {
|
|
3041
|
+
if (!this.store.order) throw new Error('order 模块未初始化');
|
|
3042
|
+
return this.store.order.updateOrderPayment(paymentIdentity, updates);
|
|
3043
|
+
}
|
|
3044
|
+
|
|
3045
|
+
/** 删除当前订单中的指定支付项。 */
|
|
3334
3046
|
}, {
|
|
3335
3047
|
key: "deleteOrderPayment",
|
|
3336
3048
|
value: function deleteOrderPayment(paymentIdentity) {
|
|
@@ -3345,31 +3057,6 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3345
3057
|
if (!this.store.order) throw new Error('order 模块未初始化');
|
|
3346
3058
|
return this.store.order.updateVoucherOrderPayments(payments, options);
|
|
3347
3059
|
}
|
|
3348
|
-
}, {
|
|
3349
|
-
key: "updateVoucherOrderPaymentsAsync",
|
|
3350
|
-
value: function () {
|
|
3351
|
-
var _updateVoucherOrderPaymentsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35(payments, options) {
|
|
3352
|
-
return _regeneratorRuntime().wrap(function _callee35$(_context35) {
|
|
3353
|
-
while (1) switch (_context35.prev = _context35.next) {
|
|
3354
|
-
case 0:
|
|
3355
|
-
if (this.store.order) {
|
|
3356
|
-
_context35.next = 2;
|
|
3357
|
-
break;
|
|
3358
|
-
}
|
|
3359
|
-
throw new Error('order 模块未初始化');
|
|
3360
|
-
case 2:
|
|
3361
|
-
return _context35.abrupt("return", this.store.order.updateVoucherOrderPaymentsAsync(payments, options));
|
|
3362
|
-
case 3:
|
|
3363
|
-
case "end":
|
|
3364
|
-
return _context35.stop();
|
|
3365
|
-
}
|
|
3366
|
-
}, _callee35, this);
|
|
3367
|
-
}));
|
|
3368
|
-
function updateVoucherOrderPaymentsAsync(_x29, _x30) {
|
|
3369
|
-
return _updateVoucherOrderPaymentsAsync.apply(this, arguments);
|
|
3370
|
-
}
|
|
3371
|
-
return updateVoucherOrderPaymentsAsync;
|
|
3372
|
-
}()
|
|
3373
3060
|
}, {
|
|
3374
3061
|
key: "confirmPendingVoucherPayments",
|
|
3375
3062
|
value: function confirmPendingVoucherPayments() {
|
|
@@ -3446,20 +3133,20 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3446
3133
|
}, {
|
|
3447
3134
|
key: "initWalletData",
|
|
3448
3135
|
value: function () {
|
|
3449
|
-
var _initWalletData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3450
|
-
var _params$order_wait_pa,
|
|
3136
|
+
var _initWalletData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(params) {
|
|
3137
|
+
var _params$order_wait_pa, _ref24, _tempOrder$is_price_i;
|
|
3451
3138
|
var snapshot, tempOrder, amount, walletBusinessData, result;
|
|
3452
|
-
return _regeneratorRuntime().wrap(function
|
|
3453
|
-
while (1) switch (
|
|
3139
|
+
return _regeneratorRuntime().wrap(function _callee32$(_context32) {
|
|
3140
|
+
while (1) switch (_context32.prev = _context32.next) {
|
|
3454
3141
|
case 0:
|
|
3455
3142
|
if (this.store.order) {
|
|
3456
|
-
|
|
3143
|
+
_context32.next = 2;
|
|
3457
3144
|
break;
|
|
3458
3145
|
}
|
|
3459
3146
|
throw new Error('order 模块未初始化');
|
|
3460
3147
|
case 2:
|
|
3461
3148
|
if (this.store.payment) {
|
|
3462
|
-
|
|
3149
|
+
_context32.next = 4;
|
|
3463
3150
|
break;
|
|
3464
3151
|
}
|
|
3465
3152
|
throw new Error('payment 模块未初始化');
|
|
@@ -3468,10 +3155,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3468
3155
|
tempOrder = snapshot === null || snapshot === void 0 ? void 0 : snapshot.tempOrder;
|
|
3469
3156
|
amount = snapshot === null || snapshot === void 0 ? void 0 : snapshot.amount;
|
|
3470
3157
|
if (!(!tempOrder || !amount)) {
|
|
3471
|
-
|
|
3158
|
+
_context32.next = 9;
|
|
3472
3159
|
break;
|
|
3473
3160
|
}
|
|
3474
|
-
return
|
|
3161
|
+
return _context32.abrupt("return", {
|
|
3475
3162
|
walletRecommendList: [],
|
|
3476
3163
|
userIdentificationCodes: [],
|
|
3477
3164
|
transformList: [],
|
|
@@ -3490,15 +3177,15 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3490
3177
|
},
|
|
3491
3178
|
products: this.getWalletProductList(),
|
|
3492
3179
|
order_wait_pay_amount: (_params$order_wait_pa = params === null || params === void 0 ? void 0 : params.order_wait_pay_amount) !== null && _params$order_wait_pa !== void 0 ? _params$order_wait_pa : Number(amount.amountGap || 0),
|
|
3493
|
-
is_price_include_tax: (
|
|
3180
|
+
is_price_include_tax: (_ref24 = (_tempOrder$is_price_i = tempOrder.is_price_include_tax) !== null && _tempOrder$is_price_i !== void 0 ? _tempOrder$is_price_i : this.otherParams.is_price_include_tax) !== null && _ref24 !== void 0 ? _ref24 : 1
|
|
3494
3181
|
}, snapshot.identity.orderId ? {
|
|
3495
3182
|
payment_order_id: String(snapshot.identity.orderId)
|
|
3496
3183
|
} : {});
|
|
3497
|
-
|
|
3184
|
+
_context32.next = 12;
|
|
3498
3185
|
return this.store.payment.wallet.initializeWalletDataFromBusinessAsync(walletBusinessData);
|
|
3499
3186
|
case 12:
|
|
3500
|
-
result =
|
|
3501
|
-
|
|
3187
|
+
result = _context32.sent;
|
|
3188
|
+
_context32.next = 15;
|
|
3502
3189
|
return this.core.effects.emit("".concat(this.name, ":onWalletDataInitialized"), {
|
|
3503
3190
|
orderId: snapshot.identity.orderId,
|
|
3504
3191
|
customerId: walletBusinessData.customer_id,
|
|
@@ -3510,14 +3197,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3510
3197
|
timestamp: Date.now()
|
|
3511
3198
|
});
|
|
3512
3199
|
case 15:
|
|
3513
|
-
return
|
|
3200
|
+
return _context32.abrupt("return", result);
|
|
3514
3201
|
case 16:
|
|
3515
3202
|
case "end":
|
|
3516
|
-
return
|
|
3203
|
+
return _context32.stop();
|
|
3517
3204
|
}
|
|
3518
|
-
},
|
|
3205
|
+
}, _callee32, this);
|
|
3519
3206
|
}));
|
|
3520
|
-
function initWalletData(
|
|
3207
|
+
function initWalletData(_x25) {
|
|
3521
3208
|
return _initWalletData.apply(this, arguments);
|
|
3522
3209
|
}
|
|
3523
3210
|
return initWalletData;
|
|
@@ -3544,35 +3231,35 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3544
3231
|
}, {
|
|
3545
3232
|
key: "getPaymentMethodsAsync",
|
|
3546
3233
|
value: (function () {
|
|
3547
|
-
var _getPaymentMethodsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3234
|
+
var _getPaymentMethodsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33() {
|
|
3548
3235
|
var response, paymentMethods;
|
|
3549
|
-
return _regeneratorRuntime().wrap(function
|
|
3550
|
-
while (1) switch (
|
|
3236
|
+
return _regeneratorRuntime().wrap(function _callee33$(_context33) {
|
|
3237
|
+
while (1) switch (_context33.prev = _context33.next) {
|
|
3551
3238
|
case 0:
|
|
3552
|
-
|
|
3553
|
-
|
|
3239
|
+
_context33.prev = 0;
|
|
3240
|
+
_context33.next = 3;
|
|
3554
3241
|
return this.request.get('/pay/custom-payment/all', {
|
|
3555
3242
|
filterPaymentMethods: true
|
|
3556
3243
|
}, {
|
|
3557
3244
|
osServer: true
|
|
3558
3245
|
});
|
|
3559
3246
|
case 3:
|
|
3560
|
-
response =
|
|
3247
|
+
response = _context33.sent;
|
|
3561
3248
|
paymentMethods = (response === null || response === void 0 ? void 0 : response.data) || [];
|
|
3562
3249
|
this.paymentMethodsCache = Array.isArray(paymentMethods) ? _toConsumableArray(paymentMethods) : [];
|
|
3563
|
-
return
|
|
3250
|
+
return _context33.abrupt("return", this.getPaymentMethods());
|
|
3564
3251
|
case 9:
|
|
3565
|
-
|
|
3566
|
-
|
|
3252
|
+
_context33.prev = 9;
|
|
3253
|
+
_context33.t0 = _context33["catch"](0);
|
|
3567
3254
|
this.logWarning('getPaymentMethodsAsync: 获取支付方式列表失败,使用缓存列表', {
|
|
3568
|
-
error:
|
|
3255
|
+
error: _context33.t0 instanceof Error ? _context33.t0.message : String(_context33.t0)
|
|
3569
3256
|
});
|
|
3570
|
-
return
|
|
3257
|
+
return _context33.abrupt("return", this.getPaymentMethods());
|
|
3571
3258
|
case 13:
|
|
3572
3259
|
case "end":
|
|
3573
|
-
return
|
|
3260
|
+
return _context33.stop();
|
|
3574
3261
|
}
|
|
3575
|
-
},
|
|
3262
|
+
}, _callee33, this, [[0, 9]]);
|
|
3576
3263
|
}));
|
|
3577
3264
|
function getPaymentMethodsAsync() {
|
|
3578
3265
|
return _getPaymentMethodsAsync.apply(this, arguments);
|
|
@@ -3585,84 +3272,106 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3585
3272
|
return _toConsumableArray(this.paymentMethodsCache);
|
|
3586
3273
|
}
|
|
3587
3274
|
|
|
3588
|
-
/**
|
|
3275
|
+
/**
|
|
3276
|
+
* 按当前店铺的现金舍入配置计算金额,供现金支付 UI 使用。
|
|
3277
|
+
*
|
|
3278
|
+
* 舍入开关取自 CASHMANUAL 支付方式;舍入规则取自
|
|
3279
|
+
* otherParams.order_rounding_setting,金额算法统一由 PaymentModule 维护。
|
|
3280
|
+
*/
|
|
3589
3281
|
}, {
|
|
3590
3282
|
key: "roundAmount",
|
|
3591
|
-
value: function
|
|
3592
|
-
var
|
|
3593
|
-
|
|
3594
|
-
|
|
3595
|
-
|
|
3596
|
-
|
|
3597
|
-
|
|
3598
|
-
|
|
3599
|
-
|
|
3600
|
-
|
|
3601
|
-
|
|
3602
|
-
|
|
3603
|
-
|
|
3604
|
-
|
|
3283
|
+
value: (function () {
|
|
3284
|
+
var _roundAmount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(params) {
|
|
3285
|
+
var _cashManualPayment$me, _this$otherParams$ord2, _this$otherParams$ord3;
|
|
3286
|
+
var amount, cashManualPayment;
|
|
3287
|
+
return _regeneratorRuntime().wrap(function _callee34$(_context34) {
|
|
3288
|
+
while (1) switch (_context34.prev = _context34.next) {
|
|
3289
|
+
case 0:
|
|
3290
|
+
amount = params.amount;
|
|
3291
|
+
cashManualPayment = this.paymentMethodsCache.find(function (paymentMethod) {
|
|
3292
|
+
return paymentMethod.code === 'CASHMANUAL';
|
|
3293
|
+
});
|
|
3294
|
+
if (cashManualPayment !== null && cashManualPayment !== void 0 && (_cashManualPayment$me = cashManualPayment.metadata) !== null && _cashManualPayment$me !== void 0 && _cashManualPayment$me.order_rounding_switch) {
|
|
3295
|
+
_context34.next = 4;
|
|
3296
|
+
break;
|
|
3297
|
+
}
|
|
3298
|
+
return _context34.abrupt("return", {
|
|
3299
|
+
originalAmount: amount.toString(),
|
|
3300
|
+
roundedAmount: amount.toString(),
|
|
3301
|
+
roundingDifference: '0.00'
|
|
3302
|
+
});
|
|
3303
|
+
case 4:
|
|
3304
|
+
if (this.payment) {
|
|
3305
|
+
_context34.next = 6;
|
|
3306
|
+
break;
|
|
3307
|
+
}
|
|
3308
|
+
throw new Error('payment 模块未初始化');
|
|
3309
|
+
case 6:
|
|
3310
|
+
return _context34.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));
|
|
3311
|
+
case 7:
|
|
3312
|
+
case "end":
|
|
3313
|
+
return _context34.stop();
|
|
3314
|
+
}
|
|
3315
|
+
}, _callee34, this);
|
|
3316
|
+
}));
|
|
3317
|
+
function roundAmount(_x26) {
|
|
3318
|
+
return _roundAmount.apply(this, arguments);
|
|
3605
3319
|
}
|
|
3606
|
-
|
|
3607
|
-
|
|
3608
|
-
originalAmount: amount.toFixed(2),
|
|
3609
|
-
roundedAmount: roundedAmount.toFixed(2),
|
|
3610
|
-
roundingDifference: roundedAmount.minus(amount).toFixed(2)
|
|
3611
|
-
};
|
|
3612
|
-
}
|
|
3613
|
-
|
|
3320
|
+
return roundAmount;
|
|
3321
|
+
}()
|
|
3614
3322
|
/**
|
|
3615
3323
|
* 发送支付链接。
|
|
3616
3324
|
*
|
|
3617
3325
|
* 如果没有 orderIds 或显式 submitBeforeSend,会先提交当前本地订单到云端;
|
|
3618
3326
|
* 只有成功拿到远端 order_id 后才调用 OrderModule 发送邮件。
|
|
3619
3327
|
*/
|
|
3328
|
+
)
|
|
3620
3329
|
}, {
|
|
3621
3330
|
key: "sendCustomerPayLink",
|
|
3622
3331
|
value: (function () {
|
|
3623
|
-
var _sendCustomerPayLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3624
|
-
var orderIds,
|
|
3625
|
-
return _regeneratorRuntime().wrap(function
|
|
3626
|
-
while (1) switch (
|
|
3332
|
+
var _sendCustomerPayLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35(params) {
|
|
3333
|
+
var orderIds, _ref25, _ref26, _submitResult$data$or, _submitResult$data, _submitResult$data2, submitResult, orderId;
|
|
3334
|
+
return _regeneratorRuntime().wrap(function _callee35$(_context35) {
|
|
3335
|
+
while (1) switch (_context35.prev = _context35.next) {
|
|
3627
3336
|
case 0:
|
|
3628
3337
|
if (this.store.order) {
|
|
3629
|
-
|
|
3338
|
+
_context35.next = 2;
|
|
3630
3339
|
break;
|
|
3631
3340
|
}
|
|
3632
3341
|
throw new Error('order 模块未初始化');
|
|
3633
3342
|
case 2:
|
|
3634
3343
|
orderIds = params.order_ids || params.orderIds || [];
|
|
3635
3344
|
if (!(!orderIds.length || params.submitBeforeSend)) {
|
|
3636
|
-
|
|
3345
|
+
_context35.next = 11;
|
|
3637
3346
|
break;
|
|
3638
3347
|
}
|
|
3639
|
-
|
|
3348
|
+
_context35.next = 6;
|
|
3640
3349
|
return this.submitSalesOrder({
|
|
3641
3350
|
smallTicketDataFlag: 1
|
|
3642
3351
|
});
|
|
3643
3352
|
case 6:
|
|
3644
|
-
submitResult =
|
|
3645
|
-
orderId = (
|
|
3353
|
+
submitResult = _context35.sent;
|
|
3354
|
+
orderId = (_ref25 = (_ref26 = (_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 && _ref26 !== void 0 ? _ref26 : submitResult === null || submitResult === void 0 || (_submitResult$data2 = submitResult.data) === null || _submitResult$data2 === void 0 ? void 0 : _submitResult$data2.id) !== null && _ref25 !== void 0 ? _ref25 : submitResult === null || submitResult === void 0 ? void 0 : submitResult.id;
|
|
3646
3355
|
if (orderId) {
|
|
3647
|
-
|
|
3356
|
+
_context35.next = 10;
|
|
3648
3357
|
break;
|
|
3649
3358
|
}
|
|
3650
3359
|
throw new Error('本地订单提交云端失败,无法发送支付链接');
|
|
3651
3360
|
case 10:
|
|
3652
3361
|
orderIds = [orderId];
|
|
3653
3362
|
case 11:
|
|
3654
|
-
return
|
|
3363
|
+
return _context35.abrupt("return", this.store.order.sendCustomerPayLink({
|
|
3655
3364
|
emails: params.emails,
|
|
3656
3365
|
notify_action: params.notify_action,
|
|
3657
3366
|
order_ids: orderIds
|
|
3658
3367
|
}));
|
|
3659
3368
|
case 12:
|
|
3660
3369
|
case "end":
|
|
3661
|
-
return
|
|
3370
|
+
return _context35.stop();
|
|
3662
3371
|
}
|
|
3663
|
-
},
|
|
3372
|
+
}, _callee35, this);
|
|
3664
3373
|
}));
|
|
3665
|
-
function sendCustomerPayLink(
|
|
3374
|
+
function sendCustomerPayLink(_x27) {
|
|
3666
3375
|
return _sendCustomerPayLink.apply(this, arguments);
|
|
3667
3376
|
}
|
|
3668
3377
|
return sendCustomerPayLink;
|
|
@@ -3675,27 +3384,27 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3675
3384
|
}, {
|
|
3676
3385
|
key: "calculateProductBookingPrice",
|
|
3677
3386
|
value: function () {
|
|
3678
|
-
var _calculateProductBookingPrice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3387
|
+
var _calculateProductBookingPrice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(params) {
|
|
3679
3388
|
var _params$customer_id;
|
|
3680
3389
|
var quotation, customerId, authoritativeProduct, product;
|
|
3681
|
-
return _regeneratorRuntime().wrap(function
|
|
3682
|
-
while (1) switch (
|
|
3390
|
+
return _regeneratorRuntime().wrap(function _callee36$(_context36) {
|
|
3391
|
+
while (1) switch (_context36.prev = _context36.next) {
|
|
3683
3392
|
case 0:
|
|
3684
3393
|
quotation = this.store.quotation;
|
|
3685
3394
|
customerId = (_params$customer_id = params.customer_id) !== null && _params$customer_id !== void 0 ? _params$customer_id : this.getCurrentOrderCustomerId();
|
|
3686
|
-
|
|
3395
|
+
_context36.next = 4;
|
|
3687
3396
|
return this.loadProductForPriceQuery(params, customerId);
|
|
3688
3397
|
case 4:
|
|
3689
|
-
authoritativeProduct =
|
|
3398
|
+
authoritativeProduct = _context36.sent;
|
|
3690
3399
|
product = this.mergeProductForPriceQuery(params.product, authoritativeProduct);
|
|
3691
|
-
|
|
3400
|
+
_context36.next = 8;
|
|
3692
3401
|
return this.loadQuotationForPriceQuery({
|
|
3693
3402
|
quotation: quotation,
|
|
3694
3403
|
customer_id: customerId,
|
|
3695
3404
|
channel: params.channel
|
|
3696
3405
|
});
|
|
3697
3406
|
case 8:
|
|
3698
|
-
return
|
|
3407
|
+
return _context36.abrupt("return", calculateBaseSalesProductBookingPrice(_objectSpread(_objectSpread({}, params), {}, {
|
|
3699
3408
|
product: product,
|
|
3700
3409
|
fallback_price: authoritativeProduct ? undefined : params.fallback_price,
|
|
3701
3410
|
customer_id: customerId,
|
|
@@ -3703,11 +3412,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3703
3412
|
})));
|
|
3704
3413
|
case 9:
|
|
3705
3414
|
case "end":
|
|
3706
|
-
return
|
|
3415
|
+
return _context36.stop();
|
|
3707
3416
|
}
|
|
3708
|
-
},
|
|
3417
|
+
}, _callee36, this);
|
|
3709
3418
|
}));
|
|
3710
|
-
function calculateProductBookingPrice(
|
|
3419
|
+
function calculateProductBookingPrice(_x28) {
|
|
3711
3420
|
return _calculateProductBookingPrice.apply(this, arguments);
|
|
3712
3421
|
}
|
|
3713
3422
|
return calculateProductBookingPrice;
|
|
@@ -3715,7 +3424,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3715
3424
|
}, {
|
|
3716
3425
|
key: "getQuotationCustomerScopeInfo",
|
|
3717
3426
|
value: function getQuotationCustomerScopeInfo() {
|
|
3718
|
-
var
|
|
3427
|
+
var _this13 = this;
|
|
3719
3428
|
var quotation = this.store.quotation;
|
|
3720
3429
|
if (quotation && typeof quotation.getQuotationCustomerScopeInfo === 'function') {
|
|
3721
3430
|
return quotation.getQuotationCustomerScopeInfo();
|
|
@@ -3727,7 +3436,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3727
3436
|
}).map(function (item) {
|
|
3728
3437
|
var localSeen = new Set();
|
|
3729
3438
|
var customers = item.customer.filter(function (customer) {
|
|
3730
|
-
var customerId =
|
|
3439
|
+
var customerId = _this13.normalizePriceContextCustomerId(customer === null || customer === void 0 ? void 0 : customer.id);
|
|
3731
3440
|
if (!customerId || localSeen.has(customerId)) return false;
|
|
3732
3441
|
localSeen.add(customerId);
|
|
3733
3442
|
if (!customerById.has(customerId)) customerById.set(customerId, customer);
|
|
@@ -3777,32 +3486,32 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3777
3486
|
}, {
|
|
3778
3487
|
key: "calculateProductBookingPrices",
|
|
3779
3488
|
value: function () {
|
|
3780
|
-
var _calculateProductBookingPrices = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3489
|
+
var _calculateProductBookingPrices = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38(paramsList) {
|
|
3781
3490
|
var _paramsList$0$custome,
|
|
3782
3491
|
_paramsList$,
|
|
3783
|
-
|
|
3492
|
+
_this14 = this,
|
|
3784
3493
|
_paramsList$2;
|
|
3785
3494
|
var quotation, customerId, productMapsByGroup, groups;
|
|
3786
|
-
return _regeneratorRuntime().wrap(function
|
|
3787
|
-
while (1) switch (
|
|
3495
|
+
return _regeneratorRuntime().wrap(function _callee38$(_context38) {
|
|
3496
|
+
while (1) switch (_context38.prev = _context38.next) {
|
|
3788
3497
|
case 0:
|
|
3789
3498
|
if (paramsList.length) {
|
|
3790
|
-
|
|
3499
|
+
_context38.next = 2;
|
|
3791
3500
|
break;
|
|
3792
3501
|
}
|
|
3793
|
-
return
|
|
3502
|
+
return _context38.abrupt("return", []);
|
|
3794
3503
|
case 2:
|
|
3795
3504
|
quotation = this.store.quotation;
|
|
3796
3505
|
customerId = (_paramsList$0$custome = (_paramsList$ = paramsList[0]) === null || _paramsList$ === void 0 ? void 0 : _paramsList$.customer_id) !== null && _paramsList$0$custome !== void 0 ? _paramsList$0$custome : this.getCurrentOrderCustomerId();
|
|
3797
3506
|
productMapsByGroup = new Map();
|
|
3798
3507
|
groups = new Map();
|
|
3799
3508
|
paramsList.forEach(function (params) {
|
|
3800
|
-
var
|
|
3509
|
+
var _this14$otherParams;
|
|
3801
3510
|
var product = params.product || {};
|
|
3802
|
-
var productId =
|
|
3511
|
+
var productId = _this14.getPriceQueryProductId(product);
|
|
3803
3512
|
if (productId === null) return;
|
|
3804
|
-
var schedule =
|
|
3805
|
-
var channel = params.channel || ((
|
|
3513
|
+
var schedule = _this14.getPriceQuerySchedule(params);
|
|
3514
|
+
var channel = params.channel || ((_this14$otherParams = _this14.otherParams) === null || _this14$otherParams === void 0 ? void 0 : _this14$otherParams.channel);
|
|
3806
3515
|
var groupKey = [schedule.schedule_date, schedule.schedule_datetime, channel || ''].join('|');
|
|
3807
3516
|
var group = groups.get(groupKey) || {
|
|
3808
3517
|
ids: new Set(),
|
|
@@ -3812,51 +3521,51 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3812
3521
|
group.ids.add(productId);
|
|
3813
3522
|
groups.set(groupKey, group);
|
|
3814
3523
|
});
|
|
3815
|
-
|
|
3524
|
+
_context38.next = 9;
|
|
3816
3525
|
return Promise.all(Array.from(groups.entries()).map( /*#__PURE__*/function () {
|
|
3817
|
-
var
|
|
3818
|
-
var
|
|
3819
|
-
return _regeneratorRuntime().wrap(function
|
|
3820
|
-
while (1) switch (
|
|
3526
|
+
var _ref28 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37(_ref27) {
|
|
3527
|
+
var _ref29, groupKey, group, productsById;
|
|
3528
|
+
return _regeneratorRuntime().wrap(function _callee37$(_context37) {
|
|
3529
|
+
while (1) switch (_context37.prev = _context37.next) {
|
|
3821
3530
|
case 0:
|
|
3822
|
-
|
|
3823
|
-
|
|
3824
|
-
return
|
|
3531
|
+
_ref29 = _slicedToArray(_ref27, 2), groupKey = _ref29[0], group = _ref29[1];
|
|
3532
|
+
_context37.next = 3;
|
|
3533
|
+
return _this14.loadProductsForPriceQuery({
|
|
3825
3534
|
ids: Array.from(group.ids),
|
|
3826
3535
|
schedule: group.schedule,
|
|
3827
3536
|
customerId: customerId,
|
|
3828
3537
|
channel: group.channel
|
|
3829
3538
|
});
|
|
3830
3539
|
case 3:
|
|
3831
|
-
productsById =
|
|
3540
|
+
productsById = _context37.sent;
|
|
3832
3541
|
productMapsByGroup.set(groupKey, productsById);
|
|
3833
3542
|
case 5:
|
|
3834
3543
|
case "end":
|
|
3835
|
-
return
|
|
3544
|
+
return _context37.stop();
|
|
3836
3545
|
}
|
|
3837
|
-
},
|
|
3546
|
+
}, _callee37);
|
|
3838
3547
|
}));
|
|
3839
|
-
return function (
|
|
3840
|
-
return
|
|
3548
|
+
return function (_x30) {
|
|
3549
|
+
return _ref28.apply(this, arguments);
|
|
3841
3550
|
};
|
|
3842
3551
|
}()));
|
|
3843
3552
|
case 9:
|
|
3844
|
-
|
|
3553
|
+
_context38.next = 11;
|
|
3845
3554
|
return this.loadQuotationForPriceQuery({
|
|
3846
3555
|
quotation: quotation,
|
|
3847
3556
|
customer_id: customerId,
|
|
3848
3557
|
channel: (_paramsList$2 = paramsList[0]) === null || _paramsList$2 === void 0 ? void 0 : _paramsList$2.channel
|
|
3849
3558
|
});
|
|
3850
3559
|
case 11:
|
|
3851
|
-
return
|
|
3852
|
-
var
|
|
3560
|
+
return _context38.abrupt("return", paramsList.map(function (params) {
|
|
3561
|
+
var _this14$otherParams2, _productMapsByGroup$g;
|
|
3853
3562
|
var productInput = params.product || {};
|
|
3854
|
-
var productId =
|
|
3855
|
-
var schedule =
|
|
3856
|
-
var channel = params.channel || ((
|
|
3563
|
+
var productId = _this14.getPriceQueryProductId(productInput);
|
|
3564
|
+
var schedule = _this14.getPriceQuerySchedule(params);
|
|
3565
|
+
var channel = params.channel || ((_this14$otherParams2 = _this14.otherParams) === null || _this14$otherParams2 === void 0 ? void 0 : _this14$otherParams2.channel);
|
|
3857
3566
|
var groupKey = [schedule.schedule_date, schedule.schedule_datetime, channel || ''].join('|');
|
|
3858
3567
|
var authoritativeProduct = productId === null ? null : ((_productMapsByGroup$g = productMapsByGroup.get(groupKey)) === null || _productMapsByGroup$g === void 0 ? void 0 : _productMapsByGroup$g.get(productId)) || null;
|
|
3859
|
-
var product =
|
|
3568
|
+
var product = _this14.mergeProductForPriceQuery(productInput, authoritativeProduct);
|
|
3860
3569
|
return calculateBaseSalesProductBookingPrice(_objectSpread(_objectSpread({}, params), {}, {
|
|
3861
3570
|
product: product,
|
|
3862
3571
|
fallback_price: authoritativeProduct ? undefined : params.fallback_price,
|
|
@@ -3866,11 +3575,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3866
3575
|
}));
|
|
3867
3576
|
case 12:
|
|
3868
3577
|
case "end":
|
|
3869
|
-
return
|
|
3578
|
+
return _context38.stop();
|
|
3870
3579
|
}
|
|
3871
|
-
},
|
|
3580
|
+
}, _callee38, this);
|
|
3872
3581
|
}));
|
|
3873
|
-
function calculateProductBookingPrices(
|
|
3582
|
+
function calculateProductBookingPrices(_x29) {
|
|
3874
3583
|
return _calculateProductBookingPrices.apply(this, arguments);
|
|
3875
3584
|
}
|
|
3876
3585
|
return calculateProductBookingPrices;
|
|
@@ -3878,34 +3587,34 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3878
3587
|
}, {
|
|
3879
3588
|
key: "addProductToOrder",
|
|
3880
3589
|
value: function () {
|
|
3881
|
-
var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3590
|
+
var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39(product, booking) {
|
|
3882
3591
|
var products;
|
|
3883
|
-
return _regeneratorRuntime().wrap(function
|
|
3884
|
-
while (1) switch (
|
|
3592
|
+
return _regeneratorRuntime().wrap(function _callee39$(_context39) {
|
|
3593
|
+
while (1) switch (_context39.prev = _context39.next) {
|
|
3885
3594
|
case 0:
|
|
3886
|
-
|
|
3595
|
+
_context39.prev = 0;
|
|
3887
3596
|
if (this.store.order) {
|
|
3888
|
-
|
|
3597
|
+
_context39.next = 3;
|
|
3889
3598
|
break;
|
|
3890
3599
|
}
|
|
3891
3600
|
throw new Error('order 模块未初始化');
|
|
3892
3601
|
case 3:
|
|
3893
|
-
|
|
3602
|
+
_context39.next = 5;
|
|
3894
3603
|
return this.store.order.addProductToOrder(product, booking);
|
|
3895
3604
|
case 5:
|
|
3896
|
-
products =
|
|
3897
|
-
return
|
|
3605
|
+
products = _context39.sent;
|
|
3606
|
+
return _context39.abrupt("return", products);
|
|
3898
3607
|
case 9:
|
|
3899
|
-
|
|
3900
|
-
|
|
3901
|
-
throw
|
|
3608
|
+
_context39.prev = 9;
|
|
3609
|
+
_context39.t0 = _context39["catch"](0);
|
|
3610
|
+
throw _context39.t0;
|
|
3902
3611
|
case 12:
|
|
3903
3612
|
case "end":
|
|
3904
|
-
return
|
|
3613
|
+
return _context39.stop();
|
|
3905
3614
|
}
|
|
3906
|
-
},
|
|
3615
|
+
}, _callee39, this, [[0, 9]]);
|
|
3907
3616
|
}));
|
|
3908
|
-
function addProductToOrder(
|
|
3617
|
+
function addProductToOrder(_x31, _x32) {
|
|
3909
3618
|
return _addProductToOrder.apply(this, arguments);
|
|
3910
3619
|
}
|
|
3911
3620
|
return addProductToOrder;
|
|
@@ -3913,34 +3622,34 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3913
3622
|
}, {
|
|
3914
3623
|
key: "updateOrderProduct",
|
|
3915
3624
|
value: function () {
|
|
3916
|
-
var _updateOrderProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3625
|
+
var _updateOrderProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40(params) {
|
|
3917
3626
|
var products;
|
|
3918
|
-
return _regeneratorRuntime().wrap(function
|
|
3919
|
-
while (1) switch (
|
|
3627
|
+
return _regeneratorRuntime().wrap(function _callee40$(_context40) {
|
|
3628
|
+
while (1) switch (_context40.prev = _context40.next) {
|
|
3920
3629
|
case 0:
|
|
3921
|
-
|
|
3630
|
+
_context40.prev = 0;
|
|
3922
3631
|
if (this.store.order) {
|
|
3923
|
-
|
|
3632
|
+
_context40.next = 3;
|
|
3924
3633
|
break;
|
|
3925
3634
|
}
|
|
3926
3635
|
throw new Error('order 模块未初始化');
|
|
3927
3636
|
case 3:
|
|
3928
|
-
|
|
3637
|
+
_context40.next = 5;
|
|
3929
3638
|
return this.store.order.updateOrderProduct(params);
|
|
3930
3639
|
case 5:
|
|
3931
|
-
products =
|
|
3932
|
-
return
|
|
3640
|
+
products = _context40.sent;
|
|
3641
|
+
return _context40.abrupt("return", products);
|
|
3933
3642
|
case 9:
|
|
3934
|
-
|
|
3935
|
-
|
|
3936
|
-
throw
|
|
3643
|
+
_context40.prev = 9;
|
|
3644
|
+
_context40.t0 = _context40["catch"](0);
|
|
3645
|
+
throw _context40.t0;
|
|
3937
3646
|
case 12:
|
|
3938
3647
|
case "end":
|
|
3939
|
-
return
|
|
3648
|
+
return _context40.stop();
|
|
3940
3649
|
}
|
|
3941
|
-
},
|
|
3650
|
+
}, _callee40, this, [[0, 9]]);
|
|
3942
3651
|
}));
|
|
3943
|
-
function updateOrderProduct(
|
|
3652
|
+
function updateOrderProduct(_x33) {
|
|
3944
3653
|
return _updateOrderProduct.apply(this, arguments);
|
|
3945
3654
|
}
|
|
3946
3655
|
return updateOrderProduct;
|
|
@@ -3948,34 +3657,34 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3948
3657
|
}, {
|
|
3949
3658
|
key: "updateOrderProducts",
|
|
3950
3659
|
value: function () {
|
|
3951
|
-
var _updateOrderProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3660
|
+
var _updateOrderProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41(paramsList) {
|
|
3952
3661
|
var products;
|
|
3953
|
-
return _regeneratorRuntime().wrap(function
|
|
3954
|
-
while (1) switch (
|
|
3662
|
+
return _regeneratorRuntime().wrap(function _callee41$(_context41) {
|
|
3663
|
+
while (1) switch (_context41.prev = _context41.next) {
|
|
3955
3664
|
case 0:
|
|
3956
|
-
|
|
3665
|
+
_context41.prev = 0;
|
|
3957
3666
|
if (this.store.order) {
|
|
3958
|
-
|
|
3667
|
+
_context41.next = 3;
|
|
3959
3668
|
break;
|
|
3960
3669
|
}
|
|
3961
3670
|
throw new Error('order 模块未初始化');
|
|
3962
3671
|
case 3:
|
|
3963
|
-
|
|
3672
|
+
_context41.next = 5;
|
|
3964
3673
|
return this.store.order.updateOrderProducts(paramsList);
|
|
3965
3674
|
case 5:
|
|
3966
|
-
products =
|
|
3967
|
-
return
|
|
3675
|
+
products = _context41.sent;
|
|
3676
|
+
return _context41.abrupt("return", products);
|
|
3968
3677
|
case 9:
|
|
3969
|
-
|
|
3970
|
-
|
|
3971
|
-
throw
|
|
3678
|
+
_context41.prev = 9;
|
|
3679
|
+
_context41.t0 = _context41["catch"](0);
|
|
3680
|
+
throw _context41.t0;
|
|
3972
3681
|
case 12:
|
|
3973
3682
|
case "end":
|
|
3974
|
-
return
|
|
3683
|
+
return _context41.stop();
|
|
3975
3684
|
}
|
|
3976
|
-
},
|
|
3685
|
+
}, _callee41, this, [[0, 9]]);
|
|
3977
3686
|
}));
|
|
3978
|
-
function updateOrderProducts(
|
|
3687
|
+
function updateOrderProducts(_x34) {
|
|
3979
3688
|
return _updateOrderProducts.apply(this, arguments);
|
|
3980
3689
|
}
|
|
3981
3690
|
return updateOrderProducts;
|
|
@@ -3983,34 +3692,34 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3983
3692
|
}, {
|
|
3984
3693
|
key: "updateOrderProductQuantity",
|
|
3985
3694
|
value: function () {
|
|
3986
|
-
var _updateOrderProductQuantity = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3695
|
+
var _updateOrderProductQuantity = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42(params) {
|
|
3987
3696
|
var products;
|
|
3988
|
-
return _regeneratorRuntime().wrap(function
|
|
3989
|
-
while (1) switch (
|
|
3697
|
+
return _regeneratorRuntime().wrap(function _callee42$(_context42) {
|
|
3698
|
+
while (1) switch (_context42.prev = _context42.next) {
|
|
3990
3699
|
case 0:
|
|
3991
|
-
|
|
3700
|
+
_context42.prev = 0;
|
|
3992
3701
|
if (this.store.order) {
|
|
3993
|
-
|
|
3702
|
+
_context42.next = 3;
|
|
3994
3703
|
break;
|
|
3995
3704
|
}
|
|
3996
3705
|
throw new Error('order 模块未初始化');
|
|
3997
3706
|
case 3:
|
|
3998
|
-
|
|
3707
|
+
_context42.next = 5;
|
|
3999
3708
|
return this.store.order.updateOrderProductQuantity(params);
|
|
4000
3709
|
case 5:
|
|
4001
|
-
products =
|
|
4002
|
-
return
|
|
3710
|
+
products = _context42.sent;
|
|
3711
|
+
return _context42.abrupt("return", products);
|
|
4003
3712
|
case 9:
|
|
4004
|
-
|
|
4005
|
-
|
|
4006
|
-
throw
|
|
3713
|
+
_context42.prev = 9;
|
|
3714
|
+
_context42.t0 = _context42["catch"](0);
|
|
3715
|
+
throw _context42.t0;
|
|
4007
3716
|
case 12:
|
|
4008
3717
|
case "end":
|
|
4009
|
-
return
|
|
3718
|
+
return _context42.stop();
|
|
4010
3719
|
}
|
|
4011
|
-
},
|
|
3720
|
+
}, _callee42, this, [[0, 9]]);
|
|
4012
3721
|
}));
|
|
4013
|
-
function updateOrderProductQuantity(
|
|
3722
|
+
function updateOrderProductQuantity(_x35) {
|
|
4014
3723
|
return _updateOrderProductQuantity.apply(this, arguments);
|
|
4015
3724
|
}
|
|
4016
3725
|
return updateOrderProductQuantity;
|
|
@@ -4033,12 +3742,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4033
3742
|
}, {
|
|
4034
3743
|
key: "setOrderProductLineNote",
|
|
4035
3744
|
value: (function () {
|
|
4036
|
-
var _setOrderProductLineNote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3745
|
+
var _setOrderProductLineNote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(identity, note) {
|
|
4037
3746
|
var params, products;
|
|
4038
|
-
return _regeneratorRuntime().wrap(function
|
|
4039
|
-
while (1) switch (
|
|
3747
|
+
return _regeneratorRuntime().wrap(function _callee43$(_context43) {
|
|
3748
|
+
while (1) switch (_context43.prev = _context43.next) {
|
|
4040
3749
|
case 0:
|
|
4041
|
-
|
|
3750
|
+
_context43.prev = 0;
|
|
4042
3751
|
params = {
|
|
4043
3752
|
product_id: identity.product_id,
|
|
4044
3753
|
product_variant_id: identity.product_variant_id,
|
|
@@ -4053,22 +3762,22 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4053
3762
|
params.product_sku = identity.product_sku;
|
|
4054
3763
|
}
|
|
4055
3764
|
if (identity.product_bundle !== undefined) params.product_bundle = identity.product_bundle;
|
|
4056
|
-
|
|
3765
|
+
_context43.next = 7;
|
|
4057
3766
|
return this.updateOrderProduct(params);
|
|
4058
3767
|
case 7:
|
|
4059
|
-
products =
|
|
4060
|
-
return
|
|
3768
|
+
products = _context43.sent;
|
|
3769
|
+
return _context43.abrupt("return", products);
|
|
4061
3770
|
case 11:
|
|
4062
|
-
|
|
4063
|
-
|
|
4064
|
-
throw
|
|
3771
|
+
_context43.prev = 11;
|
|
3772
|
+
_context43.t0 = _context43["catch"](0);
|
|
3773
|
+
throw _context43.t0;
|
|
4065
3774
|
case 14:
|
|
4066
3775
|
case "end":
|
|
4067
|
-
return
|
|
3776
|
+
return _context43.stop();
|
|
4068
3777
|
}
|
|
4069
|
-
},
|
|
3778
|
+
}, _callee43, this, [[0, 11]]);
|
|
4070
3779
|
}));
|
|
4071
|
-
function setOrderProductLineNote(
|
|
3780
|
+
function setOrderProductLineNote(_x36, _x37) {
|
|
4072
3781
|
return _setOrderProductLineNote.apply(this, arguments);
|
|
4073
3782
|
}
|
|
4074
3783
|
return setOrderProductLineNote;
|
|
@@ -4083,32 +3792,32 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4083
3792
|
}, {
|
|
4084
3793
|
key: "removeProductsFromOrder",
|
|
4085
3794
|
value: (function () {
|
|
4086
|
-
var _removeProductsFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4087
|
-
return _regeneratorRuntime().wrap(function
|
|
4088
|
-
while (1) switch (
|
|
3795
|
+
var _removeProductsFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44(identities) {
|
|
3796
|
+
return _regeneratorRuntime().wrap(function _callee44$(_context44) {
|
|
3797
|
+
while (1) switch (_context44.prev = _context44.next) {
|
|
4089
3798
|
case 0:
|
|
4090
|
-
|
|
3799
|
+
_context44.prev = 0;
|
|
4091
3800
|
if (this.store.order) {
|
|
4092
|
-
|
|
3801
|
+
_context44.next = 3;
|
|
4093
3802
|
break;
|
|
4094
3803
|
}
|
|
4095
3804
|
throw new Error('order 模块未初始化');
|
|
4096
3805
|
case 3:
|
|
4097
|
-
|
|
3806
|
+
_context44.next = 5;
|
|
4098
3807
|
return this.store.order.removeProductsFromOrder(identities);
|
|
4099
3808
|
case 5:
|
|
4100
|
-
return
|
|
3809
|
+
return _context44.abrupt("return", _context44.sent);
|
|
4101
3810
|
case 8:
|
|
4102
|
-
|
|
4103
|
-
|
|
4104
|
-
throw
|
|
3811
|
+
_context44.prev = 8;
|
|
3812
|
+
_context44.t0 = _context44["catch"](0);
|
|
3813
|
+
throw _context44.t0;
|
|
4105
3814
|
case 11:
|
|
4106
3815
|
case "end":
|
|
4107
|
-
return
|
|
3816
|
+
return _context44.stop();
|
|
4108
3817
|
}
|
|
4109
|
-
},
|
|
3818
|
+
}, _callee44, this, [[0, 8]]);
|
|
4110
3819
|
}));
|
|
4111
|
-
function removeProductsFromOrder(
|
|
3820
|
+
function removeProductsFromOrder(_x38) {
|
|
4112
3821
|
return _removeProductsFromOrder.apply(this, arguments);
|
|
4113
3822
|
}
|
|
4114
3823
|
return removeProductsFromOrder;
|
|
@@ -4116,18 +3825,18 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4116
3825
|
}, {
|
|
4117
3826
|
key: "removeProductFromOrder",
|
|
4118
3827
|
value: function () {
|
|
4119
|
-
var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4120
|
-
return _regeneratorRuntime().wrap(function
|
|
4121
|
-
while (1) switch (
|
|
3828
|
+
var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee45(identity) {
|
|
3829
|
+
return _regeneratorRuntime().wrap(function _callee45$(_context45) {
|
|
3830
|
+
while (1) switch (_context45.prev = _context45.next) {
|
|
4122
3831
|
case 0:
|
|
4123
|
-
return
|
|
3832
|
+
return _context45.abrupt("return", this.removeProductsFromOrder([identity]));
|
|
4124
3833
|
case 1:
|
|
4125
3834
|
case "end":
|
|
4126
|
-
return
|
|
3835
|
+
return _context45.stop();
|
|
4127
3836
|
}
|
|
4128
|
-
},
|
|
3837
|
+
}, _callee45, this);
|
|
4129
3838
|
}));
|
|
4130
|
-
function removeProductFromOrder(
|
|
3839
|
+
function removeProductFromOrder(_x39) {
|
|
4131
3840
|
return _removeProductFromOrder.apply(this, arguments);
|
|
4132
3841
|
}
|
|
4133
3842
|
return removeProductFromOrder;
|
|
@@ -4177,23 +3886,23 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4177
3886
|
}, {
|
|
4178
3887
|
key: "applyPromotion",
|
|
4179
3888
|
value: (function () {
|
|
4180
|
-
var _applyPromotion = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4181
|
-
return _regeneratorRuntime().wrap(function
|
|
4182
|
-
while (1) switch (
|
|
3889
|
+
var _applyPromotion = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee46() {
|
|
3890
|
+
return _regeneratorRuntime().wrap(function _callee46$(_context46) {
|
|
3891
|
+
while (1) switch (_context46.prev = _context46.next) {
|
|
4183
3892
|
case 0:
|
|
4184
3893
|
if (this.store.order) {
|
|
4185
|
-
|
|
3894
|
+
_context46.next = 2;
|
|
4186
3895
|
break;
|
|
4187
3896
|
}
|
|
4188
3897
|
throw new Error('order 模块未初始化');
|
|
4189
3898
|
case 2:
|
|
4190
|
-
|
|
3899
|
+
_context46.next = 4;
|
|
4191
3900
|
return this.store.order.applyPromotion();
|
|
4192
3901
|
case 4:
|
|
4193
3902
|
case "end":
|
|
4194
|
-
return
|
|
3903
|
+
return _context46.stop();
|
|
4195
3904
|
}
|
|
4196
|
-
},
|
|
3905
|
+
}, _callee46, this);
|
|
4197
3906
|
}));
|
|
4198
3907
|
function applyPromotion() {
|
|
4199
3908
|
return _applyPromotion.apply(this, arguments);
|
|
@@ -4220,18 +3929,18 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4220
3929
|
}, {
|
|
4221
3930
|
key: "getProductList",
|
|
4222
3931
|
value: function () {
|
|
4223
|
-
var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4224
|
-
var _this$
|
|
3932
|
+
var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee47() {
|
|
3933
|
+
var _this$otherParams21;
|
|
4225
3934
|
var menu_list_ids, _this$store$products, res;
|
|
4226
|
-
return _regeneratorRuntime().wrap(function
|
|
4227
|
-
while (1) switch (
|
|
3935
|
+
return _regeneratorRuntime().wrap(function _callee47$(_context47) {
|
|
3936
|
+
while (1) switch (_context47.prev = _context47.next) {
|
|
4228
3937
|
case 0:
|
|
4229
3938
|
// 可以直接通过配置里的 menu 读取
|
|
4230
|
-
menu_list_ids = ((_this$
|
|
3939
|
+
menu_list_ids = ((_this$otherParams21 = this.otherParams) === null || _this$otherParams21 === void 0 || (_this$otherParams21 = _this$otherParams21.dineInConfig) === null || _this$otherParams21 === void 0 ? void 0 : _this$otherParams21['menu.associated_menus'].map(function (n) {
|
|
4231
3940
|
return Number(n.value);
|
|
4232
3941
|
})) || [];
|
|
4233
|
-
|
|
4234
|
-
|
|
3942
|
+
_context47.prev = 1;
|
|
3943
|
+
_context47.next = 4;
|
|
4235
3944
|
return (_this$store$products = this.store.products) === null || _this$store$products === void 0 ? void 0 : _this$store$products.loadProducts({
|
|
4236
3945
|
menu_list_ids: menu_list_ids,
|
|
4237
3946
|
cacheId: this.cacheId,
|
|
@@ -4239,17 +3948,17 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4239
3948
|
schedule_datetime: dayjs().format('YYYY-MM-DD HH:mm:ss')
|
|
4240
3949
|
});
|
|
4241
3950
|
case 4:
|
|
4242
|
-
res =
|
|
4243
|
-
return
|
|
3951
|
+
res = _context47.sent;
|
|
3952
|
+
return _context47.abrupt("return", res);
|
|
4244
3953
|
case 8:
|
|
4245
|
-
|
|
4246
|
-
|
|
4247
|
-
throw
|
|
3954
|
+
_context47.prev = 8;
|
|
3955
|
+
_context47.t0 = _context47["catch"](1);
|
|
3956
|
+
throw _context47.t0;
|
|
4248
3957
|
case 11:
|
|
4249
3958
|
case "end":
|
|
4250
|
-
return
|
|
3959
|
+
return _context47.stop();
|
|
4251
3960
|
}
|
|
4252
|
-
},
|
|
3961
|
+
}, _callee47, this, [[1, 8]]);
|
|
4253
3962
|
}));
|
|
4254
3963
|
function getProductList() {
|
|
4255
3964
|
return _getProductList.apply(this, arguments);
|
|
@@ -4264,33 +3973,33 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4264
3973
|
}, {
|
|
4265
3974
|
key: "setOtherParams",
|
|
4266
3975
|
value: function () {
|
|
4267
|
-
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4268
|
-
var _this$
|
|
4269
|
-
var
|
|
4270
|
-
|
|
3976
|
+
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee48(params) {
|
|
3977
|
+
var _this$otherParams22;
|
|
3978
|
+
var _ref30,
|
|
3979
|
+
_ref30$cover,
|
|
4271
3980
|
cover,
|
|
4272
|
-
|
|
4273
|
-
return _regeneratorRuntime().wrap(function
|
|
4274
|
-
while (1) switch (
|
|
3981
|
+
_args48 = arguments;
|
|
3982
|
+
return _regeneratorRuntime().wrap(function _callee48$(_context48) {
|
|
3983
|
+
while (1) switch (_context48.prev = _context48.next) {
|
|
4275
3984
|
case 0:
|
|
4276
|
-
|
|
3985
|
+
_ref30 = _args48.length > 1 && _args48[1] !== undefined ? _args48[1] : {}, _ref30$cover = _ref30.cover, cover = _ref30$cover === void 0 ? false : _ref30$cover;
|
|
4277
3986
|
if (cover) {
|
|
4278
3987
|
this.otherParams = _objectSpread({}, params);
|
|
4279
3988
|
} else {
|
|
4280
3989
|
this.otherParams = _objectSpread(_objectSpread({}, this.otherParams), params);
|
|
4281
3990
|
}
|
|
4282
|
-
this.cacheId = (_this$
|
|
4283
|
-
|
|
3991
|
+
this.cacheId = (_this$otherParams22 = this.otherParams) === null || _this$otherParams22 === void 0 ? void 0 : _this$otherParams22.cacheId;
|
|
3992
|
+
_context48.next = 5;
|
|
4284
3993
|
return this.syncOtherParamsToSubModules(params, {
|
|
4285
3994
|
cover: cover
|
|
4286
3995
|
});
|
|
4287
3996
|
case 5:
|
|
4288
3997
|
case "end":
|
|
4289
|
-
return
|
|
3998
|
+
return _context48.stop();
|
|
4290
3999
|
}
|
|
4291
|
-
},
|
|
4000
|
+
}, _callee48, this);
|
|
4292
4001
|
}));
|
|
4293
|
-
function setOtherParams(
|
|
4002
|
+
function setOtherParams(_x40) {
|
|
4294
4003
|
return _setOtherParams.apply(this, arguments);
|
|
4295
4004
|
}
|
|
4296
4005
|
return setOtherParams;
|