@pisell/pisellos 0.10.7 → 0.10.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/model/strategy/adapter/promotion/index.js +9 -0
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +12 -10
- package/dist/modules/Order/index.d.ts +12 -5
- package/dist/modules/Order/index.js +310 -210
- package/dist/modules/Order/types.d.ts +26 -3
- package/dist/modules/Order/types.js +11 -0
- package/dist/modules/Order/utils/discountProductLineIdentity.d.ts +45 -0
- package/dist/modules/Order/utils/discountProductLineIdentity.js +227 -0
- package/dist/modules/Rules/index.js +125 -52
- package/dist/modules/SalesSummary/utils.js +7 -1
- package/dist/server/index.d.ts +6 -0
- package/dist/server/index.js +810 -729
- package/dist/server/modules/order/index.d.ts +1 -0
- package/dist/server/modules/order/index.js +9 -2
- package/dist/server/modules/order/types.d.ts +1 -1
- package/dist/solution/BaseSales/index.d.ts +15 -5
- package/dist/solution/BaseSales/index.js +211 -159
- package/dist/solution/BaseSales/utils/cartPromotion.js +26 -3
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +1 -1
- package/dist/solution/BaseSales/utils.js +31 -20
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.js +1 -4
- package/dist/solution/BookingTicket/types.d.ts +3 -0
- package/dist/solution/BookingTicket/utils/cartView.js +44 -32
- package/dist/solution/Sales/index.d.ts +1 -0
- package/dist/solution/Sales/index.js +16 -2
- package/dist/solution/ScanOrder/utils.js +31 -20
- package/dist/solution/UnifiedBookingSales/index.d.ts +5 -4
- package/dist/solution/UnifiedBookingSales/index.js +51 -39
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +3 -1
- package/lib/modules/Order/index.d.ts +12 -5
- package/lib/modules/Order/index.js +148 -43
- package/lib/modules/Order/types.d.ts +26 -3
- package/lib/modules/Order/utils/discountProductLineIdentity.d.ts +45 -0
- package/lib/modules/Order/utils/discountProductLineIdentity.js +170 -0
- package/lib/modules/Rules/index.js +100 -20
- package/lib/modules/SalesSummary/utils.js +5 -1
- package/lib/server/index.d.ts +6 -0
- package/lib/server/index.js +51 -0
- package/lib/server/modules/order/index.d.ts +1 -0
- package/lib/server/modules/order/index.js +9 -3
- package/lib/server/modules/order/types.d.ts +1 -1
- package/lib/solution/BaseSales/index.d.ts +15 -5
- package/lib/solution/BaseSales/index.js +64 -16
- package/lib/solution/BaseSales/utils/cartPromotion.js +26 -2
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +1 -1
- package/lib/solution/BaseSales/utils.js +29 -18
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.js +1 -4
- package/lib/solution/BookingTicket/types.d.ts +3 -0
- package/lib/solution/BookingTicket/utils/cartView.js +43 -30
- package/lib/solution/Sales/index.d.ts +1 -0
- package/lib/solution/Sales/index.js +15 -3
- package/lib/solution/ScanOrder/utils.js +29 -18
- package/lib/solution/UnifiedBookingSales/index.d.ts +5 -4
- package/lib/solution/UnifiedBookingSales/index.js +35 -26
- package/package.json +1 -1
|
@@ -65,19 +65,21 @@ function isRejectedSalesSubmitResult(result) {
|
|
|
65
65
|
var _result$response, _result$response2;
|
|
66
66
|
var candidates = [result, result === null || result === void 0 ? void 0 : result.data, result === null || result === void 0 || (_result$response = result.response) === null || _result$response === void 0 ? void 0 : _result$response.data, result === null || result === void 0 || (_result$response2 = result.response) === null || _result$response2 === void 0 ? void 0 : _result$response2.body];
|
|
67
67
|
return candidates.some(function (candidate) {
|
|
68
|
-
var _candidate$code;
|
|
69
68
|
if (!candidate || _typeof(candidate) !== 'object') return false;
|
|
70
|
-
|
|
71
|
-
|
|
69
|
+
if (candidate.code !== undefined && candidate.code !== 200 && candidate.code !== '200') {
|
|
70
|
+
return true;
|
|
71
|
+
}
|
|
72
|
+
var statusCode = Number(candidate.statusCode);
|
|
73
|
+
if (Number.isFinite(statusCode) && statusCode >= 400) return true;
|
|
72
74
|
if (candidate.status === false || candidate.success === false || candidate.result === false) {
|
|
73
75
|
return true;
|
|
74
76
|
}
|
|
75
77
|
return ['failed', 'error'].includes(String(candidate.status || '').toLowerCase());
|
|
76
78
|
});
|
|
77
79
|
}
|
|
78
|
-
function getSalesSubmitErrorMessage(result) {
|
|
80
|
+
function getSalesSubmitErrorMessage(result, fallbackMessage) {
|
|
79
81
|
var _result$data, _result$data2;
|
|
80
|
-
return (result === null || result === void 0 ? void 0 : result.message) || (result === null || result === void 0 ? void 0 : result.msg) || (result === null || result === void 0 || (_result$data = result.data) === null || _result$data === void 0 ? void 0 : _result$data.message) || (result === null || result === void 0 || (_result$data2 = result.data) === null || _result$data2 === void 0 ? void 0 : _result$data2.msg) ||
|
|
82
|
+
return (result === null || result === void 0 ? void 0 : result.message) || (result === null || result === void 0 ? void 0 : result.msg) || (result === null || result === void 0 || (_result$data = result.data) === null || _result$data === void 0 ? void 0 : _result$data.message) || (result === null || result === void 0 || (_result$data2 = result.data) === null || _result$data2 === void 0 ? void 0 : _result$data2.msg) || fallbackMessage;
|
|
81
83
|
}
|
|
82
84
|
function toWalletFundValue(value) {
|
|
83
85
|
try {
|
|
@@ -865,6 +867,40 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
865
867
|
if (!Number.isFinite(productId)) return null;
|
|
866
868
|
return productId;
|
|
867
869
|
}
|
|
870
|
+
|
|
871
|
+
/**
|
|
872
|
+
* Change Time / customer reprice 必须沿用商品列表的渠道口径。
|
|
873
|
+
* SalesSdk Provider 通常将渠道存为 platform,因此不能只读取 otherParams.channel。
|
|
874
|
+
*/
|
|
875
|
+
}, {
|
|
876
|
+
key: "getPriceQueryChannel",
|
|
877
|
+
value: function getPriceQueryChannel(channel) {
|
|
878
|
+
var _this$otherParams2, _ref12, _ref13, _this$otherParams3, _this$otherParams4;
|
|
879
|
+
var strategyContext = (_this$otherParams2 = this.otherParams) !== null && _this$otherParams2 !== void 0 && _this$otherParams2.strategy_context && _typeof(this.otherParams.strategy_context) === 'object' ? this.otherParams.strategy_context : {};
|
|
880
|
+
var value = (_ref12 = (_ref13 = channel !== null && channel !== void 0 ? channel : strategyContext.channel) !== null && _ref13 !== void 0 ? _ref13 : (_this$otherParams3 = this.otherParams) === null || _this$otherParams3 === void 0 ? void 0 : _this$otherParams3.channel) !== null && _ref12 !== void 0 ? _ref12 : (_this$otherParams4 = this.otherParams) === null || _this$otherParams4 === void 0 ? void 0 : _this$otherParams4.platform;
|
|
881
|
+
if (value === undefined || value === null || String(value).trim() === '') {
|
|
882
|
+
return undefined;
|
|
883
|
+
}
|
|
884
|
+
return String(value).trim();
|
|
885
|
+
}
|
|
886
|
+
/**
|
|
887
|
+
* /product/query 的智能定价评估只读取 strategy_context;
|
|
888
|
+
* application_code 仅作为接口兼容字段,不能替代 channel / business_code。
|
|
889
|
+
*/
|
|
890
|
+
}, {
|
|
891
|
+
key: "getPriceQueryStrategyContext",
|
|
892
|
+
value: function getPriceQueryStrategyContext(channel) {
|
|
893
|
+
var _this$otherParams5, _ref14, _strategyContext$busi, _this$otherParams6, _this$otherParams7;
|
|
894
|
+
var inherited = (_this$otherParams5 = this.otherParams) !== null && _this$otherParams5 !== void 0 && _this$otherParams5.strategy_context && _typeof(this.otherParams.strategy_context) === 'object' ? this.otherParams.strategy_context : {};
|
|
895
|
+
var strategyContext = _objectSpread({}, inherited);
|
|
896
|
+
var resolvedChannel = this.getPriceQueryChannel(channel);
|
|
897
|
+
var businessCode = (_ref14 = (_strategyContext$busi = strategyContext.business_code) !== null && _strategyContext$busi !== void 0 ? _strategyContext$busi : (_this$otherParams6 = this.otherParams) === null || _this$otherParams6 === void 0 ? void 0 : _this$otherParams6.businessCode) !== null && _ref14 !== void 0 ? _ref14 : (_this$otherParams7 = this.otherParams) === null || _this$otherParams7 === void 0 ? void 0 : _this$otherParams7.business_code;
|
|
898
|
+
if (resolvedChannel) strategyContext.channel = resolvedChannel;
|
|
899
|
+
if (businessCode !== undefined && businessCode !== null && String(businessCode).trim() !== '') {
|
|
900
|
+
strategyContext.business_code = String(businessCode).trim();
|
|
901
|
+
}
|
|
902
|
+
return strategyContext;
|
|
903
|
+
}
|
|
868
904
|
}, {
|
|
869
905
|
key: "getPriceQuerySchedule",
|
|
870
906
|
value: function getPriceQuerySchedule(params) {
|
|
@@ -897,7 +933,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
897
933
|
key: "loadProductsForPriceQuery",
|
|
898
934
|
value: function () {
|
|
899
935
|
var _loadProductsForPriceQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(params) {
|
|
900
|
-
var ids, productsById,
|
|
936
|
+
var ids, productsById, channel, strategyContext, _response$data, response, list;
|
|
901
937
|
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
902
938
|
while (1) switch (_context7.prev = _context7.next) {
|
|
903
939
|
case 0:
|
|
@@ -911,9 +947,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
911
947
|
}
|
|
912
948
|
return _context7.abrupt("return", productsById);
|
|
913
949
|
case 4:
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
950
|
+
channel = this.getPriceQueryChannel(params.channel);
|
|
951
|
+
strategyContext = this.getPriceQueryStrategyContext(channel);
|
|
952
|
+
_context7.prev = 6;
|
|
953
|
+
_context7.next = 9;
|
|
954
|
+
return this.request.post('/product/query', _objectSpread({
|
|
917
955
|
ids: ids,
|
|
918
956
|
open_quotation: 1,
|
|
919
957
|
open_bundle: 1,
|
|
@@ -923,39 +961,41 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
923
961
|
customer_id: params.customerId,
|
|
924
962
|
schedule_date: params.schedule.schedule_date,
|
|
925
963
|
schedule_datetime: params.schedule.schedule_datetime,
|
|
926
|
-
application_code:
|
|
927
|
-
}, {
|
|
964
|
+
application_code: channel
|
|
965
|
+
}, Object.keys(strategyContext).length ? {
|
|
966
|
+
strategy_context: strategyContext
|
|
967
|
+
} : {}), {
|
|
928
968
|
osServer: true,
|
|
929
969
|
customToast: function customToast() {}
|
|
930
970
|
});
|
|
931
|
-
case
|
|
971
|
+
case 9:
|
|
932
972
|
response = _context7.sent;
|
|
933
973
|
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) || [];
|
|
934
974
|
if (Array.isArray(list)) {
|
|
935
|
-
_context7.next =
|
|
975
|
+
_context7.next = 13;
|
|
936
976
|
break;
|
|
937
977
|
}
|
|
938
978
|
return _context7.abrupt("return", productsById);
|
|
939
|
-
case
|
|
979
|
+
case 13:
|
|
940
980
|
list.forEach(function (item) {
|
|
941
981
|
var _item$id;
|
|
942
982
|
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);
|
|
943
983
|
if (Number.isFinite(productId)) productsById.set(productId, item);
|
|
944
984
|
});
|
|
945
985
|
return _context7.abrupt("return", productsById);
|
|
946
|
-
case
|
|
947
|
-
_context7.prev =
|
|
948
|
-
_context7.t0 = _context7["catch"](
|
|
986
|
+
case 17:
|
|
987
|
+
_context7.prev = 17;
|
|
988
|
+
_context7.t0 = _context7["catch"](6);
|
|
949
989
|
this.logWarning('loadProductsForPriceQuery: 商品批量重查失败,使用入参 fallback', {
|
|
950
990
|
ids: ids,
|
|
951
991
|
error: _context7.t0 instanceof Error ? _context7.t0.message : String(_context7.t0)
|
|
952
992
|
});
|
|
953
993
|
return _context7.abrupt("return", productsById);
|
|
954
|
-
case
|
|
994
|
+
case 21:
|
|
955
995
|
case "end":
|
|
956
996
|
return _context7.stop();
|
|
957
997
|
}
|
|
958
|
-
}, _callee7, this, [[
|
|
998
|
+
}, _callee7, this, [[6, 17]]);
|
|
959
999
|
}));
|
|
960
1000
|
function loadProductsForPriceQuery(_x6) {
|
|
961
1001
|
return _loadProductsForPriceQuery.apply(this, arguments);
|
|
@@ -1008,10 +1048,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1008
1048
|
return groups.flatMap(function (group) {
|
|
1009
1049
|
var items = Array.isArray(group === null || group === void 0 ? void 0 : group.bundle_item) ? group.bundle_item : Array.isArray(group === null || group === void 0 ? void 0 : group.bundleItem) ? group.bundleItem : [];
|
|
1010
1050
|
return items.map(function (item) {
|
|
1011
|
-
var _item$group_id,
|
|
1051
|
+
var _item$group_id, _ref15, _item$bundle_group_id;
|
|
1012
1052
|
return _objectSpread(_objectSpread({}, item), {}, {
|
|
1013
1053
|
group_id: (_item$group_id = item === null || item === void 0 ? void 0 : item.group_id) !== null && _item$group_id !== void 0 ? _item$group_id : group === null || group === void 0 ? void 0 : group.id,
|
|
1014
|
-
bundle_group_id: (
|
|
1054
|
+
bundle_group_id: (_ref15 = (_item$bundle_group_id = item === null || item === void 0 ? void 0 : item.bundle_group_id) !== null && _item$bundle_group_id !== void 0 ? _item$bundle_group_id : item === null || item === void 0 ? void 0 : item.group_id) !== null && _ref15 !== void 0 ? _ref15 : group === null || group === void 0 ? void 0 : group.id
|
|
1015
1055
|
});
|
|
1016
1056
|
});
|
|
1017
1057
|
});
|
|
@@ -1042,21 +1082,21 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1042
1082
|
}, {
|
|
1043
1083
|
key: "getAuthoritativeBundleUnitPrice",
|
|
1044
1084
|
value: function getAuthoritativeBundleUnitPrice(bundle) {
|
|
1045
|
-
var
|
|
1046
|
-
return (
|
|
1085
|
+
var _ref16, _ref17, _ref18, _bundle$price;
|
|
1086
|
+
return (_ref16 = (_ref17 = (_ref18 = (_bundle$price = bundle.price) !== null && _bundle$price !== void 0 ? _bundle$price : bundle.bundle_selling_price) !== null && _ref18 !== void 0 ? _ref18 : bundle.custom_price) !== null && _ref17 !== void 0 ? _ref17 : bundle.product_price) !== null && _ref16 !== void 0 ? _ref16 : bundle.base_price;
|
|
1047
1087
|
}
|
|
1048
1088
|
}, {
|
|
1049
1089
|
key: "mergeProductForPriceQuery",
|
|
1050
1090
|
value: function mergeProductForPriceQuery(product, authoritativeProduct) {
|
|
1051
1091
|
var _this5 = this,
|
|
1052
1092
|
_product$id,
|
|
1053
|
-
|
|
1093
|
+
_ref19,
|
|
1054
1094
|
_product$product_id2,
|
|
1055
|
-
|
|
1095
|
+
_ref20,
|
|
1056
1096
|
_product$product_vari,
|
|
1057
|
-
|
|
1097
|
+
_ref21,
|
|
1058
1098
|
_product$num,
|
|
1059
|
-
|
|
1099
|
+
_ref22,
|
|
1060
1100
|
_product$quantity,
|
|
1061
1101
|
_product$metadata4;
|
|
1062
1102
|
if (!authoritativeProduct) return product;
|
|
@@ -1076,10 +1116,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1076
1116
|
});
|
|
1077
1117
|
return _objectSpread(_objectSpread(_objectSpread({}, product), authoritativeProduct), {}, {
|
|
1078
1118
|
id: (_product$id = product.id) !== null && _product$id !== void 0 ? _product$id : authoritativeProduct.id,
|
|
1079
|
-
product_id: (
|
|
1080
|
-
product_variant_id: (
|
|
1081
|
-
num: (
|
|
1082
|
-
quantity: (
|
|
1119
|
+
product_id: (_ref19 = (_product$product_id2 = product.product_id) !== null && _product$product_id2 !== void 0 ? _product$product_id2 : authoritativeProduct.product_id) !== null && _ref19 !== void 0 ? _ref19 : authoritativeProduct.id,
|
|
1120
|
+
product_variant_id: (_ref20 = (_product$product_vari = product.product_variant_id) !== null && _product$product_vari !== void 0 ? _product$product_vari : authoritativeProduct.product_variant_id) !== null && _ref20 !== void 0 ? _ref20 : 0,
|
|
1121
|
+
num: (_ref21 = (_product$num = product.num) !== null && _product$num !== void 0 ? _product$num : product.quantity) !== null && _ref21 !== void 0 ? _ref21 : authoritativeProduct.num,
|
|
1122
|
+
quantity: (_ref22 = (_product$quantity = product.quantity) !== null && _product$quantity !== void 0 ? _product$quantity : product.num) !== null && _ref22 !== void 0 ? _ref22 : authoritativeProduct.quantity,
|
|
1083
1123
|
product_sku: function () {
|
|
1084
1124
|
var authoritativeSku = ensureProductSku(authoritativeProduct);
|
|
1085
1125
|
var productSku = ensureProductSku(product);
|
|
@@ -1095,8 +1135,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1095
1135
|
}, {
|
|
1096
1136
|
key: "getSubmitOrderSalesChannel",
|
|
1097
1137
|
value: function getSubmitOrderSalesChannel() {
|
|
1098
|
-
var _this$
|
|
1099
|
-
return (_this$
|
|
1138
|
+
var _this$otherParams8;
|
|
1139
|
+
return (_this$otherParams8 = this.otherParams) === null || _this$otherParams8 === void 0 ? void 0 : _this$otherParams8.channel;
|
|
1100
1140
|
}
|
|
1101
1141
|
|
|
1102
1142
|
/**
|
|
@@ -1165,22 +1205,22 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1165
1205
|
value: (function () {
|
|
1166
1206
|
var _syncOtherParamsToSubModules = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(changedParams) {
|
|
1167
1207
|
var _this6 = this;
|
|
1168
|
-
var
|
|
1169
|
-
|
|
1208
|
+
var _ref23,
|
|
1209
|
+
_ref23$cover,
|
|
1170
1210
|
cover,
|
|
1171
1211
|
_args10 = arguments;
|
|
1172
1212
|
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
1173
1213
|
while (1) switch (_context10.prev = _context10.next) {
|
|
1174
1214
|
case 0:
|
|
1175
|
-
|
|
1215
|
+
_ref23 = _args10.length > 1 && _args10[1] !== undefined ? _args10[1] : {}, _ref23$cover = _ref23.cover, cover = _ref23$cover === void 0 ? false : _ref23$cover;
|
|
1176
1216
|
_context10.next = 3;
|
|
1177
1217
|
return Promise.all(Object.entries(this.store).map( /*#__PURE__*/function () {
|
|
1178
|
-
var
|
|
1179
|
-
var
|
|
1218
|
+
var _ref25 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(_ref24) {
|
|
1219
|
+
var _ref26, moduleName, subModule, targetModule, nextSubModuleOtherParams;
|
|
1180
1220
|
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
1181
1221
|
while (1) switch (_context9.prev = _context9.next) {
|
|
1182
1222
|
case 0:
|
|
1183
|
-
|
|
1223
|
+
_ref26 = _slicedToArray(_ref24, 2), moduleName = _ref26[0], subModule = _ref26[1];
|
|
1184
1224
|
if (!_this6.reusedSharedSubModuleNames.has(moduleName)) {
|
|
1185
1225
|
_context9.next = 3;
|
|
1186
1226
|
break;
|
|
@@ -1207,7 +1247,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1207
1247
|
}, _callee9);
|
|
1208
1248
|
}));
|
|
1209
1249
|
return function (_x10) {
|
|
1210
|
-
return
|
|
1250
|
+
return _ref25.apply(this, arguments);
|
|
1211
1251
|
};
|
|
1212
1252
|
}()));
|
|
1213
1253
|
case 3:
|
|
@@ -1326,11 +1366,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1326
1366
|
key: "initialize",
|
|
1327
1367
|
value: function () {
|
|
1328
1368
|
var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(core) {
|
|
1329
|
-
var _this$
|
|
1369
|
+
var _this$otherParams9,
|
|
1330
1370
|
_this$appPlugin2,
|
|
1331
1371
|
_this$appPlugin2$getA,
|
|
1332
1372
|
_this9 = this,
|
|
1333
|
-
_this$
|
|
1373
|
+
_this$otherParams10;
|
|
1334
1374
|
var options,
|
|
1335
1375
|
app,
|
|
1336
1376
|
targetCacheData,
|
|
@@ -1345,7 +1385,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1345
1385
|
this.paymentNumberDevicePrefix = null;
|
|
1346
1386
|
// this.store = { ...this.store, ...(options.store as Partial<BaseSalesState>) };
|
|
1347
1387
|
this.otherParams = options.otherParams || {};
|
|
1348
|
-
this.cacheId = (_this$
|
|
1388
|
+
this.cacheId = (_this$otherParams9 = this.otherParams) === null || _this$otherParams9 === void 0 ? void 0 : _this$otherParams9.cacheId;
|
|
1349
1389
|
this.reusedSharedSubModuleNames.clear();
|
|
1350
1390
|
this.window = core.getPlugin('window');
|
|
1351
1391
|
this.request = core.getPlugin('request');
|
|
@@ -1387,7 +1427,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1387
1427
|
_context11.next = 19;
|
|
1388
1428
|
return this.store.schedule.loadAllSchedule();
|
|
1389
1429
|
case 19:
|
|
1390
|
-
if (this.store.order && typeof ((_this$
|
|
1430
|
+
if (this.store.order && typeof ((_this$otherParams10 = this.otherParams) === null || _this$otherParams10 === void 0 ? void 0 : _this$otherParams10.enableTempOrderPersist) === 'boolean') {
|
|
1391
1431
|
this.store.order.setEnableTempOrderPersist(this.otherParams.enableTempOrderPersist);
|
|
1392
1432
|
}
|
|
1393
1433
|
_context11.next = 22;
|
|
@@ -1459,7 +1499,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1459
1499
|
key: "loadSalesDetail",
|
|
1460
1500
|
value: (function () {
|
|
1461
1501
|
var _loadSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(orderIdOrParams) {
|
|
1462
|
-
var loadSequence,
|
|
1502
|
+
var loadSequence, _ref27, _ref28, _ref29, _ref30, _params$orderId, params, externalSaleNumber, preloadedSalesDetail, lookup, loadedRecord, message, loadedSalesDetail, shouldFilterPendingPayments, remoteRecord, currentTempOrder, mergedRecord, record;
|
|
1463
1503
|
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
1464
1504
|
while (1) switch (_context13.prev = _context13.next) {
|
|
1465
1505
|
case 0:
|
|
@@ -1477,7 +1517,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1477
1517
|
};
|
|
1478
1518
|
externalSaleNumber = params.externalSaleNumber || params.external_sale_number;
|
|
1479
1519
|
preloadedSalesDetail = params.preloadedSalesDetail;
|
|
1480
|
-
lookup = (
|
|
1520
|
+
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;
|
|
1481
1521
|
if (!(!preloadedSalesDetail && (lookup === undefined || lookup === null || lookup === ''))) {
|
|
1482
1522
|
_context13.next = 11;
|
|
1483
1523
|
break;
|
|
@@ -1625,7 +1665,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1625
1665
|
}, {
|
|
1626
1666
|
key: "replaceTempOrder",
|
|
1627
1667
|
value: function () {
|
|
1628
|
-
var _replaceTempOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(tempOrder) {
|
|
1668
|
+
var _replaceTempOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(tempOrder, options) {
|
|
1629
1669
|
var nextTempOrder;
|
|
1630
1670
|
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
1631
1671
|
while (1) switch (_context14.prev = _context14.next) {
|
|
@@ -1637,7 +1677,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1637
1677
|
throw new Error('order 模块未初始化');
|
|
1638
1678
|
case 2:
|
|
1639
1679
|
_context14.next = 4;
|
|
1640
|
-
return this.store.order.replaceTempOrder(tempOrder);
|
|
1680
|
+
return this.store.order.replaceTempOrder(tempOrder, options);
|
|
1641
1681
|
case 4:
|
|
1642
1682
|
nextTempOrder = _context14.sent;
|
|
1643
1683
|
_context14.next = 7;
|
|
@@ -1652,7 +1692,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1652
1692
|
}
|
|
1653
1693
|
}, _callee14, this);
|
|
1654
1694
|
}));
|
|
1655
|
-
function replaceTempOrder(_x13) {
|
|
1695
|
+
function replaceTempOrder(_x13, _x14) {
|
|
1656
1696
|
return _replaceTempOrder.apply(this, arguments);
|
|
1657
1697
|
}
|
|
1658
1698
|
return replaceTempOrder;
|
|
@@ -2292,7 +2332,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2292
2332
|
}
|
|
2293
2333
|
}, _callee20, this, [[46, 65, 68, 71]]);
|
|
2294
2334
|
}));
|
|
2295
|
-
function loadDiscountConfig(
|
|
2335
|
+
function loadDiscountConfig(_x15) {
|
|
2296
2336
|
return _loadDiscountConfig.apply(this, arguments);
|
|
2297
2337
|
}
|
|
2298
2338
|
return loadDiscountConfig;
|
|
@@ -2390,7 +2430,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2390
2430
|
}
|
|
2391
2431
|
}, _callee21, this);
|
|
2392
2432
|
}));
|
|
2393
|
-
function bestDiscount(
|
|
2433
|
+
function bestDiscount(_x16) {
|
|
2394
2434
|
return _bestDiscount.apply(this, arguments);
|
|
2395
2435
|
}
|
|
2396
2436
|
return bestDiscount;
|
|
@@ -2453,7 +2493,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2453
2493
|
}
|
|
2454
2494
|
}, _callee22, this);
|
|
2455
2495
|
}));
|
|
2456
|
-
function replaceDiscountStoreLists(
|
|
2496
|
+
function replaceDiscountStoreLists(_x17) {
|
|
2457
2497
|
return _replaceDiscountStoreLists.apply(this, arguments);
|
|
2458
2498
|
}
|
|
2459
2499
|
return replaceDiscountStoreLists;
|
|
@@ -2515,7 +2555,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2515
2555
|
}
|
|
2516
2556
|
}, _callee23, this, [[0, 16]]);
|
|
2517
2557
|
}));
|
|
2518
|
-
function scanPromotionCode(
|
|
2558
|
+
function scanPromotionCode(_x18, _x19) {
|
|
2519
2559
|
return _scanPromotionCode.apply(this, arguments);
|
|
2520
2560
|
}
|
|
2521
2561
|
return scanPromotionCode;
|
|
@@ -2630,10 +2670,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2630
2670
|
product.discount_list = filterSelectedDiscountDetails(product.discount_list);
|
|
2631
2671
|
if (Array.isArray(product.product_bundle)) {
|
|
2632
2672
|
product.product_bundle = product.product_bundle.map(function (bundle) {
|
|
2633
|
-
var
|
|
2673
|
+
var _ref31, _bundle$original_pric;
|
|
2634
2674
|
var nextBundleDiscountList = filterSelectedDiscountDetails(bundle === null || bundle === void 0 ? void 0 : bundle.discount_list);
|
|
2635
2675
|
var shouldRestoreBundlePrice = nextBundleDiscountList.length === 0;
|
|
2636
|
-
var restoredBundlePrice = (
|
|
2676
|
+
var restoredBundlePrice = (_ref31 = (_bundle$original_pric = bundle === null || bundle === void 0 ? void 0 : bundle.original_price) !== null && _bundle$original_pric !== void 0 ? _bundle$original_pric : bundle === null || bundle === void 0 ? void 0 : bundle.product_price) !== null && _ref31 !== void 0 ? _ref31 : bundle === null || bundle === void 0 ? void 0 : bundle.price;
|
|
2637
2677
|
return _objectSpread(_objectSpread(_objectSpread({}, bundle), shouldRestoreBundlePrice ? {
|
|
2638
2678
|
price: restoredBundlePrice,
|
|
2639
2679
|
bundle_selling_price: restoredBundlePrice
|
|
@@ -2706,7 +2746,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2706
2746
|
}
|
|
2707
2747
|
}, _callee24, this, [[0, 54], [17, 38, 41, 44]]);
|
|
2708
2748
|
}));
|
|
2709
|
-
function setDiscountSelected(
|
|
2749
|
+
function setDiscountSelected(_x20) {
|
|
2710
2750
|
return _setDiscountSelected.apply(this, arguments);
|
|
2711
2751
|
}
|
|
2712
2752
|
return setDiscountSelected;
|
|
@@ -2776,7 +2816,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2776
2816
|
}
|
|
2777
2817
|
}, _callee25, this, [[0, 21]]);
|
|
2778
2818
|
}));
|
|
2779
|
-
function applyDiscountCalculationResult(
|
|
2819
|
+
function applyDiscountCalculationResult(_x21) {
|
|
2780
2820
|
return _applyDiscountCalculationResult.apply(this, arguments);
|
|
2781
2821
|
}
|
|
2782
2822
|
return applyDiscountCalculationResult;
|
|
@@ -2795,7 +2835,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2795
2835
|
}
|
|
2796
2836
|
}, _callee26, this);
|
|
2797
2837
|
}));
|
|
2798
|
-
function submitScanOrder(
|
|
2838
|
+
function submitScanOrder(_x22) {
|
|
2799
2839
|
return _submitScanOrder.apply(this, arguments);
|
|
2800
2840
|
}
|
|
2801
2841
|
return submitScanOrder;
|
|
@@ -2810,7 +2850,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2810
2850
|
key: "submitSalesOrder",
|
|
2811
2851
|
value: (function () {
|
|
2812
2852
|
var _submitSalesOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(params) {
|
|
2813
|
-
var _params$smallTicketDa, _this$
|
|
2853
|
+
var _params$smallTicketDa, _this$otherParams11, _this$otherParams12, _this$otherParams13, _this$otherParams14;
|
|
2814
2854
|
var inferredPaymentStatus, smallTicketDataFlag, submitParams;
|
|
2815
2855
|
return _regeneratorRuntime().wrap(function _callee27$(_context27) {
|
|
2816
2856
|
while (1) switch (_context27.prev = _context27.next) {
|
|
@@ -2826,10 +2866,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2826
2866
|
smallTicketDataFlag = (_params$smallTicketDa = params === null || params === void 0 ? void 0 : params.smallTicketDataFlag) !== null && _params$smallTicketDa !== void 0 ? _params$smallTicketDa : this.getDefaultCheckoutSmallTicketDataFlag();
|
|
2827
2867
|
submitParams = _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
2828
2868
|
cacheId: this.cacheId,
|
|
2829
|
-
platform: (_this$
|
|
2830
|
-
businessCode: ((_this$
|
|
2869
|
+
platform: (_this$otherParams11 = this.otherParams) === null || _this$otherParams11 === void 0 ? void 0 : _this$otherParams11.platform,
|
|
2870
|
+
businessCode: ((_this$otherParams12 = this.otherParams) === null || _this$otherParams12 === void 0 ? void 0 : _this$otherParams12.businessCode) || ((_this$otherParams13 = this.otherParams) === null || _this$otherParams13 === void 0 ? void 0 : _this$otherParams13.business_code),
|
|
2831
2871
|
channel: this.getSubmitOrderSalesChannel(),
|
|
2832
|
-
type: (_this$
|
|
2872
|
+
type: (_this$otherParams14 = this.otherParams) === null || _this$otherParams14 === void 0 ? void 0 : _this$otherParams14.type,
|
|
2833
2873
|
request_unique_idempotency_token: this.store.order.generateIdempotencyToken()
|
|
2834
2874
|
}, (params === null || params === void 0 ? void 0 : params.payments) !== undefined ? {
|
|
2835
2875
|
payments: params.payments
|
|
@@ -2849,7 +2889,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2849
2889
|
}
|
|
2850
2890
|
}, _callee27, this);
|
|
2851
2891
|
}));
|
|
2852
|
-
function submitSalesOrder(
|
|
2892
|
+
function submitSalesOrder(_x23) {
|
|
2853
2893
|
return _submitSalesOrder.apply(this, arguments);
|
|
2854
2894
|
}
|
|
2855
2895
|
return submitSalesOrder;
|
|
@@ -2858,7 +2898,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2858
2898
|
key: "saveSalesOrderDraft",
|
|
2859
2899
|
value: function () {
|
|
2860
2900
|
var _saveSalesOrderDraft = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(params) {
|
|
2861
|
-
var _params$platform, _this$
|
|
2901
|
+
var _params$platform, _this$otherParams15, _this$otherParams16, _this$otherParams17, _params$channel, _params$type, _this$otherParams18;
|
|
2862
2902
|
return _regeneratorRuntime().wrap(function _callee28$(_context28) {
|
|
2863
2903
|
while (1) switch (_context28.prev = _context28.next) {
|
|
2864
2904
|
case 0:
|
|
@@ -2870,10 +2910,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2870
2910
|
case 2:
|
|
2871
2911
|
return _context28.abrupt("return", this.store.order.saveTempOrderAsDraft(_objectSpread({
|
|
2872
2912
|
cacheId: this.cacheId,
|
|
2873
|
-
platform: (_params$platform = params === null || params === void 0 ? void 0 : params.platform) !== null && _params$platform !== void 0 ? _params$platform : (_this$
|
|
2874
|
-
businessCode: (params === null || params === void 0 ? void 0 : params.businessCode) || ((_this$
|
|
2913
|
+
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
|
+
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),
|
|
2875
2915
|
channel: (_params$channel = params === null || params === void 0 ? void 0 : params.channel) !== null && _params$channel !== void 0 ? _params$channel : this.getSubmitOrderSalesChannel(),
|
|
2876
|
-
type: (_params$type = params === null || params === void 0 ? void 0 : params.type) !== null && _params$type !== void 0 ? _params$type : (_this$
|
|
2916
|
+
type: (_params$type = params === null || params === void 0 ? void 0 : params.type) !== null && _params$type !== void 0 ? _params$type : (_this$otherParams18 = this.otherParams) === null || _this$otherParams18 === void 0 ? void 0 : _this$otherParams18.type
|
|
2877
2917
|
}, (params === null || params === void 0 ? void 0 : params.enhancePayload) !== undefined ? {
|
|
2878
2918
|
enhancePayload: params.enhancePayload
|
|
2879
2919
|
} : {})));
|
|
@@ -2883,7 +2923,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2883
2923
|
}
|
|
2884
2924
|
}, _callee28, this);
|
|
2885
2925
|
}));
|
|
2886
|
-
function saveSalesOrderDraft(
|
|
2926
|
+
function saveSalesOrderDraft(_x24) {
|
|
2887
2927
|
return _saveSalesOrderDraft.apply(this, arguments);
|
|
2888
2928
|
}
|
|
2889
2929
|
return saveSalesOrderDraft;
|
|
@@ -2892,7 +2932,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2892
2932
|
key: "submitTempOrderAsync",
|
|
2893
2933
|
value: function () {
|
|
2894
2934
|
var _submitTempOrderAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(params) {
|
|
2895
|
-
var _params$smallTicketDa2, _this$
|
|
2935
|
+
var _params$smallTicketDa2, _this$otherParams19, _this$otherParams20, _this$otherParams21, _this$otherParams22;
|
|
2896
2936
|
var inferredPaymentStatus, smallTicketDataFlag, submitParams;
|
|
2897
2937
|
return _regeneratorRuntime().wrap(function _callee29$(_context29) {
|
|
2898
2938
|
while (1) switch (_context29.prev = _context29.next) {
|
|
@@ -2907,10 +2947,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2907
2947
|
smallTicketDataFlag = (_params$smallTicketDa2 = params === null || params === void 0 ? void 0 : params.smallTicketDataFlag) !== null && _params$smallTicketDa2 !== void 0 ? _params$smallTicketDa2 : this.getDefaultCheckoutSmallTicketDataFlag();
|
|
2908
2948
|
submitParams = _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
2909
2949
|
cacheId: this.cacheId,
|
|
2910
|
-
platform: (_this$
|
|
2911
|
-
businessCode: ((_this$
|
|
2950
|
+
platform: (_this$otherParams19 = this.otherParams) === null || _this$otherParams19 === void 0 ? void 0 : _this$otherParams19.platform,
|
|
2951
|
+
businessCode: ((_this$otherParams20 = this.otherParams) === null || _this$otherParams20 === void 0 ? void 0 : _this$otherParams20.businessCode) || ((_this$otherParams21 = this.otherParams) === null || _this$otherParams21 === void 0 ? void 0 : _this$otherParams21.business_code),
|
|
2912
2952
|
channel: this.getSubmitOrderSalesChannel(),
|
|
2913
|
-
type: (_this$
|
|
2953
|
+
type: (_this$otherParams22 = this.otherParams) === null || _this$otherParams22 === void 0 ? void 0 : _this$otherParams22.type,
|
|
2914
2954
|
request_unique_idempotency_token: this.store.order.generateIdempotencyToken()
|
|
2915
2955
|
}, (params === null || params === void 0 ? void 0 : params.payments) !== undefined ? {
|
|
2916
2956
|
payments: params.payments
|
|
@@ -2930,7 +2970,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2930
2970
|
}
|
|
2931
2971
|
}, _callee29, this);
|
|
2932
2972
|
}));
|
|
2933
|
-
function submitTempOrderAsync(
|
|
2973
|
+
function submitTempOrderAsync(_x25) {
|
|
2934
2974
|
return _submitTempOrderAsync.apply(this, arguments);
|
|
2935
2975
|
}
|
|
2936
2976
|
return submitTempOrderAsync;
|
|
@@ -2942,8 +2982,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2942
2982
|
}, {
|
|
2943
2983
|
key: "shouldUseCheckoutSyncTask",
|
|
2944
2984
|
value: function shouldUseCheckoutSyncTask() {
|
|
2945
|
-
var _this$
|
|
2946
|
-
var configured = (_this$
|
|
2985
|
+
var _this$otherParams23;
|
|
2986
|
+
var configured = (_this$otherParams23 = this.otherParams) === null || _this$otherParams23 === void 0 ? void 0 : _this$otherParams23.checkoutSyncTaskEnabled;
|
|
2947
2987
|
return typeof configured === 'boolean' ? configured : true;
|
|
2948
2988
|
}
|
|
2949
2989
|
|
|
@@ -2957,7 +2997,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2957
2997
|
key: "printLocalOrderReceipt",
|
|
2958
2998
|
value: function () {
|
|
2959
2999
|
var _printLocalOrderReceipt = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(lookup) {
|
|
2960
|
-
var _this$
|
|
3000
|
+
var _this$otherParams24, _this$otherParams25, _this$otherParams26, _this$otherParams27;
|
|
2961
3001
|
var hasLookup, lookupPayload, context, payload, response, _this$store$order$app, _this$store$order5, _data;
|
|
2962
3002
|
return _regeneratorRuntime().wrap(function _callee30$(_context30) {
|
|
2963
3003
|
while (1) switch (_context30.prev = _context30.next) {
|
|
@@ -2975,10 +3015,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2975
3015
|
external_sale_number: lookup
|
|
2976
3016
|
};
|
|
2977
3017
|
context = {
|
|
2978
|
-
platform: (_this$
|
|
2979
|
-
businessCode: ((_this$
|
|
3018
|
+
platform: (_this$otherParams24 = this.otherParams) === null || _this$otherParams24 === void 0 ? void 0 : _this$otherParams24.platform,
|
|
3019
|
+
businessCode: ((_this$otherParams25 = this.otherParams) === null || _this$otherParams25 === void 0 ? void 0 : _this$otherParams25.businessCode) || ((_this$otherParams26 = this.otherParams) === null || _this$otherParams26 === void 0 ? void 0 : _this$otherParams26.business_code),
|
|
2980
3020
|
channel: this.getSubmitOrderSalesChannel(),
|
|
2981
|
-
type: (_this$
|
|
3021
|
+
type: (_this$otherParams27 = this.otherParams) === null || _this$otherParams27 === void 0 ? void 0 : _this$otherParams27.type
|
|
2982
3022
|
};
|
|
2983
3023
|
payload = hasLookup ? _objectSpread(_objectSpread({}, lookupPayload), {}, {
|
|
2984
3024
|
lookup_order_from_db: 1,
|
|
@@ -3015,7 +3055,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3015
3055
|
}
|
|
3016
3056
|
}, _callee30, this);
|
|
3017
3057
|
}));
|
|
3018
|
-
function printLocalOrderReceipt(
|
|
3058
|
+
function printLocalOrderReceipt(_x26) {
|
|
3019
3059
|
return _printLocalOrderReceipt.apply(this, arguments);
|
|
3020
3060
|
}
|
|
3021
3061
|
return printLocalOrderReceipt;
|
|
@@ -3037,7 +3077,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3037
3077
|
key: "syncPaymentsToOrder",
|
|
3038
3078
|
value: function () {
|
|
3039
3079
|
var _syncPaymentsToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(params) {
|
|
3040
|
-
var
|
|
3080
|
+
var _ref32, _params$businessCode, _this$otherParams28, _this$otherParams29, _params$channel2;
|
|
3041
3081
|
var businessCode, channel, syncParams, syncState, payments, syncResult, latestPayments, amountSnapshot, orderSnapshot, syncPayload;
|
|
3042
3082
|
return _regeneratorRuntime().wrap(function _callee31$(_context31) {
|
|
3043
3083
|
while (1) switch (_context31.prev = _context31.next) {
|
|
@@ -3048,7 +3088,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3048
3088
|
}
|
|
3049
3089
|
throw new Error('order 模块未初始化');
|
|
3050
3090
|
case 2:
|
|
3051
|
-
businessCode = (
|
|
3091
|
+
businessCode = (_ref32 = (_params$businessCode = params.businessCode) !== null && _params$businessCode !== void 0 ? _params$businessCode : (_this$otherParams28 = this.otherParams) === null || _this$otherParams28 === void 0 ? void 0 : _this$otherParams28.businessCode) !== null && _ref32 !== void 0 ? _ref32 : (_this$otherParams29 = this.otherParams) === null || _this$otherParams29 === void 0 ? void 0 : _this$otherParams29.business_code;
|
|
3052
3092
|
channel = (_params$channel2 = params.channel) !== null && _params$channel2 !== void 0 ? _params$channel2 : this.getSubmitOrderSalesChannel();
|
|
3053
3093
|
syncParams = _objectSpread(_objectSpread(_objectSpread({}, params), {}, {
|
|
3054
3094
|
checkoutSyncTaskEnabled: this.shouldUseCheckoutSyncTask()
|
|
@@ -3129,7 +3169,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3129
3169
|
}
|
|
3130
3170
|
}, _callee31, this, [[12, 29]]);
|
|
3131
3171
|
}));
|
|
3132
|
-
function syncPaymentsToOrder(
|
|
3172
|
+
function syncPaymentsToOrder(_x27) {
|
|
3133
3173
|
return _syncPaymentsToOrder.apply(this, arguments);
|
|
3134
3174
|
}
|
|
3135
3175
|
return syncPaymentsToOrder;
|
|
@@ -3299,7 +3339,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3299
3339
|
}
|
|
3300
3340
|
}, _callee33, this);
|
|
3301
3341
|
}));
|
|
3302
|
-
function addOrderPaymentAsync(
|
|
3342
|
+
function addOrderPaymentAsync(_x28) {
|
|
3303
3343
|
return _addOrderPaymentAsync.apply(this, arguments);
|
|
3304
3344
|
}
|
|
3305
3345
|
return addOrderPaymentAsync;
|
|
@@ -3307,10 +3347,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3307
3347
|
}, {
|
|
3308
3348
|
key: "addOrderPaymentWithDevicePrefix",
|
|
3309
3349
|
value: function addOrderPaymentWithDevicePrefix(payment, devicePrefix) {
|
|
3310
|
-
var _this$
|
|
3350
|
+
var _this$otherParams30,
|
|
3311
3351
|
_paymentRecord$paymen,
|
|
3312
3352
|
_paymentRecord$create,
|
|
3313
|
-
|
|
3353
|
+
_ref33,
|
|
3314
3354
|
_paymentRecord$origin,
|
|
3315
3355
|
_this14 = this;
|
|
3316
3356
|
if (!this.store.order) throw new Error('order 模块未初始化');
|
|
@@ -3323,7 +3363,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3323
3363
|
return this.store.order.getOrderPayments();
|
|
3324
3364
|
}
|
|
3325
3365
|
var metadata = paymentRecord.metadata && _typeof(paymentRecord.metadata) === 'object' ? _objectSpread({}, paymentRecord.metadata) : {};
|
|
3326
|
-
var shopWalletPassId = (_this$
|
|
3366
|
+
var shopWalletPassId = (_this$otherParams30 = this.otherParams) === null || _this$otherParams30 === void 0 ? void 0 : _this$otherParams30.shop_wallet_pass_id;
|
|
3327
3367
|
if (shopWalletPassId !== undefined && shopWalletPassId !== null) {
|
|
3328
3368
|
metadata.shop_wallet_pass_id = shopWalletPassId;
|
|
3329
3369
|
}
|
|
@@ -3332,7 +3372,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3332
3372
|
var paymentTime = (_paymentRecord$paymen = paymentRecord.payment_time) !== null && _paymentRecord$paymen !== void 0 ? _paymentRecord$paymen : paymentTimestamp;
|
|
3333
3373
|
var createdAt = (_paymentRecord$create = paymentRecord.created_at) !== null && _paymentRecord$create !== void 0 ? _paymentRecord$create : paymentTimestamp;
|
|
3334
3374
|
var serviceCharge = paymentRecord.service_charge && _typeof(paymentRecord.service_charge) === 'object' ? paymentRecord.service_charge : null;
|
|
3335
|
-
var calculatedServiceFee = serviceCharge ? new Decimal((
|
|
3375
|
+
var calculatedServiceFee = serviceCharge ? new Decimal((_ref33 = (_paymentRecord$origin = paymentRecord.origin_amount) !== null && _paymentRecord$origin !== void 0 ? _paymentRecord$origin : paymentRecord.amount) !== null && _ref33 !== void 0 ? _ref33 : 0).times(serviceCharge.percentage || 0).plus(serviceCharge.amount || 0).toDecimalPlaces(2).toFixed(2) : undefined;
|
|
3336
3376
|
var payments = this.store.order.addOrderPayment(_objectSpread(_objectSpread(_objectSpread({}, normalizedPaymentRecord), calculatedServiceFee !== undefined ? {
|
|
3337
3377
|
service_fee: calculatedServiceFee
|
|
3338
3378
|
} : {}), {}, {
|
|
@@ -3487,7 +3527,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3487
3527
|
}
|
|
3488
3528
|
}, _callee34, this, [[17, 23]]);
|
|
3489
3529
|
}));
|
|
3490
|
-
function updateOrderPayment(
|
|
3530
|
+
function updateOrderPayment(_x29, _x30) {
|
|
3491
3531
|
return _updateOrderPayment.apply(this, arguments);
|
|
3492
3532
|
}
|
|
3493
3533
|
return updateOrderPayment;
|
|
@@ -3526,7 +3566,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3526
3566
|
}
|
|
3527
3567
|
}, _callee35, this);
|
|
3528
3568
|
}));
|
|
3529
|
-
function updateVoucherOrderPaymentsAsync(
|
|
3569
|
+
function updateVoucherOrderPaymentsAsync(_x31, _x32) {
|
|
3530
3570
|
return _updateVoucherOrderPaymentsAsync.apply(this, arguments);
|
|
3531
3571
|
}
|
|
3532
3572
|
return updateVoucherOrderPaymentsAsync;
|
|
@@ -3613,7 +3653,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3613
3653
|
}, {
|
|
3614
3654
|
key: "buildWalletInitBusinessData",
|
|
3615
3655
|
value: function buildWalletInitBusinessData(params) {
|
|
3616
|
-
var _this$store$order8, _params$order_wait_pa,
|
|
3656
|
+
var _this$store$order8, _params$order_wait_pa, _ref34, _tempOrder$is_price_i;
|
|
3617
3657
|
var snapshot = (_this$store$order8 = this.store.order) === null || _this$store$order8 === void 0 ? void 0 : _this$store$order8.getOrderSnapshot();
|
|
3618
3658
|
var tempOrder = snapshot === null || snapshot === void 0 ? void 0 : snapshot.tempOrder;
|
|
3619
3659
|
var amount = snapshot === null || snapshot === void 0 ? void 0 : snapshot.amount;
|
|
@@ -3629,7 +3669,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3629
3669
|
},
|
|
3630
3670
|
products: this.getWalletProductList(),
|
|
3631
3671
|
order_wait_pay_amount: (_params$order_wait_pa = params === null || params === void 0 ? void 0 : params.order_wait_pay_amount) !== null && _params$order_wait_pa !== void 0 ? _params$order_wait_pa : Number(amount.amountGap || 0),
|
|
3632
|
-
is_price_include_tax: (
|
|
3672
|
+
is_price_include_tax: (_ref34 = (_tempOrder$is_price_i = tempOrder.is_price_include_tax) !== null && _tempOrder$is_price_i !== void 0 ? _tempOrder$is_price_i : this.otherParams.is_price_include_tax) !== null && _ref34 !== void 0 ? _ref34 : 1
|
|
3633
3673
|
}, snapshot.identity.orderId ? {
|
|
3634
3674
|
payment_order_id: String(snapshot.identity.orderId)
|
|
3635
3675
|
} : {});
|
|
@@ -3692,7 +3732,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3692
3732
|
}
|
|
3693
3733
|
}, _callee36, this);
|
|
3694
3734
|
}));
|
|
3695
|
-
function initWalletData(
|
|
3735
|
+
function initWalletData(_x33) {
|
|
3696
3736
|
return _initWalletData.apply(this, arguments);
|
|
3697
3737
|
}
|
|
3698
3738
|
return initWalletData;
|
|
@@ -3719,9 +3759,9 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3719
3759
|
var walletPassName = fundRecord.wallet_pass_name;
|
|
3720
3760
|
var title = walletPassName && _typeof(walletPassName) === 'object' ? walletPassName.default || Object.values(walletPassName)[0] : walletPassName;
|
|
3721
3761
|
var code = String((payment === null || payment === void 0 ? void 0 : payment.code) || '').toUpperCase();
|
|
3722
|
-
var tag = ((_Object$entries$find = Object.entries(WALLET_PAYMENT_CODE_BY_TAG).find(function (
|
|
3723
|
-
var
|
|
3724
|
-
paymentCode =
|
|
3762
|
+
var tag = ((_Object$entries$find = Object.entries(WALLET_PAYMENT_CODE_BY_TAG).find(function (_ref35) {
|
|
3763
|
+
var _ref36 = _slicedToArray(_ref35, 2),
|
|
3764
|
+
paymentCode = _ref36[1];
|
|
3725
3765
|
return paymentCode === code;
|
|
3726
3766
|
})) === null || _Object$entries$find === void 0 ? void 0 : _Object$entries$find[0]) || fundRecord.tag;
|
|
3727
3767
|
return {
|
|
@@ -3759,7 +3799,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3759
3799
|
}
|
|
3760
3800
|
}, _callee37, this);
|
|
3761
3801
|
}));
|
|
3762
|
-
function publishWalletAssetsState(
|
|
3802
|
+
function publishWalletAssetsState(_x34) {
|
|
3763
3803
|
return _publishWalletAssetsState.apply(this, arguments);
|
|
3764
3804
|
}
|
|
3765
3805
|
return publishWalletAssetsState;
|
|
@@ -3840,7 +3880,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3840
3880
|
}
|
|
3841
3881
|
}, _callee38, this);
|
|
3842
3882
|
}));
|
|
3843
|
-
function syncSelectedWalletAssets(
|
|
3883
|
+
function syncSelectedWalletAssets(_x35) {
|
|
3844
3884
|
return _syncSelectedWalletAssets.apply(this, arguments);
|
|
3845
3885
|
}
|
|
3846
3886
|
return syncSelectedWalletAssets;
|
|
@@ -3896,7 +3936,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3896
3936
|
}
|
|
3897
3937
|
}, _callee39, this);
|
|
3898
3938
|
}));
|
|
3899
|
-
function importWalletAssetsSnapshot(
|
|
3939
|
+
function importWalletAssetsSnapshot(_x36) {
|
|
3900
3940
|
return _importWalletAssetsSnapshot.apply(this, arguments);
|
|
3901
3941
|
}
|
|
3902
3942
|
return importWalletAssetsSnapshot;
|
|
@@ -3984,7 +4024,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3984
4024
|
}
|
|
3985
4025
|
}, _callee40, this);
|
|
3986
4026
|
}));
|
|
3987
|
-
function refreshWalletAssets(
|
|
4027
|
+
function refreshWalletAssets(_x37) {
|
|
3988
4028
|
return _refreshWalletAssets.apply(this, arguments);
|
|
3989
4029
|
}
|
|
3990
4030
|
return refreshWalletAssets;
|
|
@@ -4017,7 +4057,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4017
4057
|
}
|
|
4018
4058
|
}, _callee41, this);
|
|
4019
4059
|
}));
|
|
4020
|
-
function selectWalletAsset(
|
|
4060
|
+
function selectWalletAsset(_x38) {
|
|
4021
4061
|
return _selectWalletAsset.apply(this, arguments);
|
|
4022
4062
|
}
|
|
4023
4063
|
return selectWalletAsset;
|
|
@@ -4057,7 +4097,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4057
4097
|
}
|
|
4058
4098
|
}, _callee42, this);
|
|
4059
4099
|
}));
|
|
4060
|
-
function scanWalletAsset(
|
|
4100
|
+
function scanWalletAsset(_x39) {
|
|
4061
4101
|
return _scanWalletAsset.apply(this, arguments);
|
|
4062
4102
|
}
|
|
4063
4103
|
return scanWalletAsset;
|
|
@@ -4187,7 +4227,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4187
4227
|
key: "getCashPaymentConfig",
|
|
4188
4228
|
value: (function () {
|
|
4189
4229
|
var _getCashPaymentConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee45() {
|
|
4190
|
-
var _this$store$order11, _this$store$order11$g, _this$store$order12, _this$store$order12$g, _this$
|
|
4230
|
+
var _this$store$order11, _this$store$order11$g, _this$store$order12, _this$store$order12$g, _this$otherParams31;
|
|
4191
4231
|
var paymentMethods, paymentMethod, amountSnapshot, pendingWalletAmount, amountDue, currency, recommendedAmounts;
|
|
4192
4232
|
return _regeneratorRuntime().wrap(function _callee45$(_context45) {
|
|
4193
4233
|
while (1) switch (_context45.prev = _context45.next) {
|
|
@@ -4213,7 +4253,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4213
4253
|
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);
|
|
4214
4254
|
pendingWalletAmount = this.getPendingWalletPaymentAmount();
|
|
4215
4255
|
amountDue = Decimal.max(new Decimal((amountSnapshot === null || amountSnapshot === void 0 ? void 0 : amountSnapshot.amountGap) || 0).minus(pendingWalletAmount), 0).toDecimalPlaces(2).toNumber();
|
|
4216
|
-
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$
|
|
4256
|
+
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';
|
|
4217
4257
|
recommendedAmounts = amountDue > 0 ? this.store.payment.cash.getRecommendedAmount(amountDue, currency) : [];
|
|
4218
4258
|
return _context45.abrupt("return", {
|
|
4219
4259
|
available: Boolean(paymentMethod && amountDue > 0),
|
|
@@ -4283,7 +4323,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4283
4323
|
_context46.next = 17;
|
|
4284
4324
|
break;
|
|
4285
4325
|
}
|
|
4286
|
-
throw new Error(getSalesSubmitErrorMessage(submitResult));
|
|
4326
|
+
throw new Error(getSalesSubmitErrorMessage(submitResult, 'Wallet 支付确认失败'));
|
|
4287
4327
|
case 17:
|
|
4288
4328
|
_context46.next = 27;
|
|
4289
4329
|
break;
|
|
@@ -4348,7 +4388,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4348
4388
|
key: "payCash",
|
|
4349
4389
|
value: (function () {
|
|
4350
4390
|
var _payCash = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee47(params) {
|
|
4351
|
-
var _this$store$order$get6, _params$actualPaidAmo, _this$
|
|
4391
|
+
var _this$store$order$get6, _params$actualPaidAmo, _this$otherParams32, _this$window, _this$window$postMess;
|
|
4352
4392
|
var amount, config, paymentMethod, roundingAmount, effectivePaymentAmount, beforePayments, beforePaymentStatus, uniquePaymentNumber, paymentTimestamp, actualPaidAmount, changeAmount, shopWalletPassId, payments, payment, syncResult, committed, walletState, restoredTempOrder;
|
|
4353
4393
|
return _regeneratorRuntime().wrap(function _callee47$(_context47) {
|
|
4354
4394
|
while (1) switch (_context47.prev = _context47.next) {
|
|
@@ -4397,7 +4437,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4397
4437
|
paymentTimestamp = dayjs().format('YYYY-MM-DD HH:mm:ss');
|
|
4398
4438
|
actualPaidAmount = Number((_params$actualPaidAmo = params.actualPaidAmount) !== null && _params$actualPaidAmo !== void 0 ? _params$actualPaidAmo : amount);
|
|
4399
4439
|
changeAmount = Number(params.changeAmount || 0);
|
|
4400
|
-
shopWalletPassId = (_this$
|
|
4440
|
+
shopWalletPassId = (_this$otherParams32 = this.otherParams) === null || _this$otherParams32 === void 0 ? void 0 : _this$otherParams32.shop_wallet_pass_id;
|
|
4401
4441
|
if (!(!Number.isFinite(actualPaidAmount) || actualPaidAmount + 0.01 < amount)) {
|
|
4402
4442
|
_context47.next = 26;
|
|
4403
4443
|
break;
|
|
@@ -4444,23 +4484,29 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4444
4484
|
});
|
|
4445
4485
|
case 32:
|
|
4446
4486
|
syncResult = _context47.sent;
|
|
4487
|
+
if (!isRejectedSalesSubmitResult(syncResult.submitResult)) {
|
|
4488
|
+
_context47.next = 35;
|
|
4489
|
+
break;
|
|
4490
|
+
}
|
|
4491
|
+
throw new Error(getSalesSubmitErrorMessage(syncResult.submitResult, '订单提交失败'));
|
|
4492
|
+
case 35:
|
|
4447
4493
|
if (!this.store.payment) {
|
|
4448
|
-
_context47.next =
|
|
4494
|
+
_context47.next = 40;
|
|
4449
4495
|
break;
|
|
4450
4496
|
}
|
|
4451
4497
|
committed = this.getCommittedWalletAssets();
|
|
4452
4498
|
walletState = this.store.payment.wallet.setCommittedWalletAssets(committed.ids, committed.assets);
|
|
4453
|
-
_context47.next =
|
|
4499
|
+
_context47.next = 40;
|
|
4454
4500
|
return this.publishWalletAssetsState(walletState);
|
|
4455
|
-
case
|
|
4501
|
+
case 40:
|
|
4456
4502
|
return _context47.abrupt("return", {
|
|
4457
4503
|
payment: payment || {},
|
|
4458
4504
|
payments: this.store.order.getOrderPayments(),
|
|
4459
4505
|
syncResult: syncResult,
|
|
4460
4506
|
isOrderFullyPaid: syncResult.isOrderFullyPaid
|
|
4461
4507
|
});
|
|
4462
|
-
case
|
|
4463
|
-
_context47.prev =
|
|
4508
|
+
case 43:
|
|
4509
|
+
_context47.prev = 43;
|
|
4464
4510
|
_context47.t0 = _context47["catch"](29);
|
|
4465
4511
|
this.store.order.setOrderPayments(beforePayments);
|
|
4466
4512
|
restoredTempOrder = this.store.order.getTempOrder();
|
|
@@ -4468,19 +4514,19 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4468
4514
|
restoredTempOrder.payment_status = beforePaymentStatus;
|
|
4469
4515
|
this.store.order.persistTempOrder();
|
|
4470
4516
|
}
|
|
4471
|
-
_context47.next =
|
|
4517
|
+
_context47.next = 50;
|
|
4472
4518
|
return this.store.order.recalculateSummary({
|
|
4473
4519
|
createIfMissing: true
|
|
4474
4520
|
});
|
|
4475
|
-
case
|
|
4521
|
+
case 50:
|
|
4476
4522
|
throw _context47.t0;
|
|
4477
|
-
case
|
|
4523
|
+
case 51:
|
|
4478
4524
|
case "end":
|
|
4479
4525
|
return _context47.stop();
|
|
4480
4526
|
}
|
|
4481
|
-
}, _callee47, this, [[29,
|
|
4527
|
+
}, _callee47, this, [[29, 43]]);
|
|
4482
4528
|
}));
|
|
4483
|
-
function payCash(
|
|
4529
|
+
function payCash(_x40) {
|
|
4484
4530
|
return _payCash.apply(this, arguments);
|
|
4485
4531
|
}
|
|
4486
4532
|
return payCash;
|
|
@@ -4600,23 +4646,29 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4600
4646
|
});
|
|
4601
4647
|
case 33:
|
|
4602
4648
|
syncResult = _context48.sent;
|
|
4649
|
+
if (!isRejectedSalesSubmitResult(syncResult.submitResult)) {
|
|
4650
|
+
_context48.next = 36;
|
|
4651
|
+
break;
|
|
4652
|
+
}
|
|
4653
|
+
throw new Error(getSalesSubmitErrorMessage(syncResult.submitResult, '订单提交失败'));
|
|
4654
|
+
case 36:
|
|
4603
4655
|
if (!this.store.payment) {
|
|
4604
|
-
_context48.next =
|
|
4656
|
+
_context48.next = 41;
|
|
4605
4657
|
break;
|
|
4606
4658
|
}
|
|
4607
4659
|
committed = this.getCommittedWalletAssets();
|
|
4608
4660
|
walletState = this.store.payment.wallet.setCommittedWalletAssets(committed.ids, committed.assets);
|
|
4609
|
-
_context48.next =
|
|
4661
|
+
_context48.next = 41;
|
|
4610
4662
|
return this.publishWalletAssetsState(walletState);
|
|
4611
|
-
case
|
|
4663
|
+
case 41:
|
|
4612
4664
|
return _context48.abrupt("return", {
|
|
4613
4665
|
payment: payment || {},
|
|
4614
4666
|
payments: this.store.order.getOrderPayments(),
|
|
4615
4667
|
syncResult: syncResult,
|
|
4616
4668
|
isOrderFullyPaid: syncResult.isOrderFullyPaid
|
|
4617
4669
|
});
|
|
4618
|
-
case
|
|
4619
|
-
_context48.prev =
|
|
4670
|
+
case 44:
|
|
4671
|
+
_context48.prev = 44;
|
|
4620
4672
|
_context48.t0 = _context48["catch"](30);
|
|
4621
4673
|
this.store.order.setOrderPayments(beforePayments);
|
|
4622
4674
|
restoredTempOrder = this.store.order.getTempOrder();
|
|
@@ -4624,19 +4676,19 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4624
4676
|
restoredTempOrder.payment_status = beforePaymentStatus;
|
|
4625
4677
|
this.store.order.persistTempOrder();
|
|
4626
4678
|
}
|
|
4627
|
-
_context48.next =
|
|
4679
|
+
_context48.next = 51;
|
|
4628
4680
|
return this.store.order.recalculateSummary({
|
|
4629
4681
|
createIfMissing: true
|
|
4630
4682
|
});
|
|
4631
|
-
case
|
|
4683
|
+
case 51:
|
|
4632
4684
|
throw _context48.t0;
|
|
4633
|
-
case
|
|
4685
|
+
case 52:
|
|
4634
4686
|
case "end":
|
|
4635
4687
|
return _context48.stop();
|
|
4636
4688
|
}
|
|
4637
|
-
}, _callee48, this, [[30,
|
|
4689
|
+
}, _callee48, this, [[30, 44]]);
|
|
4638
4690
|
}));
|
|
4639
|
-
function commitPaymentMethodPayment(
|
|
4691
|
+
function commitPaymentMethodPayment(_x41) {
|
|
4640
4692
|
return _commitPaymentMethodPayment.apply(this, arguments);
|
|
4641
4693
|
}
|
|
4642
4694
|
return commitPaymentMethodPayment;
|
|
@@ -4684,7 +4736,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4684
4736
|
}
|
|
4685
4737
|
}, _callee49, this);
|
|
4686
4738
|
}));
|
|
4687
|
-
function roundAmount(
|
|
4739
|
+
function roundAmount(_x42) {
|
|
4688
4740
|
return _roundAmount.apply(this, arguments);
|
|
4689
4741
|
}
|
|
4690
4742
|
return roundAmount;
|
|
@@ -4700,7 +4752,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4700
4752
|
key: "sendCustomerPayLink",
|
|
4701
4753
|
value: (function () {
|
|
4702
4754
|
var _sendCustomerPayLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee50(params) {
|
|
4703
|
-
var orderIds,
|
|
4755
|
+
var orderIds, _ref37, _ref38, _submitResult$data$or, _submitResult$data, _submitResult$data2, submitResult, orderId;
|
|
4704
4756
|
return _regeneratorRuntime().wrap(function _callee50$(_context50) {
|
|
4705
4757
|
while (1) switch (_context50.prev = _context50.next) {
|
|
4706
4758
|
case 0:
|
|
@@ -4721,7 +4773,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4721
4773
|
});
|
|
4722
4774
|
case 6:
|
|
4723
4775
|
submitResult = _context50.sent;
|
|
4724
|
-
orderId = (
|
|
4776
|
+
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;
|
|
4725
4777
|
if (orderId) {
|
|
4726
4778
|
_context50.next = 10;
|
|
4727
4779
|
break;
|
|
@@ -4741,7 +4793,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4741
4793
|
}
|
|
4742
4794
|
}, _callee50, this);
|
|
4743
4795
|
}));
|
|
4744
|
-
function sendCustomerPayLink(
|
|
4796
|
+
function sendCustomerPayLink(_x43) {
|
|
4745
4797
|
return _sendCustomerPayLink.apply(this, arguments);
|
|
4746
4798
|
}
|
|
4747
4799
|
return sendCustomerPayLink;
|
|
@@ -4786,7 +4838,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4786
4838
|
}
|
|
4787
4839
|
}, _callee51, this);
|
|
4788
4840
|
}));
|
|
4789
|
-
function calculateProductBookingPrice(
|
|
4841
|
+
function calculateProductBookingPrice(_x44) {
|
|
4790
4842
|
return _calculateProductBookingPrice.apply(this, arguments);
|
|
4791
4843
|
}
|
|
4792
4844
|
return calculateProductBookingPrice;
|
|
@@ -4893,12 +4945,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4893
4945
|
});
|
|
4894
4946
|
_context53.next = 9;
|
|
4895
4947
|
return Promise.all(Array.from(groups.entries()).map( /*#__PURE__*/function () {
|
|
4896
|
-
var
|
|
4897
|
-
var
|
|
4948
|
+
var _ref40 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee52(_ref39) {
|
|
4949
|
+
var _ref41, groupKey, group, productsById;
|
|
4898
4950
|
return _regeneratorRuntime().wrap(function _callee52$(_context52) {
|
|
4899
4951
|
while (1) switch (_context52.prev = _context52.next) {
|
|
4900
4952
|
case 0:
|
|
4901
|
-
|
|
4953
|
+
_ref41 = _slicedToArray(_ref39, 2), groupKey = _ref41[0], group = _ref41[1];
|
|
4902
4954
|
_context52.next = 3;
|
|
4903
4955
|
return _this16.loadProductsForPriceQuery({
|
|
4904
4956
|
ids: Array.from(group.ids),
|
|
@@ -4915,8 +4967,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4915
4967
|
}
|
|
4916
4968
|
}, _callee52);
|
|
4917
4969
|
}));
|
|
4918
|
-
return function (
|
|
4919
|
-
return
|
|
4970
|
+
return function (_x46) {
|
|
4971
|
+
return _ref40.apply(this, arguments);
|
|
4920
4972
|
};
|
|
4921
4973
|
}()));
|
|
4922
4974
|
case 9:
|
|
@@ -4949,7 +5001,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4949
5001
|
}
|
|
4950
5002
|
}, _callee53, this);
|
|
4951
5003
|
}));
|
|
4952
|
-
function calculateProductBookingPrices(
|
|
5004
|
+
function calculateProductBookingPrices(_x45) {
|
|
4953
5005
|
return _calculateProductBookingPrices.apply(this, arguments);
|
|
4954
5006
|
}
|
|
4955
5007
|
return calculateProductBookingPrices;
|
|
@@ -4957,7 +5009,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4957
5009
|
}, {
|
|
4958
5010
|
key: "addProductToOrder",
|
|
4959
5011
|
value: function () {
|
|
4960
|
-
var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee54(product, booking) {
|
|
5012
|
+
var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee54(product, booking, options) {
|
|
4961
5013
|
var products;
|
|
4962
5014
|
return _regeneratorRuntime().wrap(function _callee54$(_context54) {
|
|
4963
5015
|
while (1) switch (_context54.prev = _context54.next) {
|
|
@@ -4970,7 +5022,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4970
5022
|
throw new Error('order 模块未初始化');
|
|
4971
5023
|
case 3:
|
|
4972
5024
|
_context54.next = 5;
|
|
4973
|
-
return this.store.order.addProductToOrder(product, booking);
|
|
5025
|
+
return this.store.order.addProductToOrder(product, booking, options);
|
|
4974
5026
|
case 5:
|
|
4975
5027
|
products = _context54.sent;
|
|
4976
5028
|
return _context54.abrupt("return", products);
|
|
@@ -4984,7 +5036,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4984
5036
|
}
|
|
4985
5037
|
}, _callee54, this, [[0, 9]]);
|
|
4986
5038
|
}));
|
|
4987
|
-
function addProductToOrder(
|
|
5039
|
+
function addProductToOrder(_x47, _x48, _x49) {
|
|
4988
5040
|
return _addProductToOrder.apply(this, arguments);
|
|
4989
5041
|
}
|
|
4990
5042
|
return addProductToOrder;
|
|
@@ -5019,7 +5071,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5019
5071
|
}
|
|
5020
5072
|
}, _callee55, this, [[0, 9]]);
|
|
5021
5073
|
}));
|
|
5022
|
-
function updateOrderProduct(
|
|
5074
|
+
function updateOrderProduct(_x50) {
|
|
5023
5075
|
return _updateOrderProduct.apply(this, arguments);
|
|
5024
5076
|
}
|
|
5025
5077
|
return updateOrderProduct;
|
|
@@ -5054,7 +5106,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5054
5106
|
}
|
|
5055
5107
|
}, _callee56, this, [[0, 9]]);
|
|
5056
5108
|
}));
|
|
5057
|
-
function updateOrderProducts(
|
|
5109
|
+
function updateOrderProducts(_x51) {
|
|
5058
5110
|
return _updateOrderProducts.apply(this, arguments);
|
|
5059
5111
|
}
|
|
5060
5112
|
return updateOrderProducts;
|
|
@@ -5089,7 +5141,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5089
5141
|
}
|
|
5090
5142
|
}, _callee57, this, [[0, 9]]);
|
|
5091
5143
|
}));
|
|
5092
|
-
function updateOrderProductQuantity(
|
|
5144
|
+
function updateOrderProductQuantity(_x52) {
|
|
5093
5145
|
return _updateOrderProductQuantity.apply(this, arguments);
|
|
5094
5146
|
}
|
|
5095
5147
|
return updateOrderProductQuantity;
|
|
@@ -5147,7 +5199,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5147
5199
|
}
|
|
5148
5200
|
}, _callee58, this, [[0, 11]]);
|
|
5149
5201
|
}));
|
|
5150
|
-
function setOrderProductLineNote(
|
|
5202
|
+
function setOrderProductLineNote(_x53, _x54) {
|
|
5151
5203
|
return _setOrderProductLineNote.apply(this, arguments);
|
|
5152
5204
|
}
|
|
5153
5205
|
return setOrderProductLineNote;
|
|
@@ -5162,7 +5214,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5162
5214
|
}, {
|
|
5163
5215
|
key: "removeProductsFromOrder",
|
|
5164
5216
|
value: (function () {
|
|
5165
|
-
var _removeProductsFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee59(identities) {
|
|
5217
|
+
var _removeProductsFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee59(identities, options) {
|
|
5166
5218
|
return _regeneratorRuntime().wrap(function _callee59$(_context59) {
|
|
5167
5219
|
while (1) switch (_context59.prev = _context59.next) {
|
|
5168
5220
|
case 0:
|
|
@@ -5174,7 +5226,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5174
5226
|
throw new Error('order 模块未初始化');
|
|
5175
5227
|
case 3:
|
|
5176
5228
|
_context59.next = 5;
|
|
5177
|
-
return this.store.order.removeProductsFromOrder(identities);
|
|
5229
|
+
return this.store.order.removeProductsFromOrder(identities, options);
|
|
5178
5230
|
case 5:
|
|
5179
5231
|
return _context59.abrupt("return", _context59.sent);
|
|
5180
5232
|
case 8:
|
|
@@ -5187,7 +5239,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5187
5239
|
}
|
|
5188
5240
|
}, _callee59, this, [[0, 8]]);
|
|
5189
5241
|
}));
|
|
5190
|
-
function removeProductsFromOrder(
|
|
5242
|
+
function removeProductsFromOrder(_x55, _x56) {
|
|
5191
5243
|
return _removeProductsFromOrder.apply(this, arguments);
|
|
5192
5244
|
}
|
|
5193
5245
|
return removeProductsFromOrder;
|
|
@@ -5195,18 +5247,18 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5195
5247
|
}, {
|
|
5196
5248
|
key: "removeProductFromOrder",
|
|
5197
5249
|
value: function () {
|
|
5198
|
-
var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee60(identity) {
|
|
5250
|
+
var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee60(identity, options) {
|
|
5199
5251
|
return _regeneratorRuntime().wrap(function _callee60$(_context60) {
|
|
5200
5252
|
while (1) switch (_context60.prev = _context60.next) {
|
|
5201
5253
|
case 0:
|
|
5202
|
-
return _context60.abrupt("return", this.removeProductsFromOrder([identity]));
|
|
5254
|
+
return _context60.abrupt("return", this.removeProductsFromOrder([identity], options));
|
|
5203
5255
|
case 1:
|
|
5204
5256
|
case "end":
|
|
5205
5257
|
return _context60.stop();
|
|
5206
5258
|
}
|
|
5207
5259
|
}, _callee60, this);
|
|
5208
5260
|
}));
|
|
5209
|
-
function removeProductFromOrder(
|
|
5261
|
+
function removeProductFromOrder(_x57, _x58) {
|
|
5210
5262
|
return _removeProductFromOrder.apply(this, arguments);
|
|
5211
5263
|
}
|
|
5212
5264
|
return removeProductFromOrder;
|
|
@@ -5300,13 +5352,13 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5300
5352
|
key: "getProductList",
|
|
5301
5353
|
value: function () {
|
|
5302
5354
|
var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee62() {
|
|
5303
|
-
var _this$
|
|
5355
|
+
var _this$otherParams33;
|
|
5304
5356
|
var menu_list_ids, _this$store$products, res;
|
|
5305
5357
|
return _regeneratorRuntime().wrap(function _callee62$(_context62) {
|
|
5306
5358
|
while (1) switch (_context62.prev = _context62.next) {
|
|
5307
5359
|
case 0:
|
|
5308
5360
|
// 可以直接通过配置里的 menu 读取
|
|
5309
|
-
menu_list_ids = ((_this$
|
|
5361
|
+
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) {
|
|
5310
5362
|
return Number(n.value);
|
|
5311
5363
|
})) || [];
|
|
5312
5364
|
_context62.prev = 1;
|
|
@@ -5344,21 +5396,21 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5344
5396
|
key: "setOtherParams",
|
|
5345
5397
|
value: function () {
|
|
5346
5398
|
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee63(params) {
|
|
5347
|
-
var _this$
|
|
5348
|
-
var
|
|
5349
|
-
|
|
5399
|
+
var _this$otherParams34;
|
|
5400
|
+
var _ref42,
|
|
5401
|
+
_ref42$cover,
|
|
5350
5402
|
cover,
|
|
5351
5403
|
_args63 = arguments;
|
|
5352
5404
|
return _regeneratorRuntime().wrap(function _callee63$(_context63) {
|
|
5353
5405
|
while (1) switch (_context63.prev = _context63.next) {
|
|
5354
5406
|
case 0:
|
|
5355
|
-
|
|
5407
|
+
_ref42 = _args63.length > 1 && _args63[1] !== undefined ? _args63[1] : {}, _ref42$cover = _ref42.cover, cover = _ref42$cover === void 0 ? false : _ref42$cover;
|
|
5356
5408
|
if (cover) {
|
|
5357
5409
|
this.otherParams = _objectSpread({}, params);
|
|
5358
5410
|
} else {
|
|
5359
5411
|
this.otherParams = _objectSpread(_objectSpread({}, this.otherParams), params);
|
|
5360
5412
|
}
|
|
5361
|
-
this.cacheId = (_this$
|
|
5413
|
+
this.cacheId = (_this$otherParams34 = this.otherParams) === null || _this$otherParams34 === void 0 ? void 0 : _this$otherParams34.cacheId;
|
|
5362
5414
|
_context63.next = 5;
|
|
5363
5415
|
return this.syncOtherParamsToSubModules(params, {
|
|
5364
5416
|
cover: cover
|
|
@@ -5369,7 +5421,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5369
5421
|
}
|
|
5370
5422
|
}, _callee63, this);
|
|
5371
5423
|
}));
|
|
5372
|
-
function setOtherParams(
|
|
5424
|
+
function setOtherParams(_x59) {
|
|
5373
5425
|
return _setOtherParams.apply(this, arguments);
|
|
5374
5426
|
}
|
|
5375
5427
|
return setOtherParams;
|