@pisell/pisellos 2.2.203 → 2.2.205
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.d.ts +38 -1
- package/dist/modules/Order/index.js +388 -224
- package/dist/modules/Order/types.d.ts +2 -0
- package/dist/modules/Payment/index.d.ts +0 -13
- package/dist/modules/Payment/index.js +449 -833
- package/dist/plugins/request.d.ts +1 -0
- package/dist/server/index.d.ts +6 -0
- package/dist/server/index.js +730 -619
- package/dist/server/modules/index.d.ts +2 -0
- package/dist/server/modules/index.js +2 -0
- package/dist/server/modules/payment/index.d.ts +28 -0
- package/dist/server/modules/payment/index.js +305 -0
- package/dist/server/modules/payment/types.d.ts +9 -0
- package/dist/server/modules/payment/types.js +1 -0
- package/dist/solution/BaseSales/index.d.ts +13 -1
- package/dist/solution/BaseSales/index.js +132 -60
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.js +1 -1
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +51 -52
- package/dist/solution/BookingTicket/utils/scan/index.d.ts +5 -0
- package/dist/solution/BookingTicket/utils/scan/index.js +20 -8
- package/lib/model/strategy/adapter/promotion/index.js +49 -0
- package/lib/modules/Order/index.d.ts +38 -1
- package/lib/modules/Order/index.js +94 -19
- package/lib/modules/Order/types.d.ts +2 -0
- package/lib/modules/Payment/index.d.ts +0 -13
- package/lib/modules/Payment/index.js +6 -149
- package/lib/plugins/request.d.ts +1 -0
- package/lib/server/index.d.ts +6 -0
- package/lib/server/index.js +46 -0
- package/lib/server/modules/index.d.ts +2 -0
- package/lib/server/modules/index.js +3 -0
- package/lib/server/modules/payment/index.d.ts +28 -0
- package/lib/server/modules/payment/index.js +192 -0
- package/lib/server/modules/payment/types.d.ts +9 -0
- package/lib/server/modules/payment/types.js +17 -0
- package/lib/solution/BaseSales/index.d.ts +13 -1
- package/lib/solution/BaseSales/index.js +62 -9
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.js +1 -1
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +1 -2
- package/lib/solution/BookingTicket/utils/scan/index.d.ts +5 -0
- package/lib/solution/BookingTicket/utils/scan/index.js +17 -3
- package/package.json +1 -1
|
@@ -2715,16 +2715,60 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2715
2715
|
}
|
|
2716
2716
|
return shouldMergeProductToOrder;
|
|
2717
2717
|
}() // ─── TempOrder: 商品 CRUD ───
|
|
2718
|
+
/**
|
|
2719
|
+
* 预约商品加车后的统一收尾:促销、折扣、summary 重算与持久化(批量拆行时只调用一次)。
|
|
2720
|
+
*
|
|
2721
|
+
* @example
|
|
2722
|
+
* await this.finalizeProductOrderMutation(tempOrder);
|
|
2723
|
+
*/
|
|
2718
2724
|
}, {
|
|
2719
|
-
key: "
|
|
2725
|
+
key: "finalizeProductOrderMutation",
|
|
2720
2726
|
value: function () {
|
|
2721
|
-
var
|
|
2722
|
-
var _this16 = this;
|
|
2723
|
-
var tempOrder, linked, productToAdd, incomingFingerprint, normalizedIncoming, hasIncomingGoodPass, shouldForceNewLine, matchedIndex, matchedProduct, existedFingerprint, shouldMerge, _targetProduct$metada, targetProduct, targetUid, normalizedProduct, nextNum, targetIsManualProductDiscount, nextDiscountList;
|
|
2727
|
+
var _finalizeProductOrderMutation = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(tempOrder) {
|
|
2724
2728
|
return _regeneratorRuntime().wrap(function _callee14$(_context16) {
|
|
2725
2729
|
while (1) switch (_context16.prev = _context16.next) {
|
|
2726
2730
|
case 0:
|
|
2727
|
-
|
|
2731
|
+
_context16.next = 2;
|
|
2732
|
+
return this.ensureEditDiscountConfigForProductChange(tempOrder);
|
|
2733
|
+
case 2:
|
|
2734
|
+
_context16.next = 4;
|
|
2735
|
+
return this.applyPromotion();
|
|
2736
|
+
case 4:
|
|
2737
|
+
this.applyDiscount();
|
|
2738
|
+
this.sanitizeTempOrderProducts(tempOrder);
|
|
2739
|
+
_context16.next = 8;
|
|
2740
|
+
return this.recalculateSummary({
|
|
2741
|
+
createIfMissing: true
|
|
2742
|
+
});
|
|
2743
|
+
case 8:
|
|
2744
|
+
this.persistTempOrder();
|
|
2745
|
+
case 9:
|
|
2746
|
+
case "end":
|
|
2747
|
+
return _context16.stop();
|
|
2748
|
+
}
|
|
2749
|
+
}, _callee14, this);
|
|
2750
|
+
}));
|
|
2751
|
+
function finalizeProductOrderMutation(_x14) {
|
|
2752
|
+
return _finalizeProductOrderMutation.apply(this, arguments);
|
|
2753
|
+
}
|
|
2754
|
+
return finalizeProductOrderMutation;
|
|
2755
|
+
}()
|
|
2756
|
+
/**
|
|
2757
|
+
* 向 tempOrder 追加一条商品行(及可选 booking),不触发 summary 重算。
|
|
2758
|
+
* 带 booking 且 num>1 时由 `addProductToOrder` 拆成多次本方法调用(每次 num=1)。
|
|
2759
|
+
*
|
|
2760
|
+
* @example
|
|
2761
|
+
* await this.appendProductLineToTempOrder(tempOrder, { product_id: 1, num: 1 }, booking);
|
|
2762
|
+
*/
|
|
2763
|
+
}, {
|
|
2764
|
+
key: "appendProductLineToTempOrder",
|
|
2765
|
+
value: (function () {
|
|
2766
|
+
var _appendProductLineToTempOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(tempOrder, product, booking) {
|
|
2767
|
+
var _this16 = this;
|
|
2768
|
+
var linked, productToAdd, incomingFingerprint, normalizedIncoming, hasIncomingGoodPass, shouldForceNewLine, matchedIndex, matchedProduct, existedFingerprint, shouldMerge, _targetProduct$metada, targetProduct, targetUid, normalizedProduct, nextNum, targetIsManualProductDiscount, nextDiscountList;
|
|
2769
|
+
return _regeneratorRuntime().wrap(function _callee15$(_context17) {
|
|
2770
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
2771
|
+
case 0:
|
|
2728
2772
|
linked = booking ? this.createLinkedProductAndBooking({
|
|
2729
2773
|
product: product,
|
|
2730
2774
|
booking: booking
|
|
@@ -2737,6 +2781,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2737
2781
|
shouldForceNewLine = !!booking;
|
|
2738
2782
|
matchedIndex = hasIncomingGoodPass || shouldForceNewLine ? -1 : tempOrder.products.findIndex(function (item) {
|
|
2739
2783
|
if (_this16.hasGoodPassDiscount(item)) return false;
|
|
2784
|
+
if (item.order_detail_id !== undefined && item.order_detail_id !== null) return false;
|
|
2740
2785
|
if (item.product_id !== productToAdd.product_id) return false;
|
|
2741
2786
|
if (item.product_variant_id !== productToAdd.product_variant_id) return false;
|
|
2742
2787
|
var existedFingerprint = buildProductLineFingerprint(getProductSkuOptions(item), item.product_bundle);
|
|
@@ -2745,10 +2790,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2745
2790
|
matchedProduct = matchedIndex === -1 ? null : tempOrder.products[matchedIndex];
|
|
2746
2791
|
existedFingerprint = matchedProduct ? buildProductLineFingerprint(getProductSkuOptions(matchedProduct), matchedProduct.product_bundle) : '';
|
|
2747
2792
|
if (!matchedProduct) {
|
|
2748
|
-
|
|
2793
|
+
_context17.next = 16;
|
|
2749
2794
|
break;
|
|
2750
2795
|
}
|
|
2751
|
-
|
|
2796
|
+
_context17.next = 13;
|
|
2752
2797
|
return this.shouldMergeProductToOrder({
|
|
2753
2798
|
incomingProduct: productToAdd,
|
|
2754
2799
|
normalizedIncoming: normalizedIncoming,
|
|
@@ -2759,14 +2804,14 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2759
2804
|
tempOrder: tempOrder,
|
|
2760
2805
|
booking: booking
|
|
2761
2806
|
});
|
|
2762
|
-
case
|
|
2763
|
-
|
|
2764
|
-
|
|
2807
|
+
case 13:
|
|
2808
|
+
_context17.t0 = _context17.sent;
|
|
2809
|
+
_context17.next = 17;
|
|
2765
2810
|
break;
|
|
2811
|
+
case 16:
|
|
2812
|
+
_context17.t0 = false;
|
|
2766
2813
|
case 17:
|
|
2767
|
-
|
|
2768
|
-
case 18:
|
|
2769
|
-
shouldMerge = _context16.t0;
|
|
2814
|
+
shouldMerge = _context17.t0;
|
|
2770
2815
|
if (matchedIndex === -1 || !matchedProduct || !shouldMerge) {
|
|
2771
2816
|
this.captureProductRuntime(tempOrder, productToAdd, normalizedIncoming);
|
|
2772
2817
|
if (linked) {
|
|
@@ -2817,32 +2862,83 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2817
2862
|
if (linked) {
|
|
2818
2863
|
tempOrder.bookings = [].concat(_toConsumableArray(tempOrder.bookings || []), [linked.booking]);
|
|
2819
2864
|
}
|
|
2820
|
-
|
|
2821
|
-
|
|
2865
|
+
case 20:
|
|
2866
|
+
case "end":
|
|
2867
|
+
return _context17.stop();
|
|
2868
|
+
}
|
|
2869
|
+
}, _callee15, this);
|
|
2870
|
+
}));
|
|
2871
|
+
function appendProductLineToTempOrder(_x15, _x16, _x17) {
|
|
2872
|
+
return _appendProductLineToTempOrder.apply(this, arguments);
|
|
2873
|
+
}
|
|
2874
|
+
return appendProductLineToTempOrder;
|
|
2875
|
+
}()
|
|
2876
|
+
/**
|
|
2877
|
+
* 添加商品行。带 booking 时强制独立行;num>1 时拆成多条 num=1 的 product+booking(对齐 BookingByStep / ticketBooking addService)。
|
|
2878
|
+
*
|
|
2879
|
+
* @example
|
|
2880
|
+
* await order.addProductToOrder({ product_id: 1, num: 3 }, { start_time: '10:00' });
|
|
2881
|
+
* // → tempOrder.products 新增 3 行,每行 num=1,bookings 3 条
|
|
2882
|
+
*/
|
|
2883
|
+
)
|
|
2884
|
+
}, {
|
|
2885
|
+
key: "addProductToOrder",
|
|
2886
|
+
value: (function () {
|
|
2887
|
+
var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(product, booking) {
|
|
2888
|
+
var tempOrder, _ref58, _productRecord$num, productRecord, splitCount, i, singleLine;
|
|
2889
|
+
return _regeneratorRuntime().wrap(function _callee16$(_context18) {
|
|
2890
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
2891
|
+
case 0:
|
|
2892
|
+
tempOrder = this.ensureTempOrder();
|
|
2893
|
+
if (!booking) {
|
|
2894
|
+
_context18.next = 18;
|
|
2895
|
+
break;
|
|
2896
|
+
}
|
|
2897
|
+
productRecord = product;
|
|
2898
|
+
splitCount = getSafeProductNum((_ref58 = (_productRecord$num = productRecord.num) !== null && _productRecord$num !== void 0 ? _productRecord$num : productRecord.product_quantity) !== null && _ref58 !== void 0 ? _ref58 : 1);
|
|
2899
|
+
if (!(splitCount > 1)) {
|
|
2900
|
+
_context18.next = 18;
|
|
2901
|
+
break;
|
|
2902
|
+
}
|
|
2903
|
+
i = 0;
|
|
2904
|
+
case 6:
|
|
2905
|
+
if (!(i < splitCount)) {
|
|
2906
|
+
_context18.next = 15;
|
|
2907
|
+
break;
|
|
2908
|
+
}
|
|
2909
|
+
singleLine = cloneDeep(productRecord);
|
|
2910
|
+
singleLine.num = 1;
|
|
2911
|
+
delete singleLine.product_quantity;
|
|
2912
|
+
_context18.next = 12;
|
|
2913
|
+
return this.appendProductLineToTempOrder(tempOrder, singleLine, cloneDeep(booking));
|
|
2914
|
+
case 12:
|
|
2915
|
+
i += 1;
|
|
2916
|
+
_context18.next = 6;
|
|
2917
|
+
break;
|
|
2918
|
+
case 15:
|
|
2919
|
+
_context18.next = 17;
|
|
2920
|
+
return this.finalizeProductOrderMutation(tempOrder);
|
|
2921
|
+
case 17:
|
|
2922
|
+
return _context18.abrupt("return", tempOrder.products);
|
|
2923
|
+
case 18:
|
|
2924
|
+
_context18.next = 20;
|
|
2925
|
+
return this.appendProductLineToTempOrder(tempOrder, product, booking);
|
|
2926
|
+
case 20:
|
|
2927
|
+
_context18.next = 22;
|
|
2928
|
+
return this.finalizeProductOrderMutation(tempOrder);
|
|
2929
|
+
case 22:
|
|
2930
|
+
return _context18.abrupt("return", tempOrder.products);
|
|
2822
2931
|
case 23:
|
|
2823
|
-
_context16.next = 25;
|
|
2824
|
-
return this.applyPromotion();
|
|
2825
|
-
case 25:
|
|
2826
|
-
this.applyDiscount();
|
|
2827
|
-
this.sanitizeTempOrderProducts(tempOrder);
|
|
2828
|
-
_context16.next = 29;
|
|
2829
|
-
return this.recalculateSummary({
|
|
2830
|
-
createIfMissing: true
|
|
2831
|
-
});
|
|
2832
|
-
case 29:
|
|
2833
|
-
this.persistTempOrder();
|
|
2834
|
-
return _context16.abrupt("return", tempOrder.products);
|
|
2835
|
-
case 31:
|
|
2836
2932
|
case "end":
|
|
2837
|
-
return
|
|
2933
|
+
return _context18.stop();
|
|
2838
2934
|
}
|
|
2839
|
-
},
|
|
2935
|
+
}, _callee16, this);
|
|
2840
2936
|
}));
|
|
2841
|
-
function addProductToOrder(
|
|
2937
|
+
function addProductToOrder(_x18, _x19) {
|
|
2842
2938
|
return _addProductToOrder.apply(this, arguments);
|
|
2843
2939
|
}
|
|
2844
2940
|
return addProductToOrder;
|
|
2845
|
-
}()
|
|
2941
|
+
}())
|
|
2846
2942
|
}, {
|
|
2847
2943
|
key: "hasGoodPassDiscount",
|
|
2848
2944
|
value: function hasGoodPassDiscount(product) {
|
|
@@ -2865,9 +2961,9 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2865
2961
|
}, {
|
|
2866
2962
|
key: "getBundleRuntimeIdentity",
|
|
2867
2963
|
value: function getBundleRuntimeIdentity(bundle) {
|
|
2868
|
-
var
|
|
2964
|
+
var _ref59, _bundle$bundle_id2, _ref60, _bundle$bundle_group_2, _ref61, _ref62, _bundle$bundle_produc3, _ref63, _bundle$bundle_varian3;
|
|
2869
2965
|
if (!bundle || _typeof(bundle) !== 'object') return '';
|
|
2870
|
-
return [(
|
|
2966
|
+
return [(_ref59 = (_bundle$bundle_id2 = bundle.bundle_id) !== null && _bundle$bundle_id2 !== void 0 ? _bundle$bundle_id2 : bundle.id) !== null && _ref59 !== void 0 ? _ref59 : '', (_ref60 = (_bundle$bundle_group_2 = bundle.bundle_group_id) !== null && _bundle$bundle_group_2 !== void 0 ? _bundle$bundle_group_2 : bundle.group_id) !== null && _ref60 !== void 0 ? _ref60 : '', (_ref61 = (_ref62 = (_bundle$bundle_produc3 = bundle.bundle_product_id) !== null && _bundle$bundle_produc3 !== void 0 ? _bundle$bundle_produc3 : bundle._bundle_product_id) !== null && _ref62 !== void 0 ? _ref62 : bundle.product_id) !== null && _ref61 !== void 0 ? _ref61 : '', (_ref63 = (_bundle$bundle_varian3 = bundle.bundle_variant_id) !== null && _bundle$bundle_varian3 !== void 0 ? _bundle$bundle_varian3 : bundle.product_variant_id) !== null && _ref63 !== void 0 ? _ref63 : 0].join('|');
|
|
2871
2967
|
}
|
|
2872
2968
|
}, {
|
|
2873
2969
|
key: "preservePersistedBundlePriceFields",
|
|
@@ -2897,11 +2993,11 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2897
2993
|
}, {
|
|
2898
2994
|
key: "updateOrderProduct",
|
|
2899
2995
|
value: function () {
|
|
2900
|
-
var _updateOrderProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2996
|
+
var _updateOrderProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(params) {
|
|
2901
2997
|
var _targetProduct$metada2, _product_sku, _metadata, _metadata2, _metadata3, _metadata4, _metadata5, _metadata6, _nextProduct$metadata, _targetProduct$metada8, _tempOrder$products$p;
|
|
2902
2998
|
var product_id, product_variant_id, updates, unique_identification_number, identity_key, product_sku, product_bundle, booking, tempOrder, identityLookup, productIndex, targetUid, targetProduct, nextProduct, callerUpdatesTopPrice, callerUpdatesMainMeta, isPersistedOrderLine, callerChangesDiscountList, callerUpdatesManualPrice, _targetProduct$metada3, _targetProduct$metada4, _targetProduct$metada5, _targetProduct$metada6, _targetProduct$metada7, existedMeta, normalizedProduct, preservedBookingUid, _normalizedProduct$me, _targetProduct$metada9, productUid, linked;
|
|
2903
|
-
return _regeneratorRuntime().wrap(function
|
|
2904
|
-
while (1) switch (
|
|
2999
|
+
return _regeneratorRuntime().wrap(function _callee17$(_context19) {
|
|
3000
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
2905
3001
|
case 0:
|
|
2906
3002
|
product_id = params.product_id, product_variant_id = params.product_variant_id, updates = params.updates, unique_identification_number = params.unique_identification_number, identity_key = params.identity_key, product_sku = params.product_sku, product_bundle = params.product_bundle, booking = params.booking;
|
|
2907
3003
|
tempOrder = this.ensureTempOrder();
|
|
@@ -2932,7 +3028,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2932
3028
|
productIndex = getProductIdentityIndex(tempOrder.products, identityLookup);
|
|
2933
3029
|
}
|
|
2934
3030
|
if (!(productIndex === -1)) {
|
|
2935
|
-
|
|
3031
|
+
_context19.next = 12;
|
|
2936
3032
|
break;
|
|
2937
3033
|
}
|
|
2938
3034
|
throw new Error('[Order] 目标商品不存在,无法更新');
|
|
@@ -3015,25 +3111,25 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3015
3111
|
}
|
|
3016
3112
|
tempOrder.products[productIndex] = normalizedProduct;
|
|
3017
3113
|
this.captureProductRuntime(tempOrder, updates, tempOrder.products[productIndex], (_tempOrder$products$p = tempOrder.products[productIndex].metadata) === null || _tempOrder$products$p === void 0 ? void 0 : _tempOrder$products$p.unique_identification_number);
|
|
3018
|
-
|
|
3114
|
+
_context19.next = 30;
|
|
3019
3115
|
return this.applyPromotion();
|
|
3020
3116
|
case 30:
|
|
3021
3117
|
this.applyDiscount();
|
|
3022
3118
|
this.sanitizeTempOrderProducts(tempOrder);
|
|
3023
|
-
|
|
3119
|
+
_context19.next = 34;
|
|
3024
3120
|
return this.recalculateSummary({
|
|
3025
3121
|
createIfMissing: true
|
|
3026
3122
|
});
|
|
3027
3123
|
case 34:
|
|
3028
3124
|
this.persistTempOrder();
|
|
3029
|
-
return
|
|
3125
|
+
return _context19.abrupt("return", tempOrder.products);
|
|
3030
3126
|
case 36:
|
|
3031
3127
|
case "end":
|
|
3032
|
-
return
|
|
3128
|
+
return _context19.stop();
|
|
3033
3129
|
}
|
|
3034
|
-
},
|
|
3130
|
+
}, _callee17, this);
|
|
3035
3131
|
}));
|
|
3036
|
-
function updateOrderProduct(
|
|
3132
|
+
function updateOrderProduct(_x20) {
|
|
3037
3133
|
return _updateOrderProduct.apply(this, arguments);
|
|
3038
3134
|
}
|
|
3039
3135
|
return updateOrderProduct;
|
|
@@ -3041,11 +3137,11 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3041
3137
|
}, {
|
|
3042
3138
|
key: "updateOrderProductQuantity",
|
|
3043
3139
|
value: function () {
|
|
3044
|
-
var _updateOrderProductQuantity = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3140
|
+
var _updateOrderProductQuantity = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(params) {
|
|
3045
3141
|
var _targetProduct$metada10;
|
|
3046
3142
|
var product_id, product_variant_id, num, unique_identification_number, identity_key, product_sku, product_bundle, tempOrder, identityLookup, productIndex, targetUid, targetProduct, normalizedProduct;
|
|
3047
|
-
return _regeneratorRuntime().wrap(function
|
|
3048
|
-
while (1) switch (
|
|
3143
|
+
return _regeneratorRuntime().wrap(function _callee18$(_context20) {
|
|
3144
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
3049
3145
|
case 0:
|
|
3050
3146
|
product_id = params.product_id, product_variant_id = params.product_variant_id, num = params.num, unique_identification_number = params.unique_identification_number, identity_key = params.identity_key, product_sku = params.product_sku, product_bundle = params.product_bundle;
|
|
3051
3147
|
tempOrder = this.ensureTempOrder();
|
|
@@ -3074,7 +3170,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3074
3170
|
productIndex = getProductIdentityIndex(tempOrder.products, identityLookup);
|
|
3075
3171
|
}
|
|
3076
3172
|
if (!(productIndex === -1)) {
|
|
3077
|
-
|
|
3173
|
+
_context20.next = 12;
|
|
3078
3174
|
break;
|
|
3079
3175
|
}
|
|
3080
3176
|
throw new Error('[Order] 目标商品不存在,无法更新数量');
|
|
@@ -3088,25 +3184,25 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3088
3184
|
}));
|
|
3089
3185
|
normalizedProduct.discount_list = normalizeOrderProductDiscountList(normalizedProduct.discount_list);
|
|
3090
3186
|
tempOrder.products[productIndex] = normalizedProduct;
|
|
3091
|
-
|
|
3187
|
+
_context20.next = 18;
|
|
3092
3188
|
return this.applyPromotion();
|
|
3093
3189
|
case 18:
|
|
3094
3190
|
this.applyDiscount();
|
|
3095
3191
|
this.sanitizeTempOrderProducts(tempOrder);
|
|
3096
|
-
|
|
3192
|
+
_context20.next = 22;
|
|
3097
3193
|
return this.recalculateSummary({
|
|
3098
3194
|
createIfMissing: true
|
|
3099
3195
|
});
|
|
3100
3196
|
case 22:
|
|
3101
3197
|
this.persistTempOrder();
|
|
3102
|
-
return
|
|
3198
|
+
return _context20.abrupt("return", tempOrder.products);
|
|
3103
3199
|
case 24:
|
|
3104
3200
|
case "end":
|
|
3105
|
-
return
|
|
3201
|
+
return _context20.stop();
|
|
3106
3202
|
}
|
|
3107
|
-
},
|
|
3203
|
+
}, _callee18, this);
|
|
3108
3204
|
}));
|
|
3109
|
-
function updateOrderProductQuantity(
|
|
3205
|
+
function updateOrderProductQuantity(_x21) {
|
|
3110
3206
|
return _updateOrderProductQuantity.apply(this, arguments);
|
|
3111
3207
|
}
|
|
3112
3208
|
return updateOrderProductQuantity;
|
|
@@ -3134,18 +3230,70 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3134
3230
|
this.persistTempOrder();
|
|
3135
3231
|
return tempOrder.bookings;
|
|
3136
3232
|
}
|
|
3233
|
+
|
|
3234
|
+
/**
|
|
3235
|
+
* 商品行写路径收尾:促销 → 折扣 → 清洗 → summary → 持久化。
|
|
3236
|
+
* 批量删除等多行变更场景只应调用一次,避免 N 次 applyPromotion。
|
|
3237
|
+
*
|
|
3238
|
+
* @example
|
|
3239
|
+
* await this.finalizeAfterProductsMutation(tempOrder);
|
|
3240
|
+
*/
|
|
3137
3241
|
}, {
|
|
3138
|
-
key: "
|
|
3139
|
-
value: function () {
|
|
3140
|
-
var
|
|
3242
|
+
key: "finalizeAfterProductsMutation",
|
|
3243
|
+
value: (function () {
|
|
3244
|
+
var _finalizeAfterProductsMutation = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(tempOrder) {
|
|
3245
|
+
return _regeneratorRuntime().wrap(function _callee19$(_context21) {
|
|
3246
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
3247
|
+
case 0:
|
|
3248
|
+
_context21.next = 2;
|
|
3249
|
+
return this.applyPromotion();
|
|
3250
|
+
case 2:
|
|
3251
|
+
this.applyDiscount();
|
|
3252
|
+
this.sanitizeTempOrderProducts(tempOrder);
|
|
3253
|
+
_context21.next = 6;
|
|
3254
|
+
return this.recalculateSummary({
|
|
3255
|
+
createIfMissing: true
|
|
3256
|
+
});
|
|
3257
|
+
case 6:
|
|
3258
|
+
this.persistTempOrder();
|
|
3259
|
+
case 7:
|
|
3260
|
+
case "end":
|
|
3261
|
+
return _context21.stop();
|
|
3262
|
+
}
|
|
3263
|
+
}, _callee19, this);
|
|
3264
|
+
}));
|
|
3265
|
+
function finalizeAfterProductsMutation(_x22) {
|
|
3266
|
+
return _finalizeAfterProductsMutation.apply(this, arguments);
|
|
3267
|
+
}
|
|
3268
|
+
return finalizeAfterProductsMutation;
|
|
3269
|
+
}()
|
|
3270
|
+
/**
|
|
3271
|
+
* 批量按 identity 删除购物车行,末尾仅一次促销重算。
|
|
3272
|
+
*
|
|
3273
|
+
* @example
|
|
3274
|
+
* await order.removeProductsFromOrder([identityA, identityB]);
|
|
3275
|
+
*/
|
|
3276
|
+
)
|
|
3277
|
+
}, {
|
|
3278
|
+
key: "removeProductsFromOrder",
|
|
3279
|
+
value: (function () {
|
|
3280
|
+
var _removeProductsFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(identities) {
|
|
3141
3281
|
var tempOrder, removedProducts, _i, _removedProducts, product;
|
|
3142
|
-
return _regeneratorRuntime().wrap(function
|
|
3143
|
-
while (1) switch (
|
|
3282
|
+
return _regeneratorRuntime().wrap(function _callee20$(_context22) {
|
|
3283
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
3144
3284
|
case 0:
|
|
3145
3285
|
tempOrder = this.ensureTempOrder();
|
|
3286
|
+
if (identities.length) {
|
|
3287
|
+
_context22.next = 3;
|
|
3288
|
+
break;
|
|
3289
|
+
}
|
|
3290
|
+
return _context22.abrupt("return", tempOrder.products);
|
|
3291
|
+
case 3:
|
|
3146
3292
|
removedProducts = [];
|
|
3147
3293
|
tempOrder.products = tempOrder.products.filter(function (item) {
|
|
3148
|
-
var shouldRemove =
|
|
3294
|
+
var shouldRemove = identities.some(function (identity) {
|
|
3295
|
+
return isIdentityMatch(item, identity);
|
|
3296
|
+
});
|
|
3149
3297
|
if (shouldRemove) removedProducts.push(item);
|
|
3150
3298
|
return !shouldRemove;
|
|
3151
3299
|
});
|
|
@@ -3153,25 +3301,36 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3153
3301
|
product = _removedProducts[_i];
|
|
3154
3302
|
this.removeLinkedBookingsForProduct(tempOrder, product);
|
|
3155
3303
|
}
|
|
3156
|
-
|
|
3157
|
-
return this.
|
|
3158
|
-
case
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
_context19.next = 10;
|
|
3162
|
-
return this.recalculateSummary({
|
|
3163
|
-
createIfMissing: true
|
|
3164
|
-
});
|
|
3165
|
-
case 10:
|
|
3166
|
-
this.persistTempOrder();
|
|
3167
|
-
return _context19.abrupt("return", tempOrder.products);
|
|
3168
|
-
case 12:
|
|
3304
|
+
_context22.next = 8;
|
|
3305
|
+
return this.finalizeAfterProductsMutation(tempOrder);
|
|
3306
|
+
case 8:
|
|
3307
|
+
return _context22.abrupt("return", tempOrder.products);
|
|
3308
|
+
case 9:
|
|
3169
3309
|
case "end":
|
|
3170
|
-
return
|
|
3310
|
+
return _context22.stop();
|
|
3171
3311
|
}
|
|
3172
|
-
},
|
|
3312
|
+
}, _callee20, this);
|
|
3173
3313
|
}));
|
|
3174
|
-
function
|
|
3314
|
+
function removeProductsFromOrder(_x23) {
|
|
3315
|
+
return _removeProductsFromOrder.apply(this, arguments);
|
|
3316
|
+
}
|
|
3317
|
+
return removeProductsFromOrder;
|
|
3318
|
+
}())
|
|
3319
|
+
}, {
|
|
3320
|
+
key: "removeProductFromOrder",
|
|
3321
|
+
value: function () {
|
|
3322
|
+
var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(identity) {
|
|
3323
|
+
return _regeneratorRuntime().wrap(function _callee21$(_context23) {
|
|
3324
|
+
while (1) switch (_context23.prev = _context23.next) {
|
|
3325
|
+
case 0:
|
|
3326
|
+
return _context23.abrupt("return", this.removeProductsFromOrder([identity]));
|
|
3327
|
+
case 1:
|
|
3328
|
+
case "end":
|
|
3329
|
+
return _context23.stop();
|
|
3330
|
+
}
|
|
3331
|
+
}, _callee21, this);
|
|
3332
|
+
}));
|
|
3333
|
+
function removeProductFromOrder(_x24) {
|
|
3175
3334
|
return _removeProductFromOrder.apply(this, arguments);
|
|
3176
3335
|
}
|
|
3177
3336
|
return removeProductFromOrder;
|
|
@@ -3183,10 +3342,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3183
3342
|
}, {
|
|
3184
3343
|
key: "clearOrderCartLines",
|
|
3185
3344
|
value: (function () {
|
|
3186
|
-
var _clearOrderCartLines = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3345
|
+
var _clearOrderCartLines = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22() {
|
|
3187
3346
|
var tempOrder;
|
|
3188
|
-
return _regeneratorRuntime().wrap(function
|
|
3189
|
-
while (1) switch (
|
|
3347
|
+
return _regeneratorRuntime().wrap(function _callee22$(_context24) {
|
|
3348
|
+
while (1) switch (_context24.prev = _context24.next) {
|
|
3190
3349
|
case 0:
|
|
3191
3350
|
tempOrder = this.ensureTempOrder();
|
|
3192
3351
|
tempOrder.products = [];
|
|
@@ -3196,23 +3355,23 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3196
3355
|
productsByUid: {}
|
|
3197
3356
|
});
|
|
3198
3357
|
}
|
|
3199
|
-
|
|
3358
|
+
_context24.next = 6;
|
|
3200
3359
|
return this.applyPromotion();
|
|
3201
3360
|
case 6:
|
|
3202
3361
|
this.applyDiscount();
|
|
3203
3362
|
this.sanitizeTempOrderProducts(tempOrder);
|
|
3204
|
-
|
|
3363
|
+
_context24.next = 10;
|
|
3205
3364
|
return this.recalculateSummary({
|
|
3206
3365
|
createIfMissing: true
|
|
3207
3366
|
});
|
|
3208
3367
|
case 10:
|
|
3209
3368
|
this.persistTempOrder();
|
|
3210
|
-
return
|
|
3369
|
+
return _context24.abrupt("return", tempOrder);
|
|
3211
3370
|
case 12:
|
|
3212
3371
|
case "end":
|
|
3213
|
-
return
|
|
3372
|
+
return _context24.stop();
|
|
3214
3373
|
}
|
|
3215
|
-
},
|
|
3374
|
+
}, _callee22, this);
|
|
3216
3375
|
}));
|
|
3217
3376
|
function clearOrderCartLines() {
|
|
3218
3377
|
return _clearOrderCartLines.apply(this, arguments);
|
|
@@ -3229,11 +3388,11 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3229
3388
|
}, {
|
|
3230
3389
|
key: "submitTempOrder",
|
|
3231
3390
|
value: function () {
|
|
3232
|
-
var _submitTempOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3233
|
-
var _params$cacheId, _this$otherParams,
|
|
3391
|
+
var _submitTempOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(params) {
|
|
3392
|
+
var _params$cacheId, _this$otherParams, _ref64, _params$businessCode, _this$otherParams2, _this$otherParams3;
|
|
3234
3393
|
var tempOrder, effectiveCacheId, hasPaymentOverride, hasPaymentStatusOverride, hasSmallTicketDataFlagOverride, enhancePayload, payload, result, _payload$payments, _payload$payments2, backendErrorResponse, submittedOrderId, resultRecord;
|
|
3235
|
-
return _regeneratorRuntime().wrap(function
|
|
3236
|
-
while (1) switch (
|
|
3394
|
+
return _regeneratorRuntime().wrap(function _callee23$(_context25) {
|
|
3395
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
3237
3396
|
case 0:
|
|
3238
3397
|
tempOrder = this.ensureTempOrder();
|
|
3239
3398
|
this.persistTempOrder();
|
|
@@ -3256,16 +3415,16 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3256
3415
|
tempOrder: tempOrder,
|
|
3257
3416
|
cacheId: effectiveCacheId,
|
|
3258
3417
|
platform: (params === null || params === void 0 ? void 0 : params.platform) || ((_this$otherParams = this.otherParams) === null || _this$otherParams === void 0 ? void 0 : _this$otherParams.platform),
|
|
3259
|
-
businessCode: (
|
|
3418
|
+
businessCode: (_ref64 = (_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 && _ref64 !== void 0 ? _ref64 : (_this$otherParams3 = this.otherParams) === null || _this$otherParams3 === void 0 ? void 0 : _this$otherParams3.business_code,
|
|
3260
3419
|
channel: params === null || params === void 0 ? void 0 : params.channel,
|
|
3261
3420
|
type: params === null || params === void 0 ? void 0 : params.type,
|
|
3262
3421
|
enhance: enhancePayload
|
|
3263
3422
|
}); // TODO: 前端生成的时间现在是有问题的,后面要统一优化
|
|
3264
3423
|
payload.created_at = undefined;
|
|
3265
|
-
|
|
3424
|
+
_context25.next = 11;
|
|
3266
3425
|
return this.saveDraft();
|
|
3267
3426
|
case 11:
|
|
3268
|
-
|
|
3427
|
+
_context25.prev = 11;
|
|
3269
3428
|
this.logInfo('submitTempOrder calling sales checkout', {
|
|
3270
3429
|
orderId: payload.order_id,
|
|
3271
3430
|
externalSaleNumber: payload.external_sale_number,
|
|
@@ -3274,62 +3433,67 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3274
3433
|
paymentsCount: ((_payload$payments = payload.payments) === null || _payload$payments === void 0 ? void 0 : _payload$payments.length) || 0,
|
|
3275
3434
|
smallTicketDataFlag: payload.small_ticket_data_flag
|
|
3276
3435
|
});
|
|
3277
|
-
|
|
3436
|
+
_context25.next = 15;
|
|
3278
3437
|
return this.submitSalesOrder({
|
|
3279
3438
|
query: payload
|
|
3280
3439
|
});
|
|
3281
3440
|
case 15:
|
|
3282
|
-
result =
|
|
3283
|
-
|
|
3441
|
+
result = _context25.sent;
|
|
3442
|
+
_context25.next = 28;
|
|
3284
3443
|
break;
|
|
3285
3444
|
case 18:
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
backendErrorResponse = this.extractSubmitErrorResponse(
|
|
3445
|
+
_context25.prev = 18;
|
|
3446
|
+
_context25.t0 = _context25["catch"](11);
|
|
3447
|
+
backendErrorResponse = this.extractSubmitErrorResponse(_context25.t0);
|
|
3289
3448
|
if (!backendErrorResponse) {
|
|
3290
|
-
|
|
3449
|
+
_context25.next = 25;
|
|
3291
3450
|
break;
|
|
3292
3451
|
}
|
|
3293
3452
|
this.store.syncState = 'failed';
|
|
3294
3453
|
this.logSubmitBackendRejected(backendErrorResponse, payload);
|
|
3295
|
-
return
|
|
3454
|
+
return _context25.abrupt("return", backendErrorResponse);
|
|
3296
3455
|
case 25:
|
|
3297
3456
|
this.store.syncState = 'failed';
|
|
3298
3457
|
this.logError('submitTempOrder failed', {
|
|
3299
|
-
error:
|
|
3458
|
+
error: _context25.t0 instanceof Error ? _context25.t0.message : String(_context25.t0),
|
|
3300
3459
|
orderId: payload.order_id,
|
|
3301
3460
|
externalSaleNumber: payload.external_sale_number,
|
|
3302
3461
|
paymentStatus: payload.payment_status,
|
|
3303
3462
|
paymentsCount: ((_payload$payments2 = payload.payments) === null || _payload$payments2 === void 0 ? void 0 : _payload$payments2.length) || 0
|
|
3304
3463
|
});
|
|
3305
|
-
throw
|
|
3464
|
+
throw _context25.t0;
|
|
3306
3465
|
case 28:
|
|
3307
3466
|
if (!this.isSubmitResponseRejected(result)) {
|
|
3308
|
-
|
|
3467
|
+
_context25.next = 32;
|
|
3309
3468
|
break;
|
|
3310
3469
|
}
|
|
3311
3470
|
this.store.syncState = 'failed';
|
|
3312
3471
|
this.logSubmitBackendRejected(result, payload);
|
|
3313
|
-
return
|
|
3472
|
+
return _context25.abrupt("return", result);
|
|
3314
3473
|
case 32:
|
|
3315
3474
|
submittedOrderId = this.extractOrderIdFromSubmitResult(result);
|
|
3316
3475
|
if (!(submittedOrderId !== null && submittedOrderId !== undefined)) {
|
|
3317
|
-
|
|
3476
|
+
_context25.next = 40;
|
|
3318
3477
|
break;
|
|
3319
3478
|
}
|
|
3320
3479
|
tempOrder.order_id = submittedOrderId;
|
|
3321
3480
|
resultRecord = result;
|
|
3322
|
-
|
|
3481
|
+
_context25.next = 38;
|
|
3323
3482
|
return this.markLocalOrderSynced(submittedOrderId, (resultRecord === null || resultRecord === void 0 ? void 0 : resultRecord.data) || resultRecord || {});
|
|
3324
3483
|
case 38:
|
|
3325
|
-
|
|
3326
|
-
|
|
3484
|
+
_context25.next = 41;
|
|
3485
|
+
break;
|
|
3486
|
+
case 40:
|
|
3487
|
+
this.store.syncState = 'submitted';
|
|
3488
|
+
case 41:
|
|
3489
|
+
return _context25.abrupt("return", result);
|
|
3490
|
+
case 42:
|
|
3327
3491
|
case "end":
|
|
3328
|
-
return
|
|
3492
|
+
return _context25.stop();
|
|
3329
3493
|
}
|
|
3330
|
-
},
|
|
3494
|
+
}, _callee23, this, [[11, 18]]);
|
|
3331
3495
|
}));
|
|
3332
|
-
function submitTempOrder(
|
|
3496
|
+
function submitTempOrder(_x25) {
|
|
3333
3497
|
return _submitTempOrder.apply(this, arguments);
|
|
3334
3498
|
}
|
|
3335
3499
|
return submitTempOrder;
|
|
@@ -3337,25 +3501,25 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3337
3501
|
}, {
|
|
3338
3502
|
key: "markLocalOrderSynced",
|
|
3339
3503
|
value: function () {
|
|
3340
|
-
var _markLocalOrderSynced = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3504
|
+
var _markLocalOrderSynced = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(orderId, remoteOrder) {
|
|
3341
3505
|
var tempOrder;
|
|
3342
|
-
return _regeneratorRuntime().wrap(function
|
|
3343
|
-
while (1) switch (
|
|
3506
|
+
return _regeneratorRuntime().wrap(function _callee24$(_context26) {
|
|
3507
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
3344
3508
|
case 0:
|
|
3345
3509
|
tempOrder = this.ensureTempOrder();
|
|
3346
3510
|
tempOrder.order_id = orderId;
|
|
3347
3511
|
this.store.lastOrderInfo = remoteOrder;
|
|
3348
3512
|
this.store.syncState = 'submitted';
|
|
3349
3513
|
this.persistTempOrder();
|
|
3350
|
-
|
|
3514
|
+
_context26.next = 7;
|
|
3351
3515
|
return this.saveDraft();
|
|
3352
3516
|
case 7:
|
|
3353
3517
|
case "end":
|
|
3354
|
-
return
|
|
3518
|
+
return _context26.stop();
|
|
3355
3519
|
}
|
|
3356
|
-
},
|
|
3520
|
+
}, _callee24, this);
|
|
3357
3521
|
}));
|
|
3358
|
-
function markLocalOrderSynced(
|
|
3522
|
+
function markLocalOrderSynced(_x26, _x27) {
|
|
3359
3523
|
return _markLocalOrderSynced.apply(this, arguments);
|
|
3360
3524
|
}
|
|
3361
3525
|
return markLocalOrderSynced;
|
|
@@ -3402,10 +3566,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3402
3566
|
}, {
|
|
3403
3567
|
key: "syncPaymentsToOrder",
|
|
3404
3568
|
value: function () {
|
|
3405
|
-
var _syncPaymentsToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3569
|
+
var _syncPaymentsToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(params) {
|
|
3406
3570
|
var tempOrder, mappedPayments, paymentTotal, targetAmount, isFullyPaid, paymentStatus, paymentSyncIdempotencyToken, submitResult;
|
|
3407
|
-
return _regeneratorRuntime().wrap(function
|
|
3408
|
-
while (1) switch (
|
|
3571
|
+
return _regeneratorRuntime().wrap(function _callee25$(_context27) {
|
|
3572
|
+
while (1) switch (_context27.prev = _context27.next) {
|
|
3409
3573
|
case 0:
|
|
3410
3574
|
tempOrder = this.ensureTempOrder();
|
|
3411
3575
|
mappedPayments = mapPaymentItemsToOrderPayments(params.payments || []);
|
|
@@ -3416,28 +3580,28 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3416
3580
|
tempOrder.payments = mappedPayments;
|
|
3417
3581
|
tempOrder.payment_status = paymentStatus;
|
|
3418
3582
|
this.persistTempOrder();
|
|
3419
|
-
|
|
3583
|
+
_context27.next = 11;
|
|
3420
3584
|
return this.saveDraft();
|
|
3421
3585
|
case 11:
|
|
3422
3586
|
if (params.submitWhenPaid) {
|
|
3423
|
-
|
|
3587
|
+
_context27.next = 13;
|
|
3424
3588
|
break;
|
|
3425
3589
|
}
|
|
3426
|
-
return
|
|
3590
|
+
return _context27.abrupt("return", {
|
|
3427
3591
|
isFullyPaid: isFullyPaid
|
|
3428
3592
|
});
|
|
3429
3593
|
case 13:
|
|
3430
3594
|
if (!(this.store.syncState === 'submitting')) {
|
|
3431
|
-
|
|
3595
|
+
_context27.next = 15;
|
|
3432
3596
|
break;
|
|
3433
3597
|
}
|
|
3434
|
-
return
|
|
3598
|
+
return _context27.abrupt("return", {
|
|
3435
3599
|
isFullyPaid: isFullyPaid
|
|
3436
3600
|
});
|
|
3437
3601
|
case 15:
|
|
3438
3602
|
this.store.syncState = 'submitting';
|
|
3439
3603
|
paymentSyncIdempotencyToken = this.buildPaymentSyncIdempotencyToken(tempOrder, mappedPayments);
|
|
3440
|
-
|
|
3604
|
+
_context27.next = 19;
|
|
3441
3605
|
return this.submitTempOrder({
|
|
3442
3606
|
payments: mappedPayments,
|
|
3443
3607
|
paymentStatus: paymentStatus,
|
|
@@ -3452,18 +3616,18 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3452
3616
|
}
|
|
3453
3617
|
});
|
|
3454
3618
|
case 19:
|
|
3455
|
-
submitResult =
|
|
3456
|
-
return
|
|
3619
|
+
submitResult = _context27.sent;
|
|
3620
|
+
return _context27.abrupt("return", {
|
|
3457
3621
|
isFullyPaid: isFullyPaid,
|
|
3458
3622
|
submitResult: submitResult
|
|
3459
3623
|
});
|
|
3460
3624
|
case 21:
|
|
3461
3625
|
case "end":
|
|
3462
|
-
return
|
|
3626
|
+
return _context27.stop();
|
|
3463
3627
|
}
|
|
3464
|
-
},
|
|
3628
|
+
}, _callee25, this);
|
|
3465
3629
|
}));
|
|
3466
|
-
function syncPaymentsToOrder(
|
|
3630
|
+
function syncPaymentsToOrder(_x28) {
|
|
3467
3631
|
return _syncPaymentsToOrder.apply(this, arguments);
|
|
3468
3632
|
}
|
|
3469
3633
|
return syncPaymentsToOrder;
|
|
@@ -3552,11 +3716,11 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3552
3716
|
}, {
|
|
3553
3717
|
key: "submitOrder",
|
|
3554
3718
|
value: function () {
|
|
3555
|
-
var _submitOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3719
|
+
var _submitOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(order) {
|
|
3556
3720
|
var _order$query$cartItem, _params$bookings, _params$relation_prod;
|
|
3557
3721
|
var url, query, fetchUrl, params;
|
|
3558
|
-
return _regeneratorRuntime().wrap(function
|
|
3559
|
-
while (1) switch (
|
|
3722
|
+
return _regeneratorRuntime().wrap(function _callee26$(_context28) {
|
|
3723
|
+
while (1) switch (_context28.prev = _context28.next) {
|
|
3560
3724
|
case 0:
|
|
3561
3725
|
this.logInfo('submitOrder called', {
|
|
3562
3726
|
url: order.url,
|
|
@@ -3576,14 +3740,14 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3576
3740
|
relationProductsCount: ((_params$relation_prod = params.relation_products) === null || _params$relation_prod === void 0 ? void 0 : _params$relation_prod.length) || 0,
|
|
3577
3741
|
scheduleDate: params.schedule_date
|
|
3578
3742
|
});
|
|
3579
|
-
return
|
|
3743
|
+
return _context28.abrupt("return", this.request.post(fetchUrl, params));
|
|
3580
3744
|
case 6:
|
|
3581
3745
|
case "end":
|
|
3582
|
-
return
|
|
3746
|
+
return _context28.stop();
|
|
3583
3747
|
}
|
|
3584
|
-
},
|
|
3748
|
+
}, _callee26, this);
|
|
3585
3749
|
}));
|
|
3586
|
-
function submitOrder(
|
|
3750
|
+
function submitOrder(_x29) {
|
|
3587
3751
|
return _submitOrder.apply(this, arguments);
|
|
3588
3752
|
}
|
|
3589
3753
|
return submitOrder;
|
|
@@ -3591,13 +3755,13 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3591
3755
|
}, {
|
|
3592
3756
|
key: "cancelOrder",
|
|
3593
3757
|
value: function () {
|
|
3594
|
-
var _cancelOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3758
|
+
var _cancelOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(params) {
|
|
3595
3759
|
var payload;
|
|
3596
|
-
return _regeneratorRuntime().wrap(function
|
|
3597
|
-
while (1) switch (
|
|
3760
|
+
return _regeneratorRuntime().wrap(function _callee27$(_context29) {
|
|
3761
|
+
while (1) switch (_context29.prev = _context29.next) {
|
|
3598
3762
|
case 0:
|
|
3599
3763
|
if (!(!Array.isArray(params.order_ids) || params.order_ids.length === 0)) {
|
|
3600
|
-
|
|
3764
|
+
_context29.next = 2;
|
|
3601
3765
|
break;
|
|
3602
3766
|
}
|
|
3603
3767
|
throw new Error('取消订单失败:order_ids 不能为空');
|
|
@@ -3613,16 +3777,16 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3613
3777
|
method: 'PUT',
|
|
3614
3778
|
orderIdsCount: params.order_ids.length
|
|
3615
3779
|
});
|
|
3616
|
-
return
|
|
3780
|
+
return _context29.abrupt("return", this.request.put('/order/update-status', payload, {
|
|
3617
3781
|
isShopApi: true
|
|
3618
3782
|
}));
|
|
3619
3783
|
case 5:
|
|
3620
3784
|
case "end":
|
|
3621
|
-
return
|
|
3785
|
+
return _context29.stop();
|
|
3622
3786
|
}
|
|
3623
|
-
},
|
|
3787
|
+
}, _callee27, this);
|
|
3624
3788
|
}));
|
|
3625
|
-
function cancelOrder(
|
|
3789
|
+
function cancelOrder(_x30) {
|
|
3626
3790
|
return _cancelOrder.apply(this, arguments);
|
|
3627
3791
|
}
|
|
3628
3792
|
return cancelOrder;
|
|
@@ -3630,19 +3794,19 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3630
3794
|
}, {
|
|
3631
3795
|
key: "changeBookingStatus",
|
|
3632
3796
|
value: function () {
|
|
3633
|
-
var _changeBookingStatus = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3797
|
+
var _changeBookingStatus = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(params) {
|
|
3634
3798
|
var url, payload;
|
|
3635
|
-
return _regeneratorRuntime().wrap(function
|
|
3636
|
-
while (1) switch (
|
|
3799
|
+
return _regeneratorRuntime().wrap(function _callee28$(_context30) {
|
|
3800
|
+
while (1) switch (_context30.prev = _context30.next) {
|
|
3637
3801
|
case 0:
|
|
3638
3802
|
if (params.booking_id) {
|
|
3639
|
-
|
|
3803
|
+
_context30.next = 2;
|
|
3640
3804
|
break;
|
|
3641
3805
|
}
|
|
3642
3806
|
throw new Error('变更预约状态失败:booking_id 不能为空');
|
|
3643
3807
|
case 2:
|
|
3644
3808
|
if (params.appointment_status) {
|
|
3645
|
-
|
|
3809
|
+
_context30.next = 4;
|
|
3646
3810
|
break;
|
|
3647
3811
|
}
|
|
3648
3812
|
throw new Error('变更预约状态失败:appointment_status 不能为空');
|
|
@@ -3657,16 +3821,16 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3657
3821
|
bookingId: params.booking_id,
|
|
3658
3822
|
appointmentStatus: params.appointment_status
|
|
3659
3823
|
});
|
|
3660
|
-
return
|
|
3824
|
+
return _context30.abrupt("return", this.request.put(url, payload, {
|
|
3661
3825
|
isShopApi: true
|
|
3662
3826
|
}));
|
|
3663
3827
|
case 8:
|
|
3664
3828
|
case "end":
|
|
3665
|
-
return
|
|
3829
|
+
return _context30.stop();
|
|
3666
3830
|
}
|
|
3667
|
-
},
|
|
3831
|
+
}, _callee28, this);
|
|
3668
3832
|
}));
|
|
3669
|
-
function changeBookingStatus(
|
|
3833
|
+
function changeBookingStatus(_x31) {
|
|
3670
3834
|
return _changeBookingStatus.apply(this, arguments);
|
|
3671
3835
|
}
|
|
3672
3836
|
return changeBookingStatus;
|
|
@@ -3684,11 +3848,11 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3684
3848
|
}, {
|
|
3685
3849
|
key: "createOrderByCheckout",
|
|
3686
3850
|
value: (function () {
|
|
3687
|
-
var _createOrderByCheckout = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3851
|
+
var _createOrderByCheckout = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(params) {
|
|
3688
3852
|
var _params$payments, _params$bookings2, _params$relation_prod2, _params$payments2, _params$payments3, _params$bookings3, _params$relation_prod3, _params$payments4;
|
|
3689
3853
|
var onlineStorePaymentCodeList, _orderData$payments, _orderData$bookings, _orderData$relation_p, _orderData$payments2, _orderData$payments3, _orderData$bookings2, _orderData$relation_p2, _orderData$payments4, _orderData$payments5, _response$data, orderData, response;
|
|
3690
|
-
return _regeneratorRuntime().wrap(function
|
|
3691
|
-
while (1) switch (
|
|
3854
|
+
return _regeneratorRuntime().wrap(function _callee29$(_context31) {
|
|
3855
|
+
while (1) switch (_context31.prev = _context31.next) {
|
|
3692
3856
|
case 0:
|
|
3693
3857
|
// 过滤掉由在线店铺下单的 payment 支付数据
|
|
3694
3858
|
onlineStorePaymentCodeList = ['WXPAY', 'WECHAT', 'ALIPAY', 'APPLE_PAY', 'CREDIT_CARD_3DS', 'CREDIT_CARD_TOKEN', 'GOOGLE_PAY', 'GOOGLE_PAY_3DS', 'CREDIT_CARD'];
|
|
@@ -3722,7 +3886,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3722
3886
|
relationProductsCount: ((_params$relation_prod3 = params.relation_products) === null || _params$relation_prod3 === void 0 ? void 0 : _params$relation_prod3.length) || 0,
|
|
3723
3887
|
paymentsCount: ((_params$payments4 = params.payments) === null || _params$payments4 === void 0 ? void 0 : _params$payments4.length) || 0
|
|
3724
3888
|
});
|
|
3725
|
-
|
|
3889
|
+
_context31.prev = 4;
|
|
3726
3890
|
// 构建订单数据,设置默认值并允许 params 覆盖
|
|
3727
3891
|
orderData = _objectSpread({
|
|
3728
3892
|
sales_channel: 'my_pisel',
|
|
@@ -3784,13 +3948,13 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3784
3948
|
hasOrderId: !!orderData.order_id,
|
|
3785
3949
|
smallTicketDataFlag: orderData.small_ticket_data_flag
|
|
3786
3950
|
});
|
|
3787
|
-
|
|
3788
|
-
return this.request.post('/
|
|
3951
|
+
_context31.next = 12;
|
|
3952
|
+
return this.request.post('/order/checkout', orderData, {
|
|
3789
3953
|
osServer: true,
|
|
3790
3954
|
customToast: function customToast() {}
|
|
3791
3955
|
});
|
|
3792
3956
|
case 12:
|
|
3793
|
-
response =
|
|
3957
|
+
response = _context31.sent;
|
|
3794
3958
|
this.logInfo('Order API called successfully', {
|
|
3795
3959
|
response: response
|
|
3796
3960
|
});
|
|
@@ -3798,22 +3962,22 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3798
3962
|
success: !!response,
|
|
3799
3963
|
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)
|
|
3800
3964
|
});
|
|
3801
|
-
return
|
|
3965
|
+
return _context31.abrupt("return", response);
|
|
3802
3966
|
case 18:
|
|
3803
|
-
|
|
3804
|
-
|
|
3805
|
-
console.error('[Order] createOrderByCheckout 创建订单失败:',
|
|
3967
|
+
_context31.prev = 18;
|
|
3968
|
+
_context31.t0 = _context31["catch"](4);
|
|
3969
|
+
console.error('[Order] createOrderByCheckout 创建订单失败:', _context31.t0);
|
|
3806
3970
|
this.logInfo('Order API called failed', {
|
|
3807
|
-
error:
|
|
3971
|
+
error: _context31.t0 instanceof Error ? _context31.t0.message : String(_context31.t0)
|
|
3808
3972
|
});
|
|
3809
|
-
throw
|
|
3973
|
+
throw _context31.t0;
|
|
3810
3974
|
case 23:
|
|
3811
3975
|
case "end":
|
|
3812
|
-
return
|
|
3976
|
+
return _context31.stop();
|
|
3813
3977
|
}
|
|
3814
|
-
},
|
|
3978
|
+
}, _callee29, this, [[4, 18]]);
|
|
3815
3979
|
}));
|
|
3816
|
-
function createOrderByCheckout(
|
|
3980
|
+
function createOrderByCheckout(_x32) {
|
|
3817
3981
|
return _createOrderByCheckout.apply(this, arguments);
|
|
3818
3982
|
}
|
|
3819
3983
|
return createOrderByCheckout;
|
|
@@ -3821,24 +3985,24 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3821
3985
|
}, {
|
|
3822
3986
|
key: "submitSalesOrder",
|
|
3823
3987
|
value: function () {
|
|
3824
|
-
var _submitSalesOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3988
|
+
var _submitSalesOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(params) {
|
|
3825
3989
|
var url, query, fetchUrl;
|
|
3826
|
-
return _regeneratorRuntime().wrap(function
|
|
3827
|
-
while (1) switch (
|
|
3990
|
+
return _regeneratorRuntime().wrap(function _callee30$(_context32) {
|
|
3991
|
+
while (1) switch (_context32.prev = _context32.next) {
|
|
3828
3992
|
case 0:
|
|
3829
3993
|
url = params.url, query = params.query;
|
|
3830
3994
|
fetchUrl = url || '/order/sales/checkout';
|
|
3831
|
-
return
|
|
3995
|
+
return _context32.abrupt("return", this.request.post(fetchUrl, query, {
|
|
3832
3996
|
osServer: true,
|
|
3833
3997
|
customToast: function customToast() {}
|
|
3834
3998
|
}));
|
|
3835
3999
|
case 3:
|
|
3836
4000
|
case "end":
|
|
3837
|
-
return
|
|
4001
|
+
return _context32.stop();
|
|
3838
4002
|
}
|
|
3839
|
-
},
|
|
4003
|
+
}, _callee30, this);
|
|
3840
4004
|
}));
|
|
3841
|
-
function submitSalesOrder(
|
|
4005
|
+
function submitSalesOrder(_x33) {
|
|
3842
4006
|
return _submitSalesOrder.apply(this, arguments);
|
|
3843
4007
|
}
|
|
3844
4008
|
return submitSalesOrder;
|
|
@@ -3852,37 +4016,37 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3852
4016
|
}, {
|
|
3853
4017
|
key: "sendCustomerPayLink",
|
|
3854
4018
|
value: (function () {
|
|
3855
|
-
var _sendCustomerPayLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4019
|
+
var _sendCustomerPayLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(params) {
|
|
3856
4020
|
var _params$emails;
|
|
3857
4021
|
var orderIds;
|
|
3858
|
-
return _regeneratorRuntime().wrap(function
|
|
3859
|
-
while (1) switch (
|
|
4022
|
+
return _regeneratorRuntime().wrap(function _callee31$(_context33) {
|
|
4023
|
+
while (1) switch (_context33.prev = _context33.next) {
|
|
3860
4024
|
case 0:
|
|
3861
4025
|
orderIds = params.order_ids || params.orderIds || [];
|
|
3862
4026
|
if (orderIds.length) {
|
|
3863
|
-
|
|
4027
|
+
_context33.next = 3;
|
|
3864
4028
|
break;
|
|
3865
4029
|
}
|
|
3866
4030
|
throw new Error('发送支付链接前必须先提交本地订单并取得订单 ID');
|
|
3867
4031
|
case 3:
|
|
3868
4032
|
if ((_params$emails = params.emails) !== null && _params$emails !== void 0 && _params$emails.length) {
|
|
3869
|
-
|
|
4033
|
+
_context33.next = 5;
|
|
3870
4034
|
break;
|
|
3871
4035
|
}
|
|
3872
4036
|
throw new Error('发送支付链接需要至少一个邮箱');
|
|
3873
4037
|
case 5:
|
|
3874
|
-
return
|
|
4038
|
+
return _context33.abrupt("return", this.request.post('/order/batch-email', {
|
|
3875
4039
|
order_ids: orderIds,
|
|
3876
4040
|
notify_action: params.notify_action || 'order_payment_reminder',
|
|
3877
4041
|
emails: params.emails
|
|
3878
4042
|
}));
|
|
3879
4043
|
case 6:
|
|
3880
4044
|
case "end":
|
|
3881
|
-
return
|
|
4045
|
+
return _context33.stop();
|
|
3882
4046
|
}
|
|
3883
|
-
},
|
|
4047
|
+
}, _callee31, this);
|
|
3884
4048
|
}));
|
|
3885
|
-
function sendCustomerPayLink(
|
|
4049
|
+
function sendCustomerPayLink(_x34) {
|
|
3886
4050
|
return _sendCustomerPayLink.apply(this, arguments);
|
|
3887
4051
|
}
|
|
3888
4052
|
return sendCustomerPayLink;
|
|
@@ -3890,19 +4054,19 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3890
4054
|
}, {
|
|
3891
4055
|
key: "getSalesOrderByLookup",
|
|
3892
4056
|
value: function () {
|
|
3893
|
-
var _getSalesOrderByLookup = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4057
|
+
var _getSalesOrderByLookup = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(params) {
|
|
3894
4058
|
var lookup, res;
|
|
3895
|
-
return _regeneratorRuntime().wrap(function
|
|
3896
|
-
while (1) switch (
|
|
4059
|
+
return _regeneratorRuntime().wrap(function _callee32$(_context34) {
|
|
4060
|
+
while (1) switch (_context34.prev = _context34.next) {
|
|
3897
4061
|
case 0:
|
|
3898
4062
|
lookup = params.lookup === undefined || params.lookup === null ? '' : String(params.lookup).trim();
|
|
3899
4063
|
if (lookup) {
|
|
3900
|
-
|
|
4064
|
+
_context34.next = 3;
|
|
3901
4065
|
break;
|
|
3902
4066
|
}
|
|
3903
4067
|
throw new Error('加载销售详情需要 lookup');
|
|
3904
4068
|
case 3:
|
|
3905
|
-
|
|
4069
|
+
_context34.next = 5;
|
|
3906
4070
|
return this.request.get("/order/sales/".concat(encodeURIComponent(lookup)), _objectSpread({
|
|
3907
4071
|
with: ['products', 'bookings', 'payments', 'customer', 'summary', 'contacts_info']
|
|
3908
4072
|
}, params.forceRemote ? {
|
|
@@ -3911,18 +4075,18 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3911
4075
|
osServer: true
|
|
3912
4076
|
});
|
|
3913
4077
|
case 5:
|
|
3914
|
-
res =
|
|
4078
|
+
res = _context34.sent;
|
|
3915
4079
|
if (res.code === 200) {
|
|
3916
4080
|
this.store.lastOrderInfo = res.data;
|
|
3917
4081
|
}
|
|
3918
|
-
return
|
|
4082
|
+
return _context34.abrupt("return", res);
|
|
3919
4083
|
case 8:
|
|
3920
4084
|
case "end":
|
|
3921
|
-
return
|
|
4085
|
+
return _context34.stop();
|
|
3922
4086
|
}
|
|
3923
|
-
},
|
|
4087
|
+
}, _callee32, this);
|
|
3924
4088
|
}));
|
|
3925
|
-
function getSalesOrderByLookup(
|
|
4089
|
+
function getSalesOrderByLookup(_x35) {
|
|
3926
4090
|
return _getSalesOrderByLookup.apply(this, arguments);
|
|
3927
4091
|
}
|
|
3928
4092
|
return getSalesOrderByLookup;
|
|
@@ -3936,11 +4100,11 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3936
4100
|
}, {
|
|
3937
4101
|
key: "hydrateTempOrderFromRecord",
|
|
3938
4102
|
value: (function () {
|
|
3939
|
-
var _hydrateTempOrderFromRecord = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4103
|
+
var _hydrateTempOrderFromRecord = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(record, options) {
|
|
3940
4104
|
var _this$store$discount13, _this$store$discount14;
|
|
3941
4105
|
var raw, nextTempOrder, rawSummary, summarySurcharges, hydratedEditDiscounts;
|
|
3942
|
-
return _regeneratorRuntime().wrap(function
|
|
3943
|
-
while (1) switch (
|
|
4106
|
+
return _regeneratorRuntime().wrap(function _callee33$(_context35) {
|
|
4107
|
+
while (1) switch (_context35.prev = _context35.next) {
|
|
3944
4108
|
case 0:
|
|
3945
4109
|
raw = record && _typeof(record) === 'object' && record.data && record.order_id == null ? record.data : record || {};
|
|
3946
4110
|
nextTempOrder = this.normalizeTempOrderForRuntime(raw);
|
|
@@ -3963,30 +4127,30 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3963
4127
|
});
|
|
3964
4128
|
this.store.lastOrderInfo = raw.lastOrderInfo || raw;
|
|
3965
4129
|
hydratedEditDiscounts = this.collectHydratedEditDiscounts(nextTempOrder.products);
|
|
3966
|
-
|
|
4130
|
+
_context35.next = 11;
|
|
3967
4131
|
return (_this$store$discount13 = this.store.discount) === null || _this$store$discount13 === void 0 ? void 0 : _this$store$discount13.setOriginalDiscountList(hydratedEditDiscounts);
|
|
3968
4132
|
case 11:
|
|
3969
|
-
|
|
4133
|
+
_context35.next = 13;
|
|
3970
4134
|
return (_this$store$discount14 = this.store.discount) === null || _this$store$discount14 === void 0 ? void 0 : _this$store$discount14.setDiscountList(hydratedEditDiscounts);
|
|
3971
4135
|
case 13:
|
|
3972
4136
|
if (!(options !== null && options !== void 0 && options.recalcOnHydrate)) {
|
|
3973
|
-
|
|
4137
|
+
_context35.next = 16;
|
|
3974
4138
|
break;
|
|
3975
4139
|
}
|
|
3976
|
-
|
|
4140
|
+
_context35.next = 16;
|
|
3977
4141
|
return this.recalculateSummary({
|
|
3978
4142
|
createIfMissing: false
|
|
3979
4143
|
});
|
|
3980
4144
|
case 16:
|
|
3981
4145
|
this.persistTempOrder();
|
|
3982
|
-
return
|
|
4146
|
+
return _context35.abrupt("return", nextTempOrder);
|
|
3983
4147
|
case 18:
|
|
3984
4148
|
case "end":
|
|
3985
|
-
return
|
|
4149
|
+
return _context35.stop();
|
|
3986
4150
|
}
|
|
3987
|
-
},
|
|
4151
|
+
}, _callee33, this);
|
|
3988
4152
|
}));
|
|
3989
|
-
function hydrateTempOrderFromRecord(
|
|
4153
|
+
function hydrateTempOrderFromRecord(_x36, _x37) {
|
|
3990
4154
|
return _hydrateTempOrderFromRecord.apply(this, arguments);
|
|
3991
4155
|
}
|
|
3992
4156
|
return hydrateTempOrderFromRecord;
|
|
@@ -4045,7 +4209,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4045
4209
|
_step18;
|
|
4046
4210
|
try {
|
|
4047
4211
|
for (_iterator18.s(); !(_step18 = _iterator18.n()).done;) {
|
|
4048
|
-
var _product$metadata7,
|
|
4212
|
+
var _product$metadata7, _ref65, _ref66, _existed$origin, _rawProduct$metadata;
|
|
4049
4213
|
var _step18$value = _slicedToArray(_step18.value, 2),
|
|
4050
4214
|
index = _step18$value[0],
|
|
4051
4215
|
product = _step18$value[1];
|
|
@@ -4053,7 +4217,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4053
4217
|
if (!uid) continue;
|
|
4054
4218
|
var existed = productsByUid[uid] && _typeof(productsByUid[uid]) === 'object' ? productsByUid[uid] : {};
|
|
4055
4219
|
var rawProduct = rawProducts[index] && _typeof(rawProducts[index]) === 'object' ? rawProducts[index] : product;
|
|
4056
|
-
var origin = (
|
|
4220
|
+
var origin = (_ref65 = (_ref66 = (_existed$origin = existed.origin) !== null && _existed$origin !== void 0 ? _existed$origin : rawProduct._origin) !== null && _ref66 !== void 0 ? _ref66 : (_rawProduct$metadata = rawProduct.metadata) === null || _rawProduct$metadata === void 0 ? void 0 : _rawProduct$metadata.origin) !== null && _ref65 !== void 0 ? _ref65 : rawProduct;
|
|
4057
4221
|
var originSnapshot = cloneDeep(origin);
|
|
4058
4222
|
var productOptionString = this.buildHydratedProductOptionString(rawProduct) || this.buildHydratedProductOptionString(product);
|
|
4059
4223
|
if (productOptionString && originSnapshot && _typeof(originSnapshot) === 'object') {
|
|
@@ -4121,10 +4285,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4121
4285
|
}, {
|
|
4122
4286
|
key: "normalizeHydratedProductOptionItem",
|
|
4123
4287
|
value: function normalizeHydratedProductOptionItem(optionItem) {
|
|
4124
|
-
var
|
|
4125
|
-
var rawNum = (
|
|
4288
|
+
var _ref67, _optionItem$num, _ref68, _optionItem$add_price;
|
|
4289
|
+
var rawNum = (_ref67 = (_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 && _ref67 !== void 0 ? _ref67 : 1;
|
|
4126
4290
|
var parsedNum = Number(rawNum);
|
|
4127
|
-
var rawPrice = (
|
|
4291
|
+
var rawPrice = (_ref68 = (_optionItem$add_price = optionItem === null || optionItem === void 0 ? void 0 : optionItem.add_price) !== null && _optionItem$add_price !== void 0 ? _optionItem$add_price : optionItem === null || optionItem === void 0 ? void 0 : optionItem.price) !== null && _ref68 !== void 0 ? _ref68 : 0;
|
|
4128
4292
|
var parsedPrice = Number(rawPrice);
|
|
4129
4293
|
var normalized = _objectSpread(_objectSpread({}, optionItem), {}, {
|
|
4130
4294
|
option_group_item_id: optionItem === null || optionItem === void 0 ? void 0 : optionItem.option_group_item_id,
|
|
@@ -4180,25 +4344,25 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4180
4344
|
}, {
|
|
4181
4345
|
key: "getOrderInfo",
|
|
4182
4346
|
value: function () {
|
|
4183
|
-
var _getOrderInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4347
|
+
var _getOrderInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(order_id) {
|
|
4184
4348
|
var res;
|
|
4185
|
-
return _regeneratorRuntime().wrap(function
|
|
4186
|
-
while (1) switch (
|
|
4349
|
+
return _regeneratorRuntime().wrap(function _callee34$(_context36) {
|
|
4350
|
+
while (1) switch (_context36.prev = _context36.next) {
|
|
4187
4351
|
case 0:
|
|
4188
|
-
|
|
4352
|
+
_context36.next = 2;
|
|
4189
4353
|
return this.request.get("/order/sales/".concat(order_id), {
|
|
4190
4354
|
with: ['products', 'bookings']
|
|
4191
4355
|
});
|
|
4192
4356
|
case 2:
|
|
4193
|
-
res =
|
|
4194
|
-
return
|
|
4357
|
+
res = _context36.sent;
|
|
4358
|
+
return _context36.abrupt("return", res);
|
|
4195
4359
|
case 4:
|
|
4196
4360
|
case "end":
|
|
4197
|
-
return
|
|
4361
|
+
return _context36.stop();
|
|
4198
4362
|
}
|
|
4199
|
-
},
|
|
4363
|
+
}, _callee34, this);
|
|
4200
4364
|
}));
|
|
4201
|
-
function getOrderInfo(
|
|
4365
|
+
function getOrderInfo(_x38) {
|
|
4202
4366
|
return _getOrderInfo.apply(this, arguments);
|
|
4203
4367
|
}
|
|
4204
4368
|
return getOrderInfo;
|
|
@@ -4237,9 +4401,9 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4237
4401
|
_step23;
|
|
4238
4402
|
try {
|
|
4239
4403
|
for (_iterator23.s(); !(_step23 = _iterator23.n()).done;) {
|
|
4240
|
-
var
|
|
4404
|
+
var _ref69, _bundle$num3;
|
|
4241
4405
|
var bundle = _step23.value;
|
|
4242
|
-
var bundleQty = new Decimal(Number(qty) || 1).times(Number((
|
|
4406
|
+
var bundleQty = new Decimal(Number(qty) || 1).times(Number((_ref69 = (_bundle$num3 = bundle === null || bundle === void 0 ? void 0 : bundle.num) !== null && _bundle$num3 !== void 0 ? _bundle$num3 : bundle === null || bundle === void 0 ? void 0 : bundle.quantity) !== null && _ref69 !== void 0 ? _ref69 : 1) || 1).toNumber();
|
|
4243
4407
|
var _iterator24 = _createForOfIteratorHelper((bundle === null || bundle === void 0 ? void 0 : bundle.discount_list) || []),
|
|
4244
4408
|
_step24;
|
|
4245
4409
|
try {
|