@pisell/pisellos 2.2.189 → 2.2.190
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/modules/Order/index.js +21 -21
- package/dist/modules/Order/types.d.ts +1 -0
- package/dist/solution/BaseSales/index.js +41 -32
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +14 -2
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +1 -1
- package/lib/modules/Order/index.js +5 -5
- package/lib/modules/Order/types.d.ts +1 -0
- package/lib/solution/BaseSales/index.js +12 -3
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +11 -2
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +1 -1
- package/package.json +1 -1
|
@@ -2117,7 +2117,6 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2117
2117
|
return _regeneratorRuntime().wrap(function _callee16$(_context18) {
|
|
2118
2118
|
while (1) switch (_context18.prev = _context18.next) {
|
|
2119
2119
|
case 0:
|
|
2120
|
-
debugger;
|
|
2121
2120
|
tempOrder = this.ensureTempOrder();
|
|
2122
2121
|
linked = booking ? this.createLinkedProductAndBooking({
|
|
2123
2122
|
product: product,
|
|
@@ -2139,10 +2138,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2139
2138
|
matchedProduct = matchedIndex === -1 ? null : tempOrder.products[matchedIndex];
|
|
2140
2139
|
existedFingerprint = matchedProduct ? buildProductLineFingerprint(matchedProduct.product_option_item, matchedProduct.product_bundle) : '';
|
|
2141
2140
|
if (!matchedProduct) {
|
|
2142
|
-
_context18.next =
|
|
2141
|
+
_context18.next = 17;
|
|
2143
2142
|
break;
|
|
2144
2143
|
}
|
|
2145
|
-
_context18.next =
|
|
2144
|
+
_context18.next = 14;
|
|
2146
2145
|
return this.shouldMergeProductToOrder({
|
|
2147
2146
|
incomingProduct: productToAdd,
|
|
2148
2147
|
normalizedIncoming: normalizedIncoming,
|
|
@@ -2153,13 +2152,13 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2153
2152
|
tempOrder: tempOrder,
|
|
2154
2153
|
booking: booking
|
|
2155
2154
|
});
|
|
2156
|
-
case
|
|
2155
|
+
case 14:
|
|
2157
2156
|
_context18.t0 = _context18.sent;
|
|
2158
|
-
_context18.next =
|
|
2157
|
+
_context18.next = 18;
|
|
2159
2158
|
break;
|
|
2160
|
-
case
|
|
2159
|
+
case 17:
|
|
2161
2160
|
_context18.t0 = false;
|
|
2162
|
-
case
|
|
2161
|
+
case 18:
|
|
2163
2162
|
shouldMerge = _context18.t0;
|
|
2164
2163
|
if (matchedIndex === -1 || !matchedProduct || !shouldMerge) {
|
|
2165
2164
|
this.captureProductRuntime(tempOrder, productToAdd, normalizedIncoming);
|
|
@@ -2192,18 +2191,18 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2192
2191
|
if (linked) {
|
|
2193
2192
|
tempOrder.bookings = [].concat(_toConsumableArray(tempOrder.bookings || []), [linked.booking]);
|
|
2194
2193
|
}
|
|
2195
|
-
_context18.next =
|
|
2194
|
+
_context18.next = 23;
|
|
2196
2195
|
return this.applyPromotion();
|
|
2197
|
-
case
|
|
2196
|
+
case 23:
|
|
2198
2197
|
this.applyDiscount();
|
|
2199
|
-
_context18.next =
|
|
2198
|
+
_context18.next = 26;
|
|
2200
2199
|
return this.recalculateSummary({
|
|
2201
2200
|
createIfMissing: true
|
|
2202
2201
|
});
|
|
2203
|
-
case
|
|
2202
|
+
case 26:
|
|
2204
2203
|
this.persistTempOrder();
|
|
2205
2204
|
return _context18.abrupt("return", tempOrder.products);
|
|
2206
|
-
case
|
|
2205
|
+
case 28:
|
|
2207
2206
|
case "end":
|
|
2208
2207
|
return _context18.stop();
|
|
2209
2208
|
}
|
|
@@ -2558,7 +2557,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2558
2557
|
key: "submitTempOrder",
|
|
2559
2558
|
value: function () {
|
|
2560
2559
|
var _submitTempOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(params) {
|
|
2561
|
-
var _params$cacheId, _this$otherParams;
|
|
2560
|
+
var _params$cacheId, _this$otherParams, _ref23, _params$businessCode, _this$otherParams2, _this$otherParams3;
|
|
2562
2561
|
var tempOrder, effectiveCacheId, hasPaymentOverride, hasPaymentStatusOverride, hasSmallTicketDataFlagOverride, enhancePayload, payload, result, _payload$payments, _payload$payments2, backendErrorResponse, submittedOrderId, resultRecord;
|
|
2563
2562
|
return _regeneratorRuntime().wrap(function _callee21$(_context23) {
|
|
2564
2563
|
while (1) switch (_context23.prev = _context23.next) {
|
|
@@ -2584,7 +2583,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2584
2583
|
tempOrder: tempOrder,
|
|
2585
2584
|
cacheId: effectiveCacheId,
|
|
2586
2585
|
platform: (params === null || params === void 0 ? void 0 : params.platform) || ((_this$otherParams = this.otherParams) === null || _this$otherParams === void 0 ? void 0 : _this$otherParams.platform),
|
|
2587
|
-
businessCode: params === null || params === void 0 ? void 0 : params.businessCode,
|
|
2586
|
+
businessCode: (_ref23 = (_params$businessCode = params === null || params === void 0 ? void 0 : params.businessCode) !== null && _params$businessCode !== void 0 ? _params$businessCode : (_this$otherParams2 = this.otherParams) === null || _this$otherParams2 === void 0 ? void 0 : _this$otherParams2.businessCode) !== null && _ref23 !== void 0 ? _ref23 : (_this$otherParams3 = this.otherParams) === null || _this$otherParams3 === void 0 ? void 0 : _this$otherParams3.business_code,
|
|
2588
2587
|
channel: params === null || params === void 0 ? void 0 : params.channel,
|
|
2589
2588
|
type: params === null || params === void 0 ? void 0 : params.type,
|
|
2590
2589
|
enhance: enhancePayload
|
|
@@ -2770,6 +2769,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2770
2769
|
payments: mappedPayments,
|
|
2771
2770
|
paymentStatus: paymentStatus,
|
|
2772
2771
|
smallTicketDataFlag: params.smallTicketDataFlag,
|
|
2772
|
+
businessCode: params.businessCode,
|
|
2773
2773
|
channel: params.channel,
|
|
2774
2774
|
enhancePayload: function enhancePayload(payload) {
|
|
2775
2775
|
var nextPayload = _objectSpread(_objectSpread({}, payload), {}, {
|
|
@@ -3339,7 +3339,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3339
3339
|
_step8;
|
|
3340
3340
|
try {
|
|
3341
3341
|
for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
|
|
3342
|
-
var _product$metadata6,
|
|
3342
|
+
var _product$metadata6, _ref24, _ref25, _existed$origin, _rawProduct$metadata;
|
|
3343
3343
|
var _step8$value = _slicedToArray(_step8.value, 2),
|
|
3344
3344
|
index = _step8$value[0],
|
|
3345
3345
|
product = _step8$value[1];
|
|
@@ -3347,7 +3347,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3347
3347
|
if (!uid) continue;
|
|
3348
3348
|
var existed = productsByUid[uid] && _typeof(productsByUid[uid]) === 'object' ? productsByUid[uid] : {};
|
|
3349
3349
|
var rawProduct = rawProducts[index] && _typeof(rawProducts[index]) === 'object' ? rawProducts[index] : product;
|
|
3350
|
-
var origin = (
|
|
3350
|
+
var origin = (_ref24 = (_ref25 = (_existed$origin = existed.origin) !== null && _existed$origin !== void 0 ? _existed$origin : rawProduct._origin) !== null && _ref25 !== void 0 ? _ref25 : (_rawProduct$metadata = rawProduct.metadata) === null || _rawProduct$metadata === void 0 ? void 0 : _rawProduct$metadata.origin) !== null && _ref24 !== void 0 ? _ref24 : rawProduct;
|
|
3351
3351
|
var originSnapshot = cloneDeep(origin);
|
|
3352
3352
|
var productOptionString = this.buildHydratedProductOptionString(rawProduct) || this.buildHydratedProductOptionString(product);
|
|
3353
3353
|
if (productOptionString && originSnapshot && _typeof(originSnapshot) === 'object') {
|
|
@@ -3415,10 +3415,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3415
3415
|
}, {
|
|
3416
3416
|
key: "normalizeHydratedProductOptionItem",
|
|
3417
3417
|
value: function normalizeHydratedProductOptionItem(optionItem) {
|
|
3418
|
-
var
|
|
3419
|
-
var rawNum = (
|
|
3418
|
+
var _ref26, _optionItem$num, _ref27, _optionItem$price;
|
|
3419
|
+
var rawNum = (_ref26 = (_optionItem$num = optionItem === null || optionItem === void 0 ? void 0 : optionItem.num) !== null && _optionItem$num !== void 0 ? _optionItem$num : optionItem === null || optionItem === void 0 ? void 0 : optionItem.quantity) !== null && _ref26 !== void 0 ? _ref26 : 1;
|
|
3420
3420
|
var parsedNum = Number(rawNum);
|
|
3421
|
-
var rawPrice = (
|
|
3421
|
+
var rawPrice = (_ref27 = (_optionItem$price = optionItem === null || optionItem === void 0 ? void 0 : optionItem.price) !== null && _optionItem$price !== void 0 ? _optionItem$price : optionItem === null || optionItem === void 0 ? void 0 : optionItem.add_price) !== null && _ref27 !== void 0 ? _ref27 : 0;
|
|
3422
3422
|
var parsedPrice = Number(rawPrice);
|
|
3423
3423
|
var normalized = {
|
|
3424
3424
|
option_group_item_id: optionItem === null || optionItem === void 0 ? void 0 : optionItem.option_group_item_id,
|
|
@@ -3574,9 +3574,9 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3574
3574
|
_step14;
|
|
3575
3575
|
try {
|
|
3576
3576
|
for (_iterator14.s(); !(_step14 = _iterator14.n()).done;) {
|
|
3577
|
-
var
|
|
3577
|
+
var _ref28, _bundle$num;
|
|
3578
3578
|
var bundle = _step14.value;
|
|
3579
|
-
var bundleQty = new Decimal(Number(qty) || 1).times(Number((
|
|
3579
|
+
var bundleQty = new Decimal(Number(qty) || 1).times(Number((_ref28 = (_bundle$num = bundle === null || bundle === void 0 ? void 0 : bundle.num) !== null && _bundle$num !== void 0 ? _bundle$num : bundle === null || bundle === void 0 ? void 0 : bundle.quantity) !== null && _ref28 !== void 0 ? _ref28 : 1) || 1).toNumber();
|
|
3580
3580
|
var _iterator15 = _createForOfIteratorHelper((bundle === null || bundle === void 0 ? void 0 : bundle.discount_list) || []),
|
|
3581
3581
|
_step15;
|
|
3582
3582
|
try {
|
|
@@ -479,6 +479,7 @@ export interface SyncPaymentsToOrderParams {
|
|
|
479
479
|
paymentStatus?: SubmitSalesOrderParams['query']['payment_status'];
|
|
480
480
|
submitWhenPaid?: boolean;
|
|
481
481
|
smallTicketDataFlag?: number;
|
|
482
|
+
businessCode?: string;
|
|
482
483
|
channel?: string;
|
|
483
484
|
}
|
|
484
485
|
export interface SyncPaymentsToOrderResult<T = any> {
|
|
@@ -1789,7 +1789,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1789
1789
|
key: "submitSalesOrder",
|
|
1790
1790
|
value: (function () {
|
|
1791
1791
|
var _submitSalesOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(params) {
|
|
1792
|
-
var _this$otherParams6, _this$otherParams7, _this$otherParams8;
|
|
1792
|
+
var _this$otherParams6, _this$otherParams7, _this$otherParams8, _this$otherParams9;
|
|
1793
1793
|
var inferredPaymentStatus, submitParams;
|
|
1794
1794
|
return _regeneratorRuntime().wrap(function _callee18$(_context18) {
|
|
1795
1795
|
while (1) switch (_context18.prev = _context18.next) {
|
|
@@ -1805,9 +1805,9 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1805
1805
|
submitParams = _objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
1806
1806
|
cacheId: this.cacheId,
|
|
1807
1807
|
platform: (_this$otherParams6 = this.otherParams) === null || _this$otherParams6 === void 0 ? void 0 : _this$otherParams6.platform,
|
|
1808
|
-
businessCode: (_this$otherParams7 = this.otherParams) === null || _this$otherParams7 === void 0 ? void 0 : _this$otherParams7.businessCode,
|
|
1808
|
+
businessCode: ((_this$otherParams7 = this.otherParams) === null || _this$otherParams7 === void 0 ? void 0 : _this$otherParams7.businessCode) || ((_this$otherParams8 = this.otherParams) === null || _this$otherParams8 === void 0 ? void 0 : _this$otherParams8.business_code),
|
|
1809
1809
|
channel: this.getSubmitOrderSalesChannel(),
|
|
1810
|
-
type: (_this$
|
|
1810
|
+
type: (_this$otherParams9 = this.otherParams) === null || _this$otherParams9 === void 0 ? void 0 : _this$otherParams9.type
|
|
1811
1811
|
}, (params === null || params === void 0 ? void 0 : params.payments) !== undefined ? {
|
|
1812
1812
|
payments: params.payments
|
|
1813
1813
|
} : {}), inferredPaymentStatus !== undefined ? {
|
|
@@ -1847,8 +1847,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1847
1847
|
key: "syncPaymentsToOrder",
|
|
1848
1848
|
value: function () {
|
|
1849
1849
|
var _syncPaymentsToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(params) {
|
|
1850
|
-
var _params$channel;
|
|
1851
|
-
var channel, syncParams, syncState, payments, syncResult;
|
|
1850
|
+
var _ref9, _params$businessCode, _this$otherParams10, _this$otherParams11, _params$channel;
|
|
1851
|
+
var businessCode, channel, syncParams, syncState, payments, syncResult;
|
|
1852
1852
|
return _regeneratorRuntime().wrap(function _callee19$(_context19) {
|
|
1853
1853
|
while (1) switch (_context19.prev = _context19.next) {
|
|
1854
1854
|
case 0:
|
|
@@ -1858,32 +1858,35 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1858
1858
|
}
|
|
1859
1859
|
throw new Error('order 模块未初始化');
|
|
1860
1860
|
case 2:
|
|
1861
|
+
businessCode = (_ref9 = (_params$businessCode = params.businessCode) !== null && _params$businessCode !== void 0 ? _params$businessCode : (_this$otherParams10 = this.otherParams) === null || _this$otherParams10 === void 0 ? void 0 : _this$otherParams10.businessCode) !== null && _ref9 !== void 0 ? _ref9 : (_this$otherParams11 = this.otherParams) === null || _this$otherParams11 === void 0 ? void 0 : _this$otherParams11.business_code;
|
|
1861
1862
|
channel = (_params$channel = params.channel) !== null && _params$channel !== void 0 ? _params$channel : this.getSubmitOrderSalesChannel();
|
|
1862
|
-
syncParams = _objectSpread(_objectSpread({}, params),
|
|
1863
|
+
syncParams = _objectSpread(_objectSpread(_objectSpread({}, params), businessCode !== undefined ? {
|
|
1864
|
+
businessCode: businessCode
|
|
1865
|
+
} : {}), channel !== undefined ? {
|
|
1863
1866
|
channel: channel
|
|
1864
1867
|
} : {});
|
|
1865
1868
|
syncState = this.store.order.getOrderSyncState();
|
|
1866
1869
|
if (!(params.submitWhenPaid && syncState === 'submitting')) {
|
|
1867
|
-
_context19.next =
|
|
1870
|
+
_context19.next = 8;
|
|
1868
1871
|
break;
|
|
1869
1872
|
}
|
|
1870
1873
|
return _context19.abrupt("return", this.store.order.syncPaymentsToOrder(syncParams));
|
|
1871
|
-
case
|
|
1874
|
+
case 8:
|
|
1872
1875
|
payments = params.payments || [];
|
|
1873
|
-
_context19.next =
|
|
1876
|
+
_context19.next = 11;
|
|
1874
1877
|
return this.effectsEmit(BaseSalesHookNames.onPaymentSyncStart, {
|
|
1875
1878
|
payments: payments,
|
|
1876
1879
|
params: syncParams,
|
|
1877
1880
|
amountSnapshot: this.store.order.getOrderAmountSnapshot(),
|
|
1878
1881
|
orderSnapshot: this.store.order.getOrderSnapshot()
|
|
1879
1882
|
});
|
|
1880
|
-
case
|
|
1881
|
-
_context19.prev =
|
|
1882
|
-
_context19.next =
|
|
1883
|
+
case 11:
|
|
1884
|
+
_context19.prev = 11;
|
|
1885
|
+
_context19.next = 14;
|
|
1883
1886
|
return this.store.order.syncPaymentsToOrder(syncParams);
|
|
1884
|
-
case
|
|
1887
|
+
case 14:
|
|
1885
1888
|
syncResult = _context19.sent;
|
|
1886
|
-
_context19.next =
|
|
1889
|
+
_context19.next = 17;
|
|
1887
1890
|
return this.effectsEmit(BaseSalesHookNames.onPaymentSyncEnd, {
|
|
1888
1891
|
ok: true,
|
|
1889
1892
|
syncResult: syncResult,
|
|
@@ -1892,12 +1895,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1892
1895
|
amountSnapshot: this.store.order.getOrderAmountSnapshot(),
|
|
1893
1896
|
orderSnapshot: this.store.order.getOrderSnapshot()
|
|
1894
1897
|
});
|
|
1895
|
-
case
|
|
1898
|
+
case 17:
|
|
1896
1899
|
return _context19.abrupt("return", syncResult);
|
|
1897
|
-
case
|
|
1898
|
-
_context19.prev =
|
|
1899
|
-
_context19.t0 = _context19["catch"](
|
|
1900
|
-
_context19.next =
|
|
1900
|
+
case 20:
|
|
1901
|
+
_context19.prev = 20;
|
|
1902
|
+
_context19.t0 = _context19["catch"](11);
|
|
1903
|
+
_context19.next = 24;
|
|
1901
1904
|
return this.effectsEmit(BaseSalesHookNames.onPaymentSyncEnd, {
|
|
1902
1905
|
ok: false,
|
|
1903
1906
|
error: _context19.t0,
|
|
@@ -1906,13 +1909,13 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1906
1909
|
amountSnapshot: this.store.order.getOrderAmountSnapshot(),
|
|
1907
1910
|
orderSnapshot: this.store.order.getOrderSnapshot()
|
|
1908
1911
|
});
|
|
1909
|
-
case 23:
|
|
1910
|
-
throw _context19.t0;
|
|
1911
1912
|
case 24:
|
|
1913
|
+
throw _context19.t0;
|
|
1914
|
+
case 25:
|
|
1912
1915
|
case "end":
|
|
1913
1916
|
return _context19.stop();
|
|
1914
1917
|
}
|
|
1915
|
-
}, _callee19, this, [[
|
|
1918
|
+
}, _callee19, this, [[11, 20]]);
|
|
1916
1919
|
}));
|
|
1917
1920
|
function syncPaymentsToOrder(_x15) {
|
|
1918
1921
|
return _syncPaymentsToOrder.apply(this, arguments);
|
|
@@ -1938,10 +1941,16 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1938
1941
|
}, {
|
|
1939
1942
|
key: "addOrderPayment",
|
|
1940
1943
|
value: function addOrderPayment(payment) {
|
|
1941
|
-
var
|
|
1944
|
+
var _this$otherParams12,
|
|
1945
|
+
_this6 = this;
|
|
1942
1946
|
if (!this.store.order) throw new Error('order 模块未初始化');
|
|
1943
1947
|
var paymentRecord = payment;
|
|
1944
1948
|
var metadata = paymentRecord.metadata && _typeof(paymentRecord.metadata) === 'object' ? _objectSpread({}, paymentRecord.metadata) : {};
|
|
1949
|
+
debugger;
|
|
1950
|
+
var shopWalletPassId = (_this$otherParams12 = this.otherParams) === null || _this$otherParams12 === void 0 ? void 0 : _this$otherParams12.shop_wallet_pass_id;
|
|
1951
|
+
if (shopWalletPassId !== undefined && shopWalletPassId !== null) {
|
|
1952
|
+
metadata.shop_wallet_pass_id = shopWalletPassId;
|
|
1953
|
+
}
|
|
1945
1954
|
if (!metadata.unique_identification_number) {
|
|
1946
1955
|
metadata.unique_identification_number = createUuidV4();
|
|
1947
1956
|
}
|
|
@@ -2050,7 +2059,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2050
2059
|
key: "initWalletData",
|
|
2051
2060
|
value: function () {
|
|
2052
2061
|
var _initWalletData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(params) {
|
|
2053
|
-
var _params$order_wait_pa,
|
|
2062
|
+
var _params$order_wait_pa, _ref10, _tempOrder$is_price_i;
|
|
2054
2063
|
var snapshot, tempOrder, amount, walletBusinessData, result;
|
|
2055
2064
|
return _regeneratorRuntime().wrap(function _callee20$(_context20) {
|
|
2056
2065
|
while (1) switch (_context20.prev = _context20.next) {
|
|
@@ -2093,7 +2102,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2093
2102
|
},
|
|
2094
2103
|
products: this.getWalletProductList(),
|
|
2095
2104
|
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),
|
|
2096
|
-
is_price_include_tax: (
|
|
2105
|
+
is_price_include_tax: (_ref10 = (_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 && _ref10 !== void 0 ? _ref10 : 1
|
|
2097
2106
|
}, snapshot.identity.orderId ? {
|
|
2098
2107
|
payment_order_id: String(snapshot.identity.orderId)
|
|
2099
2108
|
} : {});
|
|
@@ -2209,7 +2218,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2209
2218
|
key: "sendCustomerPayLink",
|
|
2210
2219
|
value: (function () {
|
|
2211
2220
|
var _sendCustomerPayLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(params) {
|
|
2212
|
-
var orderIds,
|
|
2221
|
+
var orderIds, _ref11, _ref12, _submitResult$data$or, _submitResult$data, _submitResult$data2, submitResult, orderId;
|
|
2213
2222
|
return _regeneratorRuntime().wrap(function _callee22$(_context22) {
|
|
2214
2223
|
while (1) switch (_context22.prev = _context22.next) {
|
|
2215
2224
|
case 0:
|
|
@@ -2230,7 +2239,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2230
2239
|
});
|
|
2231
2240
|
case 6:
|
|
2232
2241
|
submitResult = _context22.sent;
|
|
2233
|
-
orderId = (
|
|
2242
|
+
orderId = (_ref11 = (_ref12 = (_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 && _ref12 !== void 0 ? _ref12 : submitResult === null || submitResult === void 0 || (_submitResult$data2 = submitResult.data) === null || _submitResult$data2 === void 0 ? void 0 : _submitResult$data2.id) !== null && _ref11 !== void 0 ? _ref11 : submitResult === null || submitResult === void 0 ? void 0 : submitResult.id;
|
|
2234
2243
|
if (orderId) {
|
|
2235
2244
|
_context22.next = 10;
|
|
2236
2245
|
break;
|
|
@@ -2587,13 +2596,13 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2587
2596
|
key: "getProductList",
|
|
2588
2597
|
value: function () {
|
|
2589
2598
|
var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30() {
|
|
2590
|
-
var _this$
|
|
2599
|
+
var _this$otherParams13;
|
|
2591
2600
|
var menu_list_ids, _this$store$products, res;
|
|
2592
2601
|
return _regeneratorRuntime().wrap(function _callee30$(_context30) {
|
|
2593
2602
|
while (1) switch (_context30.prev = _context30.next) {
|
|
2594
2603
|
case 0:
|
|
2595
2604
|
// 可以直接通过配置里的 menu 读取
|
|
2596
|
-
menu_list_ids = ((_this$
|
|
2605
|
+
menu_list_ids = ((_this$otherParams13 = this.otherParams) === null || _this$otherParams13 === void 0 || (_this$otherParams13 = _this$otherParams13.dineInConfig) === null || _this$otherParams13 === void 0 ? void 0 : _this$otherParams13['menu.associated_menus'].map(function (n) {
|
|
2597
2606
|
return Number(n.value);
|
|
2598
2607
|
})) || [];
|
|
2599
2608
|
_context30.prev = 1;
|
|
@@ -2631,14 +2640,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2631
2640
|
key: "setOtherParams",
|
|
2632
2641
|
value: function () {
|
|
2633
2642
|
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(params) {
|
|
2634
|
-
var
|
|
2635
|
-
|
|
2643
|
+
var _ref13,
|
|
2644
|
+
_ref13$cover,
|
|
2636
2645
|
cover,
|
|
2637
2646
|
_args31 = arguments;
|
|
2638
2647
|
return _regeneratorRuntime().wrap(function _callee31$(_context31) {
|
|
2639
2648
|
while (1) switch (_context31.prev = _context31.next) {
|
|
2640
2649
|
case 0:
|
|
2641
|
-
|
|
2650
|
+
_ref13 = _args31.length > 1 && _args31[1] !== undefined ? _args31[1] : {}, _ref13$cover = _ref13.cover, cover = _ref13$cover === void 0 ? false : _ref13$cover;
|
|
2642
2651
|
if (cover) {
|
|
2643
2652
|
this.otherParams = params;
|
|
2644
2653
|
} else {
|
|
@@ -4,6 +4,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
4
4
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
5
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
6
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
|
+
import { composeLinePrice, sumOptionUnitPrice } from "../../../modules/Order/utils";
|
|
7
8
|
import { buildManualProductDiscountItem, mergeManualProductDiscountIntoList, resolveManualDiscountOriginTotal, resolveManualDiscountReasonFromSources, shouldBuildManualProductDiscount } from "../../../modules/Order/utils/manualProductDiscount";
|
|
8
9
|
function toNumber(value) {
|
|
9
10
|
var fallback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
@@ -123,6 +124,16 @@ export function transformBaseProductToOrderProduct(params) {
|
|
|
123
124
|
discountway: (_payload$_extend5 = payload._extend) === null || _payload$_extend5 === void 0 ? void 0 : _payload$_extend5.discountway,
|
|
124
125
|
discount_per: (_payload$_extend6 = payload._extend) === null || _payload$_extend6 === void 0 ? void 0 : _payload$_extend6.discount_per
|
|
125
126
|
})) : payload.discount_list || [];
|
|
127
|
+
|
|
128
|
+
// v2:source 不含 option;main_product_* 含 option(与 normalizeOrderProduct 一致)
|
|
129
|
+
var optionSum = sumOptionUnitPrice(productOptionItem).toNumber();
|
|
130
|
+
var mainProductOriginalPrice = toPriceString(Number(sourceProductPrice) + optionSum);
|
|
131
|
+
var bundleOnlyComposite = composeLinePrice({
|
|
132
|
+
mainPrice: 0,
|
|
133
|
+
bundle: productBundle
|
|
134
|
+
});
|
|
135
|
+
var derivedMainSelling = Number(lineCompositeTotal) - Number(bundleOnlyComposite);
|
|
136
|
+
var mainProductSellingPrice = toPriceString(Number.isFinite(derivedMainSelling) && derivedMainSelling >= 0 ? derivedMainSelling : Number(mainProductOriginalPrice));
|
|
126
137
|
var metadata = _objectSpread(_objectSpread({
|
|
127
138
|
unique: payload.unique,
|
|
128
139
|
session: payload.session,
|
|
@@ -135,8 +146,9 @@ export function transformBaseProductToOrderProduct(params) {
|
|
|
135
146
|
source_shop_id: payload.source_shop_id,
|
|
136
147
|
origin: origin,
|
|
137
148
|
source_product_price: sourceProductPrice,
|
|
138
|
-
main_product_selling_price:
|
|
139
|
-
main_product_original_price:
|
|
149
|
+
main_product_selling_price: mainProductSellingPrice,
|
|
150
|
+
main_product_original_price: mainProductOriginalPrice,
|
|
151
|
+
price_schema_version: 2
|
|
140
152
|
}, hasPriceOverride ? {
|
|
141
153
|
price_override: String(payload.price_override),
|
|
142
154
|
is_manual_discount: 1
|
|
@@ -311,7 +311,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
311
311
|
date: string;
|
|
312
312
|
status: string;
|
|
313
313
|
week: string;
|
|
314
|
-
weekNum: 0 |
|
|
314
|
+
weekNum: 0 | 5 | 1 | 4 | 2 | 3 | 6;
|
|
315
315
|
}[]>;
|
|
316
316
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
317
317
|
private getScheduleDataByIds;
|
|
@@ -279,7 +279,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
|
|
|
279
279
|
* 获取当前的客户搜索条件
|
|
280
280
|
* @returns 当前搜索条件
|
|
281
281
|
*/
|
|
282
|
-
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "
|
|
282
|
+
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
|
|
283
283
|
/**
|
|
284
284
|
* 获取客户列表状态(包含滚动加载相关状态)
|
|
285
285
|
* @returns 客户状态
|
|
@@ -1445,7 +1445,6 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
1445
1445
|
// ─── TempOrder: 商品 CRUD ───
|
|
1446
1446
|
async addProductToOrder(product, booking) {
|
|
1447
1447
|
var _a;
|
|
1448
|
-
debugger;
|
|
1449
1448
|
const tempOrder = this.ensureTempOrder();
|
|
1450
1449
|
const linked = booking ? this.createLinkedProductAndBooking({ product, booking }) : null;
|
|
1451
1450
|
const productToAdd = (linked == null ? void 0 : linked.product) || product;
|
|
@@ -1841,7 +1840,7 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
1841
1840
|
* 应传 1,确保 /order/sales/checkout 返回打印所需数据。
|
|
1842
1841
|
*/
|
|
1843
1842
|
async submitTempOrder(params) {
|
|
1844
|
-
var _a, _b, _c;
|
|
1843
|
+
var _a, _b, _c, _d, _e;
|
|
1845
1844
|
const tempOrder = this.ensureTempOrder();
|
|
1846
1845
|
this.persistTempOrder();
|
|
1847
1846
|
const effectiveCacheId = (params == null ? void 0 : params.cacheId) ?? this.cacheId;
|
|
@@ -1866,7 +1865,7 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
1866
1865
|
tempOrder,
|
|
1867
1866
|
cacheId: effectiveCacheId,
|
|
1868
1867
|
platform: (params == null ? void 0 : params.platform) || ((_a = this.otherParams) == null ? void 0 : _a.platform),
|
|
1869
|
-
businessCode: params == null ? void 0 : params.businessCode,
|
|
1868
|
+
businessCode: (params == null ? void 0 : params.businessCode) ?? ((_b = this.otherParams) == null ? void 0 : _b.businessCode) ?? ((_c = this.otherParams) == null ? void 0 : _c.business_code),
|
|
1870
1869
|
channel: params == null ? void 0 : params.channel,
|
|
1871
1870
|
type: params == null ? void 0 : params.type,
|
|
1872
1871
|
enhance: enhancePayload
|
|
@@ -1880,7 +1879,7 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
1880
1879
|
externalSaleNumber: payload.external_sale_number,
|
|
1881
1880
|
requestUniqueIdempotencyToken: payload.request_unique_idempotency_token,
|
|
1882
1881
|
paymentStatus: payload.payment_status,
|
|
1883
|
-
paymentsCount: ((
|
|
1882
|
+
paymentsCount: ((_d = payload.payments) == null ? void 0 : _d.length) || 0,
|
|
1884
1883
|
smallTicketDataFlag: payload.small_ticket_data_flag
|
|
1885
1884
|
});
|
|
1886
1885
|
result = await this.submitSalesOrder({
|
|
@@ -1899,7 +1898,7 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
1899
1898
|
orderId: payload.order_id,
|
|
1900
1899
|
externalSaleNumber: payload.external_sale_number,
|
|
1901
1900
|
paymentStatus: payload.payment_status,
|
|
1902
|
-
paymentsCount: ((
|
|
1901
|
+
paymentsCount: ((_e = payload.payments) == null ? void 0 : _e.length) || 0
|
|
1903
1902
|
});
|
|
1904
1903
|
throw error;
|
|
1905
1904
|
}
|
|
@@ -1988,6 +1987,7 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
1988
1987
|
payments: mappedPayments,
|
|
1989
1988
|
paymentStatus,
|
|
1990
1989
|
smallTicketDataFlag: params.smallTicketDataFlag,
|
|
1990
|
+
businessCode: params.businessCode,
|
|
1991
1991
|
channel: params.channel,
|
|
1992
1992
|
enhancePayload: (payload) => {
|
|
1993
1993
|
const nextPayload = {
|
|
@@ -479,6 +479,7 @@ export interface SyncPaymentsToOrderParams {
|
|
|
479
479
|
paymentStatus?: SubmitSalesOrderParams['query']['payment_status'];
|
|
480
480
|
submitWhenPaid?: boolean;
|
|
481
481
|
smallTicketDataFlag?: number;
|
|
482
|
+
businessCode?: string;
|
|
482
483
|
channel?: string;
|
|
483
484
|
}
|
|
484
485
|
export interface SyncPaymentsToOrderResult<T = any> {
|
|
@@ -1068,7 +1068,7 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
|
|
|
1068
1068
|
* payments 会交给 OrderModule 统一映射为 Sales 协议支付项。
|
|
1069
1069
|
*/
|
|
1070
1070
|
async submitSalesOrder(params) {
|
|
1071
|
-
var _a, _b, _c;
|
|
1071
|
+
var _a, _b, _c, _d;
|
|
1072
1072
|
if (!this.store.order) {
|
|
1073
1073
|
throw new Error("BaseSales 解决方案需要 order 模块支持");
|
|
1074
1074
|
}
|
|
@@ -1077,9 +1077,9 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
|
|
|
1077
1077
|
const submitParams = {
|
|
1078
1078
|
cacheId: this.cacheId,
|
|
1079
1079
|
platform: (_a = this.otherParams) == null ? void 0 : _a.platform,
|
|
1080
|
-
businessCode: (_b = this.otherParams) == null ? void 0 : _b.businessCode,
|
|
1080
|
+
businessCode: ((_b = this.otherParams) == null ? void 0 : _b.businessCode) || ((_c = this.otherParams) == null ? void 0 : _c.business_code),
|
|
1081
1081
|
channel: this.getSubmitOrderSalesChannel(),
|
|
1082
|
-
type: (
|
|
1082
|
+
type: (_d = this.otherParams) == null ? void 0 : _d.type,
|
|
1083
1083
|
...(params == null ? void 0 : params.payments) !== void 0 ? { payments: params.payments } : {},
|
|
1084
1084
|
...inferredPaymentStatus !== void 0 ? { paymentStatus: inferredPaymentStatus } : {},
|
|
1085
1085
|
...(params == null ? void 0 : params.smallTicketDataFlag) !== void 0 ? { smallTicketDataFlag: params.smallTicketDataFlag } : {},
|
|
@@ -1102,11 +1102,14 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
|
|
|
1102
1102
|
}
|
|
1103
1103
|
}
|
|
1104
1104
|
async syncPaymentsToOrder(params) {
|
|
1105
|
+
var _a, _b;
|
|
1105
1106
|
if (!this.store.order)
|
|
1106
1107
|
throw new Error("order 模块未初始化");
|
|
1108
|
+
const businessCode = params.businessCode ?? ((_a = this.otherParams) == null ? void 0 : _a.businessCode) ?? ((_b = this.otherParams) == null ? void 0 : _b.business_code);
|
|
1107
1109
|
const channel = params.channel ?? this.getSubmitOrderSalesChannel();
|
|
1108
1110
|
const syncParams = {
|
|
1109
1111
|
...params,
|
|
1112
|
+
...businessCode !== void 0 ? { businessCode } : {},
|
|
1110
1113
|
...channel !== void 0 ? { channel } : {}
|
|
1111
1114
|
};
|
|
1112
1115
|
const syncState = this.store.order.getOrderSyncState();
|
|
@@ -1157,10 +1160,16 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
|
|
|
1157
1160
|
}
|
|
1158
1161
|
/** 追加单个支付项到当前订单。 */
|
|
1159
1162
|
addOrderPayment(payment) {
|
|
1163
|
+
var _a;
|
|
1160
1164
|
if (!this.store.order)
|
|
1161
1165
|
throw new Error("order 模块未初始化");
|
|
1162
1166
|
const paymentRecord = payment;
|
|
1163
1167
|
const metadata = paymentRecord.metadata && typeof paymentRecord.metadata === "object" ? { ...paymentRecord.metadata } : {};
|
|
1168
|
+
debugger;
|
|
1169
|
+
const shopWalletPassId = (_a = this.otherParams) == null ? void 0 : _a.shop_wallet_pass_id;
|
|
1170
|
+
if (shopWalletPassId !== void 0 && shopWalletPassId !== null) {
|
|
1171
|
+
metadata.shop_wallet_pass_id = shopWalletPassId;
|
|
1172
|
+
}
|
|
1164
1173
|
if (!metadata.unique_identification_number) {
|
|
1165
1174
|
metadata.unique_identification_number = (0, import_utils.createUuidV4)();
|
|
1166
1175
|
}
|
|
@@ -22,6 +22,7 @@ __export(transformBaseProductToOrderProduct_exports, {
|
|
|
22
22
|
transformBaseProductToOrderProduct: () => transformBaseProductToOrderProduct
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(transformBaseProductToOrderProduct_exports);
|
|
25
|
+
var import_utils = require("../../../modules/Order/utils");
|
|
25
26
|
var import_manualProductDiscount = require("../../../modules/Order/utils/manualProductDiscount");
|
|
26
27
|
function toNumber(value, fallback = 0) {
|
|
27
28
|
const parsedValue = Number(value);
|
|
@@ -158,6 +159,13 @@ function transformBaseProductToOrderProduct(params) {
|
|
|
158
159
|
discount_per: (_k = payload._extend) == null ? void 0 : _k.discount_per
|
|
159
160
|
})
|
|
160
161
|
) : payload.discount_list || [];
|
|
162
|
+
const optionSum = (0, import_utils.sumOptionUnitPrice)(productOptionItem).toNumber();
|
|
163
|
+
const mainProductOriginalPrice = toPriceString(Number(sourceProductPrice) + optionSum);
|
|
164
|
+
const bundleOnlyComposite = (0, import_utils.composeLinePrice)({ mainPrice: 0, bundle: productBundle });
|
|
165
|
+
const derivedMainSelling = Number(lineCompositeTotal) - Number(bundleOnlyComposite);
|
|
166
|
+
const mainProductSellingPrice = toPriceString(
|
|
167
|
+
Number.isFinite(derivedMainSelling) && derivedMainSelling >= 0 ? derivedMainSelling : Number(mainProductOriginalPrice)
|
|
168
|
+
);
|
|
161
169
|
const metadata = {
|
|
162
170
|
unique: payload.unique,
|
|
163
171
|
session: payload.session,
|
|
@@ -170,8 +178,9 @@ function transformBaseProductToOrderProduct(params) {
|
|
|
170
178
|
source_shop_id: payload.source_shop_id,
|
|
171
179
|
origin,
|
|
172
180
|
source_product_price: sourceProductPrice,
|
|
173
|
-
main_product_selling_price:
|
|
174
|
-
main_product_original_price:
|
|
181
|
+
main_product_selling_price: mainProductSellingPrice,
|
|
182
|
+
main_product_original_price: mainProductOriginalPrice,
|
|
183
|
+
price_schema_version: 2,
|
|
175
184
|
...hasPriceOverride ? {
|
|
176
185
|
price_override: String(payload.price_override),
|
|
177
186
|
is_manual_discount: 1
|
|
@@ -311,7 +311,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
311
311
|
date: string;
|
|
312
312
|
status: string;
|
|
313
313
|
week: string;
|
|
314
|
-
weekNum: 0 |
|
|
314
|
+
weekNum: 0 | 5 | 1 | 4 | 2 | 3 | 6;
|
|
315
315
|
}[]>;
|
|
316
316
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
317
317
|
private getScheduleDataByIds;
|
|
@@ -279,7 +279,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
|
|
|
279
279
|
* 获取当前的客户搜索条件
|
|
280
280
|
* @returns 当前搜索条件
|
|
281
281
|
*/
|
|
282
|
-
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "
|
|
282
|
+
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
|
|
283
283
|
/**
|
|
284
284
|
* 获取客户列表状态(包含滚动加载相关状态)
|
|
285
285
|
* @returns 客户状态
|