@pisell/pisellos 2.3.37 → 2.3.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/modules/Discount/index.d.ts +1 -0
- package/dist/modules/Discount/index.js +40 -11
- package/dist/modules/Discount/types.d.ts +1 -0
- package/dist/modules/Holder/index.d.ts +48 -0
- package/dist/modules/Holder/index.js +640 -0
- package/dist/modules/Holder/types.d.ts +123 -0
- package/dist/modules/Holder/types.js +1 -0
- package/dist/modules/Holder/utils.d.ts +13 -0
- package/dist/modules/Holder/utils.js +34 -0
- package/dist/modules/OpenData/index.js +2 -2
- package/dist/modules/Order/index.d.ts +11 -28
- package/dist/modules/Order/index.js +513 -747
- package/dist/modules/Order/types.d.ts +10 -33
- package/dist/modules/Order/utils/orderCollectionIdentity.js +2 -7
- package/dist/modules/Order/utils.d.ts +10 -0
- package/dist/modules/Order/utils.js +40 -11
- package/dist/modules/Payment/index.d.ts +0 -2
- package/dist/modules/Payment/index.js +49 -78
- package/dist/modules/Payment/types.d.ts +24 -26
- package/dist/modules/Payment/types.js +0 -2
- package/dist/modules/Product/types.d.ts +1 -0
- package/dist/modules/ProductList/index.js +33 -14
- package/dist/modules/Quotation/index.d.ts +1 -1
- package/dist/modules/Quotation/index.js +2 -2
- package/dist/modules/ResourcePlanner/index.d.ts +24 -0
- package/dist/modules/ResourcePlanner/index.js +181 -0
- package/dist/modules/ResourcePlanner/planner.d.ts +14 -0
- package/dist/modules/ResourcePlanner/planner.js +1069 -0
- package/dist/modules/ResourcePlanner/types.d.ts +227 -0
- package/dist/modules/ResourcePlanner/types.js +1 -0
- package/dist/modules/Rules/index.js +48 -15
- package/dist/modules/SalesSummary/index.js +12 -13
- package/dist/modules/ScanOrderLogger/index.d.ts +2 -0
- package/dist/modules/ScanOrderLogger/index.js +15 -2
- package/dist/modules/ScanOrderLogger/providers/feishu.js +45 -27
- package/dist/modules/ScanOrderLogger/types.d.ts +1 -0
- package/dist/modules/Schedule/index.d.ts +3 -1
- package/dist/modules/Schedule/index.js +21 -16
- package/dist/modules/Summary/utils.js +38 -13
- package/dist/modules/index.d.ts +2 -0
- package/dist/modules/index.js +3 -1
- package/dist/plugins/window.d.ts +1 -0
- package/dist/server/index.d.ts +14 -16
- package/dist/server/index.js +1162 -1943
- 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 +10 -33
- package/dist/solution/BaseSales/index.js +385 -676
- package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +1 -6
- package/dist/solution/BookingByStep/index.d.ts +17 -2
- package/dist/solution/BookingByStep/index.js +294 -215
- package/dist/solution/BookingByStep/types.d.ts +2 -1
- package/dist/solution/BookingByStep/types.js +3 -1
- package/dist/solution/BookingByStep/utils/capacity.js +17 -1
- package/dist/solution/BookingByStep/utils/timeslots.d.ts +3 -1
- package/dist/solution/BookingByStep/utils/timeslots.js +19 -12
- package/dist/solution/BookingTicket/index.js +1 -2
- package/dist/solution/Sales/index.d.ts +0 -1
- package/dist/solution/Sales/index.js +2 -10
- package/dist/solution/ScanOrder/index.d.ts +26 -14
- package/dist/solution/ScanOrder/index.js +1140 -737
- package/dist/solution/ScanOrder/types.d.ts +21 -1
- package/dist/solution/ScanOrder/utils.d.ts +8 -0
- package/dist/solution/ScanOrder/utils.js +66 -25
- package/dist/solution/ShopDiscount/index.d.ts +1 -0
- package/dist/solution/ShopDiscount/index.js +125 -87
- package/dist/solution/UnifiedBookingSales/index.d.ts +183 -0
- package/dist/solution/UnifiedBookingSales/index.js +1871 -0
- package/dist/solution/UnifiedBookingSales/types.d.ts +143 -0
- package/dist/solution/UnifiedBookingSales/types.js +11 -0
- package/dist/solution/VenueBooking/index.d.ts +39 -11
- package/dist/solution/VenueBooking/index.js +1177 -850
- package/dist/solution/VenueBooking/types.d.ts +3 -0
- package/dist/solution/VenueBooking/utils/resource.js +1 -0
- package/dist/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
- package/dist/solution/VenueBooking/utils/slotMerge.js +10 -5
- package/dist/solution/index.d.ts +1 -0
- package/dist/solution/index.js +2 -1
- package/dist/types/index.d.ts +1 -0
- package/lib/modules/Discount/index.d.ts +1 -0
- package/lib/modules/Discount/index.js +9 -0
- package/lib/modules/Discount/types.d.ts +1 -0
- package/lib/modules/Holder/index.d.ts +48 -0
- package/lib/modules/Holder/index.js +402 -0
- package/lib/modules/Holder/types.d.ts +123 -0
- package/lib/modules/Holder/types.js +17 -0
- package/lib/modules/Holder/utils.d.ts +13 -0
- package/lib/modules/Holder/utils.js +71 -0
- package/lib/modules/OpenData/index.js +1 -1
- package/lib/modules/Order/index.d.ts +11 -28
- package/lib/modules/Order/index.js +83 -187
- package/lib/modules/Order/types.d.ts +10 -33
- package/lib/modules/Order/utils/orderCollectionIdentity.js +0 -3
- package/lib/modules/Order/utils.d.ts +10 -0
- package/lib/modules/Order/utils.js +39 -10
- package/lib/modules/Payment/index.d.ts +0 -2
- package/lib/modules/Payment/index.js +12 -33
- package/lib/modules/Payment/types.d.ts +24 -26
- package/lib/modules/Product/types.d.ts +1 -0
- package/lib/modules/ProductList/index.js +40 -31
- package/lib/modules/Quotation/index.d.ts +1 -1
- package/lib/modules/Quotation/index.js +2 -2
- package/lib/modules/ResourcePlanner/index.d.ts +24 -0
- package/lib/modules/ResourcePlanner/index.js +148 -0
- package/lib/modules/ResourcePlanner/planner.d.ts +14 -0
- package/lib/modules/ResourcePlanner/planner.js +933 -0
- package/lib/modules/ResourcePlanner/types.d.ts +227 -0
- package/lib/modules/ResourcePlanner/types.js +17 -0
- package/lib/modules/Rules/index.js +34 -18
- package/lib/modules/SalesSummary/index.js +6 -7
- package/lib/modules/ScanOrderLogger/index.d.ts +2 -0
- package/lib/modules/ScanOrderLogger/index.js +13 -1
- package/lib/modules/ScanOrderLogger/providers/feishu.js +15 -6
- package/lib/modules/ScanOrderLogger/types.d.ts +1 -0
- package/lib/modules/Schedule/index.d.ts +3 -1
- package/lib/modules/Schedule/index.js +10 -8
- package/lib/modules/Summary/utils.js +21 -1
- package/lib/modules/index.d.ts +2 -0
- package/lib/modules/index.js +5 -1
- package/lib/plugins/window.d.ts +1 -0
- package/lib/server/index.d.ts +14 -16
- package/lib/server/index.js +88 -678
- 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 +10 -33
- package/lib/solution/BaseSales/index.js +33 -201
- package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +1 -6
- package/lib/solution/BookingByStep/index.d.ts +17 -2
- package/lib/solution/BookingByStep/index.js +60 -18
- package/lib/solution/BookingByStep/types.d.ts +2 -1
- package/lib/solution/BookingByStep/types.js +5 -0
- package/lib/solution/BookingByStep/utils/capacity.js +20 -1
- package/lib/solution/BookingByStep/utils/timeslots.d.ts +3 -1
- package/lib/solution/BookingByStep/utils/timeslots.js +19 -11
- package/lib/solution/BookingTicket/index.js +1 -2
- package/lib/solution/Sales/index.d.ts +0 -1
- package/lib/solution/Sales/index.js +3 -5
- package/lib/solution/ScanOrder/index.d.ts +26 -14
- package/lib/solution/ScanOrder/index.js +449 -182
- package/lib/solution/ScanOrder/types.d.ts +21 -1
- package/lib/solution/ScanOrder/utils.d.ts +8 -0
- package/lib/solution/ScanOrder/utils.js +31 -0
- package/lib/solution/ShopDiscount/index.d.ts +1 -0
- package/lib/solution/ShopDiscount/index.js +14 -0
- package/lib/solution/UnifiedBookingSales/index.d.ts +183 -0
- package/lib/solution/UnifiedBookingSales/index.js +1076 -0
- package/lib/solution/UnifiedBookingSales/types.d.ts +143 -0
- package/lib/solution/UnifiedBookingSales/types.js +33 -0
- package/lib/solution/VenueBooking/index.d.ts +39 -11
- package/lib/solution/VenueBooking/index.js +328 -115
- package/lib/solution/VenueBooking/types.d.ts +3 -0
- package/lib/solution/VenueBooking/utils/resource.js +1 -0
- package/lib/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
- package/lib/solution/VenueBooking/utils/slotMerge.js +6 -4
- package/lib/solution/index.d.ts +1 -0
- package/lib/solution/index.js +3 -1
- package/lib/types/index.d.ts +1 -0
- 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,9 @@ 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
|
+
_this$appPlugin2,
|
|
1127
|
+
_this$appPlugin2$getA,
|
|
1128
|
+
_this7 = this,
|
|
1213
1129
|
_this$otherParams5;
|
|
1214
1130
|
var options,
|
|
1215
1131
|
app,
|
|
@@ -1231,53 +1147,50 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1231
1147
|
|
|
1232
1148
|
// 获取 logger 实例
|
|
1233
1149
|
this.appPlugin = core.getPlugin('app');
|
|
1234
|
-
if (this.appPlugin) {
|
|
1235
|
-
|
|
1236
|
-
break;
|
|
1150
|
+
if (!this.appPlugin) {
|
|
1151
|
+
// throw new Error('Checkout 解决方案需要 app 插件支持');
|
|
1237
1152
|
}
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
app = this.appPlugin.getApp();
|
|
1241
|
-
this.logger = app.logger;
|
|
1153
|
+
app = (_this$appPlugin2 = this.appPlugin) === null || _this$appPlugin2 === void 0 || (_this$appPlugin2$getA = _this$appPlugin2.getApp) === null || _this$appPlugin2$getA === void 0 ? void 0 : _this$appPlugin2$getA.call(_this$appPlugin2);
|
|
1154
|
+
this.logger = app === null || app === void 0 ? void 0 : app.logger;
|
|
1242
1155
|
targetCacheData = this.readSessionCacheData();
|
|
1243
1156
|
moduleNames = this.getRegisteredModuleNames();
|
|
1244
1157
|
moduleNames.forEach(function (step) {
|
|
1245
|
-
var reusedModule =
|
|
1158
|
+
var reusedModule = _this7.getReusableSharedSubModule(step);
|
|
1246
1159
|
if (reusedModule) {
|
|
1247
|
-
|
|
1248
|
-
|
|
1160
|
+
_this7.store[step] = reusedModule;
|
|
1161
|
+
_this7.reusedSharedSubModuleNames.add(step);
|
|
1249
1162
|
return;
|
|
1250
1163
|
}
|
|
1251
|
-
var targetModule =
|
|
1164
|
+
var targetModule = _this7.createSubModule(step);
|
|
1252
1165
|
if (!targetModule) {
|
|
1253
1166
|
throw new Error("\u6A21\u5757 ".concat(step, " \u4E0D\u5B58\u5728"));
|
|
1254
1167
|
}
|
|
1255
|
-
var hooks =
|
|
1256
|
-
|
|
1257
|
-
|
|
1168
|
+
var hooks = _this7.getSubModuleHooks(step);
|
|
1169
|
+
_this7.store[step] = targetModule;
|
|
1170
|
+
_this7.core.registerModule(targetModule, _objectSpread(_objectSpread({
|
|
1258
1171
|
initialState: (targetCacheData === null || targetCacheData === void 0 ? void 0 : targetCacheData[targetModule.name]) || {}
|
|
1259
1172
|
}, hooks ? {
|
|
1260
1173
|
hooks: hooks
|
|
1261
1174
|
} : {}), {}, {
|
|
1262
|
-
otherParams:
|
|
1175
|
+
otherParams: _this7.buildSubModuleOtherParams()
|
|
1263
1176
|
}));
|
|
1264
1177
|
});
|
|
1265
1178
|
if (!(this.store.schedule && !this.isScheduleListLoaded(this.store.schedule))) {
|
|
1266
|
-
_context11.next =
|
|
1179
|
+
_context11.next = 18;
|
|
1267
1180
|
break;
|
|
1268
1181
|
}
|
|
1269
|
-
_context11.next =
|
|
1182
|
+
_context11.next = 18;
|
|
1270
1183
|
return this.store.schedule.loadAllSchedule();
|
|
1271
|
-
case
|
|
1184
|
+
case 18:
|
|
1272
1185
|
if (this.store.order && typeof ((_this$otherParams5 = this.otherParams) === null || _this$otherParams5 === void 0 ? void 0 : _this$otherParams5.enableTempOrderPersist) === 'boolean') {
|
|
1273
1186
|
this.store.order.setEnableTempOrderPersist(this.otherParams.enableTempOrderPersist);
|
|
1274
1187
|
}
|
|
1275
|
-
_context11.next =
|
|
1188
|
+
_context11.next = 21;
|
|
1276
1189
|
return this.getPaymentMethodsAsync();
|
|
1277
|
-
case
|
|
1190
|
+
case 21:
|
|
1278
1191
|
this.registerServerOrderChangeSync();
|
|
1279
1192
|
this.core.effects.emit("".concat(this.name, ":onInited"), {});
|
|
1280
|
-
case
|
|
1193
|
+
case 23:
|
|
1281
1194
|
case "end":
|
|
1282
1195
|
return _context11.stop();
|
|
1283
1196
|
}
|
|
@@ -1293,15 +1206,15 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1293
1206
|
value: function () {
|
|
1294
1207
|
var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
|
|
1295
1208
|
var _this$serverOrderChan2,
|
|
1296
|
-
|
|
1209
|
+
_this8 = this;
|
|
1297
1210
|
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
1298
1211
|
while (1) switch (_context12.prev = _context12.next) {
|
|
1299
1212
|
case 0:
|
|
1300
1213
|
(_this$serverOrderChan2 = this.serverOrderChangeUnsubscribe) === null || _this$serverOrderChan2 === void 0 || _this$serverOrderChan2.call(this);
|
|
1301
1214
|
this.serverOrderChangeUnsubscribe = null;
|
|
1302
1215
|
Object.keys(this.store).forEach(function (key) {
|
|
1303
|
-
if (
|
|
1304
|
-
var sub =
|
|
1216
|
+
if (_this8.reusedSharedSubModuleNames.has(key)) return;
|
|
1217
|
+
var sub = _this8.store[key];
|
|
1305
1218
|
if (sub && typeof sub.destroy === 'function') {
|
|
1306
1219
|
try {
|
|
1307
1220
|
sub.destroy();
|
|
@@ -1339,7 +1252,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1339
1252
|
key: "loadSalesDetail",
|
|
1340
1253
|
value: (function () {
|
|
1341
1254
|
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,
|
|
1255
|
+
var loadSequence, _ref17, _ref18, _ref19, _ref20, _params$orderId, params, externalSaleNumber, preloadedSalesDetail, lookup, loadedRecord, message, remoteRecord, currentTempOrder, record;
|
|
1343
1256
|
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
1344
1257
|
while (1) switch (_context13.prev = _context13.next) {
|
|
1345
1258
|
case 0:
|
|
@@ -1388,40 +1301,39 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1388
1301
|
message = loadedRecord && (loadedRecord.message || loadedRecord.msg) || "\u52A0\u8F7D\u9500\u552E\u8BE6\u60C5\u5931\u8D25: ".concat(lookup);
|
|
1389
1302
|
throw new Error(message);
|
|
1390
1303
|
case 22:
|
|
1391
|
-
remoteRecord =
|
|
1304
|
+
remoteRecord = preloadedSalesDetail !== null && preloadedSalesDetail !== void 0 ? preloadedSalesDetail : loadedRecord.data;
|
|
1392
1305
|
currentTempOrder = params.merge ? this.store.order.getTempOrder() : null;
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
_context13.next = 28;
|
|
1306
|
+
record = params.merge ? mergeSalesDetailRecordWithTempOrder(currentTempOrder, remoteRecord, 'preserve-local') : remoteRecord;
|
|
1307
|
+
_context13.next = 27;
|
|
1396
1308
|
return this.hydrateLatestLoadedSalesDetail(record, loadSequence);
|
|
1397
|
-
case
|
|
1309
|
+
case 27:
|
|
1398
1310
|
return _context13.abrupt("return", _context13.sent);
|
|
1399
|
-
case
|
|
1400
|
-
_context13.prev =
|
|
1311
|
+
case 28:
|
|
1312
|
+
_context13.prev = 28;
|
|
1401
1313
|
this.salesDetailLoadInFlightCount = Math.max(0, this.salesDetailLoadInFlightCount - 1);
|
|
1402
1314
|
if (!(this.salesDetailLoadInFlightCount === 0)) {
|
|
1403
|
-
_context13.next =
|
|
1315
|
+
_context13.next = 39;
|
|
1404
1316
|
break;
|
|
1405
1317
|
}
|
|
1406
|
-
_context13.prev =
|
|
1407
|
-
_context13.next =
|
|
1318
|
+
_context13.prev = 31;
|
|
1319
|
+
_context13.next = 34;
|
|
1408
1320
|
return this.drainQueuedServerOrderChanges();
|
|
1409
|
-
case
|
|
1410
|
-
_context13.next =
|
|
1321
|
+
case 34:
|
|
1322
|
+
_context13.next = 39;
|
|
1411
1323
|
break;
|
|
1412
|
-
case
|
|
1413
|
-
_context13.prev =
|
|
1414
|
-
_context13.t1 = _context13["catch"](
|
|
1324
|
+
case 36:
|
|
1325
|
+
_context13.prev = 36;
|
|
1326
|
+
_context13.t1 = _context13["catch"](31);
|
|
1415
1327
|
this.logError('drain queued server order changes failed', {
|
|
1416
1328
|
error: _context13.t1 instanceof Error ? _context13.t1.message : String(_context13.t1)
|
|
1417
1329
|
});
|
|
1330
|
+
case 39:
|
|
1331
|
+
return _context13.finish(28);
|
|
1418
1332
|
case 40:
|
|
1419
|
-
return _context13.finish(29);
|
|
1420
|
-
case 41:
|
|
1421
1333
|
case "end":
|
|
1422
1334
|
return _context13.stop();
|
|
1423
1335
|
}
|
|
1424
|
-
}, _callee13, this, [[4,,
|
|
1336
|
+
}, _callee13, this, [[4,, 28, 40], [31, 36]]);
|
|
1425
1337
|
}));
|
|
1426
1338
|
function loadSalesDetail(_x11) {
|
|
1427
1339
|
return _loadSalesDetail.apply(this, arguments);
|
|
@@ -1849,10 +1761,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1849
1761
|
}, {
|
|
1850
1762
|
key: "getHistoricalProductDiscountList",
|
|
1851
1763
|
value: function getHistoricalProductDiscountList(products) {
|
|
1852
|
-
var
|
|
1764
|
+
var _this9 = this;
|
|
1853
1765
|
var historyDiscountList = [];
|
|
1854
1766
|
products.forEach(function (item) {
|
|
1855
|
-
if (!
|
|
1767
|
+
if (!_this9.isPersistedOrderProduct(item)) return;
|
|
1856
1768
|
(item.discount_list || []).forEach(function (discount) {
|
|
1857
1769
|
var _discount$discount, _discount$metadata, _discount$discount2, _discount$discount3, _discount$discount4;
|
|
1858
1770
|
var discountId = ((_discount$discount = discount.discount) === null || _discount$discount === void 0 ? void 0 : _discount$discount.resource_id) || discount.id;
|
|
@@ -1912,11 +1824,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1912
1824
|
}, {
|
|
1913
1825
|
key: "shouldSkipAutoApplyFetchedDiscountsInEditMode",
|
|
1914
1826
|
value: function shouldSkipAutoApplyFetchedDiscountsInEditMode(params) {
|
|
1915
|
-
var
|
|
1827
|
+
var _this10 = this;
|
|
1916
1828
|
if (params.discountAction !== 'edit') return false;
|
|
1917
1829
|
if (!params.products.length) return false;
|
|
1918
1830
|
var hasDraftProduct = params.products.some(function (product) {
|
|
1919
|
-
return !
|
|
1831
|
+
return !_this10.isPersistedOrderProduct(product);
|
|
1920
1832
|
});
|
|
1921
1833
|
if (hasDraftProduct) return false;
|
|
1922
1834
|
var hasSelectedDiscount = params.currentDiscountList.some(function (discount) {
|
|
@@ -2675,8 +2587,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2675
2587
|
key: "submitSalesOrder",
|
|
2676
2588
|
value: (function () {
|
|
2677
2589
|
var _submitSalesOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(params) {
|
|
2678
|
-
var _this$otherParams6, _this$otherParams7, _this$otherParams8, _this$otherParams9;
|
|
2679
|
-
var inferredPaymentStatus, submitParams;
|
|
2590
|
+
var _params$smallTicketDa, _this$otherParams6, _this$otherParams7, _this$otherParams8, _this$otherParams9;
|
|
2591
|
+
var inferredPaymentStatus, smallTicketDataFlag, submitParams;
|
|
2680
2592
|
return _regeneratorRuntime().wrap(function _callee27$(_context27) {
|
|
2681
2593
|
while (1) switch (_context27.prev = _context27.next) {
|
|
2682
2594
|
case 0:
|
|
@@ -2688,6 +2600,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2688
2600
|
case 2:
|
|
2689
2601
|
// this.store.order.persistTempOrder();
|
|
2690
2602
|
inferredPaymentStatus = this.getSubmitPaymentStatus(params === null || params === void 0 ? void 0 : params.paymentStatus);
|
|
2603
|
+
smallTicketDataFlag = (_params$smallTicketDa = params === null || params === void 0 ? void 0 : params.smallTicketDataFlag) !== null && _params$smallTicketDa !== void 0 ? _params$smallTicketDa : this.getDefaultCheckoutSmallTicketDataFlag();
|
|
2691
2604
|
submitParams = _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
2692
2605
|
cacheId: this.cacheId,
|
|
2693
2606
|
platform: (_this$otherParams6 = this.otherParams) === null || _this$otherParams6 === void 0 ? void 0 : _this$otherParams6.platform,
|
|
@@ -2699,15 +2612,15 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2699
2612
|
payments: params.payments
|
|
2700
2613
|
} : {}), inferredPaymentStatus !== undefined ? {
|
|
2701
2614
|
paymentStatus: inferredPaymentStatus
|
|
2702
|
-
} : {}),
|
|
2703
|
-
smallTicketDataFlag:
|
|
2615
|
+
} : {}), smallTicketDataFlag !== undefined ? {
|
|
2616
|
+
smallTicketDataFlag: smallTicketDataFlag
|
|
2704
2617
|
} : {}), (params === null || params === void 0 ? void 0 : params.confirmPendingVoucherPayments) !== undefined ? {
|
|
2705
2618
|
confirmPendingVoucherPayments: params.confirmPendingVoucherPayments
|
|
2706
2619
|
} : {}), (params === null || params === void 0 ? void 0 : params.enhancePayload) !== undefined ? {
|
|
2707
2620
|
enhancePayload: params.enhancePayload
|
|
2708
2621
|
} : {});
|
|
2709
|
-
return _context27.abrupt("return", this.store.order.submitTempOrder(submitParams));
|
|
2710
|
-
case
|
|
2622
|
+
return _context27.abrupt("return", this.shouldUseCheckoutSyncTask() ? this.store.order.submitTempOrder(submitParams) : this.store.order.submitTempOrderAsync(submitParams));
|
|
2623
|
+
case 6:
|
|
2711
2624
|
case "end":
|
|
2712
2625
|
return _context27.stop();
|
|
2713
2626
|
}
|
|
@@ -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 _params$
|
|
2637
|
+
var _submitTempOrderAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(params) {
|
|
2638
|
+
var _params$smallTicketDa2, _this$otherParams10, _this$otherParams11, _this$otherParams12, _this$otherParams13;
|
|
2639
|
+
var inferredPaymentStatus, smallTicketDataFlag, submitParams;
|
|
2726
2640
|
return _regeneratorRuntime().wrap(function _callee28$(_context28) {
|
|
2727
2641
|
while (1) switch (_context28.prev = _context28.next) {
|
|
2728
2642
|
case 0:
|
|
@@ -2731,83 +2645,68 @@ 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);
|
|
2650
|
+
smallTicketDataFlag = (_params$smallTicketDa2 = params === null || params === void 0 ? void 0 : params.smallTicketDataFlag) !== null && _params$smallTicketDa2 !== void 0 ? _params$smallTicketDa2 : this.getDefaultCheckoutSmallTicketDataFlag();
|
|
2771
2651
|
submitParams = _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
2772
2652
|
cacheId: this.cacheId,
|
|
2773
|
-
platform: (_this$
|
|
2774
|
-
businessCode: ((_this$
|
|
2653
|
+
platform: (_this$otherParams10 = this.otherParams) === null || _this$otherParams10 === void 0 ? void 0 : _this$otherParams10.platform,
|
|
2654
|
+
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
2655
|
channel: this.getSubmitOrderSalesChannel(),
|
|
2776
|
-
type: (_this$
|
|
2656
|
+
type: (_this$otherParams13 = this.otherParams) === null || _this$otherParams13 === void 0 ? void 0 : _this$otherParams13.type,
|
|
2657
|
+
request_unique_idempotency_token: this.store.order.generateIdempotencyToken()
|
|
2777
2658
|
}, (params === null || params === void 0 ? void 0 : params.payments) !== undefined ? {
|
|
2778
2659
|
payments: params.payments
|
|
2779
2660
|
} : {}), inferredPaymentStatus !== undefined ? {
|
|
2780
2661
|
paymentStatus: inferredPaymentStatus
|
|
2781
|
-
} : {}),
|
|
2782
|
-
smallTicketDataFlag:
|
|
2662
|
+
} : {}), smallTicketDataFlag !== undefined ? {
|
|
2663
|
+
smallTicketDataFlag: smallTicketDataFlag
|
|
2783
2664
|
} : {}), (params === null || params === void 0 ? void 0 : params.confirmPendingVoucherPayments) !== undefined ? {
|
|
2784
2665
|
confirmPendingVoucherPayments: params.confirmPendingVoucherPayments
|
|
2785
2666
|
} : {}), (params === null || params === void 0 ? void 0 : params.enhancePayload) !== undefined ? {
|
|
2786
2667
|
enhancePayload: params.enhancePayload
|
|
2787
2668
|
} : {});
|
|
2788
|
-
return
|
|
2789
|
-
case
|
|
2669
|
+
return _context28.abrupt("return", this.store.order.submitTempOrderAsync(submitParams));
|
|
2670
|
+
case 6:
|
|
2790
2671
|
case "end":
|
|
2791
|
-
return
|
|
2672
|
+
return _context28.stop();
|
|
2792
2673
|
}
|
|
2793
|
-
},
|
|
2674
|
+
}, _callee28, this);
|
|
2794
2675
|
}));
|
|
2795
|
-
function submitTempOrderAsync(
|
|
2676
|
+
function submitTempOrderAsync(_x22) {
|
|
2796
2677
|
return _submitTempOrderAsync.apply(this, arguments);
|
|
2797
2678
|
}
|
|
2798
2679
|
return submitTempOrderAsync;
|
|
2799
2680
|
}()
|
|
2681
|
+
/**
|
|
2682
|
+
* 默认保持 WebPOS 的本地待同步订单模式;需要云端确认后才算成功的渠道可覆盖此策略。
|
|
2683
|
+
* otherParams.checkoutSyncTaskEnabled 优先,便于同一 solution 按入口恢复旧行为。
|
|
2684
|
+
*/
|
|
2685
|
+
}, {
|
|
2686
|
+
key: "shouldUseCheckoutSyncTask",
|
|
2687
|
+
value: function shouldUseCheckoutSyncTask() {
|
|
2688
|
+
var _this$otherParams14;
|
|
2689
|
+
var configured = (_this$otherParams14 = this.otherParams) === null || _this$otherParams14 === void 0 ? void 0 : _this$otherParams14.checkoutSyncTaskEnabled;
|
|
2690
|
+
return typeof configured === 'boolean' ? configured : true;
|
|
2691
|
+
}
|
|
2692
|
+
|
|
2693
|
+
/** 可由特定 solution 为真实 checkout 补充默认收据数据请求。 */
|
|
2694
|
+
}, {
|
|
2695
|
+
key: "getDefaultCheckoutSmallTicketDataFlag",
|
|
2696
|
+
value: function getDefaultCheckoutSmallTicketDataFlag() {
|
|
2697
|
+
return undefined;
|
|
2698
|
+
}
|
|
2800
2699
|
}, {
|
|
2801
2700
|
key: "printLocalOrderReceipt",
|
|
2802
2701
|
value: function () {
|
|
2803
|
-
var _printLocalOrderReceipt = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2804
|
-
var _this$
|
|
2702
|
+
var _printLocalOrderReceipt = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(lookup) {
|
|
2703
|
+
var _this$otherParams15, _this$otherParams16, _this$otherParams17, _this$otherParams18;
|
|
2805
2704
|
var hasLookup, lookupPayload, context, payload, response, _this$store$order$app, _this$store$order5, _data;
|
|
2806
|
-
return _regeneratorRuntime().wrap(function
|
|
2807
|
-
while (1) switch (
|
|
2705
|
+
return _regeneratorRuntime().wrap(function _callee29$(_context29) {
|
|
2706
|
+
while (1) switch (_context29.prev = _context29.next) {
|
|
2808
2707
|
case 0:
|
|
2809
2708
|
if (this.store.order) {
|
|
2810
|
-
|
|
2709
|
+
_context29.next = 2;
|
|
2811
2710
|
break;
|
|
2812
2711
|
}
|
|
2813
2712
|
throw new Error('BaseSales 解决方案需要 order 模块支持');
|
|
@@ -2819,10 +2718,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2819
2718
|
external_sale_number: lookup
|
|
2820
2719
|
};
|
|
2821
2720
|
context = {
|
|
2822
|
-
platform: (_this$
|
|
2823
|
-
businessCode: ((_this$
|
|
2721
|
+
platform: (_this$otherParams15 = this.otherParams) === null || _this$otherParams15 === void 0 ? void 0 : _this$otherParams15.platform,
|
|
2722
|
+
businessCode: ((_this$otherParams16 = this.otherParams) === null || _this$otherParams16 === void 0 ? void 0 : _this$otherParams16.businessCode) || ((_this$otherParams17 = this.otherParams) === null || _this$otherParams17 === void 0 ? void 0 : _this$otherParams17.business_code),
|
|
2824
2723
|
channel: this.getSubmitOrderSalesChannel(),
|
|
2825
|
-
type: (_this$
|
|
2724
|
+
type: (_this$otherParams18 = this.otherParams) === null || _this$otherParams18 === void 0 ? void 0 : _this$otherParams18.type
|
|
2826
2725
|
};
|
|
2827
2726
|
payload = hasLookup ? _objectSpread(_objectSpread({}, lookupPayload), {}, {
|
|
2828
2727
|
lookup_order_from_db: 1,
|
|
@@ -2838,28 +2737,28 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2838
2737
|
channel: context.channel,
|
|
2839
2738
|
type: context.type
|
|
2840
2739
|
});
|
|
2841
|
-
|
|
2740
|
+
_context29.next = 8;
|
|
2842
2741
|
return this.request.post('/local/print-order', payload, {
|
|
2843
2742
|
osServer: true,
|
|
2844
2743
|
customToast: function customToast() {}
|
|
2845
2744
|
});
|
|
2846
2745
|
case 8:
|
|
2847
|
-
response =
|
|
2746
|
+
response = _context29.sent;
|
|
2848
2747
|
if (hasLookup) {
|
|
2849
|
-
|
|
2748
|
+
_context29.next = 12;
|
|
2850
2749
|
break;
|
|
2851
2750
|
}
|
|
2852
|
-
|
|
2751
|
+
_context29.next = 12;
|
|
2853
2752
|
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
2753
|
case 12:
|
|
2855
|
-
return
|
|
2754
|
+
return _context29.abrupt("return", response);
|
|
2856
2755
|
case 13:
|
|
2857
2756
|
case "end":
|
|
2858
|
-
return
|
|
2757
|
+
return _context29.stop();
|
|
2859
2758
|
}
|
|
2860
|
-
},
|
|
2759
|
+
}, _callee29, this);
|
|
2861
2760
|
}));
|
|
2862
|
-
function printLocalOrderReceipt(
|
|
2761
|
+
function printLocalOrderReceipt(_x23) {
|
|
2863
2762
|
return _printLocalOrderReceipt.apply(this, arguments);
|
|
2864
2763
|
}
|
|
2865
2764
|
return printLocalOrderReceipt;
|
|
@@ -2880,35 +2779,37 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2880
2779
|
}, {
|
|
2881
2780
|
key: "syncPaymentsToOrder",
|
|
2882
2781
|
value: function () {
|
|
2883
|
-
var _syncPaymentsToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2884
|
-
var
|
|
2782
|
+
var _syncPaymentsToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(params) {
|
|
2783
|
+
var _ref22, _params$businessCode, _this$otherParams19, _this$otherParams20, _params$channel;
|
|
2885
2784
|
var businessCode, channel, syncParams, syncState, payments, syncResult, latestPayments, amountSnapshot, orderSnapshot, syncPayload;
|
|
2886
|
-
return _regeneratorRuntime().wrap(function
|
|
2887
|
-
while (1) switch (
|
|
2785
|
+
return _regeneratorRuntime().wrap(function _callee30$(_context30) {
|
|
2786
|
+
while (1) switch (_context30.prev = _context30.next) {
|
|
2888
2787
|
case 0:
|
|
2889
2788
|
if (this.store.order) {
|
|
2890
|
-
|
|
2789
|
+
_context30.next = 2;
|
|
2891
2790
|
break;
|
|
2892
2791
|
}
|
|
2893
2792
|
throw new Error('order 模块未初始化');
|
|
2894
2793
|
case 2:
|
|
2895
|
-
businessCode = (
|
|
2896
|
-
channel = (_params$
|
|
2897
|
-
syncParams = _objectSpread(_objectSpread(_objectSpread({}, params),
|
|
2794
|
+
businessCode = (_ref22 = (_params$businessCode = params.businessCode) !== null && _params$businessCode !== void 0 ? _params$businessCode : (_this$otherParams19 = this.otherParams) === null || _this$otherParams19 === void 0 ? void 0 : _this$otherParams19.businessCode) !== null && _ref22 !== void 0 ? _ref22 : (_this$otherParams20 = this.otherParams) === null || _this$otherParams20 === void 0 ? void 0 : _this$otherParams20.business_code;
|
|
2795
|
+
channel = (_params$channel = params.channel) !== null && _params$channel !== void 0 ? _params$channel : this.getSubmitOrderSalesChannel();
|
|
2796
|
+
syncParams = _objectSpread(_objectSpread(_objectSpread({}, params), {}, {
|
|
2797
|
+
checkoutSyncTaskEnabled: this.shouldUseCheckoutSyncTask()
|
|
2798
|
+
}, businessCode !== undefined ? {
|
|
2898
2799
|
businessCode: businessCode
|
|
2899
2800
|
} : {}), channel !== undefined ? {
|
|
2900
2801
|
channel: channel
|
|
2901
2802
|
} : {});
|
|
2902
2803
|
syncState = this.store.order.getOrderSyncState();
|
|
2903
2804
|
if (!(params.submitWhenPaid && syncState === 'submitting')) {
|
|
2904
|
-
|
|
2805
|
+
_context30.next = 9;
|
|
2905
2806
|
break;
|
|
2906
2807
|
}
|
|
2907
2808
|
this.queueLatestAutoPaymentSync();
|
|
2908
|
-
return
|
|
2809
|
+
return _context30.abrupt("return", this.store.order.syncPaymentsToOrder(syncParams));
|
|
2909
2810
|
case 9:
|
|
2910
2811
|
payments = params.payments || [];
|
|
2911
|
-
|
|
2812
|
+
_context30.next = 12;
|
|
2912
2813
|
return this.effectsEmit(BaseSalesHookNames.onPaymentSyncStart, {
|
|
2913
2814
|
payments: payments,
|
|
2914
2815
|
params: syncParams,
|
|
@@ -2916,11 +2817,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2916
2817
|
orderSnapshot: this.store.order.getOrderSnapshot()
|
|
2917
2818
|
});
|
|
2918
2819
|
case 12:
|
|
2919
|
-
|
|
2920
|
-
|
|
2820
|
+
_context30.prev = 12;
|
|
2821
|
+
_context30.next = 15;
|
|
2921
2822
|
return this.store.order.syncPaymentsToOrder(syncParams);
|
|
2922
2823
|
case 15:
|
|
2923
|
-
syncResult =
|
|
2824
|
+
syncResult = _context30.sent;
|
|
2924
2825
|
latestPayments = this.store.order.getOrderPayments();
|
|
2925
2826
|
amountSnapshot = this.store.order.getOrderAmountSnapshot();
|
|
2926
2827
|
orderSnapshot = this.store.order.getOrderSnapshot();
|
|
@@ -2938,25 +2839,25 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2938
2839
|
depositAmount: syncResult.depositAmount,
|
|
2939
2840
|
orderExpectedAmount: syncResult.orderExpectedAmount
|
|
2940
2841
|
};
|
|
2941
|
-
|
|
2842
|
+
_context30.next = 22;
|
|
2942
2843
|
return this.effectsEmit(BaseSalesHookNames.onPaymentSyncEnd, syncPayload);
|
|
2943
2844
|
case 22:
|
|
2944
2845
|
if (!(syncResult.isDepositFullyPaid && !syncResult.isOrderFullyPaid)) {
|
|
2945
|
-
|
|
2846
|
+
_context30.next = 25;
|
|
2946
2847
|
break;
|
|
2947
2848
|
}
|
|
2948
|
-
|
|
2849
|
+
_context30.next = 25;
|
|
2949
2850
|
return this.effectsEmit(BaseSalesHookNames.onDepositPaymentSyncEnd, syncPayload);
|
|
2950
2851
|
case 25:
|
|
2951
2852
|
this.scheduleQueuedAutoPaymentSyncFlush(0);
|
|
2952
|
-
return
|
|
2853
|
+
return _context30.abrupt("return", syncResult);
|
|
2953
2854
|
case 29:
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
|
|
2855
|
+
_context30.prev = 29;
|
|
2856
|
+
_context30.t0 = _context30["catch"](12);
|
|
2857
|
+
_context30.next = 33;
|
|
2957
2858
|
return this.effectsEmit(BaseSalesHookNames.onPaymentSyncEnd, {
|
|
2958
2859
|
ok: false,
|
|
2959
|
-
error:
|
|
2860
|
+
error: _context30.t0,
|
|
2960
2861
|
payments: this.store.order.getOrderPayments(),
|
|
2961
2862
|
params: syncParams,
|
|
2962
2863
|
amountSnapshot: this.store.order.getOrderAmountSnapshot(),
|
|
@@ -2964,14 +2865,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2964
2865
|
});
|
|
2965
2866
|
case 33:
|
|
2966
2867
|
this.scheduleQueuedAutoPaymentSyncFlush(0);
|
|
2967
|
-
throw
|
|
2868
|
+
throw _context30.t0;
|
|
2968
2869
|
case 35:
|
|
2969
2870
|
case "end":
|
|
2970
|
-
return
|
|
2871
|
+
return _context30.stop();
|
|
2971
2872
|
}
|
|
2972
|
-
},
|
|
2873
|
+
}, _callee30, this, [[12, 29]]);
|
|
2973
2874
|
}));
|
|
2974
|
-
function syncPaymentsToOrder(
|
|
2875
|
+
function syncPaymentsToOrder(_x24) {
|
|
2975
2876
|
return _syncPaymentsToOrder.apply(this, arguments);
|
|
2976
2877
|
}
|
|
2977
2878
|
return syncPaymentsToOrder;
|
|
@@ -3008,58 +2909,58 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3008
2909
|
}, {
|
|
3009
2910
|
key: "scheduleQueuedAutoPaymentSyncFlush",
|
|
3010
2911
|
value: function scheduleQueuedAutoPaymentSyncFlush() {
|
|
3011
|
-
var
|
|
2912
|
+
var _this11 = this;
|
|
3012
2913
|
var delay = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 100;
|
|
3013
2914
|
if (!this.queuedAutoPaymentSync) return;
|
|
3014
2915
|
if (this.autoPaymentSyncTimer) return;
|
|
3015
2916
|
this.autoPaymentSyncTimer = setTimeout(function () {
|
|
3016
|
-
|
|
3017
|
-
void
|
|
2917
|
+
_this11.autoPaymentSyncTimer = null;
|
|
2918
|
+
void _this11.flushQueuedAutoPaymentSync();
|
|
3018
2919
|
}, delay);
|
|
3019
2920
|
}
|
|
3020
2921
|
}, {
|
|
3021
2922
|
key: "flushQueuedAutoPaymentSync",
|
|
3022
2923
|
value: function () {
|
|
3023
|
-
var _flushQueuedAutoPaymentSync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2924
|
+
var _flushQueuedAutoPaymentSync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31() {
|
|
3024
2925
|
var payments;
|
|
3025
|
-
return _regeneratorRuntime().wrap(function
|
|
3026
|
-
while (1) switch (
|
|
2926
|
+
return _regeneratorRuntime().wrap(function _callee31$(_context31) {
|
|
2927
|
+
while (1) switch (_context31.prev = _context31.next) {
|
|
3027
2928
|
case 0:
|
|
3028
2929
|
if (this.store.order) {
|
|
3029
|
-
|
|
2930
|
+
_context31.next = 2;
|
|
3030
2931
|
break;
|
|
3031
2932
|
}
|
|
3032
|
-
return
|
|
2933
|
+
return _context31.abrupt("return");
|
|
3033
2934
|
case 2:
|
|
3034
2935
|
if (!(!this.queuedAutoPaymentSync || this.autoPaymentSyncFlushing)) {
|
|
3035
|
-
|
|
2936
|
+
_context31.next = 4;
|
|
3036
2937
|
break;
|
|
3037
2938
|
}
|
|
3038
|
-
return
|
|
2939
|
+
return _context31.abrupt("return");
|
|
3039
2940
|
case 4:
|
|
3040
2941
|
if (!(this.store.order.getOrderSyncState() === 'submitting')) {
|
|
3041
|
-
|
|
2942
|
+
_context31.next = 7;
|
|
3042
2943
|
break;
|
|
3043
2944
|
}
|
|
3044
2945
|
this.scheduleQueuedAutoPaymentSyncFlush();
|
|
3045
|
-
return
|
|
2946
|
+
return _context31.abrupt("return");
|
|
3046
2947
|
case 7:
|
|
3047
2948
|
this.autoPaymentSyncFlushing = true;
|
|
3048
|
-
|
|
2949
|
+
_context31.prev = 8;
|
|
3049
2950
|
case 9:
|
|
3050
2951
|
if (!this.queuedAutoPaymentSync) {
|
|
3051
|
-
|
|
2952
|
+
_context31.next = 18;
|
|
3052
2953
|
break;
|
|
3053
2954
|
}
|
|
3054
2955
|
this.queuedAutoPaymentSync = false;
|
|
3055
2956
|
payments = this.store.order.getOrderPayments();
|
|
3056
2957
|
if (payments.length) {
|
|
3057
|
-
|
|
2958
|
+
_context31.next = 14;
|
|
3058
2959
|
break;
|
|
3059
2960
|
}
|
|
3060
|
-
return
|
|
2961
|
+
return _context31.abrupt("continue", 9);
|
|
3061
2962
|
case 14:
|
|
3062
|
-
|
|
2963
|
+
_context31.next = 16;
|
|
3063
2964
|
return this.syncPaymentsToOrder({
|
|
3064
2965
|
payments: payments,
|
|
3065
2966
|
paymentStatus: this.getPaymentStatusForSync(payments),
|
|
@@ -3067,91 +2968,44 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3067
2968
|
smallTicketDataFlag: 1
|
|
3068
2969
|
});
|
|
3069
2970
|
case 16:
|
|
3070
|
-
|
|
2971
|
+
_context31.next = 9;
|
|
3071
2972
|
break;
|
|
3072
2973
|
case 18:
|
|
3073
|
-
|
|
2974
|
+
_context31.next = 23;
|
|
3074
2975
|
break;
|
|
3075
2976
|
case 20:
|
|
3076
|
-
|
|
3077
|
-
|
|
2977
|
+
_context31.prev = 20;
|
|
2978
|
+
_context31.t0 = _context31["catch"](8);
|
|
3078
2979
|
this.logError('queued auto sync payments failed', {
|
|
3079
|
-
error:
|
|
2980
|
+
error: _context31.t0 instanceof Error ? _context31.t0.message : String(_context31.t0)
|
|
3080
2981
|
});
|
|
3081
2982
|
case 23:
|
|
3082
|
-
|
|
2983
|
+
_context31.prev = 23;
|
|
3083
2984
|
this.autoPaymentSyncFlushing = false;
|
|
3084
2985
|
if (this.queuedAutoPaymentSync) {
|
|
3085
2986
|
this.scheduleQueuedAutoPaymentSyncFlush(0);
|
|
3086
2987
|
}
|
|
3087
|
-
return
|
|
2988
|
+
return _context31.finish(23);
|
|
3088
2989
|
case 27:
|
|
3089
2990
|
case "end":
|
|
3090
|
-
return
|
|
2991
|
+
return _context31.stop();
|
|
3091
2992
|
}
|
|
3092
|
-
},
|
|
2993
|
+
}, _callee31, this, [[8, 20, 23, 27]]);
|
|
3093
2994
|
}));
|
|
3094
2995
|
function flushQueuedAutoPaymentSync() {
|
|
3095
2996
|
return _flushQueuedAutoPaymentSync.apply(this, arguments);
|
|
3096
2997
|
}
|
|
3097
2998
|
return flushQueuedAutoPaymentSync;
|
|
3098
|
-
}()
|
|
3099
|
-
/**
|
|
3100
|
-
* 同步兼容入口。无法等待 IoT 短号时,按调用当下的 device_id 或 LOCAL 生成。
|
|
3101
|
-
*/
|
|
2999
|
+
}() /** 追加单个支付项到当前订单。 */
|
|
3102
3000
|
}, {
|
|
3103
3001
|
key: "addOrderPayment",
|
|
3104
3002
|
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,
|
|
3003
|
+
var _this$otherParams21,
|
|
3150
3004
|
_paymentRecord$paymen,
|
|
3151
3005
|
_paymentRecord$create,
|
|
3152
|
-
|
|
3006
|
+
_ref23,
|
|
3153
3007
|
_paymentRecord$origin,
|
|
3154
|
-
|
|
3008
|
+
_this12 = this;
|
|
3155
3009
|
if (!this.store.order) throw new Error('order 模块未初始化');
|
|
3156
3010
|
var paymentRecord = payment;
|
|
3157
3011
|
var paymentAmount = new Decimal(paymentRecord.amount || 0);
|
|
@@ -3162,26 +3016,25 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3162
3016
|
return this.store.order.getOrderPayments();
|
|
3163
3017
|
}
|
|
3164
3018
|
var metadata = paymentRecord.metadata && _typeof(paymentRecord.metadata) === 'object' ? _objectSpread({}, paymentRecord.metadata) : {};
|
|
3165
|
-
var shopWalletPassId = (_this$
|
|
3019
|
+
var shopWalletPassId = (_this$otherParams21 = this.otherParams) === null || _this$otherParams21 === void 0 ? void 0 : _this$otherParams21.shop_wallet_pass_id;
|
|
3166
3020
|
if (shopWalletPassId !== undefined && shopWalletPassId !== null) {
|
|
3167
3021
|
metadata.shop_wallet_pass_id = shopWalletPassId;
|
|
3168
3022
|
}
|
|
3169
|
-
|
|
3023
|
+
if (!metadata.unique_payment_number) {
|
|
3024
|
+
metadata.unique_payment_number = createUuidV4();
|
|
3025
|
+
}
|
|
3170
3026
|
var paymentTimestamp = dayjs().format('YYYY-MM-DD HH:mm:ss');
|
|
3171
3027
|
var paymentTime = (_paymentRecord$paymen = paymentRecord.payment_time) !== null && _paymentRecord$paymen !== void 0 ? _paymentRecord$paymen : paymentTimestamp;
|
|
3172
3028
|
var createdAt = (_paymentRecord$create = paymentRecord.created_at) !== null && _paymentRecord$create !== void 0 ? _paymentRecord$create : paymentTimestamp;
|
|
3173
3029
|
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({},
|
|
3030
|
+
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;
|
|
3031
|
+
var payments = this.store.order.addOrderPayment(_objectSpread(_objectSpread(_objectSpread({}, paymentRecord), calculatedServiceFee !== undefined ? {
|
|
3176
3032
|
service_fee: calculatedServiceFee
|
|
3177
3033
|
} : {}), {}, {
|
|
3178
3034
|
metadata: metadata,
|
|
3179
3035
|
payment_time: paymentTime,
|
|
3180
3036
|
created_at: createdAt
|
|
3181
3037
|
}));
|
|
3182
|
-
if (paymentRecord.status === 'payment_pending') {
|
|
3183
|
-
return payments;
|
|
3184
|
-
}
|
|
3185
3038
|
var amountSnapshot = this.store.order.getOrderAmountSnapshot();
|
|
3186
3039
|
var syncState = this.store.order.getOrderSyncState();
|
|
3187
3040
|
if (amountSnapshot) {
|
|
@@ -3195,7 +3048,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3195
3048
|
submitWhenPaid: true,
|
|
3196
3049
|
smallTicketDataFlag: 1
|
|
3197
3050
|
}).catch(function (error) {
|
|
3198
|
-
|
|
3051
|
+
_this12.logError('auto sync payments failed', {
|
|
3199
3052
|
error: error instanceof Error ? error.message : String(error)
|
|
3200
3053
|
});
|
|
3201
3054
|
});
|
|
@@ -3206,131 +3059,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3206
3059
|
/** 更新当前订单中的指定支付项。 */
|
|
3207
3060
|
}, {
|
|
3208
3061
|
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
|
-
}() /** 删除当前订单中的指定支付项。 */)
|
|
3062
|
+
value: function updateOrderPayment(paymentIdentity, updates) {
|
|
3063
|
+
if (!this.store.order) throw new Error('order 模块未初始化');
|
|
3064
|
+
return this.store.order.updateOrderPayment(paymentIdentity, updates);
|
|
3065
|
+
}
|
|
3066
|
+
|
|
3067
|
+
/** 删除当前订单中的指定支付项。 */
|
|
3334
3068
|
}, {
|
|
3335
3069
|
key: "deleteOrderPayment",
|
|
3336
3070
|
value: function deleteOrderPayment(paymentIdentity) {
|
|
@@ -3345,31 +3079,6 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3345
3079
|
if (!this.store.order) throw new Error('order 模块未初始化');
|
|
3346
3080
|
return this.store.order.updateVoucherOrderPayments(payments, options);
|
|
3347
3081
|
}
|
|
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
3082
|
}, {
|
|
3374
3083
|
key: "confirmPendingVoucherPayments",
|
|
3375
3084
|
value: function confirmPendingVoucherPayments() {
|
|
@@ -3446,20 +3155,20 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3446
3155
|
}, {
|
|
3447
3156
|
key: "initWalletData",
|
|
3448
3157
|
value: function () {
|
|
3449
|
-
var _initWalletData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3450
|
-
var _params$order_wait_pa,
|
|
3158
|
+
var _initWalletData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(params) {
|
|
3159
|
+
var _params$order_wait_pa, _ref24, _tempOrder$is_price_i;
|
|
3451
3160
|
var snapshot, tempOrder, amount, walletBusinessData, result;
|
|
3452
|
-
return _regeneratorRuntime().wrap(function
|
|
3453
|
-
while (1) switch (
|
|
3161
|
+
return _regeneratorRuntime().wrap(function _callee32$(_context32) {
|
|
3162
|
+
while (1) switch (_context32.prev = _context32.next) {
|
|
3454
3163
|
case 0:
|
|
3455
3164
|
if (this.store.order) {
|
|
3456
|
-
|
|
3165
|
+
_context32.next = 2;
|
|
3457
3166
|
break;
|
|
3458
3167
|
}
|
|
3459
3168
|
throw new Error('order 模块未初始化');
|
|
3460
3169
|
case 2:
|
|
3461
3170
|
if (this.store.payment) {
|
|
3462
|
-
|
|
3171
|
+
_context32.next = 4;
|
|
3463
3172
|
break;
|
|
3464
3173
|
}
|
|
3465
3174
|
throw new Error('payment 模块未初始化');
|
|
@@ -3468,10 +3177,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3468
3177
|
tempOrder = snapshot === null || snapshot === void 0 ? void 0 : snapshot.tempOrder;
|
|
3469
3178
|
amount = snapshot === null || snapshot === void 0 ? void 0 : snapshot.amount;
|
|
3470
3179
|
if (!(!tempOrder || !amount)) {
|
|
3471
|
-
|
|
3180
|
+
_context32.next = 9;
|
|
3472
3181
|
break;
|
|
3473
3182
|
}
|
|
3474
|
-
return
|
|
3183
|
+
return _context32.abrupt("return", {
|
|
3475
3184
|
walletRecommendList: [],
|
|
3476
3185
|
userIdentificationCodes: [],
|
|
3477
3186
|
transformList: [],
|
|
@@ -3490,15 +3199,15 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3490
3199
|
},
|
|
3491
3200
|
products: this.getWalletProductList(),
|
|
3492
3201
|
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: (
|
|
3202
|
+
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
3203
|
}, snapshot.identity.orderId ? {
|
|
3495
3204
|
payment_order_id: String(snapshot.identity.orderId)
|
|
3496
3205
|
} : {});
|
|
3497
|
-
|
|
3206
|
+
_context32.next = 12;
|
|
3498
3207
|
return this.store.payment.wallet.initializeWalletDataFromBusinessAsync(walletBusinessData);
|
|
3499
3208
|
case 12:
|
|
3500
|
-
result =
|
|
3501
|
-
|
|
3209
|
+
result = _context32.sent;
|
|
3210
|
+
_context32.next = 15;
|
|
3502
3211
|
return this.core.effects.emit("".concat(this.name, ":onWalletDataInitialized"), {
|
|
3503
3212
|
orderId: snapshot.identity.orderId,
|
|
3504
3213
|
customerId: walletBusinessData.customer_id,
|
|
@@ -3510,14 +3219,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3510
3219
|
timestamp: Date.now()
|
|
3511
3220
|
});
|
|
3512
3221
|
case 15:
|
|
3513
|
-
return
|
|
3222
|
+
return _context32.abrupt("return", result);
|
|
3514
3223
|
case 16:
|
|
3515
3224
|
case "end":
|
|
3516
|
-
return
|
|
3225
|
+
return _context32.stop();
|
|
3517
3226
|
}
|
|
3518
|
-
},
|
|
3227
|
+
}, _callee32, this);
|
|
3519
3228
|
}));
|
|
3520
|
-
function initWalletData(
|
|
3229
|
+
function initWalletData(_x25) {
|
|
3521
3230
|
return _initWalletData.apply(this, arguments);
|
|
3522
3231
|
}
|
|
3523
3232
|
return initWalletData;
|
|
@@ -3544,35 +3253,35 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3544
3253
|
}, {
|
|
3545
3254
|
key: "getPaymentMethodsAsync",
|
|
3546
3255
|
value: (function () {
|
|
3547
|
-
var _getPaymentMethodsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3256
|
+
var _getPaymentMethodsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33() {
|
|
3548
3257
|
var response, paymentMethods;
|
|
3549
|
-
return _regeneratorRuntime().wrap(function
|
|
3550
|
-
while (1) switch (
|
|
3258
|
+
return _regeneratorRuntime().wrap(function _callee33$(_context33) {
|
|
3259
|
+
while (1) switch (_context33.prev = _context33.next) {
|
|
3551
3260
|
case 0:
|
|
3552
|
-
|
|
3553
|
-
|
|
3261
|
+
_context33.prev = 0;
|
|
3262
|
+
_context33.next = 3;
|
|
3554
3263
|
return this.request.get('/pay/custom-payment/all', {
|
|
3555
3264
|
filterPaymentMethods: true
|
|
3556
3265
|
}, {
|
|
3557
3266
|
osServer: true
|
|
3558
3267
|
});
|
|
3559
3268
|
case 3:
|
|
3560
|
-
response =
|
|
3269
|
+
response = _context33.sent;
|
|
3561
3270
|
paymentMethods = (response === null || response === void 0 ? void 0 : response.data) || [];
|
|
3562
3271
|
this.paymentMethodsCache = Array.isArray(paymentMethods) ? _toConsumableArray(paymentMethods) : [];
|
|
3563
|
-
return
|
|
3272
|
+
return _context33.abrupt("return", this.getPaymentMethods());
|
|
3564
3273
|
case 9:
|
|
3565
|
-
|
|
3566
|
-
|
|
3274
|
+
_context33.prev = 9;
|
|
3275
|
+
_context33.t0 = _context33["catch"](0);
|
|
3567
3276
|
this.logWarning('getPaymentMethodsAsync: 获取支付方式列表失败,使用缓存列表', {
|
|
3568
|
-
error:
|
|
3277
|
+
error: _context33.t0 instanceof Error ? _context33.t0.message : String(_context33.t0)
|
|
3569
3278
|
});
|
|
3570
|
-
return
|
|
3279
|
+
return _context33.abrupt("return", this.getPaymentMethods());
|
|
3571
3280
|
case 13:
|
|
3572
3281
|
case "end":
|
|
3573
|
-
return
|
|
3282
|
+
return _context33.stop();
|
|
3574
3283
|
}
|
|
3575
|
-
},
|
|
3284
|
+
}, _callee33, this, [[0, 9]]);
|
|
3576
3285
|
}));
|
|
3577
3286
|
function getPaymentMethodsAsync() {
|
|
3578
3287
|
return _getPaymentMethodsAsync.apply(this, arguments);
|
|
@@ -3620,49 +3329,49 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
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 _callee34(params) {
|
|
3333
|
+
var orderIds, _ref25, _ref26, _submitResult$data$or, _submitResult$data, _submitResult$data2, submitResult, orderId;
|
|
3334
|
+
return _regeneratorRuntime().wrap(function _callee34$(_context34) {
|
|
3335
|
+
while (1) switch (_context34.prev = _context34.next) {
|
|
3627
3336
|
case 0:
|
|
3628
3337
|
if (this.store.order) {
|
|
3629
|
-
|
|
3338
|
+
_context34.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
|
+
_context34.next = 11;
|
|
3637
3346
|
break;
|
|
3638
3347
|
}
|
|
3639
|
-
|
|
3348
|
+
_context34.next = 6;
|
|
3640
3349
|
return this.submitSalesOrder({
|
|
3641
3350
|
smallTicketDataFlag: 1
|
|
3642
3351
|
});
|
|
3643
3352
|
case 6:
|
|
3644
|
-
submitResult =
|
|
3645
|
-
orderId = (
|
|
3353
|
+
submitResult = _context34.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
|
+
_context34.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 _context34.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 _context34.stop();
|
|
3662
3371
|
}
|
|
3663
|
-
},
|
|
3372
|
+
}, _callee34, this);
|
|
3664
3373
|
}));
|
|
3665
|
-
function sendCustomerPayLink(
|
|
3374
|
+
function sendCustomerPayLink(_x26) {
|
|
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 _callee35(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 _callee35$(_context35) {
|
|
3391
|
+
while (1) switch (_context35.prev = _context35.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
|
+
_context35.next = 4;
|
|
3687
3396
|
return this.loadProductForPriceQuery(params, customerId);
|
|
3688
3397
|
case 4:
|
|
3689
|
-
authoritativeProduct =
|
|
3398
|
+
authoritativeProduct = _context35.sent;
|
|
3690
3399
|
product = this.mergeProductForPriceQuery(params.product, authoritativeProduct);
|
|
3691
|
-
|
|
3400
|
+
_context35.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 _context35.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 _context35.stop();
|
|
3707
3416
|
}
|
|
3708
|
-
},
|
|
3417
|
+
}, _callee35, this);
|
|
3709
3418
|
}));
|
|
3710
|
-
function calculateProductBookingPrice(
|
|
3419
|
+
function calculateProductBookingPrice(_x27) {
|
|
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 _callee37(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 _callee37$(_context37) {
|
|
3496
|
+
while (1) switch (_context37.prev = _context37.next) {
|
|
3788
3497
|
case 0:
|
|
3789
3498
|
if (paramsList.length) {
|
|
3790
|
-
|
|
3499
|
+
_context37.next = 2;
|
|
3791
3500
|
break;
|
|
3792
3501
|
}
|
|
3793
|
-
return
|
|
3502
|
+
return _context37.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
|
+
_context37.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 _callee36(_ref27) {
|
|
3527
|
+
var _ref29, groupKey, group, productsById;
|
|
3528
|
+
return _regeneratorRuntime().wrap(function _callee36$(_context36) {
|
|
3529
|
+
while (1) switch (_context36.prev = _context36.next) {
|
|
3821
3530
|
case 0:
|
|
3822
|
-
|
|
3823
|
-
|
|
3824
|
-
return
|
|
3531
|
+
_ref29 = _slicedToArray(_ref27, 2), groupKey = _ref29[0], group = _ref29[1];
|
|
3532
|
+
_context36.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 = _context36.sent;
|
|
3832
3541
|
productMapsByGroup.set(groupKey, productsById);
|
|
3833
3542
|
case 5:
|
|
3834
3543
|
case "end":
|
|
3835
|
-
return
|
|
3544
|
+
return _context36.stop();
|
|
3836
3545
|
}
|
|
3837
|
-
},
|
|
3546
|
+
}, _callee36);
|
|
3838
3547
|
}));
|
|
3839
|
-
return function (
|
|
3840
|
-
return
|
|
3548
|
+
return function (_x29) {
|
|
3549
|
+
return _ref28.apply(this, arguments);
|
|
3841
3550
|
};
|
|
3842
3551
|
}()));
|
|
3843
3552
|
case 9:
|
|
3844
|
-
|
|
3553
|
+
_context37.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 _context37.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 _context37.stop();
|
|
3870
3579
|
}
|
|
3871
|
-
},
|
|
3580
|
+
}, _callee37, this);
|
|
3872
3581
|
}));
|
|
3873
|
-
function calculateProductBookingPrices(
|
|
3582
|
+
function calculateProductBookingPrices(_x28) {
|
|
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 _callee38(product, booking) {
|
|
3882
3591
|
var products;
|
|
3883
|
-
return _regeneratorRuntime().wrap(function
|
|
3884
|
-
while (1) switch (
|
|
3592
|
+
return _regeneratorRuntime().wrap(function _callee38$(_context38) {
|
|
3593
|
+
while (1) switch (_context38.prev = _context38.next) {
|
|
3885
3594
|
case 0:
|
|
3886
|
-
|
|
3595
|
+
_context38.prev = 0;
|
|
3887
3596
|
if (this.store.order) {
|
|
3888
|
-
|
|
3597
|
+
_context38.next = 3;
|
|
3889
3598
|
break;
|
|
3890
3599
|
}
|
|
3891
3600
|
throw new Error('order 模块未初始化');
|
|
3892
3601
|
case 3:
|
|
3893
|
-
|
|
3602
|
+
_context38.next = 5;
|
|
3894
3603
|
return this.store.order.addProductToOrder(product, booking);
|
|
3895
3604
|
case 5:
|
|
3896
|
-
products =
|
|
3897
|
-
return
|
|
3605
|
+
products = _context38.sent;
|
|
3606
|
+
return _context38.abrupt("return", products);
|
|
3898
3607
|
case 9:
|
|
3899
|
-
|
|
3900
|
-
|
|
3901
|
-
throw
|
|
3608
|
+
_context38.prev = 9;
|
|
3609
|
+
_context38.t0 = _context38["catch"](0);
|
|
3610
|
+
throw _context38.t0;
|
|
3902
3611
|
case 12:
|
|
3903
3612
|
case "end":
|
|
3904
|
-
return
|
|
3613
|
+
return _context38.stop();
|
|
3905
3614
|
}
|
|
3906
|
-
},
|
|
3615
|
+
}, _callee38, this, [[0, 9]]);
|
|
3907
3616
|
}));
|
|
3908
|
-
function addProductToOrder(
|
|
3617
|
+
function addProductToOrder(_x30, _x31) {
|
|
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 _callee39(params) {
|
|
3917
3626
|
var products;
|
|
3918
|
-
return _regeneratorRuntime().wrap(function
|
|
3919
|
-
while (1) switch (
|
|
3627
|
+
return _regeneratorRuntime().wrap(function _callee39$(_context39) {
|
|
3628
|
+
while (1) switch (_context39.prev = _context39.next) {
|
|
3920
3629
|
case 0:
|
|
3921
|
-
|
|
3630
|
+
_context39.prev = 0;
|
|
3922
3631
|
if (this.store.order) {
|
|
3923
|
-
|
|
3632
|
+
_context39.next = 3;
|
|
3924
3633
|
break;
|
|
3925
3634
|
}
|
|
3926
3635
|
throw new Error('order 模块未初始化');
|
|
3927
3636
|
case 3:
|
|
3928
|
-
|
|
3637
|
+
_context39.next = 5;
|
|
3929
3638
|
return this.store.order.updateOrderProduct(params);
|
|
3930
3639
|
case 5:
|
|
3931
|
-
products =
|
|
3932
|
-
return
|
|
3640
|
+
products = _context39.sent;
|
|
3641
|
+
return _context39.abrupt("return", products);
|
|
3933
3642
|
case 9:
|
|
3934
|
-
|
|
3935
|
-
|
|
3936
|
-
throw
|
|
3643
|
+
_context39.prev = 9;
|
|
3644
|
+
_context39.t0 = _context39["catch"](0);
|
|
3645
|
+
throw _context39.t0;
|
|
3937
3646
|
case 12:
|
|
3938
3647
|
case "end":
|
|
3939
|
-
return
|
|
3648
|
+
return _context39.stop();
|
|
3940
3649
|
}
|
|
3941
|
-
},
|
|
3650
|
+
}, _callee39, this, [[0, 9]]);
|
|
3942
3651
|
}));
|
|
3943
|
-
function updateOrderProduct(
|
|
3652
|
+
function updateOrderProduct(_x32) {
|
|
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 _callee40(paramsList) {
|
|
3952
3661
|
var products;
|
|
3953
|
-
return _regeneratorRuntime().wrap(function
|
|
3954
|
-
while (1) switch (
|
|
3662
|
+
return _regeneratorRuntime().wrap(function _callee40$(_context40) {
|
|
3663
|
+
while (1) switch (_context40.prev = _context40.next) {
|
|
3955
3664
|
case 0:
|
|
3956
|
-
|
|
3665
|
+
_context40.prev = 0;
|
|
3957
3666
|
if (this.store.order) {
|
|
3958
|
-
|
|
3667
|
+
_context40.next = 3;
|
|
3959
3668
|
break;
|
|
3960
3669
|
}
|
|
3961
3670
|
throw new Error('order 模块未初始化');
|
|
3962
3671
|
case 3:
|
|
3963
|
-
|
|
3672
|
+
_context40.next = 5;
|
|
3964
3673
|
return this.store.order.updateOrderProducts(paramsList);
|
|
3965
3674
|
case 5:
|
|
3966
|
-
products =
|
|
3967
|
-
return
|
|
3675
|
+
products = _context40.sent;
|
|
3676
|
+
return _context40.abrupt("return", products);
|
|
3968
3677
|
case 9:
|
|
3969
|
-
|
|
3970
|
-
|
|
3971
|
-
throw
|
|
3678
|
+
_context40.prev = 9;
|
|
3679
|
+
_context40.t0 = _context40["catch"](0);
|
|
3680
|
+
throw _context40.t0;
|
|
3972
3681
|
case 12:
|
|
3973
3682
|
case "end":
|
|
3974
|
-
return
|
|
3683
|
+
return _context40.stop();
|
|
3975
3684
|
}
|
|
3976
|
-
},
|
|
3685
|
+
}, _callee40, this, [[0, 9]]);
|
|
3977
3686
|
}));
|
|
3978
|
-
function updateOrderProducts(
|
|
3687
|
+
function updateOrderProducts(_x33) {
|
|
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 _callee41(params) {
|
|
3987
3696
|
var products;
|
|
3988
|
-
return _regeneratorRuntime().wrap(function
|
|
3989
|
-
while (1) switch (
|
|
3697
|
+
return _regeneratorRuntime().wrap(function _callee41$(_context41) {
|
|
3698
|
+
while (1) switch (_context41.prev = _context41.next) {
|
|
3990
3699
|
case 0:
|
|
3991
|
-
|
|
3700
|
+
_context41.prev = 0;
|
|
3992
3701
|
if (this.store.order) {
|
|
3993
|
-
|
|
3702
|
+
_context41.next = 3;
|
|
3994
3703
|
break;
|
|
3995
3704
|
}
|
|
3996
3705
|
throw new Error('order 模块未初始化');
|
|
3997
3706
|
case 3:
|
|
3998
|
-
|
|
3707
|
+
_context41.next = 5;
|
|
3999
3708
|
return this.store.order.updateOrderProductQuantity(params);
|
|
4000
3709
|
case 5:
|
|
4001
|
-
products =
|
|
4002
|
-
return
|
|
3710
|
+
products = _context41.sent;
|
|
3711
|
+
return _context41.abrupt("return", products);
|
|
4003
3712
|
case 9:
|
|
4004
|
-
|
|
4005
|
-
|
|
4006
|
-
throw
|
|
3713
|
+
_context41.prev = 9;
|
|
3714
|
+
_context41.t0 = _context41["catch"](0);
|
|
3715
|
+
throw _context41.t0;
|
|
4007
3716
|
case 12:
|
|
4008
3717
|
case "end":
|
|
4009
|
-
return
|
|
3718
|
+
return _context41.stop();
|
|
4010
3719
|
}
|
|
4011
|
-
},
|
|
3720
|
+
}, _callee41, this, [[0, 9]]);
|
|
4012
3721
|
}));
|
|
4013
|
-
function updateOrderProductQuantity(
|
|
3722
|
+
function updateOrderProductQuantity(_x34) {
|
|
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 _callee42(identity, note) {
|
|
4037
3746
|
var params, products;
|
|
4038
|
-
return _regeneratorRuntime().wrap(function
|
|
4039
|
-
while (1) switch (
|
|
3747
|
+
return _regeneratorRuntime().wrap(function _callee42$(_context42) {
|
|
3748
|
+
while (1) switch (_context42.prev = _context42.next) {
|
|
4040
3749
|
case 0:
|
|
4041
|
-
|
|
3750
|
+
_context42.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
|
+
_context42.next = 7;
|
|
4057
3766
|
return this.updateOrderProduct(params);
|
|
4058
3767
|
case 7:
|
|
4059
|
-
products =
|
|
4060
|
-
return
|
|
3768
|
+
products = _context42.sent;
|
|
3769
|
+
return _context42.abrupt("return", products);
|
|
4061
3770
|
case 11:
|
|
4062
|
-
|
|
4063
|
-
|
|
4064
|
-
throw
|
|
3771
|
+
_context42.prev = 11;
|
|
3772
|
+
_context42.t0 = _context42["catch"](0);
|
|
3773
|
+
throw _context42.t0;
|
|
4065
3774
|
case 14:
|
|
4066
3775
|
case "end":
|
|
4067
|
-
return
|
|
3776
|
+
return _context42.stop();
|
|
4068
3777
|
}
|
|
4069
|
-
},
|
|
3778
|
+
}, _callee42, this, [[0, 11]]);
|
|
4070
3779
|
}));
|
|
4071
|
-
function setOrderProductLineNote(
|
|
3780
|
+
function setOrderProductLineNote(_x35, _x36) {
|
|
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 _callee43(identities) {
|
|
3796
|
+
return _regeneratorRuntime().wrap(function _callee43$(_context43) {
|
|
3797
|
+
while (1) switch (_context43.prev = _context43.next) {
|
|
4089
3798
|
case 0:
|
|
4090
|
-
|
|
3799
|
+
_context43.prev = 0;
|
|
4091
3800
|
if (this.store.order) {
|
|
4092
|
-
|
|
3801
|
+
_context43.next = 3;
|
|
4093
3802
|
break;
|
|
4094
3803
|
}
|
|
4095
3804
|
throw new Error('order 模块未初始化');
|
|
4096
3805
|
case 3:
|
|
4097
|
-
|
|
3806
|
+
_context43.next = 5;
|
|
4098
3807
|
return this.store.order.removeProductsFromOrder(identities);
|
|
4099
3808
|
case 5:
|
|
4100
|
-
return
|
|
3809
|
+
return _context43.abrupt("return", _context43.sent);
|
|
4101
3810
|
case 8:
|
|
4102
|
-
|
|
4103
|
-
|
|
4104
|
-
throw
|
|
3811
|
+
_context43.prev = 8;
|
|
3812
|
+
_context43.t0 = _context43["catch"](0);
|
|
3813
|
+
throw _context43.t0;
|
|
4105
3814
|
case 11:
|
|
4106
3815
|
case "end":
|
|
4107
|
-
return
|
|
3816
|
+
return _context43.stop();
|
|
4108
3817
|
}
|
|
4109
|
-
},
|
|
3818
|
+
}, _callee43, this, [[0, 8]]);
|
|
4110
3819
|
}));
|
|
4111
|
-
function removeProductsFromOrder(
|
|
3820
|
+
function removeProductsFromOrder(_x37) {
|
|
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 _callee44(identity) {
|
|
3829
|
+
return _regeneratorRuntime().wrap(function _callee44$(_context44) {
|
|
3830
|
+
while (1) switch (_context44.prev = _context44.next) {
|
|
4122
3831
|
case 0:
|
|
4123
|
-
return
|
|
3832
|
+
return _context44.abrupt("return", this.removeProductsFromOrder([identity]));
|
|
4124
3833
|
case 1:
|
|
4125
3834
|
case "end":
|
|
4126
|
-
return
|
|
3835
|
+
return _context44.stop();
|
|
4127
3836
|
}
|
|
4128
|
-
},
|
|
3837
|
+
}, _callee44, this);
|
|
4129
3838
|
}));
|
|
4130
|
-
function removeProductFromOrder(
|
|
3839
|
+
function removeProductFromOrder(_x38) {
|
|
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 _callee45() {
|
|
3890
|
+
return _regeneratorRuntime().wrap(function _callee45$(_context45) {
|
|
3891
|
+
while (1) switch (_context45.prev = _context45.next) {
|
|
4183
3892
|
case 0:
|
|
4184
3893
|
if (this.store.order) {
|
|
4185
|
-
|
|
3894
|
+
_context45.next = 2;
|
|
4186
3895
|
break;
|
|
4187
3896
|
}
|
|
4188
3897
|
throw new Error('order 模块未初始化');
|
|
4189
3898
|
case 2:
|
|
4190
|
-
|
|
3899
|
+
_context45.next = 4;
|
|
4191
3900
|
return this.store.order.applyPromotion();
|
|
4192
3901
|
case 4:
|
|
4193
3902
|
case "end":
|
|
4194
|
-
return
|
|
3903
|
+
return _context45.stop();
|
|
4195
3904
|
}
|
|
4196
|
-
},
|
|
3905
|
+
}, _callee45, 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 _callee46() {
|
|
3933
|
+
var _this$otherParams22;
|
|
4225
3934
|
var menu_list_ids, _this$store$products, res;
|
|
4226
|
-
return _regeneratorRuntime().wrap(function
|
|
4227
|
-
while (1) switch (
|
|
3935
|
+
return _regeneratorRuntime().wrap(function _callee46$(_context46) {
|
|
3936
|
+
while (1) switch (_context46.prev = _context46.next) {
|
|
4228
3937
|
case 0:
|
|
4229
3938
|
// 可以直接通过配置里的 menu 读取
|
|
4230
|
-
menu_list_ids = ((_this$
|
|
3939
|
+
menu_list_ids = ((_this$otherParams22 = this.otherParams) === null || _this$otherParams22 === void 0 || (_this$otherParams22 = _this$otherParams22.dineInConfig) === null || _this$otherParams22 === void 0 ? void 0 : _this$otherParams22['menu.associated_menus'].map(function (n) {
|
|
4231
3940
|
return Number(n.value);
|
|
4232
3941
|
})) || [];
|
|
4233
|
-
|
|
4234
|
-
|
|
3942
|
+
_context46.prev = 1;
|
|
3943
|
+
_context46.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 = _context46.sent;
|
|
3952
|
+
return _context46.abrupt("return", res);
|
|
4244
3953
|
case 8:
|
|
4245
|
-
|
|
4246
|
-
|
|
4247
|
-
throw
|
|
3954
|
+
_context46.prev = 8;
|
|
3955
|
+
_context46.t0 = _context46["catch"](1);
|
|
3956
|
+
throw _context46.t0;
|
|
4248
3957
|
case 11:
|
|
4249
3958
|
case "end":
|
|
4250
|
-
return
|
|
3959
|
+
return _context46.stop();
|
|
4251
3960
|
}
|
|
4252
|
-
},
|
|
3961
|
+
}, _callee46, 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 _callee47(params) {
|
|
3977
|
+
var _this$otherParams23;
|
|
3978
|
+
var _ref30,
|
|
3979
|
+
_ref30$cover,
|
|
4271
3980
|
cover,
|
|
4272
|
-
|
|
4273
|
-
return _regeneratorRuntime().wrap(function
|
|
4274
|
-
while (1) switch (
|
|
3981
|
+
_args47 = arguments;
|
|
3982
|
+
return _regeneratorRuntime().wrap(function _callee47$(_context47) {
|
|
3983
|
+
while (1) switch (_context47.prev = _context47.next) {
|
|
4275
3984
|
case 0:
|
|
4276
|
-
|
|
3985
|
+
_ref30 = _args47.length > 1 && _args47[1] !== undefined ? _args47[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$otherParams23 = this.otherParams) === null || _this$otherParams23 === void 0 ? void 0 : _this$otherParams23.cacheId;
|
|
3992
|
+
_context47.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 _context47.stop();
|
|
4290
3999
|
}
|
|
4291
|
-
},
|
|
4000
|
+
}, _callee47, this);
|
|
4292
4001
|
}));
|
|
4293
|
-
function setOtherParams(
|
|
4002
|
+
function setOtherParams(_x39) {
|
|
4294
4003
|
return _setOtherParams.apply(this, arguments);
|
|
4295
4004
|
}
|
|
4296
4005
|
return setOtherParams;
|