@pisell/pisellos 2.3.68 → 2.3.69
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/index.d.ts +7 -0
- package/dist/core/index.js +109 -65
- package/dist/modules/Quotation/index.d.ts +6 -0
- package/dist/modules/Quotation/index.js +75 -19
- package/dist/plugins/request.d.ts +1 -0
- package/dist/server/index.d.ts +8 -2
- package/dist/server/index.js +206 -140
- package/dist/server/modules/floor-plan/index.d.ts +4 -0
- package/dist/server/modules/floor-plan/index.js +240 -98
- package/dist/server/modules/menu/index.js +48 -23
- package/dist/server/modules/order/index.d.ts +17 -7
- package/dist/server/modules/order/index.js +419 -207
- package/dist/server/modules/products/index.d.ts +8 -2
- package/dist/server/modules/products/index.js +167 -75
- package/dist/server/modules/resource/index.js +21 -13
- package/dist/solution/BaseSales/index.d.ts +10 -0
- package/dist/solution/BaseSales/index.js +861 -806
- package/dist/solution/BookingTicket/index.d.ts +3 -1
- package/dist/solution/BookingTicket/index.js +187 -149
- package/lib/core/index.d.ts +7 -0
- package/lib/core/index.js +20 -2
- package/lib/modules/Quotation/index.d.ts +6 -0
- package/lib/modules/Quotation/index.js +49 -5
- package/lib/plugins/request.d.ts +1 -0
- package/lib/server/index.d.ts +8 -2
- package/lib/server/index.js +52 -17
- package/lib/server/modules/floor-plan/index.d.ts +4 -0
- package/lib/server/modules/floor-plan/index.js +54 -6
- package/lib/server/modules/menu/index.js +31 -5
- package/lib/server/modules/order/index.d.ts +17 -7
- package/lib/server/modules/order/index.js +197 -40
- package/lib/server/modules/products/index.d.ts +8 -2
- package/lib/server/modules/products/index.js +97 -24
- package/lib/server/modules/resource/index.js +7 -2
- package/lib/solution/BaseSales/index.d.ts +10 -0
- package/lib/solution/BaseSales/index.js +32 -2
- package/lib/solution/BookingTicket/index.d.ts +3 -1
- package/lib/solution/BookingTicket/index.js +12 -0
- package/package.json +1 -1
|
@@ -899,8 +899,43 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
899
899
|
if (businessCode !== undefined && businessCode !== null && String(businessCode).trim() !== '') {
|
|
900
900
|
strategyContext.business_code = String(businessCode).trim();
|
|
901
901
|
}
|
|
902
|
+
var availableWalletIds = this.getAvailableWalletIds();
|
|
903
|
+
if (availableWalletIds.length > 0 && !Array.isArray(strategyContext.available_wallet_ids)) {
|
|
904
|
+
strategyContext.available_wallet_ids = availableWalletIds;
|
|
905
|
+
}
|
|
902
906
|
return strategyContext;
|
|
903
907
|
}
|
|
908
|
+
|
|
909
|
+
/**
|
|
910
|
+
* 子类可在商品重报价前准备客户维度的策略上下文,例如等待 Wallet/优惠资产加载。
|
|
911
|
+
*/
|
|
912
|
+
}, {
|
|
913
|
+
key: "prepareProductPriceQueryContext",
|
|
914
|
+
value: (function () {
|
|
915
|
+
var _prepareProductPriceQueryContext = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(_customerId) {
|
|
916
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
917
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
918
|
+
case 0:
|
|
919
|
+
case "end":
|
|
920
|
+
return _context7.stop();
|
|
921
|
+
}
|
|
922
|
+
}, _callee7);
|
|
923
|
+
}));
|
|
924
|
+
function prepareProductPriceQueryContext(_x6) {
|
|
925
|
+
return _prepareProductPriceQueryContext.apply(this, arguments);
|
|
926
|
+
}
|
|
927
|
+
return prepareProductPriceQueryContext;
|
|
928
|
+
}()
|
|
929
|
+
/**
|
|
930
|
+
* 默认保留 BaseSales 的 legacy quotation 行为;已由 /product/query 统一完成
|
|
931
|
+
* 智能定价与报价合并的业务可在子类中覆盖,避免二次覆盖权威价格。
|
|
932
|
+
*/
|
|
933
|
+
)
|
|
934
|
+
}, {
|
|
935
|
+
key: "preferAuthoritativeProductQueryPrice",
|
|
936
|
+
value: function preferAuthoritativeProductQueryPrice() {
|
|
937
|
+
return false;
|
|
938
|
+
}
|
|
904
939
|
}, {
|
|
905
940
|
key: "getPriceQuerySchedule",
|
|
906
941
|
value: function getPriceQuerySchedule(params) {
|
|
@@ -932,25 +967,25 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
932
967
|
}, {
|
|
933
968
|
key: "loadProductsForPriceQuery",
|
|
934
969
|
value: function () {
|
|
935
|
-
var _loadProductsForPriceQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
970
|
+
var _loadProductsForPriceQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(params) {
|
|
936
971
|
var ids, productsById, channel, strategyContext, _response$data, response, list;
|
|
937
|
-
return _regeneratorRuntime().wrap(function
|
|
938
|
-
while (1) switch (
|
|
972
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
973
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
939
974
|
case 0:
|
|
940
975
|
ids = Array.from(new Set(params.ids.filter(function (id) {
|
|
941
976
|
return Number.isFinite(id);
|
|
942
977
|
})));
|
|
943
978
|
productsById = new Map();
|
|
944
979
|
if (!(!ids.length || !this.request)) {
|
|
945
|
-
|
|
980
|
+
_context8.next = 4;
|
|
946
981
|
break;
|
|
947
982
|
}
|
|
948
|
-
return
|
|
983
|
+
return _context8.abrupt("return", productsById);
|
|
949
984
|
case 4:
|
|
950
985
|
channel = this.getPriceQueryChannel(params.channel);
|
|
951
986
|
strategyContext = this.getPriceQueryStrategyContext(channel);
|
|
952
|
-
|
|
953
|
-
|
|
987
|
+
_context8.prev = 6;
|
|
988
|
+
_context8.next = 9;
|
|
954
989
|
return this.request.post('/product/query', _objectSpread({
|
|
955
990
|
ids: ids,
|
|
956
991
|
open_quotation: 1,
|
|
@@ -969,35 +1004,35 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
969
1004
|
customToast: function customToast() {}
|
|
970
1005
|
});
|
|
971
1006
|
case 9:
|
|
972
|
-
response =
|
|
1007
|
+
response = _context8.sent;
|
|
973
1008
|
list = (response === null || response === void 0 || (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.list) || (response === null || response === void 0 ? void 0 : response.list) || [];
|
|
974
1009
|
if (Array.isArray(list)) {
|
|
975
|
-
|
|
1010
|
+
_context8.next = 13;
|
|
976
1011
|
break;
|
|
977
1012
|
}
|
|
978
|
-
return
|
|
1013
|
+
return _context8.abrupt("return", productsById);
|
|
979
1014
|
case 13:
|
|
980
1015
|
list.forEach(function (item) {
|
|
981
1016
|
var _item$id;
|
|
982
1017
|
var productId = Number((_item$id = item === null || item === void 0 ? void 0 : item.id) !== null && _item$id !== void 0 ? _item$id : item === null || item === void 0 ? void 0 : item.product_id);
|
|
983
1018
|
if (Number.isFinite(productId)) productsById.set(productId, item);
|
|
984
1019
|
});
|
|
985
|
-
return
|
|
1020
|
+
return _context8.abrupt("return", productsById);
|
|
986
1021
|
case 17:
|
|
987
|
-
|
|
988
|
-
|
|
1022
|
+
_context8.prev = 17;
|
|
1023
|
+
_context8.t0 = _context8["catch"](6);
|
|
989
1024
|
this.logWarning('loadProductsForPriceQuery: 商品批量重查失败,使用入参 fallback', {
|
|
990
1025
|
ids: ids,
|
|
991
|
-
error:
|
|
1026
|
+
error: _context8.t0 instanceof Error ? _context8.t0.message : String(_context8.t0)
|
|
992
1027
|
});
|
|
993
|
-
return
|
|
1028
|
+
return _context8.abrupt("return", productsById);
|
|
994
1029
|
case 21:
|
|
995
1030
|
case "end":
|
|
996
|
-
return
|
|
1031
|
+
return _context8.stop();
|
|
997
1032
|
}
|
|
998
|
-
},
|
|
1033
|
+
}, _callee8, this, [[6, 17]]);
|
|
999
1034
|
}));
|
|
1000
|
-
function loadProductsForPriceQuery(
|
|
1035
|
+
function loadProductsForPriceQuery(_x7) {
|
|
1001
1036
|
return _loadProductsForPriceQuery.apply(this, arguments);
|
|
1002
1037
|
}
|
|
1003
1038
|
return loadProductsForPriceQuery;
|
|
@@ -1005,21 +1040,21 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1005
1040
|
}, {
|
|
1006
1041
|
key: "loadProductForPriceQuery",
|
|
1007
1042
|
value: function () {
|
|
1008
|
-
var _loadProductForPriceQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1043
|
+
var _loadProductForPriceQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(params, customerId) {
|
|
1009
1044
|
var product, productId, schedule, productsById;
|
|
1010
|
-
return _regeneratorRuntime().wrap(function
|
|
1011
|
-
while (1) switch (
|
|
1045
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
1046
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
1012
1047
|
case 0:
|
|
1013
1048
|
product = params.product || {};
|
|
1014
1049
|
productId = this.getPriceQueryProductId(product);
|
|
1015
1050
|
if (!(productId === null || !this.request)) {
|
|
1016
|
-
|
|
1051
|
+
_context9.next = 4;
|
|
1017
1052
|
break;
|
|
1018
1053
|
}
|
|
1019
|
-
return
|
|
1054
|
+
return _context9.abrupt("return", null);
|
|
1020
1055
|
case 4:
|
|
1021
1056
|
schedule = this.getPriceQuerySchedule(params);
|
|
1022
|
-
|
|
1057
|
+
_context9.next = 7;
|
|
1023
1058
|
return this.loadProductsForPriceQuery({
|
|
1024
1059
|
ids: [productId],
|
|
1025
1060
|
schedule: schedule,
|
|
@@ -1027,15 +1062,15 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1027
1062
|
channel: params.channel
|
|
1028
1063
|
});
|
|
1029
1064
|
case 7:
|
|
1030
|
-
productsById =
|
|
1031
|
-
return
|
|
1065
|
+
productsById = _context9.sent;
|
|
1066
|
+
return _context9.abrupt("return", productsById.get(productId) || null);
|
|
1032
1067
|
case 9:
|
|
1033
1068
|
case "end":
|
|
1034
|
-
return
|
|
1069
|
+
return _context9.stop();
|
|
1035
1070
|
}
|
|
1036
|
-
},
|
|
1071
|
+
}, _callee9, this);
|
|
1037
1072
|
}));
|
|
1038
|
-
function loadProductForPriceQuery(
|
|
1073
|
+
function loadProductForPriceQuery(_x8, _x9) {
|
|
1039
1074
|
return _loadProductForPriceQuery.apply(this, arguments);
|
|
1040
1075
|
}
|
|
1041
1076
|
return loadProductForPriceQuery;
|
|
@@ -1203,60 +1238,60 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1203
1238
|
}, {
|
|
1204
1239
|
key: "syncOtherParamsToSubModules",
|
|
1205
1240
|
value: (function () {
|
|
1206
|
-
var _syncOtherParamsToSubModules = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1241
|
+
var _syncOtherParamsToSubModules = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(changedParams) {
|
|
1207
1242
|
var _this6 = this;
|
|
1208
1243
|
var _ref23,
|
|
1209
1244
|
_ref23$cover,
|
|
1210
1245
|
cover,
|
|
1211
|
-
|
|
1212
|
-
return _regeneratorRuntime().wrap(function
|
|
1213
|
-
while (1) switch (
|
|
1246
|
+
_args11 = arguments;
|
|
1247
|
+
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
1248
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
1214
1249
|
case 0:
|
|
1215
|
-
_ref23 =
|
|
1216
|
-
|
|
1250
|
+
_ref23 = _args11.length > 1 && _args11[1] !== undefined ? _args11[1] : {}, _ref23$cover = _ref23.cover, cover = _ref23$cover === void 0 ? false : _ref23$cover;
|
|
1251
|
+
_context11.next = 3;
|
|
1217
1252
|
return Promise.all(Object.entries(this.store).map( /*#__PURE__*/function () {
|
|
1218
|
-
var _ref25 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1253
|
+
var _ref25 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(_ref24) {
|
|
1219
1254
|
var _ref26, moduleName, subModule, targetModule, nextSubModuleOtherParams;
|
|
1220
|
-
return _regeneratorRuntime().wrap(function
|
|
1221
|
-
while (1) switch (
|
|
1255
|
+
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
1256
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
1222
1257
|
case 0:
|
|
1223
1258
|
_ref26 = _slicedToArray(_ref24, 2), moduleName = _ref26[0], subModule = _ref26[1];
|
|
1224
1259
|
if (!_this6.reusedSharedSubModuleNames.has(moduleName)) {
|
|
1225
|
-
|
|
1260
|
+
_context10.next = 3;
|
|
1226
1261
|
break;
|
|
1227
1262
|
}
|
|
1228
|
-
return
|
|
1263
|
+
return _context10.abrupt("return");
|
|
1229
1264
|
case 3:
|
|
1230
1265
|
targetModule = subModule;
|
|
1231
1266
|
if (!(!targetModule || typeof targetModule.updateOtherParams !== 'function')) {
|
|
1232
|
-
|
|
1267
|
+
_context10.next = 6;
|
|
1233
1268
|
break;
|
|
1234
1269
|
}
|
|
1235
|
-
return
|
|
1270
|
+
return _context10.abrupt("return");
|
|
1236
1271
|
case 6:
|
|
1237
1272
|
nextSubModuleOtherParams = _this6.buildSubModuleOtherParams(moduleName);
|
|
1238
|
-
|
|
1273
|
+
_context10.next = 9;
|
|
1239
1274
|
return targetModule.updateOtherParams(nextSubModuleOtherParams, {
|
|
1240
1275
|
changedParams: changedParams,
|
|
1241
1276
|
cover: cover
|
|
1242
1277
|
});
|
|
1243
1278
|
case 9:
|
|
1244
1279
|
case "end":
|
|
1245
|
-
return
|
|
1280
|
+
return _context10.stop();
|
|
1246
1281
|
}
|
|
1247
|
-
},
|
|
1282
|
+
}, _callee10);
|
|
1248
1283
|
}));
|
|
1249
|
-
return function (
|
|
1284
|
+
return function (_x11) {
|
|
1250
1285
|
return _ref25.apply(this, arguments);
|
|
1251
1286
|
};
|
|
1252
1287
|
}()));
|
|
1253
1288
|
case 3:
|
|
1254
1289
|
case "end":
|
|
1255
|
-
return
|
|
1290
|
+
return _context11.stop();
|
|
1256
1291
|
}
|
|
1257
|
-
},
|
|
1292
|
+
}, _callee11, this);
|
|
1258
1293
|
}));
|
|
1259
|
-
function syncOtherParamsToSubModules(
|
|
1294
|
+
function syncOtherParamsToSubModules(_x10) {
|
|
1260
1295
|
return _syncOtherParamsToSubModules.apply(this, arguments);
|
|
1261
1296
|
}
|
|
1262
1297
|
return syncOtherParamsToSubModules;
|
|
@@ -1365,7 +1400,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1365
1400
|
}, {
|
|
1366
1401
|
key: "initialize",
|
|
1367
1402
|
value: function () {
|
|
1368
|
-
var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1403
|
+
var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(core) {
|
|
1369
1404
|
var _this$otherParams9,
|
|
1370
1405
|
_this$appPlugin2,
|
|
1371
1406
|
_this$appPlugin2$getA,
|
|
@@ -1375,11 +1410,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1375
1410
|
app,
|
|
1376
1411
|
targetCacheData,
|
|
1377
1412
|
moduleNames,
|
|
1378
|
-
|
|
1379
|
-
return _regeneratorRuntime().wrap(function
|
|
1380
|
-
while (1) switch (
|
|
1413
|
+
_args12 = arguments;
|
|
1414
|
+
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
1415
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
1381
1416
|
case 0:
|
|
1382
|
-
options =
|
|
1417
|
+
options = _args12.length > 1 && _args12[1] !== undefined ? _args12[1] : {};
|
|
1383
1418
|
this.core = core;
|
|
1384
1419
|
this.initializeOptions = options || {};
|
|
1385
1420
|
this.paymentNumberDevicePrefix = null;
|
|
@@ -1421,27 +1456,27 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1421
1456
|
}));
|
|
1422
1457
|
});
|
|
1423
1458
|
if (!(this.store.schedule && !this.isScheduleListLoaded(this.store.schedule))) {
|
|
1424
|
-
|
|
1459
|
+
_context12.next = 19;
|
|
1425
1460
|
break;
|
|
1426
1461
|
}
|
|
1427
|
-
|
|
1462
|
+
_context12.next = 19;
|
|
1428
1463
|
return this.store.schedule.loadAllSchedule();
|
|
1429
1464
|
case 19:
|
|
1430
1465
|
if (this.store.order && typeof ((_this$otherParams10 = this.otherParams) === null || _this$otherParams10 === void 0 ? void 0 : _this$otherParams10.enableTempOrderPersist) === 'boolean') {
|
|
1431
1466
|
this.store.order.setEnableTempOrderPersist(this.otherParams.enableTempOrderPersist);
|
|
1432
1467
|
}
|
|
1433
|
-
|
|
1468
|
+
_context12.next = 22;
|
|
1434
1469
|
return this.getPaymentMethodsAsync();
|
|
1435
1470
|
case 22:
|
|
1436
1471
|
this.registerServerOrderChangeSync();
|
|
1437
1472
|
this.core.effects.emit("".concat(this.name, ":onInited"), {});
|
|
1438
1473
|
case 24:
|
|
1439
1474
|
case "end":
|
|
1440
|
-
return
|
|
1475
|
+
return _context12.stop();
|
|
1441
1476
|
}
|
|
1442
|
-
},
|
|
1477
|
+
}, _callee12, this);
|
|
1443
1478
|
}));
|
|
1444
|
-
function initialize(
|
|
1479
|
+
function initialize(_x12) {
|
|
1445
1480
|
return _initialize.apply(this, arguments);
|
|
1446
1481
|
}
|
|
1447
1482
|
return initialize;
|
|
@@ -1449,11 +1484,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1449
1484
|
}, {
|
|
1450
1485
|
key: "destroy",
|
|
1451
1486
|
value: function () {
|
|
1452
|
-
var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1487
|
+
var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
|
|
1453
1488
|
var _this$serverOrderChan2,
|
|
1454
1489
|
_this10 = this;
|
|
1455
|
-
return _regeneratorRuntime().wrap(function
|
|
1456
|
-
while (1) switch (
|
|
1490
|
+
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
1491
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
1457
1492
|
case 0:
|
|
1458
1493
|
(_this$serverOrderChan2 = this.serverOrderChangeUnsubscribe) === null || _this$serverOrderChan2 === void 0 || _this$serverOrderChan2.call(this);
|
|
1459
1494
|
this.serverOrderChangeUnsubscribe = null;
|
|
@@ -1473,15 +1508,15 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1473
1508
|
this.queuedServerOrderChanges = [];
|
|
1474
1509
|
this.salesDetailLoadSequence += 1;
|
|
1475
1510
|
this.walletAssetsRefreshSequence += 1;
|
|
1476
|
-
|
|
1511
|
+
_context13.next = 10;
|
|
1477
1512
|
return this.core.effects.emit("".concat(this.name, ":onDestroy"), {});
|
|
1478
1513
|
case 10:
|
|
1479
1514
|
_get(_getPrototypeOf(BaseSalesImpl.prototype), "destroy", this).call(this);
|
|
1480
1515
|
case 11:
|
|
1481
1516
|
case "end":
|
|
1482
|
-
return
|
|
1517
|
+
return _context13.stop();
|
|
1483
1518
|
}
|
|
1484
|
-
},
|
|
1519
|
+
}, _callee13, this);
|
|
1485
1520
|
}));
|
|
1486
1521
|
function destroy() {
|
|
1487
1522
|
return _destroy.apply(this, arguments);
|
|
@@ -1498,20 +1533,20 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1498
1533
|
}, {
|
|
1499
1534
|
key: "loadSalesDetail",
|
|
1500
1535
|
value: (function () {
|
|
1501
|
-
var _loadSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1536
|
+
var _loadSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(orderIdOrParams) {
|
|
1502
1537
|
var loadSequence, _ref27, _ref28, _ref29, _ref30, _params$orderId, params, externalSaleNumber, preloadedSalesDetail, lookup, loadedRecord, message, loadedSalesDetail, shouldFilterPendingPayments, remoteRecord, currentTempOrder, mergedRecord, record;
|
|
1503
|
-
return _regeneratorRuntime().wrap(function
|
|
1504
|
-
while (1) switch (
|
|
1538
|
+
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
1539
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
1505
1540
|
case 0:
|
|
1506
1541
|
if (this.store.order) {
|
|
1507
|
-
|
|
1542
|
+
_context14.next = 2;
|
|
1508
1543
|
break;
|
|
1509
1544
|
}
|
|
1510
1545
|
throw new Error('order 模块未初始化');
|
|
1511
1546
|
case 2:
|
|
1512
1547
|
loadSequence = ++this.salesDetailLoadSequence;
|
|
1513
1548
|
this.salesDetailLoadInFlightCount += 1;
|
|
1514
|
-
|
|
1549
|
+
_context14.prev = 4;
|
|
1515
1550
|
params = _typeof(orderIdOrParams) === 'object' ? orderIdOrParams : {
|
|
1516
1551
|
orderId: orderIdOrParams
|
|
1517
1552
|
};
|
|
@@ -1519,30 +1554,30 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1519
1554
|
preloadedSalesDetail = params.preloadedSalesDetail;
|
|
1520
1555
|
lookup = (_ref27 = (_ref28 = (_ref29 = (_ref30 = (_params$orderId = params.orderId) !== null && _params$orderId !== void 0 ? _params$orderId : externalSaleNumber) !== null && _ref30 !== void 0 ? _ref30 : params.orderNumber) !== null && _ref29 !== void 0 ? _ref29 : preloadedSalesDetail === null || preloadedSalesDetail === void 0 ? void 0 : preloadedSalesDetail.order_id) !== null && _ref28 !== void 0 ? _ref28 : preloadedSalesDetail === null || preloadedSalesDetail === void 0 ? void 0 : preloadedSalesDetail.external_sale_number) !== null && _ref27 !== void 0 ? _ref27 : preloadedSalesDetail === null || preloadedSalesDetail === void 0 ? void 0 : preloadedSalesDetail.order_number;
|
|
1521
1556
|
if (!(!preloadedSalesDetail && (lookup === undefined || lookup === null || lookup === ''))) {
|
|
1522
|
-
|
|
1557
|
+
_context14.next = 11;
|
|
1523
1558
|
break;
|
|
1524
1559
|
}
|
|
1525
1560
|
throw new Error('加载销售详情需要 orderId、externalSaleNumber 或 orderNumber');
|
|
1526
1561
|
case 11:
|
|
1527
1562
|
if (!(preloadedSalesDetail !== null && preloadedSalesDetail !== void 0)) {
|
|
1528
|
-
|
|
1563
|
+
_context14.next = 15;
|
|
1529
1564
|
break;
|
|
1530
1565
|
}
|
|
1531
|
-
|
|
1532
|
-
|
|
1566
|
+
_context14.t0 = preloadedSalesDetail;
|
|
1567
|
+
_context14.next = 18;
|
|
1533
1568
|
break;
|
|
1534
1569
|
case 15:
|
|
1535
|
-
|
|
1570
|
+
_context14.next = 17;
|
|
1536
1571
|
return this.store.order.getSalesOrderByLookup({
|
|
1537
1572
|
lookup: lookup,
|
|
1538
1573
|
forceRemote: params.forceRemote
|
|
1539
1574
|
});
|
|
1540
1575
|
case 17:
|
|
1541
|
-
|
|
1576
|
+
_context14.t0 = _context14.sent;
|
|
1542
1577
|
case 18:
|
|
1543
|
-
loadedRecord =
|
|
1578
|
+
loadedRecord = _context14.t0;
|
|
1544
1579
|
if (!(!preloadedSalesDetail && (!loadedRecord || loadedRecord.code !== 200))) {
|
|
1545
|
-
|
|
1580
|
+
_context14.next = 22;
|
|
1546
1581
|
break;
|
|
1547
1582
|
}
|
|
1548
1583
|
message = loadedRecord && (loadedRecord.message || loadedRecord.msg) || "\u52A0\u8F7D\u9500\u552E\u8BE6\u60C5\u5931\u8D25: ".concat(lookup);
|
|
@@ -1554,38 +1589,38 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1554
1589
|
currentTempOrder = params.merge ? this.store.order.getTempOrder() : null;
|
|
1555
1590
|
mergedRecord = params.merge ? mergeSalesDetailRecordWithTempOrder(currentTempOrder, remoteRecord, 'preserve-local') : remoteRecord;
|
|
1556
1591
|
record = shouldFilterPendingPayments ? filterPendingPaymentsFromLoadedSalesDetail(mergedRecord) : mergedRecord;
|
|
1557
|
-
|
|
1592
|
+
_context14.next = 30;
|
|
1558
1593
|
return this.hydrateLatestLoadedSalesDetail(record, loadSequence, params.hydrateSource);
|
|
1559
1594
|
case 30:
|
|
1560
|
-
return
|
|
1595
|
+
return _context14.abrupt("return", _context14.sent);
|
|
1561
1596
|
case 31:
|
|
1562
|
-
|
|
1597
|
+
_context14.prev = 31;
|
|
1563
1598
|
this.salesDetailLoadInFlightCount = Math.max(0, this.salesDetailLoadInFlightCount - 1);
|
|
1564
1599
|
if (!(this.salesDetailLoadInFlightCount === 0)) {
|
|
1565
|
-
|
|
1600
|
+
_context14.next = 42;
|
|
1566
1601
|
break;
|
|
1567
1602
|
}
|
|
1568
|
-
|
|
1569
|
-
|
|
1603
|
+
_context14.prev = 34;
|
|
1604
|
+
_context14.next = 37;
|
|
1570
1605
|
return this.drainQueuedServerOrderChanges();
|
|
1571
1606
|
case 37:
|
|
1572
|
-
|
|
1607
|
+
_context14.next = 42;
|
|
1573
1608
|
break;
|
|
1574
1609
|
case 39:
|
|
1575
|
-
|
|
1576
|
-
|
|
1610
|
+
_context14.prev = 39;
|
|
1611
|
+
_context14.t1 = _context14["catch"](34);
|
|
1577
1612
|
this.logError('drain queued server order changes failed', {
|
|
1578
|
-
error:
|
|
1613
|
+
error: _context14.t1 instanceof Error ? _context14.t1.message : String(_context14.t1)
|
|
1579
1614
|
});
|
|
1580
1615
|
case 42:
|
|
1581
|
-
return
|
|
1616
|
+
return _context14.finish(31);
|
|
1582
1617
|
case 43:
|
|
1583
1618
|
case "end":
|
|
1584
|
-
return
|
|
1619
|
+
return _context14.stop();
|
|
1585
1620
|
}
|
|
1586
|
-
},
|
|
1621
|
+
}, _callee14, this, [[4,, 31, 43], [34, 39]]);
|
|
1587
1622
|
}));
|
|
1588
|
-
function loadSalesDetail(
|
|
1623
|
+
function loadSalesDetail(_x13) {
|
|
1589
1624
|
return _loadSalesDetail.apply(this, arguments);
|
|
1590
1625
|
}
|
|
1591
1626
|
return loadSalesDetail;
|
|
@@ -1665,34 +1700,34 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1665
1700
|
}, {
|
|
1666
1701
|
key: "replaceTempOrder",
|
|
1667
1702
|
value: function () {
|
|
1668
|
-
var _replaceTempOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1703
|
+
var _replaceTempOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(tempOrder, options) {
|
|
1669
1704
|
var nextTempOrder;
|
|
1670
|
-
return _regeneratorRuntime().wrap(function
|
|
1671
|
-
while (1) switch (
|
|
1705
|
+
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
|
1706
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
1672
1707
|
case 0:
|
|
1673
1708
|
if (this.store.order) {
|
|
1674
|
-
|
|
1709
|
+
_context15.next = 2;
|
|
1675
1710
|
break;
|
|
1676
1711
|
}
|
|
1677
1712
|
throw new Error('order 模块未初始化');
|
|
1678
1713
|
case 2:
|
|
1679
|
-
|
|
1714
|
+
_context15.next = 4;
|
|
1680
1715
|
return this.store.order.replaceTempOrder(tempOrder, options);
|
|
1681
1716
|
case 4:
|
|
1682
|
-
nextTempOrder =
|
|
1683
|
-
|
|
1717
|
+
nextTempOrder = _context15.sent;
|
|
1718
|
+
_context15.next = 7;
|
|
1684
1719
|
return this.effectsEmit('onTempOrderReplaced', {
|
|
1685
1720
|
tempOrder: nextTempOrder
|
|
1686
1721
|
});
|
|
1687
1722
|
case 7:
|
|
1688
|
-
return
|
|
1723
|
+
return _context15.abrupt("return", nextTempOrder);
|
|
1689
1724
|
case 8:
|
|
1690
1725
|
case "end":
|
|
1691
|
-
return
|
|
1726
|
+
return _context15.stop();
|
|
1692
1727
|
}
|
|
1693
|
-
},
|
|
1728
|
+
}, _callee15, this);
|
|
1694
1729
|
}));
|
|
1695
|
-
function replaceTempOrder(
|
|
1730
|
+
function replaceTempOrder(_x14, _x15) {
|
|
1696
1731
|
return _replaceTempOrder.apply(this, arguments);
|
|
1697
1732
|
}
|
|
1698
1733
|
return replaceTempOrder;
|
|
@@ -1790,40 +1825,40 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1790
1825
|
}, {
|
|
1791
1826
|
key: "addNewOrder",
|
|
1792
1827
|
value: function () {
|
|
1793
|
-
var _addNewOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1828
|
+
var _addNewOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16() {
|
|
1794
1829
|
var tempOrder;
|
|
1795
|
-
return _regeneratorRuntime().wrap(function
|
|
1796
|
-
while (1) switch (
|
|
1830
|
+
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
|
1831
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
1797
1832
|
case 0:
|
|
1798
|
-
|
|
1833
|
+
_context16.prev = 0;
|
|
1799
1834
|
if (this.store.order) {
|
|
1800
|
-
|
|
1835
|
+
_context16.next = 3;
|
|
1801
1836
|
break;
|
|
1802
1837
|
}
|
|
1803
1838
|
throw new Error('order 模块未初始化');
|
|
1804
1839
|
case 3:
|
|
1805
|
-
|
|
1840
|
+
_context16.next = 5;
|
|
1806
1841
|
return this.store.order.addNewOrder();
|
|
1807
1842
|
case 5:
|
|
1808
|
-
tempOrder =
|
|
1843
|
+
tempOrder = _context16.sent;
|
|
1809
1844
|
if (!(this.syncAppDataToTempOrder(tempOrder) && this.isTempOrderPersistEnabled())) {
|
|
1810
|
-
|
|
1845
|
+
_context16.next = 10;
|
|
1811
1846
|
break;
|
|
1812
1847
|
}
|
|
1813
1848
|
this.store.order.persistTempOrder();
|
|
1814
|
-
|
|
1849
|
+
_context16.next = 10;
|
|
1815
1850
|
return this.store.order.saveDraft();
|
|
1816
1851
|
case 10:
|
|
1817
|
-
return
|
|
1852
|
+
return _context16.abrupt("return", tempOrder);
|
|
1818
1853
|
case 13:
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
throw
|
|
1854
|
+
_context16.prev = 13;
|
|
1855
|
+
_context16.t0 = _context16["catch"](0);
|
|
1856
|
+
throw _context16.t0;
|
|
1822
1857
|
case 16:
|
|
1823
1858
|
case "end":
|
|
1824
|
-
return
|
|
1859
|
+
return _context16.stop();
|
|
1825
1860
|
}
|
|
1826
|
-
},
|
|
1861
|
+
}, _callee16, this, [[0, 13]]);
|
|
1827
1862
|
}));
|
|
1828
1863
|
function addNewOrder() {
|
|
1829
1864
|
return _addNewOrder.apply(this, arguments);
|
|
@@ -1833,22 +1868,22 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1833
1868
|
}, {
|
|
1834
1869
|
key: "saveDraft",
|
|
1835
1870
|
value: function () {
|
|
1836
|
-
var _saveDraft = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1837
|
-
return _regeneratorRuntime().wrap(function
|
|
1838
|
-
while (1) switch (
|
|
1871
|
+
var _saveDraft = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17() {
|
|
1872
|
+
return _regeneratorRuntime().wrap(function _callee17$(_context17) {
|
|
1873
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
1839
1874
|
case 0:
|
|
1840
1875
|
if (this.store.order) {
|
|
1841
|
-
|
|
1876
|
+
_context17.next = 2;
|
|
1842
1877
|
break;
|
|
1843
1878
|
}
|
|
1844
1879
|
throw new Error('order 模块未初始化');
|
|
1845
1880
|
case 2:
|
|
1846
|
-
return
|
|
1881
|
+
return _context17.abrupt("return", this.store.order.saveDraft());
|
|
1847
1882
|
case 3:
|
|
1848
1883
|
case "end":
|
|
1849
|
-
return
|
|
1884
|
+
return _context17.stop();
|
|
1850
1885
|
}
|
|
1851
|
-
},
|
|
1886
|
+
}, _callee17, this);
|
|
1852
1887
|
}));
|
|
1853
1888
|
function saveDraft() {
|
|
1854
1889
|
return _saveDraft.apply(this, arguments);
|
|
@@ -1859,14 +1894,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1859
1894
|
}, {
|
|
1860
1895
|
key: "restoreOrder",
|
|
1861
1896
|
value: function () {
|
|
1862
|
-
var _restoreOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1897
|
+
var _restoreOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18() {
|
|
1863
1898
|
var _this$store$payment, tempOrder, wallet;
|
|
1864
|
-
return _regeneratorRuntime().wrap(function
|
|
1865
|
-
while (1) switch (
|
|
1899
|
+
return _regeneratorRuntime().wrap(function _callee18$(_context18) {
|
|
1900
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
1866
1901
|
case 0:
|
|
1867
|
-
|
|
1902
|
+
_context18.prev = 0;
|
|
1868
1903
|
if (this.store.order) {
|
|
1869
|
-
|
|
1904
|
+
_context18.next = 3;
|
|
1870
1905
|
break;
|
|
1871
1906
|
}
|
|
1872
1907
|
throw new Error('scanOrder 解决方案需要 order 模块支持');
|
|
@@ -1878,37 +1913,37 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1878
1913
|
this.hasManualDiscountSelection = false;
|
|
1879
1914
|
wallet = (_this$store$payment = this.store.payment) === null || _this$store$payment === void 0 ? void 0 : _this$store$payment.wallet;
|
|
1880
1915
|
if (!wallet) {
|
|
1881
|
-
|
|
1916
|
+
_context18.next = 13;
|
|
1882
1917
|
break;
|
|
1883
1918
|
}
|
|
1884
1919
|
this.walletAssetsRefreshSequence += 1;
|
|
1885
1920
|
wallet.clearAllCache();
|
|
1886
|
-
|
|
1921
|
+
_context18.next = 13;
|
|
1887
1922
|
return this.publishWalletAssetsState(wallet.getWalletAssetsState());
|
|
1888
1923
|
case 13:
|
|
1889
|
-
|
|
1924
|
+
_context18.next = 15;
|
|
1890
1925
|
return this.effectsEmit('onTempOrderReplaced', {
|
|
1891
1926
|
tempOrder: tempOrder
|
|
1892
1927
|
});
|
|
1893
1928
|
case 15:
|
|
1894
1929
|
if (!(this.syncAppDataToTempOrder(tempOrder) && this.isTempOrderPersistEnabled())) {
|
|
1895
|
-
|
|
1930
|
+
_context18.next = 19;
|
|
1896
1931
|
break;
|
|
1897
1932
|
}
|
|
1898
1933
|
this.store.order.persistTempOrder();
|
|
1899
|
-
|
|
1934
|
+
_context18.next = 19;
|
|
1900
1935
|
return this.store.order.saveDraft();
|
|
1901
1936
|
case 19:
|
|
1902
|
-
return
|
|
1937
|
+
return _context18.abrupt("return", tempOrder);
|
|
1903
1938
|
case 22:
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
throw
|
|
1939
|
+
_context18.prev = 22;
|
|
1940
|
+
_context18.t0 = _context18["catch"](0);
|
|
1941
|
+
throw _context18.t0;
|
|
1907
1942
|
case 25:
|
|
1908
1943
|
case "end":
|
|
1909
|
-
return
|
|
1944
|
+
return _context18.stop();
|
|
1910
1945
|
}
|
|
1911
|
-
},
|
|
1946
|
+
}, _callee18, this, [[0, 22]]);
|
|
1912
1947
|
}));
|
|
1913
1948
|
function restoreOrder() {
|
|
1914
1949
|
return _restoreOrder.apply(this, arguments);
|
|
@@ -1922,22 +1957,22 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1922
1957
|
}, {
|
|
1923
1958
|
key: "clearOrderCartLines",
|
|
1924
1959
|
value: (function () {
|
|
1925
|
-
var _clearOrderCartLines = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1960
|
+
var _clearOrderCartLines = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19() {
|
|
1926
1961
|
var tempOrder;
|
|
1927
|
-
return _regeneratorRuntime().wrap(function
|
|
1928
|
-
while (1) switch (
|
|
1962
|
+
return _regeneratorRuntime().wrap(function _callee19$(_context19) {
|
|
1963
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
1929
1964
|
case 0:
|
|
1930
|
-
|
|
1965
|
+
_context19.prev = 0;
|
|
1931
1966
|
if (this.store.order) {
|
|
1932
|
-
|
|
1967
|
+
_context19.next = 3;
|
|
1933
1968
|
break;
|
|
1934
1969
|
}
|
|
1935
1970
|
throw new Error('order 模块未初始化');
|
|
1936
1971
|
case 3:
|
|
1937
|
-
|
|
1972
|
+
_context19.next = 5;
|
|
1938
1973
|
return this.store.order.clearOrderCartLines();
|
|
1939
1974
|
case 5:
|
|
1940
|
-
tempOrder =
|
|
1975
|
+
tempOrder = _context19.sent;
|
|
1941
1976
|
if (this.currentSalesDetail) {
|
|
1942
1977
|
this.currentSalesDetail = _objectSpread(_objectSpread({}, this.currentSalesDetail), {}, {
|
|
1943
1978
|
products: [],
|
|
@@ -1947,29 +1982,29 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1947
1982
|
discount_list: []
|
|
1948
1983
|
});
|
|
1949
1984
|
}
|
|
1950
|
-
|
|
1985
|
+
_context19.next = 9;
|
|
1951
1986
|
return this.effectsEmit('onTempOrderReplaced', {
|
|
1952
1987
|
tempOrder: tempOrder
|
|
1953
1988
|
});
|
|
1954
1989
|
case 9:
|
|
1955
1990
|
if (!(this.syncAppDataToTempOrder(tempOrder) && this.isTempOrderPersistEnabled())) {
|
|
1956
|
-
|
|
1991
|
+
_context19.next = 13;
|
|
1957
1992
|
break;
|
|
1958
1993
|
}
|
|
1959
1994
|
this.store.order.persistTempOrder();
|
|
1960
|
-
|
|
1995
|
+
_context19.next = 13;
|
|
1961
1996
|
return this.store.order.saveDraft();
|
|
1962
1997
|
case 13:
|
|
1963
|
-
return
|
|
1998
|
+
return _context19.abrupt("return", tempOrder);
|
|
1964
1999
|
case 16:
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
throw
|
|
2000
|
+
_context19.prev = 16;
|
|
2001
|
+
_context19.t0 = _context19["catch"](0);
|
|
2002
|
+
throw _context19.t0;
|
|
1968
2003
|
case 19:
|
|
1969
2004
|
case "end":
|
|
1970
|
-
return
|
|
2005
|
+
return _context19.stop();
|
|
1971
2006
|
}
|
|
1972
|
-
},
|
|
2007
|
+
}, _callee19, this, [[0, 16]]);
|
|
1973
2008
|
}));
|
|
1974
2009
|
function clearOrderCartLines() {
|
|
1975
2010
|
return _clearOrderCartLines.apply(this, arguments);
|
|
@@ -1986,32 +2021,32 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1986
2021
|
}, {
|
|
1987
2022
|
key: "getSummary",
|
|
1988
2023
|
value: function () {
|
|
1989
|
-
var _getSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2024
|
+
var _getSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20() {
|
|
1990
2025
|
var summary;
|
|
1991
|
-
return _regeneratorRuntime().wrap(function
|
|
1992
|
-
while (1) switch (
|
|
2026
|
+
return _regeneratorRuntime().wrap(function _callee20$(_context20) {
|
|
2027
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
1993
2028
|
case 0:
|
|
1994
|
-
|
|
2029
|
+
_context20.prev = 0;
|
|
1995
2030
|
if (this.store.order) {
|
|
1996
|
-
|
|
2031
|
+
_context20.next = 3;
|
|
1997
2032
|
break;
|
|
1998
2033
|
}
|
|
1999
2034
|
throw new Error('order 模块未初始化');
|
|
2000
2035
|
case 3:
|
|
2001
|
-
|
|
2036
|
+
_context20.next = 5;
|
|
2002
2037
|
return this.store.order.getOrderSummary();
|
|
2003
2038
|
case 5:
|
|
2004
|
-
summary =
|
|
2005
|
-
return
|
|
2039
|
+
summary = _context20.sent;
|
|
2040
|
+
return _context20.abrupt("return", summary);
|
|
2006
2041
|
case 9:
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
throw
|
|
2042
|
+
_context20.prev = 9;
|
|
2043
|
+
_context20.t0 = _context20["catch"](0);
|
|
2044
|
+
throw _context20.t0;
|
|
2010
2045
|
case 12:
|
|
2011
2046
|
case "end":
|
|
2012
|
-
return
|
|
2047
|
+
return _context20.stop();
|
|
2013
2048
|
}
|
|
2014
|
-
},
|
|
2049
|
+
}, _callee20, this, [[0, 9]]);
|
|
2015
2050
|
}));
|
|
2016
2051
|
function getSummary() {
|
|
2017
2052
|
return _getSummary.apply(this, arguments);
|
|
@@ -2128,14 +2163,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2128
2163
|
}, {
|
|
2129
2164
|
key: "loadDiscountConfig",
|
|
2130
2165
|
value: function () {
|
|
2131
|
-
var _loadDiscountConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2166
|
+
var _loadDiscountConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(params) {
|
|
2132
2167
|
var _this$getOrderIdentit, _tempOrder$customer, _tempOrder$_extend, _tempOrder$_extend2, _discountModule$getDi, _discountModule$getOr, _discountModule$getDi2;
|
|
2133
2168
|
var tempOrder, orderStore, discountModule, rulesModule, orderId, customerId, currentDiscountList, originalDiscountList, hasManualDiscountSelection, discountAction, discountConfigCacheKey, preparedDiscountList, _discountModule$setOr, nextDiscountList, shouldSkipAutoApplyFetchedDiscounts, _summary, _orderStore$summary, orderTotalAmount, result, _iterator2, _step2, _product$metadata5, _tempOrder$_extend3, _product$metadata$sou, _product$metadata6, _product$metadata7, _product$original_pri, product, productUid, runtimeOrigin, totalPerUnitDiscount, optionSum, sourcePrice, newSourceSellingPrice, newMainSellingPrice, summary;
|
|
2134
|
-
return _regeneratorRuntime().wrap(function
|
|
2135
|
-
while (1) switch (
|
|
2169
|
+
return _regeneratorRuntime().wrap(function _callee21$(_context21) {
|
|
2170
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
2136
2171
|
case 0:
|
|
2137
2172
|
if (this.store.order) {
|
|
2138
|
-
|
|
2173
|
+
_context21.next = 2;
|
|
2139
2174
|
break;
|
|
2140
2175
|
}
|
|
2141
2176
|
throw new Error('order 模块未初始化');
|
|
@@ -2155,18 +2190,18 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2155
2190
|
discountConfigCacheKey = [customerId, discountAction, Number(orderId) || 0].join(':');
|
|
2156
2191
|
preparedDiscountList = [];
|
|
2157
2192
|
if (!(customerId && customerId !== 1)) {
|
|
2158
|
-
|
|
2193
|
+
_context21.next = 25;
|
|
2159
2194
|
break;
|
|
2160
2195
|
}
|
|
2161
2196
|
if (!(this.discountConfigCacheKey === discountConfigCacheKey)) {
|
|
2162
|
-
|
|
2197
|
+
_context21.next = 19;
|
|
2163
2198
|
break;
|
|
2164
2199
|
}
|
|
2165
2200
|
preparedDiscountList = originalDiscountList;
|
|
2166
|
-
|
|
2201
|
+
_context21.next = 25;
|
|
2167
2202
|
break;
|
|
2168
2203
|
case 19:
|
|
2169
|
-
|
|
2204
|
+
_context21.next = 21;
|
|
2170
2205
|
return this.store.order.loadDiscountConfig({
|
|
2171
2206
|
customerId: customerId,
|
|
2172
2207
|
action: discountAction,
|
|
@@ -2174,16 +2209,16 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2174
2209
|
apply: false
|
|
2175
2210
|
});
|
|
2176
2211
|
case 21:
|
|
2177
|
-
preparedDiscountList =
|
|
2212
|
+
preparedDiscountList = _context21.sent;
|
|
2178
2213
|
this.discountConfigCacheKey = discountConfigCacheKey;
|
|
2179
|
-
|
|
2214
|
+
_context21.next = 25;
|
|
2180
2215
|
return discountModule === null || discountModule === void 0 || (_discountModule$setOr = discountModule.setOriginalDiscountList) === null || _discountModule$setOr === void 0 ? void 0 : _discountModule$setOr.call(discountModule, preparedDiscountList);
|
|
2181
2216
|
case 25:
|
|
2182
2217
|
if (!(hasManualDiscountSelection && currentDiscountList.length)) {
|
|
2183
|
-
|
|
2218
|
+
_context21.next = 27;
|
|
2184
2219
|
break;
|
|
2185
2220
|
}
|
|
2186
|
-
return
|
|
2221
|
+
return _context21.abrupt("return", {
|
|
2187
2222
|
productList: tempOrder.products || [],
|
|
2188
2223
|
discountList: currentDiscountList,
|
|
2189
2224
|
availableWalletIds: this.getAvailableWalletIds()
|
|
@@ -2191,7 +2226,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2191
2226
|
case 27:
|
|
2192
2227
|
nextDiscountList = this.mergeHistoricalDiscountList(preparedDiscountList || (discountModule === null || discountModule === void 0 || (_discountModule$getDi2 = discountModule.getDiscountList) === null || _discountModule$getDi2 === void 0 ? void 0 : _discountModule$getDi2.call(discountModule)) || [], tempOrder.products || []);
|
|
2193
2228
|
nextDiscountList = this.mergeCurrentDiscountSelectionState(nextDiscountList, currentDiscountList);
|
|
2194
|
-
|
|
2229
|
+
_context21.next = 31;
|
|
2195
2230
|
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
|
|
2196
2231
|
case 31:
|
|
2197
2232
|
shouldSkipAutoApplyFetchedDiscounts = this.shouldSkipAutoApplyFetchedDiscountsInEditMode({
|
|
@@ -2201,17 +2236,17 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2201
2236
|
nextDiscountList: nextDiscountList
|
|
2202
2237
|
});
|
|
2203
2238
|
if (!shouldSkipAutoApplyFetchedDiscounts) {
|
|
2204
|
-
|
|
2239
|
+
_context21.next = 40;
|
|
2205
2240
|
break;
|
|
2206
2241
|
}
|
|
2207
|
-
|
|
2242
|
+
_context21.next = 35;
|
|
2208
2243
|
return this.store.order.recalculateSummary({
|
|
2209
2244
|
createIfMissing: true
|
|
2210
2245
|
});
|
|
2211
2246
|
case 35:
|
|
2212
|
-
_summary =
|
|
2247
|
+
_summary = _context21.sent;
|
|
2213
2248
|
this.store.order.persistTempOrder();
|
|
2214
|
-
|
|
2249
|
+
_context21.next = 39;
|
|
2215
2250
|
return this.effectsEmit('onDiscountApplied', {
|
|
2216
2251
|
productList: tempOrder.products || [],
|
|
2217
2252
|
discountList: nextDiscountList,
|
|
@@ -2219,14 +2254,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2219
2254
|
tempOrder: tempOrder
|
|
2220
2255
|
});
|
|
2221
2256
|
case 39:
|
|
2222
|
-
return
|
|
2257
|
+
return _context21.abrupt("return", {
|
|
2223
2258
|
productList: tempOrder.products || [],
|
|
2224
2259
|
discountList: nextDiscountList,
|
|
2225
2260
|
availableWalletIds: this.getAvailableWalletIds()
|
|
2226
2261
|
});
|
|
2227
2262
|
case 40:
|
|
2228
2263
|
if (!rulesModule) {
|
|
2229
|
-
|
|
2264
|
+
_context21.next = 77;
|
|
2230
2265
|
break;
|
|
2231
2266
|
}
|
|
2232
2267
|
orderTotalAmount = Number(((_orderStore$summary = orderStore.summary) === null || _orderStore$summary === void 0 ? void 0 : _orderStore$summary.total_amount) || 0);
|
|
@@ -2247,21 +2282,21 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2247
2282
|
tempOrder.products = preserveManualProductDiscountProducts(tempOrder.products, result.productList);
|
|
2248
2283
|
}
|
|
2249
2284
|
_iterator2 = _createForOfIteratorHelper(tempOrder.products || []);
|
|
2250
|
-
|
|
2285
|
+
_context21.prev = 46;
|
|
2251
2286
|
_iterator2.s();
|
|
2252
2287
|
case 48:
|
|
2253
2288
|
if ((_step2 = _iterator2.n()).done) {
|
|
2254
|
-
|
|
2289
|
+
_context21.next = 63;
|
|
2255
2290
|
break;
|
|
2256
2291
|
}
|
|
2257
2292
|
product = _step2.value;
|
|
2258
2293
|
productUid = (_product$metadata5 = product.metadata) === null || _product$metadata5 === void 0 ? void 0 : _product$metadata5.unique_identification_number;
|
|
2259
2294
|
runtimeOrigin = productUid ? (_tempOrder$_extend3 = tempOrder._extend) === null || _tempOrder$_extend3 === void 0 || (_tempOrder$_extend3 = _tempOrder$_extend3.productsByUid) === null || _tempOrder$_extend3 === void 0 || (_tempOrder$_extend3 = _tempOrder$_extend3[productUid]) === null || _tempOrder$_extend3 === void 0 ? void 0 : _tempOrder$_extend3.origin : undefined;
|
|
2260
2295
|
if (!(runtimeOrigin !== null && runtimeOrigin !== void 0 && runtimeOrigin.isManualDiscount || isBaseSalesManualProductDiscountProduct(product))) {
|
|
2261
|
-
|
|
2296
|
+
_context21.next = 54;
|
|
2262
2297
|
break;
|
|
2263
2298
|
}
|
|
2264
|
-
return
|
|
2299
|
+
return _context21.abrupt("continue", 61);
|
|
2265
2300
|
case 54:
|
|
2266
2301
|
totalPerUnitDiscount = (product.discount_list || []).reduce(function (sum, pd) {
|
|
2267
2302
|
return sum + Number(pd.amount || 0);
|
|
@@ -2279,41 +2314,41 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2279
2314
|
bundle: product.product_bundle
|
|
2280
2315
|
});
|
|
2281
2316
|
case 61:
|
|
2282
|
-
|
|
2317
|
+
_context21.next = 48;
|
|
2283
2318
|
break;
|
|
2284
2319
|
case 63:
|
|
2285
|
-
|
|
2320
|
+
_context21.next = 68;
|
|
2286
2321
|
break;
|
|
2287
2322
|
case 65:
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
_iterator2.e(
|
|
2323
|
+
_context21.prev = 65;
|
|
2324
|
+
_context21.t0 = _context21["catch"](46);
|
|
2325
|
+
_iterator2.e(_context21.t0);
|
|
2291
2326
|
case 68:
|
|
2292
|
-
|
|
2327
|
+
_context21.prev = 68;
|
|
2293
2328
|
_iterator2.f();
|
|
2294
|
-
return
|
|
2329
|
+
return _context21.finish(68);
|
|
2295
2330
|
case 71:
|
|
2296
2331
|
if (!result.discountList) {
|
|
2297
|
-
|
|
2332
|
+
_context21.next = 77;
|
|
2298
2333
|
break;
|
|
2299
2334
|
}
|
|
2300
2335
|
nextDiscountList = this.mergeHistoricalDiscountList(result.discountList, tempOrder.products || []);
|
|
2301
2336
|
OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
|
|
2302
|
-
|
|
2337
|
+
_context21.next = 76;
|
|
2303
2338
|
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
|
|
2304
2339
|
case 76:
|
|
2305
2340
|
tempOrder.discount_list = nextDiscountList.filter(function (discount) {
|
|
2306
2341
|
return discount.isSelected;
|
|
2307
2342
|
});
|
|
2308
2343
|
case 77:
|
|
2309
|
-
|
|
2344
|
+
_context21.next = 79;
|
|
2310
2345
|
return this.store.order.recalculateSummary({
|
|
2311
2346
|
createIfMissing: true
|
|
2312
2347
|
});
|
|
2313
2348
|
case 79:
|
|
2314
|
-
summary =
|
|
2349
|
+
summary = _context21.sent;
|
|
2315
2350
|
this.store.order.persistTempOrder();
|
|
2316
|
-
|
|
2351
|
+
_context21.next = 83;
|
|
2317
2352
|
return this.effectsEmit('onDiscountApplied', {
|
|
2318
2353
|
productList: tempOrder.products || [],
|
|
2319
2354
|
discountList: nextDiscountList,
|
|
@@ -2321,18 +2356,18 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2321
2356
|
tempOrder: tempOrder
|
|
2322
2357
|
});
|
|
2323
2358
|
case 83:
|
|
2324
|
-
return
|
|
2359
|
+
return _context21.abrupt("return", {
|
|
2325
2360
|
productList: tempOrder.products || [],
|
|
2326
2361
|
discountList: nextDiscountList,
|
|
2327
2362
|
availableWalletIds: this.getAvailableWalletIds()
|
|
2328
2363
|
});
|
|
2329
2364
|
case 84:
|
|
2330
2365
|
case "end":
|
|
2331
|
-
return
|
|
2366
|
+
return _context21.stop();
|
|
2332
2367
|
}
|
|
2333
|
-
},
|
|
2368
|
+
}, _callee21, this, [[46, 65, 68, 71]]);
|
|
2334
2369
|
}));
|
|
2335
|
-
function loadDiscountConfig(
|
|
2370
|
+
function loadDiscountConfig(_x16) {
|
|
2336
2371
|
return _loadDiscountConfig.apply(this, arguments);
|
|
2337
2372
|
}
|
|
2338
2373
|
return loadDiscountConfig;
|
|
@@ -2347,14 +2382,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2347
2382
|
}, {
|
|
2348
2383
|
key: "bestDiscount",
|
|
2349
2384
|
value: function () {
|
|
2350
|
-
var _bestDiscount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2385
|
+
var _bestDiscount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(cb) {
|
|
2351
2386
|
var _discountModule$getOr2, _discountModule$getDi3;
|
|
2352
2387
|
var tempOrder, orderStore, discountModule, rulesModule, originalDiscountList, currentDiscountList, nextDiscountList, result, _orderStore$summary2, orderTotalAmount;
|
|
2353
|
-
return _regeneratorRuntime().wrap(function
|
|
2354
|
-
while (1) switch (
|
|
2388
|
+
return _regeneratorRuntime().wrap(function _callee22$(_context22) {
|
|
2389
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
2355
2390
|
case 0:
|
|
2356
2391
|
if (this.store.order) {
|
|
2357
|
-
|
|
2392
|
+
_context22.next = 2;
|
|
2358
2393
|
break;
|
|
2359
2394
|
}
|
|
2360
2395
|
throw new Error('order 模块未初始化');
|
|
@@ -2370,11 +2405,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2370
2405
|
productList: tempOrder.products || [],
|
|
2371
2406
|
discountList: nextDiscountList
|
|
2372
2407
|
};
|
|
2373
|
-
|
|
2408
|
+
_context22.next = 12;
|
|
2374
2409
|
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
|
|
2375
2410
|
case 12:
|
|
2376
2411
|
if (!rulesModule) {
|
|
2377
|
-
|
|
2412
|
+
_context22.next = 24;
|
|
2378
2413
|
break;
|
|
2379
2414
|
}
|
|
2380
2415
|
orderTotalAmount = Number(((_orderStore$summary2 = orderStore.summary) === null || _orderStore$summary2 === void 0 ? void 0 : _orderStore$summary2.total_amount) || 0);
|
|
@@ -2392,12 +2427,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2392
2427
|
tempOrder.products = preserveManualProductDiscountProducts(tempOrder.products, result.productList);
|
|
2393
2428
|
}
|
|
2394
2429
|
if (!result.discountList) {
|
|
2395
|
-
|
|
2430
|
+
_context22.next = 24;
|
|
2396
2431
|
break;
|
|
2397
2432
|
}
|
|
2398
2433
|
nextDiscountList = this.mergeHistoricalDiscountList(result.discountList, tempOrder.products || []);
|
|
2399
2434
|
OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
|
|
2400
|
-
|
|
2435
|
+
_context22.next = 22;
|
|
2401
2436
|
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
|
|
2402
2437
|
case 22:
|
|
2403
2438
|
tempOrder.discount_list = nextDiscountList.filter(function (discount) {
|
|
@@ -2408,13 +2443,13 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2408
2443
|
discountList: nextDiscountList
|
|
2409
2444
|
};
|
|
2410
2445
|
case 24:
|
|
2411
|
-
|
|
2446
|
+
_context22.next = 26;
|
|
2412
2447
|
return this.store.order.recalculateSummary({
|
|
2413
2448
|
createIfMissing: true
|
|
2414
2449
|
});
|
|
2415
2450
|
case 26:
|
|
2416
2451
|
this.store.order.persistTempOrder();
|
|
2417
|
-
|
|
2452
|
+
_context22.next = 29;
|
|
2418
2453
|
return this.effectsEmit('onDiscountApplied', {
|
|
2419
2454
|
productList: tempOrder.products || [],
|
|
2420
2455
|
discountList: nextDiscountList,
|
|
@@ -2423,14 +2458,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2423
2458
|
});
|
|
2424
2459
|
case 29:
|
|
2425
2460
|
cb === null || cb === void 0 || cb(result);
|
|
2426
|
-
return
|
|
2461
|
+
return _context22.abrupt("return", result);
|
|
2427
2462
|
case 31:
|
|
2428
2463
|
case "end":
|
|
2429
|
-
return
|
|
2464
|
+
return _context22.stop();
|
|
2430
2465
|
}
|
|
2431
|
-
},
|
|
2466
|
+
}, _callee22, this);
|
|
2432
2467
|
}));
|
|
2433
|
-
function bestDiscount(
|
|
2468
|
+
function bestDiscount(_x17) {
|
|
2434
2469
|
return _bestDiscount.apply(this, arguments);
|
|
2435
2470
|
}
|
|
2436
2471
|
return bestDiscount;
|
|
@@ -2459,41 +2494,41 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2459
2494
|
}, {
|
|
2460
2495
|
key: "replaceDiscountStoreLists",
|
|
2461
2496
|
value: (function () {
|
|
2462
|
-
var _replaceDiscountStoreLists = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2497
|
+
var _replaceDiscountStoreLists = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(params) {
|
|
2463
2498
|
var _store2;
|
|
2464
2499
|
var discountModule;
|
|
2465
|
-
return _regeneratorRuntime().wrap(function
|
|
2466
|
-
while (1) switch (
|
|
2500
|
+
return _regeneratorRuntime().wrap(function _callee23$(_context23) {
|
|
2501
|
+
while (1) switch (_context23.prev = _context23.next) {
|
|
2467
2502
|
case 0:
|
|
2468
2503
|
if (this.store.order) {
|
|
2469
|
-
|
|
2504
|
+
_context23.next = 2;
|
|
2470
2505
|
break;
|
|
2471
2506
|
}
|
|
2472
2507
|
throw new Error('order 模块未初始化');
|
|
2473
2508
|
case 2:
|
|
2474
2509
|
discountModule = (_store2 = this.store.order.store) === null || _store2 === void 0 ? void 0 : _store2.discount;
|
|
2475
2510
|
if (discountModule) {
|
|
2476
|
-
|
|
2511
|
+
_context23.next = 5;
|
|
2477
2512
|
break;
|
|
2478
2513
|
}
|
|
2479
|
-
return
|
|
2514
|
+
return _context23.abrupt("return");
|
|
2480
2515
|
case 5:
|
|
2481
2516
|
if (!params.originalDiscountList) {
|
|
2482
|
-
|
|
2517
|
+
_context23.next = 8;
|
|
2483
2518
|
break;
|
|
2484
2519
|
}
|
|
2485
|
-
|
|
2520
|
+
_context23.next = 8;
|
|
2486
2521
|
return discountModule.setOriginalDiscountList(params.originalDiscountList);
|
|
2487
2522
|
case 8:
|
|
2488
|
-
|
|
2523
|
+
_context23.next = 10;
|
|
2489
2524
|
return discountModule.setDiscountList(params.discountList);
|
|
2490
2525
|
case 10:
|
|
2491
2526
|
case "end":
|
|
2492
|
-
return
|
|
2527
|
+
return _context23.stop();
|
|
2493
2528
|
}
|
|
2494
|
-
},
|
|
2529
|
+
}, _callee23, this);
|
|
2495
2530
|
}));
|
|
2496
|
-
function replaceDiscountStoreLists(
|
|
2531
|
+
function replaceDiscountStoreLists(_x18) {
|
|
2497
2532
|
return _replaceDiscountStoreLists.apply(this, arguments);
|
|
2498
2533
|
}
|
|
2499
2534
|
return replaceDiscountStoreLists;
|
|
@@ -2501,34 +2536,34 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2501
2536
|
}, {
|
|
2502
2537
|
key: "scanPromotionCode",
|
|
2503
2538
|
value: function () {
|
|
2504
|
-
var _scanPromotionCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2539
|
+
var _scanPromotionCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(code, customerId) {
|
|
2505
2540
|
var raw, tempOrder;
|
|
2506
|
-
return _regeneratorRuntime().wrap(function
|
|
2507
|
-
while (1) switch (
|
|
2541
|
+
return _regeneratorRuntime().wrap(function _callee24$(_context24) {
|
|
2542
|
+
while (1) switch (_context24.prev = _context24.next) {
|
|
2508
2543
|
case 0:
|
|
2509
|
-
|
|
2544
|
+
_context24.prev = 0;
|
|
2510
2545
|
if (this.store.order) {
|
|
2511
|
-
|
|
2546
|
+
_context24.next = 3;
|
|
2512
2547
|
break;
|
|
2513
2548
|
}
|
|
2514
2549
|
throw new Error('order 模块未初始化');
|
|
2515
2550
|
case 3:
|
|
2516
|
-
|
|
2551
|
+
_context24.next = 5;
|
|
2517
2552
|
return this.store.order.scanCode(code, customerId);
|
|
2518
2553
|
case 5:
|
|
2519
|
-
raw =
|
|
2554
|
+
raw = _context24.sent;
|
|
2520
2555
|
if (!raw.isAvailable) {
|
|
2521
|
-
|
|
2556
|
+
_context24.next = 13;
|
|
2522
2557
|
break;
|
|
2523
2558
|
}
|
|
2524
|
-
|
|
2559
|
+
_context24.next = 9;
|
|
2525
2560
|
return this.store.order.recalculateSummary({
|
|
2526
2561
|
createIfMissing: true
|
|
2527
2562
|
});
|
|
2528
2563
|
case 9:
|
|
2529
2564
|
this.store.order.persistTempOrder();
|
|
2530
2565
|
tempOrder = this.store.order.ensureTempOrder();
|
|
2531
|
-
|
|
2566
|
+
_context24.next = 13;
|
|
2532
2567
|
return this.effectsEmit('onDiscountApplied', {
|
|
2533
2568
|
productList: tempOrder.products || [],
|
|
2534
2569
|
discountList: this.store.order.getDiscountList(),
|
|
@@ -2536,7 +2571,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2536
2571
|
tempOrder: tempOrder
|
|
2537
2572
|
});
|
|
2538
2573
|
case 13:
|
|
2539
|
-
return
|
|
2574
|
+
return _context24.abrupt("return", _objectSpread(_objectSpread({
|
|
2540
2575
|
isAvailable: raw.isAvailable
|
|
2541
2576
|
}, raw.isAccepted !== undefined ? {
|
|
2542
2577
|
isAccepted: raw.isAccepted
|
|
@@ -2546,16 +2581,16 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2546
2581
|
scannedDiscountList: raw.scannedDiscountList
|
|
2547
2582
|
}));
|
|
2548
2583
|
case 16:
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
throw
|
|
2584
|
+
_context24.prev = 16;
|
|
2585
|
+
_context24.t0 = _context24["catch"](0);
|
|
2586
|
+
throw _context24.t0;
|
|
2552
2587
|
case 19:
|
|
2553
2588
|
case "end":
|
|
2554
|
-
return
|
|
2589
|
+
return _context24.stop();
|
|
2555
2590
|
}
|
|
2556
|
-
},
|
|
2591
|
+
}, _callee24, this, [[0, 16]]);
|
|
2557
2592
|
}));
|
|
2558
|
-
function scanPromotionCode(
|
|
2593
|
+
function scanPromotionCode(_x19, _x20) {
|
|
2559
2594
|
return _scanPromotionCode.apply(this, arguments);
|
|
2560
2595
|
}
|
|
2561
2596
|
return scanPromotionCode;
|
|
@@ -2563,14 +2598,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2563
2598
|
}, {
|
|
2564
2599
|
key: "setDiscountSelected",
|
|
2565
2600
|
value: function () {
|
|
2566
|
-
var _setDiscountSelected = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2601
|
+
var _setDiscountSelected = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(params) {
|
|
2567
2602
|
var list, updated, tempOrder, orderStore, discountModule, rulesModule, nextDiscountList, _orderStore$summary3, orderTotalAmount, result, beforeSelectedIds, _iterator3, _step3, d, selectedResourceIds, filterSelectedDiscountDetails, _iterator4, _step4, _product$metadata8, _tempOrder$_extend4, _product$metadata$sou2, _product$metadata9, _product$metadata10, _product$original_pri2, product, productUid, runtimeOrigin, totalPerUnitDiscount, optionSum, sourcePrice, newSourceSellingPrice, newMainSellingPrice;
|
|
2568
|
-
return _regeneratorRuntime().wrap(function
|
|
2569
|
-
while (1) switch (
|
|
2603
|
+
return _regeneratorRuntime().wrap(function _callee25$(_context25) {
|
|
2604
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
2570
2605
|
case 0:
|
|
2571
|
-
|
|
2606
|
+
_context25.prev = 0;
|
|
2572
2607
|
if (this.store.order) {
|
|
2573
|
-
|
|
2608
|
+
_context25.next = 3;
|
|
2574
2609
|
break;
|
|
2575
2610
|
}
|
|
2576
2611
|
throw new Error('order 模块未初始化');
|
|
@@ -2588,7 +2623,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2588
2623
|
discountModule = orderStore.discount;
|
|
2589
2624
|
rulesModule = orderStore.rules;
|
|
2590
2625
|
nextDiscountList = updated;
|
|
2591
|
-
|
|
2626
|
+
_context25.next = 13;
|
|
2592
2627
|
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(updated);
|
|
2593
2628
|
case 13:
|
|
2594
2629
|
if (rulesModule) {
|
|
@@ -2651,21 +2686,21 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2651
2686
|
});
|
|
2652
2687
|
};
|
|
2653
2688
|
_iterator4 = _createForOfIteratorHelper(tempOrder.products);
|
|
2654
|
-
|
|
2689
|
+
_context25.prev = 17;
|
|
2655
2690
|
_iterator4.s();
|
|
2656
2691
|
case 19:
|
|
2657
2692
|
if ((_step4 = _iterator4.n()).done) {
|
|
2658
|
-
|
|
2693
|
+
_context25.next = 36;
|
|
2659
2694
|
break;
|
|
2660
2695
|
}
|
|
2661
2696
|
product = _step4.value;
|
|
2662
2697
|
productUid = (_product$metadata8 = product.metadata) === null || _product$metadata8 === void 0 ? void 0 : _product$metadata8.unique_identification_number;
|
|
2663
2698
|
runtimeOrigin = productUid ? (_tempOrder$_extend4 = tempOrder._extend) === null || _tempOrder$_extend4 === void 0 || (_tempOrder$_extend4 = _tempOrder$_extend4.productsByUid) === null || _tempOrder$_extend4 === void 0 || (_tempOrder$_extend4 = _tempOrder$_extend4[productUid]) === null || _tempOrder$_extend4 === void 0 ? void 0 : _tempOrder$_extend4.origin : undefined;
|
|
2664
2699
|
if (!(runtimeOrigin !== null && runtimeOrigin !== void 0 && runtimeOrigin.isManualDiscount || isBaseSalesManualProductDiscountProduct(product))) {
|
|
2665
|
-
|
|
2700
|
+
_context25.next = 25;
|
|
2666
2701
|
break;
|
|
2667
2702
|
}
|
|
2668
|
-
return
|
|
2703
|
+
return _context25.abrupt("continue", 34);
|
|
2669
2704
|
case 25:
|
|
2670
2705
|
product.discount_list = filterSelectedDiscountDetails(product.discount_list);
|
|
2671
2706
|
if (Array.isArray(product.product_bundle)) {
|
|
@@ -2701,28 +2736,28 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2701
2736
|
bundle: product.product_bundle
|
|
2702
2737
|
});
|
|
2703
2738
|
case 34:
|
|
2704
|
-
|
|
2739
|
+
_context25.next = 19;
|
|
2705
2740
|
break;
|
|
2706
2741
|
case 36:
|
|
2707
|
-
|
|
2742
|
+
_context25.next = 41;
|
|
2708
2743
|
break;
|
|
2709
2744
|
case 38:
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
_iterator4.e(
|
|
2745
|
+
_context25.prev = 38;
|
|
2746
|
+
_context25.t0 = _context25["catch"](17);
|
|
2747
|
+
_iterator4.e(_context25.t0);
|
|
2713
2748
|
case 41:
|
|
2714
|
-
|
|
2749
|
+
_context25.prev = 41;
|
|
2715
2750
|
_iterator4.f();
|
|
2716
|
-
return
|
|
2751
|
+
return _context25.finish(41);
|
|
2717
2752
|
case 44:
|
|
2718
2753
|
OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
|
|
2719
|
-
|
|
2754
|
+
_context25.next = 47;
|
|
2720
2755
|
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
|
|
2721
2756
|
case 47:
|
|
2722
2757
|
tempOrder.discount_list = (nextDiscountList || []).filter(function (d) {
|
|
2723
2758
|
return d.isSelected;
|
|
2724
2759
|
});
|
|
2725
|
-
|
|
2760
|
+
_context25.next = 50;
|
|
2726
2761
|
return this.store.order.recalculateSummary({
|
|
2727
2762
|
createIfMissing: true
|
|
2728
2763
|
});
|
|
@@ -2734,19 +2769,19 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2734
2769
|
selectedDiscountList: tempOrder.discount_list,
|
|
2735
2770
|
tempOrder: tempOrder
|
|
2736
2771
|
});
|
|
2737
|
-
|
|
2772
|
+
_context25.next = 57;
|
|
2738
2773
|
break;
|
|
2739
2774
|
case 54:
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
throw
|
|
2775
|
+
_context25.prev = 54;
|
|
2776
|
+
_context25.t1 = _context25["catch"](0);
|
|
2777
|
+
throw _context25.t1;
|
|
2743
2778
|
case 57:
|
|
2744
2779
|
case "end":
|
|
2745
|
-
return
|
|
2780
|
+
return _context25.stop();
|
|
2746
2781
|
}
|
|
2747
|
-
},
|
|
2782
|
+
}, _callee25, this, [[0, 54], [17, 38, 41, 44]]);
|
|
2748
2783
|
}));
|
|
2749
|
-
function setDiscountSelected(
|
|
2784
|
+
function setDiscountSelected(_x21) {
|
|
2750
2785
|
return _setDiscountSelected.apply(this, arguments);
|
|
2751
2786
|
}
|
|
2752
2787
|
return setDiscountSelected;
|
|
@@ -2754,23 +2789,23 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2754
2789
|
}, {
|
|
2755
2790
|
key: "applyDiscountCalculationResult",
|
|
2756
2791
|
value: function () {
|
|
2757
|
-
var _applyDiscountCalculationResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2792
|
+
var _applyDiscountCalculationResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(result) {
|
|
2758
2793
|
var tempOrder, orderStore, discountModule;
|
|
2759
|
-
return _regeneratorRuntime().wrap(function
|
|
2760
|
-
while (1) switch (
|
|
2794
|
+
return _regeneratorRuntime().wrap(function _callee26$(_context26) {
|
|
2795
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
2761
2796
|
case 0:
|
|
2762
|
-
|
|
2797
|
+
_context26.prev = 0;
|
|
2763
2798
|
if (this.store.order) {
|
|
2764
|
-
|
|
2799
|
+
_context26.next = 3;
|
|
2765
2800
|
break;
|
|
2766
2801
|
}
|
|
2767
2802
|
throw new Error('order 模块未初始化');
|
|
2768
2803
|
case 3:
|
|
2769
2804
|
if (result) {
|
|
2770
|
-
|
|
2805
|
+
_context26.next = 5;
|
|
2771
2806
|
break;
|
|
2772
2807
|
}
|
|
2773
|
-
return
|
|
2808
|
+
return _context26.abrupt("return");
|
|
2774
2809
|
case 5:
|
|
2775
2810
|
tempOrder = this.store.order.ensureTempOrder();
|
|
2776
2811
|
orderStore = this.store.order.store || {};
|
|
@@ -2779,24 +2814,24 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2779
2814
|
tempOrder.products = preserveManualProductDiscountProducts(tempOrder.products, result.productList);
|
|
2780
2815
|
}
|
|
2781
2816
|
if (!result.discountList) {
|
|
2782
|
-
|
|
2817
|
+
_context26.next = 14;
|
|
2783
2818
|
break;
|
|
2784
2819
|
}
|
|
2785
2820
|
OrderModule.populateSavedAmounts(tempOrder.products, result.discountList);
|
|
2786
|
-
|
|
2821
|
+
_context26.next = 13;
|
|
2787
2822
|
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(result.discountList);
|
|
2788
2823
|
case 13:
|
|
2789
2824
|
tempOrder.discount_list = result.discountList.filter(function (discount) {
|
|
2790
2825
|
return discount.isSelected;
|
|
2791
2826
|
});
|
|
2792
2827
|
case 14:
|
|
2793
|
-
|
|
2828
|
+
_context26.next = 16;
|
|
2794
2829
|
return this.store.order.recalculateSummary({
|
|
2795
2830
|
createIfMissing: true
|
|
2796
2831
|
});
|
|
2797
2832
|
case 16:
|
|
2798
2833
|
this.store.order.persistTempOrder();
|
|
2799
|
-
|
|
2834
|
+
_context26.next = 19;
|
|
2800
2835
|
return this.effectsEmit('onDiscountApplied', {
|
|
2801
2836
|
productList: tempOrder.products || [],
|
|
2802
2837
|
discountList: result.discountList || [],
|
|
@@ -2804,19 +2839,19 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2804
2839
|
tempOrder: tempOrder
|
|
2805
2840
|
});
|
|
2806
2841
|
case 19:
|
|
2807
|
-
|
|
2842
|
+
_context26.next = 24;
|
|
2808
2843
|
break;
|
|
2809
2844
|
case 21:
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
throw
|
|
2845
|
+
_context26.prev = 21;
|
|
2846
|
+
_context26.t0 = _context26["catch"](0);
|
|
2847
|
+
throw _context26.t0;
|
|
2813
2848
|
case 24:
|
|
2814
2849
|
case "end":
|
|
2815
|
-
return
|
|
2850
|
+
return _context26.stop();
|
|
2816
2851
|
}
|
|
2817
|
-
},
|
|
2852
|
+
}, _callee26, this, [[0, 21]]);
|
|
2818
2853
|
}));
|
|
2819
|
-
function applyDiscountCalculationResult(
|
|
2854
|
+
function applyDiscountCalculationResult(_x22) {
|
|
2820
2855
|
return _applyDiscountCalculationResult.apply(this, arguments);
|
|
2821
2856
|
}
|
|
2822
2857
|
return applyDiscountCalculationResult;
|
|
@@ -2824,18 +2859,18 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2824
2859
|
}, {
|
|
2825
2860
|
key: "submitScanOrder",
|
|
2826
2861
|
value: function () {
|
|
2827
|
-
var _submitScanOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2828
|
-
return _regeneratorRuntime().wrap(function
|
|
2829
|
-
while (1) switch (
|
|
2862
|
+
var _submitScanOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(params) {
|
|
2863
|
+
return _regeneratorRuntime().wrap(function _callee27$(_context27) {
|
|
2864
|
+
while (1) switch (_context27.prev = _context27.next) {
|
|
2830
2865
|
case 0:
|
|
2831
|
-
return
|
|
2866
|
+
return _context27.abrupt("return", this.submitSalesOrder(params));
|
|
2832
2867
|
case 1:
|
|
2833
2868
|
case "end":
|
|
2834
|
-
return
|
|
2869
|
+
return _context27.stop();
|
|
2835
2870
|
}
|
|
2836
|
-
},
|
|
2871
|
+
}, _callee27, this);
|
|
2837
2872
|
}));
|
|
2838
|
-
function submitScanOrder(
|
|
2873
|
+
function submitScanOrder(_x23) {
|
|
2839
2874
|
return _submitScanOrder.apply(this, arguments);
|
|
2840
2875
|
}
|
|
2841
2876
|
return submitScanOrder;
|
|
@@ -2849,14 +2884,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2849
2884
|
}, {
|
|
2850
2885
|
key: "submitSalesOrder",
|
|
2851
2886
|
value: (function () {
|
|
2852
|
-
var _submitSalesOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2887
|
+
var _submitSalesOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(params) {
|
|
2853
2888
|
var _params$smallTicketDa, _this$otherParams11, _this$otherParams12, _this$otherParams13, _this$otherParams14;
|
|
2854
2889
|
var inferredPaymentStatus, smallTicketDataFlag, submitParams;
|
|
2855
|
-
return _regeneratorRuntime().wrap(function
|
|
2856
|
-
while (1) switch (
|
|
2890
|
+
return _regeneratorRuntime().wrap(function _callee28$(_context28) {
|
|
2891
|
+
while (1) switch (_context28.prev = _context28.next) {
|
|
2857
2892
|
case 0:
|
|
2858
2893
|
if (this.store.order) {
|
|
2859
|
-
|
|
2894
|
+
_context28.next = 2;
|
|
2860
2895
|
break;
|
|
2861
2896
|
}
|
|
2862
2897
|
throw new Error('BaseSales 解决方案需要 order 模块支持');
|
|
@@ -2882,14 +2917,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2882
2917
|
} : {}), (params === null || params === void 0 ? void 0 : params.enhancePayload) !== undefined ? {
|
|
2883
2918
|
enhancePayload: params.enhancePayload
|
|
2884
2919
|
} : {});
|
|
2885
|
-
return
|
|
2920
|
+
return _context28.abrupt("return", this.shouldUseCheckoutSyncTask() ? this.store.order.submitTempOrder(submitParams) : this.store.order.submitTempOrderAsync(submitParams));
|
|
2886
2921
|
case 6:
|
|
2887
2922
|
case "end":
|
|
2888
|
-
return
|
|
2923
|
+
return _context28.stop();
|
|
2889
2924
|
}
|
|
2890
|
-
},
|
|
2925
|
+
}, _callee28, this);
|
|
2891
2926
|
}));
|
|
2892
|
-
function submitSalesOrder(
|
|
2927
|
+
function submitSalesOrder(_x24) {
|
|
2893
2928
|
return _submitSalesOrder.apply(this, arguments);
|
|
2894
2929
|
}
|
|
2895
2930
|
return submitSalesOrder;
|
|
@@ -2897,18 +2932,18 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2897
2932
|
}, {
|
|
2898
2933
|
key: "saveSalesOrderDraft",
|
|
2899
2934
|
value: function () {
|
|
2900
|
-
var _saveSalesOrderDraft = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2935
|
+
var _saveSalesOrderDraft = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(params) {
|
|
2901
2936
|
var _params$platform, _this$otherParams15, _this$otherParams16, _this$otherParams17, _params$channel, _params$type, _this$otherParams18;
|
|
2902
|
-
return _regeneratorRuntime().wrap(function
|
|
2903
|
-
while (1) switch (
|
|
2937
|
+
return _regeneratorRuntime().wrap(function _callee29$(_context29) {
|
|
2938
|
+
while (1) switch (_context29.prev = _context29.next) {
|
|
2904
2939
|
case 0:
|
|
2905
2940
|
if (this.store.order) {
|
|
2906
|
-
|
|
2941
|
+
_context29.next = 2;
|
|
2907
2942
|
break;
|
|
2908
2943
|
}
|
|
2909
2944
|
throw new Error('BaseSales 解决方案需要 order 模块支持');
|
|
2910
2945
|
case 2:
|
|
2911
|
-
return
|
|
2946
|
+
return _context29.abrupt("return", this.store.order.saveTempOrderAsDraft(_objectSpread({
|
|
2912
2947
|
cacheId: this.cacheId,
|
|
2913
2948
|
platform: (_params$platform = params === null || params === void 0 ? void 0 : params.platform) !== null && _params$platform !== void 0 ? _params$platform : (_this$otherParams15 = this.otherParams) === null || _this$otherParams15 === void 0 ? void 0 : _this$otherParams15.platform,
|
|
2914
2949
|
businessCode: (params === null || params === void 0 ? void 0 : params.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),
|
|
@@ -2919,11 +2954,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2919
2954
|
} : {})));
|
|
2920
2955
|
case 3:
|
|
2921
2956
|
case "end":
|
|
2922
|
-
return
|
|
2957
|
+
return _context29.stop();
|
|
2923
2958
|
}
|
|
2924
|
-
},
|
|
2959
|
+
}, _callee29, this);
|
|
2925
2960
|
}));
|
|
2926
|
-
function saveSalesOrderDraft(
|
|
2961
|
+
function saveSalesOrderDraft(_x25) {
|
|
2927
2962
|
return _saveSalesOrderDraft.apply(this, arguments);
|
|
2928
2963
|
}
|
|
2929
2964
|
return saveSalesOrderDraft;
|
|
@@ -2931,14 +2966,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2931
2966
|
}, {
|
|
2932
2967
|
key: "submitTempOrderAsync",
|
|
2933
2968
|
value: function () {
|
|
2934
|
-
var _submitTempOrderAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2969
|
+
var _submitTempOrderAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(params) {
|
|
2935
2970
|
var _params$smallTicketDa2, _this$otherParams19, _this$otherParams20, _this$otherParams21, _this$otherParams22;
|
|
2936
2971
|
var inferredPaymentStatus, smallTicketDataFlag, submitParams;
|
|
2937
|
-
return _regeneratorRuntime().wrap(function
|
|
2938
|
-
while (1) switch (
|
|
2972
|
+
return _regeneratorRuntime().wrap(function _callee30$(_context30) {
|
|
2973
|
+
while (1) switch (_context30.prev = _context30.next) {
|
|
2939
2974
|
case 0:
|
|
2940
2975
|
if (this.store.order) {
|
|
2941
|
-
|
|
2976
|
+
_context30.next = 2;
|
|
2942
2977
|
break;
|
|
2943
2978
|
}
|
|
2944
2979
|
throw new Error('BaseSales 解决方案需要 order 模块支持');
|
|
@@ -2963,14 +2998,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2963
2998
|
} : {}), (params === null || params === void 0 ? void 0 : params.enhancePayload) !== undefined ? {
|
|
2964
2999
|
enhancePayload: params.enhancePayload
|
|
2965
3000
|
} : {});
|
|
2966
|
-
return
|
|
3001
|
+
return _context30.abrupt("return", this.store.order.submitTempOrderAsync(submitParams));
|
|
2967
3002
|
case 6:
|
|
2968
3003
|
case "end":
|
|
2969
|
-
return
|
|
3004
|
+
return _context30.stop();
|
|
2970
3005
|
}
|
|
2971
|
-
},
|
|
3006
|
+
}, _callee30, this);
|
|
2972
3007
|
}));
|
|
2973
|
-
function submitTempOrderAsync(
|
|
3008
|
+
function submitTempOrderAsync(_x26) {
|
|
2974
3009
|
return _submitTempOrderAsync.apply(this, arguments);
|
|
2975
3010
|
}
|
|
2976
3011
|
return submitTempOrderAsync;
|
|
@@ -2996,14 +3031,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2996
3031
|
}, {
|
|
2997
3032
|
key: "printLocalOrderReceipt",
|
|
2998
3033
|
value: function () {
|
|
2999
|
-
var _printLocalOrderReceipt = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3034
|
+
var _printLocalOrderReceipt = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(lookup) {
|
|
3000
3035
|
var _this$otherParams24, _this$otherParams25, _this$otherParams26, _this$otherParams27;
|
|
3001
3036
|
var hasLookup, lookupPayload, context, payload, response, _this$store$order$app, _this$store$order5, _data;
|
|
3002
|
-
return _regeneratorRuntime().wrap(function
|
|
3003
|
-
while (1) switch (
|
|
3037
|
+
return _regeneratorRuntime().wrap(function _callee31$(_context31) {
|
|
3038
|
+
while (1) switch (_context31.prev = _context31.next) {
|
|
3004
3039
|
case 0:
|
|
3005
3040
|
if (this.store.order) {
|
|
3006
|
-
|
|
3041
|
+
_context31.next = 2;
|
|
3007
3042
|
break;
|
|
3008
3043
|
}
|
|
3009
3044
|
throw new Error('BaseSales 解决方案需要 order 模块支持');
|
|
@@ -3034,28 +3069,28 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3034
3069
|
channel: context.channel,
|
|
3035
3070
|
type: context.type
|
|
3036
3071
|
});
|
|
3037
|
-
|
|
3072
|
+
_context31.next = 8;
|
|
3038
3073
|
return this.request.post('/local/print-order', payload, {
|
|
3039
3074
|
osServer: true,
|
|
3040
3075
|
customToast: function customToast() {}
|
|
3041
3076
|
});
|
|
3042
3077
|
case 8:
|
|
3043
|
-
response =
|
|
3078
|
+
response = _context31.sent;
|
|
3044
3079
|
if (hasLookup) {
|
|
3045
|
-
|
|
3080
|
+
_context31.next = 12;
|
|
3046
3081
|
break;
|
|
3047
3082
|
}
|
|
3048
|
-
|
|
3083
|
+
_context31.next = 12;
|
|
3049
3084
|
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);
|
|
3050
3085
|
case 12:
|
|
3051
|
-
return
|
|
3086
|
+
return _context31.abrupt("return", response);
|
|
3052
3087
|
case 13:
|
|
3053
3088
|
case "end":
|
|
3054
|
-
return
|
|
3089
|
+
return _context31.stop();
|
|
3055
3090
|
}
|
|
3056
|
-
},
|
|
3091
|
+
}, _callee31, this);
|
|
3057
3092
|
}));
|
|
3058
|
-
function printLocalOrderReceipt(
|
|
3093
|
+
function printLocalOrderReceipt(_x27) {
|
|
3059
3094
|
return _printLocalOrderReceipt.apply(this, arguments);
|
|
3060
3095
|
}
|
|
3061
3096
|
return printLocalOrderReceipt;
|
|
@@ -3076,14 +3111,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3076
3111
|
}, {
|
|
3077
3112
|
key: "syncPaymentsToOrder",
|
|
3078
3113
|
value: function () {
|
|
3079
|
-
var _syncPaymentsToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3114
|
+
var _syncPaymentsToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(params) {
|
|
3080
3115
|
var _ref32, _params$businessCode, _this$otherParams28, _this$otherParams29, _params$channel2;
|
|
3081
3116
|
var businessCode, channel, syncParams, syncState, payments, syncResult, latestPayments, amountSnapshot, orderSnapshot, syncPayload;
|
|
3082
|
-
return _regeneratorRuntime().wrap(function
|
|
3083
|
-
while (1) switch (
|
|
3117
|
+
return _regeneratorRuntime().wrap(function _callee32$(_context32) {
|
|
3118
|
+
while (1) switch (_context32.prev = _context32.next) {
|
|
3084
3119
|
case 0:
|
|
3085
3120
|
if (this.store.order) {
|
|
3086
|
-
|
|
3121
|
+
_context32.next = 2;
|
|
3087
3122
|
break;
|
|
3088
3123
|
}
|
|
3089
3124
|
throw new Error('order 模块未初始化');
|
|
@@ -3099,14 +3134,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3099
3134
|
} : {});
|
|
3100
3135
|
syncState = this.store.order.getOrderSyncState();
|
|
3101
3136
|
if (!(params.submitWhenPaid && syncState === 'submitting')) {
|
|
3102
|
-
|
|
3137
|
+
_context32.next = 9;
|
|
3103
3138
|
break;
|
|
3104
3139
|
}
|
|
3105
3140
|
this.queueLatestAutoPaymentSync();
|
|
3106
|
-
return
|
|
3141
|
+
return _context32.abrupt("return", this.store.order.syncPaymentsToOrder(syncParams));
|
|
3107
3142
|
case 9:
|
|
3108
3143
|
payments = params.payments || [];
|
|
3109
|
-
|
|
3144
|
+
_context32.next = 12;
|
|
3110
3145
|
return this.effectsEmit(BaseSalesHookNames.onPaymentSyncStart, {
|
|
3111
3146
|
payments: payments,
|
|
3112
3147
|
params: syncParams,
|
|
@@ -3114,11 +3149,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3114
3149
|
orderSnapshot: this.store.order.getOrderSnapshot()
|
|
3115
3150
|
});
|
|
3116
3151
|
case 12:
|
|
3117
|
-
|
|
3118
|
-
|
|
3152
|
+
_context32.prev = 12;
|
|
3153
|
+
_context32.next = 15;
|
|
3119
3154
|
return this.store.order.syncPaymentsToOrder(syncParams);
|
|
3120
3155
|
case 15:
|
|
3121
|
-
syncResult =
|
|
3156
|
+
syncResult = _context32.sent;
|
|
3122
3157
|
latestPayments = this.store.order.getOrderPayments();
|
|
3123
3158
|
amountSnapshot = this.store.order.getOrderAmountSnapshot();
|
|
3124
3159
|
orderSnapshot = this.store.order.getOrderSnapshot();
|
|
@@ -3136,25 +3171,25 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3136
3171
|
depositAmount: syncResult.depositAmount,
|
|
3137
3172
|
orderExpectedAmount: syncResult.orderExpectedAmount
|
|
3138
3173
|
};
|
|
3139
|
-
|
|
3174
|
+
_context32.next = 22;
|
|
3140
3175
|
return this.effectsEmit(BaseSalesHookNames.onPaymentSyncEnd, syncPayload);
|
|
3141
3176
|
case 22:
|
|
3142
3177
|
if (!(syncResult.isDepositFullyPaid && !syncResult.isOrderFullyPaid)) {
|
|
3143
|
-
|
|
3178
|
+
_context32.next = 25;
|
|
3144
3179
|
break;
|
|
3145
3180
|
}
|
|
3146
|
-
|
|
3181
|
+
_context32.next = 25;
|
|
3147
3182
|
return this.effectsEmit(BaseSalesHookNames.onDepositPaymentSyncEnd, syncPayload);
|
|
3148
3183
|
case 25:
|
|
3149
3184
|
this.scheduleQueuedAutoPaymentSyncFlush(0);
|
|
3150
|
-
return
|
|
3185
|
+
return _context32.abrupt("return", syncResult);
|
|
3151
3186
|
case 29:
|
|
3152
|
-
|
|
3153
|
-
|
|
3154
|
-
|
|
3187
|
+
_context32.prev = 29;
|
|
3188
|
+
_context32.t0 = _context32["catch"](12);
|
|
3189
|
+
_context32.next = 33;
|
|
3155
3190
|
return this.effectsEmit(BaseSalesHookNames.onPaymentSyncEnd, {
|
|
3156
3191
|
ok: false,
|
|
3157
|
-
error:
|
|
3192
|
+
error: _context32.t0,
|
|
3158
3193
|
payments: this.store.order.getOrderPayments(),
|
|
3159
3194
|
params: syncParams,
|
|
3160
3195
|
amountSnapshot: this.store.order.getOrderAmountSnapshot(),
|
|
@@ -3162,14 +3197,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3162
3197
|
});
|
|
3163
3198
|
case 33:
|
|
3164
3199
|
this.scheduleQueuedAutoPaymentSyncFlush(0);
|
|
3165
|
-
throw
|
|
3200
|
+
throw _context32.t0;
|
|
3166
3201
|
case 35:
|
|
3167
3202
|
case "end":
|
|
3168
|
-
return
|
|
3203
|
+
return _context32.stop();
|
|
3169
3204
|
}
|
|
3170
|
-
},
|
|
3205
|
+
}, _callee32, this, [[12, 29]]);
|
|
3171
3206
|
}));
|
|
3172
|
-
function syncPaymentsToOrder(
|
|
3207
|
+
function syncPaymentsToOrder(_x28) {
|
|
3173
3208
|
return _syncPaymentsToOrder.apply(this, arguments);
|
|
3174
3209
|
}
|
|
3175
3210
|
return syncPaymentsToOrder;
|
|
@@ -3218,46 +3253,46 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3218
3253
|
}, {
|
|
3219
3254
|
key: "flushQueuedAutoPaymentSync",
|
|
3220
3255
|
value: function () {
|
|
3221
|
-
var _flushQueuedAutoPaymentSync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3256
|
+
var _flushQueuedAutoPaymentSync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33() {
|
|
3222
3257
|
var payments;
|
|
3223
|
-
return _regeneratorRuntime().wrap(function
|
|
3224
|
-
while (1) switch (
|
|
3258
|
+
return _regeneratorRuntime().wrap(function _callee33$(_context33) {
|
|
3259
|
+
while (1) switch (_context33.prev = _context33.next) {
|
|
3225
3260
|
case 0:
|
|
3226
3261
|
if (this.store.order) {
|
|
3227
|
-
|
|
3262
|
+
_context33.next = 2;
|
|
3228
3263
|
break;
|
|
3229
3264
|
}
|
|
3230
|
-
return
|
|
3265
|
+
return _context33.abrupt("return");
|
|
3231
3266
|
case 2:
|
|
3232
3267
|
if (!(!this.queuedAutoPaymentSync || this.autoPaymentSyncFlushing)) {
|
|
3233
|
-
|
|
3268
|
+
_context33.next = 4;
|
|
3234
3269
|
break;
|
|
3235
3270
|
}
|
|
3236
|
-
return
|
|
3271
|
+
return _context33.abrupt("return");
|
|
3237
3272
|
case 4:
|
|
3238
3273
|
if (!(this.store.order.getOrderSyncState() === 'submitting')) {
|
|
3239
|
-
|
|
3274
|
+
_context33.next = 7;
|
|
3240
3275
|
break;
|
|
3241
3276
|
}
|
|
3242
3277
|
this.scheduleQueuedAutoPaymentSyncFlush();
|
|
3243
|
-
return
|
|
3278
|
+
return _context33.abrupt("return");
|
|
3244
3279
|
case 7:
|
|
3245
3280
|
this.autoPaymentSyncFlushing = true;
|
|
3246
|
-
|
|
3281
|
+
_context33.prev = 8;
|
|
3247
3282
|
case 9:
|
|
3248
3283
|
if (!this.queuedAutoPaymentSync) {
|
|
3249
|
-
|
|
3284
|
+
_context33.next = 18;
|
|
3250
3285
|
break;
|
|
3251
3286
|
}
|
|
3252
3287
|
this.queuedAutoPaymentSync = false;
|
|
3253
3288
|
payments = this.store.order.getOrderPayments();
|
|
3254
3289
|
if (payments.length) {
|
|
3255
|
-
|
|
3290
|
+
_context33.next = 14;
|
|
3256
3291
|
break;
|
|
3257
3292
|
}
|
|
3258
|
-
return
|
|
3293
|
+
return _context33.abrupt("continue", 9);
|
|
3259
3294
|
case 14:
|
|
3260
|
-
|
|
3295
|
+
_context33.next = 16;
|
|
3261
3296
|
return this.syncPaymentsToOrder({
|
|
3262
3297
|
payments: payments,
|
|
3263
3298
|
paymentStatus: this.getPaymentStatusForSync(payments),
|
|
@@ -3265,29 +3300,29 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3265
3300
|
smallTicketDataFlag: 1
|
|
3266
3301
|
});
|
|
3267
3302
|
case 16:
|
|
3268
|
-
|
|
3303
|
+
_context33.next = 9;
|
|
3269
3304
|
break;
|
|
3270
3305
|
case 18:
|
|
3271
|
-
|
|
3306
|
+
_context33.next = 23;
|
|
3272
3307
|
break;
|
|
3273
3308
|
case 20:
|
|
3274
|
-
|
|
3275
|
-
|
|
3309
|
+
_context33.prev = 20;
|
|
3310
|
+
_context33.t0 = _context33["catch"](8);
|
|
3276
3311
|
this.logError('queued auto sync payments failed', {
|
|
3277
|
-
error:
|
|
3312
|
+
error: _context33.t0 instanceof Error ? _context33.t0.message : String(_context33.t0)
|
|
3278
3313
|
});
|
|
3279
3314
|
case 23:
|
|
3280
|
-
|
|
3315
|
+
_context33.prev = 23;
|
|
3281
3316
|
this.autoPaymentSyncFlushing = false;
|
|
3282
3317
|
if (this.queuedAutoPaymentSync) {
|
|
3283
3318
|
this.scheduleQueuedAutoPaymentSyncFlush(0);
|
|
3284
3319
|
}
|
|
3285
|
-
return
|
|
3320
|
+
return _context33.finish(23);
|
|
3286
3321
|
case 27:
|
|
3287
3322
|
case "end":
|
|
3288
|
-
return
|
|
3323
|
+
return _context33.stop();
|
|
3289
3324
|
}
|
|
3290
|
-
},
|
|
3325
|
+
}, _callee33, this, [[8, 20, 23, 27]]);
|
|
3291
3326
|
}));
|
|
3292
3327
|
function flushQueuedAutoPaymentSync() {
|
|
3293
3328
|
return _flushQueuedAutoPaymentSync.apply(this, arguments);
|
|
@@ -3311,35 +3346,35 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3311
3346
|
}, {
|
|
3312
3347
|
key: "addOrderPaymentAsync",
|
|
3313
3348
|
value: (function () {
|
|
3314
|
-
var _addOrderPaymentAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3349
|
+
var _addOrderPaymentAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(payment) {
|
|
3315
3350
|
var paymentRecord, hasPaymentNumber, devicePrefix;
|
|
3316
|
-
return _regeneratorRuntime().wrap(function
|
|
3317
|
-
while (1) switch (
|
|
3351
|
+
return _regeneratorRuntime().wrap(function _callee34$(_context34) {
|
|
3352
|
+
while (1) switch (_context34.prev = _context34.next) {
|
|
3318
3353
|
case 0:
|
|
3319
3354
|
paymentRecord = payment;
|
|
3320
3355
|
hasPaymentNumber = String(paymentRecord.payment_number || '').trim() !== '';
|
|
3321
3356
|
if (!hasPaymentNumber) {
|
|
3322
|
-
|
|
3357
|
+
_context34.next = 6;
|
|
3323
3358
|
break;
|
|
3324
3359
|
}
|
|
3325
|
-
|
|
3326
|
-
|
|
3360
|
+
_context34.t0 = 'LOCAL';
|
|
3361
|
+
_context34.next = 9;
|
|
3327
3362
|
break;
|
|
3328
3363
|
case 6:
|
|
3329
|
-
|
|
3364
|
+
_context34.next = 8;
|
|
3330
3365
|
return this.getPaymentNumberDevicePrefixAsync();
|
|
3331
3366
|
case 8:
|
|
3332
|
-
|
|
3367
|
+
_context34.t0 = _context34.sent;
|
|
3333
3368
|
case 9:
|
|
3334
|
-
devicePrefix =
|
|
3335
|
-
return
|
|
3369
|
+
devicePrefix = _context34.t0;
|
|
3370
|
+
return _context34.abrupt("return", this.addOrderPaymentWithDevicePrefix(payment, devicePrefix));
|
|
3336
3371
|
case 11:
|
|
3337
3372
|
case "end":
|
|
3338
|
-
return
|
|
3373
|
+
return _context34.stop();
|
|
3339
3374
|
}
|
|
3340
|
-
},
|
|
3375
|
+
}, _callee34, this);
|
|
3341
3376
|
}));
|
|
3342
|
-
function addOrderPaymentAsync(
|
|
3377
|
+
function addOrderPaymentAsync(_x29) {
|
|
3343
3378
|
return _addOrderPaymentAsync.apply(this, arguments);
|
|
3344
3379
|
}
|
|
3345
3380
|
return addOrderPaymentAsync;
|
|
@@ -3408,7 +3443,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3408
3443
|
}, {
|
|
3409
3444
|
key: "updateOrderPayment",
|
|
3410
3445
|
value: (function () {
|
|
3411
|
-
var _updateOrderPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3446
|
+
var _updateOrderPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35(paymentIdentity, updates) {
|
|
3412
3447
|
var _result$payment, _result$payment2;
|
|
3413
3448
|
var options,
|
|
3414
3449
|
matchMode,
|
|
@@ -3425,13 +3460,13 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3425
3460
|
shouldSubmit,
|
|
3426
3461
|
syncResult,
|
|
3427
3462
|
_options$smallTicketD2,
|
|
3428
|
-
|
|
3429
|
-
return _regeneratorRuntime().wrap(function
|
|
3430
|
-
while (1) switch (
|
|
3463
|
+
_args35 = arguments;
|
|
3464
|
+
return _regeneratorRuntime().wrap(function _callee35$(_context35) {
|
|
3465
|
+
while (1) switch (_context35.prev = _context35.next) {
|
|
3431
3466
|
case 0:
|
|
3432
|
-
options =
|
|
3467
|
+
options = _args35.length > 2 && _args35[2] !== undefined ? _args35[2] : {};
|
|
3433
3468
|
if (this.store.order) {
|
|
3434
|
-
|
|
3469
|
+
_context35.next = 3;
|
|
3435
3470
|
break;
|
|
3436
3471
|
}
|
|
3437
3472
|
throw new Error('order 模块未初始化');
|
|
@@ -3440,15 +3475,15 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3440
3475
|
previousMatch = resolveOrderPaymentIdentity(this.store.order.getOrderPayments(), paymentIdentity, matchMode);
|
|
3441
3476
|
previousPayment = previousMatch === null || previousMatch === void 0 ? void 0 : previousMatch.payment;
|
|
3442
3477
|
if (!((previousPayment === null || previousPayment === void 0 ? void 0 : previousPayment.status) === 'paid' && !options.applyUpdatesWhenPaid)) {
|
|
3443
|
-
|
|
3478
|
+
_context35.next = 13;
|
|
3444
3479
|
break;
|
|
3445
3480
|
}
|
|
3446
3481
|
currentPayments = this.store.order.getOrderPayments();
|
|
3447
3482
|
if (!(options.submitWhenPaid && options.forceSubmitIfPaid)) {
|
|
3448
|
-
|
|
3483
|
+
_context35.next = 12;
|
|
3449
3484
|
break;
|
|
3450
3485
|
}
|
|
3451
|
-
|
|
3486
|
+
_context35.next = 11;
|
|
3452
3487
|
return this.syncPaymentsToOrder({
|
|
3453
3488
|
payments: currentPayments,
|
|
3454
3489
|
paymentStatus: this.getPaymentStatusForSync(currentPayments),
|
|
@@ -3456,9 +3491,9 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3456
3491
|
smallTicketDataFlag: (_options$smallTicketD = options.smallTicketDataFlag) !== null && _options$smallTicketD !== void 0 ? _options$smallTicketD : 1
|
|
3457
3492
|
});
|
|
3458
3493
|
case 11:
|
|
3459
|
-
_syncResult =
|
|
3494
|
+
_syncResult = _context35.sent;
|
|
3460
3495
|
case 12:
|
|
3461
|
-
return
|
|
3496
|
+
return _context35.abrupt("return", _objectSpread({
|
|
3462
3497
|
updated: false,
|
|
3463
3498
|
payment: previousPayment,
|
|
3464
3499
|
payments: currentPayments,
|
|
@@ -3467,44 +3502,44 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3467
3502
|
syncResult: _syncResult
|
|
3468
3503
|
} : {}));
|
|
3469
3504
|
case 13:
|
|
3470
|
-
|
|
3505
|
+
_context35.next = 15;
|
|
3471
3506
|
return this.store.order.updateOrderPayment(paymentIdentity, updates, {
|
|
3472
3507
|
matchBy: matchMode
|
|
3473
3508
|
});
|
|
3474
3509
|
case 15:
|
|
3475
|
-
result =
|
|
3510
|
+
result = _context35.sent;
|
|
3476
3511
|
if (!(options.persistDraft !== false)) {
|
|
3477
|
-
|
|
3512
|
+
_context35.next = 29;
|
|
3478
3513
|
break;
|
|
3479
3514
|
}
|
|
3480
|
-
|
|
3481
|
-
|
|
3515
|
+
_context35.prev = 17;
|
|
3516
|
+
_context35.next = 20;
|
|
3482
3517
|
return this.saveSalesOrderDraft();
|
|
3483
3518
|
case 20:
|
|
3484
|
-
draftResult =
|
|
3485
|
-
|
|
3519
|
+
draftResult = _context35.sent;
|
|
3520
|
+
_context35.next = 29;
|
|
3486
3521
|
break;
|
|
3487
3522
|
case 23:
|
|
3488
|
-
|
|
3489
|
-
|
|
3490
|
-
draftError =
|
|
3523
|
+
_context35.prev = 23;
|
|
3524
|
+
_context35.t0 = _context35["catch"](17);
|
|
3525
|
+
draftError = _context35.t0;
|
|
3491
3526
|
this.logError('updateOrderPayment: 保存支付草稿失败', {
|
|
3492
3527
|
paymentIdentity: paymentIdentity,
|
|
3493
|
-
error:
|
|
3528
|
+
error: _context35.t0 instanceof Error ? _context35.t0.message : String(_context35.t0)
|
|
3494
3529
|
});
|
|
3495
3530
|
if (options.submitWhenPaid) {
|
|
3496
|
-
|
|
3531
|
+
_context35.next = 29;
|
|
3497
3532
|
break;
|
|
3498
3533
|
}
|
|
3499
|
-
throw
|
|
3534
|
+
throw _context35.t0;
|
|
3500
3535
|
case 29:
|
|
3501
3536
|
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';
|
|
3502
3537
|
shouldSubmit = Boolean(options.submitWhenPaid && ((_result$payment2 = result.payment) === null || _result$payment2 === void 0 ? void 0 : _result$payment2.status) === 'paid' && (becamePaid || options.forceSubmitIfPaid));
|
|
3503
3538
|
if (!shouldSubmit) {
|
|
3504
|
-
|
|
3539
|
+
_context35.next = 35;
|
|
3505
3540
|
break;
|
|
3506
3541
|
}
|
|
3507
|
-
|
|
3542
|
+
_context35.next = 34;
|
|
3508
3543
|
return this.syncPaymentsToOrder({
|
|
3509
3544
|
payments: result.payments,
|
|
3510
3545
|
paymentStatus: this.getPaymentStatusForSync(result.payments),
|
|
@@ -3512,9 +3547,9 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3512
3547
|
smallTicketDataFlag: (_options$smallTicketD2 = options.smallTicketDataFlag) !== null && _options$smallTicketD2 !== void 0 ? _options$smallTicketD2 : 1
|
|
3513
3548
|
});
|
|
3514
3549
|
case 34:
|
|
3515
|
-
syncResult =
|
|
3550
|
+
syncResult = _context35.sent;
|
|
3516
3551
|
case 35:
|
|
3517
|
-
return
|
|
3552
|
+
return _context35.abrupt("return", _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, result), draftResult !== undefined ? {
|
|
3518
3553
|
draftResult: draftResult
|
|
3519
3554
|
} : {}), draftError !== undefined ? {
|
|
3520
3555
|
draftError: draftError
|
|
@@ -3523,11 +3558,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3523
3558
|
} : {}));
|
|
3524
3559
|
case 36:
|
|
3525
3560
|
case "end":
|
|
3526
|
-
return
|
|
3561
|
+
return _context35.stop();
|
|
3527
3562
|
}
|
|
3528
|
-
},
|
|
3563
|
+
}, _callee35, this, [[17, 23]]);
|
|
3529
3564
|
}));
|
|
3530
|
-
function updateOrderPayment(
|
|
3565
|
+
function updateOrderPayment(_x30, _x31) {
|
|
3531
3566
|
return _updateOrderPayment.apply(this, arguments);
|
|
3532
3567
|
}
|
|
3533
3568
|
return updateOrderPayment;
|
|
@@ -3549,24 +3584,24 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3549
3584
|
}, {
|
|
3550
3585
|
key: "updateVoucherOrderPaymentsAsync",
|
|
3551
3586
|
value: function () {
|
|
3552
|
-
var _updateVoucherOrderPaymentsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3553
|
-
return _regeneratorRuntime().wrap(function
|
|
3554
|
-
while (1) switch (
|
|
3587
|
+
var _updateVoucherOrderPaymentsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(payments, options) {
|
|
3588
|
+
return _regeneratorRuntime().wrap(function _callee36$(_context36) {
|
|
3589
|
+
while (1) switch (_context36.prev = _context36.next) {
|
|
3555
3590
|
case 0:
|
|
3556
3591
|
if (this.store.order) {
|
|
3557
|
-
|
|
3592
|
+
_context36.next = 2;
|
|
3558
3593
|
break;
|
|
3559
3594
|
}
|
|
3560
3595
|
throw new Error('order 模块未初始化');
|
|
3561
3596
|
case 2:
|
|
3562
|
-
return
|
|
3597
|
+
return _context36.abrupt("return", this.store.order.updateVoucherOrderPaymentsAsync(payments, options));
|
|
3563
3598
|
case 3:
|
|
3564
3599
|
case "end":
|
|
3565
|
-
return
|
|
3600
|
+
return _context36.stop();
|
|
3566
3601
|
}
|
|
3567
|
-
},
|
|
3602
|
+
}, _callee36, this);
|
|
3568
3603
|
}));
|
|
3569
|
-
function updateVoucherOrderPaymentsAsync(
|
|
3604
|
+
function updateVoucherOrderPaymentsAsync(_x32, _x33) {
|
|
3570
3605
|
return _updateVoucherOrderPaymentsAsync.apply(this, arguments);
|
|
3571
3606
|
}
|
|
3572
3607
|
return updateVoucherOrderPaymentsAsync;
|
|
@@ -3677,20 +3712,20 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3677
3712
|
}, {
|
|
3678
3713
|
key: "initWalletData",
|
|
3679
3714
|
value: function () {
|
|
3680
|
-
var _initWalletData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3715
|
+
var _initWalletData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37(params) {
|
|
3681
3716
|
var _snapshot$identity;
|
|
3682
3717
|
var snapshot, walletBusinessData, result;
|
|
3683
|
-
return _regeneratorRuntime().wrap(function
|
|
3684
|
-
while (1) switch (
|
|
3718
|
+
return _regeneratorRuntime().wrap(function _callee37$(_context37) {
|
|
3719
|
+
while (1) switch (_context37.prev = _context37.next) {
|
|
3685
3720
|
case 0:
|
|
3686
3721
|
if (this.store.order) {
|
|
3687
|
-
|
|
3722
|
+
_context37.next = 2;
|
|
3688
3723
|
break;
|
|
3689
3724
|
}
|
|
3690
3725
|
throw new Error('order 模块未初始化');
|
|
3691
3726
|
case 2:
|
|
3692
3727
|
if (this.store.payment) {
|
|
3693
|
-
|
|
3728
|
+
_context37.next = 4;
|
|
3694
3729
|
break;
|
|
3695
3730
|
}
|
|
3696
3731
|
throw new Error('payment 模块未初始化');
|
|
@@ -3698,10 +3733,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3698
3733
|
snapshot = this.store.order.getOrderSnapshot();
|
|
3699
3734
|
walletBusinessData = this.buildWalletInitBusinessData(params);
|
|
3700
3735
|
if (walletBusinessData) {
|
|
3701
|
-
|
|
3736
|
+
_context37.next = 8;
|
|
3702
3737
|
break;
|
|
3703
3738
|
}
|
|
3704
|
-
return
|
|
3739
|
+
return _context37.abrupt("return", {
|
|
3705
3740
|
walletRecommendList: [],
|
|
3706
3741
|
userIdentificationCodes: [],
|
|
3707
3742
|
transformList: [],
|
|
@@ -3709,11 +3744,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3709
3744
|
products: []
|
|
3710
3745
|
});
|
|
3711
3746
|
case 8:
|
|
3712
|
-
|
|
3747
|
+
_context37.next = 10;
|
|
3713
3748
|
return this.store.payment.wallet.initializeWalletDataFromBusinessAsync(walletBusinessData);
|
|
3714
3749
|
case 10:
|
|
3715
|
-
result =
|
|
3716
|
-
|
|
3750
|
+
result = _context37.sent;
|
|
3751
|
+
_context37.next = 13;
|
|
3717
3752
|
return this.core.effects.emit("".concat(this.name, ":onWalletDataInitialized"), {
|
|
3718
3753
|
orderId: snapshot === null || snapshot === void 0 || (_snapshot$identity = snapshot.identity) === null || _snapshot$identity === void 0 ? void 0 : _snapshot$identity.orderId,
|
|
3719
3754
|
customerId: walletBusinessData.customer_id,
|
|
@@ -3725,14 +3760,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3725
3760
|
timestamp: Date.now()
|
|
3726
3761
|
});
|
|
3727
3762
|
case 13:
|
|
3728
|
-
return
|
|
3763
|
+
return _context37.abrupt("return", result);
|
|
3729
3764
|
case 14:
|
|
3730
3765
|
case "end":
|
|
3731
|
-
return
|
|
3766
|
+
return _context37.stop();
|
|
3732
3767
|
}
|
|
3733
|
-
},
|
|
3768
|
+
}, _callee37, this);
|
|
3734
3769
|
}));
|
|
3735
|
-
function initWalletData(
|
|
3770
|
+
function initWalletData(_x34) {
|
|
3736
3771
|
return _initWalletData.apply(this, arguments);
|
|
3737
3772
|
}
|
|
3738
3773
|
return initWalletData;
|
|
@@ -3783,23 +3818,23 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3783
3818
|
}, {
|
|
3784
3819
|
key: "publishWalletAssetsState",
|
|
3785
3820
|
value: function () {
|
|
3786
|
-
var _publishWalletAssetsState = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3787
|
-
return _regeneratorRuntime().wrap(function
|
|
3788
|
-
while (1) switch (
|
|
3821
|
+
var _publishWalletAssetsState = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38(state) {
|
|
3822
|
+
return _regeneratorRuntime().wrap(function _callee38$(_context38) {
|
|
3823
|
+
while (1) switch (_context38.prev = _context38.next) {
|
|
3789
3824
|
case 0:
|
|
3790
|
-
|
|
3825
|
+
_context38.next = 2;
|
|
3791
3826
|
return this.effectsEmit(BaseSalesHookNames.onWalletAssetsStateChanged, {
|
|
3792
3827
|
state: state
|
|
3793
3828
|
});
|
|
3794
3829
|
case 2:
|
|
3795
|
-
return
|
|
3830
|
+
return _context38.abrupt("return", state);
|
|
3796
3831
|
case 3:
|
|
3797
3832
|
case "end":
|
|
3798
|
-
return
|
|
3833
|
+
return _context38.stop();
|
|
3799
3834
|
}
|
|
3800
|
-
},
|
|
3835
|
+
}, _callee38, this);
|
|
3801
3836
|
}));
|
|
3802
|
-
function publishWalletAssetsState(
|
|
3837
|
+
function publishWalletAssetsState(_x35) {
|
|
3803
3838
|
return _publishWalletAssetsState.apply(this, arguments);
|
|
3804
3839
|
}
|
|
3805
3840
|
return publishWalletAssetsState;
|
|
@@ -3807,26 +3842,26 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3807
3842
|
}, {
|
|
3808
3843
|
key: "syncSelectedWalletAssets",
|
|
3809
3844
|
value: function () {
|
|
3810
|
-
var _syncSelectedWalletAssets = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3845
|
+
var _syncSelectedWalletAssets = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39(state) {
|
|
3811
3846
|
var paymentMethods, methodByCode, preparePayments, selectedAssetById, voucherPayments, payments;
|
|
3812
|
-
return _regeneratorRuntime().wrap(function
|
|
3813
|
-
while (1) switch (
|
|
3847
|
+
return _regeneratorRuntime().wrap(function _callee39$(_context39) {
|
|
3848
|
+
while (1) switch (_context39.prev = _context39.next) {
|
|
3814
3849
|
case 0:
|
|
3815
3850
|
if (!(!this.store.order || !this.store.payment)) {
|
|
3816
|
-
|
|
3851
|
+
_context39.next = 2;
|
|
3817
3852
|
break;
|
|
3818
3853
|
}
|
|
3819
3854
|
throw new Error('订单或支付模块未初始化');
|
|
3820
3855
|
case 2:
|
|
3821
3856
|
paymentMethods = this.getPaymentMethods();
|
|
3822
3857
|
if (!(!paymentMethods.length && state.selectedItems.length)) {
|
|
3823
|
-
|
|
3858
|
+
_context39.next = 7;
|
|
3824
3859
|
break;
|
|
3825
3860
|
}
|
|
3826
|
-
|
|
3861
|
+
_context39.next = 6;
|
|
3827
3862
|
return this.getPaymentMethodsAsync();
|
|
3828
3863
|
case 6:
|
|
3829
|
-
paymentMethods =
|
|
3864
|
+
paymentMethods = _context39.sent;
|
|
3830
3865
|
case 7:
|
|
3831
3866
|
methodByCode = new Map(paymentMethods.map(function (method) {
|
|
3832
3867
|
return [String(method.code || '').toUpperCase(), method];
|
|
@@ -3868,19 +3903,19 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3868
3903
|
payments = this.updateVoucherOrderPayments(voucherPayments, {
|
|
3869
3904
|
status: 'payment_pending'
|
|
3870
3905
|
});
|
|
3871
|
-
|
|
3906
|
+
_context39.next = 14;
|
|
3872
3907
|
return this.store.order.recalculateSummary({
|
|
3873
3908
|
createIfMissing: true
|
|
3874
3909
|
});
|
|
3875
3910
|
case 14:
|
|
3876
|
-
return
|
|
3911
|
+
return _context39.abrupt("return", payments);
|
|
3877
3912
|
case 15:
|
|
3878
3913
|
case "end":
|
|
3879
|
-
return
|
|
3914
|
+
return _context39.stop();
|
|
3880
3915
|
}
|
|
3881
|
-
},
|
|
3916
|
+
}, _callee39, this);
|
|
3882
3917
|
}));
|
|
3883
|
-
function syncSelectedWalletAssets(
|
|
3918
|
+
function syncSelectedWalletAssets(_x36) {
|
|
3884
3919
|
return _syncSelectedWalletAssets.apply(this, arguments);
|
|
3885
3920
|
}
|
|
3886
3921
|
return syncSelectedWalletAssets;
|
|
@@ -3914,29 +3949,29 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3914
3949
|
}, {
|
|
3915
3950
|
key: "importWalletAssetsSnapshot",
|
|
3916
3951
|
value: (function () {
|
|
3917
|
-
var _importWalletAssetsSnapshot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3952
|
+
var _importWalletAssetsSnapshot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40(snapshot) {
|
|
3918
3953
|
var state;
|
|
3919
|
-
return _regeneratorRuntime().wrap(function
|
|
3920
|
-
while (1) switch (
|
|
3954
|
+
return _regeneratorRuntime().wrap(function _callee40$(_context40) {
|
|
3955
|
+
while (1) switch (_context40.prev = _context40.next) {
|
|
3921
3956
|
case 0:
|
|
3922
3957
|
if (this.store.payment) {
|
|
3923
|
-
|
|
3958
|
+
_context40.next = 2;
|
|
3924
3959
|
break;
|
|
3925
3960
|
}
|
|
3926
3961
|
throw new Error('payment 模块未初始化');
|
|
3927
3962
|
case 2:
|
|
3928
3963
|
state = this.store.payment.wallet.importWalletAssetsSnapshot(snapshot);
|
|
3929
|
-
|
|
3964
|
+
_context40.next = 5;
|
|
3930
3965
|
return this.syncSelectedWalletAssets(state);
|
|
3931
3966
|
case 5:
|
|
3932
|
-
return
|
|
3967
|
+
return _context40.abrupt("return", this.publishWalletAssetsState(state));
|
|
3933
3968
|
case 6:
|
|
3934
3969
|
case "end":
|
|
3935
|
-
return
|
|
3970
|
+
return _context40.stop();
|
|
3936
3971
|
}
|
|
3937
|
-
},
|
|
3972
|
+
}, _callee40, this);
|
|
3938
3973
|
}));
|
|
3939
|
-
function importWalletAssetsSnapshot(
|
|
3974
|
+
function importWalletAssetsSnapshot(_x37) {
|
|
3940
3975
|
return _importWalletAssetsSnapshot.apply(this, arguments);
|
|
3941
3976
|
}
|
|
3942
3977
|
return importWalletAssetsSnapshot;
|
|
@@ -3948,20 +3983,20 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3948
3983
|
}, {
|
|
3949
3984
|
key: "refreshWalletAssets",
|
|
3950
3985
|
value: (function () {
|
|
3951
|
-
var _refreshWalletAssets = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3986
|
+
var _refreshWalletAssets = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41(params) {
|
|
3952
3987
|
var _previousState$custom, _businessData$custome;
|
|
3953
3988
|
var refreshSequence, wallet, businessData, emptyState, previousState, hasPreviousWalletContext, customerChanged, clearedState, refreshTask, state, committed;
|
|
3954
|
-
return _regeneratorRuntime().wrap(function
|
|
3955
|
-
while (1) switch (
|
|
3989
|
+
return _regeneratorRuntime().wrap(function _callee41$(_context41) {
|
|
3990
|
+
while (1) switch (_context41.prev = _context41.next) {
|
|
3956
3991
|
case 0:
|
|
3957
3992
|
if (this.store.order) {
|
|
3958
|
-
|
|
3993
|
+
_context41.next = 2;
|
|
3959
3994
|
break;
|
|
3960
3995
|
}
|
|
3961
3996
|
throw new Error('order 模块未初始化');
|
|
3962
3997
|
case 2:
|
|
3963
3998
|
if (this.store.payment) {
|
|
3964
|
-
|
|
3999
|
+
_context41.next = 4;
|
|
3965
4000
|
break;
|
|
3966
4001
|
}
|
|
3967
4002
|
throw new Error('payment 模块未初始化');
|
|
@@ -3970,7 +4005,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3970
4005
|
wallet = this.store.payment.wallet;
|
|
3971
4006
|
businessData = this.buildWalletInitBusinessData(params);
|
|
3972
4007
|
if (businessData) {
|
|
3973
|
-
|
|
4008
|
+
_context41.next = 12;
|
|
3974
4009
|
break;
|
|
3975
4010
|
}
|
|
3976
4011
|
wallet.clearAllCache();
|
|
@@ -3978,53 +4013,53 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3978
4013
|
this.updateVoucherOrderPayments([], {
|
|
3979
4014
|
status: 'payment_pending'
|
|
3980
4015
|
});
|
|
3981
|
-
return
|
|
4016
|
+
return _context41.abrupt("return", this.publishWalletAssetsState(emptyState));
|
|
3982
4017
|
case 12:
|
|
3983
4018
|
previousState = wallet.getWalletAssetsState();
|
|
3984
4019
|
hasPreviousWalletContext = previousState.status !== 'idle' || previousState.items.length > 0 || previousState.selectedIds.length > 0 || previousState.customerId !== undefined;
|
|
3985
4020
|
customerChanged = hasPreviousWalletContext && String((_previousState$custom = previousState.customerId) !== null && _previousState$custom !== void 0 ? _previousState$custom : '') !== String((_businessData$custome = businessData.customer_id) !== null && _businessData$custome !== void 0 ? _businessData$custome : '');
|
|
3986
4021
|
if (!customerChanged) {
|
|
3987
|
-
|
|
4022
|
+
_context41.next = 20;
|
|
3988
4023
|
break;
|
|
3989
4024
|
}
|
|
3990
4025
|
clearedState = wallet.clearWalletAssetSelection();
|
|
3991
4026
|
this.updateVoucherOrderPayments([], {
|
|
3992
4027
|
status: 'payment_pending'
|
|
3993
4028
|
});
|
|
3994
|
-
|
|
4029
|
+
_context41.next = 20;
|
|
3995
4030
|
return this.publishWalletAssetsState(clearedState);
|
|
3996
4031
|
case 20:
|
|
3997
4032
|
refreshTask = wallet.refreshWalletAssetsFromBusinessAsync(businessData, {
|
|
3998
4033
|
preserveSelection: (params === null || params === void 0 ? void 0 : params.preserveSelection) !== false && !customerChanged
|
|
3999
4034
|
});
|
|
4000
|
-
|
|
4035
|
+
_context41.next = 23;
|
|
4001
4036
|
return this.publishWalletAssetsState(wallet.getWalletAssetsState());
|
|
4002
4037
|
case 23:
|
|
4003
|
-
|
|
4038
|
+
_context41.next = 25;
|
|
4004
4039
|
return refreshTask;
|
|
4005
4040
|
case 25:
|
|
4006
|
-
state =
|
|
4041
|
+
state = _context41.sent;
|
|
4007
4042
|
if (!(refreshSequence !== this.walletAssetsRefreshSequence)) {
|
|
4008
|
-
|
|
4043
|
+
_context41.next = 28;
|
|
4009
4044
|
break;
|
|
4010
4045
|
}
|
|
4011
|
-
return
|
|
4046
|
+
return _context41.abrupt("return", wallet.getWalletAssetsState());
|
|
4012
4047
|
case 28:
|
|
4013
4048
|
if (state.status !== 'error') {
|
|
4014
4049
|
committed = this.getCommittedWalletAssets();
|
|
4015
4050
|
state = wallet.setCommittedWalletAssets(committed.ids, committed.assets);
|
|
4016
4051
|
}
|
|
4017
|
-
|
|
4052
|
+
_context41.next = 31;
|
|
4018
4053
|
return this.syncSelectedWalletAssets(state);
|
|
4019
4054
|
case 31:
|
|
4020
|
-
return
|
|
4055
|
+
return _context41.abrupt("return", this.publishWalletAssetsState(state));
|
|
4021
4056
|
case 32:
|
|
4022
4057
|
case "end":
|
|
4023
|
-
return
|
|
4058
|
+
return _context41.stop();
|
|
4024
4059
|
}
|
|
4025
|
-
},
|
|
4060
|
+
}, _callee41, this);
|
|
4026
4061
|
}));
|
|
4027
|
-
function refreshWalletAssets(
|
|
4062
|
+
function refreshWalletAssets(_x38) {
|
|
4028
4063
|
return _refreshWalletAssets.apply(this, arguments);
|
|
4029
4064
|
}
|
|
4030
4065
|
return refreshWalletAssets;
|
|
@@ -4032,13 +4067,13 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4032
4067
|
}, {
|
|
4033
4068
|
key: "selectWalletAsset",
|
|
4034
4069
|
value: (function () {
|
|
4035
|
-
var _selectWalletAsset = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4070
|
+
var _selectWalletAsset = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42(params) {
|
|
4036
4071
|
var state;
|
|
4037
|
-
return _regeneratorRuntime().wrap(function
|
|
4038
|
-
while (1) switch (
|
|
4072
|
+
return _regeneratorRuntime().wrap(function _callee42$(_context42) {
|
|
4073
|
+
while (1) switch (_context42.prev = _context42.next) {
|
|
4039
4074
|
case 0:
|
|
4040
4075
|
if (this.store.payment) {
|
|
4041
|
-
|
|
4076
|
+
_context42.next = 2;
|
|
4042
4077
|
break;
|
|
4043
4078
|
}
|
|
4044
4079
|
throw new Error('payment 模块未初始化');
|
|
@@ -4047,17 +4082,17 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4047
4082
|
selected: params.selected,
|
|
4048
4083
|
source: params.source
|
|
4049
4084
|
});
|
|
4050
|
-
|
|
4085
|
+
_context42.next = 5;
|
|
4051
4086
|
return this.syncSelectedWalletAssets(state);
|
|
4052
4087
|
case 5:
|
|
4053
|
-
return
|
|
4088
|
+
return _context42.abrupt("return", this.publishWalletAssetsState(state));
|
|
4054
4089
|
case 6:
|
|
4055
4090
|
case "end":
|
|
4056
|
-
return
|
|
4091
|
+
return _context42.stop();
|
|
4057
4092
|
}
|
|
4058
|
-
},
|
|
4093
|
+
}, _callee42, this);
|
|
4059
4094
|
}));
|
|
4060
|
-
function selectWalletAsset(
|
|
4095
|
+
function selectWalletAsset(_x39) {
|
|
4061
4096
|
return _selectWalletAsset.apply(this, arguments);
|
|
4062
4097
|
}
|
|
4063
4098
|
return selectWalletAsset;
|
|
@@ -4065,29 +4100,29 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4065
4100
|
}, {
|
|
4066
4101
|
key: "updateWalletAssetAmount",
|
|
4067
4102
|
value: (function () {
|
|
4068
|
-
var _updateWalletAssetAmount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4103
|
+
var _updateWalletAssetAmount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(params) {
|
|
4069
4104
|
var state;
|
|
4070
|
-
return _regeneratorRuntime().wrap(function
|
|
4071
|
-
while (1) switch (
|
|
4105
|
+
return _regeneratorRuntime().wrap(function _callee43$(_context43) {
|
|
4106
|
+
while (1) switch (_context43.prev = _context43.next) {
|
|
4072
4107
|
case 0:
|
|
4073
4108
|
if (this.store.payment) {
|
|
4074
|
-
|
|
4109
|
+
_context43.next = 2;
|
|
4075
4110
|
break;
|
|
4076
4111
|
}
|
|
4077
4112
|
throw new Error('payment 模块未初始化');
|
|
4078
4113
|
case 2:
|
|
4079
4114
|
state = this.store.payment.wallet.updateWalletAssetAmount(params.assetId, params.amount);
|
|
4080
|
-
|
|
4115
|
+
_context43.next = 5;
|
|
4081
4116
|
return this.syncSelectedWalletAssets(state);
|
|
4082
4117
|
case 5:
|
|
4083
|
-
return
|
|
4118
|
+
return _context43.abrupt("return", this.publishWalletAssetsState(state));
|
|
4084
4119
|
case 6:
|
|
4085
4120
|
case "end":
|
|
4086
|
-
return
|
|
4121
|
+
return _context43.stop();
|
|
4087
4122
|
}
|
|
4088
|
-
},
|
|
4123
|
+
}, _callee43, this);
|
|
4089
4124
|
}));
|
|
4090
|
-
function updateWalletAssetAmount(
|
|
4125
|
+
function updateWalletAssetAmount(_x40) {
|
|
4091
4126
|
return _updateWalletAssetAmount.apply(this, arguments);
|
|
4092
4127
|
}
|
|
4093
4128
|
return updateWalletAssetAmount;
|
|
@@ -4095,13 +4130,13 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4095
4130
|
}, {
|
|
4096
4131
|
key: "scanWalletAsset",
|
|
4097
4132
|
value: (function () {
|
|
4098
|
-
var _scanWalletAsset = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4133
|
+
var _scanWalletAsset = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44(code) {
|
|
4099
4134
|
var wallet, businessData, result;
|
|
4100
|
-
return _regeneratorRuntime().wrap(function
|
|
4101
|
-
while (1) switch (
|
|
4135
|
+
return _regeneratorRuntime().wrap(function _callee44$(_context44) {
|
|
4136
|
+
while (1) switch (_context44.prev = _context44.next) {
|
|
4102
4137
|
case 0:
|
|
4103
4138
|
if (this.store.payment) {
|
|
4104
|
-
|
|
4139
|
+
_context44.next = 2;
|
|
4105
4140
|
break;
|
|
4106
4141
|
}
|
|
4107
4142
|
throw new Error('payment 模块未初始化');
|
|
@@ -4111,28 +4146,28 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4111
4146
|
if (businessData) {
|
|
4112
4147
|
wallet.generateWalletParams(businessData);
|
|
4113
4148
|
}
|
|
4114
|
-
|
|
4149
|
+
_context44.next = 7;
|
|
4115
4150
|
return wallet.scanWalletAssetAsync(code);
|
|
4116
4151
|
case 7:
|
|
4117
|
-
result =
|
|
4152
|
+
result = _context44.sent;
|
|
4118
4153
|
if (!(result.type === 'normalCode')) {
|
|
4119
|
-
|
|
4154
|
+
_context44.next = 13;
|
|
4120
4155
|
break;
|
|
4121
4156
|
}
|
|
4122
|
-
|
|
4157
|
+
_context44.next = 11;
|
|
4123
4158
|
return this.syncSelectedWalletAssets(result.state);
|
|
4124
4159
|
case 11:
|
|
4125
|
-
|
|
4160
|
+
_context44.next = 13;
|
|
4126
4161
|
return this.publishWalletAssetsState(result.state);
|
|
4127
4162
|
case 13:
|
|
4128
|
-
return
|
|
4163
|
+
return _context44.abrupt("return", result);
|
|
4129
4164
|
case 14:
|
|
4130
4165
|
case "end":
|
|
4131
|
-
return
|
|
4166
|
+
return _context44.stop();
|
|
4132
4167
|
}
|
|
4133
|
-
},
|
|
4168
|
+
}, _callee44, this);
|
|
4134
4169
|
}));
|
|
4135
|
-
function scanWalletAsset(
|
|
4170
|
+
function scanWalletAsset(_x41) {
|
|
4136
4171
|
return _scanWalletAsset.apply(this, arguments);
|
|
4137
4172
|
}
|
|
4138
4173
|
return scanWalletAsset;
|
|
@@ -4140,27 +4175,27 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4140
4175
|
}, {
|
|
4141
4176
|
key: "clearWalletAssetSelection",
|
|
4142
4177
|
value: (function () {
|
|
4143
|
-
var _clearWalletAssetSelection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4178
|
+
var _clearWalletAssetSelection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee45() {
|
|
4144
4179
|
var state;
|
|
4145
|
-
return _regeneratorRuntime().wrap(function
|
|
4146
|
-
while (1) switch (
|
|
4180
|
+
return _regeneratorRuntime().wrap(function _callee45$(_context45) {
|
|
4181
|
+
while (1) switch (_context45.prev = _context45.next) {
|
|
4147
4182
|
case 0:
|
|
4148
4183
|
if (this.store.payment) {
|
|
4149
|
-
|
|
4184
|
+
_context45.next = 2;
|
|
4150
4185
|
break;
|
|
4151
4186
|
}
|
|
4152
4187
|
throw new Error('payment 模块未初始化');
|
|
4153
4188
|
case 2:
|
|
4154
4189
|
state = this.store.payment.wallet.clearWalletAssetSelection();
|
|
4155
|
-
|
|
4190
|
+
_context45.next = 5;
|
|
4156
4191
|
return this.syncSelectedWalletAssets(state);
|
|
4157
4192
|
case 5:
|
|
4158
|
-
return
|
|
4193
|
+
return _context45.abrupt("return", this.publishWalletAssetsState(state));
|
|
4159
4194
|
case 6:
|
|
4160
4195
|
case "end":
|
|
4161
|
-
return
|
|
4196
|
+
return _context45.stop();
|
|
4162
4197
|
}
|
|
4163
|
-
},
|
|
4198
|
+
}, _callee45, this);
|
|
4164
4199
|
}));
|
|
4165
4200
|
function clearWalletAssetSelection() {
|
|
4166
4201
|
return _clearWalletAssetSelection.apply(this, arguments);
|
|
@@ -4190,35 +4225,35 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4190
4225
|
}, {
|
|
4191
4226
|
key: "getPaymentMethodsAsync",
|
|
4192
4227
|
value: (function () {
|
|
4193
|
-
var _getPaymentMethodsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4228
|
+
var _getPaymentMethodsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee46() {
|
|
4194
4229
|
var response, paymentMethods;
|
|
4195
|
-
return _regeneratorRuntime().wrap(function
|
|
4196
|
-
while (1) switch (
|
|
4230
|
+
return _regeneratorRuntime().wrap(function _callee46$(_context46) {
|
|
4231
|
+
while (1) switch (_context46.prev = _context46.next) {
|
|
4197
4232
|
case 0:
|
|
4198
|
-
|
|
4199
|
-
|
|
4233
|
+
_context46.prev = 0;
|
|
4234
|
+
_context46.next = 3;
|
|
4200
4235
|
return this.request.get('/pay/custom-payment/all', {
|
|
4201
4236
|
filterPaymentMethods: true
|
|
4202
4237
|
}, {
|
|
4203
4238
|
osServer: true
|
|
4204
4239
|
});
|
|
4205
4240
|
case 3:
|
|
4206
|
-
response =
|
|
4241
|
+
response = _context46.sent;
|
|
4207
4242
|
paymentMethods = (response === null || response === void 0 ? void 0 : response.data) || [];
|
|
4208
4243
|
this.paymentMethodsCache = Array.isArray(paymentMethods) ? _toConsumableArray(paymentMethods) : [];
|
|
4209
|
-
return
|
|
4244
|
+
return _context46.abrupt("return", this.getPaymentMethods());
|
|
4210
4245
|
case 9:
|
|
4211
|
-
|
|
4212
|
-
|
|
4246
|
+
_context46.prev = 9;
|
|
4247
|
+
_context46.t0 = _context46["catch"](0);
|
|
4213
4248
|
this.logWarning('getPaymentMethodsAsync: 获取支付方式列表失败,使用缓存列表', {
|
|
4214
|
-
error:
|
|
4249
|
+
error: _context46.t0 instanceof Error ? _context46.t0.message : String(_context46.t0)
|
|
4215
4250
|
});
|
|
4216
|
-
return
|
|
4251
|
+
return _context46.abrupt("return", this.getPaymentMethods());
|
|
4217
4252
|
case 13:
|
|
4218
4253
|
case "end":
|
|
4219
|
-
return
|
|
4254
|
+
return _context46.stop();
|
|
4220
4255
|
}
|
|
4221
|
-
},
|
|
4256
|
+
}, _callee46, this, [[0, 9]]);
|
|
4222
4257
|
}));
|
|
4223
4258
|
function getPaymentMethodsAsync() {
|
|
4224
4259
|
return _getPaymentMethodsAsync.apply(this, arguments);
|
|
@@ -4261,14 +4296,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4261
4296
|
}, {
|
|
4262
4297
|
key: "getCashPaymentConfig",
|
|
4263
4298
|
value: (function () {
|
|
4264
|
-
var _getCashPaymentConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4299
|
+
var _getCashPaymentConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee47() {
|
|
4265
4300
|
var _this$store$order11, _this$store$order11$g, _this$store$order12, _this$store$order12$g, _this$otherParams31;
|
|
4266
4301
|
var paymentMethods, paymentMethod, amountSnapshot, pendingWalletAmount, amountDue, currency, recommendedAmounts;
|
|
4267
|
-
return _regeneratorRuntime().wrap(function
|
|
4268
|
-
while (1) switch (
|
|
4302
|
+
return _regeneratorRuntime().wrap(function _callee47$(_context47) {
|
|
4303
|
+
while (1) switch (_context47.prev = _context47.next) {
|
|
4269
4304
|
case 0:
|
|
4270
4305
|
if (this.store.payment) {
|
|
4271
|
-
|
|
4306
|
+
_context47.next = 2;
|
|
4272
4307
|
break;
|
|
4273
4308
|
}
|
|
4274
4309
|
throw new Error('payment 模块未初始化');
|
|
@@ -4276,13 +4311,13 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4276
4311
|
paymentMethods = this.getPaymentMethods();
|
|
4277
4312
|
paymentMethod = this.findCashPaymentMethod(paymentMethods);
|
|
4278
4313
|
if (paymentMethod) {
|
|
4279
|
-
|
|
4314
|
+
_context47.next = 9;
|
|
4280
4315
|
break;
|
|
4281
4316
|
}
|
|
4282
|
-
|
|
4317
|
+
_context47.next = 7;
|
|
4283
4318
|
return this.getPaymentMethodsAsync();
|
|
4284
4319
|
case 7:
|
|
4285
|
-
paymentMethods =
|
|
4320
|
+
paymentMethods = _context47.sent;
|
|
4286
4321
|
paymentMethod = this.findCashPaymentMethod(paymentMethods);
|
|
4287
4322
|
case 9:
|
|
4288
4323
|
amountSnapshot = (_this$store$order11 = this.store.order) === null || _this$store$order11 === void 0 || (_this$store$order11$g = _this$store$order11.getOrderAmountSnapshot) === null || _this$store$order11$g === void 0 ? void 0 : _this$store$order11$g.call(_this$store$order11);
|
|
@@ -4290,7 +4325,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4290
4325
|
amountDue = Decimal.max(new Decimal((amountSnapshot === null || amountSnapshot === void 0 ? void 0 : amountSnapshot.amountGap) || 0).minus(pendingWalletAmount), 0).toDecimalPlaces(2).toNumber();
|
|
4291
4326
|
currency = ((_this$store$order12 = this.store.order) === null || _this$store$order12 === void 0 || (_this$store$order12$g = _this$store$order12.getTempOrder) === null || _this$store$order12$g === void 0 || (_this$store$order12$g = _this$store$order12$g.call(_this$store$order12)) === null || _this$store$order12$g === void 0 ? void 0 : _this$store$order12$g.currency_code) || ((_this$otherParams31 = this.otherParams) === null || _this$otherParams31 === void 0 ? void 0 : _this$otherParams31.currency) || 'USD';
|
|
4292
4327
|
recommendedAmounts = amountDue > 0 ? this.store.payment.cash.getRecommendedAmount(amountDue, currency) : [];
|
|
4293
|
-
return
|
|
4328
|
+
return _context47.abrupt("return", {
|
|
4294
4329
|
available: Boolean(paymentMethod && amountDue > 0),
|
|
4295
4330
|
paymentMethod: paymentMethod,
|
|
4296
4331
|
amountDue: amountDue,
|
|
@@ -4298,9 +4333,9 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4298
4333
|
});
|
|
4299
4334
|
case 15:
|
|
4300
4335
|
case "end":
|
|
4301
|
-
return
|
|
4336
|
+
return _context47.stop();
|
|
4302
4337
|
}
|
|
4303
|
-
},
|
|
4338
|
+
}, _callee47, this);
|
|
4304
4339
|
}));
|
|
4305
4340
|
function getCashPaymentConfig() {
|
|
4306
4341
|
return _getCashPaymentConfig.apply(this, arguments);
|
|
@@ -4317,14 +4352,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4317
4352
|
}, {
|
|
4318
4353
|
key: "confirmWalletPayment",
|
|
4319
4354
|
value: (function () {
|
|
4320
|
-
var _confirmWalletPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4355
|
+
var _confirmWalletPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee48() {
|
|
4321
4356
|
var _this$store$order$get3, _this$store$order13, _this$store$order$get4, _this$store$order$get5, _this$store$order14;
|
|
4322
4357
|
var beforePayments, pendingWalletAmount, amountSnapshot, effectiveAmountDue, beforePaymentStatus, submitResult, restoredTempOrder, committed, walletState, latestAmountSnapshot;
|
|
4323
|
-
return _regeneratorRuntime().wrap(function
|
|
4324
|
-
while (1) switch (
|
|
4358
|
+
return _regeneratorRuntime().wrap(function _callee48$(_context48) {
|
|
4359
|
+
while (1) switch (_context48.prev = _context48.next) {
|
|
4325
4360
|
case 0:
|
|
4326
4361
|
if (this.store.order) {
|
|
4327
|
-
|
|
4362
|
+
_context48.next = 2;
|
|
4328
4363
|
break;
|
|
4329
4364
|
}
|
|
4330
4365
|
throw new Error('order 模块未初始化');
|
|
@@ -4332,7 +4367,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4332
4367
|
beforePayments = cloneDeep(this.store.order.getOrderPayments());
|
|
4333
4368
|
pendingWalletAmount = this.getPendingWalletPaymentAmount(beforePayments);
|
|
4334
4369
|
if (!pendingWalletAmount.lte(0)) {
|
|
4335
|
-
|
|
4370
|
+
_context48.next = 6;
|
|
4336
4371
|
break;
|
|
4337
4372
|
}
|
|
4338
4373
|
throw new Error('当前订单没有待确认的 Wallet 支付');
|
|
@@ -4340,74 +4375,74 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4340
4375
|
amountSnapshot = (_this$store$order$get3 = (_this$store$order13 = this.store.order).getOrderAmountSnapshot) === null || _this$store$order$get3 === void 0 ? void 0 : _this$store$order$get3.call(_this$store$order13);
|
|
4341
4376
|
effectiveAmountDue = Decimal.max(new Decimal((amountSnapshot === null || amountSnapshot === void 0 ? void 0 : amountSnapshot.amountGap) || 0).minus(pendingWalletAmount), 0);
|
|
4342
4377
|
if (!effectiveAmountDue.gt(0.01)) {
|
|
4343
|
-
|
|
4378
|
+
_context48.next = 10;
|
|
4344
4379
|
break;
|
|
4345
4380
|
}
|
|
4346
4381
|
throw new Error('Wallet 支付尚未覆盖全部待支付金额');
|
|
4347
4382
|
case 10:
|
|
4348
4383
|
beforePaymentStatus = (_this$store$order$get4 = this.store.order.getTempOrder()) === null || _this$store$order$get4 === void 0 ? void 0 : _this$store$order$get4.payment_status;
|
|
4349
|
-
|
|
4350
|
-
|
|
4384
|
+
_context48.prev = 11;
|
|
4385
|
+
_context48.next = 14;
|
|
4351
4386
|
return this.submitSalesOrder({
|
|
4352
4387
|
smallTicketDataFlag: 1,
|
|
4353
4388
|
confirmPendingVoucherPayments: true
|
|
4354
4389
|
});
|
|
4355
4390
|
case 14:
|
|
4356
|
-
submitResult =
|
|
4391
|
+
submitResult = _context48.sent;
|
|
4357
4392
|
if (!isRejectedSalesSubmitResult(submitResult)) {
|
|
4358
|
-
|
|
4393
|
+
_context48.next = 17;
|
|
4359
4394
|
break;
|
|
4360
4395
|
}
|
|
4361
4396
|
throw new Error(getSalesSubmitErrorMessage(submitResult, 'Wallet 支付确认失败'));
|
|
4362
4397
|
case 17:
|
|
4363
|
-
|
|
4398
|
+
_context48.next = 27;
|
|
4364
4399
|
break;
|
|
4365
4400
|
case 19:
|
|
4366
|
-
|
|
4367
|
-
|
|
4401
|
+
_context48.prev = 19;
|
|
4402
|
+
_context48.t0 = _context48["catch"](11);
|
|
4368
4403
|
this.store.order.setOrderPayments(beforePayments);
|
|
4369
4404
|
restoredTempOrder = this.store.order.getTempOrder();
|
|
4370
4405
|
if (restoredTempOrder && beforePaymentStatus !== undefined) {
|
|
4371
4406
|
restoredTempOrder.payment_status = beforePaymentStatus;
|
|
4372
4407
|
this.store.order.persistTempOrder();
|
|
4373
4408
|
}
|
|
4374
|
-
|
|
4409
|
+
_context48.next = 26;
|
|
4375
4410
|
return this.store.order.recalculateSummary({
|
|
4376
4411
|
createIfMissing: true
|
|
4377
4412
|
});
|
|
4378
4413
|
case 26:
|
|
4379
|
-
throw
|
|
4414
|
+
throw _context48.t0;
|
|
4380
4415
|
case 27:
|
|
4381
4416
|
if (!this.store.payment) {
|
|
4382
|
-
|
|
4417
|
+
_context48.next = 38;
|
|
4383
4418
|
break;
|
|
4384
4419
|
}
|
|
4385
|
-
|
|
4420
|
+
_context48.prev = 28;
|
|
4386
4421
|
committed = this.getCommittedWalletAssets();
|
|
4387
4422
|
walletState = this.store.payment.wallet.setCommittedWalletAssets(committed.ids, committed.assets);
|
|
4388
|
-
|
|
4423
|
+
_context48.next = 33;
|
|
4389
4424
|
return this.publishWalletAssetsState(walletState);
|
|
4390
4425
|
case 33:
|
|
4391
|
-
|
|
4426
|
+
_context48.next = 38;
|
|
4392
4427
|
break;
|
|
4393
4428
|
case 35:
|
|
4394
|
-
|
|
4395
|
-
|
|
4429
|
+
_context48.prev = 35;
|
|
4430
|
+
_context48.t1 = _context48["catch"](28);
|
|
4396
4431
|
this.logWarning('confirmWalletPayment: Wallet committed 状态同步失败', {
|
|
4397
|
-
error:
|
|
4432
|
+
error: _context48.t1 instanceof Error ? _context48.t1.message : String(_context48.t1)
|
|
4398
4433
|
});
|
|
4399
4434
|
case 38:
|
|
4400
4435
|
latestAmountSnapshot = (_this$store$order$get5 = (_this$store$order14 = this.store.order).getOrderAmountSnapshot) === null || _this$store$order$get5 === void 0 ? void 0 : _this$store$order$get5.call(_this$store$order14);
|
|
4401
|
-
return
|
|
4436
|
+
return _context48.abrupt("return", {
|
|
4402
4437
|
submitResult: submitResult,
|
|
4403
4438
|
payments: this.store.order.getOrderPayments(),
|
|
4404
4439
|
isOrderFullyPaid: new Decimal((latestAmountSnapshot === null || latestAmountSnapshot === void 0 ? void 0 : latestAmountSnapshot.amountGap) || 0).lte(0)
|
|
4405
4440
|
});
|
|
4406
4441
|
case 40:
|
|
4407
4442
|
case "end":
|
|
4408
|
-
return
|
|
4443
|
+
return _context48.stop();
|
|
4409
4444
|
}
|
|
4410
|
-
},
|
|
4445
|
+
}, _callee48, this, [[11, 19], [28, 35]]);
|
|
4411
4446
|
}));
|
|
4412
4447
|
function confirmWalletPayment() {
|
|
4413
4448
|
return _confirmWalletPayment.apply(this, arguments);
|
|
@@ -4422,38 +4457,38 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4422
4457
|
}, {
|
|
4423
4458
|
key: "payCash",
|
|
4424
4459
|
value: (function () {
|
|
4425
|
-
var _payCash = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4460
|
+
var _payCash = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee49(params) {
|
|
4426
4461
|
var _this$store$order$get6, _params$actualPaidAmo, _this$otherParams32, _this$window, _this$window$postMess;
|
|
4427
4462
|
var amount, config, paymentMethod, roundingAmount, effectivePaymentAmount, beforePayments, beforePaymentStatus, uniquePaymentNumber, paymentTimestamp, actualPaidAmount, changeAmount, shopWalletPassId, payments, payment, syncResult, committed, walletState, restoredTempOrder;
|
|
4428
|
-
return _regeneratorRuntime().wrap(function
|
|
4429
|
-
while (1) switch (
|
|
4463
|
+
return _regeneratorRuntime().wrap(function _callee49$(_context49) {
|
|
4464
|
+
while (1) switch (_context49.prev = _context49.next) {
|
|
4430
4465
|
case 0:
|
|
4431
4466
|
if (this.store.order) {
|
|
4432
|
-
|
|
4467
|
+
_context49.next = 2;
|
|
4433
4468
|
break;
|
|
4434
4469
|
}
|
|
4435
4470
|
throw new Error('order 模块未初始化');
|
|
4436
4471
|
case 2:
|
|
4437
4472
|
amount = Number(params.amount || 0);
|
|
4438
4473
|
if (!(!Number.isFinite(amount) || amount <= 0)) {
|
|
4439
|
-
|
|
4474
|
+
_context49.next = 5;
|
|
4440
4475
|
break;
|
|
4441
4476
|
}
|
|
4442
4477
|
throw new Error('现金支付金额必须大于 0');
|
|
4443
4478
|
case 5:
|
|
4444
|
-
|
|
4479
|
+
_context49.next = 7;
|
|
4445
4480
|
return this.getCashPaymentConfig();
|
|
4446
4481
|
case 7:
|
|
4447
|
-
config =
|
|
4482
|
+
config = _context49.sent;
|
|
4448
4483
|
paymentMethod = config.paymentMethod;
|
|
4449
4484
|
if (paymentMethod) {
|
|
4450
|
-
|
|
4485
|
+
_context49.next = 11;
|
|
4451
4486
|
break;
|
|
4452
4487
|
}
|
|
4453
4488
|
throw new Error('未找到可用的 CASHMANUAL 支付方式');
|
|
4454
4489
|
case 11:
|
|
4455
4490
|
if (!(config.amountDue <= 0)) {
|
|
4456
|
-
|
|
4491
|
+
_context49.next = 13;
|
|
4457
4492
|
break;
|
|
4458
4493
|
}
|
|
4459
4494
|
throw new Error('当前订单没有待支付金额');
|
|
@@ -4461,7 +4496,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4461
4496
|
roundingAmount = Number(params.roundingAmount || 0);
|
|
4462
4497
|
effectivePaymentAmount = new Decimal(amount).minus(roundingAmount);
|
|
4463
4498
|
if (!effectivePaymentAmount.gt(new Decimal(config.amountDue).plus(0.01))) {
|
|
4464
|
-
|
|
4499
|
+
_context49.next = 17;
|
|
4465
4500
|
break;
|
|
4466
4501
|
}
|
|
4467
4502
|
throw new Error('现金支付金额超过当前待支付金额');
|
|
@@ -4474,7 +4509,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4474
4509
|
changeAmount = Number(params.changeAmount || 0);
|
|
4475
4510
|
shopWalletPassId = (_this$otherParams32 = this.otherParams) === null || _this$otherParams32 === void 0 ? void 0 : _this$otherParams32.shop_wallet_pass_id;
|
|
4476
4511
|
if (!(!Number.isFinite(actualPaidAmount) || actualPaidAmount + 0.01 < amount)) {
|
|
4477
|
-
|
|
4512
|
+
_context49.next = 26;
|
|
4478
4513
|
break;
|
|
4479
4514
|
}
|
|
4480
4515
|
throw new Error('顾客实收现金不能小于支付金额');
|
|
@@ -4509,8 +4544,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4509
4544
|
var _item$metadata2;
|
|
4510
4545
|
return (item === null || item === void 0 || (_item$metadata2 = item.metadata) === null || _item$metadata2 === void 0 ? void 0 : _item$metadata2.unique_payment_number) === uniquePaymentNumber;
|
|
4511
4546
|
});
|
|
4512
|
-
|
|
4513
|
-
|
|
4547
|
+
_context49.prev = 29;
|
|
4548
|
+
_context49.next = 32;
|
|
4514
4549
|
return this.syncPaymentsToOrder({
|
|
4515
4550
|
payments: payments,
|
|
4516
4551
|
submitWhenPaid: true,
|
|
@@ -4518,50 +4553,50 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4518
4553
|
confirmPendingVoucherPayments: true
|
|
4519
4554
|
});
|
|
4520
4555
|
case 32:
|
|
4521
|
-
syncResult =
|
|
4556
|
+
syncResult = _context49.sent;
|
|
4522
4557
|
if (!isRejectedSalesSubmitResult(syncResult.submitResult)) {
|
|
4523
|
-
|
|
4558
|
+
_context49.next = 35;
|
|
4524
4559
|
break;
|
|
4525
4560
|
}
|
|
4526
4561
|
throw new Error(getSalesSubmitErrorMessage(syncResult.submitResult, '订单提交失败'));
|
|
4527
4562
|
case 35:
|
|
4528
4563
|
if (!this.store.payment) {
|
|
4529
|
-
|
|
4564
|
+
_context49.next = 40;
|
|
4530
4565
|
break;
|
|
4531
4566
|
}
|
|
4532
4567
|
committed = this.getCommittedWalletAssets();
|
|
4533
4568
|
walletState = this.store.payment.wallet.setCommittedWalletAssets(committed.ids, committed.assets);
|
|
4534
|
-
|
|
4569
|
+
_context49.next = 40;
|
|
4535
4570
|
return this.publishWalletAssetsState(walletState);
|
|
4536
4571
|
case 40:
|
|
4537
|
-
return
|
|
4572
|
+
return _context49.abrupt("return", {
|
|
4538
4573
|
payment: payment || {},
|
|
4539
4574
|
payments: this.store.order.getOrderPayments(),
|
|
4540
4575
|
syncResult: syncResult,
|
|
4541
4576
|
isOrderFullyPaid: syncResult.isOrderFullyPaid
|
|
4542
4577
|
});
|
|
4543
4578
|
case 43:
|
|
4544
|
-
|
|
4545
|
-
|
|
4579
|
+
_context49.prev = 43;
|
|
4580
|
+
_context49.t0 = _context49["catch"](29);
|
|
4546
4581
|
this.store.order.setOrderPayments(beforePayments);
|
|
4547
4582
|
restoredTempOrder = this.store.order.getTempOrder();
|
|
4548
4583
|
if (restoredTempOrder && beforePaymentStatus !== undefined) {
|
|
4549
4584
|
restoredTempOrder.payment_status = beforePaymentStatus;
|
|
4550
4585
|
this.store.order.persistTempOrder();
|
|
4551
4586
|
}
|
|
4552
|
-
|
|
4587
|
+
_context49.next = 50;
|
|
4553
4588
|
return this.store.order.recalculateSummary({
|
|
4554
4589
|
createIfMissing: true
|
|
4555
4590
|
});
|
|
4556
4591
|
case 50:
|
|
4557
|
-
throw
|
|
4592
|
+
throw _context49.t0;
|
|
4558
4593
|
case 51:
|
|
4559
4594
|
case "end":
|
|
4560
|
-
return
|
|
4595
|
+
return _context49.stop();
|
|
4561
4596
|
}
|
|
4562
|
-
},
|
|
4597
|
+
}, _callee49, this, [[29, 43]]);
|
|
4563
4598
|
}));
|
|
4564
|
-
function payCash(
|
|
4599
|
+
function payCash(_x42) {
|
|
4565
4600
|
return _payCash.apply(this, arguments);
|
|
4566
4601
|
}
|
|
4567
4602
|
return payCash;
|
|
@@ -4577,21 +4612,21 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4577
4612
|
}, {
|
|
4578
4613
|
key: "commitPaymentMethodPayment",
|
|
4579
4614
|
value: (function () {
|
|
4580
|
-
var _commitPaymentMethodPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4615
|
+
var _commitPaymentMethodPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee50(params) {
|
|
4581
4616
|
var _this$store$order$get7, _this$store$order15, _this$store$order$get8, _params$metadata, _params$originAmount;
|
|
4582
4617
|
var amount, paymentMethods, findPaymentMethod, paymentMethod, amountSnapshot, pendingWalletAmount, amountDue, beforePayments, beforePaymentStatus, paymentTimestamp, metadata, serviceCharge, serviceFee, payments, payment, syncResult, committed, walletState, restoredTempOrder;
|
|
4583
|
-
return _regeneratorRuntime().wrap(function
|
|
4584
|
-
while (1) switch (
|
|
4618
|
+
return _regeneratorRuntime().wrap(function _callee50$(_context50) {
|
|
4619
|
+
while (1) switch (_context50.prev = _context50.next) {
|
|
4585
4620
|
case 0:
|
|
4586
4621
|
if (this.store.order) {
|
|
4587
|
-
|
|
4622
|
+
_context50.next = 2;
|
|
4588
4623
|
break;
|
|
4589
4624
|
}
|
|
4590
4625
|
throw new Error('order 模块未初始化');
|
|
4591
4626
|
case 2:
|
|
4592
4627
|
amount = Number(params.amount || 0);
|
|
4593
4628
|
if (!(!Number.isFinite(amount) || amount <= 0)) {
|
|
4594
|
-
|
|
4629
|
+
_context50.next = 5;
|
|
4595
4630
|
break;
|
|
4596
4631
|
}
|
|
4597
4632
|
throw new Error('支付金额必须大于 0');
|
|
@@ -4607,17 +4642,17 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4607
4642
|
};
|
|
4608
4643
|
paymentMethod = findPaymentMethod();
|
|
4609
4644
|
if (paymentMethod) {
|
|
4610
|
-
|
|
4645
|
+
_context50.next = 13;
|
|
4611
4646
|
break;
|
|
4612
4647
|
}
|
|
4613
|
-
|
|
4648
|
+
_context50.next = 11;
|
|
4614
4649
|
return this.getPaymentMethodsAsync();
|
|
4615
4650
|
case 11:
|
|
4616
|
-
paymentMethods =
|
|
4651
|
+
paymentMethods = _context50.sent;
|
|
4617
4652
|
paymentMethod = findPaymentMethod();
|
|
4618
4653
|
case 13:
|
|
4619
4654
|
if (paymentMethod) {
|
|
4620
|
-
|
|
4655
|
+
_context50.next = 15;
|
|
4621
4656
|
break;
|
|
4622
4657
|
}
|
|
4623
4658
|
throw new Error("\u672A\u627E\u5230\u53EF\u7528\u7684\u652F\u4ED8\u65B9\u5F0F\uFF1A".concat(params.paymentMethodCode || params.paymentMethodId || ''));
|
|
@@ -4626,13 +4661,13 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4626
4661
|
pendingWalletAmount = this.getPendingWalletPaymentAmount();
|
|
4627
4662
|
amountDue = Decimal.max(new Decimal((amountSnapshot === null || amountSnapshot === void 0 ? void 0 : amountSnapshot.amountGap) || 0).minus(pendingWalletAmount), 0);
|
|
4628
4663
|
if (!amountDue.lte(0)) {
|
|
4629
|
-
|
|
4664
|
+
_context50.next = 20;
|
|
4630
4665
|
break;
|
|
4631
4666
|
}
|
|
4632
4667
|
throw new Error('当前订单没有待支付金额');
|
|
4633
4668
|
case 20:
|
|
4634
4669
|
if (!new Decimal(amount).gt(amountDue.plus(0.01))) {
|
|
4635
|
-
|
|
4670
|
+
_context50.next = 22;
|
|
4636
4671
|
break;
|
|
4637
4672
|
}
|
|
4638
4673
|
throw new Error('支付金额超过当前待支付金额');
|
|
@@ -4671,8 +4706,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4671
4706
|
var _item$metadata3;
|
|
4672
4707
|
return (item === null || item === void 0 || (_item$metadata3 = item.metadata) === null || _item$metadata3 === void 0 ? void 0 : _item$metadata3.unique_payment_number) === metadata.unique_payment_number;
|
|
4673
4708
|
});
|
|
4674
|
-
|
|
4675
|
-
|
|
4709
|
+
_context50.prev = 30;
|
|
4710
|
+
_context50.next = 33;
|
|
4676
4711
|
return this.syncPaymentsToOrder({
|
|
4677
4712
|
payments: payments,
|
|
4678
4713
|
submitWhenPaid: true,
|
|
@@ -4680,50 +4715,50 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4680
4715
|
confirmPendingVoucherPayments: true
|
|
4681
4716
|
});
|
|
4682
4717
|
case 33:
|
|
4683
|
-
syncResult =
|
|
4718
|
+
syncResult = _context50.sent;
|
|
4684
4719
|
if (!isRejectedSalesSubmitResult(syncResult.submitResult)) {
|
|
4685
|
-
|
|
4720
|
+
_context50.next = 36;
|
|
4686
4721
|
break;
|
|
4687
4722
|
}
|
|
4688
4723
|
throw new Error(getSalesSubmitErrorMessage(syncResult.submitResult, '订单提交失败'));
|
|
4689
4724
|
case 36:
|
|
4690
4725
|
if (!this.store.payment) {
|
|
4691
|
-
|
|
4726
|
+
_context50.next = 41;
|
|
4692
4727
|
break;
|
|
4693
4728
|
}
|
|
4694
4729
|
committed = this.getCommittedWalletAssets();
|
|
4695
4730
|
walletState = this.store.payment.wallet.setCommittedWalletAssets(committed.ids, committed.assets);
|
|
4696
|
-
|
|
4731
|
+
_context50.next = 41;
|
|
4697
4732
|
return this.publishWalletAssetsState(walletState);
|
|
4698
4733
|
case 41:
|
|
4699
|
-
return
|
|
4734
|
+
return _context50.abrupt("return", {
|
|
4700
4735
|
payment: payment || {},
|
|
4701
4736
|
payments: this.store.order.getOrderPayments(),
|
|
4702
4737
|
syncResult: syncResult,
|
|
4703
4738
|
isOrderFullyPaid: syncResult.isOrderFullyPaid
|
|
4704
4739
|
});
|
|
4705
4740
|
case 44:
|
|
4706
|
-
|
|
4707
|
-
|
|
4741
|
+
_context50.prev = 44;
|
|
4742
|
+
_context50.t0 = _context50["catch"](30);
|
|
4708
4743
|
this.store.order.setOrderPayments(beforePayments);
|
|
4709
4744
|
restoredTempOrder = this.store.order.getTempOrder();
|
|
4710
4745
|
if (restoredTempOrder && beforePaymentStatus !== undefined) {
|
|
4711
4746
|
restoredTempOrder.payment_status = beforePaymentStatus;
|
|
4712
4747
|
this.store.order.persistTempOrder();
|
|
4713
4748
|
}
|
|
4714
|
-
|
|
4749
|
+
_context50.next = 51;
|
|
4715
4750
|
return this.store.order.recalculateSummary({
|
|
4716
4751
|
createIfMissing: true
|
|
4717
4752
|
});
|
|
4718
4753
|
case 51:
|
|
4719
|
-
throw
|
|
4754
|
+
throw _context50.t0;
|
|
4720
4755
|
case 52:
|
|
4721
4756
|
case "end":
|
|
4722
|
-
return
|
|
4757
|
+
return _context50.stop();
|
|
4723
4758
|
}
|
|
4724
|
-
},
|
|
4759
|
+
}, _callee50, this, [[30, 44]]);
|
|
4725
4760
|
}));
|
|
4726
|
-
function commitPaymentMethodPayment(
|
|
4761
|
+
function commitPaymentMethodPayment(_x43) {
|
|
4727
4762
|
return _commitPaymentMethodPayment.apply(this, arguments);
|
|
4728
4763
|
}
|
|
4729
4764
|
return commitPaymentMethodPayment;
|
|
@@ -4738,40 +4773,40 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4738
4773
|
}, {
|
|
4739
4774
|
key: "roundAmount",
|
|
4740
4775
|
value: (function () {
|
|
4741
|
-
var _roundAmount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4776
|
+
var _roundAmount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee51(params) {
|
|
4742
4777
|
var _cashManualPayment$me, _this$otherParams$ord2, _this$otherParams$ord3;
|
|
4743
4778
|
var amount, cashManualPayment;
|
|
4744
|
-
return _regeneratorRuntime().wrap(function
|
|
4745
|
-
while (1) switch (
|
|
4779
|
+
return _regeneratorRuntime().wrap(function _callee51$(_context51) {
|
|
4780
|
+
while (1) switch (_context51.prev = _context51.next) {
|
|
4746
4781
|
case 0:
|
|
4747
4782
|
amount = params.amount;
|
|
4748
4783
|
cashManualPayment = this.paymentMethodsCache.find(function (paymentMethod) {
|
|
4749
4784
|
return paymentMethod.code === 'CASHMANUAL';
|
|
4750
4785
|
});
|
|
4751
4786
|
if (cashManualPayment !== null && cashManualPayment !== void 0 && (_cashManualPayment$me = cashManualPayment.metadata) !== null && _cashManualPayment$me !== void 0 && _cashManualPayment$me.order_rounding_switch) {
|
|
4752
|
-
|
|
4787
|
+
_context51.next = 4;
|
|
4753
4788
|
break;
|
|
4754
4789
|
}
|
|
4755
|
-
return
|
|
4790
|
+
return _context51.abrupt("return", {
|
|
4756
4791
|
originalAmount: amount.toString(),
|
|
4757
4792
|
roundedAmount: amount.toString(),
|
|
4758
4793
|
roundingDifference: '0.00'
|
|
4759
4794
|
});
|
|
4760
4795
|
case 4:
|
|
4761
4796
|
if (this.payment) {
|
|
4762
|
-
|
|
4797
|
+
_context51.next = 6;
|
|
4763
4798
|
break;
|
|
4764
4799
|
}
|
|
4765
4800
|
throw new Error('payment 模块未初始化');
|
|
4766
4801
|
case 6:
|
|
4767
|
-
return
|
|
4802
|
+
return _context51.abrupt("return", this.payment.roundAmountAsync(amount, (_this$otherParams$ord2 = this.otherParams.order_rounding_setting) === null || _this$otherParams$ord2 === void 0 ? void 0 : _this$otherParams$ord2.interval, (_this$otherParams$ord3 = this.otherParams.order_rounding_setting) === null || _this$otherParams$ord3 === void 0 ? void 0 : _this$otherParams$ord3.type));
|
|
4768
4803
|
case 7:
|
|
4769
4804
|
case "end":
|
|
4770
|
-
return
|
|
4805
|
+
return _context51.stop();
|
|
4771
4806
|
}
|
|
4772
|
-
},
|
|
4807
|
+
}, _callee51, this);
|
|
4773
4808
|
}));
|
|
4774
|
-
function roundAmount(
|
|
4809
|
+
function roundAmount(_x44) {
|
|
4775
4810
|
return _roundAmount.apply(this, arguments);
|
|
4776
4811
|
}
|
|
4777
4812
|
return roundAmount;
|
|
@@ -4786,49 +4821,49 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4786
4821
|
}, {
|
|
4787
4822
|
key: "sendCustomerPayLink",
|
|
4788
4823
|
value: (function () {
|
|
4789
|
-
var _sendCustomerPayLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4824
|
+
var _sendCustomerPayLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee52(params) {
|
|
4790
4825
|
var orderIds, _ref37, _ref38, _submitResult$data$or, _submitResult$data, _submitResult$data2, submitResult, orderId;
|
|
4791
|
-
return _regeneratorRuntime().wrap(function
|
|
4792
|
-
while (1) switch (
|
|
4826
|
+
return _regeneratorRuntime().wrap(function _callee52$(_context52) {
|
|
4827
|
+
while (1) switch (_context52.prev = _context52.next) {
|
|
4793
4828
|
case 0:
|
|
4794
4829
|
if (this.store.order) {
|
|
4795
|
-
|
|
4830
|
+
_context52.next = 2;
|
|
4796
4831
|
break;
|
|
4797
4832
|
}
|
|
4798
4833
|
throw new Error('order 模块未初始化');
|
|
4799
4834
|
case 2:
|
|
4800
4835
|
orderIds = params.order_ids || params.orderIds || [];
|
|
4801
4836
|
if (!(!orderIds.length || params.submitBeforeSend)) {
|
|
4802
|
-
|
|
4837
|
+
_context52.next = 11;
|
|
4803
4838
|
break;
|
|
4804
4839
|
}
|
|
4805
|
-
|
|
4840
|
+
_context52.next = 6;
|
|
4806
4841
|
return this.submitSalesOrder({
|
|
4807
4842
|
smallTicketDataFlag: 1
|
|
4808
4843
|
});
|
|
4809
4844
|
case 6:
|
|
4810
|
-
submitResult =
|
|
4845
|
+
submitResult = _context52.sent;
|
|
4811
4846
|
orderId = (_ref37 = (_ref38 = (_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 && _ref38 !== void 0 ? _ref38 : submitResult === null || submitResult === void 0 || (_submitResult$data2 = submitResult.data) === null || _submitResult$data2 === void 0 ? void 0 : _submitResult$data2.id) !== null && _ref37 !== void 0 ? _ref37 : submitResult === null || submitResult === void 0 ? void 0 : submitResult.id;
|
|
4812
4847
|
if (orderId) {
|
|
4813
|
-
|
|
4848
|
+
_context52.next = 10;
|
|
4814
4849
|
break;
|
|
4815
4850
|
}
|
|
4816
4851
|
throw new Error('本地订单提交云端失败,无法发送支付链接');
|
|
4817
4852
|
case 10:
|
|
4818
4853
|
orderIds = [orderId];
|
|
4819
4854
|
case 11:
|
|
4820
|
-
return
|
|
4855
|
+
return _context52.abrupt("return", this.store.order.sendCustomerPayLink({
|
|
4821
4856
|
emails: params.emails,
|
|
4822
4857
|
notify_action: params.notify_action,
|
|
4823
4858
|
order_ids: orderIds
|
|
4824
4859
|
}));
|
|
4825
4860
|
case 12:
|
|
4826
4861
|
case "end":
|
|
4827
|
-
return
|
|
4862
|
+
return _context52.stop();
|
|
4828
4863
|
}
|
|
4829
|
-
},
|
|
4864
|
+
}, _callee52, this);
|
|
4830
4865
|
}));
|
|
4831
|
-
function sendCustomerPayLink(
|
|
4866
|
+
function sendCustomerPayLink(_x45) {
|
|
4832
4867
|
return _sendCustomerPayLink.apply(this, arguments);
|
|
4833
4868
|
}
|
|
4834
4869
|
return sendCustomerPayLink;
|
|
@@ -4841,39 +4876,42 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4841
4876
|
}, {
|
|
4842
4877
|
key: "calculateProductBookingPrice",
|
|
4843
4878
|
value: function () {
|
|
4844
|
-
var _calculateProductBookingPrice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4879
|
+
var _calculateProductBookingPrice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee53(params) {
|
|
4845
4880
|
var _params$customer_id;
|
|
4846
4881
|
var quotation, customerId, authoritativeProduct, product;
|
|
4847
|
-
return _regeneratorRuntime().wrap(function
|
|
4848
|
-
while (1) switch (
|
|
4882
|
+
return _regeneratorRuntime().wrap(function _callee53$(_context53) {
|
|
4883
|
+
while (1) switch (_context53.prev = _context53.next) {
|
|
4849
4884
|
case 0:
|
|
4850
4885
|
quotation = this.store.quotation;
|
|
4851
4886
|
customerId = (_params$customer_id = params.customer_id) !== null && _params$customer_id !== void 0 ? _params$customer_id : this.getCurrentOrderCustomerId();
|
|
4852
|
-
|
|
4853
|
-
return this.
|
|
4887
|
+
_context53.next = 4;
|
|
4888
|
+
return this.prepareProductPriceQueryContext(customerId);
|
|
4854
4889
|
case 4:
|
|
4855
|
-
|
|
4890
|
+
_context53.next = 6;
|
|
4891
|
+
return this.loadProductForPriceQuery(params, customerId);
|
|
4892
|
+
case 6:
|
|
4893
|
+
authoritativeProduct = _context53.sent;
|
|
4856
4894
|
product = this.mergeProductForPriceQuery(params.product, authoritativeProduct);
|
|
4857
|
-
|
|
4895
|
+
_context53.next = 10;
|
|
4858
4896
|
return this.loadQuotationForPriceQuery({
|
|
4859
4897
|
quotation: quotation,
|
|
4860
4898
|
customer_id: customerId,
|
|
4861
4899
|
channel: params.channel
|
|
4862
4900
|
});
|
|
4863
|
-
case
|
|
4864
|
-
return
|
|
4901
|
+
case 10:
|
|
4902
|
+
return _context53.abrupt("return", calculateBaseSalesProductBookingPrice(_objectSpread(_objectSpread({}, params), {}, {
|
|
4865
4903
|
product: product,
|
|
4866
4904
|
fallback_price: authoritativeProduct ? undefined : params.fallback_price,
|
|
4867
4905
|
customer_id: customerId,
|
|
4868
|
-
quotation: quotation
|
|
4906
|
+
quotation: authoritativeProduct && this.preferAuthoritativeProductQueryPrice() ? undefined : quotation
|
|
4869
4907
|
})));
|
|
4870
|
-
case
|
|
4908
|
+
case 11:
|
|
4871
4909
|
case "end":
|
|
4872
|
-
return
|
|
4910
|
+
return _context53.stop();
|
|
4873
4911
|
}
|
|
4874
|
-
},
|
|
4912
|
+
}, _callee53, this);
|
|
4875
4913
|
}));
|
|
4876
|
-
function calculateProductBookingPrice(
|
|
4914
|
+
function calculateProductBookingPrice(_x46) {
|
|
4877
4915
|
return _calculateProductBookingPrice.apply(this, arguments);
|
|
4878
4916
|
}
|
|
4879
4917
|
return calculateProductBookingPrice;
|
|
@@ -4917,6 +4955,17 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4917
4955
|
quotationScopes: quotationScopes
|
|
4918
4956
|
};
|
|
4919
4957
|
}
|
|
4958
|
+
}, {
|
|
4959
|
+
key: "hasSmartPricingStrategies",
|
|
4960
|
+
value: function hasSmartPricingStrategies() {
|
|
4961
|
+
var _this$core3;
|
|
4962
|
+
var evaluator = (_this$core3 = this.core) === null || _this$core3 === void 0 || (_this$core3 = _this$core3.context) === null || _this$core3 === void 0 ? void 0 : _this$core3.dataVariantEvaluator;
|
|
4963
|
+
if (!evaluator || typeof evaluator.getStrategyConfigs !== 'function') {
|
|
4964
|
+
return false;
|
|
4965
|
+
}
|
|
4966
|
+
var configs = evaluator.getStrategyConfigs();
|
|
4967
|
+
return Array.isArray(configs) && configs.length > 0;
|
|
4968
|
+
}
|
|
4920
4969
|
}, {
|
|
4921
4970
|
key: "shouldRecalculateProductBookingPricesForContextChange",
|
|
4922
4971
|
value: function shouldRecalculateProductBookingPricesForContextChange(params) {
|
|
@@ -4926,6 +4975,9 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4926
4975
|
}));
|
|
4927
4976
|
var previousCustomerId = this.normalizePriceContextCustomerId(params.previousCustomerId);
|
|
4928
4977
|
var nextCustomerId = this.normalizePriceContextCustomerId(params.nextCustomerId);
|
|
4978
|
+
if (this.hasSmartPricingStrategies()) {
|
|
4979
|
+
return previousCustomerId !== nextCustomerId;
|
|
4980
|
+
}
|
|
4929
4981
|
var previousInScope = previousCustomerId ? scopedCustomerIds.has(previousCustomerId) : false;
|
|
4930
4982
|
var nextInScope = nextCustomerId ? scopedCustomerIds.has(nextCustomerId) : false;
|
|
4931
4983
|
var shouldRecalculate = false;
|
|
@@ -4943,23 +4995,26 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4943
4995
|
}, {
|
|
4944
4996
|
key: "calculateProductBookingPrices",
|
|
4945
4997
|
value: function () {
|
|
4946
|
-
var _calculateProductBookingPrices = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4998
|
+
var _calculateProductBookingPrices = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee55(paramsList) {
|
|
4947
4999
|
var _paramsList$0$custome,
|
|
4948
5000
|
_paramsList$,
|
|
4949
5001
|
_this16 = this,
|
|
4950
5002
|
_paramsList$2;
|
|
4951
5003
|
var quotation, customerId, productMapsByGroup, groups;
|
|
4952
|
-
return _regeneratorRuntime().wrap(function
|
|
4953
|
-
while (1) switch (
|
|
5004
|
+
return _regeneratorRuntime().wrap(function _callee55$(_context55) {
|
|
5005
|
+
while (1) switch (_context55.prev = _context55.next) {
|
|
4954
5006
|
case 0:
|
|
4955
5007
|
if (paramsList.length) {
|
|
4956
|
-
|
|
5008
|
+
_context55.next = 2;
|
|
4957
5009
|
break;
|
|
4958
5010
|
}
|
|
4959
|
-
return
|
|
5011
|
+
return _context55.abrupt("return", []);
|
|
4960
5012
|
case 2:
|
|
4961
5013
|
quotation = this.store.quotation;
|
|
4962
5014
|
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();
|
|
5015
|
+
_context55.next = 6;
|
|
5016
|
+
return this.prepareProductPriceQueryContext(customerId);
|
|
5017
|
+
case 6:
|
|
4963
5018
|
productMapsByGroup = new Map();
|
|
4964
5019
|
groups = new Map();
|
|
4965
5020
|
paramsList.forEach(function (params) {
|
|
@@ -4978,15 +5033,15 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4978
5033
|
group.ids.add(productId);
|
|
4979
5034
|
groups.set(groupKey, group);
|
|
4980
5035
|
});
|
|
4981
|
-
|
|
5036
|
+
_context55.next = 11;
|
|
4982
5037
|
return Promise.all(Array.from(groups.entries()).map( /*#__PURE__*/function () {
|
|
4983
|
-
var _ref40 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5038
|
+
var _ref40 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee54(_ref39) {
|
|
4984
5039
|
var _ref41, groupKey, group, productsById;
|
|
4985
|
-
return _regeneratorRuntime().wrap(function
|
|
4986
|
-
while (1) switch (
|
|
5040
|
+
return _regeneratorRuntime().wrap(function _callee54$(_context54) {
|
|
5041
|
+
while (1) switch (_context54.prev = _context54.next) {
|
|
4987
5042
|
case 0:
|
|
4988
5043
|
_ref41 = _slicedToArray(_ref39, 2), groupKey = _ref41[0], group = _ref41[1];
|
|
4989
|
-
|
|
5044
|
+
_context54.next = 3;
|
|
4990
5045
|
return _this16.loadProductsForPriceQuery({
|
|
4991
5046
|
ids: Array.from(group.ids),
|
|
4992
5047
|
schedule: group.schedule,
|
|
@@ -4994,27 +5049,27 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4994
5049
|
channel: group.channel
|
|
4995
5050
|
});
|
|
4996
5051
|
case 3:
|
|
4997
|
-
productsById =
|
|
5052
|
+
productsById = _context54.sent;
|
|
4998
5053
|
productMapsByGroup.set(groupKey, productsById);
|
|
4999
5054
|
case 5:
|
|
5000
5055
|
case "end":
|
|
5001
|
-
return
|
|
5056
|
+
return _context54.stop();
|
|
5002
5057
|
}
|
|
5003
|
-
},
|
|
5058
|
+
}, _callee54);
|
|
5004
5059
|
}));
|
|
5005
|
-
return function (
|
|
5060
|
+
return function (_x48) {
|
|
5006
5061
|
return _ref40.apply(this, arguments);
|
|
5007
5062
|
};
|
|
5008
5063
|
}()));
|
|
5009
|
-
case
|
|
5010
|
-
|
|
5064
|
+
case 11:
|
|
5065
|
+
_context55.next = 13;
|
|
5011
5066
|
return this.loadQuotationForPriceQuery({
|
|
5012
5067
|
quotation: quotation,
|
|
5013
5068
|
customer_id: customerId,
|
|
5014
5069
|
channel: (_paramsList$2 = paramsList[0]) === null || _paramsList$2 === void 0 ? void 0 : _paramsList$2.channel
|
|
5015
5070
|
});
|
|
5016
|
-
case
|
|
5017
|
-
return
|
|
5071
|
+
case 13:
|
|
5072
|
+
return _context55.abrupt("return", paramsList.map(function (params) {
|
|
5018
5073
|
var _this16$otherParams2, _productMapsByGroup$g;
|
|
5019
5074
|
var productInput = params.product || {};
|
|
5020
5075
|
var productId = _this16.getPriceQueryProductId(productInput);
|
|
@@ -5027,16 +5082,16 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5027
5082
|
product: product,
|
|
5028
5083
|
fallback_price: authoritativeProduct ? undefined : params.fallback_price,
|
|
5029
5084
|
customer_id: customerId,
|
|
5030
|
-
quotation: quotation
|
|
5085
|
+
quotation: authoritativeProduct && _this16.preferAuthoritativeProductQueryPrice() ? undefined : quotation
|
|
5031
5086
|
}));
|
|
5032
5087
|
}));
|
|
5033
|
-
case
|
|
5088
|
+
case 14:
|
|
5034
5089
|
case "end":
|
|
5035
|
-
return
|
|
5090
|
+
return _context55.stop();
|
|
5036
5091
|
}
|
|
5037
|
-
},
|
|
5092
|
+
}, _callee55, this);
|
|
5038
5093
|
}));
|
|
5039
|
-
function calculateProductBookingPrices(
|
|
5094
|
+
function calculateProductBookingPrices(_x47) {
|
|
5040
5095
|
return _calculateProductBookingPrices.apply(this, arguments);
|
|
5041
5096
|
}
|
|
5042
5097
|
return calculateProductBookingPrices;
|
|
@@ -5044,42 +5099,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5044
5099
|
}, {
|
|
5045
5100
|
key: "addProductToOrder",
|
|
5046
5101
|
value: function () {
|
|
5047
|
-
var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5048
|
-
var products;
|
|
5049
|
-
return _regeneratorRuntime().wrap(function _callee55$(_context55) {
|
|
5050
|
-
while (1) switch (_context55.prev = _context55.next) {
|
|
5051
|
-
case 0:
|
|
5052
|
-
_context55.prev = 0;
|
|
5053
|
-
if (this.store.order) {
|
|
5054
|
-
_context55.next = 3;
|
|
5055
|
-
break;
|
|
5056
|
-
}
|
|
5057
|
-
throw new Error('order 模块未初始化');
|
|
5058
|
-
case 3:
|
|
5059
|
-
_context55.next = 5;
|
|
5060
|
-
return this.store.order.addProductToOrder(product, booking, options);
|
|
5061
|
-
case 5:
|
|
5062
|
-
products = _context55.sent;
|
|
5063
|
-
return _context55.abrupt("return", products);
|
|
5064
|
-
case 9:
|
|
5065
|
-
_context55.prev = 9;
|
|
5066
|
-
_context55.t0 = _context55["catch"](0);
|
|
5067
|
-
throw _context55.t0;
|
|
5068
|
-
case 12:
|
|
5069
|
-
case "end":
|
|
5070
|
-
return _context55.stop();
|
|
5071
|
-
}
|
|
5072
|
-
}, _callee55, this, [[0, 9]]);
|
|
5073
|
-
}));
|
|
5074
|
-
function addProductToOrder(_x48, _x49, _x50) {
|
|
5075
|
-
return _addProductToOrder.apply(this, arguments);
|
|
5076
|
-
}
|
|
5077
|
-
return addProductToOrder;
|
|
5078
|
-
}()
|
|
5079
|
-
}, {
|
|
5080
|
-
key: "updateOrderProduct",
|
|
5081
|
-
value: function () {
|
|
5082
|
-
var _updateOrderProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee56(params) {
|
|
5102
|
+
var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee56(product, booking, options) {
|
|
5083
5103
|
var products;
|
|
5084
5104
|
return _regeneratorRuntime().wrap(function _callee56$(_context56) {
|
|
5085
5105
|
while (1) switch (_context56.prev = _context56.next) {
|
|
@@ -5092,7 +5112,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5092
5112
|
throw new Error('order 模块未初始化');
|
|
5093
5113
|
case 3:
|
|
5094
5114
|
_context56.next = 5;
|
|
5095
|
-
return this.store.order.
|
|
5115
|
+
return this.store.order.addProductToOrder(product, booking, options);
|
|
5096
5116
|
case 5:
|
|
5097
5117
|
products = _context56.sent;
|
|
5098
5118
|
return _context56.abrupt("return", products);
|
|
@@ -5106,15 +5126,15 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5106
5126
|
}
|
|
5107
5127
|
}, _callee56, this, [[0, 9]]);
|
|
5108
5128
|
}));
|
|
5109
|
-
function
|
|
5110
|
-
return
|
|
5129
|
+
function addProductToOrder(_x49, _x50, _x51) {
|
|
5130
|
+
return _addProductToOrder.apply(this, arguments);
|
|
5111
5131
|
}
|
|
5112
|
-
return
|
|
5132
|
+
return addProductToOrder;
|
|
5113
5133
|
}()
|
|
5114
5134
|
}, {
|
|
5115
|
-
key: "
|
|
5135
|
+
key: "updateOrderProduct",
|
|
5116
5136
|
value: function () {
|
|
5117
|
-
var
|
|
5137
|
+
var _updateOrderProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee57(params) {
|
|
5118
5138
|
var products;
|
|
5119
5139
|
return _regeneratorRuntime().wrap(function _callee57$(_context57) {
|
|
5120
5140
|
while (1) switch (_context57.prev = _context57.next) {
|
|
@@ -5127,7 +5147,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5127
5147
|
throw new Error('order 模块未初始化');
|
|
5128
5148
|
case 3:
|
|
5129
5149
|
_context57.next = 5;
|
|
5130
|
-
return this.store.order.
|
|
5150
|
+
return this.store.order.updateOrderProduct(params);
|
|
5131
5151
|
case 5:
|
|
5132
5152
|
products = _context57.sent;
|
|
5133
5153
|
return _context57.abrupt("return", products);
|
|
@@ -5141,15 +5161,15 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5141
5161
|
}
|
|
5142
5162
|
}, _callee57, this, [[0, 9]]);
|
|
5143
5163
|
}));
|
|
5144
|
-
function
|
|
5145
|
-
return
|
|
5164
|
+
function updateOrderProduct(_x52) {
|
|
5165
|
+
return _updateOrderProduct.apply(this, arguments);
|
|
5146
5166
|
}
|
|
5147
|
-
return
|
|
5167
|
+
return updateOrderProduct;
|
|
5148
5168
|
}()
|
|
5149
5169
|
}, {
|
|
5150
|
-
key: "
|
|
5170
|
+
key: "updateOrderProducts",
|
|
5151
5171
|
value: function () {
|
|
5152
|
-
var
|
|
5172
|
+
var _updateOrderProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee58(paramsList) {
|
|
5153
5173
|
var products;
|
|
5154
5174
|
return _regeneratorRuntime().wrap(function _callee58$(_context58) {
|
|
5155
5175
|
while (1) switch (_context58.prev = _context58.next) {
|
|
@@ -5162,7 +5182,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5162
5182
|
throw new Error('order 模块未初始化');
|
|
5163
5183
|
case 3:
|
|
5164
5184
|
_context58.next = 5;
|
|
5165
|
-
return this.store.order.
|
|
5185
|
+
return this.store.order.updateOrderProducts(paramsList);
|
|
5166
5186
|
case 5:
|
|
5167
5187
|
products = _context58.sent;
|
|
5168
5188
|
return _context58.abrupt("return", products);
|
|
@@ -5176,7 +5196,42 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5176
5196
|
}
|
|
5177
5197
|
}, _callee58, this, [[0, 9]]);
|
|
5178
5198
|
}));
|
|
5179
|
-
function
|
|
5199
|
+
function updateOrderProducts(_x53) {
|
|
5200
|
+
return _updateOrderProducts.apply(this, arguments);
|
|
5201
|
+
}
|
|
5202
|
+
return updateOrderProducts;
|
|
5203
|
+
}()
|
|
5204
|
+
}, {
|
|
5205
|
+
key: "updateOrderProductQuantity",
|
|
5206
|
+
value: function () {
|
|
5207
|
+
var _updateOrderProductQuantity = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee59(params) {
|
|
5208
|
+
var products;
|
|
5209
|
+
return _regeneratorRuntime().wrap(function _callee59$(_context59) {
|
|
5210
|
+
while (1) switch (_context59.prev = _context59.next) {
|
|
5211
|
+
case 0:
|
|
5212
|
+
_context59.prev = 0;
|
|
5213
|
+
if (this.store.order) {
|
|
5214
|
+
_context59.next = 3;
|
|
5215
|
+
break;
|
|
5216
|
+
}
|
|
5217
|
+
throw new Error('order 模块未初始化');
|
|
5218
|
+
case 3:
|
|
5219
|
+
_context59.next = 5;
|
|
5220
|
+
return this.store.order.updateOrderProductQuantity(params);
|
|
5221
|
+
case 5:
|
|
5222
|
+
products = _context59.sent;
|
|
5223
|
+
return _context59.abrupt("return", products);
|
|
5224
|
+
case 9:
|
|
5225
|
+
_context59.prev = 9;
|
|
5226
|
+
_context59.t0 = _context59["catch"](0);
|
|
5227
|
+
throw _context59.t0;
|
|
5228
|
+
case 12:
|
|
5229
|
+
case "end":
|
|
5230
|
+
return _context59.stop();
|
|
5231
|
+
}
|
|
5232
|
+
}, _callee59, this, [[0, 9]]);
|
|
5233
|
+
}));
|
|
5234
|
+
function updateOrderProductQuantity(_x54) {
|
|
5180
5235
|
return _updateOrderProductQuantity.apply(this, arguments);
|
|
5181
5236
|
}
|
|
5182
5237
|
return updateOrderProductQuantity;
|
|
@@ -5199,12 +5254,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5199
5254
|
}, {
|
|
5200
5255
|
key: "setOrderProductLineNote",
|
|
5201
5256
|
value: (function () {
|
|
5202
|
-
var _setOrderProductLineNote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5257
|
+
var _setOrderProductLineNote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee60(identity, note) {
|
|
5203
5258
|
var params, products;
|
|
5204
|
-
return _regeneratorRuntime().wrap(function
|
|
5205
|
-
while (1) switch (
|
|
5259
|
+
return _regeneratorRuntime().wrap(function _callee60$(_context60) {
|
|
5260
|
+
while (1) switch (_context60.prev = _context60.next) {
|
|
5206
5261
|
case 0:
|
|
5207
|
-
|
|
5262
|
+
_context60.prev = 0;
|
|
5208
5263
|
params = {
|
|
5209
5264
|
product_id: identity.product_id,
|
|
5210
5265
|
product_variant_id: identity.product_variant_id,
|
|
@@ -5219,22 +5274,22 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5219
5274
|
params.product_sku = identity.product_sku;
|
|
5220
5275
|
}
|
|
5221
5276
|
if (identity.product_bundle !== undefined) params.product_bundle = identity.product_bundle;
|
|
5222
|
-
|
|
5277
|
+
_context60.next = 7;
|
|
5223
5278
|
return this.updateOrderProduct(params);
|
|
5224
5279
|
case 7:
|
|
5225
|
-
products =
|
|
5226
|
-
return
|
|
5280
|
+
products = _context60.sent;
|
|
5281
|
+
return _context60.abrupt("return", products);
|
|
5227
5282
|
case 11:
|
|
5228
|
-
|
|
5229
|
-
|
|
5230
|
-
throw
|
|
5283
|
+
_context60.prev = 11;
|
|
5284
|
+
_context60.t0 = _context60["catch"](0);
|
|
5285
|
+
throw _context60.t0;
|
|
5231
5286
|
case 14:
|
|
5232
5287
|
case "end":
|
|
5233
|
-
return
|
|
5288
|
+
return _context60.stop();
|
|
5234
5289
|
}
|
|
5235
|
-
},
|
|
5290
|
+
}, _callee60, this, [[0, 11]]);
|
|
5236
5291
|
}));
|
|
5237
|
-
function setOrderProductLineNote(
|
|
5292
|
+
function setOrderProductLineNote(_x55, _x56) {
|
|
5238
5293
|
return _setOrderProductLineNote.apply(this, arguments);
|
|
5239
5294
|
}
|
|
5240
5295
|
return setOrderProductLineNote;
|
|
@@ -5249,32 +5304,32 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5249
5304
|
}, {
|
|
5250
5305
|
key: "removeProductsFromOrder",
|
|
5251
5306
|
value: (function () {
|
|
5252
|
-
var _removeProductsFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5253
|
-
return _regeneratorRuntime().wrap(function
|
|
5254
|
-
while (1) switch (
|
|
5307
|
+
var _removeProductsFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee61(identities, options) {
|
|
5308
|
+
return _regeneratorRuntime().wrap(function _callee61$(_context61) {
|
|
5309
|
+
while (1) switch (_context61.prev = _context61.next) {
|
|
5255
5310
|
case 0:
|
|
5256
|
-
|
|
5311
|
+
_context61.prev = 0;
|
|
5257
5312
|
if (this.store.order) {
|
|
5258
|
-
|
|
5313
|
+
_context61.next = 3;
|
|
5259
5314
|
break;
|
|
5260
5315
|
}
|
|
5261
5316
|
throw new Error('order 模块未初始化');
|
|
5262
5317
|
case 3:
|
|
5263
|
-
|
|
5318
|
+
_context61.next = 5;
|
|
5264
5319
|
return this.store.order.removeProductsFromOrder(identities, options);
|
|
5265
5320
|
case 5:
|
|
5266
|
-
return
|
|
5321
|
+
return _context61.abrupt("return", _context61.sent);
|
|
5267
5322
|
case 8:
|
|
5268
|
-
|
|
5269
|
-
|
|
5270
|
-
throw
|
|
5323
|
+
_context61.prev = 8;
|
|
5324
|
+
_context61.t0 = _context61["catch"](0);
|
|
5325
|
+
throw _context61.t0;
|
|
5271
5326
|
case 11:
|
|
5272
5327
|
case "end":
|
|
5273
|
-
return
|
|
5328
|
+
return _context61.stop();
|
|
5274
5329
|
}
|
|
5275
|
-
},
|
|
5330
|
+
}, _callee61, this, [[0, 8]]);
|
|
5276
5331
|
}));
|
|
5277
|
-
function removeProductsFromOrder(
|
|
5332
|
+
function removeProductsFromOrder(_x57, _x58) {
|
|
5278
5333
|
return _removeProductsFromOrder.apply(this, arguments);
|
|
5279
5334
|
}
|
|
5280
5335
|
return removeProductsFromOrder;
|
|
@@ -5282,18 +5337,18 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5282
5337
|
}, {
|
|
5283
5338
|
key: "removeProductFromOrder",
|
|
5284
5339
|
value: function () {
|
|
5285
|
-
var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5286
|
-
return _regeneratorRuntime().wrap(function
|
|
5287
|
-
while (1) switch (
|
|
5340
|
+
var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee62(identity, options) {
|
|
5341
|
+
return _regeneratorRuntime().wrap(function _callee62$(_context62) {
|
|
5342
|
+
while (1) switch (_context62.prev = _context62.next) {
|
|
5288
5343
|
case 0:
|
|
5289
|
-
return
|
|
5344
|
+
return _context62.abrupt("return", this.removeProductsFromOrder([identity], options));
|
|
5290
5345
|
case 1:
|
|
5291
5346
|
case "end":
|
|
5292
|
-
return
|
|
5347
|
+
return _context62.stop();
|
|
5293
5348
|
}
|
|
5294
|
-
},
|
|
5349
|
+
}, _callee62, this);
|
|
5295
5350
|
}));
|
|
5296
|
-
function removeProductFromOrder(
|
|
5351
|
+
function removeProductFromOrder(_x59, _x60) {
|
|
5297
5352
|
return _removeProductFromOrder.apply(this, arguments);
|
|
5298
5353
|
}
|
|
5299
5354
|
return removeProductFromOrder;
|
|
@@ -5343,23 +5398,23 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5343
5398
|
}, {
|
|
5344
5399
|
key: "applyPromotion",
|
|
5345
5400
|
value: (function () {
|
|
5346
|
-
var _applyPromotion = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5347
|
-
return _regeneratorRuntime().wrap(function
|
|
5348
|
-
while (1) switch (
|
|
5401
|
+
var _applyPromotion = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee63() {
|
|
5402
|
+
return _regeneratorRuntime().wrap(function _callee63$(_context63) {
|
|
5403
|
+
while (1) switch (_context63.prev = _context63.next) {
|
|
5349
5404
|
case 0:
|
|
5350
5405
|
if (this.store.order) {
|
|
5351
|
-
|
|
5406
|
+
_context63.next = 2;
|
|
5352
5407
|
break;
|
|
5353
5408
|
}
|
|
5354
5409
|
throw new Error('order 模块未初始化');
|
|
5355
5410
|
case 2:
|
|
5356
|
-
|
|
5411
|
+
_context63.next = 4;
|
|
5357
5412
|
return this.store.order.applyPromotion();
|
|
5358
5413
|
case 4:
|
|
5359
5414
|
case "end":
|
|
5360
|
-
return
|
|
5415
|
+
return _context63.stop();
|
|
5361
5416
|
}
|
|
5362
|
-
},
|
|
5417
|
+
}, _callee63, this);
|
|
5363
5418
|
}));
|
|
5364
5419
|
function applyPromotion() {
|
|
5365
5420
|
return _applyPromotion.apply(this, arguments);
|
|
@@ -5386,18 +5441,18 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5386
5441
|
}, {
|
|
5387
5442
|
key: "getProductList",
|
|
5388
5443
|
value: function () {
|
|
5389
|
-
var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5444
|
+
var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee64() {
|
|
5390
5445
|
var _this$otherParams33;
|
|
5391
5446
|
var menu_list_ids, _this$store$products, res;
|
|
5392
|
-
return _regeneratorRuntime().wrap(function
|
|
5393
|
-
while (1) switch (
|
|
5447
|
+
return _regeneratorRuntime().wrap(function _callee64$(_context64) {
|
|
5448
|
+
while (1) switch (_context64.prev = _context64.next) {
|
|
5394
5449
|
case 0:
|
|
5395
5450
|
// 可以直接通过配置里的 menu 读取
|
|
5396
5451
|
menu_list_ids = ((_this$otherParams33 = this.otherParams) === null || _this$otherParams33 === void 0 || (_this$otherParams33 = _this$otherParams33.dineInConfig) === null || _this$otherParams33 === void 0 ? void 0 : _this$otherParams33['menu.associated_menus'].map(function (n) {
|
|
5397
5452
|
return Number(n.value);
|
|
5398
5453
|
})) || [];
|
|
5399
|
-
|
|
5400
|
-
|
|
5454
|
+
_context64.prev = 1;
|
|
5455
|
+
_context64.next = 4;
|
|
5401
5456
|
return (_this$store$products = this.store.products) === null || _this$store$products === void 0 ? void 0 : _this$store$products.loadProducts({
|
|
5402
5457
|
menu_list_ids: menu_list_ids,
|
|
5403
5458
|
cacheId: this.cacheId,
|
|
@@ -5405,17 +5460,17 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5405
5460
|
schedule_datetime: dayjs().format('YYYY-MM-DD HH:mm:ss')
|
|
5406
5461
|
});
|
|
5407
5462
|
case 4:
|
|
5408
|
-
res =
|
|
5409
|
-
return
|
|
5463
|
+
res = _context64.sent;
|
|
5464
|
+
return _context64.abrupt("return", res);
|
|
5410
5465
|
case 8:
|
|
5411
|
-
|
|
5412
|
-
|
|
5413
|
-
throw
|
|
5466
|
+
_context64.prev = 8;
|
|
5467
|
+
_context64.t0 = _context64["catch"](1);
|
|
5468
|
+
throw _context64.t0;
|
|
5414
5469
|
case 11:
|
|
5415
5470
|
case "end":
|
|
5416
|
-
return
|
|
5471
|
+
return _context64.stop();
|
|
5417
5472
|
}
|
|
5418
|
-
},
|
|
5473
|
+
}, _callee64, this, [[1, 8]]);
|
|
5419
5474
|
}));
|
|
5420
5475
|
function getProductList() {
|
|
5421
5476
|
return _getProductList.apply(this, arguments);
|
|
@@ -5430,33 +5485,33 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5430
5485
|
}, {
|
|
5431
5486
|
key: "setOtherParams",
|
|
5432
5487
|
value: function () {
|
|
5433
|
-
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5488
|
+
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee65(params) {
|
|
5434
5489
|
var _this$otherParams34;
|
|
5435
5490
|
var _ref42,
|
|
5436
5491
|
_ref42$cover,
|
|
5437
5492
|
cover,
|
|
5438
|
-
|
|
5439
|
-
return _regeneratorRuntime().wrap(function
|
|
5440
|
-
while (1) switch (
|
|
5493
|
+
_args65 = arguments;
|
|
5494
|
+
return _regeneratorRuntime().wrap(function _callee65$(_context65) {
|
|
5495
|
+
while (1) switch (_context65.prev = _context65.next) {
|
|
5441
5496
|
case 0:
|
|
5442
|
-
_ref42 =
|
|
5497
|
+
_ref42 = _args65.length > 1 && _args65[1] !== undefined ? _args65[1] : {}, _ref42$cover = _ref42.cover, cover = _ref42$cover === void 0 ? false : _ref42$cover;
|
|
5443
5498
|
if (cover) {
|
|
5444
5499
|
this.otherParams = _objectSpread({}, params);
|
|
5445
5500
|
} else {
|
|
5446
5501
|
this.otherParams = _objectSpread(_objectSpread({}, this.otherParams), params);
|
|
5447
5502
|
}
|
|
5448
5503
|
this.cacheId = (_this$otherParams34 = this.otherParams) === null || _this$otherParams34 === void 0 ? void 0 : _this$otherParams34.cacheId;
|
|
5449
|
-
|
|
5504
|
+
_context65.next = 5;
|
|
5450
5505
|
return this.syncOtherParamsToSubModules(params, {
|
|
5451
5506
|
cover: cover
|
|
5452
5507
|
});
|
|
5453
5508
|
case 5:
|
|
5454
5509
|
case "end":
|
|
5455
|
-
return
|
|
5510
|
+
return _context65.stop();
|
|
5456
5511
|
}
|
|
5457
|
-
},
|
|
5512
|
+
}, _callee65, this);
|
|
5458
5513
|
}));
|
|
5459
|
-
function setOtherParams(
|
|
5514
|
+
function setOtherParams(_x61) {
|
|
5460
5515
|
return _setOtherParams.apply(this, arguments);
|
|
5461
5516
|
}
|
|
5462
5517
|
return setOtherParams;
|