@pisell/pisellos 0.10.15 → 0.10.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/index.js +6 -9
- package/dist/model/strategy/adapter/promotion/index.js +0 -9
- package/dist/model/strategy/adapter/walletPass/example.js +3 -26
- package/dist/model/strategy/strategy-example.js +5 -19
- package/dist/modules/Cart/index.js +0 -3
- package/dist/modules/Cart/utils/cartProduct.js +0 -1
- package/dist/modules/Date/index.js +1 -5
- package/dist/modules/Discount/index.js +2 -4
- package/dist/modules/OpenData/index.d.ts +5 -2
- package/dist/modules/OpenData/index.js +27 -14
- package/dist/modules/OpenData/types.d.ts +42 -0
- package/dist/modules/OpenData/types.js +7 -1
- package/dist/modules/OpenData/utils.d.ts +15 -1
- package/dist/modules/OpenData/utils.js +85 -0
- package/dist/modules/Order/index.d.ts +4 -2
- package/dist/modules/Order/index.js +131 -123
- package/dist/modules/Order/types.d.ts +8 -1
- package/dist/modules/Order/types.js +1 -0
- package/dist/modules/Order/utils.js +7 -1
- package/dist/modules/Payment/index.js +97 -162
- package/dist/modules/Product/types.d.ts +2 -0
- package/dist/modules/ProductList/index.js +96 -74
- package/dist/modules/Rules/index.js +12 -12
- package/dist/modules/SalesSummary/index.js +6 -4
- package/dist/modules/Schedule/index.js +0 -1
- package/dist/modules/Schedule/utils.js +0 -1
- package/dist/modules/Step/index.js +0 -1
- package/dist/plugins/request.js +1 -4
- package/dist/plugins/window.js +2 -6
- package/dist/server/index.d.ts +11 -0
- package/dist/server/index.js +977 -641
- package/dist/server/modules/menu/index.js +32 -41
- package/dist/server/modules/order/index.d.ts +8 -0
- package/dist/server/modules/order/index.js +253 -219
- package/dist/server/modules/products/index.js +24 -42
- package/dist/server/modules/quotation/index.js +29 -38
- package/dist/server/modules/resource/index.js +3 -4
- package/dist/server/modules/schedule/index.js +27 -35
- package/dist/server/utils/product.js +0 -1
- package/dist/server/utils/small-ticket.d.ts +9 -1
- package/dist/server/utils/small-ticket.js +117 -43
- package/dist/solution/BaseSales/index.d.ts +7 -0
- package/dist/solution/BaseSales/index.js +350 -215
- package/dist/solution/BaseSales/types.d.ts +2 -0
- package/dist/solution/BaseSales/utils/cartPromotion.d.ts +5 -0
- package/dist/solution/BaseSales/utils/cartPromotion.js +15 -6
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +3 -0
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +7 -1
- package/dist/solution/BaseSales/utils.js +6 -3
- package/dist/solution/BookingByStep/index.d.ts +2 -2
- package/dist/solution/BookingByStep/index.js +7 -59
- package/dist/solution/BookingByStep/utils/capacity.js +1 -11
- package/dist/solution/BookingByStep/utils/resources.js +1 -3
- package/dist/solution/BookingByStep/utils/timeslots.js +2 -43
- package/dist/solution/BookingTicket/index.d.ts +14 -19
- package/dist/solution/BookingTicket/index.js +553 -433
- package/dist/solution/BookingTicket/utils/addProductDecision.js +3 -1
- package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +6 -7
- package/dist/solution/BookingTicket/utils/scan/handleScan.js +25 -31
- package/dist/solution/BookingTicket/utils/scan/index.js +6 -10
- package/dist/solution/BuyTickets/index.js +9 -12
- package/dist/solution/Checkout/index.js +177 -252
- package/dist/solution/Checkout/utils/index.js +4 -16
- package/dist/solution/RegisterAndLogin/index.js +30 -76
- package/dist/solution/Sales/index.d.ts +20 -4
- package/dist/solution/Sales/index.js +348 -75
- package/dist/solution/Sales/types.d.ts +10 -0
- package/dist/solution/ScanOrder/index.js +50 -60
- package/dist/solution/ScanOrder/types.d.ts +2 -0
- package/dist/solution/ScanOrder/utils.js +6 -3
- package/dist/solution/ShopDiscount/index.js +2 -7
- package/dist/solution/UnifiedBookingSales/index.d.ts +5 -4
- package/dist/solution/UnifiedBookingSales/index.js +495 -422
- package/dist/solution/UnifiedBookingSales/types.d.ts +7 -1
- package/dist/solution/VenueBooking/index.js +45 -55
- package/dist/utils/task.js +15 -18
- package/dist/utils/watch.js +0 -1
- package/lib/apis/picoding.js +2 -0
- package/lib/core/index.js +131 -131
- package/lib/effects/index.js +46 -57
- package/lib/index.js +82 -49
- package/lib/model/index.js +14 -21
- package/lib/model/strategy/adapter/dataVariant/adapter.js +38 -50
- package/lib/model/strategy/adapter/dataVariant/evaluator.js +209 -315
- package/lib/model/strategy/adapter/dataVariant/examples.js +229 -237
- package/lib/model/strategy/adapter/dataVariant/index.js +39 -34
- package/lib/model/strategy/adapter/dataVariant/type.js +57 -28
- package/lib/model/strategy/adapter/index.js +100 -64
- package/lib/model/strategy/adapter/itemRule/adapter.js +156 -144
- package/lib/model/strategy/adapter/itemRule/evaluator.js +36 -48
- package/lib/model/strategy/adapter/itemRule/examples.js +295 -225
- package/lib/model/strategy/adapter/itemRule/index.js +83 -57
- package/lib/model/strategy/adapter/itemRule/type.js +97 -36
- package/lib/model/strategy/adapter/promotion/adapter.js +91 -69
- package/lib/model/strategy/adapter/promotion/evaluator.js +444 -310
- package/lib/model/strategy/adapter/promotion/examples.js +222 -234
- package/lib/model/strategy/adapter/promotion/index.js +1 -51
- package/lib/model/strategy/adapter/promotion/type.js +243 -36
- package/lib/model/strategy/adapter/type.js +4 -16
- package/lib/model/strategy/adapter/walletPass/evaluator.js +180 -150
- package/lib/model/strategy/adapter/walletPass/example.js +217 -190
- package/lib/model/strategy/adapter/walletPass/index.js +75 -51
- package/lib/model/strategy/adapter/walletPass/locales.js +36 -58
- package/lib/model/strategy/adapter/walletPass/type.js +4 -16
- package/lib/model/strategy/adapter/walletPass/utils.js +588 -378
- package/lib/model/strategy/engine.js +270 -168
- package/lib/model/strategy/index.js +49 -34
- package/lib/model/strategy/strategy-example.js +243 -239
- package/lib/model/strategy/type.js +100 -40
- package/lib/modules/Account/index.js +39 -53
- package/lib/modules/Account/types.js +20 -33
- package/lib/modules/AccountList/index.js +116 -154
- package/lib/modules/AccountList/types.js +30 -31
- package/lib/modules/AccountList/utils.js +18 -30
- package/lib/modules/BaseModule.js +23 -42
- package/lib/modules/BookingContext/index.js +158 -136
- package/lib/modules/BookingContext/types.js +46 -32
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +138 -146
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +78 -83
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +170 -150
- package/lib/modules/BookingContext/utils/flexible.js +38 -55
- package/lib/modules/BookingContext/utils/formatResourceList.js +19 -34
- package/lib/modules/BookingContext/utils/index.js +124 -41
- package/lib/modules/BookingContext/utils/noResource.js +58 -70
- package/lib/modules/BookingContext/utils/orderLineDisplay.js +14 -41
- package/lib/modules/BookingContext/utils/productExtend.js +202 -155
- package/lib/modules/BookingContext/utils/resourceErrors.js +53 -53
- package/lib/modules/BookingContext/utils/resourceSelection.js +19 -41
- package/lib/modules/BookingContext/utils/resources.js +209 -167
- package/lib/modules/BookingContext/utils/serviceTimes.js +115 -116
- package/lib/modules/BookingContext/utils/timeSlices.js +76 -86
- package/lib/modules/Cart/index.js +170 -124
- package/lib/modules/Cart/types.js +46 -51
- package/lib/modules/Cart/utils/cartAccount.js +40 -39
- package/lib/modules/Cart/utils/cartDate.js +56 -61
- package/lib/modules/Cart/utils/cartDiscount.js +28 -33
- package/lib/modules/Cart/utils/cartNote.js +27 -32
- package/lib/modules/Cart/utils/cartProduct.js +321 -251
- package/lib/modules/Cart/utils/cartRelationForms.js +29 -35
- package/lib/modules/Cart/utils/cartResource.js +70 -78
- package/lib/modules/Cart/utils/changePrice.js +22 -50
- package/lib/modules/Cart/utils/index.js +106 -48
- package/lib/modules/Customer/constants.js +13 -34
- package/lib/modules/Customer/index.js +235 -172
- package/lib/modules/Customer/types.js +38 -35
- package/lib/modules/Date/index.js +116 -115
- package/lib/modules/Date/types.js +16 -28
- package/lib/modules/Date/utils.js +174 -123
- package/lib/modules/Discount/index.js +133 -143
- package/lib/modules/Discount/types.js +9 -31
- package/lib/modules/Guests/index.js +30 -56
- package/lib/modules/Guests/types.js +23 -33
- package/lib/modules/Holder/index.js +209 -189
- package/lib/modules/Holder/types.js +4 -16
- package/lib/modules/Holder/utils.js +20 -49
- package/lib/modules/OpenData/index.d.ts +5 -2
- package/lib/modules/OpenData/index.js +119 -78
- package/lib/modules/OpenData/types.d.ts +42 -0
- package/lib/modules/OpenData/types.js +12 -16
- package/lib/modules/OpenData/utils.d.ts +15 -1
- package/lib/modules/OpenData/utils.js +129 -78
- package/lib/modules/Order/index.d.ts +4 -2
- package/lib/modules/Order/index.js +1843 -2251
- package/lib/modules/Order/payment-utils.js +77 -120
- package/lib/modules/Order/types.d.ts +8 -1
- package/lib/modules/Order/types.js +88 -35
- package/lib/modules/Order/utils/bundleDiscountHydration.js +41 -74
- package/lib/modules/Order/utils/discountProductLineIdentity.js +142 -100
- package/lib/modules/Order/utils/manualProductDiscount.js +124 -123
- package/lib/modules/Order/utils/orderCollectionIdentity.js +184 -244
- package/lib/modules/Order/utils/virtualSettlement.js +120 -171
- package/lib/modules/Order/utils.js +834 -668
- package/lib/modules/Payment/cash.js +20 -33
- package/lib/modules/Payment/cashRecommendationAlgorithm.js +145 -76
- package/lib/modules/Payment/eftpos.js +16 -30
- package/lib/modules/Payment/index.js +532 -399
- package/lib/modules/Payment/mx51.js +1 -0
- package/lib/modules/Payment/types.js +230 -108
- package/lib/modules/Payment/utils.js +52 -51
- package/lib/modules/Payment/walletpass.js +485 -660
- package/lib/modules/Product/index.js +51 -46
- package/lib/modules/Product/types.d.ts +2 -0
- package/lib/modules/Product/types.js +4 -16
- package/lib/modules/Product/utils.js +32 -33
- package/lib/modules/ProductList/index.js +141 -161
- package/lib/modules/ProductList/types.js +9 -31
- package/lib/modules/Quotation/index.js +66 -100
- package/lib/modules/Quotation/types.js +4 -16
- package/lib/modules/Resource/index.js +27 -59
- package/lib/modules/Resource/types.js +22 -32
- package/lib/modules/Resource/utils.js +30 -38
- package/lib/modules/ResourcePlanner/index.js +25 -23
- package/lib/modules/ResourcePlanner/localClock.js +54 -119
- package/lib/modules/ResourcePlanner/planner.js +591 -772
- package/lib/modules/ResourcePlanner/types.js +10 -29
- package/lib/modules/Rules/index.js +1224 -963
- package/lib/modules/Rules/types.js +17 -40
- package/lib/modules/SalesSummary/index.js +80 -89
- package/lib/modules/SalesSummary/types.js +4 -16
- package/lib/modules/SalesSummary/utils.js +359 -442
- package/lib/modules/ScanOrderLogger/index.js +59 -79
- package/lib/modules/ScanOrderLogger/providers/feishu.js +54 -78
- package/lib/modules/ScanOrderLogger/providers/grafana.js +13 -36
- package/lib/modules/ScanOrderLogger/types.js +4 -16
- package/lib/modules/Schedule/getDateIsInSchedule.js +334 -163
- package/lib/modules/Schedule/index.js +100 -114
- package/lib/modules/Schedule/type.js +4 -16
- package/lib/modules/Schedule/types.js +4 -16
- package/lib/modules/Schedule/utils.js +433 -291
- package/lib/modules/Step/index.js +40 -52
- package/lib/modules/Step/tyeps.js +4 -16
- package/lib/modules/Summary/index.js +66 -71
- package/lib/modules/Summary/types.js +4 -16
- package/lib/modules/Summary/utils.js +773 -418
- package/lib/modules/SurchargeList/index.js +46 -60
- package/lib/modules/SurchargeList/types.js +4 -16
- package/lib/modules/index.js +245 -63
- package/lib/plugins/app.js +4 -16
- package/lib/plugins/index.js +36 -25
- package/lib/plugins/request.js +137 -126
- package/lib/plugins/shopStore.js +4 -16
- package/lib/plugins/user.js +4 -16
- package/lib/plugins/window.js +171 -179
- package/lib/server/index.d.ts +11 -0
- package/lib/server/index.js +3432 -2757
- package/lib/server/modules/floor-plan/index.js +102 -123
- package/lib/server/modules/floor-plan/types.js +15 -30
- package/lib/server/modules/index.js +106 -68
- package/lib/server/modules/menu/index.js +146 -122
- package/lib/server/modules/menu/types.js +18 -31
- package/lib/server/modules/order/index.d.ts +8 -0
- package/lib/server/modules/order/index.js +781 -956
- package/lib/server/modules/order/types.js +122 -33
- package/lib/server/modules/order/utils/filterBookings.js +219 -194
- package/lib/server/modules/order/utils/filterOrders.js +118 -92
- package/lib/server/modules/payment/index.js +59 -83
- package/lib/server/modules/payment/types.js +4 -16
- package/lib/server/modules/products/index.js +575 -459
- package/lib/server/modules/products/types.js +44 -34
- package/lib/server/modules/quotation/index.js +137 -172
- package/lib/server/modules/quotation/types.js +21 -31
- package/lib/server/modules/resource/index.js +213 -184
- package/lib/server/modules/resource/types.js +42 -33
- package/lib/server/modules/schedule/index.js +135 -123
- package/lib/server/modules/schedule/types.js +14 -21
- package/lib/server/modules/schedule/utils.js +334 -163
- package/lib/server/types.js +4 -16
- package/lib/server/utils/index.js +25 -23
- package/lib/server/utils/product.js +196 -139
- package/lib/server/utils/schedule.js +34 -41
- package/lib/server/utils/small-ticket.d.ts +9 -1
- package/lib/server/utils/small-ticket.js +565 -470
- package/lib/server/utils/time.js +40 -49
- package/lib/solution/BaseSales/index.d.ts +7 -0
- package/lib/solution/BaseSales/index.js +1385 -1503
- package/lib/solution/BaseSales/types.d.ts +2 -0
- package/lib/solution/BaseSales/types.js +42 -38
- package/lib/solution/BaseSales/utils/cartPromotion.d.ts +5 -0
- package/lib/solution/BaseSales/utils/cartPromotion.js +652 -498
- package/lib/solution/BaseSales/utils/parseSalesResponse.js +85 -105
- package/lib/solution/BaseSales/utils/quotationPrice.js +56 -114
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +3 -0
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +138 -180
- package/lib/solution/BaseSales/utils.js +161 -143
- package/lib/solution/BookingByStep/index.d.ts +2 -2
- package/lib/solution/BookingByStep/index.js +1527 -1340
- package/lib/solution/BookingByStep/types.js +40 -99
- package/lib/solution/BookingByStep/utils/capacity.js +192 -160
- package/lib/solution/BookingByStep/utils/products.js +42 -52
- package/lib/solution/BookingByStep/utils/resources.js +527 -330
- package/lib/solution/BookingByStep/utils/stock.js +65 -44
- package/lib/solution/BookingByStep/utils/timeslots.js +129 -131
- package/lib/solution/BookingTicket/index.d.ts +14 -19
- package/lib/solution/BookingTicket/index.js +663 -526
- package/lib/solution/BookingTicket/types.js +99 -77
- package/lib/solution/BookingTicket/utils/addProductDecision.js +229 -190
- package/lib/solution/BookingTicket/utils/addTimeAvailability.js +58 -89
- package/lib/solution/BookingTicket/utils/bookingStatus.js +107 -78
- package/lib/solution/BookingTicket/utils/cartView.js +114 -99
- package/lib/solution/BookingTicket/utils/exampleData.js +185 -0
- package/lib/solution/BookingTicket/utils/orderCustomer.js +18 -41
- package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.js +219 -86
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +168 -116
- package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +79 -91
- package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.js +54 -41
- package/lib/solution/BookingTicket/utils/scan/handleScan.js +84 -81
- package/lib/solution/BookingTicket/utils/scan/index.js +98 -104
- package/lib/solution/BookingTicket/utils/scan/scanCache.js +90 -43
- package/lib/solution/BookingTicket/utils/scan/scanProductValues.js +52 -64
- package/lib/solution/BookingTicket/utils/sessionCatalogStale.js +56 -58
- package/lib/solution/BookingTicket/utils/weighingProductSku.js +34 -48
- package/lib/solution/BuyTickets/index.js +67 -70
- package/lib/solution/BuyTickets/types.js +22 -38
- package/lib/solution/Checkout/index.js +1451 -1158
- package/lib/solution/Checkout/types.js +91 -61
- package/lib/solution/Checkout/utils/index.js +228 -156
- package/lib/solution/PlaceOrder/index.js +55 -0
- package/lib/solution/RegisterAndLogin/config.js +493 -460
- package/lib/solution/RegisterAndLogin/index.js +633 -630
- package/lib/solution/RegisterAndLogin/types.js +189 -76
- package/lib/solution/RegisterAndLogin/utils.js +183 -125
- package/lib/solution/Sales/index.d.ts +20 -4
- package/lib/solution/Sales/index.js +502 -330
- package/lib/solution/Sales/types.d.ts +10 -0
- package/lib/solution/Sales/types.js +27 -33
- package/lib/solution/ScanOrder/index.js +822 -852
- package/lib/solution/ScanOrder/types.d.ts +2 -0
- package/lib/solution/ScanOrder/types.js +33 -34
- package/lib/solution/ScanOrder/utils.js +412 -374
- package/lib/solution/ShopDiscount/index.js +226 -232
- package/lib/solution/ShopDiscount/types.js +15 -37
- package/lib/solution/ShopDiscount/utils.js +300 -172
- package/lib/solution/UnifiedBookingSales/index.d.ts +5 -4
- package/lib/solution/UnifiedBookingSales/index.js +1087 -1222
- package/lib/solution/UnifiedBookingSales/remoteOccupancyCache.js +99 -159
- package/lib/solution/UnifiedBookingSales/types.d.ts +7 -1
- package/lib/solution/UnifiedBookingSales/types.js +10 -32
- package/lib/solution/VenueBooking/index.js +811 -879
- package/lib/solution/VenueBooking/types.js +19 -39
- package/lib/solution/VenueBooking/utils/dateSummary.js +27 -56
- package/lib/solution/VenueBooking/utils/resource.js +31 -54
- package/lib/solution/VenueBooking/utils/slotMerge.js +94 -107
- package/lib/solution/VenueBooking/utils/timeSlot.js +132 -132
- package/lib/solution/VenueBooking/utils.js +130 -67
- package/lib/solution/index.js +124 -41
- package/lib/store/createStore.js +32 -29
- package/lib/types/index.js +4 -16
- package/lib/utils/payment-number.js +26 -46
- package/lib/utils/task.js +36 -36
- package/lib/utils/watch.js +81 -47
- package/package.json +2 -1
|
@@ -37,7 +37,7 @@ import { isNormalProduct } from "../Product/utils";
|
|
|
37
37
|
import dayjs from 'dayjs';
|
|
38
38
|
import { ensureOrderPaymentNumber, mergeOrderPaymentRecord, resolveOrderPaymentIdentity } from "./payment-utils";
|
|
39
39
|
import { resolvePaymentNumberDevicePrefix, resolvePaymentNumberDevicePrefixFromDeviceId } from "../../utils/payment-number";
|
|
40
|
-
import { processCartPromotion, appendPromotionTags as _appendPromotionTags, getOrderProductUid as getPromotionUid } from "../../solution/BaseSales/utils/cartPromotion";
|
|
40
|
+
import { processCartPromotion, appendPromotionTags as _appendPromotionTags, getOrderProductUid as getPromotionUid, PRODUCT_LINE_MERGE_DISABLED_METADATA_KEY } from "../../solution/BaseSales/utils/cartPromotion";
|
|
41
41
|
import { buildProductLineFingerprint, getProductIdentityIndex, getSafeProductNum, isIdentityMatch, normalizeOrderProduct } from "../../solution/ScanOrder/utils";
|
|
42
42
|
import { hasManualProductDiscountFlag, syncManualProductDiscountProductNum } from "./utils/manualProductDiscount";
|
|
43
43
|
import { expandHydratedProductsForDiscountCollection, restoreHydratedBundleDiscounts } from "./utils/bundleDiscountHydration";
|
|
@@ -1584,21 +1584,32 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1584
1584
|
return Decimal.max(new Decimal(Number(amount) || 0), 0).toDecimalPlaces(2).toFixed(2);
|
|
1585
1585
|
}
|
|
1586
1586
|
}, {
|
|
1587
|
-
key: "
|
|
1588
|
-
value: function
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1587
|
+
key: "normalizeDepositFlag",
|
|
1588
|
+
value: function normalizeDepositFlag(value) {
|
|
1589
|
+
if (value === 0 || value === '0') return 0;
|
|
1590
|
+
if (value === 1 || value === '1') return 1;
|
|
1591
|
+
return null;
|
|
1592
|
+
}
|
|
1593
|
+
}, {
|
|
1594
|
+
key: "getHistoricalDepositSnapshot",
|
|
1595
|
+
value: function getHistoricalDepositSnapshot(source) {
|
|
1596
|
+
var _record$deposit_amoun, _record$summary, _this$normalizeDeposi;
|
|
1597
|
+
if (!source || _typeof(source) !== 'object') return null;
|
|
1598
|
+
var record = source;
|
|
1599
|
+
var rawDepositAmount = (_record$deposit_amoun = record.deposit_amount) !== null && _record$deposit_amoun !== void 0 ? _record$deposit_amoun : (_record$summary = record.summary) === null || _record$summary === void 0 ? void 0 : _record$summary.deposit_amount;
|
|
1593
1600
|
var depositAmount = this.normalizeDepositAmount(rawDepositAmount !== null && rawDepositAmount !== void 0 ? rawDepositAmount : 0);
|
|
1594
|
-
|
|
1595
|
-
var isDeposit = Number(lastOrderInfo.is_deposit) === 1 || hasDepositAmount;
|
|
1596
|
-
if (!isDeposit || !hasDepositAmount) return null;
|
|
1601
|
+
if (!new Decimal(depositAmount).gt(0)) return null;
|
|
1597
1602
|
return {
|
|
1598
|
-
|
|
1603
|
+
// 兼容历史数据:旧快照缺少 is_deposit 时,沿用正定金金额的推导规则。
|
|
1604
|
+
isDeposit: (_this$normalizeDeposi = this.normalizeDepositFlag(record.is_deposit)) !== null && _this$normalizeDeposi !== void 0 ? _this$normalizeDeposi : 1,
|
|
1599
1605
|
depositAmount: depositAmount
|
|
1600
1606
|
};
|
|
1601
1607
|
}
|
|
1608
|
+
}, {
|
|
1609
|
+
key: "getLastOrderDepositSnapshot",
|
|
1610
|
+
value: function getLastOrderDepositSnapshot() {
|
|
1611
|
+
return this.getHistoricalDepositSnapshot(this.store.lastOrderInfo);
|
|
1612
|
+
}
|
|
1602
1613
|
}, {
|
|
1603
1614
|
key: "getLastOrderSubmitSnapshot",
|
|
1604
1615
|
value: function getLastOrderSubmitSnapshot() {
|
|
@@ -1645,7 +1656,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1645
1656
|
})
|
|
1646
1657
|
});
|
|
1647
1658
|
tempOrder.deposit_amount = snapshot.depositAmount;
|
|
1648
|
-
tempOrder.is_deposit =
|
|
1659
|
+
tempOrder.is_deposit = snapshot.isDeposit;
|
|
1649
1660
|
return nextSummary;
|
|
1650
1661
|
}
|
|
1651
1662
|
}, {
|
|
@@ -2355,6 +2366,9 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2355
2366
|
}, {
|
|
2356
2367
|
key: "restoreOriginalSnapshotIfProductsUnchanged",
|
|
2357
2368
|
value: function restoreOriginalSnapshotIfProductsUnchanged(tempOrder, snapshot) {
|
|
2369
|
+
var _historicalDepositSna;
|
|
2370
|
+
// merge hydrate 的商品集合包含本地未提交行,但 summary 仍来自远端旧订单,不能复用。
|
|
2371
|
+
if (snapshot.requiresFullSummaryRecalculation === true) return null;
|
|
2358
2372
|
var currentFingerprint = this.buildOrderProductsFingerprint(tempOrder.products);
|
|
2359
2373
|
var manualDepositOverride = this.getManualDepositOverride(tempOrder);
|
|
2360
2374
|
if (currentFingerprint !== snapshot.productFingerprint) {
|
|
@@ -2364,10 +2378,17 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2364
2378
|
}
|
|
2365
2379
|
var summary = _objectSpread(_objectSpread({}, createEmptySummary()), cloneDeep(snapshot.summary || {}));
|
|
2366
2380
|
var shouldUseManualDepositOverride = Boolean(manualDepositOverride && manualDepositOverride.productStructuralFingerprint === this.buildOrderProductsStructuralFingerprint(tempOrder.products));
|
|
2381
|
+
var historicalDepositSnapshot = this.getHistoricalDepositSnapshot(snapshot);
|
|
2367
2382
|
if (shouldUseManualDepositOverride) {
|
|
2368
2383
|
summary = this.applyDepositAmountToSummary(tempOrder, summary, manualDepositOverride.amount);
|
|
2369
|
-
} else
|
|
2370
|
-
|
|
2384
|
+
} else {
|
|
2385
|
+
if (manualDepositOverride) {
|
|
2386
|
+
this.clearManualDepositOverride(tempOrder);
|
|
2387
|
+
}
|
|
2388
|
+
if (historicalDepositSnapshot) {
|
|
2389
|
+
summary = this.applyDepositAmountToSummary(tempOrder, summary, historicalDepositSnapshot.depositAmount);
|
|
2390
|
+
tempOrder.is_deposit = historicalDepositSnapshot.isDeposit;
|
|
2391
|
+
}
|
|
2371
2392
|
}
|
|
2372
2393
|
var isPayableAmountUnchanged = this.isSnapshotPayableAmountUnchanged(tempOrder, snapshot, summary);
|
|
2373
2394
|
if (!isPayableAmountUnchanged) return null;
|
|
@@ -2384,8 +2405,8 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2384
2405
|
tempOrder.surcharges = cloneDeep(snapshot.surcharges);
|
|
2385
2406
|
}
|
|
2386
2407
|
tempOrder.surcharge_fee = summary.surcharge_fee || tempOrder.surcharge_fee;
|
|
2387
|
-
tempOrder.deposit_amount = summary.deposit_amount ||
|
|
2388
|
-
tempOrder.is_deposit =
|
|
2408
|
+
tempOrder.deposit_amount = this.normalizeDepositAmount(summary.deposit_amount || 0);
|
|
2409
|
+
tempOrder.is_deposit = shouldUseManualDepositOverride ? new Decimal(tempOrder.deposit_amount).gt(0) ? 1 : 0 : (_historicalDepositSna = historicalDepositSnapshot === null || historicalDepositSnapshot === void 0 ? void 0 : historicalDepositSnapshot.isDeposit) !== null && _historicalDepositSna !== void 0 ? _historicalDepositSna : new Decimal(tempOrder.deposit_amount).gt(0) ? 1 : 0;
|
|
2389
2410
|
var previousSummary = this.store.summary;
|
|
2390
2411
|
this.store.summary = summary;
|
|
2391
2412
|
this.updateTempOrderPaymentStatus(tempOrder, {
|
|
@@ -3047,7 +3068,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3047
3068
|
var isExistingDepositDisabled = tempOrder.is_deposit === 0 && new Decimal(tempOrder.deposit_amount || 0).gt(0);
|
|
3048
3069
|
tempOrder.deposit_amount = depositAmount;
|
|
3049
3070
|
tempOrder.is_deposit = hasDepositAmount && !isExistingDepositDisabled ? 1 : 0;
|
|
3050
|
-
return this.applyLastOrderDepositSnapshot(tempOrder, nextSummary);
|
|
3071
|
+
return shouldUseManualDepositOverride ? nextSummary : this.applyLastOrderDepositSnapshot(tempOrder, nextSummary);
|
|
3051
3072
|
}
|
|
3052
3073
|
}, {
|
|
3053
3074
|
key: "recalculateSummary",
|
|
@@ -4168,9 +4189,13 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4168
4189
|
booking: booking
|
|
4169
4190
|
}) : null;
|
|
4170
4191
|
var productToAdd = (linked === null || linked === void 0 ? void 0 : linked.product) || product;
|
|
4192
|
+
var disableMerge = (options === null || options === void 0 ? void 0 : options.disableMerge) === true;
|
|
4171
4193
|
this.assertAndLockProductSettlement(tempOrder, productToAdd);
|
|
4172
|
-
var incomingFingerprint = buildProductLineFingerprint(getProductSkuOptions(productToAdd), productToAdd.product_bundle);
|
|
4194
|
+
var incomingFingerprint = disableMerge ? '' : buildProductLineFingerprint(getProductSkuOptions(productToAdd), productToAdd.product_bundle);
|
|
4173
4195
|
var normalizedIncoming = this.normalizeVirtualSettlementProductIfEnabled(mergeOrderProductDisplayFields(productToAdd, normalizeOrderProduct(productToAdd)));
|
|
4196
|
+
if (disableMerge) {
|
|
4197
|
+
normalizedIncoming.metadata = _objectSpread(_objectSpread({}, normalizedIncoming.metadata || {}), {}, _defineProperty({}, PRODUCT_LINE_MERGE_DISABLED_METADATA_KEY, true));
|
|
4198
|
+
}
|
|
4174
4199
|
var isWeighingProduct = Number(((_normalizedIncoming$p = normalizedIncoming.product_sku) === null || _normalizedIncoming$p === void 0 ? void 0 : _normalizedIncoming$p.open_sold_weight) || 0) === 1;
|
|
4175
4200
|
var netWeight = Number((_normalizedIncoming$p2 = normalizedIncoming.product_sku) === null || _normalizedIncoming$p2 === void 0 ? void 0 : _normalizedIncoming$p2.net_weight);
|
|
4176
4201
|
if (isWeighingProduct && (!Number.isFinite(netWeight) || netWeight <= 0)) {
|
|
@@ -4189,7 +4214,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4189
4214
|
var hasIncomingManualProductDiscount = isManualProductDiscountProduct(normalizedIncoming);
|
|
4190
4215
|
var hasIncomingBookingUid = this.hasLinkedBookingUid(productToAdd) || this.hasLinkedBookingUid(normalizedIncoming);
|
|
4191
4216
|
var isIncomingCustomItem = ((_productToAdd$metadat = productToAdd.metadata) === null || _productToAdd$metadat === void 0 || (_productToAdd$metadat = _productToAdd$metadat.origin) === null || _productToAdd$metadat === void 0 ? void 0 : _productToAdd$metadat.isCustomItem) === true || ((_origin = productToAdd._origin) === null || _origin === void 0 ? void 0 : _origin.isCustomItem) === true;
|
|
4192
|
-
var shouldForceNewLine = !!booking || hasIncomingProductNote || hasIncomingManualProductDiscount || hasIncomingBookingUid || isIncomingCustomItem || isWeighingProduct;
|
|
4217
|
+
var shouldForceNewLine = disableMerge || !!booking || hasIncomingProductNote || hasIncomingManualProductDiscount || hasIncomingBookingUid || isIncomingCustomItem || isWeighingProduct;
|
|
4193
4218
|
var matchedIndex = hasIncomingGoodPass || shouldForceNewLine ? -1 : tempOrder.products.findIndex(function (item) {
|
|
4194
4219
|
var _item$metadata3;
|
|
4195
4220
|
if (_this27.hasGoodPassDiscount(item)) return false;
|
|
@@ -4319,7 +4344,8 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4319
4344
|
singleLine.num = 1;
|
|
4320
4345
|
delete singleLine.product_quantity;
|
|
4321
4346
|
_appendResult = this.appendProductLineToTempOrder(tempOrder, singleLine, cloneDeep(booking), {
|
|
4322
|
-
insertAtIndex: insertAtIndex
|
|
4347
|
+
insertAtIndex: insertAtIndex,
|
|
4348
|
+
disableMerge: options === null || options === void 0 ? void 0 : options.disableMerge
|
|
4323
4349
|
});
|
|
4324
4350
|
if (!_appendResult) {
|
|
4325
4351
|
_context21.next = 17;
|
|
@@ -4340,7 +4366,8 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4340
4366
|
return _context21.abrupt("return", tempOrder.products);
|
|
4341
4367
|
case 24:
|
|
4342
4368
|
appendResult = this.appendProductLineToTempOrder(tempOrder, product, booking, {
|
|
4343
|
-
insertAtIndex: insertAtIndex
|
|
4369
|
+
insertAtIndex: insertAtIndex,
|
|
4370
|
+
disableMerge: options === null || options === void 0 ? void 0 : options.disableMerge
|
|
4344
4371
|
});
|
|
4345
4372
|
if (!appendResult) {
|
|
4346
4373
|
_context21.next = 28;
|
|
@@ -5512,7 +5539,6 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5512
5539
|
includePaymentStatus: !isOnlineStorePlatform,
|
|
5513
5540
|
enhance: enhancePayload
|
|
5514
5541
|
});
|
|
5515
|
-
console.log('[Order.runSubmitTempOrder.payload]', payload);
|
|
5516
5542
|
if (params !== null && params !== void 0 && params.syncMode) {
|
|
5517
5543
|
payload.sync_mode = true;
|
|
5518
5544
|
}
|
|
@@ -5520,10 +5546,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5520
5546
|
if (!payload.created_at) {
|
|
5521
5547
|
payload.created_at = dayjs().format('YYYY-MM-DD HH:mm:ss');
|
|
5522
5548
|
}
|
|
5523
|
-
_context36.next =
|
|
5549
|
+
_context36.next = 27;
|
|
5524
5550
|
return this.saveDraft();
|
|
5525
|
-
case
|
|
5526
|
-
_context36.prev =
|
|
5551
|
+
case 27:
|
|
5552
|
+
_context36.prev = 27;
|
|
5527
5553
|
this.logInfo('submitTempOrder calling sales checkout', {
|
|
5528
5554
|
orderId: payload.order_id,
|
|
5529
5555
|
externalSaleNumber: payload.external_sale_number,
|
|
@@ -5533,26 +5559,26 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5533
5559
|
smallTicketDataFlag: payload.small_ticket_data_flag,
|
|
5534
5560
|
syncMode: payload.sync_mode
|
|
5535
5561
|
});
|
|
5536
|
-
_context36.next =
|
|
5562
|
+
_context36.next = 31;
|
|
5537
5563
|
return this.submitSalesOrder({
|
|
5538
5564
|
query: payload
|
|
5539
5565
|
});
|
|
5540
|
-
case
|
|
5566
|
+
case 31:
|
|
5541
5567
|
result = _context36.sent;
|
|
5542
|
-
_context36.next =
|
|
5568
|
+
_context36.next = 44;
|
|
5543
5569
|
break;
|
|
5544
|
-
case
|
|
5545
|
-
_context36.prev =
|
|
5546
|
-
_context36.t2 = _context36["catch"](
|
|
5570
|
+
case 34:
|
|
5571
|
+
_context36.prev = 34;
|
|
5572
|
+
_context36.t2 = _context36["catch"](27);
|
|
5547
5573
|
backendErrorResponse = this.extractSubmitErrorResponse(_context36.t2);
|
|
5548
5574
|
if (!backendErrorResponse) {
|
|
5549
|
-
_context36.next =
|
|
5575
|
+
_context36.next = 41;
|
|
5550
5576
|
break;
|
|
5551
5577
|
}
|
|
5552
5578
|
this.store.syncState = 'failed';
|
|
5553
5579
|
this.logSubmitBackendRejected(backendErrorResponse, payload);
|
|
5554
5580
|
return _context36.abrupt("return", backendErrorResponse);
|
|
5555
|
-
case
|
|
5581
|
+
case 41:
|
|
5556
5582
|
this.store.syncState = 'failed';
|
|
5557
5583
|
this.logError('submitTempOrder failed', {
|
|
5558
5584
|
error: _context36.t2 instanceof Error ? _context36.t2.message : String(_context36.t2),
|
|
@@ -5562,15 +5588,15 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5562
5588
|
paymentsCount: ((_payload$payments2 = payload.payments) === null || _payload$payments2 === void 0 ? void 0 : _payload$payments2.length) || 0
|
|
5563
5589
|
});
|
|
5564
5590
|
throw _context36.t2;
|
|
5565
|
-
case
|
|
5591
|
+
case 44:
|
|
5566
5592
|
if (!this.isSubmitResponseRejected(result)) {
|
|
5567
|
-
_context36.next =
|
|
5593
|
+
_context36.next = 48;
|
|
5568
5594
|
break;
|
|
5569
5595
|
}
|
|
5570
5596
|
this.store.syncState = 'failed';
|
|
5571
5597
|
this.logSubmitBackendRejected(result, payload);
|
|
5572
5598
|
return _context36.abrupt("return", result);
|
|
5573
|
-
case
|
|
5599
|
+
case 48:
|
|
5574
5600
|
submittedOrderId = this.extractOrderIdFromSubmitResult(result);
|
|
5575
5601
|
this.logInfo('runSubmitTempOrder: 提交成功', {
|
|
5576
5602
|
submittedOrderId: submittedOrderId,
|
|
@@ -5580,29 +5606,29 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5580
5606
|
})
|
|
5581
5607
|
});
|
|
5582
5608
|
if (!(submittedOrderId !== null && submittedOrderId !== undefined)) {
|
|
5583
|
-
_context36.next =
|
|
5609
|
+
_context36.next = 57;
|
|
5584
5610
|
break;
|
|
5585
5611
|
}
|
|
5586
5612
|
tempOrder.order_id = submittedOrderId;
|
|
5587
5613
|
resultRecord = result;
|
|
5588
|
-
_context36.next =
|
|
5614
|
+
_context36.next = 55;
|
|
5589
5615
|
return this.markLocalOrderSynced(submittedOrderId, (resultRecord === null || resultRecord === void 0 ? void 0 : resultRecord.data) || resultRecord || {});
|
|
5590
|
-
case
|
|
5591
|
-
_context36.next =
|
|
5616
|
+
case 55:
|
|
5617
|
+
_context36.next = 58;
|
|
5592
5618
|
break;
|
|
5593
|
-
case
|
|
5619
|
+
case 57:
|
|
5594
5620
|
if (this.isLocalPendingSubmitResult(result)) {
|
|
5595
5621
|
this.store.syncState = 'local';
|
|
5596
5622
|
} else {
|
|
5597
5623
|
this.store.syncState = 'submitted';
|
|
5598
5624
|
}
|
|
5599
|
-
case
|
|
5625
|
+
case 58:
|
|
5600
5626
|
return _context36.abrupt("return", result);
|
|
5601
|
-
case
|
|
5627
|
+
case 59:
|
|
5602
5628
|
case "end":
|
|
5603
5629
|
return _context36.stop();
|
|
5604
5630
|
}
|
|
5605
|
-
}, _callee33, this, [[
|
|
5631
|
+
}, _callee33, this, [[27, 34]]);
|
|
5606
5632
|
}));
|
|
5607
5633
|
function runSubmitTempOrder(_x39) {
|
|
5608
5634
|
return _runSubmitTempOrder.apply(this, arguments);
|
|
@@ -5707,7 +5733,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5707
5733
|
var _syncPaymentsToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35(params) {
|
|
5708
5734
|
var _this32 = this,
|
|
5709
5735
|
_params$confirmPendin;
|
|
5710
|
-
var tempOrder, needsPaymentNumber, devicePrefix, mappedPayments, shouldConfirmPendingVoucherPayments, effectivePayments, completion, orderPaidPaymentTotal, paymentStatus, paymentSyncIdempotencyToken, submitParams, submitResult;
|
|
5736
|
+
var tempOrder, needsPaymentNumber, devicePrefix, mappedPayments, shouldConfirmPendingVoucherPayments, effectivePayments, completion, orderPaidPaymentTotal, paymentStatus, paymentSyncIdempotencyToken, enhancePayload, submitParams, submitResult;
|
|
5711
5737
|
return _regeneratorRuntime().wrap(function _callee35$(_context38) {
|
|
5712
5738
|
while (1) switch (_context38.prev = _context38.next) {
|
|
5713
5739
|
case 0:
|
|
@@ -5760,6 +5786,12 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5760
5786
|
case 25:
|
|
5761
5787
|
this.store.syncState = 'submitting';
|
|
5762
5788
|
paymentSyncIdempotencyToken = this.buildPaymentSyncIdempotencyToken(tempOrder, effectivePayments);
|
|
5789
|
+
enhancePayload = function enhancePayload(payload, ctx) {
|
|
5790
|
+
var enhancedPayload = params.enhancePayload ? params.enhancePayload(payload, ctx) : payload;
|
|
5791
|
+
return _objectSpread(_objectSpread({}, enhancedPayload), {}, {
|
|
5792
|
+
request_unique_idempotency_token: paymentSyncIdempotencyToken
|
|
5793
|
+
});
|
|
5794
|
+
};
|
|
5763
5795
|
submitParams = {
|
|
5764
5796
|
payments: effectivePayments,
|
|
5765
5797
|
paymentStatus: paymentStatus,
|
|
@@ -5767,34 +5799,29 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5767
5799
|
businessCode: params.businessCode,
|
|
5768
5800
|
channel: params.channel,
|
|
5769
5801
|
confirmPendingVoucherPayments: true,
|
|
5770
|
-
enhancePayload:
|
|
5771
|
-
var nextPayload = _objectSpread(_objectSpread({}, payload), {}, {
|
|
5772
|
-
request_unique_idempotency_token: paymentSyncIdempotencyToken
|
|
5773
|
-
});
|
|
5774
|
-
return nextPayload;
|
|
5775
|
-
}
|
|
5802
|
+
enhancePayload: enhancePayload
|
|
5776
5803
|
};
|
|
5777
5804
|
if (!(params.checkoutSyncTaskEnabled === false)) {
|
|
5778
|
-
_context38.next =
|
|
5805
|
+
_context38.next = 35;
|
|
5779
5806
|
break;
|
|
5780
5807
|
}
|
|
5781
|
-
_context38.next =
|
|
5808
|
+
_context38.next = 32;
|
|
5782
5809
|
return this.submitTempOrderAsync(submitParams);
|
|
5783
|
-
case
|
|
5810
|
+
case 32:
|
|
5784
5811
|
_context38.t1 = _context38.sent;
|
|
5785
|
-
_context38.next =
|
|
5812
|
+
_context38.next = 38;
|
|
5786
5813
|
break;
|
|
5787
|
-
case
|
|
5788
|
-
_context38.next =
|
|
5814
|
+
case 35:
|
|
5815
|
+
_context38.next = 37;
|
|
5789
5816
|
return this.submitTempOrder(submitParams);
|
|
5790
|
-
case 36:
|
|
5791
|
-
_context38.t1 = _context38.sent;
|
|
5792
5817
|
case 37:
|
|
5818
|
+
_context38.t1 = _context38.sent;
|
|
5819
|
+
case 38:
|
|
5793
5820
|
submitResult = _context38.t1;
|
|
5794
5821
|
return _context38.abrupt("return", _objectSpread(_objectSpread({}, completion), {}, {
|
|
5795
5822
|
submitResult: submitResult
|
|
5796
5823
|
}));
|
|
5797
|
-
case
|
|
5824
|
+
case 40:
|
|
5798
5825
|
case "end":
|
|
5799
5826
|
return _context38.stop();
|
|
5800
5827
|
}
|
|
@@ -6030,8 +6057,8 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
6030
6057
|
key: "createOrderByCheckout",
|
|
6031
6058
|
value: (function () {
|
|
6032
6059
|
var _createOrderByCheckout = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39(params) {
|
|
6033
|
-
var _params$payments, _params$bookings2, _params$relation_prod2, _params$payments2, _params$payments3
|
|
6034
|
-
var onlineStorePaymentCodeList, _orderData$payments, _orderData$bookings, _orderData$relation_p, _orderData$payments2, _orderData$payments3,
|
|
6060
|
+
var _params$payments, _params$bookings2, _params$relation_prod2, _params$payments2, _params$payments3;
|
|
6061
|
+
var onlineStorePaymentCodeList, _orderData$payments, _orderData$bookings, _orderData$relation_p, _orderData$payments2, _orderData$payments3, orderData, response;
|
|
6035
6062
|
return _regeneratorRuntime().wrap(function _callee39$(_context42) {
|
|
6036
6063
|
while (1) switch (_context42.prev = _context42.next) {
|
|
6037
6064
|
case 0:
|
|
@@ -6058,16 +6085,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
6058
6085
|
return p.code;
|
|
6059
6086
|
})) || []
|
|
6060
6087
|
});
|
|
6061
|
-
|
|
6062
|
-
type: params.type,
|
|
6063
|
-
platform: params.platform,
|
|
6064
|
-
is_deposit: params.is_deposit,
|
|
6065
|
-
customer_id: params.customer_id,
|
|
6066
|
-
bookingsCount: ((_params$bookings3 = params.bookings) === null || _params$bookings3 === void 0 ? void 0 : _params$bookings3.length) || 0,
|
|
6067
|
-
relationProductsCount: ((_params$relation_prod3 = params.relation_products) === null || _params$relation_prod3 === void 0 ? void 0 : _params$relation_prod3.length) || 0,
|
|
6068
|
-
paymentsCount: ((_params$payments4 = params.payments) === null || _params$payments4 === void 0 ? void 0 : _params$payments4.length) || 0
|
|
6069
|
-
});
|
|
6070
|
-
_context42.prev = 4;
|
|
6088
|
+
_context42.prev = 3;
|
|
6071
6089
|
// 构建订单数据,设置默认值并允许 params 覆盖
|
|
6072
6090
|
orderData = _objectSpread({
|
|
6073
6091
|
sales_channel: 'my_pisel',
|
|
@@ -6089,20 +6107,6 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
6089
6107
|
if (!params.order_id && !orderData.schedule_date) {
|
|
6090
6108
|
orderData.schedule_date = dayjs().format('YYYY-MM-DD HH:mm:ss');
|
|
6091
6109
|
}
|
|
6092
|
-
console.log('[Order] 调用后端接口创建订单:', {
|
|
6093
|
-
url: '/shop/order/checkout',
|
|
6094
|
-
orderType: orderData.type,
|
|
6095
|
-
platform: orderData.platform,
|
|
6096
|
-
isDeposit: orderData.is_deposit,
|
|
6097
|
-
customerId: orderData.customer_id,
|
|
6098
|
-
bookingsCount: ((_orderData$bookings = orderData.bookings) === null || _orderData$bookings === void 0 ? void 0 : _orderData$bookings.length) || 0,
|
|
6099
|
-
relationProductsCount: ((_orderData$relation_p = orderData.relation_products) === null || _orderData$relation_p === void 0 ? void 0 : _orderData$relation_p.length) || 0,
|
|
6100
|
-
paymentsCount: ((_orderData$payments2 = orderData.payments) === null || _orderData$payments2 === void 0 ? void 0 : _orderData$payments2.length) || 0,
|
|
6101
|
-
paymentsMethods: ((_orderData$payments3 = orderData.payments) === null || _orderData$payments3 === void 0 ? void 0 : _orderData$payments3.map(function (p) {
|
|
6102
|
-
return p.code;
|
|
6103
|
-
})) || []
|
|
6104
|
-
});
|
|
6105
|
-
|
|
6106
6110
|
// 记录接口调用详情
|
|
6107
6111
|
this.logInfo('Calling backend checkout API', {
|
|
6108
6112
|
url: '/shop/order/checkout',
|
|
@@ -6111,10 +6115,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
6111
6115
|
isDeposit: orderData.is_deposit,
|
|
6112
6116
|
customerId: orderData.customer_id,
|
|
6113
6117
|
depositAmount: orderData.deposit_amount,
|
|
6114
|
-
bookingsCount: ((_orderData$
|
|
6115
|
-
relationProductsCount: ((_orderData$
|
|
6116
|
-
paymentsCount: ((_orderData$
|
|
6117
|
-
paymentMethods: ((_orderData$
|
|
6118
|
+
bookingsCount: ((_orderData$bookings = orderData.bookings) === null || _orderData$bookings === void 0 ? void 0 : _orderData$bookings.length) || 0,
|
|
6119
|
+
relationProductsCount: ((_orderData$relation_p = orderData.relation_products) === null || _orderData$relation_p === void 0 ? void 0 : _orderData$relation_p.length) || 0,
|
|
6120
|
+
paymentsCount: ((_orderData$payments2 = orderData.payments) === null || _orderData$payments2 === void 0 ? void 0 : _orderData$payments2.length) || 0,
|
|
6121
|
+
paymentMethods: ((_orderData$payments3 = orderData.payments) === null || _orderData$payments3 === void 0 ? void 0 : _orderData$payments3.map(function (p) {
|
|
6118
6122
|
return {
|
|
6119
6123
|
code: p.code,
|
|
6120
6124
|
amount: p.amount,
|
|
@@ -6129,34 +6133,30 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
6129
6133
|
hasOrderId: !!orderData.order_id,
|
|
6130
6134
|
smallTicketDataFlag: orderData.small_ticket_data_flag
|
|
6131
6135
|
});
|
|
6132
|
-
_context42.next =
|
|
6136
|
+
_context42.next = 10;
|
|
6133
6137
|
return this.request.post('/order/checkout', orderData, {
|
|
6134
6138
|
osServer: true,
|
|
6135
6139
|
customToast: function customToast() {}
|
|
6136
6140
|
});
|
|
6137
|
-
case
|
|
6141
|
+
case 10:
|
|
6138
6142
|
response = _context42.sent;
|
|
6139
6143
|
this.logInfo('Order API called successfully', {
|
|
6140
6144
|
response: response
|
|
6141
6145
|
});
|
|
6142
|
-
console.log('[Order] 订单创建成功,后端响应:', {
|
|
6143
|
-
success: !!response,
|
|
6144
|
-
hasOrderId: !!(response !== null && response !== void 0 && (_response$data = response.data) !== null && _response$data !== void 0 && _response$data.order_id || response !== null && response !== void 0 && response.order_id)
|
|
6145
|
-
});
|
|
6146
6146
|
return _context42.abrupt("return", response);
|
|
6147
|
-
case
|
|
6148
|
-
_context42.prev =
|
|
6149
|
-
_context42.t0 = _context42["catch"](
|
|
6147
|
+
case 15:
|
|
6148
|
+
_context42.prev = 15;
|
|
6149
|
+
_context42.t0 = _context42["catch"](3);
|
|
6150
6150
|
console.error('[Order] createOrderByCheckout 创建订单失败:', _context42.t0);
|
|
6151
6151
|
this.logInfo('Order API called failed', {
|
|
6152
6152
|
error: _context42.t0 instanceof Error ? _context42.t0.message : String(_context42.t0)
|
|
6153
6153
|
});
|
|
6154
6154
|
throw _context42.t0;
|
|
6155
|
-
case
|
|
6155
|
+
case 20:
|
|
6156
6156
|
case "end":
|
|
6157
6157
|
return _context42.stop();
|
|
6158
6158
|
}
|
|
6159
|
-
}, _callee39, this, [[
|
|
6159
|
+
}, _callee39, this, [[3, 15]]);
|
|
6160
6160
|
}));
|
|
6161
6161
|
function createOrderByCheckout(_x46) {
|
|
6162
6162
|
return _createOrderByCheckout.apply(this, arguments);
|
|
@@ -6287,7 +6287,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
6287
6287
|
value: (function () {
|
|
6288
6288
|
var _hydrateTempOrderFromRecord = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(record, options) {
|
|
6289
6289
|
var _sourceRaw$_extend, _this$store$discount26;
|
|
6290
|
-
var sourceRaw, duplicateProductIdentityRepair, duplicateIdentityReadySource, identityReadySource, normalizedCollections, raw, hasIdentityChanges, identityLogMetadata, hasIdentityWarnings, isSessionStorageHydrate, nextTempOrder, _this$store$discount24, _this$store$discount25, restoredSessionDiscounts, nextExtend, sourceLastOrderInfo, isDraftOrder, syntheticIdentityOptions, rawSummary, summarySurcharges, hadSyntheticDraftOrderId, hydratedEditDiscounts, currentDiscounts, currentScanDiscounts, hydratedDiscountIds, retainedScanDiscounts, nextDiscounts, shouldSkipEmptyDiscountSync, _this$store$discount27, _this$store$discount28;
|
|
6290
|
+
var sourceRaw, duplicateProductIdentityRepair, duplicateIdentityReadySource, identityReadySource, normalizedCollections, raw, hasIdentityChanges, identityLogMetadata, hasIdentityWarnings, isSessionStorageHydrate, isMergedSalesDetailHydrate, nextTempOrder, _this$store$discount24, _this$store$discount25, restoredSessionDiscounts, nextExtend, sourceLastOrderInfo, isDraftOrder, syntheticIdentityOptions, rawSummary, historicalDepositSnapshot, summarySurcharges, hadSyntheticDraftOrderId, hydratedEditDiscounts, currentDiscounts, currentScanDiscounts, hydratedDiscountIds, retainedScanDiscounts, nextDiscounts, shouldSkipEmptyDiscountSync, _this$store$discount27, _this$store$discount28;
|
|
6291
6291
|
return _regeneratorRuntime().wrap(function _callee43$(_context46) {
|
|
6292
6292
|
while (1) switch (_context46.prev = _context46.next) {
|
|
6293
6293
|
case 0:
|
|
@@ -6322,12 +6322,14 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
6322
6322
|
}
|
|
6323
6323
|
}
|
|
6324
6324
|
isSessionStorageHydrate = (options === null || options === void 0 ? void 0 : options.source) === 'sessionStorage';
|
|
6325
|
+
isMergedSalesDetailHydrate = (options === null || options === void 0 ? void 0 : options.source) === 'mergedSalesDetail';
|
|
6325
6326
|
nextTempOrder = this.normalizeTempOrderForRuntime(raw, {
|
|
6326
|
-
|
|
6327
|
+
// merge 前已只给远端商品补标记;这里不能把本地未提交商品一并变成 saved item。
|
|
6328
|
+
makeEditMark: !isSessionStorageHydrate && !isMergedSalesDetailHydrate
|
|
6327
6329
|
});
|
|
6328
6330
|
this.store.tempOrder = nextTempOrder;
|
|
6329
6331
|
if (!isSessionStorageHydrate) {
|
|
6330
|
-
_context46.next =
|
|
6332
|
+
_context46.next = 30;
|
|
6331
6333
|
break;
|
|
6332
6334
|
}
|
|
6333
6335
|
// 会话快照是未提交购物车,不应获得编辑订单的 saved/edit 标记与服务端基线。
|
|
@@ -6343,24 +6345,24 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
6343
6345
|
nextTempOrder.discount_list = restoredSessionDiscounts;
|
|
6344
6346
|
this.store.summary = createEmptySummary();
|
|
6345
6347
|
this.store.lastOrderInfo = undefined;
|
|
6346
|
-
_context46.next =
|
|
6348
|
+
_context46.next = 23;
|
|
6347
6349
|
return (_this$store$discount24 = this.store.discount) === null || _this$store$discount24 === void 0 ? void 0 : _this$store$discount24.setOriginalDiscountList(cloneDeep(restoredSessionDiscounts));
|
|
6348
|
-
case
|
|
6349
|
-
_context46.next =
|
|
6350
|
+
case 23:
|
|
6351
|
+
_context46.next = 25;
|
|
6350
6352
|
return (_this$store$discount25 = this.store.discount) === null || _this$store$discount25 === void 0 ? void 0 : _this$store$discount25.setDiscountList(cloneDeep(restoredSessionDiscounts));
|
|
6351
|
-
case
|
|
6353
|
+
case 25:
|
|
6352
6354
|
if (!(options !== null && options !== void 0 && options.recalcOnHydrate)) {
|
|
6353
|
-
_context46.next =
|
|
6355
|
+
_context46.next = 28;
|
|
6354
6356
|
break;
|
|
6355
6357
|
}
|
|
6356
|
-
_context46.next =
|
|
6358
|
+
_context46.next = 28;
|
|
6357
6359
|
return this.recalculateSummary({
|
|
6358
6360
|
createIfMissing: false
|
|
6359
6361
|
});
|
|
6360
|
-
case
|
|
6362
|
+
case 28:
|
|
6361
6363
|
this.persistTempOrder();
|
|
6362
6364
|
return _context46.abrupt("return", nextTempOrder);
|
|
6363
|
-
case
|
|
6365
|
+
case 30:
|
|
6364
6366
|
// Server list compatibility may synthesize order_id from external_sale_number; tempOrder must not.
|
|
6365
6367
|
sourceLastOrderInfo = sourceRaw.lastOrderInfo || sourceRaw;
|
|
6366
6368
|
isDraftOrder = Number(nextTempOrder.is_draft_order || 0) === 1;
|
|
@@ -6369,6 +6371,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
6369
6371
|
externalSaleNumber: nextTempOrder.external_sale_number
|
|
6370
6372
|
};
|
|
6371
6373
|
rawSummary = raw.summary && _typeof(raw.summary) === 'object' ? raw.summary : {};
|
|
6374
|
+
historicalDepositSnapshot = this.getHistoricalDepositSnapshot(sourceLastOrderInfo);
|
|
6372
6375
|
summarySurcharges = Array.isArray(rawSummary.surcharges) ? rawSummary.surcharges.map(function (s) {
|
|
6373
6376
|
return _objectSpread({}, s || {});
|
|
6374
6377
|
}) : cloneDeep(nextTempOrder.surcharges || []);
|
|
@@ -6376,7 +6379,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
6376
6379
|
surcharges: summarySurcharges
|
|
6377
6380
|
});
|
|
6378
6381
|
nextTempOrder._extend = _objectSpread(_objectSpread({}, nextTempOrder._extend || {}), {}, {
|
|
6379
|
-
originalSalesSnapshot: {
|
|
6382
|
+
originalSalesSnapshot: _objectSpread(_objectSpread({
|
|
6380
6383
|
summary: cloneDeep(this.store.summary),
|
|
6381
6384
|
products: cloneDeep(nextTempOrder.products || []),
|
|
6382
6385
|
bookings: cloneDeep(nextTempOrder.bookings || []),
|
|
@@ -6384,7 +6387,12 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
6384
6387
|
surcharges: cloneDeep(nextTempOrder.surcharges || []),
|
|
6385
6388
|
shop_discount: nextTempOrder.shop_discount || '0.00',
|
|
6386
6389
|
productFingerprint: this.buildOrderProductsFingerprint(nextTempOrder.products || [])
|
|
6387
|
-
}
|
|
6390
|
+
}, historicalDepositSnapshot ? {
|
|
6391
|
+
is_deposit: historicalDepositSnapshot.isDeposit,
|
|
6392
|
+
deposit_amount: historicalDepositSnapshot.depositAmount
|
|
6393
|
+
} : {}), isMergedSalesDetailHydrate ? {
|
|
6394
|
+
requiresFullSummaryRecalculation: true
|
|
6395
|
+
} : {})
|
|
6388
6396
|
});
|
|
6389
6397
|
this.store.lastOrderInfo = this.withoutSyntheticDraftOrderIdForRuntime(sourceLastOrderInfo, syntheticIdentityOptions);
|
|
6390
6398
|
hadSyntheticDraftOrderId = this.isSyntheticDraftOrderIdForRuntime(raw, syntheticIdentityOptions) || this.isSyntheticDraftOrderIdForRuntime(sourceLastOrderInfo, syntheticIdentityOptions);
|
|
@@ -6405,28 +6413,28 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
6405
6413
|
nextDiscounts = [].concat(_toConsumableArray(hydratedEditDiscounts), _toConsumableArray(retainedScanDiscounts));
|
|
6406
6414
|
shouldSkipEmptyDiscountSync = nextDiscounts.length === 0 && currentDiscounts.length === 0;
|
|
6407
6415
|
if (shouldSkipEmptyDiscountSync) {
|
|
6408
|
-
_context46.next =
|
|
6416
|
+
_context46.next = 54;
|
|
6409
6417
|
break;
|
|
6410
6418
|
}
|
|
6411
6419
|
OrderModule.populateSavedAmounts(nextTempOrder.products, nextDiscounts);
|
|
6412
|
-
_context46.next = 50;
|
|
6413
|
-
return (_this$store$discount27 = this.store.discount) === null || _this$store$discount27 === void 0 ? void 0 : _this$store$discount27.setOriginalDiscountList(nextDiscounts);
|
|
6414
|
-
case 50:
|
|
6415
6420
|
_context46.next = 52;
|
|
6416
|
-
return (_this$store$
|
|
6421
|
+
return (_this$store$discount27 = this.store.discount) === null || _this$store$discount27 === void 0 ? void 0 : _this$store$discount27.setOriginalDiscountList(nextDiscounts);
|
|
6417
6422
|
case 52:
|
|
6423
|
+
_context46.next = 54;
|
|
6424
|
+
return (_this$store$discount28 = this.store.discount) === null || _this$store$discount28 === void 0 ? void 0 : _this$store$discount28.setDiscountList(nextDiscounts);
|
|
6425
|
+
case 54:
|
|
6418
6426
|
if (!(options !== null && options !== void 0 && options.recalcOnHydrate)) {
|
|
6419
|
-
_context46.next =
|
|
6427
|
+
_context46.next = 57;
|
|
6420
6428
|
break;
|
|
6421
6429
|
}
|
|
6422
|
-
_context46.next =
|
|
6430
|
+
_context46.next = 57;
|
|
6423
6431
|
return this.recalculateSummary({
|
|
6424
6432
|
createIfMissing: false
|
|
6425
6433
|
});
|
|
6426
|
-
case
|
|
6434
|
+
case 57:
|
|
6427
6435
|
this.persistTempOrder();
|
|
6428
6436
|
return _context46.abrupt("return", nextTempOrder);
|
|
6429
|
-
case
|
|
6437
|
+
case 59:
|
|
6430
6438
|
case "end":
|
|
6431
6439
|
return _context46.stop();
|
|
6432
6440
|
}
|
|
@@ -157,11 +157,13 @@ export interface OrderCustomerPatch {
|
|
|
157
157
|
* 下单客户变更事件 payload。
|
|
158
158
|
* - `patch`:tempOrder 上的协议字段视图(会随订单提交)
|
|
159
159
|
* - `snapshot`:UI 富字段快照(仅本地,不随订单提交)
|
|
160
|
+
* - `source`:缺省表示真实业务变更;`detailHydrate` 仅表示打开详情时快照已就绪
|
|
160
161
|
* 清空时整个 payload 为 null。
|
|
161
162
|
*/
|
|
162
163
|
export interface OrderCustomerChangePayload {
|
|
163
164
|
patch: OrderCustomerView;
|
|
164
165
|
snapshot: ICustomer | null;
|
|
166
|
+
source?: 'detailHydrate';
|
|
165
167
|
}
|
|
166
168
|
export interface OrderScanCodeResult {
|
|
167
169
|
isAvailable: boolean;
|
|
@@ -189,6 +191,8 @@ export interface OrderLocalizedText {
|
|
|
189
191
|
export interface OrderProduct extends OrderProductIdentity {
|
|
190
192
|
order_detail_id: number | null;
|
|
191
193
|
num: number;
|
|
194
|
+
/** Product 或当前 Variant 的生产编码 */
|
|
195
|
+
production_code?: string;
|
|
192
196
|
bundle_edit?: number;
|
|
193
197
|
product_sku: OrderProductSku;
|
|
194
198
|
gift_card?: number;
|
|
@@ -332,6 +336,8 @@ export type AddProductBookingInput = Record<string, any>;
|
|
|
332
336
|
*/
|
|
333
337
|
export interface AddProductToOrderOptions {
|
|
334
338
|
insertAfterProductUid?: string;
|
|
339
|
+
/** 跳过同商品/规格匹配,始终新增购物车行。 */
|
|
340
|
+
disableMerge?: boolean;
|
|
335
341
|
}
|
|
336
342
|
/**
|
|
337
343
|
* 删除商品后的可选位置保持策略。
|
|
@@ -608,6 +614,7 @@ export interface SyncPaymentsToOrderParams {
|
|
|
608
614
|
businessCode?: string;
|
|
609
615
|
channel?: string;
|
|
610
616
|
confirmPendingVoucherPayments?: boolean;
|
|
617
|
+
enhancePayload?: SubmitPayloadEnhancer;
|
|
611
618
|
}
|
|
612
619
|
export interface SyncPaymentsToOrderResult<T = any> {
|
|
613
620
|
isFullyPaid: boolean;
|
|
@@ -827,7 +834,7 @@ export interface OrderModuleAPI {
|
|
|
827
834
|
saveDraft: () => Promise<void>;
|
|
828
835
|
hydrateTempOrderFromRecord: (record: Record<string, any>, options?: {
|
|
829
836
|
recalcOnHydrate?: boolean;
|
|
830
|
-
source?: 'salesDetail' | 'sessionStorage';
|
|
837
|
+
source?: 'salesDetail' | 'mergedSalesDetail' | 'sessionStorage';
|
|
831
838
|
}) => Promise<OrderTempOrder>;
|
|
832
839
|
syncPaymentsToOrder: <T = any>(params: SyncPaymentsToOrderParams) => Promise<SyncPaymentsToOrderResult<T>>;
|
|
833
840
|
getSalesOrderByLookup: (params: SalesOrderLookupParams) => Promise<any>;
|
|
@@ -873,6 +873,7 @@ function formatSubmitBundleItems(bundle) {
|
|
|
873
873
|
return {
|
|
874
874
|
is_charge_tax: formatOptions.virtualSettlementMode ? 0 : (_rawBundle$is_charge_ = rawBundle.is_charge_tax) !== null && _rawBundle$is_charge_ !== void 0 ? _rawBundle$is_charge_ : 0,
|
|
875
875
|
bundle_variant_id: (_rawBundle$bundle_var = rawBundle.bundle_variant_id) !== null && _rawBundle$bundle_var !== void 0 ? _rawBundle$bundle_var : 0,
|
|
876
|
+
production_code: rawBundle.production_code,
|
|
876
877
|
num: num,
|
|
877
878
|
quantity: toBundleNumber((_rawBundle$quantity = rawBundle.quantity) !== null && _rawBundle$quantity !== void 0 ? _rawBundle$quantity : rawBundle.num, num),
|
|
878
879
|
extension_id: (_rawBundle$extension_ = rawBundle.extension_id) !== null && _rawBundle$extension_ !== void 0 ? _rawBundle$extension_ : 0,
|
|
@@ -1155,7 +1156,12 @@ export function buildSubmitPayload(params) {
|
|
|
1155
1156
|
var _tempOrder$bookings;
|
|
1156
1157
|
// 如果外部没有传递 types,根据订单里当前是否有 bookings 来决定是 appointment_booking 还是 virtual
|
|
1157
1158
|
if (tempOrder !== null && tempOrder !== void 0 && (_tempOrder$bookings = tempOrder.bookings) !== null && _tempOrder$bookings !== void 0 && _tempOrder$bookings.length) {
|
|
1158
|
-
|
|
1159
|
+
// 260807 如果 biz 是堂食,type 使用table-order
|
|
1160
|
+
if (businessCode === 'dine_in') {
|
|
1161
|
+
submitType = 'table-order';
|
|
1162
|
+
} else {
|
|
1163
|
+
submitType = 'appointment_booking';
|
|
1164
|
+
}
|
|
1159
1165
|
} else {
|
|
1160
1166
|
submitType = 'virtual';
|
|
1161
1167
|
}
|