@pisell/pisellos 2.3.80 → 2.3.82
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/modules/ProductList/clientDataVariants.d.ts +50 -0
- package/dist/modules/ProductList/clientDataVariants.js +216 -0
- package/dist/modules/ProductList/index.d.ts +14 -13
- package/dist/modules/ProductList/index.js +104 -76
- package/dist/solution/BaseSales/index.d.ts +16 -1
- package/dist/solution/BaseSales/index.js +530 -260
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +1 -1
- package/dist/solution/UnifiedBookingSales/index.js +2 -2
- package/dist/utils/platform.d.ts +8 -0
- package/dist/utils/platform.js +15 -0
- package/lib/modules/ProductList/clientDataVariants.d.ts +50 -0
- package/lib/modules/ProductList/clientDataVariants.js +204 -0
- package/lib/modules/ProductList/index.d.ts +14 -13
- package/lib/modules/ProductList/index.js +76 -57
- package/lib/solution/BaseSales/index.d.ts +16 -1
- package/lib/solution/BaseSales/index.js +269 -65
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +1 -1
- package/lib/solution/UnifiedBookingSales/index.js +2 -2
- package/lib/utils/platform.d.ts +8 -0
- package/lib/utils/platform.js +22 -0
- package/package.json +1 -1
|
@@ -42,6 +42,8 @@ import { resolvePaymentNumberDevicePrefix, resolvePaymentNumberDevicePrefixFromD
|
|
|
42
42
|
import { applyOrderCollectionUidRemaps, getOrderCollectionPersistentId, getOrderCollectionReferenceUid, getOrderCollectionUid, isSameOrderCollectionItem, mergeOrderCollectionItems, normalizeOrderCollection, normalizeOrderCollections, setOrderCollectionUid } from "../../modules/Order/utils/orderCollectionIdentity";
|
|
43
43
|
import dayjs from 'dayjs';
|
|
44
44
|
export * from "./types";
|
|
45
|
+
import { isProductQueryHandledByOsServer, PRODUCT_QUERY_DATA_VARIANT_RELATIONS, resolveClientDataVariants, tryResolveClientDataVariants } from "../../modules/ProductList/clientDataVariants";
|
|
46
|
+
import { isCustomerUserPlatform } from "../../utils/platform";
|
|
45
47
|
import { QuotationModule } from "../../modules/Quotation";
|
|
46
48
|
import { transformBaseProductToOrderProduct as _transformBaseProductToOrderProduct } from "./utils/transformBaseProductToOrderProduct";
|
|
47
49
|
import { calculateBaseSalesProductBookingPrice } from "./utils/quotationPrice";
|
|
@@ -991,11 +993,167 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
991
993
|
schedule_datetime: now.format('YYYY-MM-DD HH:mm:ss')
|
|
992
994
|
};
|
|
993
995
|
}
|
|
996
|
+
}, {
|
|
997
|
+
key: "isCustomerUserPriceQuery",
|
|
998
|
+
value: function isCustomerUserPriceQuery() {
|
|
999
|
+
var _this$otherParams8;
|
|
1000
|
+
return isCustomerUserPlatform((_this$otherParams8 = this.otherParams) === null || _this$otherParams8 === void 0 ? void 0 : _this$otherParams8.platform);
|
|
1001
|
+
}
|
|
1002
|
+
}, {
|
|
1003
|
+
key: "getPriceQueryScheduleList",
|
|
1004
|
+
value: function getPriceQueryScheduleList() {
|
|
1005
|
+
var _this$store$schedule, _this$store$schedule$, _this$core3;
|
|
1006
|
+
var storeScheduleList = (_this$store$schedule = this.store.schedule) === null || _this$store$schedule === void 0 || (_this$store$schedule$ = _this$store$schedule.getScheduleList) === null || _this$store$schedule$ === void 0 ? void 0 : _this$store$schedule$.call(_this$store$schedule);
|
|
1007
|
+
if (Array.isArray(storeScheduleList) && storeScheduleList.length > 0) {
|
|
1008
|
+
return storeScheduleList;
|
|
1009
|
+
}
|
|
1010
|
+
var contextScheduleList = (_this$core3 = this.core) === null || _this$core3 === void 0 || (_this$core3 = _this$core3.context) === null || _this$core3 === void 0 ? void 0 : _this$core3.scheduleList;
|
|
1011
|
+
return Array.isArray(contextScheduleList) && contextScheduleList.length > 0 ? contextScheduleList : undefined;
|
|
1012
|
+
}
|
|
1013
|
+
}, {
|
|
1014
|
+
key: "buildPriceQueryPayload",
|
|
1015
|
+
value: function buildPriceQueryPayload(params) {
|
|
1016
|
+
var channel = this.getPriceQueryChannel(params.channel);
|
|
1017
|
+
var strategyContext = this.getPriceQueryStrategyContext(channel);
|
|
1018
|
+
return _objectSpread(_objectSpread({
|
|
1019
|
+
ids: params.ids
|
|
1020
|
+
}, this.isCustomerUserPriceQuery() ? {} : {
|
|
1021
|
+
open_quotation: 1
|
|
1022
|
+
}), {}, {
|
|
1023
|
+
open_bundle: 1,
|
|
1024
|
+
with: _toConsumableArray(PRODUCT_QUERY_DATA_VARIANT_RELATIONS),
|
|
1025
|
+
status: 'published',
|
|
1026
|
+
num: Math.max(params.ids.length, 1),
|
|
1027
|
+
skip: 1,
|
|
1028
|
+
customer_id: params.customerId,
|
|
1029
|
+
schedule_date: params.schedule.schedule_date,
|
|
1030
|
+
schedule_datetime: params.schedule.schedule_datetime,
|
|
1031
|
+
application_code: channel
|
|
1032
|
+
}, Object.keys(strategyContext).length ? {
|
|
1033
|
+
strategy_context: strategyContext
|
|
1034
|
+
} : {});
|
|
1035
|
+
}
|
|
1036
|
+
}, {
|
|
1037
|
+
key: "getRawProductPriceSources",
|
|
1038
|
+
value: function getRawProductPriceSources(ids) {
|
|
1039
|
+
var products = this.store.products;
|
|
1040
|
+
if (typeof (products === null || products === void 0 ? void 0 : products.getRawProductPriceSources) !== 'function') {
|
|
1041
|
+
return new Map();
|
|
1042
|
+
}
|
|
1043
|
+
try {
|
|
1044
|
+
var result = products.getRawProductPriceSources(ids);
|
|
1045
|
+
return result instanceof Map ? result : new Map();
|
|
1046
|
+
} catch (error) {
|
|
1047
|
+
this.logWarning('getRawProductPriceSources: 读取商品原始报价源失败', {
|
|
1048
|
+
ids: ids,
|
|
1049
|
+
error: error instanceof Error ? error.message : String(error)
|
|
1050
|
+
});
|
|
1051
|
+
return new Map();
|
|
1052
|
+
}
|
|
1053
|
+
}
|
|
1054
|
+
}, {
|
|
1055
|
+
key: "rememberRawProductPriceSources",
|
|
1056
|
+
value: function rememberRawProductPriceSources(products) {
|
|
1057
|
+
var productList = this.store.products;
|
|
1058
|
+
if (typeof (productList === null || productList === void 0 ? void 0 : productList.rememberRawProductQueryResult) !== 'function') return;
|
|
1059
|
+
try {
|
|
1060
|
+
productList.rememberRawProductQueryResult(products);
|
|
1061
|
+
} catch (error) {
|
|
1062
|
+
this.logWarning('rememberRawProductPriceSources: 保存商品原始报价源失败', {
|
|
1063
|
+
error: error instanceof Error ? error.message : String(error)
|
|
1064
|
+
});
|
|
1065
|
+
}
|
|
1066
|
+
}
|
|
1067
|
+
}, {
|
|
1068
|
+
key: "getSelectedProductVariantId",
|
|
1069
|
+
value: function getSelectedProductVariantId(product) {
|
|
1070
|
+
var _ref15, _product$product_vari;
|
|
1071
|
+
var variantId = Number((_ref15 = (_product$product_vari = product === null || product === void 0 ? void 0 : product.product_variant_id) !== null && _product$product_vari !== void 0 ? _product$product_vari : product === null || product === void 0 ? void 0 : product.variant_id) !== null && _ref15 !== void 0 ? _ref15 : 0);
|
|
1072
|
+
return Number.isFinite(variantId) && variantId > 0 ? variantId : 0;
|
|
1073
|
+
}
|
|
1074
|
+
|
|
1075
|
+
/**
|
|
1076
|
+
* 将目录原始商品还原为本次选择的 SKU 基线。
|
|
1077
|
+
*
|
|
1078
|
+
* 这里绝不能复用已评估后的目录商品,否则从命中智能价切回不命中的
|
|
1079
|
+
* 日期时会残留旧价格。套餐仅验证所选关系存在,最终仍由 merge 方法把
|
|
1080
|
+
* 评估后的套餐价格映射回用户的选择数据。
|
|
1081
|
+
*/
|
|
1082
|
+
}, {
|
|
1083
|
+
key: "prepareRawProductForPriceQuery",
|
|
1084
|
+
value: function prepareRawProductForPriceQuery(rawProduct, selectedProduct) {
|
|
1085
|
+
var _product$product_id2,
|
|
1086
|
+
_this5 = this;
|
|
1087
|
+
var product = cloneDeep(rawProduct);
|
|
1088
|
+
var rawProductId = this.getPriceQueryProductId(product);
|
|
1089
|
+
var selectedProductId = this.getPriceQueryProductId(selectedProduct);
|
|
1090
|
+
if (rawProductId === null || selectedProductId === null || rawProductId !== selectedProductId) {
|
|
1091
|
+
return null;
|
|
1092
|
+
}
|
|
1093
|
+
var selectedVariantId = this.getSelectedProductVariantId(selectedProduct);
|
|
1094
|
+
product.product_id = (_product$product_id2 = product.product_id) !== null && _product$product_id2 !== void 0 ? _product$product_id2 : product.id;
|
|
1095
|
+
product.product_variant_id = selectedVariantId;
|
|
1096
|
+
product.variant_id = selectedVariantId;
|
|
1097
|
+
if (selectedVariantId > 0) {
|
|
1098
|
+
var _ref16, _selectedVariant$pric, _selectedVariant$sell, _selectedVariant$base;
|
|
1099
|
+
var variants = Array.isArray(product.variant) ? product.variant : [];
|
|
1100
|
+
var selectedVariant = variants.find(function (variant) {
|
|
1101
|
+
return Number(variant === null || variant === void 0 ? void 0 : variant.id) === selectedVariantId;
|
|
1102
|
+
});
|
|
1103
|
+
if (!selectedVariant) return null;
|
|
1104
|
+
var variantPrice = (_ref16 = (_selectedVariant$pric = selectedVariant.price) !== null && _selectedVariant$pric !== void 0 ? _selectedVariant$pric : selectedVariant.selling_price) !== null && _ref16 !== void 0 ? _ref16 : selectedVariant.base_price;
|
|
1105
|
+
if (variantPrice === undefined || variantPrice === null || variantPrice === '') {
|
|
1106
|
+
return null;
|
|
1107
|
+
}
|
|
1108
|
+
product.price = variantPrice;
|
|
1109
|
+
product.selling_price = (_selectedVariant$sell = selectedVariant.selling_price) !== null && _selectedVariant$sell !== void 0 ? _selectedVariant$sell : variantPrice;
|
|
1110
|
+
product.base_price = (_selectedVariant$base = selectedVariant.base_price) !== null && _selectedVariant$base !== void 0 ? _selectedVariant$base : variantPrice;
|
|
1111
|
+
}
|
|
1112
|
+
var selectedBundles = Array.isArray(selectedProduct.product_bundle) ? selectedProduct.product_bundle : [];
|
|
1113
|
+
if (selectedBundles.length > 0) {
|
|
1114
|
+
var rawBundleItems = this.getAuthoritativeBundleItems(product);
|
|
1115
|
+
var allSelectedBundlesExist = selectedBundles.every(function (bundle) {
|
|
1116
|
+
var _ref17, _bundle$bundle_varian, _ref18, _authoritativeBundle$;
|
|
1117
|
+
var authoritativeBundle = _this5.findAuthoritativeBundleItem(bundle, rawBundleItems);
|
|
1118
|
+
if (!authoritativeBundle) return false;
|
|
1119
|
+
var selectedBundleVariantId = Number((_ref17 = (_bundle$bundle_varian = bundle === null || bundle === void 0 ? void 0 : bundle.bundle_variant_id) !== null && _bundle$bundle_varian !== void 0 ? _bundle$bundle_varian : bundle === null || bundle === void 0 ? void 0 : bundle.variant_id) !== null && _ref17 !== void 0 ? _ref17 : 0);
|
|
1120
|
+
var authoritativeBundleVariantId = Number((_ref18 = (_authoritativeBundle$ = authoritativeBundle === null || authoritativeBundle === void 0 ? void 0 : authoritativeBundle.bundle_variant_id) !== null && _authoritativeBundle$ !== void 0 ? _authoritativeBundle$ : authoritativeBundle === null || authoritativeBundle === void 0 ? void 0 : authoritativeBundle.variant_id) !== null && _ref18 !== void 0 ? _ref18 : 0);
|
|
1121
|
+
if ((Number.isFinite(selectedBundleVariantId) ? selectedBundleVariantId : 0) !== (Number.isFinite(authoritativeBundleVariantId) ? authoritativeBundleVariantId : 0)) {
|
|
1122
|
+
return false;
|
|
1123
|
+
}
|
|
1124
|
+
|
|
1125
|
+
// 省略字段表示该套餐子商品关系没有被价格查询完整水合,不能把它
|
|
1126
|
+
// 当作“没有规则”而静默使用基础价。
|
|
1127
|
+
return Array.isArray(authoritativeBundle.data_variants);
|
|
1128
|
+
});
|
|
1129
|
+
if (!allSelectedBundlesExist) return null;
|
|
1130
|
+
}
|
|
1131
|
+
return product;
|
|
1132
|
+
}
|
|
1133
|
+
}, {
|
|
1134
|
+
key: "resolveLocalProductForPriceQuery",
|
|
1135
|
+
value: function resolveLocalProductForPriceQuery(params) {
|
|
1136
|
+
if (!params.rawProduct) return null;
|
|
1137
|
+
var preparedProduct = this.prepareRawProductForPriceQuery(params.rawProduct, params.selectedProduct);
|
|
1138
|
+
if (!preparedProduct) return null;
|
|
1139
|
+
var scheduleList = this.getPriceQueryScheduleList();
|
|
1140
|
+
var result = tryResolveClientDataVariants(_objectSpread({
|
|
1141
|
+
core: this.core,
|
|
1142
|
+
otherParams: this.otherParams,
|
|
1143
|
+
products: [preparedProduct],
|
|
1144
|
+
queryPayload: params.queryPayload,
|
|
1145
|
+
handledByOsServer: false
|
|
1146
|
+
}, scheduleList ? {
|
|
1147
|
+
scheduleList: scheduleList
|
|
1148
|
+
} : {}));
|
|
1149
|
+
if (result.status !== 'resolved') return null;
|
|
1150
|
+
return result.products[0] || null;
|
|
1151
|
+
}
|
|
994
1152
|
}, {
|
|
995
1153
|
key: "loadProductsForPriceQuery",
|
|
996
1154
|
value: function () {
|
|
997
1155
|
var _loadProductsForPriceQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(params) {
|
|
998
|
-
var ids, productsById,
|
|
1156
|
+
var ids, productsById, handledByOsServer, _response$data, queryPayload, response, list, scheduleList, resolvedList;
|
|
999
1157
|
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
1000
1158
|
while (1) switch (_context8.prev = _context8.next) {
|
|
1001
1159
|
case 0:
|
|
@@ -1009,24 +1167,13 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1009
1167
|
}
|
|
1010
1168
|
return _context8.abrupt("return", productsById);
|
|
1011
1169
|
case 4:
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1170
|
+
handledByOsServer = isProductQueryHandledByOsServer(this.core, this.request);
|
|
1171
|
+
_context8.prev = 5;
|
|
1172
|
+
queryPayload = this.buildPriceQueryPayload(_objectSpread(_objectSpread({}, params), {}, {
|
|
1173
|
+
ids: ids
|
|
1174
|
+
}));
|
|
1015
1175
|
_context8.next = 9;
|
|
1016
|
-
return this.request.post('/product/query',
|
|
1017
|
-
ids: ids,
|
|
1018
|
-
open_quotation: 1,
|
|
1019
|
-
open_bundle: 1,
|
|
1020
|
-
status: 'published',
|
|
1021
|
-
num: 1,
|
|
1022
|
-
skip: 1,
|
|
1023
|
-
customer_id: params.customerId,
|
|
1024
|
-
schedule_date: params.schedule.schedule_date,
|
|
1025
|
-
schedule_datetime: params.schedule.schedule_datetime,
|
|
1026
|
-
application_code: channel
|
|
1027
|
-
}, Object.keys(strategyContext).length ? {
|
|
1028
|
-
strategy_context: strategyContext
|
|
1029
|
-
} : {}), {
|
|
1176
|
+
return this.request.post('/product/query', queryPayload, {
|
|
1030
1177
|
osServer: true,
|
|
1031
1178
|
customToast: function customToast() {}
|
|
1032
1179
|
});
|
|
@@ -1039,6 +1186,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1039
1186
|
}
|
|
1040
1187
|
return _context8.abrupt("return", productsById);
|
|
1041
1188
|
case 13:
|
|
1189
|
+
if (!(this.isCustomerUserPriceQuery() && !handledByOsServer)) {
|
|
1190
|
+
_context8.next = 17;
|
|
1191
|
+
break;
|
|
1192
|
+
}
|
|
1193
|
+
this.rememberRawProductPriceSources(list);
|
|
1042
1194
|
list.forEach(function (item) {
|
|
1043
1195
|
var _item$id;
|
|
1044
1196
|
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);
|
|
@@ -1046,18 +1198,35 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1046
1198
|
});
|
|
1047
1199
|
return _context8.abrupt("return", productsById);
|
|
1048
1200
|
case 17:
|
|
1049
|
-
|
|
1050
|
-
|
|
1201
|
+
scheduleList = this.getPriceQueryScheduleList();
|
|
1202
|
+
resolvedList = resolveClientDataVariants(_objectSpread({
|
|
1203
|
+
core: this.core,
|
|
1204
|
+
otherParams: this.otherParams,
|
|
1205
|
+
products: list,
|
|
1206
|
+
queryPayload: queryPayload,
|
|
1207
|
+
handledByOsServer: handledByOsServer
|
|
1208
|
+
}, scheduleList ? {
|
|
1209
|
+
scheduleList: scheduleList
|
|
1210
|
+
} : {}));
|
|
1211
|
+
resolvedList.forEach(function (item) {
|
|
1212
|
+
var _item$id2;
|
|
1213
|
+
var productId = Number((_item$id2 = item === null || item === void 0 ? void 0 : item.id) !== null && _item$id2 !== void 0 ? _item$id2 : item === null || item === void 0 ? void 0 : item.product_id);
|
|
1214
|
+
if (Number.isFinite(productId)) productsById.set(productId, item);
|
|
1215
|
+
});
|
|
1216
|
+
return _context8.abrupt("return", productsById);
|
|
1217
|
+
case 23:
|
|
1218
|
+
_context8.prev = 23;
|
|
1219
|
+
_context8.t0 = _context8["catch"](5);
|
|
1051
1220
|
this.logWarning('loadProductsForPriceQuery: 商品批量重查失败,使用入参 fallback', {
|
|
1052
1221
|
ids: ids,
|
|
1053
1222
|
error: _context8.t0 instanceof Error ? _context8.t0.message : String(_context8.t0)
|
|
1054
1223
|
});
|
|
1055
1224
|
return _context8.abrupt("return", productsById);
|
|
1056
|
-
case
|
|
1225
|
+
case 27:
|
|
1057
1226
|
case "end":
|
|
1058
1227
|
return _context8.stop();
|
|
1059
1228
|
}
|
|
1060
|
-
}, _callee8, this, [[
|
|
1229
|
+
}, _callee8, this, [[5, 23]]);
|
|
1061
1230
|
}));
|
|
1062
1231
|
function loadProductsForPriceQuery(_x7) {
|
|
1063
1232
|
return _loadProductsForPriceQuery.apply(this, arguments);
|
|
@@ -1065,42 +1234,127 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1065
1234
|
return loadProductsForPriceQuery;
|
|
1066
1235
|
}()
|
|
1067
1236
|
}, {
|
|
1068
|
-
key: "
|
|
1237
|
+
key: "resolveProductsForPriceQuery",
|
|
1069
1238
|
value: function () {
|
|
1070
|
-
var
|
|
1071
|
-
var
|
|
1239
|
+
var _resolveProductsForPriceQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(params) {
|
|
1240
|
+
var _this6 = this;
|
|
1241
|
+
var selectedProducts, productIds, ids, handledByOsServer, canUseLocalFastPath, productsById, queryPayload, cachedRawProducts, authoritativeProducts, missingIds, remoteRawProducts;
|
|
1072
1242
|
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
1073
1243
|
while (1) switch (_context9.prev = _context9.next) {
|
|
1074
1244
|
case 0:
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1245
|
+
selectedProducts = params.priceQueries.map(function (item) {
|
|
1246
|
+
return item.product || {};
|
|
1247
|
+
});
|
|
1248
|
+
productIds = selectedProducts.map(function (product) {
|
|
1249
|
+
return _this6.getPriceQueryProductId(product);
|
|
1250
|
+
});
|
|
1251
|
+
ids = Array.from(new Set(productIds.filter(function (id) {
|
|
1252
|
+
return id !== null;
|
|
1253
|
+
})));
|
|
1254
|
+
if (ids.length) {
|
|
1255
|
+
_context9.next = 5;
|
|
1079
1256
|
break;
|
|
1080
1257
|
}
|
|
1081
|
-
return _context9.abrupt("return",
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1258
|
+
return _context9.abrupt("return", selectedProducts.map(function () {
|
|
1259
|
+
return null;
|
|
1260
|
+
}));
|
|
1261
|
+
case 5:
|
|
1262
|
+
handledByOsServer = this.request ? isProductQueryHandledByOsServer(this.core, this.request) : false;
|
|
1263
|
+
canUseLocalFastPath = this.isCustomerUserPriceQuery() && !handledByOsServer;
|
|
1264
|
+
if (canUseLocalFastPath) {
|
|
1265
|
+
_context9.next = 14;
|
|
1266
|
+
break;
|
|
1267
|
+
}
|
|
1268
|
+
if (this.request) {
|
|
1269
|
+
_context9.next = 10;
|
|
1270
|
+
break;
|
|
1271
|
+
}
|
|
1272
|
+
return _context9.abrupt("return", selectedProducts.map(function () {
|
|
1273
|
+
return null;
|
|
1274
|
+
}));
|
|
1275
|
+
case 10:
|
|
1276
|
+
_context9.next = 12;
|
|
1085
1277
|
return this.loadProductsForPriceQuery({
|
|
1086
|
-
ids:
|
|
1087
|
-
schedule: schedule,
|
|
1088
|
-
customerId: customerId,
|
|
1278
|
+
ids: ids,
|
|
1279
|
+
schedule: params.schedule,
|
|
1280
|
+
customerId: params.customerId,
|
|
1089
1281
|
channel: params.channel
|
|
1090
1282
|
});
|
|
1091
|
-
case
|
|
1283
|
+
case 12:
|
|
1092
1284
|
productsById = _context9.sent;
|
|
1093
|
-
return _context9.abrupt("return",
|
|
1094
|
-
|
|
1285
|
+
return _context9.abrupt("return", productIds.map(function (productId) {
|
|
1286
|
+
return productId === null ? null : productsById.get(productId) || null;
|
|
1287
|
+
}));
|
|
1288
|
+
case 14:
|
|
1289
|
+
queryPayload = this.buildPriceQueryPayload({
|
|
1290
|
+
ids: ids,
|
|
1291
|
+
schedule: params.schedule,
|
|
1292
|
+
customerId: params.customerId,
|
|
1293
|
+
channel: params.channel
|
|
1294
|
+
});
|
|
1295
|
+
cachedRawProducts = this.getRawProductPriceSources(ids);
|
|
1296
|
+
authoritativeProducts = selectedProducts.map(function (selectedProduct, index) {
|
|
1297
|
+
var productId = productIds[index];
|
|
1298
|
+
return productId === null ? null : _this6.resolveLocalProductForPriceQuery({
|
|
1299
|
+
selectedProduct: selectedProduct,
|
|
1300
|
+
rawProduct: cachedRawProducts.get(productId),
|
|
1301
|
+
queryPayload: queryPayload
|
|
1302
|
+
});
|
|
1303
|
+
});
|
|
1304
|
+
missingIds = Array.from(new Set(productIds.filter(function (productId, index) {
|
|
1305
|
+
return productId !== null && !authoritativeProducts[index];
|
|
1306
|
+
})));
|
|
1307
|
+
if (missingIds.length) {
|
|
1308
|
+
_context9.next = 20;
|
|
1309
|
+
break;
|
|
1310
|
+
}
|
|
1311
|
+
return _context9.abrupt("return", authoritativeProducts);
|
|
1312
|
+
case 20:
|
|
1313
|
+
if (this.request) {
|
|
1314
|
+
_context9.next = 22;
|
|
1315
|
+
break;
|
|
1316
|
+
}
|
|
1317
|
+
return _context9.abrupt("return", authoritativeProducts);
|
|
1318
|
+
case 22:
|
|
1319
|
+
_context9.next = 24;
|
|
1320
|
+
return this.loadProductsForPriceQuery({
|
|
1321
|
+
ids: missingIds,
|
|
1322
|
+
schedule: params.schedule,
|
|
1323
|
+
customerId: params.customerId,
|
|
1324
|
+
channel: params.channel
|
|
1325
|
+
});
|
|
1326
|
+
case 24:
|
|
1327
|
+
remoteRawProducts = _context9.sent;
|
|
1328
|
+
authoritativeProducts.forEach(function (authoritativeProduct, index) {
|
|
1329
|
+
if (authoritativeProduct) return;
|
|
1330
|
+
var productId = productIds[index];
|
|
1331
|
+
if (productId === null) return;
|
|
1332
|
+
var rawProduct = remoteRawProducts.get(productId);
|
|
1333
|
+
var locallyResolved = _this6.resolveLocalProductForPriceQuery({
|
|
1334
|
+
selectedProduct: selectedProducts[index],
|
|
1335
|
+
rawProduct: rawProduct,
|
|
1336
|
+
queryPayload: queryPayload
|
|
1337
|
+
});
|
|
1338
|
+
if (locallyResolved) {
|
|
1339
|
+
authoritativeProducts[index] = locallyResolved;
|
|
1340
|
+
return;
|
|
1341
|
+
}
|
|
1342
|
+
|
|
1343
|
+
// 严格客户端能力仍不可用时,真实请求已经是最后的权威降级。
|
|
1344
|
+
// 尽量应用所选 SKU 基线;关系不完整时保持旧的远端商品语义。
|
|
1345
|
+
authoritativeProducts[index] = rawProduct ? _this6.prepareRawProductForPriceQuery(rawProduct, selectedProducts[index]) || rawProduct : null;
|
|
1346
|
+
});
|
|
1347
|
+
return _context9.abrupt("return", authoritativeProducts);
|
|
1348
|
+
case 27:
|
|
1095
1349
|
case "end":
|
|
1096
1350
|
return _context9.stop();
|
|
1097
1351
|
}
|
|
1098
1352
|
}, _callee9, this);
|
|
1099
1353
|
}));
|
|
1100
|
-
function
|
|
1101
|
-
return
|
|
1354
|
+
function resolveProductsForPriceQuery(_x8) {
|
|
1355
|
+
return _resolveProductsForPriceQuery.apply(this, arguments);
|
|
1102
1356
|
}
|
|
1103
|
-
return
|
|
1357
|
+
return resolveProductsForPriceQuery;
|
|
1104
1358
|
}()
|
|
1105
1359
|
}, {
|
|
1106
1360
|
key: "getAuthoritativeBundleItems",
|
|
@@ -1110,10 +1364,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1110
1364
|
return groups.flatMap(function (group) {
|
|
1111
1365
|
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 : [];
|
|
1112
1366
|
return items.map(function (item) {
|
|
1113
|
-
var _item$group_id,
|
|
1367
|
+
var _item$group_id, _ref19, _item$bundle_group_id;
|
|
1114
1368
|
return _objectSpread(_objectSpread({}, item), {}, {
|
|
1115
1369
|
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,
|
|
1116
|
-
bundle_group_id: (
|
|
1370
|
+
bundle_group_id: (_ref19 = (_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 && _ref19 !== void 0 ? _ref19 : group === null || group === void 0 ? void 0 : group.id
|
|
1117
1371
|
});
|
|
1118
1372
|
});
|
|
1119
1373
|
});
|
|
@@ -1144,44 +1398,44 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1144
1398
|
}, {
|
|
1145
1399
|
key: "getAuthoritativeBundleUnitPrice",
|
|
1146
1400
|
value: function getAuthoritativeBundleUnitPrice(bundle) {
|
|
1147
|
-
var
|
|
1148
|
-
return (
|
|
1401
|
+
var _ref20, _ref21, _ref22, _bundle$price;
|
|
1402
|
+
return (_ref20 = (_ref21 = (_ref22 = (_bundle$price = bundle.price) !== null && _bundle$price !== void 0 ? _bundle$price : bundle.bundle_selling_price) !== null && _ref22 !== void 0 ? _ref22 : bundle.custom_price) !== null && _ref21 !== void 0 ? _ref21 : bundle.product_price) !== null && _ref20 !== void 0 ? _ref20 : bundle.base_price;
|
|
1149
1403
|
}
|
|
1150
1404
|
}, {
|
|
1151
1405
|
key: "mergeProductForPriceQuery",
|
|
1152
1406
|
value: function mergeProductForPriceQuery(product, authoritativeProduct) {
|
|
1153
|
-
var
|
|
1407
|
+
var _this7 = this,
|
|
1154
1408
|
_product$id,
|
|
1155
|
-
|
|
1156
|
-
_product$
|
|
1157
|
-
|
|
1158
|
-
_product$
|
|
1159
|
-
|
|
1409
|
+
_ref23,
|
|
1410
|
+
_product$product_id3,
|
|
1411
|
+
_ref24,
|
|
1412
|
+
_product$product_vari2,
|
|
1413
|
+
_ref25,
|
|
1160
1414
|
_product$num,
|
|
1161
|
-
|
|
1415
|
+
_ref26,
|
|
1162
1416
|
_product$quantity,
|
|
1163
1417
|
_product$metadata4;
|
|
1164
1418
|
if (!authoritativeProduct) return product;
|
|
1165
1419
|
var selectedBundles = Array.isArray(product.product_bundle) ? product.product_bundle : [];
|
|
1166
1420
|
var authoritativeBundles = this.getAuthoritativeBundleItems(authoritativeProduct);
|
|
1167
1421
|
var productBundle = selectedBundles.map(function (bundle) {
|
|
1168
|
-
var _authoritativeBundle
|
|
1169
|
-
var authoritativeBundle =
|
|
1170
|
-
var unitPrice = authoritativeBundle ?
|
|
1422
|
+
var _authoritativeBundle$2, _authoritativeBundle$3;
|
|
1423
|
+
var authoritativeBundle = _this7.findAuthoritativeBundleItem(bundle, authoritativeBundles);
|
|
1424
|
+
var unitPrice = authoritativeBundle ? _this7.getAuthoritativeBundleUnitPrice(authoritativeBundle) : undefined;
|
|
1171
1425
|
if (unitPrice === undefined || unitPrice === null || unitPrice === '') return bundle;
|
|
1172
1426
|
return _objectSpread(_objectSpread({}, bundle), {}, {
|
|
1173
1427
|
price: unitPrice,
|
|
1174
1428
|
bundle_selling_price: unitPrice,
|
|
1175
|
-
base_price: (_authoritativeBundle$ = authoritativeBundle === null || authoritativeBundle === void 0 ? void 0 : authoritativeBundle.base_price) !== null && _authoritativeBundle$ !== void 0 ? _authoritativeBundle$ : bundle.base_price,
|
|
1176
|
-
product_price: (_authoritativeBundle$
|
|
1429
|
+
base_price: (_authoritativeBundle$2 = authoritativeBundle === null || authoritativeBundle === void 0 ? void 0 : authoritativeBundle.base_price) !== null && _authoritativeBundle$2 !== void 0 ? _authoritativeBundle$2 : bundle.base_price,
|
|
1430
|
+
product_price: (_authoritativeBundle$3 = authoritativeBundle === null || authoritativeBundle === void 0 ? void 0 : authoritativeBundle.product_price) !== null && _authoritativeBundle$3 !== void 0 ? _authoritativeBundle$3 : bundle.product_price
|
|
1177
1431
|
});
|
|
1178
1432
|
});
|
|
1179
1433
|
return _objectSpread(_objectSpread(_objectSpread({}, product), authoritativeProduct), {}, {
|
|
1180
1434
|
id: (_product$id = product.id) !== null && _product$id !== void 0 ? _product$id : authoritativeProduct.id,
|
|
1181
|
-
product_id: (
|
|
1182
|
-
product_variant_id: (
|
|
1183
|
-
num: (
|
|
1184
|
-
quantity: (
|
|
1435
|
+
product_id: (_ref23 = (_product$product_id3 = product.product_id) !== null && _product$product_id3 !== void 0 ? _product$product_id3 : authoritativeProduct.product_id) !== null && _ref23 !== void 0 ? _ref23 : authoritativeProduct.id,
|
|
1436
|
+
product_variant_id: (_ref24 = (_product$product_vari2 = product.product_variant_id) !== null && _product$product_vari2 !== void 0 ? _product$product_vari2 : authoritativeProduct.product_variant_id) !== null && _ref24 !== void 0 ? _ref24 : 0,
|
|
1437
|
+
num: (_ref25 = (_product$num = product.num) !== null && _product$num !== void 0 ? _product$num : product.quantity) !== null && _ref25 !== void 0 ? _ref25 : authoritativeProduct.num,
|
|
1438
|
+
quantity: (_ref26 = (_product$quantity = product.quantity) !== null && _product$quantity !== void 0 ? _product$quantity : product.num) !== null && _ref26 !== void 0 ? _ref26 : authoritativeProduct.quantity,
|
|
1185
1439
|
product_sku: function () {
|
|
1186
1440
|
var authoritativeSku = ensureProductSku(authoritativeProduct);
|
|
1187
1441
|
var productSku = ensureProductSku(product);
|
|
@@ -1197,8 +1451,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1197
1451
|
}, {
|
|
1198
1452
|
key: "getSubmitOrderSalesChannel",
|
|
1199
1453
|
value: function getSubmitOrderSalesChannel() {
|
|
1200
|
-
var _this$
|
|
1201
|
-
return (_this$
|
|
1454
|
+
var _this$otherParams9;
|
|
1455
|
+
return (_this$otherParams9 = this.otherParams) === null || _this$otherParams9 === void 0 ? void 0 : _this$otherParams9.channel;
|
|
1202
1456
|
}
|
|
1203
1457
|
|
|
1204
1458
|
/**
|
|
@@ -1266,24 +1520,24 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1266
1520
|
key: "syncOtherParamsToSubModules",
|
|
1267
1521
|
value: (function () {
|
|
1268
1522
|
var _syncOtherParamsToSubModules = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(changedParams) {
|
|
1269
|
-
var
|
|
1270
|
-
var
|
|
1271
|
-
|
|
1523
|
+
var _this8 = this;
|
|
1524
|
+
var _ref27,
|
|
1525
|
+
_ref27$cover,
|
|
1272
1526
|
cover,
|
|
1273
1527
|
_args11 = arguments;
|
|
1274
1528
|
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
1275
1529
|
while (1) switch (_context11.prev = _context11.next) {
|
|
1276
1530
|
case 0:
|
|
1277
|
-
|
|
1531
|
+
_ref27 = _args11.length > 1 && _args11[1] !== undefined ? _args11[1] : {}, _ref27$cover = _ref27.cover, cover = _ref27$cover === void 0 ? false : _ref27$cover;
|
|
1278
1532
|
_context11.next = 3;
|
|
1279
1533
|
return Promise.all(Object.entries(this.store).map( /*#__PURE__*/function () {
|
|
1280
|
-
var
|
|
1281
|
-
var
|
|
1534
|
+
var _ref29 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(_ref28) {
|
|
1535
|
+
var _ref30, moduleName, subModule, targetModule, nextSubModuleOtherParams;
|
|
1282
1536
|
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
1283
1537
|
while (1) switch (_context10.prev = _context10.next) {
|
|
1284
1538
|
case 0:
|
|
1285
|
-
|
|
1286
|
-
if (!
|
|
1539
|
+
_ref30 = _slicedToArray(_ref28, 2), moduleName = _ref30[0], subModule = _ref30[1];
|
|
1540
|
+
if (!_this8.reusedSharedSubModuleNames.has(moduleName)) {
|
|
1287
1541
|
_context10.next = 3;
|
|
1288
1542
|
break;
|
|
1289
1543
|
}
|
|
@@ -1296,7 +1550,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1296
1550
|
}
|
|
1297
1551
|
return _context10.abrupt("return");
|
|
1298
1552
|
case 6:
|
|
1299
|
-
nextSubModuleOtherParams =
|
|
1553
|
+
nextSubModuleOtherParams = _this8.buildSubModuleOtherParams(moduleName);
|
|
1300
1554
|
_context10.next = 9;
|
|
1301
1555
|
return targetModule.updateOtherParams(nextSubModuleOtherParams, {
|
|
1302
1556
|
changedParams: changedParams,
|
|
@@ -1308,8 +1562,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1308
1562
|
}
|
|
1309
1563
|
}, _callee10);
|
|
1310
1564
|
}));
|
|
1311
|
-
return function (
|
|
1312
|
-
return
|
|
1565
|
+
return function (_x10) {
|
|
1566
|
+
return _ref29.apply(this, arguments);
|
|
1313
1567
|
};
|
|
1314
1568
|
}()));
|
|
1315
1569
|
case 3:
|
|
@@ -1318,7 +1572,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1318
1572
|
}
|
|
1319
1573
|
}, _callee11, this);
|
|
1320
1574
|
}));
|
|
1321
|
-
function syncOtherParamsToSubModules(
|
|
1575
|
+
function syncOtherParamsToSubModules(_x9) {
|
|
1322
1576
|
return _syncOtherParamsToSubModules.apply(this, arguments);
|
|
1323
1577
|
}
|
|
1324
1578
|
return syncOtherParamsToSubModules;
|
|
@@ -1368,22 +1622,22 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1368
1622
|
}, {
|
|
1369
1623
|
key: "getPaymentNumberDevicePrefixSync",
|
|
1370
1624
|
value: function getPaymentNumberDevicePrefixSync() {
|
|
1371
|
-
var
|
|
1625
|
+
var _this9 = this;
|
|
1372
1626
|
if (!this.appPlugin) return 'LOCAL';
|
|
1373
1627
|
return resolvePaymentNumberDevicePrefixFromDeviceId(function (key) {
|
|
1374
|
-
return
|
|
1628
|
+
return _this9.getAppData(key);
|
|
1375
1629
|
});
|
|
1376
1630
|
}
|
|
1377
1631
|
}, {
|
|
1378
1632
|
key: "getPaymentNumberDevicePrefixAsync",
|
|
1379
1633
|
value: function getPaymentNumberDevicePrefixAsync() {
|
|
1380
|
-
var
|
|
1634
|
+
var _this10 = this;
|
|
1381
1635
|
if (!this.appPlugin) return Promise.resolve('LOCAL');
|
|
1382
1636
|
if (this.paymentNumberDevicePrefix) {
|
|
1383
1637
|
return Promise.resolve(this.paymentNumberDevicePrefix);
|
|
1384
1638
|
}
|
|
1385
1639
|
return resolvePaymentNumberDevicePrefix(function (key) {
|
|
1386
|
-
return
|
|
1640
|
+
return _this10.getAppData(key);
|
|
1387
1641
|
});
|
|
1388
1642
|
}
|
|
1389
1643
|
}, {
|
|
@@ -1428,11 +1682,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1428
1682
|
key: "initialize",
|
|
1429
1683
|
value: function () {
|
|
1430
1684
|
var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(core) {
|
|
1431
|
-
var _this$
|
|
1685
|
+
var _this$otherParams10,
|
|
1432
1686
|
_this$appPlugin2,
|
|
1433
1687
|
_this$appPlugin2$getA,
|
|
1434
|
-
|
|
1435
|
-
_this$
|
|
1688
|
+
_this11 = this,
|
|
1689
|
+
_this$otherParams11;
|
|
1436
1690
|
var options,
|
|
1437
1691
|
app,
|
|
1438
1692
|
targetCacheData,
|
|
@@ -1447,7 +1701,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1447
1701
|
this.paymentNumberDevicePrefix = null;
|
|
1448
1702
|
// this.store = { ...this.store, ...(options.store as Partial<BaseSalesState>) };
|
|
1449
1703
|
this.otherParams = options.otherParams || {};
|
|
1450
|
-
this.cacheId = (_this$
|
|
1704
|
+
this.cacheId = (_this$otherParams10 = this.otherParams) === null || _this$otherParams10 === void 0 ? void 0 : _this$otherParams10.cacheId;
|
|
1451
1705
|
this.reusedSharedSubModuleNames.clear();
|
|
1452
1706
|
this.window = core.getPlugin('window');
|
|
1453
1707
|
this.request = core.getPlugin('request');
|
|
@@ -1462,24 +1716,24 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1462
1716
|
targetCacheData = this.readSessionCacheData();
|
|
1463
1717
|
moduleNames = this.getRegisteredModuleNames();
|
|
1464
1718
|
moduleNames.forEach(function (step) {
|
|
1465
|
-
var reusedModule =
|
|
1719
|
+
var reusedModule = _this11.getReusableSharedSubModule(step);
|
|
1466
1720
|
if (reusedModule) {
|
|
1467
|
-
|
|
1468
|
-
|
|
1721
|
+
_this11.store[step] = reusedModule;
|
|
1722
|
+
_this11.reusedSharedSubModuleNames.add(step);
|
|
1469
1723
|
return;
|
|
1470
1724
|
}
|
|
1471
|
-
var targetModule =
|
|
1725
|
+
var targetModule = _this11.createSubModule(step);
|
|
1472
1726
|
if (!targetModule) {
|
|
1473
1727
|
throw new Error("\u6A21\u5757 ".concat(step, " \u4E0D\u5B58\u5728"));
|
|
1474
1728
|
}
|
|
1475
|
-
var hooks =
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
initialState:
|
|
1729
|
+
var hooks = _this11.getSubModuleHooks(step);
|
|
1730
|
+
_this11.store[step] = targetModule;
|
|
1731
|
+
_this11.core.registerModule(targetModule, _objectSpread(_objectSpread({
|
|
1732
|
+
initialState: _this11.shouldUseSessionStorageForSubModule(step) ? (targetCacheData === null || targetCacheData === void 0 ? void 0 : targetCacheData[targetModule.name]) || {} : {}
|
|
1479
1733
|
}, hooks ? {
|
|
1480
1734
|
hooks: hooks
|
|
1481
1735
|
} : {}), {}, {
|
|
1482
|
-
otherParams:
|
|
1736
|
+
otherParams: _this11.buildSubModuleOtherParams(step)
|
|
1483
1737
|
}));
|
|
1484
1738
|
});
|
|
1485
1739
|
if (!(this.store.schedule && !this.isScheduleListLoaded(this.store.schedule))) {
|
|
@@ -1489,7 +1743,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1489
1743
|
_context12.next = 19;
|
|
1490
1744
|
return this.store.schedule.loadAllSchedule();
|
|
1491
1745
|
case 19:
|
|
1492
|
-
if (this.store.order && typeof ((_this$
|
|
1746
|
+
if (this.store.order && typeof ((_this$otherParams11 = this.otherParams) === null || _this$otherParams11 === void 0 ? void 0 : _this$otherParams11.enableTempOrderPersist) === 'boolean') {
|
|
1493
1747
|
this.store.order.setEnableTempOrderPersist(this.otherParams.enableTempOrderPersist);
|
|
1494
1748
|
}
|
|
1495
1749
|
_context12.next = 22;
|
|
@@ -1503,7 +1757,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1503
1757
|
}
|
|
1504
1758
|
}, _callee12, this);
|
|
1505
1759
|
}));
|
|
1506
|
-
function initialize(
|
|
1760
|
+
function initialize(_x11) {
|
|
1507
1761
|
return _initialize.apply(this, arguments);
|
|
1508
1762
|
}
|
|
1509
1763
|
return initialize;
|
|
@@ -1513,15 +1767,15 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1513
1767
|
value: function () {
|
|
1514
1768
|
var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
|
|
1515
1769
|
var _this$serverOrderChan2,
|
|
1516
|
-
|
|
1770
|
+
_this12 = this;
|
|
1517
1771
|
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
1518
1772
|
while (1) switch (_context13.prev = _context13.next) {
|
|
1519
1773
|
case 0:
|
|
1520
1774
|
(_this$serverOrderChan2 = this.serverOrderChangeUnsubscribe) === null || _this$serverOrderChan2 === void 0 || _this$serverOrderChan2.call(this);
|
|
1521
1775
|
this.serverOrderChangeUnsubscribe = null;
|
|
1522
1776
|
Object.keys(this.store).forEach(function (key) {
|
|
1523
|
-
if (
|
|
1524
|
-
var sub =
|
|
1777
|
+
if (_this12.reusedSharedSubModuleNames.has(key)) return;
|
|
1778
|
+
var sub = _this12.store[key];
|
|
1525
1779
|
if (sub && typeof sub.destroy === 'function') {
|
|
1526
1780
|
try {
|
|
1527
1781
|
sub.destroy();
|
|
@@ -1561,7 +1815,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1561
1815
|
key: "loadSalesDetail",
|
|
1562
1816
|
value: (function () {
|
|
1563
1817
|
var _loadSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(orderIdOrParams) {
|
|
1564
|
-
var loadSequence,
|
|
1818
|
+
var loadSequence, _ref31, _ref32, _ref33, _ref34, _params$orderId, params, externalSaleNumber, preloadedSalesDetail, lookup, loadedRecord, message, loadedSalesDetail, shouldFilterPendingPayments, remoteRecord, mergeSourceRecord, currentTempOrder, mergedRecord, record;
|
|
1565
1819
|
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
1566
1820
|
while (1) switch (_context14.prev = _context14.next) {
|
|
1567
1821
|
case 0:
|
|
@@ -1579,7 +1833,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1579
1833
|
};
|
|
1580
1834
|
externalSaleNumber = params.externalSaleNumber || params.external_sale_number;
|
|
1581
1835
|
preloadedSalesDetail = params.preloadedSalesDetail;
|
|
1582
|
-
lookup = (
|
|
1836
|
+
lookup = (_ref31 = (_ref32 = (_ref33 = (_ref34 = (_params$orderId = params.orderId) !== null && _params$orderId !== void 0 ? _params$orderId : externalSaleNumber) !== null && _ref34 !== void 0 ? _ref34 : params.orderNumber) !== null && _ref33 !== void 0 ? _ref33 : preloadedSalesDetail === null || preloadedSalesDetail === void 0 ? void 0 : preloadedSalesDetail.order_id) !== null && _ref32 !== void 0 ? _ref32 : preloadedSalesDetail === null || preloadedSalesDetail === void 0 ? void 0 : preloadedSalesDetail.external_sale_number) !== null && _ref31 !== void 0 ? _ref31 : preloadedSalesDetail === null || preloadedSalesDetail === void 0 ? void 0 : preloadedSalesDetail.order_number;
|
|
1583
1837
|
if (!(!preloadedSalesDetail && (lookup === undefined || lookup === null || lookup === ''))) {
|
|
1584
1838
|
_context14.next = 11;
|
|
1585
1839
|
break;
|
|
@@ -1651,7 +1905,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1651
1905
|
}
|
|
1652
1906
|
}, _callee14, this, [[4,, 32, 44], [35, 40]]);
|
|
1653
1907
|
}));
|
|
1654
|
-
function loadSalesDetail(
|
|
1908
|
+
function loadSalesDetail(_x12) {
|
|
1655
1909
|
return _loadSalesDetail.apply(this, arguments);
|
|
1656
1910
|
}
|
|
1657
1911
|
return loadSalesDetail;
|
|
@@ -1758,7 +2012,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1758
2012
|
}
|
|
1759
2013
|
}, _callee15, this);
|
|
1760
2014
|
}));
|
|
1761
|
-
function replaceTempOrder(
|
|
2015
|
+
function replaceTempOrder(_x13, _x14) {
|
|
1762
2016
|
return _replaceTempOrder.apply(this, arguments);
|
|
1763
2017
|
}
|
|
1764
2018
|
return replaceTempOrder;
|
|
@@ -2087,10 +2341,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2087
2341
|
}, {
|
|
2088
2342
|
key: "getHistoricalProductDiscountList",
|
|
2089
2343
|
value: function getHistoricalProductDiscountList(products) {
|
|
2090
|
-
var
|
|
2344
|
+
var _this13 = this;
|
|
2091
2345
|
var historyDiscountList = [];
|
|
2092
2346
|
products.forEach(function (item) {
|
|
2093
|
-
if (!
|
|
2347
|
+
if (!_this13.isPersistedOrderProduct(item)) return;
|
|
2094
2348
|
(item.discount_list || []).forEach(function (discount) {
|
|
2095
2349
|
var _discount$discount, _discount$metadata, _discount$discount2, _discount$discount3, _discount$discount4;
|
|
2096
2350
|
var discountId = ((_discount$discount = discount.discount) === null || _discount$discount === void 0 ? void 0 : _discount$discount.resource_id) || discount.id;
|
|
@@ -2150,11 +2404,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2150
2404
|
}, {
|
|
2151
2405
|
key: "shouldSkipAutoApplyFetchedDiscountsInEditMode",
|
|
2152
2406
|
value: function shouldSkipAutoApplyFetchedDiscountsInEditMode(params) {
|
|
2153
|
-
var
|
|
2407
|
+
var _this14 = this;
|
|
2154
2408
|
if (params.discountAction !== 'edit') return false;
|
|
2155
2409
|
if (!params.products.length) return false;
|
|
2156
2410
|
var hasDraftProduct = params.products.some(function (product) {
|
|
2157
|
-
return !
|
|
2411
|
+
return !_this14.isPersistedOrderProduct(product);
|
|
2158
2412
|
});
|
|
2159
2413
|
if (hasDraftProduct) return false;
|
|
2160
2414
|
|
|
@@ -2408,7 +2662,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2408
2662
|
}
|
|
2409
2663
|
}, _callee21, this, [[45, 64, 67, 70]]);
|
|
2410
2664
|
}));
|
|
2411
|
-
function loadDiscountConfig(
|
|
2665
|
+
function loadDiscountConfig(_x15) {
|
|
2412
2666
|
return _loadDiscountConfig.apply(this, arguments);
|
|
2413
2667
|
}
|
|
2414
2668
|
return loadDiscountConfig;
|
|
@@ -2505,7 +2759,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2505
2759
|
}
|
|
2506
2760
|
}, _callee22, this);
|
|
2507
2761
|
}));
|
|
2508
|
-
function bestDiscount(
|
|
2762
|
+
function bestDiscount(_x16) {
|
|
2509
2763
|
return _bestDiscount.apply(this, arguments);
|
|
2510
2764
|
}
|
|
2511
2765
|
return bestDiscount;
|
|
@@ -2568,7 +2822,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2568
2822
|
}
|
|
2569
2823
|
}, _callee23, this);
|
|
2570
2824
|
}));
|
|
2571
|
-
function replaceDiscountStoreLists(
|
|
2825
|
+
function replaceDiscountStoreLists(_x17) {
|
|
2572
2826
|
return _replaceDiscountStoreLists.apply(this, arguments);
|
|
2573
2827
|
}
|
|
2574
2828
|
return replaceDiscountStoreLists;
|
|
@@ -2630,7 +2884,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2630
2884
|
}
|
|
2631
2885
|
}, _callee24, this, [[0, 16]]);
|
|
2632
2886
|
}));
|
|
2633
|
-
function scanPromotionCode(
|
|
2887
|
+
function scanPromotionCode(_x18, _x19) {
|
|
2634
2888
|
return _scanPromotionCode.apply(this, arguments);
|
|
2635
2889
|
}
|
|
2636
2890
|
return scanPromotionCode;
|
|
@@ -2744,10 +2998,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2744
2998
|
product.discount_list = filterSelectedDiscountDetails(product.discount_list);
|
|
2745
2999
|
if (Array.isArray(product.product_bundle)) {
|
|
2746
3000
|
product.product_bundle = product.product_bundle.map(function (bundle) {
|
|
2747
|
-
var
|
|
3001
|
+
var _ref35, _bundle$original_pric;
|
|
2748
3002
|
var nextBundleDiscountList = filterSelectedDiscountDetails(bundle === null || bundle === void 0 ? void 0 : bundle.discount_list);
|
|
2749
3003
|
var shouldRestoreBundlePrice = nextBundleDiscountList.length === 0;
|
|
2750
|
-
var restoredBundlePrice = (
|
|
3004
|
+
var restoredBundlePrice = (_ref35 = (_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 && _ref35 !== void 0 ? _ref35 : bundle === null || bundle === void 0 ? void 0 : bundle.price;
|
|
2751
3005
|
return _objectSpread(_objectSpread(_objectSpread({}, bundle), shouldRestoreBundlePrice ? {
|
|
2752
3006
|
price: restoredBundlePrice,
|
|
2753
3007
|
bundle_selling_price: restoredBundlePrice
|
|
@@ -2820,7 +3074,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2820
3074
|
}
|
|
2821
3075
|
}, _callee25, this, [[0, 54], [17, 38, 41, 44]]);
|
|
2822
3076
|
}));
|
|
2823
|
-
function setDiscountSelected(
|
|
3077
|
+
function setDiscountSelected(_x20) {
|
|
2824
3078
|
return _setDiscountSelected.apply(this, arguments);
|
|
2825
3079
|
}
|
|
2826
3080
|
return setDiscountSelected;
|
|
@@ -2890,7 +3144,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2890
3144
|
}
|
|
2891
3145
|
}, _callee26, this, [[0, 21]]);
|
|
2892
3146
|
}));
|
|
2893
|
-
function applyDiscountCalculationResult(
|
|
3147
|
+
function applyDiscountCalculationResult(_x21) {
|
|
2894
3148
|
return _applyDiscountCalculationResult.apply(this, arguments);
|
|
2895
3149
|
}
|
|
2896
3150
|
return applyDiscountCalculationResult;
|
|
@@ -2909,7 +3163,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2909
3163
|
}
|
|
2910
3164
|
}, _callee27, this);
|
|
2911
3165
|
}));
|
|
2912
|
-
function submitScanOrder(
|
|
3166
|
+
function submitScanOrder(_x22) {
|
|
2913
3167
|
return _submitScanOrder.apply(this, arguments);
|
|
2914
3168
|
}
|
|
2915
3169
|
return submitScanOrder;
|
|
@@ -2924,7 +3178,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2924
3178
|
key: "submitSalesOrder",
|
|
2925
3179
|
value: (function () {
|
|
2926
3180
|
var _submitSalesOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(params) {
|
|
2927
|
-
var _params$smallTicketDa, _this$
|
|
3181
|
+
var _params$smallTicketDa, _this$otherParams12, _this$otherParams13, _this$otherParams14, _this$otherParams15;
|
|
2928
3182
|
var inferredPaymentStatus, smallTicketDataFlag, submitParams;
|
|
2929
3183
|
return _regeneratorRuntime().wrap(function _callee28$(_context28) {
|
|
2930
3184
|
while (1) switch (_context28.prev = _context28.next) {
|
|
@@ -2940,10 +3194,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2940
3194
|
smallTicketDataFlag = (_params$smallTicketDa = params === null || params === void 0 ? void 0 : params.smallTicketDataFlag) !== null && _params$smallTicketDa !== void 0 ? _params$smallTicketDa : this.getDefaultCheckoutSmallTicketDataFlag();
|
|
2941
3195
|
submitParams = _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
2942
3196
|
cacheId: this.cacheId,
|
|
2943
|
-
platform: (_this$
|
|
2944
|
-
businessCode: ((_this$
|
|
3197
|
+
platform: (_this$otherParams12 = this.otherParams) === null || _this$otherParams12 === void 0 ? void 0 : _this$otherParams12.platform,
|
|
3198
|
+
businessCode: ((_this$otherParams13 = this.otherParams) === null || _this$otherParams13 === void 0 ? void 0 : _this$otherParams13.businessCode) || ((_this$otherParams14 = this.otherParams) === null || _this$otherParams14 === void 0 ? void 0 : _this$otherParams14.business_code),
|
|
2945
3199
|
channel: this.getSubmitOrderSalesChannel(),
|
|
2946
|
-
type: (_this$
|
|
3200
|
+
type: (_this$otherParams15 = this.otherParams) === null || _this$otherParams15 === void 0 ? void 0 : _this$otherParams15.type,
|
|
2947
3201
|
request_unique_idempotency_token: this.store.order.generateIdempotencyToken()
|
|
2948
3202
|
}, (params === null || params === void 0 ? void 0 : params.payments) !== undefined ? {
|
|
2949
3203
|
payments: params.payments
|
|
@@ -2963,7 +3217,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2963
3217
|
}
|
|
2964
3218
|
}, _callee28, this);
|
|
2965
3219
|
}));
|
|
2966
|
-
function submitSalesOrder(
|
|
3220
|
+
function submitSalesOrder(_x23) {
|
|
2967
3221
|
return _submitSalesOrder.apply(this, arguments);
|
|
2968
3222
|
}
|
|
2969
3223
|
return submitSalesOrder;
|
|
@@ -2972,7 +3226,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2972
3226
|
key: "saveSalesOrderDraft",
|
|
2973
3227
|
value: function () {
|
|
2974
3228
|
var _saveSalesOrderDraft = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(params) {
|
|
2975
|
-
var _params$platform, _this$
|
|
3229
|
+
var _params$platform, _this$otherParams16, _this$otherParams17, _this$otherParams18, _params$channel, _params$type, _this$otherParams19;
|
|
2976
3230
|
return _regeneratorRuntime().wrap(function _callee29$(_context29) {
|
|
2977
3231
|
while (1) switch (_context29.prev = _context29.next) {
|
|
2978
3232
|
case 0:
|
|
@@ -2984,10 +3238,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2984
3238
|
case 2:
|
|
2985
3239
|
return _context29.abrupt("return", this.store.order.saveTempOrderAsDraft(_objectSpread({
|
|
2986
3240
|
cacheId: this.cacheId,
|
|
2987
|
-
platform: (_params$platform = params === null || params === void 0 ? void 0 : params.platform) !== null && _params$platform !== void 0 ? _params$platform : (_this$
|
|
2988
|
-
businessCode: (params === null || params === void 0 ? void 0 : params.businessCode) || ((_this$
|
|
3241
|
+
platform: (_params$platform = params === null || params === void 0 ? void 0 : params.platform) !== null && _params$platform !== void 0 ? _params$platform : (_this$otherParams16 = this.otherParams) === null || _this$otherParams16 === void 0 ? void 0 : _this$otherParams16.platform,
|
|
3242
|
+
businessCode: (params === null || params === void 0 ? void 0 : params.businessCode) || ((_this$otherParams17 = this.otherParams) === null || _this$otherParams17 === void 0 ? void 0 : _this$otherParams17.businessCode) || ((_this$otherParams18 = this.otherParams) === null || _this$otherParams18 === void 0 ? void 0 : _this$otherParams18.business_code),
|
|
2989
3243
|
channel: (_params$channel = params === null || params === void 0 ? void 0 : params.channel) !== null && _params$channel !== void 0 ? _params$channel : this.getSubmitOrderSalesChannel(),
|
|
2990
|
-
type: (_params$type = params === null || params === void 0 ? void 0 : params.type) !== null && _params$type !== void 0 ? _params$type : (_this$
|
|
3244
|
+
type: (_params$type = params === null || params === void 0 ? void 0 : params.type) !== null && _params$type !== void 0 ? _params$type : (_this$otherParams19 = this.otherParams) === null || _this$otherParams19 === void 0 ? void 0 : _this$otherParams19.type
|
|
2991
3245
|
}, (params === null || params === void 0 ? void 0 : params.enhancePayload) !== undefined ? {
|
|
2992
3246
|
enhancePayload: params.enhancePayload
|
|
2993
3247
|
} : {})));
|
|
@@ -2997,7 +3251,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2997
3251
|
}
|
|
2998
3252
|
}, _callee29, this);
|
|
2999
3253
|
}));
|
|
3000
|
-
function saveSalesOrderDraft(
|
|
3254
|
+
function saveSalesOrderDraft(_x24) {
|
|
3001
3255
|
return _saveSalesOrderDraft.apply(this, arguments);
|
|
3002
3256
|
}
|
|
3003
3257
|
return saveSalesOrderDraft;
|
|
@@ -3006,7 +3260,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3006
3260
|
key: "submitTempOrderAsync",
|
|
3007
3261
|
value: function () {
|
|
3008
3262
|
var _submitTempOrderAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(params) {
|
|
3009
|
-
var _params$smallTicketDa2, _this$
|
|
3263
|
+
var _params$smallTicketDa2, _this$otherParams20, _this$otherParams21, _this$otherParams22, _this$otherParams23;
|
|
3010
3264
|
var inferredPaymentStatus, smallTicketDataFlag, submitParams;
|
|
3011
3265
|
return _regeneratorRuntime().wrap(function _callee30$(_context30) {
|
|
3012
3266
|
while (1) switch (_context30.prev = _context30.next) {
|
|
@@ -3021,10 +3275,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3021
3275
|
smallTicketDataFlag = (_params$smallTicketDa2 = params === null || params === void 0 ? void 0 : params.smallTicketDataFlag) !== null && _params$smallTicketDa2 !== void 0 ? _params$smallTicketDa2 : this.getDefaultCheckoutSmallTicketDataFlag();
|
|
3022
3276
|
submitParams = _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
3023
3277
|
cacheId: this.cacheId,
|
|
3024
|
-
platform: (_this$
|
|
3025
|
-
businessCode: ((_this$
|
|
3278
|
+
platform: (_this$otherParams20 = this.otherParams) === null || _this$otherParams20 === void 0 ? void 0 : _this$otherParams20.platform,
|
|
3279
|
+
businessCode: ((_this$otherParams21 = this.otherParams) === null || _this$otherParams21 === void 0 ? void 0 : _this$otherParams21.businessCode) || ((_this$otherParams22 = this.otherParams) === null || _this$otherParams22 === void 0 ? void 0 : _this$otherParams22.business_code),
|
|
3026
3280
|
channel: this.getSubmitOrderSalesChannel(),
|
|
3027
|
-
type: (_this$
|
|
3281
|
+
type: (_this$otherParams23 = this.otherParams) === null || _this$otherParams23 === void 0 ? void 0 : _this$otherParams23.type,
|
|
3028
3282
|
request_unique_idempotency_token: this.store.order.generateIdempotencyToken()
|
|
3029
3283
|
}, (params === null || params === void 0 ? void 0 : params.payments) !== undefined ? {
|
|
3030
3284
|
payments: params.payments
|
|
@@ -3044,7 +3298,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3044
3298
|
}
|
|
3045
3299
|
}, _callee30, this);
|
|
3046
3300
|
}));
|
|
3047
|
-
function submitTempOrderAsync(
|
|
3301
|
+
function submitTempOrderAsync(_x25) {
|
|
3048
3302
|
return _submitTempOrderAsync.apply(this, arguments);
|
|
3049
3303
|
}
|
|
3050
3304
|
return submitTempOrderAsync;
|
|
@@ -3056,8 +3310,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3056
3310
|
}, {
|
|
3057
3311
|
key: "shouldUseCheckoutSyncTask",
|
|
3058
3312
|
value: function shouldUseCheckoutSyncTask() {
|
|
3059
|
-
var _this$
|
|
3060
|
-
var configured = (_this$
|
|
3313
|
+
var _this$otherParams24;
|
|
3314
|
+
var configured = (_this$otherParams24 = this.otherParams) === null || _this$otherParams24 === void 0 ? void 0 : _this$otherParams24.checkoutSyncTaskEnabled;
|
|
3061
3315
|
return typeof configured === 'boolean' ? configured : true;
|
|
3062
3316
|
}
|
|
3063
3317
|
|
|
@@ -3071,7 +3325,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3071
3325
|
key: "printLocalOrderReceipt",
|
|
3072
3326
|
value: function () {
|
|
3073
3327
|
var _printLocalOrderReceipt = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(lookup) {
|
|
3074
|
-
var _this$
|
|
3328
|
+
var _this$otherParams25, _this$otherParams26, _this$otherParams27, _this$otherParams28;
|
|
3075
3329
|
var hasLookup, lookupPayload, context, payload, response, _this$store$order$app, _this$store$order5, _data;
|
|
3076
3330
|
return _regeneratorRuntime().wrap(function _callee31$(_context31) {
|
|
3077
3331
|
while (1) switch (_context31.prev = _context31.next) {
|
|
@@ -3089,10 +3343,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3089
3343
|
external_sale_number: lookup
|
|
3090
3344
|
};
|
|
3091
3345
|
context = {
|
|
3092
|
-
platform: (_this$
|
|
3093
|
-
businessCode: ((_this$
|
|
3346
|
+
platform: (_this$otherParams25 = this.otherParams) === null || _this$otherParams25 === void 0 ? void 0 : _this$otherParams25.platform,
|
|
3347
|
+
businessCode: ((_this$otherParams26 = this.otherParams) === null || _this$otherParams26 === void 0 ? void 0 : _this$otherParams26.businessCode) || ((_this$otherParams27 = this.otherParams) === null || _this$otherParams27 === void 0 ? void 0 : _this$otherParams27.business_code),
|
|
3094
3348
|
channel: this.getSubmitOrderSalesChannel(),
|
|
3095
|
-
type: (_this$
|
|
3349
|
+
type: (_this$otherParams28 = this.otherParams) === null || _this$otherParams28 === void 0 ? void 0 : _this$otherParams28.type
|
|
3096
3350
|
};
|
|
3097
3351
|
payload = hasLookup ? _objectSpread(_objectSpread({}, lookupPayload), {}, {
|
|
3098
3352
|
lookup_order_from_db: 1,
|
|
@@ -3129,7 +3383,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3129
3383
|
}
|
|
3130
3384
|
}, _callee31, this);
|
|
3131
3385
|
}));
|
|
3132
|
-
function printLocalOrderReceipt(
|
|
3386
|
+
function printLocalOrderReceipt(_x26) {
|
|
3133
3387
|
return _printLocalOrderReceipt.apply(this, arguments);
|
|
3134
3388
|
}
|
|
3135
3389
|
return printLocalOrderReceipt;
|
|
@@ -3151,7 +3405,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3151
3405
|
key: "syncPaymentsToOrder",
|
|
3152
3406
|
value: function () {
|
|
3153
3407
|
var _syncPaymentsToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(params) {
|
|
3154
|
-
var
|
|
3408
|
+
var _ref36, _params$businessCode, _this$otherParams29, _this$otherParams30, _params$channel2;
|
|
3155
3409
|
var businessCode, channel, syncParams, syncState, payments, syncResult, latestPayments, amountSnapshot, orderSnapshot, syncPayload;
|
|
3156
3410
|
return _regeneratorRuntime().wrap(function _callee32$(_context32) {
|
|
3157
3411
|
while (1) switch (_context32.prev = _context32.next) {
|
|
@@ -3162,7 +3416,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3162
3416
|
}
|
|
3163
3417
|
throw new Error('order 模块未初始化');
|
|
3164
3418
|
case 2:
|
|
3165
|
-
businessCode = (
|
|
3419
|
+
businessCode = (_ref36 = (_params$businessCode = params.businessCode) !== null && _params$businessCode !== void 0 ? _params$businessCode : (_this$otherParams29 = this.otherParams) === null || _this$otherParams29 === void 0 ? void 0 : _this$otherParams29.businessCode) !== null && _ref36 !== void 0 ? _ref36 : (_this$otherParams30 = this.otherParams) === null || _this$otherParams30 === void 0 ? void 0 : _this$otherParams30.business_code;
|
|
3166
3420
|
channel = (_params$channel2 = params.channel) !== null && _params$channel2 !== void 0 ? _params$channel2 : this.getSubmitOrderSalesChannel();
|
|
3167
3421
|
syncParams = _objectSpread(_objectSpread(_objectSpread({}, params), {}, {
|
|
3168
3422
|
checkoutSyncTaskEnabled: this.shouldUseCheckoutSyncTask()
|
|
@@ -3243,7 +3497,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3243
3497
|
}
|
|
3244
3498
|
}, _callee32, this, [[12, 29]]);
|
|
3245
3499
|
}));
|
|
3246
|
-
function syncPaymentsToOrder(
|
|
3500
|
+
function syncPaymentsToOrder(_x27) {
|
|
3247
3501
|
return _syncPaymentsToOrder.apply(this, arguments);
|
|
3248
3502
|
}
|
|
3249
3503
|
return syncPaymentsToOrder;
|
|
@@ -3280,13 +3534,13 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3280
3534
|
}, {
|
|
3281
3535
|
key: "scheduleQueuedAutoPaymentSyncFlush",
|
|
3282
3536
|
value: function scheduleQueuedAutoPaymentSyncFlush() {
|
|
3283
|
-
var
|
|
3537
|
+
var _this15 = this;
|
|
3284
3538
|
var delay = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 100;
|
|
3285
3539
|
if (!this.queuedAutoPaymentSync) return;
|
|
3286
3540
|
if (this.autoPaymentSyncTimer) return;
|
|
3287
3541
|
this.autoPaymentSyncTimer = setTimeout(function () {
|
|
3288
|
-
|
|
3289
|
-
void
|
|
3542
|
+
_this15.autoPaymentSyncTimer = null;
|
|
3543
|
+
void _this15.flushQueuedAutoPaymentSync();
|
|
3290
3544
|
}, delay);
|
|
3291
3545
|
}
|
|
3292
3546
|
}, {
|
|
@@ -3413,7 +3667,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3413
3667
|
}
|
|
3414
3668
|
}, _callee34, this);
|
|
3415
3669
|
}));
|
|
3416
|
-
function addOrderPaymentAsync(
|
|
3670
|
+
function addOrderPaymentAsync(_x28) {
|
|
3417
3671
|
return _addOrderPaymentAsync.apply(this, arguments);
|
|
3418
3672
|
}
|
|
3419
3673
|
return addOrderPaymentAsync;
|
|
@@ -3421,12 +3675,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3421
3675
|
}, {
|
|
3422
3676
|
key: "addOrderPaymentWithDevicePrefix",
|
|
3423
3677
|
value: function addOrderPaymentWithDevicePrefix(payment, devicePrefix) {
|
|
3424
|
-
var _this$
|
|
3678
|
+
var _this$otherParams31,
|
|
3425
3679
|
_paymentRecord$paymen,
|
|
3426
3680
|
_paymentRecord$create,
|
|
3427
|
-
|
|
3681
|
+
_ref37,
|
|
3428
3682
|
_paymentRecord$origin,
|
|
3429
|
-
|
|
3683
|
+
_this16 = this;
|
|
3430
3684
|
if (!this.store.order) throw new Error('order 模块未初始化');
|
|
3431
3685
|
var paymentRecord = payment;
|
|
3432
3686
|
var paymentAmount = new Decimal(paymentRecord.amount || 0);
|
|
@@ -3437,7 +3691,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3437
3691
|
return this.store.order.getOrderPayments();
|
|
3438
3692
|
}
|
|
3439
3693
|
var metadata = paymentRecord.metadata && _typeof(paymentRecord.metadata) === 'object' ? _objectSpread({}, paymentRecord.metadata) : {};
|
|
3440
|
-
var shopWalletPassId = (_this$
|
|
3694
|
+
var shopWalletPassId = (_this$otherParams31 = this.otherParams) === null || _this$otherParams31 === void 0 ? void 0 : _this$otherParams31.shop_wallet_pass_id;
|
|
3441
3695
|
if (shopWalletPassId !== undefined && shopWalletPassId !== null) {
|
|
3442
3696
|
metadata.shop_wallet_pass_id = shopWalletPassId;
|
|
3443
3697
|
}
|
|
@@ -3446,7 +3700,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3446
3700
|
var paymentTime = (_paymentRecord$paymen = paymentRecord.payment_time) !== null && _paymentRecord$paymen !== void 0 ? _paymentRecord$paymen : paymentTimestamp;
|
|
3447
3701
|
var createdAt = (_paymentRecord$create = paymentRecord.created_at) !== null && _paymentRecord$create !== void 0 ? _paymentRecord$create : paymentTimestamp;
|
|
3448
3702
|
var serviceCharge = paymentRecord.service_charge && _typeof(paymentRecord.service_charge) === 'object' ? paymentRecord.service_charge : null;
|
|
3449
|
-
var calculatedServiceFee = serviceCharge ? new Decimal((
|
|
3703
|
+
var calculatedServiceFee = serviceCharge ? new Decimal((_ref37 = (_paymentRecord$origin = paymentRecord.origin_amount) !== null && _paymentRecord$origin !== void 0 ? _paymentRecord$origin : paymentRecord.amount) !== null && _ref37 !== void 0 ? _ref37 : 0).times(serviceCharge.percentage || 0).plus(serviceCharge.amount || 0).toDecimalPlaces(2).toFixed(2) : undefined;
|
|
3450
3704
|
var payments = this.store.order.addOrderPayment(_objectSpread(_objectSpread(_objectSpread({}, normalizedPaymentRecord), calculatedServiceFee !== undefined ? {
|
|
3451
3705
|
service_fee: calculatedServiceFee
|
|
3452
3706
|
} : {}), {}, {
|
|
@@ -3470,7 +3724,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3470
3724
|
submitWhenPaid: true,
|
|
3471
3725
|
smallTicketDataFlag: 1
|
|
3472
3726
|
}).catch(function (error) {
|
|
3473
|
-
|
|
3727
|
+
_this16.logError('auto sync payments failed', {
|
|
3474
3728
|
error: error instanceof Error ? error.message : String(error)
|
|
3475
3729
|
});
|
|
3476
3730
|
});
|
|
@@ -3601,7 +3855,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3601
3855
|
}
|
|
3602
3856
|
}, _callee35, this, [[17, 23]]);
|
|
3603
3857
|
}));
|
|
3604
|
-
function updateOrderPayment(
|
|
3858
|
+
function updateOrderPayment(_x29, _x30) {
|
|
3605
3859
|
return _updateOrderPayment.apply(this, arguments);
|
|
3606
3860
|
}
|
|
3607
3861
|
return updateOrderPayment;
|
|
@@ -3640,7 +3894,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3640
3894
|
}
|
|
3641
3895
|
}, _callee36, this);
|
|
3642
3896
|
}));
|
|
3643
|
-
function updateVoucherOrderPaymentsAsync(
|
|
3897
|
+
function updateVoucherOrderPaymentsAsync(_x31, _x32) {
|
|
3644
3898
|
return _updateVoucherOrderPaymentsAsync.apply(this, arguments);
|
|
3645
3899
|
}
|
|
3646
3900
|
return updateVoucherOrderPaymentsAsync;
|
|
@@ -3674,14 +3928,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3674
3928
|
// const products = tempOrder?.products?.filter(n => n.product_id)
|
|
3675
3929
|
|
|
3676
3930
|
var walletProducts = tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.products.map(function (product) {
|
|
3677
|
-
var _product$holder_id, _product$
|
|
3931
|
+
var _product$holder_id, _product$product_vari3, _product$is_charge_ta, _metadata$main_produc, _metadata$main_produc2;
|
|
3678
3932
|
var metadata = product.metadata || {};
|
|
3679
3933
|
var rawHolderId = (_product$holder_id = product.holder_id) !== null && _product$holder_id !== void 0 ? _product$holder_id : metadata.holder_id;
|
|
3680
3934
|
var holderIdValue = Array.isArray(rawHolderId) ? rawHolderId[0] : rawHolderId;
|
|
3681
3935
|
var holder_id = Number.isInteger(Number(holderIdValue)) ? Number(holderIdValue) : undefined;
|
|
3682
3936
|
return {
|
|
3683
3937
|
product_id: product.product_id || 0,
|
|
3684
|
-
product_variant_id: String((_product$
|
|
3938
|
+
product_variant_id: String((_product$product_vari3 = product.product_variant_id) !== null && _product$product_vari3 !== void 0 ? _product$product_vari3 : ''),
|
|
3685
3939
|
quantity: product.num || 1,
|
|
3686
3940
|
is_price_include_tax: tempOrder.is_price_include_tax,
|
|
3687
3941
|
is_charge_tax: (_product$is_charge_ta = product.is_charge_tax) !== null && _product$is_charge_ta !== void 0 ? _product$is_charge_ta : 0,
|
|
@@ -3727,7 +3981,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3727
3981
|
}, {
|
|
3728
3982
|
key: "buildWalletInitBusinessData",
|
|
3729
3983
|
value: function buildWalletInitBusinessData(params) {
|
|
3730
|
-
var _this$store$order8, _params$order_wait_pa,
|
|
3984
|
+
var _this$store$order8, _params$order_wait_pa, _ref38, _tempOrder$is_price_i;
|
|
3731
3985
|
var snapshot = (_this$store$order8 = this.store.order) === null || _this$store$order8 === void 0 ? void 0 : _this$store$order8.getOrderSnapshot();
|
|
3732
3986
|
var tempOrder = snapshot === null || snapshot === void 0 ? void 0 : snapshot.tempOrder;
|
|
3733
3987
|
var amount = snapshot === null || snapshot === void 0 ? void 0 : snapshot.amount;
|
|
@@ -3743,7 +3997,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3743
3997
|
},
|
|
3744
3998
|
products: this.getWalletProductList(),
|
|
3745
3999
|
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),
|
|
3746
|
-
is_price_include_tax: (
|
|
4000
|
+
is_price_include_tax: (_ref38 = (_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 && _ref38 !== void 0 ? _ref38 : 1
|
|
3747
4001
|
}, snapshot.identity.orderId ? {
|
|
3748
4002
|
payment_order_id: String(snapshot.identity.orderId)
|
|
3749
4003
|
} : {});
|
|
@@ -3806,7 +4060,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3806
4060
|
}
|
|
3807
4061
|
}, _callee37, this);
|
|
3808
4062
|
}));
|
|
3809
|
-
function initWalletData(
|
|
4063
|
+
function initWalletData(_x33) {
|
|
3810
4064
|
return _initWalletData.apply(this, arguments);
|
|
3811
4065
|
}
|
|
3812
4066
|
return initWalletData;
|
|
@@ -3833,9 +4087,9 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3833
4087
|
var walletPassName = fundRecord.wallet_pass_name;
|
|
3834
4088
|
var title = walletPassName && _typeof(walletPassName) === 'object' ? walletPassName.default || Object.values(walletPassName)[0] : walletPassName;
|
|
3835
4089
|
var code = String((payment === null || payment === void 0 ? void 0 : payment.code) || '').toUpperCase();
|
|
3836
|
-
var tag = ((_Object$entries$find = Object.entries(WALLET_PAYMENT_CODE_BY_TAG).find(function (
|
|
3837
|
-
var
|
|
3838
|
-
paymentCode =
|
|
4090
|
+
var tag = ((_Object$entries$find = Object.entries(WALLET_PAYMENT_CODE_BY_TAG).find(function (_ref39) {
|
|
4091
|
+
var _ref40 = _slicedToArray(_ref39, 2),
|
|
4092
|
+
paymentCode = _ref40[1];
|
|
3839
4093
|
return paymentCode === code;
|
|
3840
4094
|
})) === null || _Object$entries$find === void 0 ? void 0 : _Object$entries$find[0]) || fundRecord.tag;
|
|
3841
4095
|
return {
|
|
@@ -3873,7 +4127,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3873
4127
|
}
|
|
3874
4128
|
}, _callee38, this);
|
|
3875
4129
|
}));
|
|
3876
|
-
function publishWalletAssetsState(
|
|
4130
|
+
function publishWalletAssetsState(_x34) {
|
|
3877
4131
|
return _publishWalletAssetsState.apply(this, arguments);
|
|
3878
4132
|
}
|
|
3879
4133
|
return publishWalletAssetsState;
|
|
@@ -3954,7 +4208,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3954
4208
|
}
|
|
3955
4209
|
}, _callee39, this);
|
|
3956
4210
|
}));
|
|
3957
|
-
function syncSelectedWalletAssets(
|
|
4211
|
+
function syncSelectedWalletAssets(_x35) {
|
|
3958
4212
|
return _syncSelectedWalletAssets.apply(this, arguments);
|
|
3959
4213
|
}
|
|
3960
4214
|
return syncSelectedWalletAssets;
|
|
@@ -4010,7 +4264,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4010
4264
|
}
|
|
4011
4265
|
}, _callee40, this);
|
|
4012
4266
|
}));
|
|
4013
|
-
function importWalletAssetsSnapshot(
|
|
4267
|
+
function importWalletAssetsSnapshot(_x36) {
|
|
4014
4268
|
return _importWalletAssetsSnapshot.apply(this, arguments);
|
|
4015
4269
|
}
|
|
4016
4270
|
return importWalletAssetsSnapshot;
|
|
@@ -4098,7 +4352,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4098
4352
|
}
|
|
4099
4353
|
}, _callee41, this);
|
|
4100
4354
|
}));
|
|
4101
|
-
function refreshWalletAssets(
|
|
4355
|
+
function refreshWalletAssets(_x37) {
|
|
4102
4356
|
return _refreshWalletAssets.apply(this, arguments);
|
|
4103
4357
|
}
|
|
4104
4358
|
return refreshWalletAssets;
|
|
@@ -4131,7 +4385,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4131
4385
|
}
|
|
4132
4386
|
}, _callee42, this);
|
|
4133
4387
|
}));
|
|
4134
|
-
function selectWalletAsset(
|
|
4388
|
+
function selectWalletAsset(_x38) {
|
|
4135
4389
|
return _selectWalletAsset.apply(this, arguments);
|
|
4136
4390
|
}
|
|
4137
4391
|
return selectWalletAsset;
|
|
@@ -4161,7 +4415,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4161
4415
|
}
|
|
4162
4416
|
}, _callee43, this);
|
|
4163
4417
|
}));
|
|
4164
|
-
function updateWalletAssetAmount(
|
|
4418
|
+
function updateWalletAssetAmount(_x39) {
|
|
4165
4419
|
return _updateWalletAssetAmount.apply(this, arguments);
|
|
4166
4420
|
}
|
|
4167
4421
|
return updateWalletAssetAmount;
|
|
@@ -4206,7 +4460,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4206
4460
|
}
|
|
4207
4461
|
}, _callee44, this);
|
|
4208
4462
|
}));
|
|
4209
|
-
function scanWalletAsset(
|
|
4463
|
+
function scanWalletAsset(_x40) {
|
|
4210
4464
|
return _scanWalletAsset.apply(this, arguments);
|
|
4211
4465
|
}
|
|
4212
4466
|
return scanWalletAsset;
|
|
@@ -4336,7 +4590,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4336
4590
|
key: "getCashPaymentConfig",
|
|
4337
4591
|
value: (function () {
|
|
4338
4592
|
var _getCashPaymentConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee47() {
|
|
4339
|
-
var _this$store$order11, _this$store$order11$g, _this$store$order12, _this$store$order12$g, _this$
|
|
4593
|
+
var _this$store$order11, _this$store$order11$g, _this$store$order12, _this$store$order12$g, _this$otherParams32;
|
|
4340
4594
|
var paymentMethods, paymentMethod, amountSnapshot, pendingWalletAmount, amountDue, currency, recommendedAmounts;
|
|
4341
4595
|
return _regeneratorRuntime().wrap(function _callee47$(_context47) {
|
|
4342
4596
|
while (1) switch (_context47.prev = _context47.next) {
|
|
@@ -4362,7 +4616,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4362
4616
|
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);
|
|
4363
4617
|
pendingWalletAmount = this.getPendingWalletPaymentAmount();
|
|
4364
4618
|
amountDue = Decimal.max(new Decimal((amountSnapshot === null || amountSnapshot === void 0 ? void 0 : amountSnapshot.amountGap) || 0).minus(pendingWalletAmount), 0).toDecimalPlaces(2).toNumber();
|
|
4365
|
-
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$
|
|
4619
|
+
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$otherParams32 = this.otherParams) === null || _this$otherParams32 === void 0 ? void 0 : _this$otherParams32.currency) || 'USD';
|
|
4366
4620
|
recommendedAmounts = amountDue > 0 ? this.store.payment.cash.getRecommendedAmount(amountDue, currency) : [];
|
|
4367
4621
|
return _context47.abrupt("return", {
|
|
4368
4622
|
available: Boolean(paymentMethod && amountDue > 0),
|
|
@@ -4497,7 +4751,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4497
4751
|
key: "payCash",
|
|
4498
4752
|
value: (function () {
|
|
4499
4753
|
var _payCash = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee49(params) {
|
|
4500
|
-
var _this$store$order$get6, _params$actualPaidAmo, _this$
|
|
4754
|
+
var _this$store$order$get6, _params$actualPaidAmo, _this$otherParams33, _this$window, _this$window$postMess;
|
|
4501
4755
|
var amount, config, paymentMethod, roundingAmount, effectivePaymentAmount, beforePayments, beforePaymentStatus, uniquePaymentNumber, paymentTimestamp, actualPaidAmount, changeAmount, shopWalletPassId, payments, payment, syncResult, committed, walletState, restoredTempOrder;
|
|
4502
4756
|
return _regeneratorRuntime().wrap(function _callee49$(_context49) {
|
|
4503
4757
|
while (1) switch (_context49.prev = _context49.next) {
|
|
@@ -4546,7 +4800,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4546
4800
|
paymentTimestamp = dayjs().format('YYYY-MM-DD HH:mm:ss');
|
|
4547
4801
|
actualPaidAmount = Number((_params$actualPaidAmo = params.actualPaidAmount) !== null && _params$actualPaidAmo !== void 0 ? _params$actualPaidAmo : amount);
|
|
4548
4802
|
changeAmount = Number(params.changeAmount || 0);
|
|
4549
|
-
shopWalletPassId = (_this$
|
|
4803
|
+
shopWalletPassId = (_this$otherParams33 = this.otherParams) === null || _this$otherParams33 === void 0 ? void 0 : _this$otherParams33.shop_wallet_pass_id;
|
|
4550
4804
|
if (!(!Number.isFinite(actualPaidAmount) || actualPaidAmount + 0.01 < amount)) {
|
|
4551
4805
|
_context49.next = 26;
|
|
4552
4806
|
break;
|
|
@@ -4635,7 +4889,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4635
4889
|
}
|
|
4636
4890
|
}, _callee49, this, [[29, 43]]);
|
|
4637
4891
|
}));
|
|
4638
|
-
function payCash(
|
|
4892
|
+
function payCash(_x41) {
|
|
4639
4893
|
return _payCash.apply(this, arguments);
|
|
4640
4894
|
}
|
|
4641
4895
|
return payCash;
|
|
@@ -4797,7 +5051,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4797
5051
|
}
|
|
4798
5052
|
}, _callee50, this, [[30, 44]]);
|
|
4799
5053
|
}));
|
|
4800
|
-
function commitPaymentMethodPayment(
|
|
5054
|
+
function commitPaymentMethodPayment(_x42) {
|
|
4801
5055
|
return _commitPaymentMethodPayment.apply(this, arguments);
|
|
4802
5056
|
}
|
|
4803
5057
|
return commitPaymentMethodPayment;
|
|
@@ -4845,7 +5099,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4845
5099
|
}
|
|
4846
5100
|
}, _callee51, this);
|
|
4847
5101
|
}));
|
|
4848
|
-
function roundAmount(
|
|
5102
|
+
function roundAmount(_x43) {
|
|
4849
5103
|
return _roundAmount.apply(this, arguments);
|
|
4850
5104
|
}
|
|
4851
5105
|
return roundAmount;
|
|
@@ -4861,7 +5115,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4861
5115
|
key: "sendCustomerPayLink",
|
|
4862
5116
|
value: (function () {
|
|
4863
5117
|
var _sendCustomerPayLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee52(params) {
|
|
4864
|
-
var orderIds,
|
|
5118
|
+
var orderIds, _ref41, _ref42, _submitResult$data$or, _submitResult$data, _submitResult$data2, submitResult, orderId;
|
|
4865
5119
|
return _regeneratorRuntime().wrap(function _callee52$(_context52) {
|
|
4866
5120
|
while (1) switch (_context52.prev = _context52.next) {
|
|
4867
5121
|
case 0:
|
|
@@ -4882,7 +5136,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4882
5136
|
});
|
|
4883
5137
|
case 6:
|
|
4884
5138
|
submitResult = _context52.sent;
|
|
4885
|
-
orderId = (
|
|
5139
|
+
orderId = (_ref41 = (_ref42 = (_submitResult$data$or = submitResult === null || submitResult === void 0 || (_submitResult$data = submitResult.data) === null || _submitResult$data === void 0 ? void 0 : _submitResult$data.order_id) !== null && _submitResult$data$or !== void 0 ? _submitResult$data$or : submitResult === null || submitResult === void 0 ? void 0 : submitResult.order_id) !== null && _ref42 !== void 0 ? _ref42 : submitResult === null || submitResult === void 0 || (_submitResult$data2 = submitResult.data) === null || _submitResult$data2 === void 0 ? void 0 : _submitResult$data2.id) !== null && _ref41 !== void 0 ? _ref41 : submitResult === null || submitResult === void 0 ? void 0 : submitResult.id;
|
|
4886
5140
|
if (orderId) {
|
|
4887
5141
|
_context52.next = 10;
|
|
4888
5142
|
break;
|
|
@@ -4902,7 +5156,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4902
5156
|
}
|
|
4903
5157
|
}, _callee52, this);
|
|
4904
5158
|
}));
|
|
4905
|
-
function sendCustomerPayLink(
|
|
5159
|
+
function sendCustomerPayLink(_x44) {
|
|
4906
5160
|
return _sendCustomerPayLink.apply(this, arguments);
|
|
4907
5161
|
}
|
|
4908
5162
|
return sendCustomerPayLink;
|
|
@@ -4917,40 +5171,52 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4917
5171
|
value: function () {
|
|
4918
5172
|
var _calculateProductBookingPrice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee53(params) {
|
|
4919
5173
|
var _params$customer_id;
|
|
4920
|
-
var quotation, customerId, authoritativeProduct, product;
|
|
5174
|
+
var useCustomerUserPricing, quotation, customerId, _yield$this$resolvePr, _yield$this$resolvePr2, authoritativeProduct, product;
|
|
4921
5175
|
return _regeneratorRuntime().wrap(function _callee53$(_context53) {
|
|
4922
5176
|
while (1) switch (_context53.prev = _context53.next) {
|
|
4923
5177
|
case 0:
|
|
4924
|
-
|
|
5178
|
+
useCustomerUserPricing = this.isCustomerUserPriceQuery();
|
|
5179
|
+
quotation = useCustomerUserPricing ? undefined : this.store.quotation;
|
|
4925
5180
|
customerId = (_params$customer_id = params.customer_id) !== null && _params$customer_id !== void 0 ? _params$customer_id : this.getCurrentOrderCustomerId();
|
|
4926
|
-
_context53.next =
|
|
5181
|
+
_context53.next = 5;
|
|
4927
5182
|
return this.prepareProductPriceQueryContext(customerId);
|
|
4928
|
-
case
|
|
4929
|
-
_context53.next =
|
|
4930
|
-
return this.
|
|
4931
|
-
|
|
4932
|
-
|
|
5183
|
+
case 5:
|
|
5184
|
+
_context53.next = 7;
|
|
5185
|
+
return this.resolveProductsForPriceQuery({
|
|
5186
|
+
priceQueries: [params],
|
|
5187
|
+
schedule: this.getPriceQuerySchedule(params),
|
|
5188
|
+
customerId: customerId,
|
|
5189
|
+
channel: params.channel
|
|
5190
|
+
});
|
|
5191
|
+
case 7:
|
|
5192
|
+
_yield$this$resolvePr = _context53.sent;
|
|
5193
|
+
_yield$this$resolvePr2 = _slicedToArray(_yield$this$resolvePr, 1);
|
|
5194
|
+
authoritativeProduct = _yield$this$resolvePr2[0];
|
|
4933
5195
|
product = this.mergeProductForPriceQuery(params.product, authoritativeProduct);
|
|
4934
|
-
|
|
5196
|
+
if (useCustomerUserPricing) {
|
|
5197
|
+
_context53.next = 14;
|
|
5198
|
+
break;
|
|
5199
|
+
}
|
|
5200
|
+
_context53.next = 14;
|
|
4935
5201
|
return this.loadQuotationForPriceQuery({
|
|
4936
5202
|
quotation: quotation,
|
|
4937
5203
|
customer_id: customerId,
|
|
4938
5204
|
channel: params.channel
|
|
4939
5205
|
});
|
|
4940
|
-
case
|
|
5206
|
+
case 14:
|
|
4941
5207
|
return _context53.abrupt("return", calculateBaseSalesProductBookingPrice(_objectSpread(_objectSpread({}, params), {}, {
|
|
4942
5208
|
product: product,
|
|
4943
5209
|
fallback_price: authoritativeProduct ? undefined : params.fallback_price,
|
|
4944
5210
|
customer_id: customerId,
|
|
4945
5211
|
quotation: authoritativeProduct && this.preferAuthoritativeProductQueryPrice() ? undefined : quotation
|
|
4946
5212
|
})));
|
|
4947
|
-
case
|
|
5213
|
+
case 15:
|
|
4948
5214
|
case "end":
|
|
4949
5215
|
return _context53.stop();
|
|
4950
5216
|
}
|
|
4951
5217
|
}, _callee53, this);
|
|
4952
5218
|
}));
|
|
4953
|
-
function calculateProductBookingPrice(
|
|
5219
|
+
function calculateProductBookingPrice(_x45) {
|
|
4954
5220
|
return _calculateProductBookingPrice.apply(this, arguments);
|
|
4955
5221
|
}
|
|
4956
5222
|
return calculateProductBookingPrice;
|
|
@@ -4958,7 +5224,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4958
5224
|
}, {
|
|
4959
5225
|
key: "getQuotationCustomerScopeInfo",
|
|
4960
5226
|
value: function getQuotationCustomerScopeInfo() {
|
|
4961
|
-
var
|
|
5227
|
+
var _this17 = this;
|
|
4962
5228
|
var quotation = this.store.quotation;
|
|
4963
5229
|
if (quotation && typeof quotation.getQuotationCustomerScopeInfo === 'function') {
|
|
4964
5230
|
return quotation.getQuotationCustomerScopeInfo();
|
|
@@ -4970,7 +5236,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4970
5236
|
}).map(function (item) {
|
|
4971
5237
|
var localSeen = new Set();
|
|
4972
5238
|
var customers = item.customer.filter(function (customer) {
|
|
4973
|
-
var customerId =
|
|
5239
|
+
var customerId = _this17.normalizePriceContextCustomerId(customer === null || customer === void 0 ? void 0 : customer.id);
|
|
4974
5240
|
if (!customerId || localSeen.has(customerId)) return false;
|
|
4975
5241
|
localSeen.add(customerId);
|
|
4976
5242
|
if (!customerById.has(customerId)) customerById.set(customerId, customer);
|
|
@@ -4997,8 +5263,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4997
5263
|
}, {
|
|
4998
5264
|
key: "hasSmartPricingStrategies",
|
|
4999
5265
|
value: function hasSmartPricingStrategies() {
|
|
5000
|
-
var _this$
|
|
5001
|
-
var evaluator = (_this$
|
|
5266
|
+
var _this$core4;
|
|
5267
|
+
var evaluator = (_this$core4 = this.core) === null || _this$core4 === void 0 || (_this$core4 = _this$core4.context) === null || _this$core4 === void 0 ? void 0 : _this$core4.dataVariantEvaluator;
|
|
5002
5268
|
if (!evaluator || typeof evaluator.getStrategyConfigs !== 'function') {
|
|
5003
5269
|
return false;
|
|
5004
5270
|
}
|
|
@@ -5008,15 +5274,15 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5008
5274
|
}, {
|
|
5009
5275
|
key: "shouldRecalculateProductBookingPricesForContextChange",
|
|
5010
5276
|
value: function shouldRecalculateProductBookingPricesForContextChange(params) {
|
|
5011
|
-
var scopeInfo = this.getQuotationCustomerScopeInfo();
|
|
5012
|
-
var scopedCustomerIds = new Set(scopeInfo.customerIds.map(function (id) {
|
|
5013
|
-
return String(id);
|
|
5014
|
-
}));
|
|
5015
5277
|
var previousCustomerId = this.normalizePriceContextCustomerId(params.previousCustomerId);
|
|
5016
5278
|
var nextCustomerId = this.normalizePriceContextCustomerId(params.nextCustomerId);
|
|
5017
|
-
if (this.hasSmartPricingStrategies()) {
|
|
5279
|
+
if (this.isCustomerUserPriceQuery() || this.hasSmartPricingStrategies()) {
|
|
5018
5280
|
return previousCustomerId !== nextCustomerId;
|
|
5019
5281
|
}
|
|
5282
|
+
var scopeInfo = this.getQuotationCustomerScopeInfo();
|
|
5283
|
+
var scopedCustomerIds = new Set(scopeInfo.customerIds.map(function (id) {
|
|
5284
|
+
return String(id);
|
|
5285
|
+
}));
|
|
5020
5286
|
var previousInScope = previousCustomerId ? scopedCustomerIds.has(previousCustomerId) : false;
|
|
5021
5287
|
var nextInScope = nextCustomerId ? scopedCustomerIds.has(nextCustomerId) : false;
|
|
5022
5288
|
var shouldRecalculate = false;
|
|
@@ -5035,11 +5301,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5035
5301
|
key: "calculateProductBookingPrices",
|
|
5036
5302
|
value: function () {
|
|
5037
5303
|
var _calculateProductBookingPrices = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee55(paramsList) {
|
|
5038
|
-
var
|
|
5039
|
-
|
|
5040
|
-
_this16 = this,
|
|
5041
|
-
_paramsList$2;
|
|
5042
|
-
var quotation, customerId, productMapsByGroup, groups;
|
|
5304
|
+
var _this18 = this;
|
|
5305
|
+
var useCustomerUserPricing, quotation, currentOrderCustomerId, authoritativeProducts, groups, _paramsList$0$custome, _paramsList$, _paramsList$2;
|
|
5043
5306
|
return _regeneratorRuntime().wrap(function _callee55$(_context55) {
|
|
5044
5307
|
while (1) switch (_context55.prev = _context55.next) {
|
|
5045
5308
|
case 0:
|
|
@@ -5049,79 +5312,86 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5049
5312
|
}
|
|
5050
5313
|
return _context55.abrupt("return", []);
|
|
5051
5314
|
case 2:
|
|
5052
|
-
|
|
5053
|
-
|
|
5054
|
-
|
|
5055
|
-
|
|
5056
|
-
|
|
5057
|
-
|
|
5315
|
+
useCustomerUserPricing = this.isCustomerUserPriceQuery();
|
|
5316
|
+
quotation = useCustomerUserPricing ? undefined : this.store.quotation;
|
|
5317
|
+
currentOrderCustomerId = this.getCurrentOrderCustomerId();
|
|
5318
|
+
authoritativeProducts = paramsList.map(function () {
|
|
5319
|
+
return null;
|
|
5320
|
+
});
|
|
5058
5321
|
groups = new Map();
|
|
5059
|
-
paramsList.forEach(function (params) {
|
|
5060
|
-
var
|
|
5061
|
-
var
|
|
5062
|
-
var
|
|
5063
|
-
|
|
5064
|
-
var
|
|
5065
|
-
var channel = params.channel || ((_this16$otherParams = _this16.otherParams) === null || _this16$otherParams === void 0 ? void 0 : _this16$otherParams.channel);
|
|
5066
|
-
var groupKey = [schedule.schedule_date, schedule.schedule_datetime, channel || ''].join('|');
|
|
5322
|
+
paramsList.forEach(function (params, index) {
|
|
5323
|
+
var _params$customer_id2;
|
|
5324
|
+
var schedule = _this18.getPriceQuerySchedule(params);
|
|
5325
|
+
var channel = _this18.getPriceQueryChannel(params.channel);
|
|
5326
|
+
var customerId = (_params$customer_id2 = params.customer_id) !== null && _params$customer_id2 !== void 0 ? _params$customer_id2 : currentOrderCustomerId;
|
|
5327
|
+
var groupKey = [schedule.schedule_date, schedule.schedule_datetime, channel || '', _this18.normalizePriceContextCustomerId(customerId) || ''].join('|');
|
|
5067
5328
|
var group = groups.get(groupKey) || {
|
|
5068
|
-
|
|
5329
|
+
indices: [],
|
|
5069
5330
|
schedule: schedule,
|
|
5331
|
+
customerId: customerId,
|
|
5070
5332
|
channel: channel
|
|
5071
5333
|
};
|
|
5072
|
-
group.
|
|
5334
|
+
group.indices.push(index);
|
|
5073
5335
|
groups.set(groupKey, group);
|
|
5074
5336
|
});
|
|
5075
|
-
_context55.next =
|
|
5076
|
-
return Promise.all(Array.from(groups.
|
|
5077
|
-
var
|
|
5078
|
-
var
|
|
5337
|
+
_context55.next = 10;
|
|
5338
|
+
return Promise.all(Array.from(groups.values()).map( /*#__PURE__*/function () {
|
|
5339
|
+
var _ref43 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee54(group) {
|
|
5340
|
+
var priceQueries, resolvedProducts;
|
|
5079
5341
|
return _regeneratorRuntime().wrap(function _callee54$(_context54) {
|
|
5080
5342
|
while (1) switch (_context54.prev = _context54.next) {
|
|
5081
5343
|
case 0:
|
|
5082
|
-
|
|
5083
|
-
|
|
5084
|
-
|
|
5085
|
-
|
|
5344
|
+
_context54.next = 2;
|
|
5345
|
+
return _this18.prepareProductPriceQueryContext(group.customerId);
|
|
5346
|
+
case 2:
|
|
5347
|
+
priceQueries = group.indices.map(function (index) {
|
|
5348
|
+
return paramsList[index];
|
|
5349
|
+
});
|
|
5350
|
+
_context54.next = 5;
|
|
5351
|
+
return _this18.resolveProductsForPriceQuery({
|
|
5352
|
+
priceQueries: priceQueries,
|
|
5086
5353
|
schedule: group.schedule,
|
|
5087
|
-
customerId: customerId,
|
|
5354
|
+
customerId: group.customerId,
|
|
5088
5355
|
channel: group.channel
|
|
5089
5356
|
});
|
|
5090
|
-
case 3:
|
|
5091
|
-
productsById = _context54.sent;
|
|
5092
|
-
productMapsByGroup.set(groupKey, productsById);
|
|
5093
5357
|
case 5:
|
|
5358
|
+
resolvedProducts = _context54.sent;
|
|
5359
|
+
group.indices.forEach(function (originalIndex, groupIndex) {
|
|
5360
|
+
authoritativeProducts[originalIndex] = resolvedProducts[groupIndex] || null;
|
|
5361
|
+
});
|
|
5362
|
+
case 7:
|
|
5094
5363
|
case "end":
|
|
5095
5364
|
return _context54.stop();
|
|
5096
5365
|
}
|
|
5097
5366
|
}, _callee54);
|
|
5098
5367
|
}));
|
|
5099
|
-
return function (
|
|
5100
|
-
return
|
|
5368
|
+
return function (_x47) {
|
|
5369
|
+
return _ref43.apply(this, arguments);
|
|
5101
5370
|
};
|
|
5102
5371
|
}()));
|
|
5103
|
-
case
|
|
5372
|
+
case 10:
|
|
5373
|
+
if (useCustomerUserPricing) {
|
|
5374
|
+
_context55.next = 13;
|
|
5375
|
+
break;
|
|
5376
|
+
}
|
|
5104
5377
|
_context55.next = 13;
|
|
5105
5378
|
return this.loadQuotationForPriceQuery({
|
|
5106
5379
|
quotation: quotation,
|
|
5107
|
-
customer_id:
|
|
5380
|
+
customer_id: (_paramsList$0$custome = (_paramsList$ = paramsList[0]) === null || _paramsList$ === void 0 ? void 0 : _paramsList$.customer_id) !== null && _paramsList$0$custome !== void 0 ? _paramsList$0$custome : currentOrderCustomerId,
|
|
5108
5381
|
channel: (_paramsList$2 = paramsList[0]) === null || _paramsList$2 === void 0 ? void 0 : _paramsList$2.channel
|
|
5109
5382
|
});
|
|
5110
5383
|
case 13:
|
|
5111
|
-
return _context55.abrupt("return", paramsList.map(function (params) {
|
|
5112
|
-
var
|
|
5384
|
+
return _context55.abrupt("return", paramsList.map(function (params, index) {
|
|
5385
|
+
var _params$customer_id3;
|
|
5113
5386
|
var productInput = params.product || {};
|
|
5114
|
-
var
|
|
5115
|
-
var
|
|
5116
|
-
var
|
|
5117
|
-
var groupKey = [schedule.schedule_date, schedule.schedule_datetime, channel || ''].join('|');
|
|
5118
|
-
var authoritativeProduct = productId === null ? null : ((_productMapsByGroup$g = productMapsByGroup.get(groupKey)) === null || _productMapsByGroup$g === void 0 ? void 0 : _productMapsByGroup$g.get(productId)) || null;
|
|
5119
|
-
var product = _this16.mergeProductForPriceQuery(productInput, authoritativeProduct);
|
|
5387
|
+
var authoritativeProduct = authoritativeProducts[index];
|
|
5388
|
+
var product = _this18.mergeProductForPriceQuery(productInput, authoritativeProduct);
|
|
5389
|
+
var customerId = (_params$customer_id3 = params.customer_id) !== null && _params$customer_id3 !== void 0 ? _params$customer_id3 : currentOrderCustomerId;
|
|
5120
5390
|
return calculateBaseSalesProductBookingPrice(_objectSpread(_objectSpread({}, params), {}, {
|
|
5121
5391
|
product: product,
|
|
5122
5392
|
fallback_price: authoritativeProduct ? undefined : params.fallback_price,
|
|
5123
5393
|
customer_id: customerId,
|
|
5124
|
-
quotation: authoritativeProduct &&
|
|
5394
|
+
quotation: authoritativeProduct && _this18.preferAuthoritativeProductQueryPrice() ? undefined : quotation
|
|
5125
5395
|
}));
|
|
5126
5396
|
}));
|
|
5127
5397
|
case 14:
|
|
@@ -5130,7 +5400,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5130
5400
|
}
|
|
5131
5401
|
}, _callee55, this);
|
|
5132
5402
|
}));
|
|
5133
|
-
function calculateProductBookingPrices(
|
|
5403
|
+
function calculateProductBookingPrices(_x46) {
|
|
5134
5404
|
return _calculateProductBookingPrices.apply(this, arguments);
|
|
5135
5405
|
}
|
|
5136
5406
|
return calculateProductBookingPrices;
|
|
@@ -5165,7 +5435,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5165
5435
|
}
|
|
5166
5436
|
}, _callee56, this, [[0, 9]]);
|
|
5167
5437
|
}));
|
|
5168
|
-
function addProductToOrder(_x49, _x50
|
|
5438
|
+
function addProductToOrder(_x48, _x49, _x50) {
|
|
5169
5439
|
return _addProductToOrder.apply(this, arguments);
|
|
5170
5440
|
}
|
|
5171
5441
|
return addProductToOrder;
|
|
@@ -5200,7 +5470,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5200
5470
|
}
|
|
5201
5471
|
}, _callee57, this, [[0, 9]]);
|
|
5202
5472
|
}));
|
|
5203
|
-
function updateOrderProduct(
|
|
5473
|
+
function updateOrderProduct(_x51) {
|
|
5204
5474
|
return _updateOrderProduct.apply(this, arguments);
|
|
5205
5475
|
}
|
|
5206
5476
|
return updateOrderProduct;
|
|
@@ -5235,7 +5505,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5235
5505
|
}
|
|
5236
5506
|
}, _callee58, this, [[0, 9]]);
|
|
5237
5507
|
}));
|
|
5238
|
-
function updateOrderProducts(
|
|
5508
|
+
function updateOrderProducts(_x52) {
|
|
5239
5509
|
return _updateOrderProducts.apply(this, arguments);
|
|
5240
5510
|
}
|
|
5241
5511
|
return updateOrderProducts;
|
|
@@ -5270,7 +5540,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5270
5540
|
}
|
|
5271
5541
|
}, _callee59, this, [[0, 9]]);
|
|
5272
5542
|
}));
|
|
5273
|
-
function updateOrderProductQuantity(
|
|
5543
|
+
function updateOrderProductQuantity(_x53) {
|
|
5274
5544
|
return _updateOrderProductQuantity.apply(this, arguments);
|
|
5275
5545
|
}
|
|
5276
5546
|
return updateOrderProductQuantity;
|
|
@@ -5328,7 +5598,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5328
5598
|
}
|
|
5329
5599
|
}, _callee60, this, [[0, 11]]);
|
|
5330
5600
|
}));
|
|
5331
|
-
function setOrderProductLineNote(
|
|
5601
|
+
function setOrderProductLineNote(_x54, _x55) {
|
|
5332
5602
|
return _setOrderProductLineNote.apply(this, arguments);
|
|
5333
5603
|
}
|
|
5334
5604
|
return setOrderProductLineNote;
|
|
@@ -5368,7 +5638,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5368
5638
|
}
|
|
5369
5639
|
}, _callee61, this, [[0, 8]]);
|
|
5370
5640
|
}));
|
|
5371
|
-
function removeProductsFromOrder(
|
|
5641
|
+
function removeProductsFromOrder(_x56, _x57) {
|
|
5372
5642
|
return _removeProductsFromOrder.apply(this, arguments);
|
|
5373
5643
|
}
|
|
5374
5644
|
return removeProductsFromOrder;
|
|
@@ -5387,7 +5657,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5387
5657
|
}
|
|
5388
5658
|
}, _callee62, this);
|
|
5389
5659
|
}));
|
|
5390
|
-
function removeProductFromOrder(
|
|
5660
|
+
function removeProductFromOrder(_x58, _x59) {
|
|
5391
5661
|
return _removeProductFromOrder.apply(this, arguments);
|
|
5392
5662
|
}
|
|
5393
5663
|
return removeProductFromOrder;
|
|
@@ -5481,13 +5751,13 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5481
5751
|
key: "getProductList",
|
|
5482
5752
|
value: function () {
|
|
5483
5753
|
var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee64() {
|
|
5484
|
-
var _this$
|
|
5754
|
+
var _this$otherParams34;
|
|
5485
5755
|
var menu_list_ids, _this$store$products, res;
|
|
5486
5756
|
return _regeneratorRuntime().wrap(function _callee64$(_context64) {
|
|
5487
5757
|
while (1) switch (_context64.prev = _context64.next) {
|
|
5488
5758
|
case 0:
|
|
5489
5759
|
// 可以直接通过配置里的 menu 读取
|
|
5490
|
-
menu_list_ids = ((_this$
|
|
5760
|
+
menu_list_ids = ((_this$otherParams34 = this.otherParams) === null || _this$otherParams34 === void 0 || (_this$otherParams34 = _this$otherParams34.dineInConfig) === null || _this$otherParams34 === void 0 ? void 0 : _this$otherParams34['menu.associated_menus'].map(function (n) {
|
|
5491
5761
|
return Number(n.value);
|
|
5492
5762
|
})) || [];
|
|
5493
5763
|
_context64.prev = 1;
|
|
@@ -5525,21 +5795,21 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5525
5795
|
key: "setOtherParams",
|
|
5526
5796
|
value: function () {
|
|
5527
5797
|
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee65(params) {
|
|
5528
|
-
var _this$
|
|
5529
|
-
var
|
|
5530
|
-
|
|
5798
|
+
var _this$otherParams35;
|
|
5799
|
+
var _ref44,
|
|
5800
|
+
_ref44$cover,
|
|
5531
5801
|
cover,
|
|
5532
5802
|
_args65 = arguments;
|
|
5533
5803
|
return _regeneratorRuntime().wrap(function _callee65$(_context65) {
|
|
5534
5804
|
while (1) switch (_context65.prev = _context65.next) {
|
|
5535
5805
|
case 0:
|
|
5536
|
-
|
|
5806
|
+
_ref44 = _args65.length > 1 && _args65[1] !== undefined ? _args65[1] : {}, _ref44$cover = _ref44.cover, cover = _ref44$cover === void 0 ? false : _ref44$cover;
|
|
5537
5807
|
if (cover) {
|
|
5538
5808
|
this.otherParams = _objectSpread({}, params);
|
|
5539
5809
|
} else {
|
|
5540
5810
|
this.otherParams = _objectSpread(_objectSpread({}, this.otherParams), params);
|
|
5541
5811
|
}
|
|
5542
|
-
this.cacheId = (_this$
|
|
5812
|
+
this.cacheId = (_this$otherParams35 = this.otherParams) === null || _this$otherParams35 === void 0 ? void 0 : _this$otherParams35.cacheId;
|
|
5543
5813
|
_context65.next = 5;
|
|
5544
5814
|
return this.syncOtherParamsToSubModules(params, {
|
|
5545
5815
|
cover: cover
|
|
@@ -5550,7 +5820,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5550
5820
|
}
|
|
5551
5821
|
}, _callee65, this);
|
|
5552
5822
|
}));
|
|
5553
|
-
function setOtherParams(
|
|
5823
|
+
function setOtherParams(_x60) {
|
|
5554
5824
|
return _setOtherParams.apply(this, arguments);
|
|
5555
5825
|
}
|
|
5556
5826
|
return setOtherParams;
|