@pisell/pisellos 2.3.81 → 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/model/strategy/adapter/promotion/index.js +0 -9
- package/dist/modules/ProductList/clientDataVariants.d.ts +23 -0
- package/dist/modules/ProductList/clientDataVariants.js +165 -11
- package/dist/modules/ProductList/index.d.ts +14 -0
- package/dist/modules/ProductList/index.js +78 -11
- package/dist/solution/BaseSales/index.d.ts +16 -1
- package/dist/solution/BaseSales/index.js +531 -273
- 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 +23 -0
- package/lib/modules/ProductList/clientDataVariants.js +147 -11
- package/lib/modules/ProductList/index.d.ts +14 -0
- package/lib/modules/ProductList/index.js +59 -1
- package/lib/solution/BaseSales/index.d.ts +16 -1
- package/lib/solution/BaseSales/index.js +258 -66
- 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,7 +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 } from "../../modules/ProductList/clientDataVariants";
|
|
45
|
+
import { isProductQueryHandledByOsServer, PRODUCT_QUERY_DATA_VARIANT_RELATIONS, resolveClientDataVariants, tryResolveClientDataVariants } from "../../modules/ProductList/clientDataVariants";
|
|
46
|
+
import { isCustomerUserPlatform } from "../../utils/platform";
|
|
46
47
|
import { QuotationModule } from "../../modules/Quotation";
|
|
47
48
|
import { transformBaseProductToOrderProduct as _transformBaseProductToOrderProduct } from "./utils/transformBaseProductToOrderProduct";
|
|
48
49
|
import { calculateBaseSalesProductBookingPrice } from "./utils/quotationPrice";
|
|
@@ -992,11 +993,167 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
992
993
|
schedule_datetime: now.format('YYYY-MM-DD HH:mm:ss')
|
|
993
994
|
};
|
|
994
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
|
+
}
|
|
995
1152
|
}, {
|
|
996
1153
|
key: "loadProductsForPriceQuery",
|
|
997
1154
|
value: function () {
|
|
998
1155
|
var _loadProductsForPriceQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(params) {
|
|
999
|
-
var ids, productsById,
|
|
1156
|
+
var ids, productsById, handledByOsServer, _response$data, queryPayload, response, list, scheduleList, resolvedList;
|
|
1000
1157
|
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
1001
1158
|
while (1) switch (_context8.prev = _context8.next) {
|
|
1002
1159
|
case 0:
|
|
@@ -1010,66 +1167,66 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1010
1167
|
}
|
|
1011
1168
|
return _context8.abrupt("return", productsById);
|
|
1012
1169
|
case 4:
|
|
1013
|
-
channel = this.getPriceQueryChannel(params.channel);
|
|
1014
|
-
strategyContext = this.getPriceQueryStrategyContext(channel);
|
|
1015
1170
|
handledByOsServer = isProductQueryHandledByOsServer(this.core, this.request);
|
|
1016
|
-
_context8.prev =
|
|
1017
|
-
queryPayload = _objectSpread({
|
|
1018
|
-
ids: ids
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
with: _toConsumableArray(PRODUCT_QUERY_DATA_VARIANT_RELATIONS),
|
|
1022
|
-
status: 'published',
|
|
1023
|
-
num: Math.max(ids.length, 1),
|
|
1024
|
-
skip: 1,
|
|
1025
|
-
customer_id: params.customerId,
|
|
1026
|
-
schedule_date: params.schedule.schedule_date,
|
|
1027
|
-
schedule_datetime: params.schedule.schedule_datetime,
|
|
1028
|
-
application_code: channel
|
|
1029
|
-
}, Object.keys(strategyContext).length ? {
|
|
1030
|
-
strategy_context: strategyContext
|
|
1031
|
-
} : {});
|
|
1032
|
-
_context8.next = 11;
|
|
1171
|
+
_context8.prev = 5;
|
|
1172
|
+
queryPayload = this.buildPriceQueryPayload(_objectSpread(_objectSpread({}, params), {}, {
|
|
1173
|
+
ids: ids
|
|
1174
|
+
}));
|
|
1175
|
+
_context8.next = 9;
|
|
1033
1176
|
return this.request.post('/product/query', queryPayload, {
|
|
1034
1177
|
osServer: true,
|
|
1035
1178
|
customToast: function customToast() {}
|
|
1036
1179
|
});
|
|
1037
|
-
case
|
|
1180
|
+
case 9:
|
|
1038
1181
|
response = _context8.sent;
|
|
1039
1182
|
list = (response === null || response === void 0 || (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.list) || (response === null || response === void 0 ? void 0 : response.list) || [];
|
|
1040
1183
|
if (Array.isArray(list)) {
|
|
1041
|
-
_context8.next =
|
|
1184
|
+
_context8.next = 13;
|
|
1042
1185
|
break;
|
|
1043
1186
|
}
|
|
1044
1187
|
return _context8.abrupt("return", productsById);
|
|
1045
|
-
case
|
|
1046
|
-
|
|
1188
|
+
case 13:
|
|
1189
|
+
if (!(this.isCustomerUserPriceQuery() && !handledByOsServer)) {
|
|
1190
|
+
_context8.next = 17;
|
|
1191
|
+
break;
|
|
1192
|
+
}
|
|
1193
|
+
this.rememberRawProductPriceSources(list);
|
|
1194
|
+
list.forEach(function (item) {
|
|
1195
|
+
var _item$id;
|
|
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);
|
|
1197
|
+
if (Number.isFinite(productId)) productsById.set(productId, item);
|
|
1198
|
+
});
|
|
1199
|
+
return _context8.abrupt("return", productsById);
|
|
1200
|
+
case 17:
|
|
1201
|
+
scheduleList = this.getPriceQueryScheduleList();
|
|
1202
|
+
resolvedList = resolveClientDataVariants(_objectSpread({
|
|
1047
1203
|
core: this.core,
|
|
1048
1204
|
otherParams: this.otherParams,
|
|
1049
1205
|
products: list,
|
|
1050
1206
|
queryPayload: queryPayload,
|
|
1051
|
-
handledByOsServer: handledByOsServer
|
|
1052
|
-
|
|
1053
|
-
|
|
1207
|
+
handledByOsServer: handledByOsServer
|
|
1208
|
+
}, scheduleList ? {
|
|
1209
|
+
scheduleList: scheduleList
|
|
1210
|
+
} : {}));
|
|
1054
1211
|
resolvedList.forEach(function (item) {
|
|
1055
|
-
var _item$
|
|
1056
|
-
var productId = Number((_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);
|
|
1057
1214
|
if (Number.isFinite(productId)) productsById.set(productId, item);
|
|
1058
1215
|
});
|
|
1059
1216
|
return _context8.abrupt("return", productsById);
|
|
1060
|
-
case
|
|
1061
|
-
_context8.prev =
|
|
1062
|
-
_context8.t0 = _context8["catch"](
|
|
1217
|
+
case 23:
|
|
1218
|
+
_context8.prev = 23;
|
|
1219
|
+
_context8.t0 = _context8["catch"](5);
|
|
1063
1220
|
this.logWarning('loadProductsForPriceQuery: 商品批量重查失败,使用入参 fallback', {
|
|
1064
1221
|
ids: ids,
|
|
1065
1222
|
error: _context8.t0 instanceof Error ? _context8.t0.message : String(_context8.t0)
|
|
1066
1223
|
});
|
|
1067
1224
|
return _context8.abrupt("return", productsById);
|
|
1068
|
-
case
|
|
1225
|
+
case 27:
|
|
1069
1226
|
case "end":
|
|
1070
1227
|
return _context8.stop();
|
|
1071
1228
|
}
|
|
1072
|
-
}, _callee8, this, [[
|
|
1229
|
+
}, _callee8, this, [[5, 23]]);
|
|
1073
1230
|
}));
|
|
1074
1231
|
function loadProductsForPriceQuery(_x7) {
|
|
1075
1232
|
return _loadProductsForPriceQuery.apply(this, arguments);
|
|
@@ -1077,42 +1234,127 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1077
1234
|
return loadProductsForPriceQuery;
|
|
1078
1235
|
}()
|
|
1079
1236
|
}, {
|
|
1080
|
-
key: "
|
|
1237
|
+
key: "resolveProductsForPriceQuery",
|
|
1081
1238
|
value: function () {
|
|
1082
|
-
var
|
|
1083
|
-
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;
|
|
1084
1242
|
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
1085
1243
|
while (1) switch (_context9.prev = _context9.next) {
|
|
1086
1244
|
case 0:
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
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;
|
|
1091
1256
|
break;
|
|
1092
1257
|
}
|
|
1093
|
-
return _context9.abrupt("return",
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
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;
|
|
1097
1277
|
return this.loadProductsForPriceQuery({
|
|
1098
|
-
ids:
|
|
1099
|
-
schedule: schedule,
|
|
1100
|
-
customerId: customerId,
|
|
1278
|
+
ids: ids,
|
|
1279
|
+
schedule: params.schedule,
|
|
1280
|
+
customerId: params.customerId,
|
|
1101
1281
|
channel: params.channel
|
|
1102
1282
|
});
|
|
1103
|
-
case
|
|
1283
|
+
case 12:
|
|
1104
1284
|
productsById = _context9.sent;
|
|
1105
|
-
return _context9.abrupt("return",
|
|
1106
|
-
|
|
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:
|
|
1107
1349
|
case "end":
|
|
1108
1350
|
return _context9.stop();
|
|
1109
1351
|
}
|
|
1110
1352
|
}, _callee9, this);
|
|
1111
1353
|
}));
|
|
1112
|
-
function
|
|
1113
|
-
return
|
|
1354
|
+
function resolveProductsForPriceQuery(_x8) {
|
|
1355
|
+
return _resolveProductsForPriceQuery.apply(this, arguments);
|
|
1114
1356
|
}
|
|
1115
|
-
return
|
|
1357
|
+
return resolveProductsForPriceQuery;
|
|
1116
1358
|
}()
|
|
1117
1359
|
}, {
|
|
1118
1360
|
key: "getAuthoritativeBundleItems",
|
|
@@ -1122,10 +1364,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1122
1364
|
return groups.flatMap(function (group) {
|
|
1123
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 : [];
|
|
1124
1366
|
return items.map(function (item) {
|
|
1125
|
-
var _item$group_id,
|
|
1367
|
+
var _item$group_id, _ref19, _item$bundle_group_id;
|
|
1126
1368
|
return _objectSpread(_objectSpread({}, item), {}, {
|
|
1127
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,
|
|
1128
|
-
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
|
|
1129
1371
|
});
|
|
1130
1372
|
});
|
|
1131
1373
|
});
|
|
@@ -1156,44 +1398,44 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1156
1398
|
}, {
|
|
1157
1399
|
key: "getAuthoritativeBundleUnitPrice",
|
|
1158
1400
|
value: function getAuthoritativeBundleUnitPrice(bundle) {
|
|
1159
|
-
var
|
|
1160
|
-
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;
|
|
1161
1403
|
}
|
|
1162
1404
|
}, {
|
|
1163
1405
|
key: "mergeProductForPriceQuery",
|
|
1164
1406
|
value: function mergeProductForPriceQuery(product, authoritativeProduct) {
|
|
1165
|
-
var
|
|
1407
|
+
var _this7 = this,
|
|
1166
1408
|
_product$id,
|
|
1167
|
-
|
|
1168
|
-
_product$
|
|
1169
|
-
|
|
1170
|
-
_product$
|
|
1171
|
-
|
|
1409
|
+
_ref23,
|
|
1410
|
+
_product$product_id3,
|
|
1411
|
+
_ref24,
|
|
1412
|
+
_product$product_vari2,
|
|
1413
|
+
_ref25,
|
|
1172
1414
|
_product$num,
|
|
1173
|
-
|
|
1415
|
+
_ref26,
|
|
1174
1416
|
_product$quantity,
|
|
1175
1417
|
_product$metadata4;
|
|
1176
1418
|
if (!authoritativeProduct) return product;
|
|
1177
1419
|
var selectedBundles = Array.isArray(product.product_bundle) ? product.product_bundle : [];
|
|
1178
1420
|
var authoritativeBundles = this.getAuthoritativeBundleItems(authoritativeProduct);
|
|
1179
1421
|
var productBundle = selectedBundles.map(function (bundle) {
|
|
1180
|
-
var _authoritativeBundle
|
|
1181
|
-
var authoritativeBundle =
|
|
1182
|
-
var unitPrice = authoritativeBundle ?
|
|
1422
|
+
var _authoritativeBundle$2, _authoritativeBundle$3;
|
|
1423
|
+
var authoritativeBundle = _this7.findAuthoritativeBundleItem(bundle, authoritativeBundles);
|
|
1424
|
+
var unitPrice = authoritativeBundle ? _this7.getAuthoritativeBundleUnitPrice(authoritativeBundle) : undefined;
|
|
1183
1425
|
if (unitPrice === undefined || unitPrice === null || unitPrice === '') return bundle;
|
|
1184
1426
|
return _objectSpread(_objectSpread({}, bundle), {}, {
|
|
1185
1427
|
price: unitPrice,
|
|
1186
1428
|
bundle_selling_price: unitPrice,
|
|
1187
|
-
base_price: (_authoritativeBundle$ = authoritativeBundle === null || authoritativeBundle === void 0 ? void 0 : authoritativeBundle.base_price) !== null && _authoritativeBundle$ !== void 0 ? _authoritativeBundle$ : bundle.base_price,
|
|
1188
|
-
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
|
|
1189
1431
|
});
|
|
1190
1432
|
});
|
|
1191
1433
|
return _objectSpread(_objectSpread(_objectSpread({}, product), authoritativeProduct), {}, {
|
|
1192
1434
|
id: (_product$id = product.id) !== null && _product$id !== void 0 ? _product$id : authoritativeProduct.id,
|
|
1193
|
-
product_id: (
|
|
1194
|
-
product_variant_id: (
|
|
1195
|
-
num: (
|
|
1196
|
-
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,
|
|
1197
1439
|
product_sku: function () {
|
|
1198
1440
|
var authoritativeSku = ensureProductSku(authoritativeProduct);
|
|
1199
1441
|
var productSku = ensureProductSku(product);
|
|
@@ -1209,8 +1451,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1209
1451
|
}, {
|
|
1210
1452
|
key: "getSubmitOrderSalesChannel",
|
|
1211
1453
|
value: function getSubmitOrderSalesChannel() {
|
|
1212
|
-
var _this$
|
|
1213
|
-
return (_this$
|
|
1454
|
+
var _this$otherParams9;
|
|
1455
|
+
return (_this$otherParams9 = this.otherParams) === null || _this$otherParams9 === void 0 ? void 0 : _this$otherParams9.channel;
|
|
1214
1456
|
}
|
|
1215
1457
|
|
|
1216
1458
|
/**
|
|
@@ -1278,24 +1520,24 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1278
1520
|
key: "syncOtherParamsToSubModules",
|
|
1279
1521
|
value: (function () {
|
|
1280
1522
|
var _syncOtherParamsToSubModules = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(changedParams) {
|
|
1281
|
-
var
|
|
1282
|
-
var
|
|
1283
|
-
|
|
1523
|
+
var _this8 = this;
|
|
1524
|
+
var _ref27,
|
|
1525
|
+
_ref27$cover,
|
|
1284
1526
|
cover,
|
|
1285
1527
|
_args11 = arguments;
|
|
1286
1528
|
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
1287
1529
|
while (1) switch (_context11.prev = _context11.next) {
|
|
1288
1530
|
case 0:
|
|
1289
|
-
|
|
1531
|
+
_ref27 = _args11.length > 1 && _args11[1] !== undefined ? _args11[1] : {}, _ref27$cover = _ref27.cover, cover = _ref27$cover === void 0 ? false : _ref27$cover;
|
|
1290
1532
|
_context11.next = 3;
|
|
1291
1533
|
return Promise.all(Object.entries(this.store).map( /*#__PURE__*/function () {
|
|
1292
|
-
var
|
|
1293
|
-
var
|
|
1534
|
+
var _ref29 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(_ref28) {
|
|
1535
|
+
var _ref30, moduleName, subModule, targetModule, nextSubModuleOtherParams;
|
|
1294
1536
|
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
1295
1537
|
while (1) switch (_context10.prev = _context10.next) {
|
|
1296
1538
|
case 0:
|
|
1297
|
-
|
|
1298
|
-
if (!
|
|
1539
|
+
_ref30 = _slicedToArray(_ref28, 2), moduleName = _ref30[0], subModule = _ref30[1];
|
|
1540
|
+
if (!_this8.reusedSharedSubModuleNames.has(moduleName)) {
|
|
1299
1541
|
_context10.next = 3;
|
|
1300
1542
|
break;
|
|
1301
1543
|
}
|
|
@@ -1308,7 +1550,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1308
1550
|
}
|
|
1309
1551
|
return _context10.abrupt("return");
|
|
1310
1552
|
case 6:
|
|
1311
|
-
nextSubModuleOtherParams =
|
|
1553
|
+
nextSubModuleOtherParams = _this8.buildSubModuleOtherParams(moduleName);
|
|
1312
1554
|
_context10.next = 9;
|
|
1313
1555
|
return targetModule.updateOtherParams(nextSubModuleOtherParams, {
|
|
1314
1556
|
changedParams: changedParams,
|
|
@@ -1320,8 +1562,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1320
1562
|
}
|
|
1321
1563
|
}, _callee10);
|
|
1322
1564
|
}));
|
|
1323
|
-
return function (
|
|
1324
|
-
return
|
|
1565
|
+
return function (_x10) {
|
|
1566
|
+
return _ref29.apply(this, arguments);
|
|
1325
1567
|
};
|
|
1326
1568
|
}()));
|
|
1327
1569
|
case 3:
|
|
@@ -1330,7 +1572,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1330
1572
|
}
|
|
1331
1573
|
}, _callee11, this);
|
|
1332
1574
|
}));
|
|
1333
|
-
function syncOtherParamsToSubModules(
|
|
1575
|
+
function syncOtherParamsToSubModules(_x9) {
|
|
1334
1576
|
return _syncOtherParamsToSubModules.apply(this, arguments);
|
|
1335
1577
|
}
|
|
1336
1578
|
return syncOtherParamsToSubModules;
|
|
@@ -1380,22 +1622,22 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1380
1622
|
}, {
|
|
1381
1623
|
key: "getPaymentNumberDevicePrefixSync",
|
|
1382
1624
|
value: function getPaymentNumberDevicePrefixSync() {
|
|
1383
|
-
var
|
|
1625
|
+
var _this9 = this;
|
|
1384
1626
|
if (!this.appPlugin) return 'LOCAL';
|
|
1385
1627
|
return resolvePaymentNumberDevicePrefixFromDeviceId(function (key) {
|
|
1386
|
-
return
|
|
1628
|
+
return _this9.getAppData(key);
|
|
1387
1629
|
});
|
|
1388
1630
|
}
|
|
1389
1631
|
}, {
|
|
1390
1632
|
key: "getPaymentNumberDevicePrefixAsync",
|
|
1391
1633
|
value: function getPaymentNumberDevicePrefixAsync() {
|
|
1392
|
-
var
|
|
1634
|
+
var _this10 = this;
|
|
1393
1635
|
if (!this.appPlugin) return Promise.resolve('LOCAL');
|
|
1394
1636
|
if (this.paymentNumberDevicePrefix) {
|
|
1395
1637
|
return Promise.resolve(this.paymentNumberDevicePrefix);
|
|
1396
1638
|
}
|
|
1397
1639
|
return resolvePaymentNumberDevicePrefix(function (key) {
|
|
1398
|
-
return
|
|
1640
|
+
return _this10.getAppData(key);
|
|
1399
1641
|
});
|
|
1400
1642
|
}
|
|
1401
1643
|
}, {
|
|
@@ -1440,11 +1682,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1440
1682
|
key: "initialize",
|
|
1441
1683
|
value: function () {
|
|
1442
1684
|
var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(core) {
|
|
1443
|
-
var _this$
|
|
1685
|
+
var _this$otherParams10,
|
|
1444
1686
|
_this$appPlugin2,
|
|
1445
1687
|
_this$appPlugin2$getA,
|
|
1446
|
-
|
|
1447
|
-
_this$
|
|
1688
|
+
_this11 = this,
|
|
1689
|
+
_this$otherParams11;
|
|
1448
1690
|
var options,
|
|
1449
1691
|
app,
|
|
1450
1692
|
targetCacheData,
|
|
@@ -1459,7 +1701,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1459
1701
|
this.paymentNumberDevicePrefix = null;
|
|
1460
1702
|
// this.store = { ...this.store, ...(options.store as Partial<BaseSalesState>) };
|
|
1461
1703
|
this.otherParams = options.otherParams || {};
|
|
1462
|
-
this.cacheId = (_this$
|
|
1704
|
+
this.cacheId = (_this$otherParams10 = this.otherParams) === null || _this$otherParams10 === void 0 ? void 0 : _this$otherParams10.cacheId;
|
|
1463
1705
|
this.reusedSharedSubModuleNames.clear();
|
|
1464
1706
|
this.window = core.getPlugin('window');
|
|
1465
1707
|
this.request = core.getPlugin('request');
|
|
@@ -1474,24 +1716,24 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1474
1716
|
targetCacheData = this.readSessionCacheData();
|
|
1475
1717
|
moduleNames = this.getRegisteredModuleNames();
|
|
1476
1718
|
moduleNames.forEach(function (step) {
|
|
1477
|
-
var reusedModule =
|
|
1719
|
+
var reusedModule = _this11.getReusableSharedSubModule(step);
|
|
1478
1720
|
if (reusedModule) {
|
|
1479
|
-
|
|
1480
|
-
|
|
1721
|
+
_this11.store[step] = reusedModule;
|
|
1722
|
+
_this11.reusedSharedSubModuleNames.add(step);
|
|
1481
1723
|
return;
|
|
1482
1724
|
}
|
|
1483
|
-
var targetModule =
|
|
1725
|
+
var targetModule = _this11.createSubModule(step);
|
|
1484
1726
|
if (!targetModule) {
|
|
1485
1727
|
throw new Error("\u6A21\u5757 ".concat(step, " \u4E0D\u5B58\u5728"));
|
|
1486
1728
|
}
|
|
1487
|
-
var hooks =
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
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]) || {} : {}
|
|
1491
1733
|
}, hooks ? {
|
|
1492
1734
|
hooks: hooks
|
|
1493
1735
|
} : {}), {}, {
|
|
1494
|
-
otherParams:
|
|
1736
|
+
otherParams: _this11.buildSubModuleOtherParams(step)
|
|
1495
1737
|
}));
|
|
1496
1738
|
});
|
|
1497
1739
|
if (!(this.store.schedule && !this.isScheduleListLoaded(this.store.schedule))) {
|
|
@@ -1501,7 +1743,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1501
1743
|
_context12.next = 19;
|
|
1502
1744
|
return this.store.schedule.loadAllSchedule();
|
|
1503
1745
|
case 19:
|
|
1504
|
-
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') {
|
|
1505
1747
|
this.store.order.setEnableTempOrderPersist(this.otherParams.enableTempOrderPersist);
|
|
1506
1748
|
}
|
|
1507
1749
|
_context12.next = 22;
|
|
@@ -1515,7 +1757,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1515
1757
|
}
|
|
1516
1758
|
}, _callee12, this);
|
|
1517
1759
|
}));
|
|
1518
|
-
function initialize(
|
|
1760
|
+
function initialize(_x11) {
|
|
1519
1761
|
return _initialize.apply(this, arguments);
|
|
1520
1762
|
}
|
|
1521
1763
|
return initialize;
|
|
@@ -1525,15 +1767,15 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1525
1767
|
value: function () {
|
|
1526
1768
|
var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
|
|
1527
1769
|
var _this$serverOrderChan2,
|
|
1528
|
-
|
|
1770
|
+
_this12 = this;
|
|
1529
1771
|
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
1530
1772
|
while (1) switch (_context13.prev = _context13.next) {
|
|
1531
1773
|
case 0:
|
|
1532
1774
|
(_this$serverOrderChan2 = this.serverOrderChangeUnsubscribe) === null || _this$serverOrderChan2 === void 0 || _this$serverOrderChan2.call(this);
|
|
1533
1775
|
this.serverOrderChangeUnsubscribe = null;
|
|
1534
1776
|
Object.keys(this.store).forEach(function (key) {
|
|
1535
|
-
if (
|
|
1536
|
-
var sub =
|
|
1777
|
+
if (_this12.reusedSharedSubModuleNames.has(key)) return;
|
|
1778
|
+
var sub = _this12.store[key];
|
|
1537
1779
|
if (sub && typeof sub.destroy === 'function') {
|
|
1538
1780
|
try {
|
|
1539
1781
|
sub.destroy();
|
|
@@ -1573,7 +1815,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1573
1815
|
key: "loadSalesDetail",
|
|
1574
1816
|
value: (function () {
|
|
1575
1817
|
var _loadSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(orderIdOrParams) {
|
|
1576
|
-
var loadSequence,
|
|
1818
|
+
var loadSequence, _ref31, _ref32, _ref33, _ref34, _params$orderId, params, externalSaleNumber, preloadedSalesDetail, lookup, loadedRecord, message, loadedSalesDetail, shouldFilterPendingPayments, remoteRecord, mergeSourceRecord, currentTempOrder, mergedRecord, record;
|
|
1577
1819
|
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
1578
1820
|
while (1) switch (_context14.prev = _context14.next) {
|
|
1579
1821
|
case 0:
|
|
@@ -1591,7 +1833,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1591
1833
|
};
|
|
1592
1834
|
externalSaleNumber = params.externalSaleNumber || params.external_sale_number;
|
|
1593
1835
|
preloadedSalesDetail = params.preloadedSalesDetail;
|
|
1594
|
-
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;
|
|
1595
1837
|
if (!(!preloadedSalesDetail && (lookup === undefined || lookup === null || lookup === ''))) {
|
|
1596
1838
|
_context14.next = 11;
|
|
1597
1839
|
break;
|
|
@@ -1663,7 +1905,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1663
1905
|
}
|
|
1664
1906
|
}, _callee14, this, [[4,, 32, 44], [35, 40]]);
|
|
1665
1907
|
}));
|
|
1666
|
-
function loadSalesDetail(
|
|
1908
|
+
function loadSalesDetail(_x12) {
|
|
1667
1909
|
return _loadSalesDetail.apply(this, arguments);
|
|
1668
1910
|
}
|
|
1669
1911
|
return loadSalesDetail;
|
|
@@ -1770,7 +2012,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1770
2012
|
}
|
|
1771
2013
|
}, _callee15, this);
|
|
1772
2014
|
}));
|
|
1773
|
-
function replaceTempOrder(
|
|
2015
|
+
function replaceTempOrder(_x13, _x14) {
|
|
1774
2016
|
return _replaceTempOrder.apply(this, arguments);
|
|
1775
2017
|
}
|
|
1776
2018
|
return replaceTempOrder;
|
|
@@ -2099,10 +2341,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2099
2341
|
}, {
|
|
2100
2342
|
key: "getHistoricalProductDiscountList",
|
|
2101
2343
|
value: function getHistoricalProductDiscountList(products) {
|
|
2102
|
-
var
|
|
2344
|
+
var _this13 = this;
|
|
2103
2345
|
var historyDiscountList = [];
|
|
2104
2346
|
products.forEach(function (item) {
|
|
2105
|
-
if (!
|
|
2347
|
+
if (!_this13.isPersistedOrderProduct(item)) return;
|
|
2106
2348
|
(item.discount_list || []).forEach(function (discount) {
|
|
2107
2349
|
var _discount$discount, _discount$metadata, _discount$discount2, _discount$discount3, _discount$discount4;
|
|
2108
2350
|
var discountId = ((_discount$discount = discount.discount) === null || _discount$discount === void 0 ? void 0 : _discount$discount.resource_id) || discount.id;
|
|
@@ -2162,11 +2404,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2162
2404
|
}, {
|
|
2163
2405
|
key: "shouldSkipAutoApplyFetchedDiscountsInEditMode",
|
|
2164
2406
|
value: function shouldSkipAutoApplyFetchedDiscountsInEditMode(params) {
|
|
2165
|
-
var
|
|
2407
|
+
var _this14 = this;
|
|
2166
2408
|
if (params.discountAction !== 'edit') return false;
|
|
2167
2409
|
if (!params.products.length) return false;
|
|
2168
2410
|
var hasDraftProduct = params.products.some(function (product) {
|
|
2169
|
-
return !
|
|
2411
|
+
return !_this14.isPersistedOrderProduct(product);
|
|
2170
2412
|
});
|
|
2171
2413
|
if (hasDraftProduct) return false;
|
|
2172
2414
|
|
|
@@ -2420,7 +2662,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2420
2662
|
}
|
|
2421
2663
|
}, _callee21, this, [[45, 64, 67, 70]]);
|
|
2422
2664
|
}));
|
|
2423
|
-
function loadDiscountConfig(
|
|
2665
|
+
function loadDiscountConfig(_x15) {
|
|
2424
2666
|
return _loadDiscountConfig.apply(this, arguments);
|
|
2425
2667
|
}
|
|
2426
2668
|
return loadDiscountConfig;
|
|
@@ -2517,7 +2759,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2517
2759
|
}
|
|
2518
2760
|
}, _callee22, this);
|
|
2519
2761
|
}));
|
|
2520
|
-
function bestDiscount(
|
|
2762
|
+
function bestDiscount(_x16) {
|
|
2521
2763
|
return _bestDiscount.apply(this, arguments);
|
|
2522
2764
|
}
|
|
2523
2765
|
return bestDiscount;
|
|
@@ -2580,7 +2822,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2580
2822
|
}
|
|
2581
2823
|
}, _callee23, this);
|
|
2582
2824
|
}));
|
|
2583
|
-
function replaceDiscountStoreLists(
|
|
2825
|
+
function replaceDiscountStoreLists(_x17) {
|
|
2584
2826
|
return _replaceDiscountStoreLists.apply(this, arguments);
|
|
2585
2827
|
}
|
|
2586
2828
|
return replaceDiscountStoreLists;
|
|
@@ -2642,7 +2884,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2642
2884
|
}
|
|
2643
2885
|
}, _callee24, this, [[0, 16]]);
|
|
2644
2886
|
}));
|
|
2645
|
-
function scanPromotionCode(
|
|
2887
|
+
function scanPromotionCode(_x18, _x19) {
|
|
2646
2888
|
return _scanPromotionCode.apply(this, arguments);
|
|
2647
2889
|
}
|
|
2648
2890
|
return scanPromotionCode;
|
|
@@ -2756,10 +2998,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2756
2998
|
product.discount_list = filterSelectedDiscountDetails(product.discount_list);
|
|
2757
2999
|
if (Array.isArray(product.product_bundle)) {
|
|
2758
3000
|
product.product_bundle = product.product_bundle.map(function (bundle) {
|
|
2759
|
-
var
|
|
3001
|
+
var _ref35, _bundle$original_pric;
|
|
2760
3002
|
var nextBundleDiscountList = filterSelectedDiscountDetails(bundle === null || bundle === void 0 ? void 0 : bundle.discount_list);
|
|
2761
3003
|
var shouldRestoreBundlePrice = nextBundleDiscountList.length === 0;
|
|
2762
|
-
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;
|
|
2763
3005
|
return _objectSpread(_objectSpread(_objectSpread({}, bundle), shouldRestoreBundlePrice ? {
|
|
2764
3006
|
price: restoredBundlePrice,
|
|
2765
3007
|
bundle_selling_price: restoredBundlePrice
|
|
@@ -2832,7 +3074,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2832
3074
|
}
|
|
2833
3075
|
}, _callee25, this, [[0, 54], [17, 38, 41, 44]]);
|
|
2834
3076
|
}));
|
|
2835
|
-
function setDiscountSelected(
|
|
3077
|
+
function setDiscountSelected(_x20) {
|
|
2836
3078
|
return _setDiscountSelected.apply(this, arguments);
|
|
2837
3079
|
}
|
|
2838
3080
|
return setDiscountSelected;
|
|
@@ -2902,7 +3144,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2902
3144
|
}
|
|
2903
3145
|
}, _callee26, this, [[0, 21]]);
|
|
2904
3146
|
}));
|
|
2905
|
-
function applyDiscountCalculationResult(
|
|
3147
|
+
function applyDiscountCalculationResult(_x21) {
|
|
2906
3148
|
return _applyDiscountCalculationResult.apply(this, arguments);
|
|
2907
3149
|
}
|
|
2908
3150
|
return applyDiscountCalculationResult;
|
|
@@ -2921,7 +3163,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2921
3163
|
}
|
|
2922
3164
|
}, _callee27, this);
|
|
2923
3165
|
}));
|
|
2924
|
-
function submitScanOrder(
|
|
3166
|
+
function submitScanOrder(_x22) {
|
|
2925
3167
|
return _submitScanOrder.apply(this, arguments);
|
|
2926
3168
|
}
|
|
2927
3169
|
return submitScanOrder;
|
|
@@ -2936,7 +3178,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2936
3178
|
key: "submitSalesOrder",
|
|
2937
3179
|
value: (function () {
|
|
2938
3180
|
var _submitSalesOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(params) {
|
|
2939
|
-
var _params$smallTicketDa, _this$
|
|
3181
|
+
var _params$smallTicketDa, _this$otherParams12, _this$otherParams13, _this$otherParams14, _this$otherParams15;
|
|
2940
3182
|
var inferredPaymentStatus, smallTicketDataFlag, submitParams;
|
|
2941
3183
|
return _regeneratorRuntime().wrap(function _callee28$(_context28) {
|
|
2942
3184
|
while (1) switch (_context28.prev = _context28.next) {
|
|
@@ -2952,10 +3194,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2952
3194
|
smallTicketDataFlag = (_params$smallTicketDa = params === null || params === void 0 ? void 0 : params.smallTicketDataFlag) !== null && _params$smallTicketDa !== void 0 ? _params$smallTicketDa : this.getDefaultCheckoutSmallTicketDataFlag();
|
|
2953
3195
|
submitParams = _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
2954
3196
|
cacheId: this.cacheId,
|
|
2955
|
-
platform: (_this$
|
|
2956
|
-
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),
|
|
2957
3199
|
channel: this.getSubmitOrderSalesChannel(),
|
|
2958
|
-
type: (_this$
|
|
3200
|
+
type: (_this$otherParams15 = this.otherParams) === null || _this$otherParams15 === void 0 ? void 0 : _this$otherParams15.type,
|
|
2959
3201
|
request_unique_idempotency_token: this.store.order.generateIdempotencyToken()
|
|
2960
3202
|
}, (params === null || params === void 0 ? void 0 : params.payments) !== undefined ? {
|
|
2961
3203
|
payments: params.payments
|
|
@@ -2975,7 +3217,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2975
3217
|
}
|
|
2976
3218
|
}, _callee28, this);
|
|
2977
3219
|
}));
|
|
2978
|
-
function submitSalesOrder(
|
|
3220
|
+
function submitSalesOrder(_x23) {
|
|
2979
3221
|
return _submitSalesOrder.apply(this, arguments);
|
|
2980
3222
|
}
|
|
2981
3223
|
return submitSalesOrder;
|
|
@@ -2984,7 +3226,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2984
3226
|
key: "saveSalesOrderDraft",
|
|
2985
3227
|
value: function () {
|
|
2986
3228
|
var _saveSalesOrderDraft = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(params) {
|
|
2987
|
-
var _params$platform, _this$
|
|
3229
|
+
var _params$platform, _this$otherParams16, _this$otherParams17, _this$otherParams18, _params$channel, _params$type, _this$otherParams19;
|
|
2988
3230
|
return _regeneratorRuntime().wrap(function _callee29$(_context29) {
|
|
2989
3231
|
while (1) switch (_context29.prev = _context29.next) {
|
|
2990
3232
|
case 0:
|
|
@@ -2996,10 +3238,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2996
3238
|
case 2:
|
|
2997
3239
|
return _context29.abrupt("return", this.store.order.saveTempOrderAsDraft(_objectSpread({
|
|
2998
3240
|
cacheId: this.cacheId,
|
|
2999
|
-
platform: (_params$platform = params === null || params === void 0 ? void 0 : params.platform) !== null && _params$platform !== void 0 ? _params$platform : (_this$
|
|
3000
|
-
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),
|
|
3001
3243
|
channel: (_params$channel = params === null || params === void 0 ? void 0 : params.channel) !== null && _params$channel !== void 0 ? _params$channel : this.getSubmitOrderSalesChannel(),
|
|
3002
|
-
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
|
|
3003
3245
|
}, (params === null || params === void 0 ? void 0 : params.enhancePayload) !== undefined ? {
|
|
3004
3246
|
enhancePayload: params.enhancePayload
|
|
3005
3247
|
} : {})));
|
|
@@ -3009,7 +3251,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3009
3251
|
}
|
|
3010
3252
|
}, _callee29, this);
|
|
3011
3253
|
}));
|
|
3012
|
-
function saveSalesOrderDraft(
|
|
3254
|
+
function saveSalesOrderDraft(_x24) {
|
|
3013
3255
|
return _saveSalesOrderDraft.apply(this, arguments);
|
|
3014
3256
|
}
|
|
3015
3257
|
return saveSalesOrderDraft;
|
|
@@ -3018,7 +3260,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3018
3260
|
key: "submitTempOrderAsync",
|
|
3019
3261
|
value: function () {
|
|
3020
3262
|
var _submitTempOrderAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(params) {
|
|
3021
|
-
var _params$smallTicketDa2, _this$
|
|
3263
|
+
var _params$smallTicketDa2, _this$otherParams20, _this$otherParams21, _this$otherParams22, _this$otherParams23;
|
|
3022
3264
|
var inferredPaymentStatus, smallTicketDataFlag, submitParams;
|
|
3023
3265
|
return _regeneratorRuntime().wrap(function _callee30$(_context30) {
|
|
3024
3266
|
while (1) switch (_context30.prev = _context30.next) {
|
|
@@ -3033,10 +3275,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3033
3275
|
smallTicketDataFlag = (_params$smallTicketDa2 = params === null || params === void 0 ? void 0 : params.smallTicketDataFlag) !== null && _params$smallTicketDa2 !== void 0 ? _params$smallTicketDa2 : this.getDefaultCheckoutSmallTicketDataFlag();
|
|
3034
3276
|
submitParams = _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
3035
3277
|
cacheId: this.cacheId,
|
|
3036
|
-
platform: (_this$
|
|
3037
|
-
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),
|
|
3038
3280
|
channel: this.getSubmitOrderSalesChannel(),
|
|
3039
|
-
type: (_this$
|
|
3281
|
+
type: (_this$otherParams23 = this.otherParams) === null || _this$otherParams23 === void 0 ? void 0 : _this$otherParams23.type,
|
|
3040
3282
|
request_unique_idempotency_token: this.store.order.generateIdempotencyToken()
|
|
3041
3283
|
}, (params === null || params === void 0 ? void 0 : params.payments) !== undefined ? {
|
|
3042
3284
|
payments: params.payments
|
|
@@ -3056,7 +3298,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3056
3298
|
}
|
|
3057
3299
|
}, _callee30, this);
|
|
3058
3300
|
}));
|
|
3059
|
-
function submitTempOrderAsync(
|
|
3301
|
+
function submitTempOrderAsync(_x25) {
|
|
3060
3302
|
return _submitTempOrderAsync.apply(this, arguments);
|
|
3061
3303
|
}
|
|
3062
3304
|
return submitTempOrderAsync;
|
|
@@ -3068,8 +3310,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3068
3310
|
}, {
|
|
3069
3311
|
key: "shouldUseCheckoutSyncTask",
|
|
3070
3312
|
value: function shouldUseCheckoutSyncTask() {
|
|
3071
|
-
var _this$
|
|
3072
|
-
var configured = (_this$
|
|
3313
|
+
var _this$otherParams24;
|
|
3314
|
+
var configured = (_this$otherParams24 = this.otherParams) === null || _this$otherParams24 === void 0 ? void 0 : _this$otherParams24.checkoutSyncTaskEnabled;
|
|
3073
3315
|
return typeof configured === 'boolean' ? configured : true;
|
|
3074
3316
|
}
|
|
3075
3317
|
|
|
@@ -3083,7 +3325,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3083
3325
|
key: "printLocalOrderReceipt",
|
|
3084
3326
|
value: function () {
|
|
3085
3327
|
var _printLocalOrderReceipt = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(lookup) {
|
|
3086
|
-
var _this$
|
|
3328
|
+
var _this$otherParams25, _this$otherParams26, _this$otherParams27, _this$otherParams28;
|
|
3087
3329
|
var hasLookup, lookupPayload, context, payload, response, _this$store$order$app, _this$store$order5, _data;
|
|
3088
3330
|
return _regeneratorRuntime().wrap(function _callee31$(_context31) {
|
|
3089
3331
|
while (1) switch (_context31.prev = _context31.next) {
|
|
@@ -3101,10 +3343,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3101
3343
|
external_sale_number: lookup
|
|
3102
3344
|
};
|
|
3103
3345
|
context = {
|
|
3104
|
-
platform: (_this$
|
|
3105
|
-
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),
|
|
3106
3348
|
channel: this.getSubmitOrderSalesChannel(),
|
|
3107
|
-
type: (_this$
|
|
3349
|
+
type: (_this$otherParams28 = this.otherParams) === null || _this$otherParams28 === void 0 ? void 0 : _this$otherParams28.type
|
|
3108
3350
|
};
|
|
3109
3351
|
payload = hasLookup ? _objectSpread(_objectSpread({}, lookupPayload), {}, {
|
|
3110
3352
|
lookup_order_from_db: 1,
|
|
@@ -3141,7 +3383,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3141
3383
|
}
|
|
3142
3384
|
}, _callee31, this);
|
|
3143
3385
|
}));
|
|
3144
|
-
function printLocalOrderReceipt(
|
|
3386
|
+
function printLocalOrderReceipt(_x26) {
|
|
3145
3387
|
return _printLocalOrderReceipt.apply(this, arguments);
|
|
3146
3388
|
}
|
|
3147
3389
|
return printLocalOrderReceipt;
|
|
@@ -3163,7 +3405,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3163
3405
|
key: "syncPaymentsToOrder",
|
|
3164
3406
|
value: function () {
|
|
3165
3407
|
var _syncPaymentsToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(params) {
|
|
3166
|
-
var
|
|
3408
|
+
var _ref36, _params$businessCode, _this$otherParams29, _this$otherParams30, _params$channel2;
|
|
3167
3409
|
var businessCode, channel, syncParams, syncState, payments, syncResult, latestPayments, amountSnapshot, orderSnapshot, syncPayload;
|
|
3168
3410
|
return _regeneratorRuntime().wrap(function _callee32$(_context32) {
|
|
3169
3411
|
while (1) switch (_context32.prev = _context32.next) {
|
|
@@ -3174,7 +3416,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3174
3416
|
}
|
|
3175
3417
|
throw new Error('order 模块未初始化');
|
|
3176
3418
|
case 2:
|
|
3177
|
-
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;
|
|
3178
3420
|
channel = (_params$channel2 = params.channel) !== null && _params$channel2 !== void 0 ? _params$channel2 : this.getSubmitOrderSalesChannel();
|
|
3179
3421
|
syncParams = _objectSpread(_objectSpread(_objectSpread({}, params), {}, {
|
|
3180
3422
|
checkoutSyncTaskEnabled: this.shouldUseCheckoutSyncTask()
|
|
@@ -3255,7 +3497,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3255
3497
|
}
|
|
3256
3498
|
}, _callee32, this, [[12, 29]]);
|
|
3257
3499
|
}));
|
|
3258
|
-
function syncPaymentsToOrder(
|
|
3500
|
+
function syncPaymentsToOrder(_x27) {
|
|
3259
3501
|
return _syncPaymentsToOrder.apply(this, arguments);
|
|
3260
3502
|
}
|
|
3261
3503
|
return syncPaymentsToOrder;
|
|
@@ -3292,13 +3534,13 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3292
3534
|
}, {
|
|
3293
3535
|
key: "scheduleQueuedAutoPaymentSyncFlush",
|
|
3294
3536
|
value: function scheduleQueuedAutoPaymentSyncFlush() {
|
|
3295
|
-
var
|
|
3537
|
+
var _this15 = this;
|
|
3296
3538
|
var delay = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 100;
|
|
3297
3539
|
if (!this.queuedAutoPaymentSync) return;
|
|
3298
3540
|
if (this.autoPaymentSyncTimer) return;
|
|
3299
3541
|
this.autoPaymentSyncTimer = setTimeout(function () {
|
|
3300
|
-
|
|
3301
|
-
void
|
|
3542
|
+
_this15.autoPaymentSyncTimer = null;
|
|
3543
|
+
void _this15.flushQueuedAutoPaymentSync();
|
|
3302
3544
|
}, delay);
|
|
3303
3545
|
}
|
|
3304
3546
|
}, {
|
|
@@ -3425,7 +3667,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3425
3667
|
}
|
|
3426
3668
|
}, _callee34, this);
|
|
3427
3669
|
}));
|
|
3428
|
-
function addOrderPaymentAsync(
|
|
3670
|
+
function addOrderPaymentAsync(_x28) {
|
|
3429
3671
|
return _addOrderPaymentAsync.apply(this, arguments);
|
|
3430
3672
|
}
|
|
3431
3673
|
return addOrderPaymentAsync;
|
|
@@ -3433,12 +3675,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3433
3675
|
}, {
|
|
3434
3676
|
key: "addOrderPaymentWithDevicePrefix",
|
|
3435
3677
|
value: function addOrderPaymentWithDevicePrefix(payment, devicePrefix) {
|
|
3436
|
-
var _this$
|
|
3678
|
+
var _this$otherParams31,
|
|
3437
3679
|
_paymentRecord$paymen,
|
|
3438
3680
|
_paymentRecord$create,
|
|
3439
|
-
|
|
3681
|
+
_ref37,
|
|
3440
3682
|
_paymentRecord$origin,
|
|
3441
|
-
|
|
3683
|
+
_this16 = this;
|
|
3442
3684
|
if (!this.store.order) throw new Error('order 模块未初始化');
|
|
3443
3685
|
var paymentRecord = payment;
|
|
3444
3686
|
var paymentAmount = new Decimal(paymentRecord.amount || 0);
|
|
@@ -3449,7 +3691,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3449
3691
|
return this.store.order.getOrderPayments();
|
|
3450
3692
|
}
|
|
3451
3693
|
var metadata = paymentRecord.metadata && _typeof(paymentRecord.metadata) === 'object' ? _objectSpread({}, paymentRecord.metadata) : {};
|
|
3452
|
-
var shopWalletPassId = (_this$
|
|
3694
|
+
var shopWalletPassId = (_this$otherParams31 = this.otherParams) === null || _this$otherParams31 === void 0 ? void 0 : _this$otherParams31.shop_wallet_pass_id;
|
|
3453
3695
|
if (shopWalletPassId !== undefined && shopWalletPassId !== null) {
|
|
3454
3696
|
metadata.shop_wallet_pass_id = shopWalletPassId;
|
|
3455
3697
|
}
|
|
@@ -3458,7 +3700,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3458
3700
|
var paymentTime = (_paymentRecord$paymen = paymentRecord.payment_time) !== null && _paymentRecord$paymen !== void 0 ? _paymentRecord$paymen : paymentTimestamp;
|
|
3459
3701
|
var createdAt = (_paymentRecord$create = paymentRecord.created_at) !== null && _paymentRecord$create !== void 0 ? _paymentRecord$create : paymentTimestamp;
|
|
3460
3702
|
var serviceCharge = paymentRecord.service_charge && _typeof(paymentRecord.service_charge) === 'object' ? paymentRecord.service_charge : null;
|
|
3461
|
-
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;
|
|
3462
3704
|
var payments = this.store.order.addOrderPayment(_objectSpread(_objectSpread(_objectSpread({}, normalizedPaymentRecord), calculatedServiceFee !== undefined ? {
|
|
3463
3705
|
service_fee: calculatedServiceFee
|
|
3464
3706
|
} : {}), {}, {
|
|
@@ -3482,7 +3724,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3482
3724
|
submitWhenPaid: true,
|
|
3483
3725
|
smallTicketDataFlag: 1
|
|
3484
3726
|
}).catch(function (error) {
|
|
3485
|
-
|
|
3727
|
+
_this16.logError('auto sync payments failed', {
|
|
3486
3728
|
error: error instanceof Error ? error.message : String(error)
|
|
3487
3729
|
});
|
|
3488
3730
|
});
|
|
@@ -3613,7 +3855,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3613
3855
|
}
|
|
3614
3856
|
}, _callee35, this, [[17, 23]]);
|
|
3615
3857
|
}));
|
|
3616
|
-
function updateOrderPayment(
|
|
3858
|
+
function updateOrderPayment(_x29, _x30) {
|
|
3617
3859
|
return _updateOrderPayment.apply(this, arguments);
|
|
3618
3860
|
}
|
|
3619
3861
|
return updateOrderPayment;
|
|
@@ -3652,7 +3894,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3652
3894
|
}
|
|
3653
3895
|
}, _callee36, this);
|
|
3654
3896
|
}));
|
|
3655
|
-
function updateVoucherOrderPaymentsAsync(
|
|
3897
|
+
function updateVoucherOrderPaymentsAsync(_x31, _x32) {
|
|
3656
3898
|
return _updateVoucherOrderPaymentsAsync.apply(this, arguments);
|
|
3657
3899
|
}
|
|
3658
3900
|
return updateVoucherOrderPaymentsAsync;
|
|
@@ -3686,14 +3928,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3686
3928
|
// const products = tempOrder?.products?.filter(n => n.product_id)
|
|
3687
3929
|
|
|
3688
3930
|
var walletProducts = tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.products.map(function (product) {
|
|
3689
|
-
var _product$holder_id, _product$
|
|
3931
|
+
var _product$holder_id, _product$product_vari3, _product$is_charge_ta, _metadata$main_produc, _metadata$main_produc2;
|
|
3690
3932
|
var metadata = product.metadata || {};
|
|
3691
3933
|
var rawHolderId = (_product$holder_id = product.holder_id) !== null && _product$holder_id !== void 0 ? _product$holder_id : metadata.holder_id;
|
|
3692
3934
|
var holderIdValue = Array.isArray(rawHolderId) ? rawHolderId[0] : rawHolderId;
|
|
3693
3935
|
var holder_id = Number.isInteger(Number(holderIdValue)) ? Number(holderIdValue) : undefined;
|
|
3694
3936
|
return {
|
|
3695
3937
|
product_id: product.product_id || 0,
|
|
3696
|
-
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 : ''),
|
|
3697
3939
|
quantity: product.num || 1,
|
|
3698
3940
|
is_price_include_tax: tempOrder.is_price_include_tax,
|
|
3699
3941
|
is_charge_tax: (_product$is_charge_ta = product.is_charge_tax) !== null && _product$is_charge_ta !== void 0 ? _product$is_charge_ta : 0,
|
|
@@ -3739,7 +3981,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3739
3981
|
}, {
|
|
3740
3982
|
key: "buildWalletInitBusinessData",
|
|
3741
3983
|
value: function buildWalletInitBusinessData(params) {
|
|
3742
|
-
var _this$store$order8, _params$order_wait_pa,
|
|
3984
|
+
var _this$store$order8, _params$order_wait_pa, _ref38, _tempOrder$is_price_i;
|
|
3743
3985
|
var snapshot = (_this$store$order8 = this.store.order) === null || _this$store$order8 === void 0 ? void 0 : _this$store$order8.getOrderSnapshot();
|
|
3744
3986
|
var tempOrder = snapshot === null || snapshot === void 0 ? void 0 : snapshot.tempOrder;
|
|
3745
3987
|
var amount = snapshot === null || snapshot === void 0 ? void 0 : snapshot.amount;
|
|
@@ -3755,7 +3997,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3755
3997
|
},
|
|
3756
3998
|
products: this.getWalletProductList(),
|
|
3757
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),
|
|
3758
|
-
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
|
|
3759
4001
|
}, snapshot.identity.orderId ? {
|
|
3760
4002
|
payment_order_id: String(snapshot.identity.orderId)
|
|
3761
4003
|
} : {});
|
|
@@ -3818,7 +4060,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3818
4060
|
}
|
|
3819
4061
|
}, _callee37, this);
|
|
3820
4062
|
}));
|
|
3821
|
-
function initWalletData(
|
|
4063
|
+
function initWalletData(_x33) {
|
|
3822
4064
|
return _initWalletData.apply(this, arguments);
|
|
3823
4065
|
}
|
|
3824
4066
|
return initWalletData;
|
|
@@ -3845,9 +4087,9 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3845
4087
|
var walletPassName = fundRecord.wallet_pass_name;
|
|
3846
4088
|
var title = walletPassName && _typeof(walletPassName) === 'object' ? walletPassName.default || Object.values(walletPassName)[0] : walletPassName;
|
|
3847
4089
|
var code = String((payment === null || payment === void 0 ? void 0 : payment.code) || '').toUpperCase();
|
|
3848
|
-
var tag = ((_Object$entries$find = Object.entries(WALLET_PAYMENT_CODE_BY_TAG).find(function (
|
|
3849
|
-
var
|
|
3850
|
-
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];
|
|
3851
4093
|
return paymentCode === code;
|
|
3852
4094
|
})) === null || _Object$entries$find === void 0 ? void 0 : _Object$entries$find[0]) || fundRecord.tag;
|
|
3853
4095
|
return {
|
|
@@ -3885,7 +4127,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3885
4127
|
}
|
|
3886
4128
|
}, _callee38, this);
|
|
3887
4129
|
}));
|
|
3888
|
-
function publishWalletAssetsState(
|
|
4130
|
+
function publishWalletAssetsState(_x34) {
|
|
3889
4131
|
return _publishWalletAssetsState.apply(this, arguments);
|
|
3890
4132
|
}
|
|
3891
4133
|
return publishWalletAssetsState;
|
|
@@ -3966,7 +4208,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3966
4208
|
}
|
|
3967
4209
|
}, _callee39, this);
|
|
3968
4210
|
}));
|
|
3969
|
-
function syncSelectedWalletAssets(
|
|
4211
|
+
function syncSelectedWalletAssets(_x35) {
|
|
3970
4212
|
return _syncSelectedWalletAssets.apply(this, arguments);
|
|
3971
4213
|
}
|
|
3972
4214
|
return syncSelectedWalletAssets;
|
|
@@ -4022,7 +4264,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4022
4264
|
}
|
|
4023
4265
|
}, _callee40, this);
|
|
4024
4266
|
}));
|
|
4025
|
-
function importWalletAssetsSnapshot(
|
|
4267
|
+
function importWalletAssetsSnapshot(_x36) {
|
|
4026
4268
|
return _importWalletAssetsSnapshot.apply(this, arguments);
|
|
4027
4269
|
}
|
|
4028
4270
|
return importWalletAssetsSnapshot;
|
|
@@ -4110,7 +4352,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4110
4352
|
}
|
|
4111
4353
|
}, _callee41, this);
|
|
4112
4354
|
}));
|
|
4113
|
-
function refreshWalletAssets(
|
|
4355
|
+
function refreshWalletAssets(_x37) {
|
|
4114
4356
|
return _refreshWalletAssets.apply(this, arguments);
|
|
4115
4357
|
}
|
|
4116
4358
|
return refreshWalletAssets;
|
|
@@ -4143,7 +4385,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4143
4385
|
}
|
|
4144
4386
|
}, _callee42, this);
|
|
4145
4387
|
}));
|
|
4146
|
-
function selectWalletAsset(
|
|
4388
|
+
function selectWalletAsset(_x38) {
|
|
4147
4389
|
return _selectWalletAsset.apply(this, arguments);
|
|
4148
4390
|
}
|
|
4149
4391
|
return selectWalletAsset;
|
|
@@ -4173,7 +4415,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4173
4415
|
}
|
|
4174
4416
|
}, _callee43, this);
|
|
4175
4417
|
}));
|
|
4176
|
-
function updateWalletAssetAmount(
|
|
4418
|
+
function updateWalletAssetAmount(_x39) {
|
|
4177
4419
|
return _updateWalletAssetAmount.apply(this, arguments);
|
|
4178
4420
|
}
|
|
4179
4421
|
return updateWalletAssetAmount;
|
|
@@ -4218,7 +4460,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4218
4460
|
}
|
|
4219
4461
|
}, _callee44, this);
|
|
4220
4462
|
}));
|
|
4221
|
-
function scanWalletAsset(
|
|
4463
|
+
function scanWalletAsset(_x40) {
|
|
4222
4464
|
return _scanWalletAsset.apply(this, arguments);
|
|
4223
4465
|
}
|
|
4224
4466
|
return scanWalletAsset;
|
|
@@ -4348,7 +4590,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4348
4590
|
key: "getCashPaymentConfig",
|
|
4349
4591
|
value: (function () {
|
|
4350
4592
|
var _getCashPaymentConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee47() {
|
|
4351
|
-
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;
|
|
4352
4594
|
var paymentMethods, paymentMethod, amountSnapshot, pendingWalletAmount, amountDue, currency, recommendedAmounts;
|
|
4353
4595
|
return _regeneratorRuntime().wrap(function _callee47$(_context47) {
|
|
4354
4596
|
while (1) switch (_context47.prev = _context47.next) {
|
|
@@ -4374,7 +4616,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4374
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);
|
|
4375
4617
|
pendingWalletAmount = this.getPendingWalletPaymentAmount();
|
|
4376
4618
|
amountDue = Decimal.max(new Decimal((amountSnapshot === null || amountSnapshot === void 0 ? void 0 : amountSnapshot.amountGap) || 0).minus(pendingWalletAmount), 0).toDecimalPlaces(2).toNumber();
|
|
4377
|
-
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';
|
|
4378
4620
|
recommendedAmounts = amountDue > 0 ? this.store.payment.cash.getRecommendedAmount(amountDue, currency) : [];
|
|
4379
4621
|
return _context47.abrupt("return", {
|
|
4380
4622
|
available: Boolean(paymentMethod && amountDue > 0),
|
|
@@ -4509,7 +4751,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4509
4751
|
key: "payCash",
|
|
4510
4752
|
value: (function () {
|
|
4511
4753
|
var _payCash = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee49(params) {
|
|
4512
|
-
var _this$store$order$get6, _params$actualPaidAmo, _this$
|
|
4754
|
+
var _this$store$order$get6, _params$actualPaidAmo, _this$otherParams33, _this$window, _this$window$postMess;
|
|
4513
4755
|
var amount, config, paymentMethod, roundingAmount, effectivePaymentAmount, beforePayments, beforePaymentStatus, uniquePaymentNumber, paymentTimestamp, actualPaidAmount, changeAmount, shopWalletPassId, payments, payment, syncResult, committed, walletState, restoredTempOrder;
|
|
4514
4756
|
return _regeneratorRuntime().wrap(function _callee49$(_context49) {
|
|
4515
4757
|
while (1) switch (_context49.prev = _context49.next) {
|
|
@@ -4558,7 +4800,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4558
4800
|
paymentTimestamp = dayjs().format('YYYY-MM-DD HH:mm:ss');
|
|
4559
4801
|
actualPaidAmount = Number((_params$actualPaidAmo = params.actualPaidAmount) !== null && _params$actualPaidAmo !== void 0 ? _params$actualPaidAmo : amount);
|
|
4560
4802
|
changeAmount = Number(params.changeAmount || 0);
|
|
4561
|
-
shopWalletPassId = (_this$
|
|
4803
|
+
shopWalletPassId = (_this$otherParams33 = this.otherParams) === null || _this$otherParams33 === void 0 ? void 0 : _this$otherParams33.shop_wallet_pass_id;
|
|
4562
4804
|
if (!(!Number.isFinite(actualPaidAmount) || actualPaidAmount + 0.01 < amount)) {
|
|
4563
4805
|
_context49.next = 26;
|
|
4564
4806
|
break;
|
|
@@ -4647,7 +4889,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4647
4889
|
}
|
|
4648
4890
|
}, _callee49, this, [[29, 43]]);
|
|
4649
4891
|
}));
|
|
4650
|
-
function payCash(
|
|
4892
|
+
function payCash(_x41) {
|
|
4651
4893
|
return _payCash.apply(this, arguments);
|
|
4652
4894
|
}
|
|
4653
4895
|
return payCash;
|
|
@@ -4809,7 +5051,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4809
5051
|
}
|
|
4810
5052
|
}, _callee50, this, [[30, 44]]);
|
|
4811
5053
|
}));
|
|
4812
|
-
function commitPaymentMethodPayment(
|
|
5054
|
+
function commitPaymentMethodPayment(_x42) {
|
|
4813
5055
|
return _commitPaymentMethodPayment.apply(this, arguments);
|
|
4814
5056
|
}
|
|
4815
5057
|
return commitPaymentMethodPayment;
|
|
@@ -4857,7 +5099,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4857
5099
|
}
|
|
4858
5100
|
}, _callee51, this);
|
|
4859
5101
|
}));
|
|
4860
|
-
function roundAmount(
|
|
5102
|
+
function roundAmount(_x43) {
|
|
4861
5103
|
return _roundAmount.apply(this, arguments);
|
|
4862
5104
|
}
|
|
4863
5105
|
return roundAmount;
|
|
@@ -4873,7 +5115,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4873
5115
|
key: "sendCustomerPayLink",
|
|
4874
5116
|
value: (function () {
|
|
4875
5117
|
var _sendCustomerPayLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee52(params) {
|
|
4876
|
-
var orderIds,
|
|
5118
|
+
var orderIds, _ref41, _ref42, _submitResult$data$or, _submitResult$data, _submitResult$data2, submitResult, orderId;
|
|
4877
5119
|
return _regeneratorRuntime().wrap(function _callee52$(_context52) {
|
|
4878
5120
|
while (1) switch (_context52.prev = _context52.next) {
|
|
4879
5121
|
case 0:
|
|
@@ -4894,7 +5136,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4894
5136
|
});
|
|
4895
5137
|
case 6:
|
|
4896
5138
|
submitResult = _context52.sent;
|
|
4897
|
-
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;
|
|
4898
5140
|
if (orderId) {
|
|
4899
5141
|
_context52.next = 10;
|
|
4900
5142
|
break;
|
|
@@ -4914,7 +5156,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4914
5156
|
}
|
|
4915
5157
|
}, _callee52, this);
|
|
4916
5158
|
}));
|
|
4917
|
-
function sendCustomerPayLink(
|
|
5159
|
+
function sendCustomerPayLink(_x44) {
|
|
4918
5160
|
return _sendCustomerPayLink.apply(this, arguments);
|
|
4919
5161
|
}
|
|
4920
5162
|
return sendCustomerPayLink;
|
|
@@ -4929,40 +5171,52 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4929
5171
|
value: function () {
|
|
4930
5172
|
var _calculateProductBookingPrice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee53(params) {
|
|
4931
5173
|
var _params$customer_id;
|
|
4932
|
-
var quotation, customerId, authoritativeProduct, product;
|
|
5174
|
+
var useCustomerUserPricing, quotation, customerId, _yield$this$resolvePr, _yield$this$resolvePr2, authoritativeProduct, product;
|
|
4933
5175
|
return _regeneratorRuntime().wrap(function _callee53$(_context53) {
|
|
4934
5176
|
while (1) switch (_context53.prev = _context53.next) {
|
|
4935
5177
|
case 0:
|
|
4936
|
-
|
|
5178
|
+
useCustomerUserPricing = this.isCustomerUserPriceQuery();
|
|
5179
|
+
quotation = useCustomerUserPricing ? undefined : this.store.quotation;
|
|
4937
5180
|
customerId = (_params$customer_id = params.customer_id) !== null && _params$customer_id !== void 0 ? _params$customer_id : this.getCurrentOrderCustomerId();
|
|
4938
|
-
_context53.next =
|
|
5181
|
+
_context53.next = 5;
|
|
4939
5182
|
return this.prepareProductPriceQueryContext(customerId);
|
|
4940
|
-
case
|
|
4941
|
-
_context53.next =
|
|
4942
|
-
return this.
|
|
4943
|
-
|
|
4944
|
-
|
|
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];
|
|
4945
5195
|
product = this.mergeProductForPriceQuery(params.product, authoritativeProduct);
|
|
4946
|
-
|
|
5196
|
+
if (useCustomerUserPricing) {
|
|
5197
|
+
_context53.next = 14;
|
|
5198
|
+
break;
|
|
5199
|
+
}
|
|
5200
|
+
_context53.next = 14;
|
|
4947
5201
|
return this.loadQuotationForPriceQuery({
|
|
4948
5202
|
quotation: quotation,
|
|
4949
5203
|
customer_id: customerId,
|
|
4950
5204
|
channel: params.channel
|
|
4951
5205
|
});
|
|
4952
|
-
case
|
|
5206
|
+
case 14:
|
|
4953
5207
|
return _context53.abrupt("return", calculateBaseSalesProductBookingPrice(_objectSpread(_objectSpread({}, params), {}, {
|
|
4954
5208
|
product: product,
|
|
4955
5209
|
fallback_price: authoritativeProduct ? undefined : params.fallback_price,
|
|
4956
5210
|
customer_id: customerId,
|
|
4957
5211
|
quotation: authoritativeProduct && this.preferAuthoritativeProductQueryPrice() ? undefined : quotation
|
|
4958
5212
|
})));
|
|
4959
|
-
case
|
|
5213
|
+
case 15:
|
|
4960
5214
|
case "end":
|
|
4961
5215
|
return _context53.stop();
|
|
4962
5216
|
}
|
|
4963
5217
|
}, _callee53, this);
|
|
4964
5218
|
}));
|
|
4965
|
-
function calculateProductBookingPrice(
|
|
5219
|
+
function calculateProductBookingPrice(_x45) {
|
|
4966
5220
|
return _calculateProductBookingPrice.apply(this, arguments);
|
|
4967
5221
|
}
|
|
4968
5222
|
return calculateProductBookingPrice;
|
|
@@ -4970,7 +5224,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4970
5224
|
}, {
|
|
4971
5225
|
key: "getQuotationCustomerScopeInfo",
|
|
4972
5226
|
value: function getQuotationCustomerScopeInfo() {
|
|
4973
|
-
var
|
|
5227
|
+
var _this17 = this;
|
|
4974
5228
|
var quotation = this.store.quotation;
|
|
4975
5229
|
if (quotation && typeof quotation.getQuotationCustomerScopeInfo === 'function') {
|
|
4976
5230
|
return quotation.getQuotationCustomerScopeInfo();
|
|
@@ -4982,7 +5236,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4982
5236
|
}).map(function (item) {
|
|
4983
5237
|
var localSeen = new Set();
|
|
4984
5238
|
var customers = item.customer.filter(function (customer) {
|
|
4985
|
-
var customerId =
|
|
5239
|
+
var customerId = _this17.normalizePriceContextCustomerId(customer === null || customer === void 0 ? void 0 : customer.id);
|
|
4986
5240
|
if (!customerId || localSeen.has(customerId)) return false;
|
|
4987
5241
|
localSeen.add(customerId);
|
|
4988
5242
|
if (!customerById.has(customerId)) customerById.set(customerId, customer);
|
|
@@ -5009,8 +5263,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5009
5263
|
}, {
|
|
5010
5264
|
key: "hasSmartPricingStrategies",
|
|
5011
5265
|
value: function hasSmartPricingStrategies() {
|
|
5012
|
-
var _this$
|
|
5013
|
-
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;
|
|
5014
5268
|
if (!evaluator || typeof evaluator.getStrategyConfigs !== 'function') {
|
|
5015
5269
|
return false;
|
|
5016
5270
|
}
|
|
@@ -5020,15 +5274,15 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5020
5274
|
}, {
|
|
5021
5275
|
key: "shouldRecalculateProductBookingPricesForContextChange",
|
|
5022
5276
|
value: function shouldRecalculateProductBookingPricesForContextChange(params) {
|
|
5023
|
-
var scopeInfo = this.getQuotationCustomerScopeInfo();
|
|
5024
|
-
var scopedCustomerIds = new Set(scopeInfo.customerIds.map(function (id) {
|
|
5025
|
-
return String(id);
|
|
5026
|
-
}));
|
|
5027
5277
|
var previousCustomerId = this.normalizePriceContextCustomerId(params.previousCustomerId);
|
|
5028
5278
|
var nextCustomerId = this.normalizePriceContextCustomerId(params.nextCustomerId);
|
|
5029
|
-
if (this.hasSmartPricingStrategies()) {
|
|
5279
|
+
if (this.isCustomerUserPriceQuery() || this.hasSmartPricingStrategies()) {
|
|
5030
5280
|
return previousCustomerId !== nextCustomerId;
|
|
5031
5281
|
}
|
|
5282
|
+
var scopeInfo = this.getQuotationCustomerScopeInfo();
|
|
5283
|
+
var scopedCustomerIds = new Set(scopeInfo.customerIds.map(function (id) {
|
|
5284
|
+
return String(id);
|
|
5285
|
+
}));
|
|
5032
5286
|
var previousInScope = previousCustomerId ? scopedCustomerIds.has(previousCustomerId) : false;
|
|
5033
5287
|
var nextInScope = nextCustomerId ? scopedCustomerIds.has(nextCustomerId) : false;
|
|
5034
5288
|
var shouldRecalculate = false;
|
|
@@ -5047,11 +5301,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5047
5301
|
key: "calculateProductBookingPrices",
|
|
5048
5302
|
value: function () {
|
|
5049
5303
|
var _calculateProductBookingPrices = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee55(paramsList) {
|
|
5050
|
-
var
|
|
5051
|
-
|
|
5052
|
-
_this16 = this,
|
|
5053
|
-
_paramsList$2;
|
|
5054
|
-
var quotation, customerId, productMapsByGroup, groups;
|
|
5304
|
+
var _this18 = this;
|
|
5305
|
+
var useCustomerUserPricing, quotation, currentOrderCustomerId, authoritativeProducts, groups, _paramsList$0$custome, _paramsList$, _paramsList$2;
|
|
5055
5306
|
return _regeneratorRuntime().wrap(function _callee55$(_context55) {
|
|
5056
5307
|
while (1) switch (_context55.prev = _context55.next) {
|
|
5057
5308
|
case 0:
|
|
@@ -5061,79 +5312,86 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5061
5312
|
}
|
|
5062
5313
|
return _context55.abrupt("return", []);
|
|
5063
5314
|
case 2:
|
|
5064
|
-
|
|
5065
|
-
|
|
5066
|
-
|
|
5067
|
-
|
|
5068
|
-
|
|
5069
|
-
|
|
5315
|
+
useCustomerUserPricing = this.isCustomerUserPriceQuery();
|
|
5316
|
+
quotation = useCustomerUserPricing ? undefined : this.store.quotation;
|
|
5317
|
+
currentOrderCustomerId = this.getCurrentOrderCustomerId();
|
|
5318
|
+
authoritativeProducts = paramsList.map(function () {
|
|
5319
|
+
return null;
|
|
5320
|
+
});
|
|
5070
5321
|
groups = new Map();
|
|
5071
|
-
paramsList.forEach(function (params) {
|
|
5072
|
-
var
|
|
5073
|
-
var
|
|
5074
|
-
var
|
|
5075
|
-
|
|
5076
|
-
var
|
|
5077
|
-
var channel = params.channel || ((_this16$otherParams = _this16.otherParams) === null || _this16$otherParams === void 0 ? void 0 : _this16$otherParams.channel);
|
|
5078
|
-
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('|');
|
|
5079
5328
|
var group = groups.get(groupKey) || {
|
|
5080
|
-
|
|
5329
|
+
indices: [],
|
|
5081
5330
|
schedule: schedule,
|
|
5331
|
+
customerId: customerId,
|
|
5082
5332
|
channel: channel
|
|
5083
5333
|
};
|
|
5084
|
-
group.
|
|
5334
|
+
group.indices.push(index);
|
|
5085
5335
|
groups.set(groupKey, group);
|
|
5086
5336
|
});
|
|
5087
|
-
_context55.next =
|
|
5088
|
-
return Promise.all(Array.from(groups.
|
|
5089
|
-
var
|
|
5090
|
-
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;
|
|
5091
5341
|
return _regeneratorRuntime().wrap(function _callee54$(_context54) {
|
|
5092
5342
|
while (1) switch (_context54.prev = _context54.next) {
|
|
5093
5343
|
case 0:
|
|
5094
|
-
|
|
5095
|
-
|
|
5096
|
-
|
|
5097
|
-
|
|
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,
|
|
5098
5353
|
schedule: group.schedule,
|
|
5099
|
-
customerId: customerId,
|
|
5354
|
+
customerId: group.customerId,
|
|
5100
5355
|
channel: group.channel
|
|
5101
5356
|
});
|
|
5102
|
-
case 3:
|
|
5103
|
-
productsById = _context54.sent;
|
|
5104
|
-
productMapsByGroup.set(groupKey, productsById);
|
|
5105
5357
|
case 5:
|
|
5358
|
+
resolvedProducts = _context54.sent;
|
|
5359
|
+
group.indices.forEach(function (originalIndex, groupIndex) {
|
|
5360
|
+
authoritativeProducts[originalIndex] = resolvedProducts[groupIndex] || null;
|
|
5361
|
+
});
|
|
5362
|
+
case 7:
|
|
5106
5363
|
case "end":
|
|
5107
5364
|
return _context54.stop();
|
|
5108
5365
|
}
|
|
5109
5366
|
}, _callee54);
|
|
5110
5367
|
}));
|
|
5111
|
-
return function (
|
|
5112
|
-
return
|
|
5368
|
+
return function (_x47) {
|
|
5369
|
+
return _ref43.apply(this, arguments);
|
|
5113
5370
|
};
|
|
5114
5371
|
}()));
|
|
5115
|
-
case
|
|
5372
|
+
case 10:
|
|
5373
|
+
if (useCustomerUserPricing) {
|
|
5374
|
+
_context55.next = 13;
|
|
5375
|
+
break;
|
|
5376
|
+
}
|
|
5116
5377
|
_context55.next = 13;
|
|
5117
5378
|
return this.loadQuotationForPriceQuery({
|
|
5118
5379
|
quotation: quotation,
|
|
5119
|
-
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,
|
|
5120
5381
|
channel: (_paramsList$2 = paramsList[0]) === null || _paramsList$2 === void 0 ? void 0 : _paramsList$2.channel
|
|
5121
5382
|
});
|
|
5122
5383
|
case 13:
|
|
5123
|
-
return _context55.abrupt("return", paramsList.map(function (params) {
|
|
5124
|
-
var
|
|
5384
|
+
return _context55.abrupt("return", paramsList.map(function (params, index) {
|
|
5385
|
+
var _params$customer_id3;
|
|
5125
5386
|
var productInput = params.product || {};
|
|
5126
|
-
var
|
|
5127
|
-
var
|
|
5128
|
-
var
|
|
5129
|
-
var groupKey = [schedule.schedule_date, schedule.schedule_datetime, channel || ''].join('|');
|
|
5130
|
-
var authoritativeProduct = productId === null ? null : ((_productMapsByGroup$g = productMapsByGroup.get(groupKey)) === null || _productMapsByGroup$g === void 0 ? void 0 : _productMapsByGroup$g.get(productId)) || null;
|
|
5131
|
-
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;
|
|
5132
5390
|
return calculateBaseSalesProductBookingPrice(_objectSpread(_objectSpread({}, params), {}, {
|
|
5133
5391
|
product: product,
|
|
5134
5392
|
fallback_price: authoritativeProduct ? undefined : params.fallback_price,
|
|
5135
5393
|
customer_id: customerId,
|
|
5136
|
-
quotation: authoritativeProduct &&
|
|
5394
|
+
quotation: authoritativeProduct && _this18.preferAuthoritativeProductQueryPrice() ? undefined : quotation
|
|
5137
5395
|
}));
|
|
5138
5396
|
}));
|
|
5139
5397
|
case 14:
|
|
@@ -5142,7 +5400,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5142
5400
|
}
|
|
5143
5401
|
}, _callee55, this);
|
|
5144
5402
|
}));
|
|
5145
|
-
function calculateProductBookingPrices(
|
|
5403
|
+
function calculateProductBookingPrices(_x46) {
|
|
5146
5404
|
return _calculateProductBookingPrices.apply(this, arguments);
|
|
5147
5405
|
}
|
|
5148
5406
|
return calculateProductBookingPrices;
|
|
@@ -5177,7 +5435,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5177
5435
|
}
|
|
5178
5436
|
}, _callee56, this, [[0, 9]]);
|
|
5179
5437
|
}));
|
|
5180
|
-
function addProductToOrder(_x49, _x50
|
|
5438
|
+
function addProductToOrder(_x48, _x49, _x50) {
|
|
5181
5439
|
return _addProductToOrder.apply(this, arguments);
|
|
5182
5440
|
}
|
|
5183
5441
|
return addProductToOrder;
|
|
@@ -5212,7 +5470,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5212
5470
|
}
|
|
5213
5471
|
}, _callee57, this, [[0, 9]]);
|
|
5214
5472
|
}));
|
|
5215
|
-
function updateOrderProduct(
|
|
5473
|
+
function updateOrderProduct(_x51) {
|
|
5216
5474
|
return _updateOrderProduct.apply(this, arguments);
|
|
5217
5475
|
}
|
|
5218
5476
|
return updateOrderProduct;
|
|
@@ -5247,7 +5505,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5247
5505
|
}
|
|
5248
5506
|
}, _callee58, this, [[0, 9]]);
|
|
5249
5507
|
}));
|
|
5250
|
-
function updateOrderProducts(
|
|
5508
|
+
function updateOrderProducts(_x52) {
|
|
5251
5509
|
return _updateOrderProducts.apply(this, arguments);
|
|
5252
5510
|
}
|
|
5253
5511
|
return updateOrderProducts;
|
|
@@ -5282,7 +5540,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5282
5540
|
}
|
|
5283
5541
|
}, _callee59, this, [[0, 9]]);
|
|
5284
5542
|
}));
|
|
5285
|
-
function updateOrderProductQuantity(
|
|
5543
|
+
function updateOrderProductQuantity(_x53) {
|
|
5286
5544
|
return _updateOrderProductQuantity.apply(this, arguments);
|
|
5287
5545
|
}
|
|
5288
5546
|
return updateOrderProductQuantity;
|
|
@@ -5340,7 +5598,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5340
5598
|
}
|
|
5341
5599
|
}, _callee60, this, [[0, 11]]);
|
|
5342
5600
|
}));
|
|
5343
|
-
function setOrderProductLineNote(
|
|
5601
|
+
function setOrderProductLineNote(_x54, _x55) {
|
|
5344
5602
|
return _setOrderProductLineNote.apply(this, arguments);
|
|
5345
5603
|
}
|
|
5346
5604
|
return setOrderProductLineNote;
|
|
@@ -5380,7 +5638,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5380
5638
|
}
|
|
5381
5639
|
}, _callee61, this, [[0, 8]]);
|
|
5382
5640
|
}));
|
|
5383
|
-
function removeProductsFromOrder(
|
|
5641
|
+
function removeProductsFromOrder(_x56, _x57) {
|
|
5384
5642
|
return _removeProductsFromOrder.apply(this, arguments);
|
|
5385
5643
|
}
|
|
5386
5644
|
return removeProductsFromOrder;
|
|
@@ -5399,7 +5657,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5399
5657
|
}
|
|
5400
5658
|
}, _callee62, this);
|
|
5401
5659
|
}));
|
|
5402
|
-
function removeProductFromOrder(
|
|
5660
|
+
function removeProductFromOrder(_x58, _x59) {
|
|
5403
5661
|
return _removeProductFromOrder.apply(this, arguments);
|
|
5404
5662
|
}
|
|
5405
5663
|
return removeProductFromOrder;
|
|
@@ -5493,13 +5751,13 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5493
5751
|
key: "getProductList",
|
|
5494
5752
|
value: function () {
|
|
5495
5753
|
var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee64() {
|
|
5496
|
-
var _this$
|
|
5754
|
+
var _this$otherParams34;
|
|
5497
5755
|
var menu_list_ids, _this$store$products, res;
|
|
5498
5756
|
return _regeneratorRuntime().wrap(function _callee64$(_context64) {
|
|
5499
5757
|
while (1) switch (_context64.prev = _context64.next) {
|
|
5500
5758
|
case 0:
|
|
5501
5759
|
// 可以直接通过配置里的 menu 读取
|
|
5502
|
-
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) {
|
|
5503
5761
|
return Number(n.value);
|
|
5504
5762
|
})) || [];
|
|
5505
5763
|
_context64.prev = 1;
|
|
@@ -5537,21 +5795,21 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5537
5795
|
key: "setOtherParams",
|
|
5538
5796
|
value: function () {
|
|
5539
5797
|
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee65(params) {
|
|
5540
|
-
var _this$
|
|
5541
|
-
var
|
|
5542
|
-
|
|
5798
|
+
var _this$otherParams35;
|
|
5799
|
+
var _ref44,
|
|
5800
|
+
_ref44$cover,
|
|
5543
5801
|
cover,
|
|
5544
5802
|
_args65 = arguments;
|
|
5545
5803
|
return _regeneratorRuntime().wrap(function _callee65$(_context65) {
|
|
5546
5804
|
while (1) switch (_context65.prev = _context65.next) {
|
|
5547
5805
|
case 0:
|
|
5548
|
-
|
|
5806
|
+
_ref44 = _args65.length > 1 && _args65[1] !== undefined ? _args65[1] : {}, _ref44$cover = _ref44.cover, cover = _ref44$cover === void 0 ? false : _ref44$cover;
|
|
5549
5807
|
if (cover) {
|
|
5550
5808
|
this.otherParams = _objectSpread({}, params);
|
|
5551
5809
|
} else {
|
|
5552
5810
|
this.otherParams = _objectSpread(_objectSpread({}, this.otherParams), params);
|
|
5553
5811
|
}
|
|
5554
|
-
this.cacheId = (_this$
|
|
5812
|
+
this.cacheId = (_this$otherParams35 = this.otherParams) === null || _this$otherParams35 === void 0 ? void 0 : _this$otherParams35.cacheId;
|
|
5555
5813
|
_context65.next = 5;
|
|
5556
5814
|
return this.syncOtherParamsToSubModules(params, {
|
|
5557
5815
|
cover: cover
|
|
@@ -5562,7 +5820,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5562
5820
|
}
|
|
5563
5821
|
}, _callee65, this);
|
|
5564
5822
|
}));
|
|
5565
|
-
function setOtherParams(
|
|
5823
|
+
function setOtherParams(_x60) {
|
|
5566
5824
|
return _setOtherParams.apply(this, arguments);
|
|
5567
5825
|
}
|
|
5568
5826
|
return setOtherParams;
|