@pisell/pisellos 0.10.65 → 0.10.66
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/OpenData/contactInfo.d.ts +20 -0
- package/dist/modules/OpenData/contactInfo.js +70 -0
- package/dist/modules/OpenData/index.d.ts +1 -0
- package/dist/modules/OpenData/index.js +1 -0
- package/dist/modules/OpenData/types.d.ts +9 -0
- package/dist/solution/BaseSales/index.d.ts +7 -0
- package/dist/solution/BaseSales/index.js +966 -844
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +5 -14
- package/dist/solution/BookingTicket/index.js +460 -433
- package/lib/modules/OpenData/contactInfo.d.ts +20 -0
- package/lib/modules/OpenData/contactInfo.js +56 -0
- package/lib/modules/OpenData/index.d.ts +1 -0
- package/lib/modules/OpenData/index.js +12 -0
- package/lib/modules/OpenData/types.d.ts +9 -0
- package/lib/solution/BaseSales/index.d.ts +7 -0
- package/lib/solution/BaseSales/index.js +31 -0
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +5 -14
- package/lib/solution/BookingTicket/index.js +13 -2
- package/package.json +1 -1
|
@@ -40,6 +40,7 @@ import { OrderModule } from "../../modules/Order";
|
|
|
40
40
|
import { isFulfillmentTimingBooking } from "../../modules/Order/pickupTiming";
|
|
41
41
|
import { PickupTimingController } from "./pickupTiming";
|
|
42
42
|
import { getProductHolderRelations, hasProductBooking } from "../../modules/Order/holderRelations";
|
|
43
|
+
import { resolveContactInfoConfig, getMissingContactInfoFields, ContactInfoRequiredError } from "../../modules/OpenData/contactInfo";
|
|
43
44
|
import Decimal from 'decimal.js';
|
|
44
45
|
import { cloneDeep, isEqual, mergeWith } from 'lodash-es';
|
|
45
46
|
import { createModule } from "../BookingByStep/types";
|
|
@@ -2897,8 +2898,97 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2897
2898
|
if (!this.store.order) throw new Error('order 模块未初始化');
|
|
2898
2899
|
return this.store.order.updateTempOrderContactsInfo(contactsInfo);
|
|
2899
2900
|
}
|
|
2900
|
-
|
|
2901
|
-
|
|
2901
|
+
}, {
|
|
2902
|
+
key: "loadContactInfoOpenData",
|
|
2903
|
+
value: function () {
|
|
2904
|
+
var _loadContactInfoOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24() {
|
|
2905
|
+
var _this$otherParams$ope, _this$otherParams18;
|
|
2906
|
+
return _regeneratorRuntime().wrap(function _callee24$(_context24) {
|
|
2907
|
+
while (1) switch (_context24.prev = _context24.next) {
|
|
2908
|
+
case 0:
|
|
2909
|
+
return _context24.abrupt("return", (_this$otherParams$ope = (_this$otherParams18 = this.otherParams) === null || _this$otherParams18 === void 0 ? void 0 : _this$otherParams18.openData) !== null && _this$otherParams$ope !== void 0 ? _this$otherParams$ope : null);
|
|
2910
|
+
case 1:
|
|
2911
|
+
case "end":
|
|
2912
|
+
return _context24.stop();
|
|
2913
|
+
}
|
|
2914
|
+
}, _callee24, this);
|
|
2915
|
+
}));
|
|
2916
|
+
function loadContactInfoOpenData() {
|
|
2917
|
+
return _loadContactInfoOpenData.apply(this, arguments);
|
|
2918
|
+
}
|
|
2919
|
+
return loadContactInfoOpenData;
|
|
2920
|
+
}()
|
|
2921
|
+
}, {
|
|
2922
|
+
key: "getContactInfoConfig",
|
|
2923
|
+
value: function () {
|
|
2924
|
+
var _getContactInfoConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25() {
|
|
2925
|
+
var scope, data;
|
|
2926
|
+
return _regeneratorRuntime().wrap(function _callee25$(_context25) {
|
|
2927
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
2928
|
+
case 0:
|
|
2929
|
+
scope = this.getPickupTimingScope();
|
|
2930
|
+
_context25.next = 3;
|
|
2931
|
+
return this.loadContactInfoOpenData();
|
|
2932
|
+
case 3:
|
|
2933
|
+
data = _context25.sent;
|
|
2934
|
+
if (!(scope !== this.getPickupTimingScope())) {
|
|
2935
|
+
_context25.next = 6;
|
|
2936
|
+
break;
|
|
2937
|
+
}
|
|
2938
|
+
throw new Error('Store settings changed. Please try again.');
|
|
2939
|
+
case 6:
|
|
2940
|
+
return _context25.abrupt("return", resolveContactInfoConfig(data));
|
|
2941
|
+
case 7:
|
|
2942
|
+
case "end":
|
|
2943
|
+
return _context25.stop();
|
|
2944
|
+
}
|
|
2945
|
+
}, _callee25, this);
|
|
2946
|
+
}));
|
|
2947
|
+
function getContactInfoConfig() {
|
|
2948
|
+
return _getContactInfoConfig.apply(this, arguments);
|
|
2949
|
+
}
|
|
2950
|
+
return getContactInfoConfig;
|
|
2951
|
+
}()
|
|
2952
|
+
}, {
|
|
2953
|
+
key: "validateContactInfo",
|
|
2954
|
+
value: function () {
|
|
2955
|
+
var _validateContactInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26() {
|
|
2956
|
+
var _order$_extend, _current$_extend;
|
|
2957
|
+
var order, identity, customerId, config, current, missing;
|
|
2958
|
+
return _regeneratorRuntime().wrap(function _callee26$(_context26) {
|
|
2959
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
2960
|
+
case 0:
|
|
2961
|
+
order = this.getTempOrder();
|
|
2962
|
+
identity = (order === null || order === void 0 || (_order$_extend = order._extend) === null || _order$_extend === void 0 ? void 0 : _order$_extend.localId) || (order === null || order === void 0 ? void 0 : order.external_sale_number) || (order === null || order === void 0 ? void 0 : order.order_id) || order;
|
|
2963
|
+
customerId = order === null || order === void 0 ? void 0 : order.customer_id;
|
|
2964
|
+
_context26.next = 5;
|
|
2965
|
+
return this.getContactInfoConfig();
|
|
2966
|
+
case 5:
|
|
2967
|
+
config = _context26.sent;
|
|
2968
|
+
current = this.getTempOrder();
|
|
2969
|
+
if (!(identity !== ((current === null || current === void 0 || (_current$_extend = current._extend) === null || _current$_extend === void 0 ? void 0 : _current$_extend.localId) || (current === null || current === void 0 ? void 0 : current.external_sale_number) || (current === null || current === void 0 ? void 0 : current.order_id) || current) || customerId !== (current === null || current === void 0 ? void 0 : current.customer_id))) {
|
|
2970
|
+
_context26.next = 9;
|
|
2971
|
+
break;
|
|
2972
|
+
}
|
|
2973
|
+
throw new Error('The order changed. Please try again.');
|
|
2974
|
+
case 9:
|
|
2975
|
+
missing = getMissingContactInfoFields(config, current === null || current === void 0 ? void 0 : current.contacts_info);
|
|
2976
|
+
if (!missing.length) {
|
|
2977
|
+
_context26.next = 12;
|
|
2978
|
+
break;
|
|
2979
|
+
}
|
|
2980
|
+
throw new ContactInfoRequiredError(missing);
|
|
2981
|
+
case 12:
|
|
2982
|
+
case "end":
|
|
2983
|
+
return _context26.stop();
|
|
2984
|
+
}
|
|
2985
|
+
}, _callee26, this);
|
|
2986
|
+
}));
|
|
2987
|
+
function validateContactInfo() {
|
|
2988
|
+
return _validateContactInfo.apply(this, arguments);
|
|
2989
|
+
}
|
|
2990
|
+
return validateContactInfo;
|
|
2991
|
+
}() /** @deprecated OrderModule 不再负责 tempOrder localStorage 持久化。 */
|
|
2902
2992
|
}, {
|
|
2903
2993
|
key: "setEnableTempOrderPersist",
|
|
2904
2994
|
value: function setEnableTempOrderPersist(enabled) {
|
|
@@ -2924,40 +3014,40 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2924
3014
|
}, {
|
|
2925
3015
|
key: "addNewOrder",
|
|
2926
3016
|
value: function () {
|
|
2927
|
-
var _addNewOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3017
|
+
var _addNewOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27() {
|
|
2928
3018
|
var tempOrder;
|
|
2929
|
-
return _regeneratorRuntime().wrap(function
|
|
2930
|
-
while (1) switch (
|
|
3019
|
+
return _regeneratorRuntime().wrap(function _callee27$(_context27) {
|
|
3020
|
+
while (1) switch (_context27.prev = _context27.next) {
|
|
2931
3021
|
case 0:
|
|
2932
|
-
|
|
3022
|
+
_context27.prev = 0;
|
|
2933
3023
|
if (this.store.order) {
|
|
2934
|
-
|
|
3024
|
+
_context27.next = 3;
|
|
2935
3025
|
break;
|
|
2936
3026
|
}
|
|
2937
3027
|
throw new Error('order 模块未初始化');
|
|
2938
3028
|
case 3:
|
|
2939
|
-
|
|
3029
|
+
_context27.next = 5;
|
|
2940
3030
|
return this.store.order.addNewOrder();
|
|
2941
3031
|
case 5:
|
|
2942
|
-
tempOrder =
|
|
3032
|
+
tempOrder = _context27.sent;
|
|
2943
3033
|
if (!(this.syncAppDataToTempOrder(tempOrder) && this.isTempOrderPersistEnabled())) {
|
|
2944
|
-
|
|
3034
|
+
_context27.next = 10;
|
|
2945
3035
|
break;
|
|
2946
3036
|
}
|
|
2947
3037
|
this.store.order.persistTempOrder();
|
|
2948
|
-
|
|
3038
|
+
_context27.next = 10;
|
|
2949
3039
|
return this.store.order.saveDraft();
|
|
2950
3040
|
case 10:
|
|
2951
|
-
return
|
|
3041
|
+
return _context27.abrupt("return", tempOrder);
|
|
2952
3042
|
case 13:
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
throw
|
|
3043
|
+
_context27.prev = 13;
|
|
3044
|
+
_context27.t0 = _context27["catch"](0);
|
|
3045
|
+
throw _context27.t0;
|
|
2956
3046
|
case 16:
|
|
2957
3047
|
case "end":
|
|
2958
|
-
return
|
|
3048
|
+
return _context27.stop();
|
|
2959
3049
|
}
|
|
2960
|
-
},
|
|
3050
|
+
}, _callee27, this, [[0, 13]]);
|
|
2961
3051
|
}));
|
|
2962
3052
|
function addNewOrder() {
|
|
2963
3053
|
return _addNewOrder.apply(this, arguments);
|
|
@@ -2967,22 +3057,22 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2967
3057
|
}, {
|
|
2968
3058
|
key: "saveDraft",
|
|
2969
3059
|
value: function () {
|
|
2970
|
-
var _saveDraft = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2971
|
-
return _regeneratorRuntime().wrap(function
|
|
2972
|
-
while (1) switch (
|
|
3060
|
+
var _saveDraft = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28() {
|
|
3061
|
+
return _regeneratorRuntime().wrap(function _callee28$(_context28) {
|
|
3062
|
+
while (1) switch (_context28.prev = _context28.next) {
|
|
2973
3063
|
case 0:
|
|
2974
3064
|
if (this.store.order) {
|
|
2975
|
-
|
|
3065
|
+
_context28.next = 2;
|
|
2976
3066
|
break;
|
|
2977
3067
|
}
|
|
2978
3068
|
throw new Error('order 模块未初始化');
|
|
2979
3069
|
case 2:
|
|
2980
|
-
return
|
|
3070
|
+
return _context28.abrupt("return", this.store.order.saveDraft());
|
|
2981
3071
|
case 3:
|
|
2982
3072
|
case "end":
|
|
2983
|
-
return
|
|
3073
|
+
return _context28.stop();
|
|
2984
3074
|
}
|
|
2985
|
-
},
|
|
3075
|
+
}, _callee28, this);
|
|
2986
3076
|
}));
|
|
2987
3077
|
function saveDraft() {
|
|
2988
3078
|
return _saveDraft.apply(this, arguments);
|
|
@@ -2993,14 +3083,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2993
3083
|
}, {
|
|
2994
3084
|
key: "restoreOrder",
|
|
2995
3085
|
value: function () {
|
|
2996
|
-
var _restoreOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3086
|
+
var _restoreOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29() {
|
|
2997
3087
|
var _this$store$payment, tempOrder, appDataChanged, wallet;
|
|
2998
|
-
return _regeneratorRuntime().wrap(function
|
|
2999
|
-
while (1) switch (
|
|
3088
|
+
return _regeneratorRuntime().wrap(function _callee29$(_context29) {
|
|
3089
|
+
while (1) switch (_context29.prev = _context29.next) {
|
|
3000
3090
|
case 0:
|
|
3001
|
-
|
|
3091
|
+
_context29.prev = 0;
|
|
3002
3092
|
if (this.store.order) {
|
|
3003
|
-
|
|
3093
|
+
_context29.next = 3;
|
|
3004
3094
|
break;
|
|
3005
3095
|
}
|
|
3006
3096
|
throw new Error('scanOrder 解决方案需要 order 模块支持');
|
|
@@ -3013,37 +3103,37 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3013
3103
|
this.hasManualDiscountSelection = false;
|
|
3014
3104
|
wallet = (_this$store$payment = this.store.payment) === null || _this$store$payment === void 0 ? void 0 : _this$store$payment.wallet;
|
|
3015
3105
|
if (!wallet) {
|
|
3016
|
-
|
|
3106
|
+
_context29.next = 14;
|
|
3017
3107
|
break;
|
|
3018
3108
|
}
|
|
3019
3109
|
this.walletAssetsRefreshSequence += 1;
|
|
3020
3110
|
wallet.clearAllCache();
|
|
3021
|
-
|
|
3111
|
+
_context29.next = 14;
|
|
3022
3112
|
return this.publishWalletAssetsState(wallet.getWalletAssetsState());
|
|
3023
3113
|
case 14:
|
|
3024
|
-
|
|
3114
|
+
_context29.next = 16;
|
|
3025
3115
|
return this.effectsEmit('onTempOrderReplaced', {
|
|
3026
3116
|
tempOrder: tempOrder
|
|
3027
3117
|
});
|
|
3028
3118
|
case 16:
|
|
3029
3119
|
if (!(appDataChanged && this.isTempOrderPersistEnabled())) {
|
|
3030
|
-
|
|
3120
|
+
_context29.next = 20;
|
|
3031
3121
|
break;
|
|
3032
3122
|
}
|
|
3033
3123
|
this.store.order.persistTempOrder();
|
|
3034
|
-
|
|
3124
|
+
_context29.next = 20;
|
|
3035
3125
|
return this.store.order.saveDraft();
|
|
3036
3126
|
case 20:
|
|
3037
|
-
return
|
|
3127
|
+
return _context29.abrupt("return", tempOrder);
|
|
3038
3128
|
case 23:
|
|
3039
|
-
|
|
3040
|
-
|
|
3041
|
-
throw
|
|
3129
|
+
_context29.prev = 23;
|
|
3130
|
+
_context29.t0 = _context29["catch"](0);
|
|
3131
|
+
throw _context29.t0;
|
|
3042
3132
|
case 26:
|
|
3043
3133
|
case "end":
|
|
3044
|
-
return
|
|
3134
|
+
return _context29.stop();
|
|
3045
3135
|
}
|
|
3046
|
-
},
|
|
3136
|
+
}, _callee29, this, [[0, 23]]);
|
|
3047
3137
|
}));
|
|
3048
3138
|
function restoreOrder() {
|
|
3049
3139
|
return _restoreOrder.apply(this, arguments);
|
|
@@ -3057,22 +3147,22 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3057
3147
|
}, {
|
|
3058
3148
|
key: "clearOrderCartLines",
|
|
3059
3149
|
value: (function () {
|
|
3060
|
-
var _clearOrderCartLines = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3150
|
+
var _clearOrderCartLines = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30() {
|
|
3061
3151
|
var tempOrder;
|
|
3062
|
-
return _regeneratorRuntime().wrap(function
|
|
3063
|
-
while (1) switch (
|
|
3152
|
+
return _regeneratorRuntime().wrap(function _callee30$(_context30) {
|
|
3153
|
+
while (1) switch (_context30.prev = _context30.next) {
|
|
3064
3154
|
case 0:
|
|
3065
|
-
|
|
3155
|
+
_context30.prev = 0;
|
|
3066
3156
|
if (this.store.order) {
|
|
3067
|
-
|
|
3157
|
+
_context30.next = 3;
|
|
3068
3158
|
break;
|
|
3069
3159
|
}
|
|
3070
3160
|
throw new Error('order 模块未初始化');
|
|
3071
3161
|
case 3:
|
|
3072
|
-
|
|
3162
|
+
_context30.next = 5;
|
|
3073
3163
|
return this.store.order.clearOrderCartLines();
|
|
3074
3164
|
case 5:
|
|
3075
|
-
tempOrder =
|
|
3165
|
+
tempOrder = _context30.sent;
|
|
3076
3166
|
if (this.currentSalesDetail) {
|
|
3077
3167
|
this.currentSalesDetail = _objectSpread(_objectSpread({}, this.currentSalesDetail), {}, {
|
|
3078
3168
|
products: [],
|
|
@@ -3082,29 +3172,29 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3082
3172
|
discount_list: []
|
|
3083
3173
|
});
|
|
3084
3174
|
}
|
|
3085
|
-
|
|
3175
|
+
_context30.next = 9;
|
|
3086
3176
|
return this.effectsEmit('onTempOrderReplaced', {
|
|
3087
3177
|
tempOrder: tempOrder
|
|
3088
3178
|
});
|
|
3089
3179
|
case 9:
|
|
3090
3180
|
if (!(this.syncAppDataToTempOrder(tempOrder) && this.isTempOrderPersistEnabled())) {
|
|
3091
|
-
|
|
3181
|
+
_context30.next = 13;
|
|
3092
3182
|
break;
|
|
3093
3183
|
}
|
|
3094
3184
|
this.store.order.persistTempOrder();
|
|
3095
|
-
|
|
3185
|
+
_context30.next = 13;
|
|
3096
3186
|
return this.store.order.saveDraft();
|
|
3097
3187
|
case 13:
|
|
3098
|
-
return
|
|
3188
|
+
return _context30.abrupt("return", tempOrder);
|
|
3099
3189
|
case 16:
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
throw
|
|
3190
|
+
_context30.prev = 16;
|
|
3191
|
+
_context30.t0 = _context30["catch"](0);
|
|
3192
|
+
throw _context30.t0;
|
|
3103
3193
|
case 19:
|
|
3104
3194
|
case "end":
|
|
3105
|
-
return
|
|
3195
|
+
return _context30.stop();
|
|
3106
3196
|
}
|
|
3107
|
-
},
|
|
3197
|
+
}, _callee30, this, [[0, 16]]);
|
|
3108
3198
|
}));
|
|
3109
3199
|
function clearOrderCartLines() {
|
|
3110
3200
|
return _clearOrderCartLines.apply(this, arguments);
|
|
@@ -3114,21 +3204,21 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3114
3204
|
}, {
|
|
3115
3205
|
key: "clearOrderForSettlementSwitch",
|
|
3116
3206
|
value: (function () {
|
|
3117
|
-
var _clearOrderForSettlementSwitch = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3207
|
+
var _clearOrderForSettlementSwitch = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31() {
|
|
3118
3208
|
var tempOrder;
|
|
3119
|
-
return _regeneratorRuntime().wrap(function
|
|
3120
|
-
while (1) switch (
|
|
3209
|
+
return _regeneratorRuntime().wrap(function _callee31$(_context31) {
|
|
3210
|
+
while (1) switch (_context31.prev = _context31.next) {
|
|
3121
3211
|
case 0:
|
|
3122
3212
|
if (this.store.order) {
|
|
3123
|
-
|
|
3213
|
+
_context31.next = 2;
|
|
3124
3214
|
break;
|
|
3125
3215
|
}
|
|
3126
3216
|
throw new Error('order 模块未初始化');
|
|
3127
3217
|
case 2:
|
|
3128
|
-
|
|
3218
|
+
_context31.next = 4;
|
|
3129
3219
|
return this.store.order.clearOrderForSettlementSwitch();
|
|
3130
3220
|
case 4:
|
|
3131
|
-
tempOrder =
|
|
3221
|
+
tempOrder = _context31.sent;
|
|
3132
3222
|
if (this.currentSalesDetail) {
|
|
3133
3223
|
this.currentSalesDetail = _objectSpread(_objectSpread({}, this.currentSalesDetail), {}, {
|
|
3134
3224
|
products: [],
|
|
@@ -3139,12 +3229,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3139
3229
|
payments: []
|
|
3140
3230
|
});
|
|
3141
3231
|
}
|
|
3142
|
-
return
|
|
3232
|
+
return _context31.abrupt("return", tempOrder);
|
|
3143
3233
|
case 7:
|
|
3144
3234
|
case "end":
|
|
3145
|
-
return
|
|
3235
|
+
return _context31.stop();
|
|
3146
3236
|
}
|
|
3147
|
-
},
|
|
3237
|
+
}, _callee31, this);
|
|
3148
3238
|
}));
|
|
3149
3239
|
function clearOrderForSettlementSwitch() {
|
|
3150
3240
|
return _clearOrderForSettlementSwitch.apply(this, arguments);
|
|
@@ -3161,32 +3251,32 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3161
3251
|
}, {
|
|
3162
3252
|
key: "getSummary",
|
|
3163
3253
|
value: function () {
|
|
3164
|
-
var _getSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3254
|
+
var _getSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32() {
|
|
3165
3255
|
var summary;
|
|
3166
|
-
return _regeneratorRuntime().wrap(function
|
|
3167
|
-
while (1) switch (
|
|
3256
|
+
return _regeneratorRuntime().wrap(function _callee32$(_context32) {
|
|
3257
|
+
while (1) switch (_context32.prev = _context32.next) {
|
|
3168
3258
|
case 0:
|
|
3169
|
-
|
|
3259
|
+
_context32.prev = 0;
|
|
3170
3260
|
if (this.store.order) {
|
|
3171
|
-
|
|
3261
|
+
_context32.next = 3;
|
|
3172
3262
|
break;
|
|
3173
3263
|
}
|
|
3174
3264
|
throw new Error('order 模块未初始化');
|
|
3175
3265
|
case 3:
|
|
3176
|
-
|
|
3266
|
+
_context32.next = 5;
|
|
3177
3267
|
return this.store.order.getOrderSummary();
|
|
3178
3268
|
case 5:
|
|
3179
|
-
summary =
|
|
3180
|
-
return
|
|
3269
|
+
summary = _context32.sent;
|
|
3270
|
+
return _context32.abrupt("return", summary);
|
|
3181
3271
|
case 9:
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
throw
|
|
3272
|
+
_context32.prev = 9;
|
|
3273
|
+
_context32.t0 = _context32["catch"](0);
|
|
3274
|
+
throw _context32.t0;
|
|
3185
3275
|
case 12:
|
|
3186
3276
|
case "end":
|
|
3187
|
-
return
|
|
3277
|
+
return _context32.stop();
|
|
3188
3278
|
}
|
|
3189
|
-
},
|
|
3279
|
+
}, _callee32, this, [[0, 9]]);
|
|
3190
3280
|
}));
|
|
3191
3281
|
function getSummary() {
|
|
3192
3282
|
return _getSummary.apply(this, arguments);
|
|
@@ -3332,7 +3422,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3332
3422
|
}, {
|
|
3333
3423
|
key: "loadDiscountConfig",
|
|
3334
3424
|
value: function () {
|
|
3335
|
-
var _loadDiscountConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3425
|
+
var _loadDiscountConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(params) {
|
|
3336
3426
|
var _this$store$order$get2,
|
|
3337
3427
|
_this$store$order8,
|
|
3338
3428
|
_tempOrder$customer2,
|
|
@@ -3345,11 +3435,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3345
3435
|
_this18 = this,
|
|
3346
3436
|
_discountModule$getDi3;
|
|
3347
3437
|
var tempOrder, orderStore, discountModule, rulesModule, orderId, customerId, currentDiscountList, originalDiscountList, hasManualDiscountSelection, discountAction, requestOrderIdentityKey, discountConfigCacheKey, requestEpoch, isCurrentRequest, getCurrentResult, searchedDiscountList, searchedDiscountIds, preparedDiscountList, _this$store$order$get4, _this$store$order10, _discountModule$setOr, prepareConfigPromise, _discountModule$setOr2, _discountModule$setDi, nextDiscountList, shouldSkipAutoApplyFetchedDiscounts, _orderStore$summary, orderTotalAmount, result, _iterator5, _step5, _product$metadata5, _tempOrder$_extend6, _product$metadata$sou, _product$metadata6, _product$metadata7, _product$original_pri, product, productUid, runtimeOrigin, totalPerUnitDiscount, optionSum, sourcePrice, newSourceSellingPrice, newMainSellingPrice;
|
|
3348
|
-
return _regeneratorRuntime().wrap(function
|
|
3349
|
-
while (1) switch (
|
|
3438
|
+
return _regeneratorRuntime().wrap(function _callee33$(_context33) {
|
|
3439
|
+
while (1) switch (_context33.prev = _context33.next) {
|
|
3350
3440
|
case 0:
|
|
3351
3441
|
if (this.store.order) {
|
|
3352
|
-
|
|
3442
|
+
_context33.next = 2;
|
|
3353
3443
|
break;
|
|
3354
3444
|
}
|
|
3355
3445
|
throw new Error('order 模块未初始化');
|
|
@@ -3395,15 +3485,15 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3395
3485
|
return !searchedDiscountIds.has(String(discount.id));
|
|
3396
3486
|
})));
|
|
3397
3487
|
if (!(customerId && customerId !== 1)) {
|
|
3398
|
-
|
|
3488
|
+
_context33.next = 37;
|
|
3399
3489
|
break;
|
|
3400
3490
|
}
|
|
3401
3491
|
if (!(!(params !== null && params !== void 0 && params.force) && this.discountConfigCacheKey === discountConfigCacheKey)) {
|
|
3402
|
-
|
|
3492
|
+
_context33.next = 25;
|
|
3403
3493
|
break;
|
|
3404
3494
|
}
|
|
3405
3495
|
preparedDiscountList = originalDiscountList;
|
|
3406
|
-
|
|
3496
|
+
_context33.next = 37;
|
|
3407
3497
|
break;
|
|
3408
3498
|
case 25:
|
|
3409
3499
|
prepareConfigPromise = this.store.order.loadDiscountConfig({
|
|
@@ -3413,58 +3503,58 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3413
3503
|
apply: false
|
|
3414
3504
|
}); // OrderModule increments this epoch synchronously before its first await.
|
|
3415
3505
|
requestEpoch = (_this$store$order$get4 = (_this$store$order10 = this.store.order).getCustomerWalletPrepareConfigEpoch) === null || _this$store$order$get4 === void 0 ? void 0 : _this$store$order$get4.call(_this$store$order10);
|
|
3416
|
-
|
|
3506
|
+
_context33.next = 29;
|
|
3417
3507
|
return prepareConfigPromise;
|
|
3418
3508
|
case 29:
|
|
3419
|
-
preparedDiscountList =
|
|
3509
|
+
preparedDiscountList = _context33.sent;
|
|
3420
3510
|
if (isCurrentRequest()) {
|
|
3421
|
-
|
|
3511
|
+
_context33.next = 32;
|
|
3422
3512
|
break;
|
|
3423
3513
|
}
|
|
3424
|
-
return
|
|
3514
|
+
return _context33.abrupt("return", getCurrentResult());
|
|
3425
3515
|
case 32:
|
|
3426
|
-
|
|
3516
|
+
_context33.next = 34;
|
|
3427
3517
|
return discountModule === null || discountModule === void 0 || (_discountModule$setOr = discountModule.setOriginalDiscountList) === null || _discountModule$setOr === void 0 ? void 0 : _discountModule$setOr.call(discountModule, preparedDiscountList);
|
|
3428
3518
|
case 34:
|
|
3429
3519
|
if (isCurrentRequest()) {
|
|
3430
|
-
|
|
3520
|
+
_context33.next = 36;
|
|
3431
3521
|
break;
|
|
3432
3522
|
}
|
|
3433
|
-
return
|
|
3523
|
+
return _context33.abrupt("return", getCurrentResult());
|
|
3434
3524
|
case 36:
|
|
3435
3525
|
this.discountConfigCacheKey = discountConfigCacheKey;
|
|
3436
3526
|
case 37:
|
|
3437
3527
|
if (!this.isActiveVirtualSettlementOrder(tempOrder)) {
|
|
3438
|
-
|
|
3528
|
+
_context33.next = 51;
|
|
3439
3529
|
break;
|
|
3440
3530
|
}
|
|
3441
3531
|
if (isCurrentRequest()) {
|
|
3442
|
-
|
|
3532
|
+
_context33.next = 40;
|
|
3443
3533
|
break;
|
|
3444
3534
|
}
|
|
3445
|
-
return
|
|
3535
|
+
return _context33.abrupt("return", getCurrentResult());
|
|
3446
3536
|
case 40:
|
|
3447
|
-
|
|
3537
|
+
_context33.next = 42;
|
|
3448
3538
|
return discountModule === null || discountModule === void 0 || (_discountModule$setOr2 = discountModule.setOriginalDiscountList) === null || _discountModule$setOr2 === void 0 ? void 0 : _discountModule$setOr2.call(discountModule, []);
|
|
3449
3539
|
case 42:
|
|
3450
3540
|
if (isCurrentRequest()) {
|
|
3451
|
-
|
|
3541
|
+
_context33.next = 44;
|
|
3452
3542
|
break;
|
|
3453
3543
|
}
|
|
3454
|
-
return
|
|
3544
|
+
return _context33.abrupt("return", getCurrentResult());
|
|
3455
3545
|
case 44:
|
|
3456
|
-
|
|
3546
|
+
_context33.next = 46;
|
|
3457
3547
|
return discountModule === null || discountModule === void 0 || (_discountModule$setDi = discountModule.setDiscountList) === null || _discountModule$setDi === void 0 ? void 0 : _discountModule$setDi.call(discountModule, []);
|
|
3458
3548
|
case 46:
|
|
3459
3549
|
if (isCurrentRequest()) {
|
|
3460
|
-
|
|
3550
|
+
_context33.next = 48;
|
|
3461
3551
|
break;
|
|
3462
3552
|
}
|
|
3463
|
-
return
|
|
3553
|
+
return _context33.abrupt("return", getCurrentResult());
|
|
3464
3554
|
case 48:
|
|
3465
3555
|
tempOrder.discount_list = [];
|
|
3466
3556
|
tempOrder.shop_discount = '0.00';
|
|
3467
|
-
return
|
|
3557
|
+
return _context33.abrupt("return", {
|
|
3468
3558
|
productList: tempOrder.products || [],
|
|
3469
3559
|
discountList: [],
|
|
3470
3560
|
availableWalletIds: this.getAvailableWalletIds(),
|
|
@@ -3472,10 +3562,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3472
3562
|
});
|
|
3473
3563
|
case 51:
|
|
3474
3564
|
if (!(hasManualDiscountSelection && currentDiscountList.length)) {
|
|
3475
|
-
|
|
3565
|
+
_context33.next = 53;
|
|
3476
3566
|
break;
|
|
3477
3567
|
}
|
|
3478
|
-
return
|
|
3568
|
+
return _context33.abrupt("return", {
|
|
3479
3569
|
productList: tempOrder.products || [],
|
|
3480
3570
|
discountList: currentDiscountList,
|
|
3481
3571
|
availableWalletIds: this.getAvailableWalletIds(),
|
|
@@ -3485,19 +3575,19 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3485
3575
|
nextDiscountList = this.mergeHistoricalDiscountList(preparedDiscountList || (discountModule === null || discountModule === void 0 || (_discountModule$getDi3 = discountModule.getDiscountList) === null || _discountModule$getDi3 === void 0 ? void 0 : _discountModule$getDi3.call(discountModule)) || [], tempOrder.products || []);
|
|
3486
3576
|
nextDiscountList = this.mergeCurrentDiscountSelectionState(nextDiscountList, currentDiscountList);
|
|
3487
3577
|
if (isCurrentRequest()) {
|
|
3488
|
-
|
|
3578
|
+
_context33.next = 57;
|
|
3489
3579
|
break;
|
|
3490
3580
|
}
|
|
3491
|
-
return
|
|
3581
|
+
return _context33.abrupt("return", getCurrentResult());
|
|
3492
3582
|
case 57:
|
|
3493
|
-
|
|
3583
|
+
_context33.next = 59;
|
|
3494
3584
|
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
|
|
3495
3585
|
case 59:
|
|
3496
3586
|
if (isCurrentRequest()) {
|
|
3497
|
-
|
|
3587
|
+
_context33.next = 61;
|
|
3498
3588
|
break;
|
|
3499
3589
|
}
|
|
3500
|
-
return
|
|
3590
|
+
return _context33.abrupt("return", getCurrentResult());
|
|
3501
3591
|
case 61:
|
|
3502
3592
|
shouldSkipAutoApplyFetchedDiscounts = this.shouldSkipAutoApplyFetchedDiscountsInEditMode({
|
|
3503
3593
|
discountAction: discountAction,
|
|
@@ -3506,28 +3596,28 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3506
3596
|
nextDiscountList: nextDiscountList
|
|
3507
3597
|
});
|
|
3508
3598
|
if (!shouldSkipAutoApplyFetchedDiscounts) {
|
|
3509
|
-
|
|
3599
|
+
_context33.next = 75;
|
|
3510
3600
|
break;
|
|
3511
3601
|
}
|
|
3512
|
-
|
|
3602
|
+
_context33.next = 65;
|
|
3513
3603
|
return this.store.order.recalculateSummary({
|
|
3514
3604
|
createIfMissing: true
|
|
3515
3605
|
});
|
|
3516
3606
|
case 65:
|
|
3517
3607
|
if (isCurrentRequest()) {
|
|
3518
|
-
|
|
3608
|
+
_context33.next = 67;
|
|
3519
3609
|
break;
|
|
3520
3610
|
}
|
|
3521
|
-
return
|
|
3611
|
+
return _context33.abrupt("return", getCurrentResult());
|
|
3522
3612
|
case 67:
|
|
3523
3613
|
this.store.order.persistTempOrder();
|
|
3524
3614
|
if (isCurrentRequest()) {
|
|
3525
|
-
|
|
3615
|
+
_context33.next = 70;
|
|
3526
3616
|
break;
|
|
3527
3617
|
}
|
|
3528
|
-
return
|
|
3618
|
+
return _context33.abrupt("return", getCurrentResult());
|
|
3529
3619
|
case 70:
|
|
3530
|
-
|
|
3620
|
+
_context33.next = 72;
|
|
3531
3621
|
return this.effectsEmit('onDiscountApplied', {
|
|
3532
3622
|
productList: tempOrder.products || [],
|
|
3533
3623
|
discountList: nextDiscountList,
|
|
@@ -3536,12 +3626,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3536
3626
|
});
|
|
3537
3627
|
case 72:
|
|
3538
3628
|
if (isCurrentRequest()) {
|
|
3539
|
-
|
|
3629
|
+
_context33.next = 74;
|
|
3540
3630
|
break;
|
|
3541
3631
|
}
|
|
3542
|
-
return
|
|
3632
|
+
return _context33.abrupt("return", getCurrentResult());
|
|
3543
3633
|
case 74:
|
|
3544
|
-
return
|
|
3634
|
+
return _context33.abrupt("return", {
|
|
3545
3635
|
productList: tempOrder.products || [],
|
|
3546
3636
|
discountList: nextDiscountList,
|
|
3547
3637
|
availableWalletIds: this.getAvailableWalletIds(),
|
|
@@ -3549,14 +3639,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3549
3639
|
});
|
|
3550
3640
|
case 75:
|
|
3551
3641
|
if (!rulesModule) {
|
|
3552
|
-
|
|
3642
|
+
_context33.next = 117;
|
|
3553
3643
|
break;
|
|
3554
3644
|
}
|
|
3555
3645
|
if (isCurrentRequest()) {
|
|
3556
|
-
|
|
3646
|
+
_context33.next = 78;
|
|
3557
3647
|
break;
|
|
3558
3648
|
}
|
|
3559
|
-
return
|
|
3649
|
+
return _context33.abrupt("return", getCurrentResult());
|
|
3560
3650
|
case 78:
|
|
3561
3651
|
orderTotalAmount = Number(((_orderStore$summary = orderStore.summary) === null || _orderStore$summary === void 0 ? void 0 : _orderStore$summary.total_amount) || 0);
|
|
3562
3652
|
result = rulesModule.calcDiscount({
|
|
@@ -3575,21 +3665,21 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3575
3665
|
tempOrder.products = preserveManualProductDiscountProducts(tempOrder.products, result.productList);
|
|
3576
3666
|
}
|
|
3577
3667
|
_iterator5 = _createForOfIteratorHelper(tempOrder.products || []);
|
|
3578
|
-
|
|
3668
|
+
_context33.prev = 82;
|
|
3579
3669
|
_iterator5.s();
|
|
3580
3670
|
case 84:
|
|
3581
3671
|
if ((_step5 = _iterator5.n()).done) {
|
|
3582
|
-
|
|
3672
|
+
_context33.next = 99;
|
|
3583
3673
|
break;
|
|
3584
3674
|
}
|
|
3585
3675
|
product = _step5.value;
|
|
3586
3676
|
productUid = (_product$metadata5 = product.metadata) === null || _product$metadata5 === void 0 ? void 0 : _product$metadata5.unique_identification_number;
|
|
3587
3677
|
runtimeOrigin = productUid ? (_tempOrder$_extend6 = tempOrder._extend) === null || _tempOrder$_extend6 === void 0 || (_tempOrder$_extend6 = _tempOrder$_extend6.productsByUid) === null || _tempOrder$_extend6 === void 0 || (_tempOrder$_extend6 = _tempOrder$_extend6[productUid]) === null || _tempOrder$_extend6 === void 0 ? void 0 : _tempOrder$_extend6.origin : undefined;
|
|
3588
3678
|
if (!(runtimeOrigin !== null && runtimeOrigin !== void 0 && runtimeOrigin.isManualDiscount || isBaseSalesManualProductDiscountProduct(product))) {
|
|
3589
|
-
|
|
3679
|
+
_context33.next = 90;
|
|
3590
3680
|
break;
|
|
3591
3681
|
}
|
|
3592
|
-
return
|
|
3682
|
+
return _context33.abrupt("continue", 97);
|
|
3593
3683
|
case 90:
|
|
3594
3684
|
totalPerUnitDiscount = (product.discount_list || []).reduce(function (sum, pd) {
|
|
3595
3685
|
return sum + Number(pd.amount || 0);
|
|
@@ -3607,70 +3697,70 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3607
3697
|
bundle: product.product_bundle
|
|
3608
3698
|
});
|
|
3609
3699
|
case 97:
|
|
3610
|
-
|
|
3700
|
+
_context33.next = 84;
|
|
3611
3701
|
break;
|
|
3612
3702
|
case 99:
|
|
3613
|
-
|
|
3703
|
+
_context33.next = 104;
|
|
3614
3704
|
break;
|
|
3615
3705
|
case 101:
|
|
3616
|
-
|
|
3617
|
-
|
|
3618
|
-
_iterator5.e(
|
|
3706
|
+
_context33.prev = 101;
|
|
3707
|
+
_context33.t0 = _context33["catch"](82);
|
|
3708
|
+
_iterator5.e(_context33.t0);
|
|
3619
3709
|
case 104:
|
|
3620
|
-
|
|
3710
|
+
_context33.prev = 104;
|
|
3621
3711
|
_iterator5.f();
|
|
3622
|
-
return
|
|
3712
|
+
return _context33.finish(104);
|
|
3623
3713
|
case 107:
|
|
3624
3714
|
if (!result.discountList) {
|
|
3625
|
-
|
|
3715
|
+
_context33.next = 117;
|
|
3626
3716
|
break;
|
|
3627
3717
|
}
|
|
3628
3718
|
nextDiscountList = this.mergeHistoricalDiscountList(result.discountList, tempOrder.products || []);
|
|
3629
3719
|
OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
|
|
3630
3720
|
if (isCurrentRequest()) {
|
|
3631
|
-
|
|
3721
|
+
_context33.next = 112;
|
|
3632
3722
|
break;
|
|
3633
3723
|
}
|
|
3634
|
-
return
|
|
3724
|
+
return _context33.abrupt("return", getCurrentResult());
|
|
3635
3725
|
case 112:
|
|
3636
|
-
|
|
3726
|
+
_context33.next = 114;
|
|
3637
3727
|
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
|
|
3638
3728
|
case 114:
|
|
3639
3729
|
if (isCurrentRequest()) {
|
|
3640
|
-
|
|
3730
|
+
_context33.next = 116;
|
|
3641
3731
|
break;
|
|
3642
3732
|
}
|
|
3643
|
-
return
|
|
3733
|
+
return _context33.abrupt("return", getCurrentResult());
|
|
3644
3734
|
case 116:
|
|
3645
3735
|
tempOrder.discount_list = nextDiscountList.filter(function (discount) {
|
|
3646
3736
|
return discount.isSelected;
|
|
3647
3737
|
});
|
|
3648
3738
|
case 117:
|
|
3649
3739
|
if (isCurrentRequest()) {
|
|
3650
|
-
|
|
3740
|
+
_context33.next = 119;
|
|
3651
3741
|
break;
|
|
3652
3742
|
}
|
|
3653
|
-
return
|
|
3743
|
+
return _context33.abrupt("return", getCurrentResult());
|
|
3654
3744
|
case 119:
|
|
3655
|
-
|
|
3745
|
+
_context33.next = 121;
|
|
3656
3746
|
return this.store.order.recalculateSummary({
|
|
3657
3747
|
createIfMissing: true
|
|
3658
3748
|
});
|
|
3659
3749
|
case 121:
|
|
3660
3750
|
if (isCurrentRequest()) {
|
|
3661
|
-
|
|
3751
|
+
_context33.next = 123;
|
|
3662
3752
|
break;
|
|
3663
3753
|
}
|
|
3664
|
-
return
|
|
3754
|
+
return _context33.abrupt("return", getCurrentResult());
|
|
3665
3755
|
case 123:
|
|
3666
3756
|
this.store.order.persistTempOrder();
|
|
3667
3757
|
if (isCurrentRequest()) {
|
|
3668
|
-
|
|
3758
|
+
_context33.next = 126;
|
|
3669
3759
|
break;
|
|
3670
3760
|
}
|
|
3671
|
-
return
|
|
3761
|
+
return _context33.abrupt("return", getCurrentResult());
|
|
3672
3762
|
case 126:
|
|
3673
|
-
|
|
3763
|
+
_context33.next = 128;
|
|
3674
3764
|
return this.effectsEmit('onDiscountApplied', {
|
|
3675
3765
|
productList: tempOrder.products || [],
|
|
3676
3766
|
discountList: nextDiscountList,
|
|
@@ -3679,12 +3769,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3679
3769
|
});
|
|
3680
3770
|
case 128:
|
|
3681
3771
|
if (isCurrentRequest()) {
|
|
3682
|
-
|
|
3772
|
+
_context33.next = 130;
|
|
3683
3773
|
break;
|
|
3684
3774
|
}
|
|
3685
|
-
return
|
|
3775
|
+
return _context33.abrupt("return", getCurrentResult());
|
|
3686
3776
|
case 130:
|
|
3687
|
-
return
|
|
3777
|
+
return _context33.abrupt("return", {
|
|
3688
3778
|
productList: tempOrder.products || [],
|
|
3689
3779
|
discountList: nextDiscountList,
|
|
3690
3780
|
availableWalletIds: this.getAvailableWalletIds(),
|
|
@@ -3692,9 +3782,9 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3692
3782
|
});
|
|
3693
3783
|
case 131:
|
|
3694
3784
|
case "end":
|
|
3695
|
-
return
|
|
3785
|
+
return _context33.stop();
|
|
3696
3786
|
}
|
|
3697
|
-
},
|
|
3787
|
+
}, _callee33, this, [[82, 101, 104, 107]]);
|
|
3698
3788
|
}));
|
|
3699
3789
|
function loadDiscountConfig(_x22) {
|
|
3700
3790
|
return _loadDiscountConfig.apply(this, arguments);
|
|
@@ -3718,21 +3808,21 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3718
3808
|
}, {
|
|
3719
3809
|
key: "bestDiscount",
|
|
3720
3810
|
value: function () {
|
|
3721
|
-
var _bestDiscount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3811
|
+
var _bestDiscount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(cb) {
|
|
3722
3812
|
var _discountModule$getOr2, _discountModule$getDi4;
|
|
3723
3813
|
var tempOrder, _result2, orderStore, discountModule, rulesModule, originalDiscountList, currentDiscountList, nextDiscountList, result, _orderStore$summary2, orderTotalAmount;
|
|
3724
|
-
return _regeneratorRuntime().wrap(function
|
|
3725
|
-
while (1) switch (
|
|
3814
|
+
return _regeneratorRuntime().wrap(function _callee34$(_context34) {
|
|
3815
|
+
while (1) switch (_context34.prev = _context34.next) {
|
|
3726
3816
|
case 0:
|
|
3727
3817
|
if (this.store.order) {
|
|
3728
|
-
|
|
3818
|
+
_context34.next = 2;
|
|
3729
3819
|
break;
|
|
3730
3820
|
}
|
|
3731
3821
|
throw new Error('order 模块未初始化');
|
|
3732
3822
|
case 2:
|
|
3733
3823
|
tempOrder = this.store.order.ensureTempOrder();
|
|
3734
3824
|
if (!this.isActiveVirtualSettlementOrder(tempOrder)) {
|
|
3735
|
-
|
|
3825
|
+
_context34.next = 7;
|
|
3736
3826
|
break;
|
|
3737
3827
|
}
|
|
3738
3828
|
_result2 = {
|
|
@@ -3740,7 +3830,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3740
3830
|
discountList: []
|
|
3741
3831
|
};
|
|
3742
3832
|
cb === null || cb === void 0 || cb(_result2);
|
|
3743
|
-
return
|
|
3833
|
+
return _context34.abrupt("return", _result2);
|
|
3744
3834
|
case 7:
|
|
3745
3835
|
orderStore = this.store.order.store || {};
|
|
3746
3836
|
discountModule = orderStore.discount;
|
|
@@ -3752,11 +3842,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3752
3842
|
productList: tempOrder.products || [],
|
|
3753
3843
|
discountList: nextDiscountList
|
|
3754
3844
|
};
|
|
3755
|
-
|
|
3845
|
+
_context34.next = 16;
|
|
3756
3846
|
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
|
|
3757
3847
|
case 16:
|
|
3758
3848
|
if (!rulesModule) {
|
|
3759
|
-
|
|
3849
|
+
_context34.next = 27;
|
|
3760
3850
|
break;
|
|
3761
3851
|
}
|
|
3762
3852
|
orderTotalAmount = Number(((_orderStore$summary2 = orderStore.summary) === null || _orderStore$summary2 === void 0 ? void 0 : _orderStore$summary2.total_amount) || 0);
|
|
@@ -3775,12 +3865,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3775
3865
|
tempOrder.products = preserveManualProductDiscountProducts(tempOrder.products, result.productList);
|
|
3776
3866
|
}
|
|
3777
3867
|
if (!result.discountList) {
|
|
3778
|
-
|
|
3868
|
+
_context34.next = 27;
|
|
3779
3869
|
break;
|
|
3780
3870
|
}
|
|
3781
3871
|
nextDiscountList = this.mergeHistoricalDiscountList(result.discountList, tempOrder.products || []);
|
|
3782
3872
|
OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
|
|
3783
|
-
|
|
3873
|
+
_context34.next = 25;
|
|
3784
3874
|
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
|
|
3785
3875
|
case 25:
|
|
3786
3876
|
tempOrder.discount_list = nextDiscountList.filter(function (discount) {
|
|
@@ -3791,13 +3881,13 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3791
3881
|
discountList: nextDiscountList
|
|
3792
3882
|
};
|
|
3793
3883
|
case 27:
|
|
3794
|
-
|
|
3884
|
+
_context34.next = 29;
|
|
3795
3885
|
return this.store.order.recalculateSummary({
|
|
3796
3886
|
createIfMissing: true
|
|
3797
3887
|
});
|
|
3798
3888
|
case 29:
|
|
3799
3889
|
this.store.order.persistTempOrder();
|
|
3800
|
-
|
|
3890
|
+
_context34.next = 32;
|
|
3801
3891
|
return this.effectsEmit('onDiscountApplied', {
|
|
3802
3892
|
productList: tempOrder.products || [],
|
|
3803
3893
|
discountList: nextDiscountList,
|
|
@@ -3806,12 +3896,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3806
3896
|
});
|
|
3807
3897
|
case 32:
|
|
3808
3898
|
cb === null || cb === void 0 || cb(result);
|
|
3809
|
-
return
|
|
3899
|
+
return _context34.abrupt("return", result);
|
|
3810
3900
|
case 34:
|
|
3811
3901
|
case "end":
|
|
3812
|
-
return
|
|
3902
|
+
return _context34.stop();
|
|
3813
3903
|
}
|
|
3814
|
-
},
|
|
3904
|
+
}, _callee34, this);
|
|
3815
3905
|
}));
|
|
3816
3906
|
function bestDiscount(_x23) {
|
|
3817
3907
|
return _bestDiscount.apply(this, arguments);
|
|
@@ -3842,39 +3932,39 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3842
3932
|
}, {
|
|
3843
3933
|
key: "replaceDiscountStoreLists",
|
|
3844
3934
|
value: (function () {
|
|
3845
|
-
var _replaceDiscountStoreLists = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3935
|
+
var _replaceDiscountStoreLists = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35(params) {
|
|
3846
3936
|
var _store2;
|
|
3847
3937
|
var discountModule;
|
|
3848
|
-
return _regeneratorRuntime().wrap(function
|
|
3849
|
-
while (1) switch (
|
|
3938
|
+
return _regeneratorRuntime().wrap(function _callee35$(_context35) {
|
|
3939
|
+
while (1) switch (_context35.prev = _context35.next) {
|
|
3850
3940
|
case 0:
|
|
3851
3941
|
if (this.store.order) {
|
|
3852
|
-
|
|
3942
|
+
_context35.next = 2;
|
|
3853
3943
|
break;
|
|
3854
3944
|
}
|
|
3855
3945
|
throw new Error('order 模块未初始化');
|
|
3856
3946
|
case 2:
|
|
3857
3947
|
discountModule = (_store2 = this.store.order.store) === null || _store2 === void 0 ? void 0 : _store2.discount;
|
|
3858
3948
|
if (discountModule) {
|
|
3859
|
-
|
|
3949
|
+
_context35.next = 5;
|
|
3860
3950
|
break;
|
|
3861
3951
|
}
|
|
3862
|
-
return
|
|
3952
|
+
return _context35.abrupt("return");
|
|
3863
3953
|
case 5:
|
|
3864
3954
|
if (!params.originalDiscountList) {
|
|
3865
|
-
|
|
3955
|
+
_context35.next = 8;
|
|
3866
3956
|
break;
|
|
3867
3957
|
}
|
|
3868
|
-
|
|
3958
|
+
_context35.next = 8;
|
|
3869
3959
|
return discountModule.setOriginalDiscountList(params.originalDiscountList);
|
|
3870
3960
|
case 8:
|
|
3871
|
-
|
|
3961
|
+
_context35.next = 10;
|
|
3872
3962
|
return discountModule.setDiscountList(params.discountList);
|
|
3873
3963
|
case 10:
|
|
3874
3964
|
case "end":
|
|
3875
|
-
return
|
|
3965
|
+
return _context35.stop();
|
|
3876
3966
|
}
|
|
3877
|
-
},
|
|
3967
|
+
}, _callee35, this);
|
|
3878
3968
|
}));
|
|
3879
3969
|
function replaceDiscountStoreLists(_x24) {
|
|
3880
3970
|
return _replaceDiscountStoreLists.apply(this, arguments);
|
|
@@ -3884,34 +3974,34 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3884
3974
|
}, {
|
|
3885
3975
|
key: "scanPromotionCode",
|
|
3886
3976
|
value: function () {
|
|
3887
|
-
var _scanPromotionCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3977
|
+
var _scanPromotionCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(code, customerId, options) {
|
|
3888
3978
|
var raw, tempOrder;
|
|
3889
|
-
return _regeneratorRuntime().wrap(function
|
|
3890
|
-
while (1) switch (
|
|
3979
|
+
return _regeneratorRuntime().wrap(function _callee36$(_context36) {
|
|
3980
|
+
while (1) switch (_context36.prev = _context36.next) {
|
|
3891
3981
|
case 0:
|
|
3892
|
-
|
|
3982
|
+
_context36.prev = 0;
|
|
3893
3983
|
if (this.store.order) {
|
|
3894
|
-
|
|
3984
|
+
_context36.next = 3;
|
|
3895
3985
|
break;
|
|
3896
3986
|
}
|
|
3897
3987
|
throw new Error('order 模块未初始化');
|
|
3898
3988
|
case 3:
|
|
3899
|
-
|
|
3989
|
+
_context36.next = 5;
|
|
3900
3990
|
return this.store.order.scanCode(code, customerId, options);
|
|
3901
3991
|
case 5:
|
|
3902
|
-
raw =
|
|
3992
|
+
raw = _context36.sent;
|
|
3903
3993
|
if (!raw.isAvailable) {
|
|
3904
|
-
|
|
3994
|
+
_context36.next = 13;
|
|
3905
3995
|
break;
|
|
3906
3996
|
}
|
|
3907
|
-
|
|
3997
|
+
_context36.next = 9;
|
|
3908
3998
|
return this.store.order.recalculateSummary({
|
|
3909
3999
|
createIfMissing: true
|
|
3910
4000
|
});
|
|
3911
4001
|
case 9:
|
|
3912
4002
|
this.store.order.persistTempOrder();
|
|
3913
4003
|
tempOrder = this.store.order.ensureTempOrder();
|
|
3914
|
-
|
|
4004
|
+
_context36.next = 13;
|
|
3915
4005
|
return this.effectsEmit('onDiscountApplied', {
|
|
3916
4006
|
productList: tempOrder.products || [],
|
|
3917
4007
|
discountList: this.store.order.getDiscountList(),
|
|
@@ -3919,7 +4009,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3919
4009
|
tempOrder: tempOrder
|
|
3920
4010
|
});
|
|
3921
4011
|
case 13:
|
|
3922
|
-
return
|
|
4012
|
+
return _context36.abrupt("return", _objectSpread(_objectSpread({
|
|
3923
4013
|
isAvailable: raw.isAvailable
|
|
3924
4014
|
}, raw.isAccepted !== undefined ? {
|
|
3925
4015
|
isAccepted: raw.isAccepted
|
|
@@ -3929,14 +4019,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3929
4019
|
scannedDiscountList: raw.scannedDiscountList
|
|
3930
4020
|
}));
|
|
3931
4021
|
case 16:
|
|
3932
|
-
|
|
3933
|
-
|
|
3934
|
-
throw
|
|
4022
|
+
_context36.prev = 16;
|
|
4023
|
+
_context36.t0 = _context36["catch"](0);
|
|
4024
|
+
throw _context36.t0;
|
|
3935
4025
|
case 19:
|
|
3936
4026
|
case "end":
|
|
3937
|
-
return
|
|
4027
|
+
return _context36.stop();
|
|
3938
4028
|
}
|
|
3939
|
-
},
|
|
4029
|
+
}, _callee36, this, [[0, 16]]);
|
|
3940
4030
|
}));
|
|
3941
4031
|
function scanPromotionCode(_x25, _x26, _x27) {
|
|
3942
4032
|
return _scanPromotionCode.apply(this, arguments);
|
|
@@ -3946,35 +4036,35 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3946
4036
|
}, {
|
|
3947
4037
|
key: "setDiscountSelected",
|
|
3948
4038
|
value: function () {
|
|
3949
|
-
var _setDiscountSelected = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4039
|
+
var _setDiscountSelected = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37(params) {
|
|
3950
4040
|
var currentOrder, _store3, _store3$setDiscountLi, list, updated, tempOrder, orderStore, _discountModule, rulesModule, nextDiscountList, _orderStore$summary3, orderTotalAmount, result, beforeSelectedIds, _iterator6, _step6, d, selectedResourceIds, filterSelectedDiscountDetails, _iterator7, _step7, _product$metadata8, _tempOrder$_extend7, _product$metadata$sou2, _product$metadata9, _product$metadata10, _product$original_pri2, product, productUid, runtimeOrigin, totalPerUnitDiscount, optionSum, sourcePrice, newSourceSellingPrice, newMainSellingPrice;
|
|
3951
|
-
return _regeneratorRuntime().wrap(function
|
|
3952
|
-
while (1) switch (
|
|
4041
|
+
return _regeneratorRuntime().wrap(function _callee37$(_context37) {
|
|
4042
|
+
while (1) switch (_context37.prev = _context37.next) {
|
|
3953
4043
|
case 0:
|
|
3954
|
-
|
|
4044
|
+
_context37.prev = 0;
|
|
3955
4045
|
if (this.store.order) {
|
|
3956
|
-
|
|
4046
|
+
_context37.next = 3;
|
|
3957
4047
|
break;
|
|
3958
4048
|
}
|
|
3959
4049
|
throw new Error('order 模块未初始化');
|
|
3960
4050
|
case 3:
|
|
3961
4051
|
currentOrder = this.store.order.ensureTempOrder();
|
|
3962
4052
|
if (!this.isActiveVirtualSettlementOrder(currentOrder)) {
|
|
3963
|
-
|
|
4053
|
+
_context37.next = 13;
|
|
3964
4054
|
break;
|
|
3965
4055
|
}
|
|
3966
4056
|
currentOrder.discount_list = [];
|
|
3967
4057
|
currentOrder.shop_discount = '0.00';
|
|
3968
|
-
|
|
4058
|
+
_context37.next = 9;
|
|
3969
4059
|
return (_store3 = this.store.order.store) === null || _store3 === void 0 || (_store3 = _store3.discount) === null || _store3 === void 0 || (_store3$setDiscountLi = _store3.setDiscountList) === null || _store3$setDiscountLi === void 0 ? void 0 : _store3$setDiscountLi.call(_store3, []);
|
|
3970
4060
|
case 9:
|
|
3971
|
-
|
|
4061
|
+
_context37.next = 11;
|
|
3972
4062
|
return this.store.order.recalculateSummary({
|
|
3973
4063
|
createIfMissing: true
|
|
3974
4064
|
});
|
|
3975
4065
|
case 11:
|
|
3976
4066
|
this.store.order.persistTempOrder();
|
|
3977
|
-
return
|
|
4067
|
+
return _context37.abrupt("return");
|
|
3978
4068
|
case 13:
|
|
3979
4069
|
list = this.store.order.getDiscountList();
|
|
3980
4070
|
updated = list.map(function (d) {
|
|
@@ -3989,7 +4079,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3989
4079
|
_discountModule = orderStore.discount;
|
|
3990
4080
|
rulesModule = orderStore.rules;
|
|
3991
4081
|
nextDiscountList = updated;
|
|
3992
|
-
|
|
4082
|
+
_context37.next = 23;
|
|
3993
4083
|
return _discountModule === null || _discountModule === void 0 ? void 0 : _discountModule.setDiscountList(updated);
|
|
3994
4084
|
case 23:
|
|
3995
4085
|
if (rulesModule) {
|
|
@@ -4051,21 +4141,21 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4051
4141
|
});
|
|
4052
4142
|
};
|
|
4053
4143
|
_iterator7 = _createForOfIteratorHelper(tempOrder.products);
|
|
4054
|
-
|
|
4144
|
+
_context37.prev = 27;
|
|
4055
4145
|
_iterator7.s();
|
|
4056
4146
|
case 29:
|
|
4057
4147
|
if ((_step7 = _iterator7.n()).done) {
|
|
4058
|
-
|
|
4148
|
+
_context37.next = 46;
|
|
4059
4149
|
break;
|
|
4060
4150
|
}
|
|
4061
4151
|
product = _step7.value;
|
|
4062
4152
|
productUid = (_product$metadata8 = product.metadata) === null || _product$metadata8 === void 0 ? void 0 : _product$metadata8.unique_identification_number;
|
|
4063
4153
|
runtimeOrigin = productUid ? (_tempOrder$_extend7 = tempOrder._extend) === null || _tempOrder$_extend7 === void 0 || (_tempOrder$_extend7 = _tempOrder$_extend7.productsByUid) === null || _tempOrder$_extend7 === void 0 || (_tempOrder$_extend7 = _tempOrder$_extend7[productUid]) === null || _tempOrder$_extend7 === void 0 ? void 0 : _tempOrder$_extend7.origin : undefined;
|
|
4064
4154
|
if (!(runtimeOrigin !== null && runtimeOrigin !== void 0 && runtimeOrigin.isManualDiscount || isBaseSalesManualProductDiscountProduct(product))) {
|
|
4065
|
-
|
|
4155
|
+
_context37.next = 35;
|
|
4066
4156
|
break;
|
|
4067
4157
|
}
|
|
4068
|
-
return
|
|
4158
|
+
return _context37.abrupt("continue", 44);
|
|
4069
4159
|
case 35:
|
|
4070
4160
|
product.discount_list = filterSelectedDiscountDetails(product.discount_list);
|
|
4071
4161
|
if (Array.isArray(product.product_bundle)) {
|
|
@@ -4101,28 +4191,28 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4101
4191
|
bundle: product.product_bundle
|
|
4102
4192
|
});
|
|
4103
4193
|
case 44:
|
|
4104
|
-
|
|
4194
|
+
_context37.next = 29;
|
|
4105
4195
|
break;
|
|
4106
4196
|
case 46:
|
|
4107
|
-
|
|
4197
|
+
_context37.next = 51;
|
|
4108
4198
|
break;
|
|
4109
4199
|
case 48:
|
|
4110
|
-
|
|
4111
|
-
|
|
4112
|
-
_iterator7.e(
|
|
4200
|
+
_context37.prev = 48;
|
|
4201
|
+
_context37.t0 = _context37["catch"](27);
|
|
4202
|
+
_iterator7.e(_context37.t0);
|
|
4113
4203
|
case 51:
|
|
4114
|
-
|
|
4204
|
+
_context37.prev = 51;
|
|
4115
4205
|
_iterator7.f();
|
|
4116
|
-
return
|
|
4206
|
+
return _context37.finish(51);
|
|
4117
4207
|
case 54:
|
|
4118
4208
|
OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
|
|
4119
|
-
|
|
4209
|
+
_context37.next = 57;
|
|
4120
4210
|
return _discountModule === null || _discountModule === void 0 ? void 0 : _discountModule.setDiscountList(nextDiscountList);
|
|
4121
4211
|
case 57:
|
|
4122
4212
|
tempOrder.discount_list = (nextDiscountList || []).filter(function (d) {
|
|
4123
4213
|
return d.isSelected;
|
|
4124
4214
|
});
|
|
4125
|
-
|
|
4215
|
+
_context37.next = 60;
|
|
4126
4216
|
return this.store.order.recalculateSummary({
|
|
4127
4217
|
createIfMissing: true
|
|
4128
4218
|
});
|
|
@@ -4134,17 +4224,17 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4134
4224
|
selectedDiscountList: tempOrder.discount_list,
|
|
4135
4225
|
tempOrder: tempOrder
|
|
4136
4226
|
});
|
|
4137
|
-
|
|
4227
|
+
_context37.next = 67;
|
|
4138
4228
|
break;
|
|
4139
4229
|
case 64:
|
|
4140
|
-
|
|
4141
|
-
|
|
4142
|
-
throw
|
|
4230
|
+
_context37.prev = 64;
|
|
4231
|
+
_context37.t1 = _context37["catch"](0);
|
|
4232
|
+
throw _context37.t1;
|
|
4143
4233
|
case 67:
|
|
4144
4234
|
case "end":
|
|
4145
|
-
return
|
|
4235
|
+
return _context37.stop();
|
|
4146
4236
|
}
|
|
4147
|
-
},
|
|
4237
|
+
}, _callee37, this, [[0, 64], [27, 48, 51, 54]]);
|
|
4148
4238
|
}));
|
|
4149
4239
|
function setDiscountSelected(_x28) {
|
|
4150
4240
|
return _setDiscountSelected.apply(this, arguments);
|
|
@@ -4154,23 +4244,23 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4154
4244
|
}, {
|
|
4155
4245
|
key: "applyDiscountCalculationResult",
|
|
4156
4246
|
value: function () {
|
|
4157
|
-
var _applyDiscountCalculationResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4247
|
+
var _applyDiscountCalculationResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38(result) {
|
|
4158
4248
|
var tempOrder, orderStore, _discountModule2;
|
|
4159
|
-
return _regeneratorRuntime().wrap(function
|
|
4160
|
-
while (1) switch (
|
|
4249
|
+
return _regeneratorRuntime().wrap(function _callee38$(_context38) {
|
|
4250
|
+
while (1) switch (_context38.prev = _context38.next) {
|
|
4161
4251
|
case 0:
|
|
4162
|
-
|
|
4252
|
+
_context38.prev = 0;
|
|
4163
4253
|
if (this.store.order) {
|
|
4164
|
-
|
|
4254
|
+
_context38.next = 3;
|
|
4165
4255
|
break;
|
|
4166
4256
|
}
|
|
4167
4257
|
throw new Error('order 模块未初始化');
|
|
4168
4258
|
case 3:
|
|
4169
4259
|
if (result) {
|
|
4170
|
-
|
|
4260
|
+
_context38.next = 5;
|
|
4171
4261
|
break;
|
|
4172
4262
|
}
|
|
4173
|
-
return
|
|
4263
|
+
return _context38.abrupt("return");
|
|
4174
4264
|
case 5:
|
|
4175
4265
|
tempOrder = this.store.order.ensureTempOrder();
|
|
4176
4266
|
orderStore = this.store.order.store || {};
|
|
@@ -4179,24 +4269,24 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4179
4269
|
tempOrder.products = preserveManualProductDiscountProducts(tempOrder.products, result.productList);
|
|
4180
4270
|
}
|
|
4181
4271
|
if (!result.discountList) {
|
|
4182
|
-
|
|
4272
|
+
_context38.next = 14;
|
|
4183
4273
|
break;
|
|
4184
4274
|
}
|
|
4185
4275
|
OrderModule.populateSavedAmounts(tempOrder.products, result.discountList);
|
|
4186
|
-
|
|
4276
|
+
_context38.next = 13;
|
|
4187
4277
|
return _discountModule2 === null || _discountModule2 === void 0 ? void 0 : _discountModule2.setDiscountList(result.discountList);
|
|
4188
4278
|
case 13:
|
|
4189
4279
|
tempOrder.discount_list = result.discountList.filter(function (discount) {
|
|
4190
4280
|
return discount.isSelected;
|
|
4191
4281
|
});
|
|
4192
4282
|
case 14:
|
|
4193
|
-
|
|
4283
|
+
_context38.next = 16;
|
|
4194
4284
|
return this.store.order.recalculateSummary({
|
|
4195
4285
|
createIfMissing: true
|
|
4196
4286
|
});
|
|
4197
4287
|
case 16:
|
|
4198
4288
|
this.store.order.persistTempOrder();
|
|
4199
|
-
|
|
4289
|
+
_context38.next = 19;
|
|
4200
4290
|
return this.effectsEmit('onDiscountApplied', {
|
|
4201
4291
|
productList: tempOrder.products || [],
|
|
4202
4292
|
discountList: result.discountList || [],
|
|
@@ -4204,17 +4294,17 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4204
4294
|
tempOrder: tempOrder
|
|
4205
4295
|
});
|
|
4206
4296
|
case 19:
|
|
4207
|
-
|
|
4297
|
+
_context38.next = 24;
|
|
4208
4298
|
break;
|
|
4209
4299
|
case 21:
|
|
4210
|
-
|
|
4211
|
-
|
|
4212
|
-
throw
|
|
4300
|
+
_context38.prev = 21;
|
|
4301
|
+
_context38.t0 = _context38["catch"](0);
|
|
4302
|
+
throw _context38.t0;
|
|
4213
4303
|
case 24:
|
|
4214
4304
|
case "end":
|
|
4215
|
-
return
|
|
4305
|
+
return _context38.stop();
|
|
4216
4306
|
}
|
|
4217
|
-
},
|
|
4307
|
+
}, _callee38, this, [[0, 21]]);
|
|
4218
4308
|
}));
|
|
4219
4309
|
function applyDiscountCalculationResult(_x29) {
|
|
4220
4310
|
return _applyDiscountCalculationResult.apply(this, arguments);
|
|
@@ -4224,16 +4314,16 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4224
4314
|
}, {
|
|
4225
4315
|
key: "submitScanOrder",
|
|
4226
4316
|
value: function () {
|
|
4227
|
-
var _submitScanOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4228
|
-
return _regeneratorRuntime().wrap(function
|
|
4229
|
-
while (1) switch (
|
|
4317
|
+
var _submitScanOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39(params) {
|
|
4318
|
+
return _regeneratorRuntime().wrap(function _callee39$(_context39) {
|
|
4319
|
+
while (1) switch (_context39.prev = _context39.next) {
|
|
4230
4320
|
case 0:
|
|
4231
|
-
return
|
|
4321
|
+
return _context39.abrupt("return", this.submitSalesOrder(params));
|
|
4232
4322
|
case 1:
|
|
4233
4323
|
case "end":
|
|
4234
|
-
return
|
|
4324
|
+
return _context39.stop();
|
|
4235
4325
|
}
|
|
4236
|
-
},
|
|
4326
|
+
}, _callee39, this);
|
|
4237
4327
|
}));
|
|
4238
4328
|
function submitScanOrder(_x30) {
|
|
4239
4329
|
return _submitScanOrder.apply(this, arguments);
|
|
@@ -4263,33 +4353,33 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4263
4353
|
}, {
|
|
4264
4354
|
key: "buildVirtualSettlementSubmitData",
|
|
4265
4355
|
value: function () {
|
|
4266
|
-
var _buildVirtualSettlementSubmitData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4356
|
+
var _buildVirtualSettlementSubmitData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40() {
|
|
4267
4357
|
var settlement, tempOrder, currencyProductId, summary, amount, customerId, asset, balance, amountText, paymentNumber, payment, _paymentMethod$custom, paymentMethods, paymentMethod;
|
|
4268
|
-
return _regeneratorRuntime().wrap(function
|
|
4269
|
-
while (1) switch (
|
|
4358
|
+
return _regeneratorRuntime().wrap(function _callee40$(_context40) {
|
|
4359
|
+
while (1) switch (_context40.prev = _context40.next) {
|
|
4270
4360
|
case 0:
|
|
4271
4361
|
settlement = this.buildVirtualSettlementOrderData();
|
|
4272
4362
|
if (!(!settlement || !this.store.order)) {
|
|
4273
|
-
|
|
4363
|
+
_context40.next = 3;
|
|
4274
4364
|
break;
|
|
4275
4365
|
}
|
|
4276
|
-
return
|
|
4366
|
+
return _context40.abrupt("return", null);
|
|
4277
4367
|
case 3:
|
|
4278
4368
|
tempOrder = this.store.order.getTempOrder();
|
|
4279
4369
|
currencyProductId = settlement.currencyProductId;
|
|
4280
|
-
|
|
4370
|
+
_context40.next = 7;
|
|
4281
4371
|
return this.store.order.recalculateSummary({
|
|
4282
4372
|
createIfMissing: true
|
|
4283
4373
|
});
|
|
4284
4374
|
case 7:
|
|
4285
|
-
summary =
|
|
4375
|
+
summary = _context40.sent;
|
|
4286
4376
|
amount = new Decimal((summary === null || summary === void 0 ? void 0 : summary.total_amount) || 0).toDecimalPlaces(2);
|
|
4287
4377
|
customerId = Number((tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.customer_id) || 0);
|
|
4288
4378
|
if (!(amount.gt(0) && customerId > 0 && customerId !== 1)) {
|
|
4289
|
-
|
|
4379
|
+
_context40.next = 13;
|
|
4290
4380
|
break;
|
|
4291
4381
|
}
|
|
4292
|
-
|
|
4382
|
+
_context40.next = 13;
|
|
4293
4383
|
return this.store.order.loadDiscountConfig({
|
|
4294
4384
|
customerId: customerId,
|
|
4295
4385
|
action: tempOrder !== null && tempOrder !== void 0 && tempOrder.order_id ? 'edit' : 'create',
|
|
@@ -4301,22 +4391,22 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4301
4391
|
return Number(item === null || item === void 0 ? void 0 : item.product_id) === currencyProductId;
|
|
4302
4392
|
});
|
|
4303
4393
|
if (!amount.lte(0)) {
|
|
4304
|
-
|
|
4394
|
+
_context40.next = 16;
|
|
4305
4395
|
break;
|
|
4306
4396
|
}
|
|
4307
|
-
return
|
|
4397
|
+
return _context40.abrupt("return", _objectSpread(_objectSpread({}, settlement), {}, {
|
|
4308
4398
|
payments: []
|
|
4309
4399
|
}));
|
|
4310
4400
|
case 16:
|
|
4311
4401
|
if (asset) {
|
|
4312
|
-
|
|
4402
|
+
_context40.next = 18;
|
|
4313
4403
|
break;
|
|
4314
4404
|
}
|
|
4315
4405
|
throw new Error('No matching virtual currency card is available.');
|
|
4316
4406
|
case 18:
|
|
4317
4407
|
balance = new Decimal(asset.balance || 0);
|
|
4318
4408
|
if (!balance.lt(amount)) {
|
|
4319
|
-
|
|
4409
|
+
_context40.next = 21;
|
|
4320
4410
|
break;
|
|
4321
4411
|
}
|
|
4322
4412
|
throw new Error('Insufficient virtual currency balance.');
|
|
@@ -4324,7 +4414,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4324
4414
|
amountText = amount.toFixed(2);
|
|
4325
4415
|
paymentNumber = "LOCAL_".concat(createUuidV4());
|
|
4326
4416
|
if (!this.store.order.isOnlineStorePlatform()) {
|
|
4327
|
-
|
|
4417
|
+
_context40.next = 27;
|
|
4328
4418
|
break;
|
|
4329
4419
|
}
|
|
4330
4420
|
payment = {
|
|
@@ -4341,18 +4431,18 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4341
4431
|
},
|
|
4342
4432
|
wallet_pass_use_value: amountText
|
|
4343
4433
|
};
|
|
4344
|
-
|
|
4434
|
+
_context40.next = 34;
|
|
4345
4435
|
break;
|
|
4346
4436
|
case 27:
|
|
4347
|
-
|
|
4437
|
+
_context40.next = 29;
|
|
4348
4438
|
return this.getPaymentMethodsAsync();
|
|
4349
4439
|
case 29:
|
|
4350
|
-
paymentMethods =
|
|
4440
|
+
paymentMethods = _context40.sent;
|
|
4351
4441
|
paymentMethod = paymentMethods.find(function (method) {
|
|
4352
4442
|
return String(method.code || '').toUpperCase() === 'PRODUCTVOUCHER';
|
|
4353
4443
|
});
|
|
4354
4444
|
if (paymentMethod) {
|
|
4355
|
-
|
|
4445
|
+
_context40.next = 33;
|
|
4356
4446
|
break;
|
|
4357
4447
|
}
|
|
4358
4448
|
throw new Error('PRODUCTVOUCHER payment method is unavailable.');
|
|
@@ -4376,14 +4466,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4376
4466
|
metadata: {}
|
|
4377
4467
|
};
|
|
4378
4468
|
case 34:
|
|
4379
|
-
return
|
|
4469
|
+
return _context40.abrupt("return", _objectSpread(_objectSpread({}, settlement), {}, {
|
|
4380
4470
|
payments: [payment]
|
|
4381
4471
|
}));
|
|
4382
4472
|
case 35:
|
|
4383
4473
|
case "end":
|
|
4384
|
-
return
|
|
4474
|
+
return _context40.stop();
|
|
4385
4475
|
}
|
|
4386
|
-
},
|
|
4476
|
+
}, _callee40, this);
|
|
4387
4477
|
}));
|
|
4388
4478
|
function buildVirtualSettlementSubmitData() {
|
|
4389
4479
|
return _buildVirtualSettlementSubmitData.apply(this, arguments);
|
|
@@ -4399,42 +4489,45 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4399
4489
|
}, {
|
|
4400
4490
|
key: "submitSalesOrder",
|
|
4401
4491
|
value: (function () {
|
|
4402
|
-
var _submitSalesOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4403
|
-
var _params$smallTicketDa, _this$
|
|
4492
|
+
var _submitSalesOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41(params) {
|
|
4493
|
+
var _params$smallTicketDa, _this$otherParams19, _this$otherParams20, _this$otherParams21, _this$otherParams22;
|
|
4404
4494
|
var isDeferredPayment, virtualPaymentSettlement, virtualSettlement, inferredPaymentStatus, smallTicketDataFlag, virtualSettlementEnhancePayload, configuredEnhancePayload, enhancePayload, submitParams;
|
|
4405
|
-
return _regeneratorRuntime().wrap(function
|
|
4406
|
-
while (1) switch (
|
|
4495
|
+
return _regeneratorRuntime().wrap(function _callee41$(_context41) {
|
|
4496
|
+
while (1) switch (_context41.prev = _context41.next) {
|
|
4407
4497
|
case 0:
|
|
4408
4498
|
if (this.store.order) {
|
|
4409
|
-
|
|
4499
|
+
_context41.next = 2;
|
|
4410
4500
|
break;
|
|
4411
4501
|
}
|
|
4412
4502
|
throw new Error('BaseSales 解决方案需要 order 模块支持');
|
|
4413
4503
|
case 2:
|
|
4504
|
+
_context41.next = 4;
|
|
4505
|
+
return this.validateContactInfo();
|
|
4506
|
+
case 4:
|
|
4414
4507
|
if (!this.isPickupTimingEnabled()) {
|
|
4415
|
-
|
|
4508
|
+
_context41.next = 7;
|
|
4416
4509
|
break;
|
|
4417
4510
|
}
|
|
4418
|
-
|
|
4511
|
+
_context41.next = 7;
|
|
4419
4512
|
return this.preparePickupTimingForCheckout({
|
|
4420
4513
|
freeze: true
|
|
4421
4514
|
});
|
|
4422
|
-
case
|
|
4515
|
+
case 7:
|
|
4423
4516
|
isDeferredPayment = (params === null || params === void 0 ? void 0 : params.paymentExecution) === 'deferred';
|
|
4424
4517
|
if (!isDeferredPayment) {
|
|
4425
|
-
|
|
4518
|
+
_context41.next = 12;
|
|
4426
4519
|
break;
|
|
4427
4520
|
}
|
|
4428
|
-
|
|
4429
|
-
|
|
4521
|
+
_context41.t0 = null;
|
|
4522
|
+
_context41.next = 15;
|
|
4430
4523
|
break;
|
|
4431
|
-
case 10:
|
|
4432
|
-
_context38.next = 12;
|
|
4433
|
-
return this.buildVirtualSettlementSubmitData();
|
|
4434
4524
|
case 12:
|
|
4435
|
-
|
|
4436
|
-
|
|
4437
|
-
|
|
4525
|
+
_context41.next = 14;
|
|
4526
|
+
return this.buildVirtualSettlementSubmitData();
|
|
4527
|
+
case 14:
|
|
4528
|
+
_context41.t0 = _context41.sent;
|
|
4529
|
+
case 15:
|
|
4530
|
+
virtualPaymentSettlement = _context41.t0;
|
|
4438
4531
|
virtualSettlement = isDeferredPayment ? this.buildVirtualSettlementOrderData() : virtualPaymentSettlement; // this.store.order.persistTempOrder();
|
|
4439
4532
|
inferredPaymentStatus = isDeferredPayment ? undefined : this.getSubmitPaymentStatus(params === null || params === void 0 ? void 0 : params.paymentStatus);
|
|
4440
4533
|
smallTicketDataFlag = (_params$smallTicketDa = params === null || params === void 0 ? void 0 : params.smallTicketDataFlag) !== null && _params$smallTicketDa !== void 0 ? _params$smallTicketDa : this.getDefaultCheckoutSmallTicketDataFlag();
|
|
@@ -4467,10 +4560,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4467
4560
|
} : configuredEnhancePayload;
|
|
4468
4561
|
submitParams = _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
4469
4562
|
cacheId: this.cacheId,
|
|
4470
|
-
platform: (_this$
|
|
4471
|
-
businessCode: ((_this$
|
|
4563
|
+
platform: (_this$otherParams19 = this.otherParams) === null || _this$otherParams19 === void 0 ? void 0 : _this$otherParams19.platform,
|
|
4564
|
+
businessCode: ((_this$otherParams20 = this.otherParams) === null || _this$otherParams20 === void 0 ? void 0 : _this$otherParams20.businessCode) || ((_this$otherParams21 = this.otherParams) === null || _this$otherParams21 === void 0 ? void 0 : _this$otherParams21.business_code),
|
|
4472
4565
|
channel: this.getSubmitOrderSalesChannel(),
|
|
4473
|
-
type: (_this$
|
|
4566
|
+
type: (_this$otherParams22 = this.otherParams) === null || _this$otherParams22 === void 0 ? void 0 : _this$otherParams22.type,
|
|
4474
4567
|
request_unique_idempotency_token: this.store.order.generateIdempotencyToken()
|
|
4475
4568
|
}, isDeferredPayment ? {
|
|
4476
4569
|
payments: []
|
|
@@ -4489,55 +4582,75 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4489
4582
|
} : {}), enhancePayload !== undefined ? {
|
|
4490
4583
|
enhancePayload: enhancePayload
|
|
4491
4584
|
} : {});
|
|
4492
|
-
return
|
|
4493
|
-
case
|
|
4585
|
+
return _context41.abrupt("return", this.shouldUseCheckoutSyncTask() ? this.store.order.submitTempOrder(submitParams) : this.store.order.submitTempOrderAsync(submitParams));
|
|
4586
|
+
case 24:
|
|
4494
4587
|
case "end":
|
|
4495
|
-
return
|
|
4588
|
+
return _context41.stop();
|
|
4496
4589
|
}
|
|
4497
|
-
},
|
|
4590
|
+
}, _callee41, this);
|
|
4498
4591
|
}));
|
|
4499
4592
|
function submitSalesOrder(_x31) {
|
|
4500
4593
|
return _submitSalesOrder.apply(this, arguments);
|
|
4501
4594
|
}
|
|
4502
4595
|
return submitSalesOrder;
|
|
4596
|
+
}() /** Validate required contact fields before a new payment is initiated. */)
|
|
4597
|
+
}, {
|
|
4598
|
+
key: "ensureSalesOrderReadyForPayment",
|
|
4599
|
+
value: (function () {
|
|
4600
|
+
var _ensureSalesOrderReadyForPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42() {
|
|
4601
|
+
return _regeneratorRuntime().wrap(function _callee42$(_context42) {
|
|
4602
|
+
while (1) switch (_context42.prev = _context42.next) {
|
|
4603
|
+
case 0:
|
|
4604
|
+
_context42.next = 2;
|
|
4605
|
+
return this.validateContactInfo();
|
|
4606
|
+
case 2:
|
|
4607
|
+
case "end":
|
|
4608
|
+
return _context42.stop();
|
|
4609
|
+
}
|
|
4610
|
+
}, _callee42, this);
|
|
4611
|
+
}));
|
|
4612
|
+
function ensureSalesOrderReadyForPayment() {
|
|
4613
|
+
return _ensureSalesOrderReadyForPayment.apply(this, arguments);
|
|
4614
|
+
}
|
|
4615
|
+
return ensureSalesOrderReadyForPayment;
|
|
4503
4616
|
}())
|
|
4504
4617
|
}, {
|
|
4505
4618
|
key: "saveSalesOrderDraft",
|
|
4506
4619
|
value: function () {
|
|
4507
|
-
var _saveSalesOrderDraft = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4508
|
-
var _params$platform, _this$
|
|
4509
|
-
return _regeneratorRuntime().wrap(function
|
|
4510
|
-
while (1) switch (
|
|
4620
|
+
var _saveSalesOrderDraft = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(params) {
|
|
4621
|
+
var _params$platform, _this$otherParams23, _this$otherParams24, _this$otherParams25, _params$channel, _params$type, _this$otherParams26;
|
|
4622
|
+
return _regeneratorRuntime().wrap(function _callee43$(_context43) {
|
|
4623
|
+
while (1) switch (_context43.prev = _context43.next) {
|
|
4511
4624
|
case 0:
|
|
4512
4625
|
if (this.store.order) {
|
|
4513
|
-
|
|
4626
|
+
_context43.next = 2;
|
|
4514
4627
|
break;
|
|
4515
4628
|
}
|
|
4516
4629
|
throw new Error('BaseSales 解决方案需要 order 模块支持');
|
|
4517
4630
|
case 2:
|
|
4518
4631
|
if (!this.isPickupTimingEnabled()) {
|
|
4519
|
-
|
|
4632
|
+
_context43.next = 5;
|
|
4520
4633
|
break;
|
|
4521
4634
|
}
|
|
4522
|
-
|
|
4635
|
+
_context43.next = 5;
|
|
4523
4636
|
return this.preparePickupTimingForCheckout({
|
|
4524
4637
|
freeze: false
|
|
4525
4638
|
});
|
|
4526
4639
|
case 5:
|
|
4527
|
-
return
|
|
4640
|
+
return _context43.abrupt("return", this.store.order.saveTempOrderAsDraft(_objectSpread({
|
|
4528
4641
|
cacheId: this.cacheId,
|
|
4529
|
-
platform: (_params$platform = params === null || params === void 0 ? void 0 : params.platform) !== null && _params$platform !== void 0 ? _params$platform : (_this$
|
|
4530
|
-
businessCode: (params === null || params === void 0 ? void 0 : params.businessCode) || ((_this$
|
|
4642
|
+
platform: (_params$platform = params === null || params === void 0 ? void 0 : params.platform) !== null && _params$platform !== void 0 ? _params$platform : (_this$otherParams23 = this.otherParams) === null || _this$otherParams23 === void 0 ? void 0 : _this$otherParams23.platform,
|
|
4643
|
+
businessCode: (params === null || params === void 0 ? void 0 : params.businessCode) || ((_this$otherParams24 = this.otherParams) === null || _this$otherParams24 === void 0 ? void 0 : _this$otherParams24.businessCode) || ((_this$otherParams25 = this.otherParams) === null || _this$otherParams25 === void 0 ? void 0 : _this$otherParams25.business_code),
|
|
4531
4644
|
channel: (_params$channel = params === null || params === void 0 ? void 0 : params.channel) !== null && _params$channel !== void 0 ? _params$channel : this.getSubmitOrderSalesChannel(),
|
|
4532
|
-
type: (_params$type = params === null || params === void 0 ? void 0 : params.type) !== null && _params$type !== void 0 ? _params$type : (_this$
|
|
4645
|
+
type: (_params$type = params === null || params === void 0 ? void 0 : params.type) !== null && _params$type !== void 0 ? _params$type : (_this$otherParams26 = this.otherParams) === null || _this$otherParams26 === void 0 ? void 0 : _this$otherParams26.type
|
|
4533
4646
|
}, (params === null || params === void 0 ? void 0 : params.enhancePayload) !== undefined ? {
|
|
4534
4647
|
enhancePayload: params.enhancePayload
|
|
4535
4648
|
} : {})));
|
|
4536
4649
|
case 6:
|
|
4537
4650
|
case "end":
|
|
4538
|
-
return
|
|
4651
|
+
return _context43.stop();
|
|
4539
4652
|
}
|
|
4540
|
-
},
|
|
4653
|
+
}, _callee43, this);
|
|
4541
4654
|
}));
|
|
4542
4655
|
function saveSalesOrderDraft(_x32) {
|
|
4543
4656
|
return _saveSalesOrderDraft.apply(this, arguments);
|
|
@@ -4547,36 +4660,39 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4547
4660
|
}, {
|
|
4548
4661
|
key: "submitTempOrderAsync",
|
|
4549
4662
|
value: function () {
|
|
4550
|
-
var _submitTempOrderAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4551
|
-
var _params$smallTicketDa2, _this$
|
|
4663
|
+
var _submitTempOrderAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44(params) {
|
|
4664
|
+
var _params$smallTicketDa2, _this$otherParams27, _this$otherParams28, _this$otherParams29, _this$otherParams30;
|
|
4552
4665
|
var inferredPaymentStatus, smallTicketDataFlag, enhancePayload, submitParams;
|
|
4553
|
-
return _regeneratorRuntime().wrap(function
|
|
4554
|
-
while (1) switch (
|
|
4666
|
+
return _regeneratorRuntime().wrap(function _callee44$(_context44) {
|
|
4667
|
+
while (1) switch (_context44.prev = _context44.next) {
|
|
4555
4668
|
case 0:
|
|
4556
4669
|
if (this.store.order) {
|
|
4557
|
-
|
|
4670
|
+
_context44.next = 2;
|
|
4558
4671
|
break;
|
|
4559
4672
|
}
|
|
4560
4673
|
throw new Error('BaseSales 解决方案需要 order 模块支持');
|
|
4561
4674
|
case 2:
|
|
4675
|
+
_context44.next = 4;
|
|
4676
|
+
return this.validateContactInfo();
|
|
4677
|
+
case 4:
|
|
4562
4678
|
if (!this.isPickupTimingEnabled()) {
|
|
4563
|
-
|
|
4679
|
+
_context44.next = 7;
|
|
4564
4680
|
break;
|
|
4565
4681
|
}
|
|
4566
|
-
|
|
4682
|
+
_context44.next = 7;
|
|
4567
4683
|
return this.preparePickupTimingForCheckout({
|
|
4568
4684
|
freeze: true
|
|
4569
4685
|
});
|
|
4570
|
-
case
|
|
4686
|
+
case 7:
|
|
4571
4687
|
inferredPaymentStatus = this.getSubmitPaymentStatus(params === null || params === void 0 ? void 0 : params.paymentStatus);
|
|
4572
4688
|
smallTicketDataFlag = (_params$smallTicketDa2 = params === null || params === void 0 ? void 0 : params.smallTicketDataFlag) !== null && _params$smallTicketDa2 !== void 0 ? _params$smallTicketDa2 : this.getDefaultCheckoutSmallTicketDataFlag();
|
|
4573
4689
|
enhancePayload = this.buildSubmitPayloadEnhancerWithOpenDataConfig(params === null || params === void 0 ? void 0 : params.enhancePayload);
|
|
4574
4690
|
submitParams = _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
4575
4691
|
cacheId: this.cacheId,
|
|
4576
|
-
platform: (_this$
|
|
4577
|
-
businessCode: ((_this$
|
|
4692
|
+
platform: (_this$otherParams27 = this.otherParams) === null || _this$otherParams27 === void 0 ? void 0 : _this$otherParams27.platform,
|
|
4693
|
+
businessCode: ((_this$otherParams28 = this.otherParams) === null || _this$otherParams28 === void 0 ? void 0 : _this$otherParams28.businessCode) || ((_this$otherParams29 = this.otherParams) === null || _this$otherParams29 === void 0 ? void 0 : _this$otherParams29.business_code),
|
|
4578
4694
|
channel: this.getSubmitOrderSalesChannel(),
|
|
4579
|
-
type: (_this$
|
|
4695
|
+
type: (_this$otherParams30 = this.otherParams) === null || _this$otherParams30 === void 0 ? void 0 : _this$otherParams30.type,
|
|
4580
4696
|
request_unique_idempotency_token: this.store.order.generateIdempotencyToken()
|
|
4581
4697
|
}, (params === null || params === void 0 ? void 0 : params.payments) !== undefined ? {
|
|
4582
4698
|
payments: params.payments
|
|
@@ -4589,12 +4705,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4589
4705
|
} : {}), enhancePayload !== undefined ? {
|
|
4590
4706
|
enhancePayload: enhancePayload
|
|
4591
4707
|
} : {});
|
|
4592
|
-
return
|
|
4593
|
-
case
|
|
4708
|
+
return _context44.abrupt("return", this.store.order.submitTempOrderAsync(submitParams));
|
|
4709
|
+
case 12:
|
|
4594
4710
|
case "end":
|
|
4595
|
-
return
|
|
4711
|
+
return _context44.stop();
|
|
4596
4712
|
}
|
|
4597
|
-
},
|
|
4713
|
+
}, _callee44, this);
|
|
4598
4714
|
}));
|
|
4599
4715
|
function submitTempOrderAsync(_x33) {
|
|
4600
4716
|
return _submitTempOrderAsync.apply(this, arguments);
|
|
@@ -4608,8 +4724,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4608
4724
|
}, {
|
|
4609
4725
|
key: "shouldUseCheckoutSyncTask",
|
|
4610
4726
|
value: function shouldUseCheckoutSyncTask() {
|
|
4611
|
-
var _this$
|
|
4612
|
-
var configured = (_this$
|
|
4727
|
+
var _this$otherParams31;
|
|
4728
|
+
var configured = (_this$otherParams31 = this.otherParams) === null || _this$otherParams31 === void 0 ? void 0 : _this$otherParams31.checkoutSyncTaskEnabled;
|
|
4613
4729
|
return typeof configured === 'boolean' ? configured : true;
|
|
4614
4730
|
}
|
|
4615
4731
|
|
|
@@ -4622,14 +4738,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4622
4738
|
}, {
|
|
4623
4739
|
key: "printLocalOrderReceipt",
|
|
4624
4740
|
value: function () {
|
|
4625
|
-
var _printLocalOrderReceipt = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4626
|
-
var _this$
|
|
4741
|
+
var _printLocalOrderReceipt = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee45(lookup) {
|
|
4742
|
+
var _this$otherParams32, _this$otherParams33, _this$otherParams34, _this$otherParams35;
|
|
4627
4743
|
var hasLookup, lookupPayload, context, payload, invoiceLayoutConfig, invoiceTemplateSettings, printPayload, response, _this$store$order$app, _this$store$order13, _data;
|
|
4628
|
-
return _regeneratorRuntime().wrap(function
|
|
4629
|
-
while (1) switch (
|
|
4744
|
+
return _regeneratorRuntime().wrap(function _callee45$(_context45) {
|
|
4745
|
+
while (1) switch (_context45.prev = _context45.next) {
|
|
4630
4746
|
case 0:
|
|
4631
4747
|
if (this.store.order) {
|
|
4632
|
-
|
|
4748
|
+
_context45.next = 2;
|
|
4633
4749
|
break;
|
|
4634
4750
|
}
|
|
4635
4751
|
throw new Error('BaseSales 解决方案需要 order 模块支持');
|
|
@@ -4641,10 +4757,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4641
4757
|
external_sale_number: lookup
|
|
4642
4758
|
};
|
|
4643
4759
|
context = {
|
|
4644
|
-
platform: (_this$
|
|
4645
|
-
businessCode: ((_this$
|
|
4760
|
+
platform: (_this$otherParams32 = this.otherParams) === null || _this$otherParams32 === void 0 ? void 0 : _this$otherParams32.platform,
|
|
4761
|
+
businessCode: ((_this$otherParams33 = this.otherParams) === null || _this$otherParams33 === void 0 ? void 0 : _this$otherParams33.businessCode) || ((_this$otherParams34 = this.otherParams) === null || _this$otherParams34 === void 0 ? void 0 : _this$otherParams34.business_code),
|
|
4646
4762
|
channel: this.getSubmitOrderSalesChannel(),
|
|
4647
|
-
type: (_this$
|
|
4763
|
+
type: (_this$otherParams35 = this.otherParams) === null || _this$otherParams35 === void 0 ? void 0 : _this$otherParams35.type
|
|
4648
4764
|
};
|
|
4649
4765
|
payload = hasLookup ? _objectSpread(_objectSpread({}, lookupPayload), {}, {
|
|
4650
4766
|
lookup_order_from_db: 1,
|
|
@@ -4667,26 +4783,26 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4667
4783
|
} : {}), invoiceTemplateSettings ? {
|
|
4668
4784
|
template_settings: cloneDeep(invoiceTemplateSettings)
|
|
4669
4785
|
} : {});
|
|
4670
|
-
|
|
4786
|
+
_context45.next = 11;
|
|
4671
4787
|
return this.request.post('/local/print-order', printPayload, {
|
|
4672
4788
|
osServer: true,
|
|
4673
4789
|
customToast: function customToast() {}
|
|
4674
4790
|
});
|
|
4675
4791
|
case 11:
|
|
4676
|
-
response =
|
|
4792
|
+
response = _context45.sent;
|
|
4677
4793
|
if (hasLookup) {
|
|
4678
|
-
|
|
4794
|
+
_context45.next = 15;
|
|
4679
4795
|
break;
|
|
4680
4796
|
}
|
|
4681
|
-
|
|
4797
|
+
_context45.next = 15;
|
|
4682
4798
|
return (_this$store$order$app = (_this$store$order13 = this.store.order).applyLocalPrintOrderNumbers) === null || _this$store$order$app === void 0 ? void 0 : _this$store$order$app.call(_this$store$order13, response === null || response === void 0 || (_data = response.data) === null || _data === void 0 ? void 0 : _data.order);
|
|
4683
4799
|
case 15:
|
|
4684
|
-
return
|
|
4800
|
+
return _context45.abrupt("return", response);
|
|
4685
4801
|
case 16:
|
|
4686
4802
|
case "end":
|
|
4687
|
-
return
|
|
4803
|
+
return _context45.stop();
|
|
4688
4804
|
}
|
|
4689
|
-
},
|
|
4805
|
+
}, _callee45, this);
|
|
4690
4806
|
}));
|
|
4691
4807
|
function printLocalOrderReceipt(_x34) {
|
|
4692
4808
|
return _printLocalOrderReceipt.apply(this, arguments);
|
|
@@ -4709,19 +4825,19 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4709
4825
|
}, {
|
|
4710
4826
|
key: "syncPaymentsToOrder",
|
|
4711
4827
|
value: function () {
|
|
4712
|
-
var _syncPaymentsToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4713
|
-
var _ref49, _params$businessCode, _this$
|
|
4828
|
+
var _syncPaymentsToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee46(params) {
|
|
4829
|
+
var _ref49, _params$businessCode, _this$otherParams36, _this$otherParams37, _params$channel2;
|
|
4714
4830
|
var businessCode, channel, enhancePayload, syncParams, syncState, payments, syncResult, latestPayments, amountSnapshot, orderSnapshot, syncPayload;
|
|
4715
|
-
return _regeneratorRuntime().wrap(function
|
|
4716
|
-
while (1) switch (
|
|
4831
|
+
return _regeneratorRuntime().wrap(function _callee46$(_context46) {
|
|
4832
|
+
while (1) switch (_context46.prev = _context46.next) {
|
|
4717
4833
|
case 0:
|
|
4718
4834
|
if (this.store.order) {
|
|
4719
|
-
|
|
4835
|
+
_context46.next = 2;
|
|
4720
4836
|
break;
|
|
4721
4837
|
}
|
|
4722
4838
|
throw new Error('order 模块未初始化');
|
|
4723
4839
|
case 2:
|
|
4724
|
-
businessCode = (_ref49 = (_params$businessCode = params.businessCode) !== null && _params$businessCode !== void 0 ? _params$businessCode : (_this$
|
|
4840
|
+
businessCode = (_ref49 = (_params$businessCode = params.businessCode) !== null && _params$businessCode !== void 0 ? _params$businessCode : (_this$otherParams36 = this.otherParams) === null || _this$otherParams36 === void 0 ? void 0 : _this$otherParams36.businessCode) !== null && _ref49 !== void 0 ? _ref49 : (_this$otherParams37 = this.otherParams) === null || _this$otherParams37 === void 0 ? void 0 : _this$otherParams37.business_code;
|
|
4725
4841
|
channel = (_params$channel2 = params.channel) !== null && _params$channel2 !== void 0 ? _params$channel2 : this.getSubmitOrderSalesChannel();
|
|
4726
4842
|
enhancePayload = this.buildSubmitPayloadEnhancerWithOpenDataConfig(params.enhancePayload);
|
|
4727
4843
|
syncParams = _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, params), {}, {
|
|
@@ -4735,14 +4851,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4735
4851
|
} : {});
|
|
4736
4852
|
syncState = this.store.order.getOrderSyncState();
|
|
4737
4853
|
if (!(params.submitWhenPaid && syncState === 'submitting')) {
|
|
4738
|
-
|
|
4854
|
+
_context46.next = 10;
|
|
4739
4855
|
break;
|
|
4740
4856
|
}
|
|
4741
4857
|
this.queueLatestAutoPaymentSync();
|
|
4742
|
-
return
|
|
4858
|
+
return _context46.abrupt("return", this.store.order.syncPaymentsToOrder(syncParams));
|
|
4743
4859
|
case 10:
|
|
4744
4860
|
payments = params.payments || [];
|
|
4745
|
-
|
|
4861
|
+
_context46.next = 13;
|
|
4746
4862
|
return this.effectsEmit(BaseSalesHookNames.onPaymentSyncStart, {
|
|
4747
4863
|
payments: payments,
|
|
4748
4864
|
params: syncParams,
|
|
@@ -4750,11 +4866,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4750
4866
|
orderSnapshot: this.store.order.getOrderSnapshot()
|
|
4751
4867
|
});
|
|
4752
4868
|
case 13:
|
|
4753
|
-
|
|
4754
|
-
|
|
4869
|
+
_context46.prev = 13;
|
|
4870
|
+
_context46.next = 16;
|
|
4755
4871
|
return this.store.order.syncPaymentsToOrder(syncParams);
|
|
4756
4872
|
case 16:
|
|
4757
|
-
syncResult =
|
|
4873
|
+
syncResult = _context46.sent;
|
|
4758
4874
|
latestPayments = this.store.order.getOrderPayments();
|
|
4759
4875
|
amountSnapshot = this.store.order.getOrderAmountSnapshot();
|
|
4760
4876
|
orderSnapshot = this.store.order.getOrderSnapshot();
|
|
@@ -4772,25 +4888,25 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4772
4888
|
depositAmount: syncResult.depositAmount,
|
|
4773
4889
|
orderExpectedAmount: syncResult.orderExpectedAmount
|
|
4774
4890
|
};
|
|
4775
|
-
|
|
4891
|
+
_context46.next = 23;
|
|
4776
4892
|
return this.effectsEmit(BaseSalesHookNames.onPaymentSyncEnd, syncPayload);
|
|
4777
4893
|
case 23:
|
|
4778
4894
|
if (!(syncResult.isDepositFullyPaid && !syncResult.isOrderFullyPaid)) {
|
|
4779
|
-
|
|
4895
|
+
_context46.next = 26;
|
|
4780
4896
|
break;
|
|
4781
4897
|
}
|
|
4782
|
-
|
|
4898
|
+
_context46.next = 26;
|
|
4783
4899
|
return this.effectsEmit(BaseSalesHookNames.onDepositPaymentSyncEnd, syncPayload);
|
|
4784
4900
|
case 26:
|
|
4785
4901
|
this.scheduleQueuedAutoPaymentSyncFlush(0);
|
|
4786
|
-
return
|
|
4902
|
+
return _context46.abrupt("return", syncResult);
|
|
4787
4903
|
case 30:
|
|
4788
|
-
|
|
4789
|
-
|
|
4790
|
-
|
|
4904
|
+
_context46.prev = 30;
|
|
4905
|
+
_context46.t0 = _context46["catch"](13);
|
|
4906
|
+
_context46.next = 34;
|
|
4791
4907
|
return this.effectsEmit(BaseSalesHookNames.onPaymentSyncEnd, {
|
|
4792
4908
|
ok: false,
|
|
4793
|
-
error:
|
|
4909
|
+
error: _context46.t0,
|
|
4794
4910
|
payments: this.store.order.getOrderPayments(),
|
|
4795
4911
|
params: syncParams,
|
|
4796
4912
|
amountSnapshot: this.store.order.getOrderAmountSnapshot(),
|
|
@@ -4798,12 +4914,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4798
4914
|
});
|
|
4799
4915
|
case 34:
|
|
4800
4916
|
this.scheduleQueuedAutoPaymentSyncFlush(0);
|
|
4801
|
-
throw
|
|
4917
|
+
throw _context46.t0;
|
|
4802
4918
|
case 36:
|
|
4803
4919
|
case "end":
|
|
4804
|
-
return
|
|
4920
|
+
return _context46.stop();
|
|
4805
4921
|
}
|
|
4806
|
-
},
|
|
4922
|
+
}, _callee46, this, [[13, 30]]);
|
|
4807
4923
|
}));
|
|
4808
4924
|
function syncPaymentsToOrder(_x35) {
|
|
4809
4925
|
return _syncPaymentsToOrder.apply(this, arguments);
|
|
@@ -4854,46 +4970,46 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4854
4970
|
}, {
|
|
4855
4971
|
key: "flushQueuedAutoPaymentSync",
|
|
4856
4972
|
value: function () {
|
|
4857
|
-
var _flushQueuedAutoPaymentSync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4973
|
+
var _flushQueuedAutoPaymentSync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee47() {
|
|
4858
4974
|
var payments;
|
|
4859
|
-
return _regeneratorRuntime().wrap(function
|
|
4860
|
-
while (1) switch (
|
|
4975
|
+
return _regeneratorRuntime().wrap(function _callee47$(_context47) {
|
|
4976
|
+
while (1) switch (_context47.prev = _context47.next) {
|
|
4861
4977
|
case 0:
|
|
4862
4978
|
if (this.store.order) {
|
|
4863
|
-
|
|
4979
|
+
_context47.next = 2;
|
|
4864
4980
|
break;
|
|
4865
4981
|
}
|
|
4866
|
-
return
|
|
4982
|
+
return _context47.abrupt("return");
|
|
4867
4983
|
case 2:
|
|
4868
4984
|
if (!(!this.queuedAutoPaymentSync || this.autoPaymentSyncFlushing)) {
|
|
4869
|
-
|
|
4985
|
+
_context47.next = 4;
|
|
4870
4986
|
break;
|
|
4871
4987
|
}
|
|
4872
|
-
return
|
|
4988
|
+
return _context47.abrupt("return");
|
|
4873
4989
|
case 4:
|
|
4874
4990
|
if (!(this.store.order.getOrderSyncState() === 'submitting')) {
|
|
4875
|
-
|
|
4991
|
+
_context47.next = 7;
|
|
4876
4992
|
break;
|
|
4877
4993
|
}
|
|
4878
4994
|
this.scheduleQueuedAutoPaymentSyncFlush();
|
|
4879
|
-
return
|
|
4995
|
+
return _context47.abrupt("return");
|
|
4880
4996
|
case 7:
|
|
4881
4997
|
this.autoPaymentSyncFlushing = true;
|
|
4882
|
-
|
|
4998
|
+
_context47.prev = 8;
|
|
4883
4999
|
case 9:
|
|
4884
5000
|
if (!this.queuedAutoPaymentSync) {
|
|
4885
|
-
|
|
5001
|
+
_context47.next = 18;
|
|
4886
5002
|
break;
|
|
4887
5003
|
}
|
|
4888
5004
|
this.queuedAutoPaymentSync = false;
|
|
4889
5005
|
payments = this.store.order.getOrderPayments();
|
|
4890
5006
|
if (payments.length) {
|
|
4891
|
-
|
|
5007
|
+
_context47.next = 14;
|
|
4892
5008
|
break;
|
|
4893
5009
|
}
|
|
4894
|
-
return
|
|
5010
|
+
return _context47.abrupt("continue", 9);
|
|
4895
5011
|
case 14:
|
|
4896
|
-
|
|
5012
|
+
_context47.next = 16;
|
|
4897
5013
|
return this.syncPaymentsToOrder({
|
|
4898
5014
|
payments: payments,
|
|
4899
5015
|
paymentStatus: this.getPaymentStatusForSync(payments),
|
|
@@ -4901,29 +5017,29 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4901
5017
|
smallTicketDataFlag: 1
|
|
4902
5018
|
});
|
|
4903
5019
|
case 16:
|
|
4904
|
-
|
|
5020
|
+
_context47.next = 9;
|
|
4905
5021
|
break;
|
|
4906
5022
|
case 18:
|
|
4907
|
-
|
|
5023
|
+
_context47.next = 23;
|
|
4908
5024
|
break;
|
|
4909
5025
|
case 20:
|
|
4910
|
-
|
|
4911
|
-
|
|
5026
|
+
_context47.prev = 20;
|
|
5027
|
+
_context47.t0 = _context47["catch"](8);
|
|
4912
5028
|
this.logError('queued auto sync payments failed', {
|
|
4913
|
-
error:
|
|
5029
|
+
error: _context47.t0 instanceof Error ? _context47.t0.message : String(_context47.t0)
|
|
4914
5030
|
});
|
|
4915
5031
|
case 23:
|
|
4916
|
-
|
|
5032
|
+
_context47.prev = 23;
|
|
4917
5033
|
this.autoPaymentSyncFlushing = false;
|
|
4918
5034
|
if (this.queuedAutoPaymentSync) {
|
|
4919
5035
|
this.scheduleQueuedAutoPaymentSyncFlush(0);
|
|
4920
5036
|
}
|
|
4921
|
-
return
|
|
5037
|
+
return _context47.finish(23);
|
|
4922
5038
|
case 27:
|
|
4923
5039
|
case "end":
|
|
4924
|
-
return
|
|
5040
|
+
return _context47.stop();
|
|
4925
5041
|
}
|
|
4926
|
-
},
|
|
5042
|
+
}, _callee47, this, [[8, 20, 23, 27]]);
|
|
4927
5043
|
}));
|
|
4928
5044
|
function flushQueuedAutoPaymentSync() {
|
|
4929
5045
|
return _flushQueuedAutoPaymentSync.apply(this, arguments);
|
|
@@ -4947,33 +5063,33 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4947
5063
|
}, {
|
|
4948
5064
|
key: "addOrderPaymentAsync",
|
|
4949
5065
|
value: (function () {
|
|
4950
|
-
var _addOrderPaymentAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5066
|
+
var _addOrderPaymentAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee48(payment) {
|
|
4951
5067
|
var paymentRecord, hasPaymentNumber, devicePrefix;
|
|
4952
|
-
return _regeneratorRuntime().wrap(function
|
|
4953
|
-
while (1) switch (
|
|
5068
|
+
return _regeneratorRuntime().wrap(function _callee48$(_context48) {
|
|
5069
|
+
while (1) switch (_context48.prev = _context48.next) {
|
|
4954
5070
|
case 0:
|
|
4955
5071
|
paymentRecord = payment;
|
|
4956
5072
|
hasPaymentNumber = String(paymentRecord.payment_number || '').trim() !== '';
|
|
4957
5073
|
if (!hasPaymentNumber) {
|
|
4958
|
-
|
|
5074
|
+
_context48.next = 6;
|
|
4959
5075
|
break;
|
|
4960
5076
|
}
|
|
4961
|
-
|
|
4962
|
-
|
|
5077
|
+
_context48.t0 = 'LOCAL';
|
|
5078
|
+
_context48.next = 9;
|
|
4963
5079
|
break;
|
|
4964
5080
|
case 6:
|
|
4965
|
-
|
|
5081
|
+
_context48.next = 8;
|
|
4966
5082
|
return this.getPaymentNumberDevicePrefixAsync();
|
|
4967
5083
|
case 8:
|
|
4968
|
-
|
|
5084
|
+
_context48.t0 = _context48.sent;
|
|
4969
5085
|
case 9:
|
|
4970
|
-
devicePrefix =
|
|
4971
|
-
return
|
|
5086
|
+
devicePrefix = _context48.t0;
|
|
5087
|
+
return _context48.abrupt("return", this.addOrderPaymentWithDevicePrefix(payment, devicePrefix));
|
|
4972
5088
|
case 11:
|
|
4973
5089
|
case "end":
|
|
4974
|
-
return
|
|
5090
|
+
return _context48.stop();
|
|
4975
5091
|
}
|
|
4976
|
-
},
|
|
5092
|
+
}, _callee48, this);
|
|
4977
5093
|
}));
|
|
4978
5094
|
function addOrderPaymentAsync(_x36) {
|
|
4979
5095
|
return _addOrderPaymentAsync.apply(this, arguments);
|
|
@@ -4983,7 +5099,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4983
5099
|
}, {
|
|
4984
5100
|
key: "addOrderPaymentWithDevicePrefix",
|
|
4985
5101
|
value: function addOrderPaymentWithDevicePrefix(payment, devicePrefix) {
|
|
4986
|
-
var _this$
|
|
5102
|
+
var _this$otherParams38,
|
|
4987
5103
|
_paymentRecord$paymen,
|
|
4988
5104
|
_paymentRecord$create,
|
|
4989
5105
|
_ref50,
|
|
@@ -4999,7 +5115,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4999
5115
|
return this.store.order.getOrderPayments();
|
|
5000
5116
|
}
|
|
5001
5117
|
var metadata = paymentRecord.metadata && _typeof(paymentRecord.metadata) === 'object' ? _objectSpread({}, paymentRecord.metadata) : {};
|
|
5002
|
-
var shopWalletPassId = (_this$
|
|
5118
|
+
var shopWalletPassId = (_this$otherParams38 = this.otherParams) === null || _this$otherParams38 === void 0 ? void 0 : _this$otherParams38.shop_wallet_pass_id;
|
|
5003
5119
|
if (shopWalletPassId !== undefined && shopWalletPassId !== null) {
|
|
5004
5120
|
metadata.shop_wallet_pass_id = shopWalletPassId;
|
|
5005
5121
|
}
|
|
@@ -5044,7 +5160,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5044
5160
|
}, {
|
|
5045
5161
|
key: "updateOrderPayment",
|
|
5046
5162
|
value: (function () {
|
|
5047
|
-
var _updateOrderPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5163
|
+
var _updateOrderPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee49(paymentIdentity, updates) {
|
|
5048
5164
|
var _result$payment, _result$payment2;
|
|
5049
5165
|
var options,
|
|
5050
5166
|
matchMode,
|
|
@@ -5061,13 +5177,13 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5061
5177
|
shouldSubmit,
|
|
5062
5178
|
syncResult,
|
|
5063
5179
|
_options$smallTicketD2,
|
|
5064
|
-
|
|
5065
|
-
return _regeneratorRuntime().wrap(function
|
|
5066
|
-
while (1) switch (
|
|
5180
|
+
_args49 = arguments;
|
|
5181
|
+
return _regeneratorRuntime().wrap(function _callee49$(_context49) {
|
|
5182
|
+
while (1) switch (_context49.prev = _context49.next) {
|
|
5067
5183
|
case 0:
|
|
5068
|
-
options =
|
|
5184
|
+
options = _args49.length > 2 && _args49[2] !== undefined ? _args49[2] : {};
|
|
5069
5185
|
if (this.store.order) {
|
|
5070
|
-
|
|
5186
|
+
_context49.next = 3;
|
|
5071
5187
|
break;
|
|
5072
5188
|
}
|
|
5073
5189
|
throw new Error('order 模块未初始化');
|
|
@@ -5076,15 +5192,15 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5076
5192
|
previousMatch = resolveOrderPaymentIdentity(this.store.order.getOrderPayments(), paymentIdentity, matchMode);
|
|
5077
5193
|
previousPayment = previousMatch === null || previousMatch === void 0 ? void 0 : previousMatch.payment;
|
|
5078
5194
|
if (!((previousPayment === null || previousPayment === void 0 ? void 0 : previousPayment.status) === 'paid' && !options.applyUpdatesWhenPaid)) {
|
|
5079
|
-
|
|
5195
|
+
_context49.next = 13;
|
|
5080
5196
|
break;
|
|
5081
5197
|
}
|
|
5082
5198
|
currentPayments = this.store.order.getOrderPayments();
|
|
5083
5199
|
if (!(options.submitWhenPaid && options.forceSubmitIfPaid)) {
|
|
5084
|
-
|
|
5200
|
+
_context49.next = 12;
|
|
5085
5201
|
break;
|
|
5086
5202
|
}
|
|
5087
|
-
|
|
5203
|
+
_context49.next = 11;
|
|
5088
5204
|
return this.syncPaymentsToOrder({
|
|
5089
5205
|
payments: currentPayments,
|
|
5090
5206
|
paymentStatus: this.getPaymentStatusForSync(currentPayments),
|
|
@@ -5092,9 +5208,9 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5092
5208
|
smallTicketDataFlag: (_options$smallTicketD = options.smallTicketDataFlag) !== null && _options$smallTicketD !== void 0 ? _options$smallTicketD : 1
|
|
5093
5209
|
});
|
|
5094
5210
|
case 11:
|
|
5095
|
-
_syncResult =
|
|
5211
|
+
_syncResult = _context49.sent;
|
|
5096
5212
|
case 12:
|
|
5097
|
-
return
|
|
5213
|
+
return _context49.abrupt("return", _objectSpread({
|
|
5098
5214
|
updated: false,
|
|
5099
5215
|
payment: previousPayment,
|
|
5100
5216
|
payments: currentPayments,
|
|
@@ -5103,44 +5219,44 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5103
5219
|
syncResult: _syncResult
|
|
5104
5220
|
} : {}));
|
|
5105
5221
|
case 13:
|
|
5106
|
-
|
|
5222
|
+
_context49.next = 15;
|
|
5107
5223
|
return this.store.order.updateOrderPayment(paymentIdentity, updates, {
|
|
5108
5224
|
matchBy: matchMode
|
|
5109
5225
|
});
|
|
5110
5226
|
case 15:
|
|
5111
|
-
result =
|
|
5227
|
+
result = _context49.sent;
|
|
5112
5228
|
if (!(options.persistDraft !== false)) {
|
|
5113
|
-
|
|
5229
|
+
_context49.next = 29;
|
|
5114
5230
|
break;
|
|
5115
5231
|
}
|
|
5116
|
-
|
|
5117
|
-
|
|
5232
|
+
_context49.prev = 17;
|
|
5233
|
+
_context49.next = 20;
|
|
5118
5234
|
return this.saveSalesOrderDraft();
|
|
5119
5235
|
case 20:
|
|
5120
|
-
draftResult =
|
|
5121
|
-
|
|
5236
|
+
draftResult = _context49.sent;
|
|
5237
|
+
_context49.next = 29;
|
|
5122
5238
|
break;
|
|
5123
5239
|
case 23:
|
|
5124
|
-
|
|
5125
|
-
|
|
5126
|
-
draftError =
|
|
5240
|
+
_context49.prev = 23;
|
|
5241
|
+
_context49.t0 = _context49["catch"](17);
|
|
5242
|
+
draftError = _context49.t0;
|
|
5127
5243
|
this.logError('updateOrderPayment: 保存支付草稿失败', {
|
|
5128
5244
|
paymentIdentity: paymentIdentity,
|
|
5129
|
-
error:
|
|
5245
|
+
error: _context49.t0 instanceof Error ? _context49.t0.message : String(_context49.t0)
|
|
5130
5246
|
});
|
|
5131
5247
|
if (options.submitWhenPaid) {
|
|
5132
|
-
|
|
5248
|
+
_context49.next = 29;
|
|
5133
5249
|
break;
|
|
5134
5250
|
}
|
|
5135
|
-
throw
|
|
5251
|
+
throw _context49.t0;
|
|
5136
5252
|
case 29:
|
|
5137
5253
|
becamePaid = (previousPayment === null || previousPayment === void 0 ? void 0 : previousPayment.status) !== 'paid' && ((_result$payment = result.payment) === null || _result$payment === void 0 ? void 0 : _result$payment.status) === 'paid';
|
|
5138
5254
|
shouldSubmit = Boolean(options.submitWhenPaid && ((_result$payment2 = result.payment) === null || _result$payment2 === void 0 ? void 0 : _result$payment2.status) === 'paid' && (becamePaid || options.forceSubmitIfPaid));
|
|
5139
5255
|
if (!shouldSubmit) {
|
|
5140
|
-
|
|
5256
|
+
_context49.next = 35;
|
|
5141
5257
|
break;
|
|
5142
5258
|
}
|
|
5143
|
-
|
|
5259
|
+
_context49.next = 34;
|
|
5144
5260
|
return this.syncPaymentsToOrder({
|
|
5145
5261
|
payments: result.payments,
|
|
5146
5262
|
paymentStatus: this.getPaymentStatusForSync(result.payments),
|
|
@@ -5148,9 +5264,9 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5148
5264
|
smallTicketDataFlag: (_options$smallTicketD2 = options.smallTicketDataFlag) !== null && _options$smallTicketD2 !== void 0 ? _options$smallTicketD2 : 1
|
|
5149
5265
|
});
|
|
5150
5266
|
case 34:
|
|
5151
|
-
syncResult =
|
|
5267
|
+
syncResult = _context49.sent;
|
|
5152
5268
|
case 35:
|
|
5153
|
-
return
|
|
5269
|
+
return _context49.abrupt("return", _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, result), draftResult !== undefined ? {
|
|
5154
5270
|
draftResult: draftResult
|
|
5155
5271
|
} : {}), draftError !== undefined ? {
|
|
5156
5272
|
draftError: draftError
|
|
@@ -5159,9 +5275,9 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5159
5275
|
} : {}));
|
|
5160
5276
|
case 36:
|
|
5161
5277
|
case "end":
|
|
5162
|
-
return
|
|
5278
|
+
return _context49.stop();
|
|
5163
5279
|
}
|
|
5164
|
-
},
|
|
5280
|
+
}, _callee49, this, [[17, 23]]);
|
|
5165
5281
|
}));
|
|
5166
5282
|
function updateOrderPayment(_x37, _x38) {
|
|
5167
5283
|
return _updateOrderPayment.apply(this, arguments);
|
|
@@ -5185,22 +5301,22 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5185
5301
|
}, {
|
|
5186
5302
|
key: "updateVoucherOrderPaymentsAsync",
|
|
5187
5303
|
value: function () {
|
|
5188
|
-
var _updateVoucherOrderPaymentsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5189
|
-
return _regeneratorRuntime().wrap(function
|
|
5190
|
-
while (1) switch (
|
|
5304
|
+
var _updateVoucherOrderPaymentsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee50(payments, options) {
|
|
5305
|
+
return _regeneratorRuntime().wrap(function _callee50$(_context50) {
|
|
5306
|
+
while (1) switch (_context50.prev = _context50.next) {
|
|
5191
5307
|
case 0:
|
|
5192
5308
|
if (this.store.order) {
|
|
5193
|
-
|
|
5309
|
+
_context50.next = 2;
|
|
5194
5310
|
break;
|
|
5195
5311
|
}
|
|
5196
5312
|
throw new Error('order 模块未初始化');
|
|
5197
5313
|
case 2:
|
|
5198
|
-
return
|
|
5314
|
+
return _context50.abrupt("return", this.store.order.updateVoucherOrderPaymentsAsync(payments, options));
|
|
5199
5315
|
case 3:
|
|
5200
5316
|
case "end":
|
|
5201
|
-
return
|
|
5317
|
+
return _context50.stop();
|
|
5202
5318
|
}
|
|
5203
|
-
},
|
|
5319
|
+
}, _callee50, this);
|
|
5204
5320
|
}));
|
|
5205
5321
|
function updateVoucherOrderPaymentsAsync(_x39, _x40) {
|
|
5206
5322
|
return _updateVoucherOrderPaymentsAsync.apply(this, arguments);
|
|
@@ -5317,20 +5433,20 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5317
5433
|
}, {
|
|
5318
5434
|
key: "initWalletData",
|
|
5319
5435
|
value: function () {
|
|
5320
|
-
var _initWalletData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5436
|
+
var _initWalletData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee51(params) {
|
|
5321
5437
|
var _this$store$order$mer, _this$store$order17, _snapshot$identity;
|
|
5322
5438
|
var snapshot, walletBusinessData, result;
|
|
5323
|
-
return _regeneratorRuntime().wrap(function
|
|
5324
|
-
while (1) switch (
|
|
5439
|
+
return _regeneratorRuntime().wrap(function _callee51$(_context51) {
|
|
5440
|
+
while (1) switch (_context51.prev = _context51.next) {
|
|
5325
5441
|
case 0:
|
|
5326
5442
|
if (this.store.order) {
|
|
5327
|
-
|
|
5443
|
+
_context51.next = 2;
|
|
5328
5444
|
break;
|
|
5329
5445
|
}
|
|
5330
5446
|
throw new Error('order 模块未初始化');
|
|
5331
5447
|
case 2:
|
|
5332
5448
|
if (this.store.payment) {
|
|
5333
|
-
|
|
5449
|
+
_context51.next = 4;
|
|
5334
5450
|
break;
|
|
5335
5451
|
}
|
|
5336
5452
|
throw new Error('payment 模块未初始化');
|
|
@@ -5338,10 +5454,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5338
5454
|
snapshot = this.store.order.getOrderSnapshot();
|
|
5339
5455
|
walletBusinessData = this.buildWalletInitBusinessData(params);
|
|
5340
5456
|
if (walletBusinessData) {
|
|
5341
|
-
|
|
5457
|
+
_context51.next = 8;
|
|
5342
5458
|
break;
|
|
5343
5459
|
}
|
|
5344
|
-
return
|
|
5460
|
+
return _context51.abrupt("return", {
|
|
5345
5461
|
walletRecommendList: [],
|
|
5346
5462
|
userIdentificationCodes: [],
|
|
5347
5463
|
transformList: [],
|
|
@@ -5349,15 +5465,15 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5349
5465
|
products: []
|
|
5350
5466
|
});
|
|
5351
5467
|
case 8:
|
|
5352
|
-
|
|
5468
|
+
_context51.next = 10;
|
|
5353
5469
|
return this.store.payment.wallet.initializeWalletDataFromBusinessAsync(walletBusinessData);
|
|
5354
5470
|
case 10:
|
|
5355
|
-
result =
|
|
5471
|
+
result = _context51.sent;
|
|
5356
5472
|
(_this$store$order$mer = (_this$store$order17 = this.store.order).mergePointCardSnapshotCodes) === null || _this$store$order$mer === void 0 || _this$store$order$mer.call(_this$store$order17, result.userIdentificationCodes, {
|
|
5357
5473
|
customerId: walletBusinessData.customer_id,
|
|
5358
5474
|
orderIdentity: snapshot === null || snapshot === void 0 ? void 0 : snapshot.identity
|
|
5359
5475
|
});
|
|
5360
|
-
|
|
5476
|
+
_context51.next = 14;
|
|
5361
5477
|
return this.core.effects.emit("".concat(this.name, ":onWalletDataInitialized"), {
|
|
5362
5478
|
orderId: snapshot === null || snapshot === void 0 || (_snapshot$identity = snapshot.identity) === null || _snapshot$identity === void 0 ? void 0 : _snapshot$identity.orderId,
|
|
5363
5479
|
customerId: walletBusinessData.customer_id,
|
|
@@ -5369,12 +5485,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5369
5485
|
timestamp: Date.now()
|
|
5370
5486
|
});
|
|
5371
5487
|
case 14:
|
|
5372
|
-
return
|
|
5488
|
+
return _context51.abrupt("return", result);
|
|
5373
5489
|
case 15:
|
|
5374
5490
|
case "end":
|
|
5375
|
-
return
|
|
5491
|
+
return _context51.stop();
|
|
5376
5492
|
}
|
|
5377
|
-
},
|
|
5493
|
+
}, _callee51, this);
|
|
5378
5494
|
}));
|
|
5379
5495
|
function initWalletData(_x41) {
|
|
5380
5496
|
return _initWalletData.apply(this, arguments);
|
|
@@ -5427,25 +5543,25 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5427
5543
|
}, {
|
|
5428
5544
|
key: "publishWalletAssetsState",
|
|
5429
5545
|
value: function () {
|
|
5430
|
-
var _publishWalletAssetsState = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5546
|
+
var _publishWalletAssetsState = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee52(state) {
|
|
5431
5547
|
var changeSource,
|
|
5432
|
-
|
|
5433
|
-
return _regeneratorRuntime().wrap(function
|
|
5434
|
-
while (1) switch (
|
|
5548
|
+
_args52 = arguments;
|
|
5549
|
+
return _regeneratorRuntime().wrap(function _callee52$(_context52) {
|
|
5550
|
+
while (1) switch (_context52.prev = _context52.next) {
|
|
5435
5551
|
case 0:
|
|
5436
|
-
changeSource =
|
|
5437
|
-
|
|
5552
|
+
changeSource = _args52.length > 1 && _args52[1] !== undefined ? _args52[1] : 'derived';
|
|
5553
|
+
_context52.next = 3;
|
|
5438
5554
|
return this.effectsEmit(BaseSalesHookNames.onWalletAssetsStateChanged, {
|
|
5439
5555
|
state: state,
|
|
5440
5556
|
changeSource: changeSource
|
|
5441
5557
|
});
|
|
5442
5558
|
case 3:
|
|
5443
|
-
return
|
|
5559
|
+
return _context52.abrupt("return", state);
|
|
5444
5560
|
case 4:
|
|
5445
5561
|
case "end":
|
|
5446
|
-
return
|
|
5562
|
+
return _context52.stop();
|
|
5447
5563
|
}
|
|
5448
|
-
},
|
|
5564
|
+
}, _callee52, this);
|
|
5449
5565
|
}));
|
|
5450
5566
|
function publishWalletAssetsState(_x42) {
|
|
5451
5567
|
return _publishWalletAssetsState.apply(this, arguments);
|
|
@@ -5455,26 +5571,26 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5455
5571
|
}, {
|
|
5456
5572
|
key: "syncSelectedWalletAssets",
|
|
5457
5573
|
value: function () {
|
|
5458
|
-
var _syncSelectedWalletAssets = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5574
|
+
var _syncSelectedWalletAssets = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee53(state) {
|
|
5459
5575
|
var paymentMethods, methodByCode, preparePayments, selectedAssetById, voucherPayments, payments;
|
|
5460
|
-
return _regeneratorRuntime().wrap(function
|
|
5461
|
-
while (1) switch (
|
|
5576
|
+
return _regeneratorRuntime().wrap(function _callee53$(_context53) {
|
|
5577
|
+
while (1) switch (_context53.prev = _context53.next) {
|
|
5462
5578
|
case 0:
|
|
5463
5579
|
if (!(!this.store.order || !this.store.payment)) {
|
|
5464
|
-
|
|
5580
|
+
_context53.next = 2;
|
|
5465
5581
|
break;
|
|
5466
5582
|
}
|
|
5467
5583
|
throw new Error('订单或支付模块未初始化');
|
|
5468
5584
|
case 2:
|
|
5469
5585
|
paymentMethods = this.getPaymentMethods();
|
|
5470
5586
|
if (!(!paymentMethods.length && state.selectedItems.length)) {
|
|
5471
|
-
|
|
5587
|
+
_context53.next = 7;
|
|
5472
5588
|
break;
|
|
5473
5589
|
}
|
|
5474
|
-
|
|
5590
|
+
_context53.next = 6;
|
|
5475
5591
|
return this.getPaymentMethodsAsync();
|
|
5476
5592
|
case 6:
|
|
5477
|
-
paymentMethods =
|
|
5593
|
+
paymentMethods = _context53.sent;
|
|
5478
5594
|
case 7:
|
|
5479
5595
|
methodByCode = new Map(paymentMethods.map(function (method) {
|
|
5480
5596
|
return [String(method.code || '').toUpperCase(), method];
|
|
@@ -5516,17 +5632,17 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5516
5632
|
payments = this.updateVoucherOrderPayments(voucherPayments, {
|
|
5517
5633
|
status: 'payment_pending'
|
|
5518
5634
|
});
|
|
5519
|
-
|
|
5635
|
+
_context53.next = 14;
|
|
5520
5636
|
return this.store.order.recalculateSummary({
|
|
5521
5637
|
createIfMissing: true
|
|
5522
5638
|
});
|
|
5523
5639
|
case 14:
|
|
5524
|
-
return
|
|
5640
|
+
return _context53.abrupt("return", payments);
|
|
5525
5641
|
case 15:
|
|
5526
5642
|
case "end":
|
|
5527
|
-
return
|
|
5643
|
+
return _context53.stop();
|
|
5528
5644
|
}
|
|
5529
|
-
},
|
|
5645
|
+
}, _callee53, this);
|
|
5530
5646
|
}));
|
|
5531
5647
|
function syncSelectedWalletAssets(_x43) {
|
|
5532
5648
|
return _syncSelectedWalletAssets.apply(this, arguments);
|
|
@@ -5562,29 +5678,29 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5562
5678
|
}, {
|
|
5563
5679
|
key: "importWalletAssetsSnapshot",
|
|
5564
5680
|
value: (function () {
|
|
5565
|
-
var _importWalletAssetsSnapshot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5681
|
+
var _importWalletAssetsSnapshot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee54(snapshot) {
|
|
5566
5682
|
var _this$store$order19, _this$store$order19$m;
|
|
5567
5683
|
var state;
|
|
5568
|
-
return _regeneratorRuntime().wrap(function
|
|
5569
|
-
while (1) switch (
|
|
5684
|
+
return _regeneratorRuntime().wrap(function _callee54$(_context54) {
|
|
5685
|
+
while (1) switch (_context54.prev = _context54.next) {
|
|
5570
5686
|
case 0:
|
|
5571
5687
|
if (this.store.payment) {
|
|
5572
|
-
|
|
5688
|
+
_context54.next = 2;
|
|
5573
5689
|
break;
|
|
5574
5690
|
}
|
|
5575
5691
|
throw new Error('payment 模块未初始化');
|
|
5576
5692
|
case 2:
|
|
5577
5693
|
state = this.store.payment.wallet.importWalletAssetsSnapshot(snapshot);
|
|
5578
5694
|
(_this$store$order19 = this.store.order) === null || _this$store$order19 === void 0 || (_this$store$order19$m = _this$store$order19.mergePointCardSnapshotCodes) === null || _this$store$order19$m === void 0 || _this$store$order19$m.call(_this$store$order19, state.items);
|
|
5579
|
-
|
|
5695
|
+
_context54.next = 6;
|
|
5580
5696
|
return this.syncSelectedWalletAssets(state);
|
|
5581
5697
|
case 6:
|
|
5582
|
-
return
|
|
5698
|
+
return _context54.abrupt("return", this.publishWalletAssetsState(state));
|
|
5583
5699
|
case 7:
|
|
5584
5700
|
case "end":
|
|
5585
|
-
return
|
|
5701
|
+
return _context54.stop();
|
|
5586
5702
|
}
|
|
5587
|
-
},
|
|
5703
|
+
}, _callee54, this);
|
|
5588
5704
|
}));
|
|
5589
5705
|
function importWalletAssetsSnapshot(_x44) {
|
|
5590
5706
|
return _importWalletAssetsSnapshot.apply(this, arguments);
|
|
@@ -5598,20 +5714,20 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5598
5714
|
}, {
|
|
5599
5715
|
key: "refreshWalletAssets",
|
|
5600
5716
|
value: (function () {
|
|
5601
|
-
var _refreshWalletAssets = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5717
|
+
var _refreshWalletAssets = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee55(params) {
|
|
5602
5718
|
var _this$store$order$get6, _previousState$custom, _businessData$custome;
|
|
5603
5719
|
var refreshSequence, wallet, businessData, emptyState, pointCardSnapshotMergeContext, previousState, hasPreviousWalletContext, customerChanged, clearedState, refreshTask, state, _this$store$order$mer2, _this$store$order20, _wallet$getUserIdenti, committed;
|
|
5604
|
-
return _regeneratorRuntime().wrap(function
|
|
5605
|
-
while (1) switch (
|
|
5720
|
+
return _regeneratorRuntime().wrap(function _callee55$(_context55) {
|
|
5721
|
+
while (1) switch (_context55.prev = _context55.next) {
|
|
5606
5722
|
case 0:
|
|
5607
5723
|
if (this.store.order) {
|
|
5608
|
-
|
|
5724
|
+
_context55.next = 2;
|
|
5609
5725
|
break;
|
|
5610
5726
|
}
|
|
5611
5727
|
throw new Error('order 模块未初始化');
|
|
5612
5728
|
case 2:
|
|
5613
5729
|
if (this.store.payment) {
|
|
5614
|
-
|
|
5730
|
+
_context55.next = 4;
|
|
5615
5731
|
break;
|
|
5616
5732
|
}
|
|
5617
5733
|
throw new Error('payment 模块未初始化');
|
|
@@ -5620,7 +5736,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5620
5736
|
wallet = this.store.payment.wallet;
|
|
5621
5737
|
businessData = this.buildWalletInitBusinessData(params);
|
|
5622
5738
|
if (businessData) {
|
|
5623
|
-
|
|
5739
|
+
_context55.next = 12;
|
|
5624
5740
|
break;
|
|
5625
5741
|
}
|
|
5626
5742
|
wallet.clearAllCache();
|
|
@@ -5628,7 +5744,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5628
5744
|
this.updateVoucherOrderPayments([], {
|
|
5629
5745
|
status: 'payment_pending'
|
|
5630
5746
|
});
|
|
5631
|
-
return
|
|
5747
|
+
return _context55.abrupt("return", this.publishWalletAssetsState(emptyState));
|
|
5632
5748
|
case 12:
|
|
5633
5749
|
pointCardSnapshotMergeContext = {
|
|
5634
5750
|
customerId: businessData.customer_id,
|
|
@@ -5638,47 +5754,47 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5638
5754
|
hasPreviousWalletContext = previousState.status !== 'idle' || previousState.items.length > 0 || previousState.selectedIds.length > 0 || previousState.customerId !== undefined;
|
|
5639
5755
|
customerChanged = hasPreviousWalletContext && String((_previousState$custom = previousState.customerId) !== null && _previousState$custom !== void 0 ? _previousState$custom : '') !== String((_businessData$custome = businessData.customer_id) !== null && _businessData$custome !== void 0 ? _businessData$custome : '');
|
|
5640
5756
|
if (!customerChanged) {
|
|
5641
|
-
|
|
5757
|
+
_context55.next = 21;
|
|
5642
5758
|
break;
|
|
5643
5759
|
}
|
|
5644
5760
|
clearedState = wallet.clearWalletAssetSelection();
|
|
5645
5761
|
this.updateVoucherOrderPayments([], {
|
|
5646
5762
|
status: 'payment_pending'
|
|
5647
5763
|
});
|
|
5648
|
-
|
|
5764
|
+
_context55.next = 21;
|
|
5649
5765
|
return this.publishWalletAssetsState(clearedState);
|
|
5650
5766
|
case 21:
|
|
5651
5767
|
refreshTask = wallet.refreshWalletAssetsFromBusinessAsync(businessData, {
|
|
5652
5768
|
preserveSelection: (params === null || params === void 0 ? void 0 : params.preserveSelection) !== false && !customerChanged,
|
|
5653
5769
|
retainSearchResultCodes: params === null || params === void 0 ? void 0 : params.retainSearchResultCodes
|
|
5654
5770
|
});
|
|
5655
|
-
|
|
5771
|
+
_context55.next = 24;
|
|
5656
5772
|
return this.publishWalletAssetsState(wallet.getWalletAssetsState());
|
|
5657
5773
|
case 24:
|
|
5658
|
-
|
|
5774
|
+
_context55.next = 26;
|
|
5659
5775
|
return refreshTask;
|
|
5660
5776
|
case 26:
|
|
5661
|
-
state =
|
|
5777
|
+
state = _context55.sent;
|
|
5662
5778
|
if (!(refreshSequence !== this.walletAssetsRefreshSequence)) {
|
|
5663
|
-
|
|
5779
|
+
_context55.next = 29;
|
|
5664
5780
|
break;
|
|
5665
5781
|
}
|
|
5666
|
-
return
|
|
5782
|
+
return _context55.abrupt("return", wallet.getWalletAssetsState());
|
|
5667
5783
|
case 29:
|
|
5668
5784
|
if (state.status !== 'error') {
|
|
5669
5785
|
committed = this.getCommittedWalletAssets();
|
|
5670
5786
|
state = wallet.setCommittedWalletAssets(committed.ids, committed.assets);
|
|
5671
5787
|
(_this$store$order$mer2 = (_this$store$order20 = this.store.order).mergePointCardSnapshotCodes) === null || _this$store$order$mer2 === void 0 || _this$store$order$mer2.call(_this$store$order20, ((_wallet$getUserIdenti = wallet.getUserIdentificationCodes) === null || _wallet$getUserIdenti === void 0 ? void 0 : _wallet$getUserIdenti.call(wallet)) || [], pointCardSnapshotMergeContext);
|
|
5672
5788
|
}
|
|
5673
|
-
|
|
5789
|
+
_context55.next = 32;
|
|
5674
5790
|
return this.syncSelectedWalletAssets(state);
|
|
5675
5791
|
case 32:
|
|
5676
|
-
return
|
|
5792
|
+
return _context55.abrupt("return", this.publishWalletAssetsState(state));
|
|
5677
5793
|
case 33:
|
|
5678
5794
|
case "end":
|
|
5679
|
-
return
|
|
5795
|
+
return _context55.stop();
|
|
5680
5796
|
}
|
|
5681
|
-
},
|
|
5797
|
+
}, _callee55, this);
|
|
5682
5798
|
}));
|
|
5683
5799
|
function refreshWalletAssets(_x45) {
|
|
5684
5800
|
return _refreshWalletAssets.apply(this, arguments);
|
|
@@ -5688,13 +5804,13 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5688
5804
|
}, {
|
|
5689
5805
|
key: "selectWalletAsset",
|
|
5690
5806
|
value: (function () {
|
|
5691
|
-
var _selectWalletAsset = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5807
|
+
var _selectWalletAsset = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee56(params) {
|
|
5692
5808
|
var state;
|
|
5693
|
-
return _regeneratorRuntime().wrap(function
|
|
5694
|
-
while (1) switch (
|
|
5809
|
+
return _regeneratorRuntime().wrap(function _callee56$(_context56) {
|
|
5810
|
+
while (1) switch (_context56.prev = _context56.next) {
|
|
5695
5811
|
case 0:
|
|
5696
5812
|
if (this.store.payment) {
|
|
5697
|
-
|
|
5813
|
+
_context56.next = 2;
|
|
5698
5814
|
break;
|
|
5699
5815
|
}
|
|
5700
5816
|
throw new Error('payment 模块未初始化');
|
|
@@ -5703,15 +5819,15 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5703
5819
|
selected: params.selected,
|
|
5704
5820
|
source: params.source
|
|
5705
5821
|
});
|
|
5706
|
-
|
|
5822
|
+
_context56.next = 5;
|
|
5707
5823
|
return this.syncSelectedWalletAssets(state);
|
|
5708
5824
|
case 5:
|
|
5709
|
-
return
|
|
5825
|
+
return _context56.abrupt("return", this.publishWalletAssetsState(state, 'local'));
|
|
5710
5826
|
case 6:
|
|
5711
5827
|
case "end":
|
|
5712
|
-
return
|
|
5828
|
+
return _context56.stop();
|
|
5713
5829
|
}
|
|
5714
|
-
},
|
|
5830
|
+
}, _callee56, this);
|
|
5715
5831
|
}));
|
|
5716
5832
|
function selectWalletAsset(_x46) {
|
|
5717
5833
|
return _selectWalletAsset.apply(this, arguments);
|
|
@@ -5721,27 +5837,27 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5721
5837
|
}, {
|
|
5722
5838
|
key: "updateWalletAssetAmount",
|
|
5723
5839
|
value: (function () {
|
|
5724
|
-
var _updateWalletAssetAmount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5840
|
+
var _updateWalletAssetAmount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee57(params) {
|
|
5725
5841
|
var state;
|
|
5726
|
-
return _regeneratorRuntime().wrap(function
|
|
5727
|
-
while (1) switch (
|
|
5842
|
+
return _regeneratorRuntime().wrap(function _callee57$(_context57) {
|
|
5843
|
+
while (1) switch (_context57.prev = _context57.next) {
|
|
5728
5844
|
case 0:
|
|
5729
5845
|
if (this.store.payment) {
|
|
5730
|
-
|
|
5846
|
+
_context57.next = 2;
|
|
5731
5847
|
break;
|
|
5732
5848
|
}
|
|
5733
5849
|
throw new Error('payment 模块未初始化');
|
|
5734
5850
|
case 2:
|
|
5735
5851
|
state = this.store.payment.wallet.updateWalletAssetAmount(params.assetId, params.amount);
|
|
5736
|
-
|
|
5852
|
+
_context57.next = 5;
|
|
5737
5853
|
return this.syncSelectedWalletAssets(state);
|
|
5738
5854
|
case 5:
|
|
5739
|
-
return
|
|
5855
|
+
return _context57.abrupt("return", this.publishWalletAssetsState(state, 'local'));
|
|
5740
5856
|
case 6:
|
|
5741
5857
|
case "end":
|
|
5742
|
-
return
|
|
5858
|
+
return _context57.stop();
|
|
5743
5859
|
}
|
|
5744
|
-
},
|
|
5860
|
+
}, _callee57, this);
|
|
5745
5861
|
}));
|
|
5746
5862
|
function updateWalletAssetAmount(_x47) {
|
|
5747
5863
|
return _updateWalletAssetAmount.apply(this, arguments);
|
|
@@ -5751,13 +5867,13 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5751
5867
|
}, {
|
|
5752
5868
|
key: "scanWalletAsset",
|
|
5753
5869
|
value: (function () {
|
|
5754
|
-
var _scanWalletAsset = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5870
|
+
var _scanWalletAsset = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee58(code) {
|
|
5755
5871
|
var wallet, businessData, result;
|
|
5756
|
-
return _regeneratorRuntime().wrap(function
|
|
5757
|
-
while (1) switch (
|
|
5872
|
+
return _regeneratorRuntime().wrap(function _callee58$(_context58) {
|
|
5873
|
+
while (1) switch (_context58.prev = _context58.next) {
|
|
5758
5874
|
case 0:
|
|
5759
5875
|
if (this.store.payment) {
|
|
5760
|
-
|
|
5876
|
+
_context58.next = 2;
|
|
5761
5877
|
break;
|
|
5762
5878
|
}
|
|
5763
5879
|
throw new Error('payment 模块未初始化');
|
|
@@ -5767,26 +5883,26 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5767
5883
|
if (businessData) {
|
|
5768
5884
|
wallet.generateWalletParams(businessData);
|
|
5769
5885
|
}
|
|
5770
|
-
|
|
5886
|
+
_context58.next = 7;
|
|
5771
5887
|
return wallet.scanWalletAssetAsync(code);
|
|
5772
5888
|
case 7:
|
|
5773
|
-
result =
|
|
5889
|
+
result = _context58.sent;
|
|
5774
5890
|
if (!(result.type === 'normalCode')) {
|
|
5775
|
-
|
|
5891
|
+
_context58.next = 13;
|
|
5776
5892
|
break;
|
|
5777
5893
|
}
|
|
5778
|
-
|
|
5894
|
+
_context58.next = 11;
|
|
5779
5895
|
return this.syncSelectedWalletAssets(result.state);
|
|
5780
5896
|
case 11:
|
|
5781
|
-
|
|
5897
|
+
_context58.next = 13;
|
|
5782
5898
|
return this.publishWalletAssetsState(result.state, 'local');
|
|
5783
5899
|
case 13:
|
|
5784
|
-
return
|
|
5900
|
+
return _context58.abrupt("return", result);
|
|
5785
5901
|
case 14:
|
|
5786
5902
|
case "end":
|
|
5787
|
-
return
|
|
5903
|
+
return _context58.stop();
|
|
5788
5904
|
}
|
|
5789
|
-
},
|
|
5905
|
+
}, _callee58, this);
|
|
5790
5906
|
}));
|
|
5791
5907
|
function scanWalletAsset(_x48) {
|
|
5792
5908
|
return _scanWalletAsset.apply(this, arguments);
|
|
@@ -5796,27 +5912,27 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5796
5912
|
}, {
|
|
5797
5913
|
key: "clearWalletAssetSelection",
|
|
5798
5914
|
value: (function () {
|
|
5799
|
-
var _clearWalletAssetSelection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5915
|
+
var _clearWalletAssetSelection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee59() {
|
|
5800
5916
|
var state;
|
|
5801
|
-
return _regeneratorRuntime().wrap(function
|
|
5802
|
-
while (1) switch (
|
|
5917
|
+
return _regeneratorRuntime().wrap(function _callee59$(_context59) {
|
|
5918
|
+
while (1) switch (_context59.prev = _context59.next) {
|
|
5803
5919
|
case 0:
|
|
5804
5920
|
if (this.store.payment) {
|
|
5805
|
-
|
|
5921
|
+
_context59.next = 2;
|
|
5806
5922
|
break;
|
|
5807
5923
|
}
|
|
5808
5924
|
throw new Error('payment 模块未初始化');
|
|
5809
5925
|
case 2:
|
|
5810
5926
|
state = this.store.payment.wallet.clearWalletAssetSelection();
|
|
5811
|
-
|
|
5927
|
+
_context59.next = 5;
|
|
5812
5928
|
return this.syncSelectedWalletAssets(state);
|
|
5813
5929
|
case 5:
|
|
5814
|
-
return
|
|
5930
|
+
return _context59.abrupt("return", this.publishWalletAssetsState(state, 'local'));
|
|
5815
5931
|
case 6:
|
|
5816
5932
|
case "end":
|
|
5817
|
-
return
|
|
5933
|
+
return _context59.stop();
|
|
5818
5934
|
}
|
|
5819
|
-
},
|
|
5935
|
+
}, _callee59, this);
|
|
5820
5936
|
}));
|
|
5821
5937
|
function clearWalletAssetSelection() {
|
|
5822
5938
|
return _clearWalletAssetSelection.apply(this, arguments);
|
|
@@ -5853,35 +5969,35 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5853
5969
|
}, {
|
|
5854
5970
|
key: "getPaymentMethodsAsync",
|
|
5855
5971
|
value: (function () {
|
|
5856
|
-
var _getPaymentMethodsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5972
|
+
var _getPaymentMethodsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee60() {
|
|
5857
5973
|
var response, paymentMethods;
|
|
5858
|
-
return _regeneratorRuntime().wrap(function
|
|
5859
|
-
while (1) switch (
|
|
5974
|
+
return _regeneratorRuntime().wrap(function _callee60$(_context60) {
|
|
5975
|
+
while (1) switch (_context60.prev = _context60.next) {
|
|
5860
5976
|
case 0:
|
|
5861
|
-
|
|
5862
|
-
|
|
5977
|
+
_context60.prev = 0;
|
|
5978
|
+
_context60.next = 3;
|
|
5863
5979
|
return this.request.get('/pay/custom-payment/all', {
|
|
5864
5980
|
filterPaymentMethods: true
|
|
5865
5981
|
}, {
|
|
5866
5982
|
osServer: true
|
|
5867
5983
|
});
|
|
5868
5984
|
case 3:
|
|
5869
|
-
response =
|
|
5985
|
+
response = _context60.sent;
|
|
5870
5986
|
paymentMethods = (response === null || response === void 0 ? void 0 : response.data) || [];
|
|
5871
5987
|
this.paymentMethodsCache = Array.isArray(paymentMethods) ? _toConsumableArray(paymentMethods) : [];
|
|
5872
|
-
return
|
|
5988
|
+
return _context60.abrupt("return", this.getPaymentMethods());
|
|
5873
5989
|
case 9:
|
|
5874
|
-
|
|
5875
|
-
|
|
5990
|
+
_context60.prev = 9;
|
|
5991
|
+
_context60.t0 = _context60["catch"](0);
|
|
5876
5992
|
this.logWarning('getPaymentMethodsAsync: 获取支付方式列表失败,使用缓存列表', {
|
|
5877
|
-
error:
|
|
5993
|
+
error: _context60.t0 instanceof Error ? _context60.t0.message : String(_context60.t0)
|
|
5878
5994
|
});
|
|
5879
|
-
return
|
|
5995
|
+
return _context60.abrupt("return", this.getPaymentMethods());
|
|
5880
5996
|
case 13:
|
|
5881
5997
|
case "end":
|
|
5882
|
-
return
|
|
5998
|
+
return _context60.stop();
|
|
5883
5999
|
}
|
|
5884
|
-
},
|
|
6000
|
+
}, _callee60, this, [[0, 9]]);
|
|
5885
6001
|
}));
|
|
5886
6002
|
function getPaymentMethodsAsync() {
|
|
5887
6003
|
return _getPaymentMethodsAsync.apply(this, arguments);
|
|
@@ -5930,8 +6046,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5930
6046
|
}, {
|
|
5931
6047
|
key: "getCashPaymentConfig",
|
|
5932
6048
|
value: (function () {
|
|
5933
|
-
var _getCashPaymentConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5934
|
-
var _this$store$order24, _this$store$order24$g, _this$store$order25, _this$store$order25$g, _this$
|
|
6049
|
+
var _getCashPaymentConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee61() {
|
|
6050
|
+
var _this$store$order24, _this$store$order24$g, _this$store$order25, _this$store$order25$g, _this$otherParams39;
|
|
5935
6051
|
var options,
|
|
5936
6052
|
paymentMethods,
|
|
5937
6053
|
paymentMethod,
|
|
@@ -5940,13 +6056,13 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5940
6056
|
amountDue,
|
|
5941
6057
|
currency,
|
|
5942
6058
|
recommendedAmounts,
|
|
5943
|
-
|
|
5944
|
-
return _regeneratorRuntime().wrap(function
|
|
5945
|
-
while (1) switch (
|
|
6059
|
+
_args61 = arguments;
|
|
6060
|
+
return _regeneratorRuntime().wrap(function _callee61$(_context61) {
|
|
6061
|
+
while (1) switch (_context61.prev = _context61.next) {
|
|
5946
6062
|
case 0:
|
|
5947
|
-
options =
|
|
6063
|
+
options = _args61.length > 0 && _args61[0] !== undefined ? _args61[0] : {};
|
|
5948
6064
|
if (this.store.payment) {
|
|
5949
|
-
|
|
6065
|
+
_context61.next = 3;
|
|
5950
6066
|
break;
|
|
5951
6067
|
}
|
|
5952
6068
|
throw new Error('payment 模块未初始化');
|
|
@@ -5954,17 +6070,17 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5954
6070
|
paymentMethods = this.getPaymentMethods();
|
|
5955
6071
|
paymentMethod = this.findCashPaymentMethod(paymentMethods, options.paymentMethodId);
|
|
5956
6072
|
if (paymentMethod) {
|
|
5957
|
-
|
|
6073
|
+
_context61.next = 10;
|
|
5958
6074
|
break;
|
|
5959
6075
|
}
|
|
5960
|
-
|
|
6076
|
+
_context61.next = 8;
|
|
5961
6077
|
return this.getPaymentMethodsAsync();
|
|
5962
6078
|
case 8:
|
|
5963
|
-
paymentMethods =
|
|
6079
|
+
paymentMethods = _context61.sent;
|
|
5964
6080
|
paymentMethod = this.findCashPaymentMethod(paymentMethods, options.paymentMethodId);
|
|
5965
6081
|
case 10:
|
|
5966
6082
|
if (!(!paymentMethod && options.paymentMethodId !== undefined)) {
|
|
5967
|
-
|
|
6083
|
+
_context61.next = 12;
|
|
5968
6084
|
break;
|
|
5969
6085
|
}
|
|
5970
6086
|
throw new Error("\u672A\u627E\u5230\u53EF\u7528\u7684\u73B0\u91D1\u652F\u4ED8\u65B9\u5F0F\uFF1A".concat(options.paymentMethodId));
|
|
@@ -5972,9 +6088,9 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5972
6088
|
amountSnapshot = (_this$store$order24 = this.store.order) === null || _this$store$order24 === void 0 || (_this$store$order24$g = _this$store$order24.getOrderAmountSnapshot) === null || _this$store$order24$g === void 0 ? void 0 : _this$store$order24$g.call(_this$store$order24);
|
|
5973
6089
|
pendingWalletAmount = this.getPendingWalletPaymentAmount();
|
|
5974
6090
|
amountDue = Decimal.max(new Decimal((amountSnapshot === null || amountSnapshot === void 0 ? void 0 : amountSnapshot.amountGap) || 0).minus(pendingWalletAmount), 0).toDecimalPlaces(2).toNumber();
|
|
5975
|
-
currency = ((_this$store$order25 = this.store.order) === null || _this$store$order25 === void 0 || (_this$store$order25$g = _this$store$order25.getTempOrder) === null || _this$store$order25$g === void 0 || (_this$store$order25$g = _this$store$order25$g.call(_this$store$order25)) === null || _this$store$order25$g === void 0 ? void 0 : _this$store$order25$g.currency_code) || ((_this$
|
|
6091
|
+
currency = ((_this$store$order25 = this.store.order) === null || _this$store$order25 === void 0 || (_this$store$order25$g = _this$store$order25.getTempOrder) === null || _this$store$order25$g === void 0 || (_this$store$order25$g = _this$store$order25$g.call(_this$store$order25)) === null || _this$store$order25$g === void 0 ? void 0 : _this$store$order25$g.currency_code) || ((_this$otherParams39 = this.otherParams) === null || _this$otherParams39 === void 0 ? void 0 : _this$otherParams39.currency) || 'USD';
|
|
5976
6092
|
recommendedAmounts = amountDue > 0 ? this.store.payment.cash.getRecommendedAmount(amountDue, currency) : [];
|
|
5977
|
-
return
|
|
6093
|
+
return _context61.abrupt("return", {
|
|
5978
6094
|
available: Boolean(paymentMethod && amountDue > 0),
|
|
5979
6095
|
paymentMethod: paymentMethod,
|
|
5980
6096
|
amountDue: amountDue,
|
|
@@ -5982,9 +6098,9 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5982
6098
|
});
|
|
5983
6099
|
case 18:
|
|
5984
6100
|
case "end":
|
|
5985
|
-
return
|
|
6101
|
+
return _context61.stop();
|
|
5986
6102
|
}
|
|
5987
|
-
},
|
|
6103
|
+
}, _callee61, this);
|
|
5988
6104
|
}));
|
|
5989
6105
|
function getCashPaymentConfig() {
|
|
5990
6106
|
return _getCashPaymentConfig.apply(this, arguments);
|
|
@@ -6001,117 +6117,120 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
6001
6117
|
}, {
|
|
6002
6118
|
key: "confirmWalletPayment",
|
|
6003
6119
|
value: (function () {
|
|
6004
|
-
var _confirmWalletPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
6120
|
+
var _confirmWalletPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee62() {
|
|
6005
6121
|
var _this$store$order$get9, _this$store$order26, _this$store$order$get11, _this$store$order$get12, _this$store$order28;
|
|
6006
6122
|
var beforePayments, pendingWalletAmount, amountSnapshot, _this$store$order$get10, _this$store$order27, _submitResult, _latestAmountSnapshot, effectiveAmountDue, beforePaymentStatus, submitResult, restoredTempOrder, committed, walletState, latestAmountSnapshot;
|
|
6007
|
-
return _regeneratorRuntime().wrap(function
|
|
6008
|
-
while (1) switch (
|
|
6123
|
+
return _regeneratorRuntime().wrap(function _callee62$(_context62) {
|
|
6124
|
+
while (1) switch (_context62.prev = _context62.next) {
|
|
6009
6125
|
case 0:
|
|
6010
6126
|
if (this.store.order) {
|
|
6011
|
-
|
|
6127
|
+
_context62.next = 2;
|
|
6012
6128
|
break;
|
|
6013
6129
|
}
|
|
6014
6130
|
throw new Error('order 模块未初始化');
|
|
6015
6131
|
case 2:
|
|
6132
|
+
_context62.next = 4;
|
|
6133
|
+
return this.validateContactInfo();
|
|
6134
|
+
case 4:
|
|
6016
6135
|
beforePayments = cloneDeep(this.store.order.getOrderPayments());
|
|
6017
6136
|
pendingWalletAmount = this.getPendingWalletPaymentAmount(beforePayments);
|
|
6018
6137
|
amountSnapshot = (_this$store$order$get9 = (_this$store$order26 = this.store.order).getOrderAmountSnapshot) === null || _this$store$order$get9 === void 0 ? void 0 : _this$store$order$get9.call(_this$store$order26);
|
|
6019
6138
|
if (!pendingWalletAmount.lte(0)) {
|
|
6020
|
-
|
|
6139
|
+
_context62.next = 16;
|
|
6021
6140
|
break;
|
|
6022
6141
|
}
|
|
6023
6142
|
this.logWarning('confirmWalletPayment: 未发现待确认 Wallet 支付,跳过 Wallet 确认并按普通订单提交', {
|
|
6024
6143
|
amountGap: amountSnapshot === null || amountSnapshot === void 0 ? void 0 : amountSnapshot.amountGap
|
|
6025
6144
|
});
|
|
6026
|
-
|
|
6145
|
+
_context62.next = 11;
|
|
6027
6146
|
return this.submitSalesOrder({
|
|
6028
6147
|
smallTicketDataFlag: 1
|
|
6029
6148
|
});
|
|
6030
|
-
case
|
|
6031
|
-
_submitResult =
|
|
6149
|
+
case 11:
|
|
6150
|
+
_submitResult = _context62.sent;
|
|
6032
6151
|
if (!isRejectedSalesSubmitResult(_submitResult)) {
|
|
6033
|
-
|
|
6152
|
+
_context62.next = 14;
|
|
6034
6153
|
break;
|
|
6035
6154
|
}
|
|
6036
6155
|
throw new Error(getSalesSubmitErrorMessage(_submitResult, '订单提交失败'));
|
|
6037
|
-
case
|
|
6156
|
+
case 14:
|
|
6038
6157
|
_latestAmountSnapshot = (_this$store$order$get10 = (_this$store$order27 = this.store.order).getOrderAmountSnapshot) === null || _this$store$order$get10 === void 0 ? void 0 : _this$store$order$get10.call(_this$store$order27);
|
|
6039
|
-
return
|
|
6158
|
+
return _context62.abrupt("return", {
|
|
6040
6159
|
submitResult: _submitResult,
|
|
6041
6160
|
payments: this.store.order.getOrderPayments(),
|
|
6042
6161
|
isOrderFullyPaid: new Decimal((_latestAmountSnapshot === null || _latestAmountSnapshot === void 0 ? void 0 : _latestAmountSnapshot.amountGap) || 0).lte(0)
|
|
6043
6162
|
});
|
|
6044
|
-
case
|
|
6163
|
+
case 16:
|
|
6045
6164
|
effectiveAmountDue = Decimal.max(new Decimal((amountSnapshot === null || amountSnapshot === void 0 ? void 0 : amountSnapshot.amountGap) || 0).minus(pendingWalletAmount), 0);
|
|
6046
6165
|
if (!effectiveAmountDue.gt(0.01)) {
|
|
6047
|
-
|
|
6166
|
+
_context62.next = 19;
|
|
6048
6167
|
break;
|
|
6049
6168
|
}
|
|
6050
6169
|
throw new Error('Wallet 支付尚未覆盖全部待支付金额');
|
|
6051
|
-
case
|
|
6170
|
+
case 19:
|
|
6052
6171
|
beforePaymentStatus = (_this$store$order$get11 = this.store.order.getTempOrder()) === null || _this$store$order$get11 === void 0 ? void 0 : _this$store$order$get11.payment_status;
|
|
6053
|
-
|
|
6054
|
-
|
|
6172
|
+
_context62.prev = 20;
|
|
6173
|
+
_context62.next = 23;
|
|
6055
6174
|
return this.submitSalesOrder({
|
|
6056
6175
|
smallTicketDataFlag: 1,
|
|
6057
6176
|
confirmPendingVoucherPayments: true
|
|
6058
6177
|
});
|
|
6059
|
-
case
|
|
6060
|
-
submitResult =
|
|
6178
|
+
case 23:
|
|
6179
|
+
submitResult = _context62.sent;
|
|
6061
6180
|
if (!isRejectedSalesSubmitResult(submitResult)) {
|
|
6062
|
-
|
|
6181
|
+
_context62.next = 26;
|
|
6063
6182
|
break;
|
|
6064
6183
|
}
|
|
6065
6184
|
throw new Error(getSalesSubmitErrorMessage(submitResult, 'Wallet 支付确认失败'));
|
|
6066
|
-
case 24:
|
|
6067
|
-
_context58.next = 34;
|
|
6068
|
-
break;
|
|
6069
6185
|
case 26:
|
|
6070
|
-
|
|
6071
|
-
|
|
6186
|
+
_context62.next = 36;
|
|
6187
|
+
break;
|
|
6188
|
+
case 28:
|
|
6189
|
+
_context62.prev = 28;
|
|
6190
|
+
_context62.t0 = _context62["catch"](20);
|
|
6072
6191
|
this.store.order.setOrderPayments(beforePayments);
|
|
6073
6192
|
restoredTempOrder = this.store.order.getTempOrder();
|
|
6074
6193
|
if (restoredTempOrder && beforePaymentStatus !== undefined) {
|
|
6075
6194
|
restoredTempOrder.payment_status = beforePaymentStatus;
|
|
6076
6195
|
this.store.order.persistTempOrder();
|
|
6077
6196
|
}
|
|
6078
|
-
|
|
6197
|
+
_context62.next = 35;
|
|
6079
6198
|
return this.store.order.recalculateSummary({
|
|
6080
6199
|
createIfMissing: true
|
|
6081
6200
|
});
|
|
6082
|
-
case
|
|
6083
|
-
throw
|
|
6084
|
-
case
|
|
6201
|
+
case 35:
|
|
6202
|
+
throw _context62.t0;
|
|
6203
|
+
case 36:
|
|
6085
6204
|
if (!this.store.payment) {
|
|
6086
|
-
|
|
6205
|
+
_context62.next = 47;
|
|
6087
6206
|
break;
|
|
6088
6207
|
}
|
|
6089
|
-
|
|
6208
|
+
_context62.prev = 37;
|
|
6090
6209
|
committed = this.getCommittedWalletAssets();
|
|
6091
6210
|
walletState = this.store.payment.wallet.setCommittedWalletAssets(committed.ids, committed.assets);
|
|
6092
|
-
|
|
6211
|
+
_context62.next = 42;
|
|
6093
6212
|
return this.publishWalletAssetsState(walletState, 'local');
|
|
6094
|
-
case 40:
|
|
6095
|
-
_context58.next = 45;
|
|
6096
|
-
break;
|
|
6097
6213
|
case 42:
|
|
6098
|
-
|
|
6099
|
-
|
|
6214
|
+
_context62.next = 47;
|
|
6215
|
+
break;
|
|
6216
|
+
case 44:
|
|
6217
|
+
_context62.prev = 44;
|
|
6218
|
+
_context62.t1 = _context62["catch"](37);
|
|
6100
6219
|
this.logWarning('confirmWalletPayment: Wallet committed 状态同步失败', {
|
|
6101
|
-
error:
|
|
6220
|
+
error: _context62.t1 instanceof Error ? _context62.t1.message : String(_context62.t1)
|
|
6102
6221
|
});
|
|
6103
|
-
case
|
|
6222
|
+
case 47:
|
|
6104
6223
|
latestAmountSnapshot = (_this$store$order$get12 = (_this$store$order28 = this.store.order).getOrderAmountSnapshot) === null || _this$store$order$get12 === void 0 ? void 0 : _this$store$order$get12.call(_this$store$order28);
|
|
6105
|
-
return
|
|
6224
|
+
return _context62.abrupt("return", {
|
|
6106
6225
|
submitResult: submitResult,
|
|
6107
6226
|
payments: this.store.order.getOrderPayments(),
|
|
6108
6227
|
isOrderFullyPaid: new Decimal((latestAmountSnapshot === null || latestAmountSnapshot === void 0 ? void 0 : latestAmountSnapshot.amountGap) || 0).lte(0)
|
|
6109
6228
|
});
|
|
6110
|
-
case
|
|
6229
|
+
case 49:
|
|
6111
6230
|
case "end":
|
|
6112
|
-
return
|
|
6231
|
+
return _context62.stop();
|
|
6113
6232
|
}
|
|
6114
|
-
},
|
|
6233
|
+
}, _callee62, this, [[20, 28], [37, 44]]);
|
|
6115
6234
|
}));
|
|
6116
6235
|
function confirmWalletPayment() {
|
|
6117
6236
|
return _confirmWalletPayment.apply(this, arguments);
|
|
@@ -6126,87 +6245,90 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
6126
6245
|
}, {
|
|
6127
6246
|
key: "payCash",
|
|
6128
6247
|
value: (function () {
|
|
6129
|
-
var _payCash = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
6130
|
-
var _this$store$order$get13, _params$actualPaidAmo, _this$
|
|
6248
|
+
var _payCash = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee63(params) {
|
|
6249
|
+
var _this$store$order$get13, _params$actualPaidAmo, _this$otherParams40, _this$window, _this$window$postMess;
|
|
6131
6250
|
var amount, config, paymentMethod, roundingAmount, effectivePaymentAmount, beforePayments, beforePaymentStatus, uniquePaymentNumber, paymentTimestamp, actualPaidAmount, changeAmount, shopWalletPassId, payments, payment, syncResult, committed, walletState, restoredTempOrder;
|
|
6132
|
-
return _regeneratorRuntime().wrap(function
|
|
6133
|
-
while (1) switch (
|
|
6251
|
+
return _regeneratorRuntime().wrap(function _callee63$(_context63) {
|
|
6252
|
+
while (1) switch (_context63.prev = _context63.next) {
|
|
6134
6253
|
case 0:
|
|
6135
6254
|
if (this.store.order) {
|
|
6136
|
-
|
|
6255
|
+
_context63.next = 2;
|
|
6137
6256
|
break;
|
|
6138
6257
|
}
|
|
6139
6258
|
throw new Error('order 模块未初始化');
|
|
6140
6259
|
case 2:
|
|
6260
|
+
_context63.next = 4;
|
|
6261
|
+
return this.validateContactInfo();
|
|
6262
|
+
case 4:
|
|
6141
6263
|
amount = Number(params.amount || 0);
|
|
6142
6264
|
if (!(!Number.isFinite(amount) || amount <= 0)) {
|
|
6143
|
-
|
|
6265
|
+
_context63.next = 7;
|
|
6144
6266
|
break;
|
|
6145
6267
|
}
|
|
6146
6268
|
throw new Error('现金支付金额必须大于 0');
|
|
6147
|
-
case
|
|
6269
|
+
case 7:
|
|
6148
6270
|
if (!(params.paymentMethodId === undefined)) {
|
|
6149
|
-
|
|
6271
|
+
_context63.next = 13;
|
|
6150
6272
|
break;
|
|
6151
6273
|
}
|
|
6152
|
-
|
|
6274
|
+
_context63.next = 10;
|
|
6153
6275
|
return this.getCashPaymentConfig();
|
|
6154
|
-
case
|
|
6155
|
-
|
|
6156
|
-
|
|
6276
|
+
case 10:
|
|
6277
|
+
_context63.t0 = _context63.sent;
|
|
6278
|
+
_context63.next = 16;
|
|
6157
6279
|
break;
|
|
6158
|
-
case
|
|
6159
|
-
|
|
6280
|
+
case 13:
|
|
6281
|
+
_context63.next = 15;
|
|
6160
6282
|
return this.getCashPaymentConfig({
|
|
6161
6283
|
paymentMethodId: params.paymentMethodId
|
|
6162
6284
|
});
|
|
6163
|
-
case
|
|
6164
|
-
|
|
6165
|
-
case
|
|
6166
|
-
config =
|
|
6285
|
+
case 15:
|
|
6286
|
+
_context63.t0 = _context63.sent;
|
|
6287
|
+
case 16:
|
|
6288
|
+
config = _context63.t0;
|
|
6167
6289
|
paymentMethod = config.paymentMethod;
|
|
6168
6290
|
if (paymentMethod) {
|
|
6169
|
-
|
|
6291
|
+
_context63.next = 20;
|
|
6170
6292
|
break;
|
|
6171
6293
|
}
|
|
6172
6294
|
throw new Error('未找到可用的 CASHMANUAL 支付方式');
|
|
6173
|
-
case
|
|
6295
|
+
case 20:
|
|
6174
6296
|
if (!(config.amountDue <= 0)) {
|
|
6175
|
-
|
|
6297
|
+
_context63.next = 22;
|
|
6176
6298
|
break;
|
|
6177
6299
|
}
|
|
6178
6300
|
throw new Error('当前订单没有待支付金额');
|
|
6179
|
-
case
|
|
6301
|
+
case 22:
|
|
6180
6302
|
roundingAmount = Number(params.roundingAmount || 0);
|
|
6181
6303
|
effectivePaymentAmount = new Decimal(amount).minus(roundingAmount);
|
|
6182
6304
|
if (!effectivePaymentAmount.gt(new Decimal(config.amountDue).plus(0.01))) {
|
|
6183
|
-
|
|
6305
|
+
_context63.next = 26;
|
|
6184
6306
|
break;
|
|
6185
6307
|
}
|
|
6186
6308
|
throw new Error('现金支付金额超过当前待支付金额');
|
|
6187
|
-
case
|
|
6309
|
+
case 26:
|
|
6188
6310
|
beforePayments = cloneDeep(this.store.order.getOrderPayments());
|
|
6189
6311
|
beforePaymentStatus = (_this$store$order$get13 = this.store.order.getTempOrder()) === null || _this$store$order$get13 === void 0 ? void 0 : _this$store$order$get13.payment_status;
|
|
6190
6312
|
uniquePaymentNumber = createUuidV4();
|
|
6191
6313
|
paymentTimestamp = dayjs().format('YYYY-MM-DD HH:mm:ss');
|
|
6192
6314
|
actualPaidAmount = Number((_params$actualPaidAmo = params.actualPaidAmount) !== null && _params$actualPaidAmo !== void 0 ? _params$actualPaidAmo : amount);
|
|
6193
6315
|
changeAmount = Number(params.changeAmount || 0);
|
|
6194
|
-
shopWalletPassId = (_this$
|
|
6316
|
+
shopWalletPassId = (_this$otherParams40 = this.otherParams) === null || _this$otherParams40 === void 0 ? void 0 : _this$otherParams40.shop_wallet_pass_id;
|
|
6195
6317
|
if (!(!Number.isFinite(actualPaidAmount) || actualPaidAmount + 0.01 < amount)) {
|
|
6196
|
-
|
|
6318
|
+
_context63.next = 35;
|
|
6197
6319
|
break;
|
|
6198
6320
|
}
|
|
6199
6321
|
throw new Error('顾客实收现金不能小于支付金额');
|
|
6200
|
-
case
|
|
6322
|
+
case 35:
|
|
6201
6323
|
if (!this.isPickupTimingEnabled()) {
|
|
6202
|
-
|
|
6324
|
+
_context63.next = 38;
|
|
6203
6325
|
break;
|
|
6204
6326
|
}
|
|
6205
|
-
|
|
6327
|
+
_context63.next = 38;
|
|
6206
6328
|
return this.preparePickupTimingForCheckout({
|
|
6207
6329
|
freeze: true
|
|
6208
6330
|
});
|
|
6209
|
-
case
|
|
6331
|
+
case 38:
|
|
6210
6332
|
(_this$window = this.window) === null || _this$window === void 0 || (_this$window = _this$window.interaction) === null || _this$window === void 0 || (_this$window = _this$window.utils) === null || _this$window === void 0 || (_this$window$postMess = _this$window.postMessageToApp) === null || _this$window$postMess === void 0 || _this$window$postMess.call(_this$window, {
|
|
6211
6333
|
module: 'till',
|
|
6212
6334
|
key: 'open_till',
|
|
@@ -6237,57 +6359,57 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
6237
6359
|
var _item$metadata2;
|
|
6238
6360
|
return (item === null || item === void 0 || (_item$metadata2 = item.metadata) === null || _item$metadata2 === void 0 ? void 0 : _item$metadata2.unique_payment_number) === uniquePaymentNumber;
|
|
6239
6361
|
});
|
|
6240
|
-
|
|
6241
|
-
|
|
6362
|
+
_context63.prev = 41;
|
|
6363
|
+
_context63.next = 44;
|
|
6242
6364
|
return this.syncPaymentsToOrder({
|
|
6243
6365
|
payments: payments,
|
|
6244
6366
|
submitWhenPaid: true,
|
|
6245
6367
|
smallTicketDataFlag: 1,
|
|
6246
6368
|
confirmPendingVoucherPayments: true
|
|
6247
6369
|
});
|
|
6248
|
-
case
|
|
6249
|
-
syncResult =
|
|
6370
|
+
case 44:
|
|
6371
|
+
syncResult = _context63.sent;
|
|
6250
6372
|
if (!isRejectedSalesSubmitResult(syncResult.submitResult)) {
|
|
6251
|
-
|
|
6373
|
+
_context63.next = 47;
|
|
6252
6374
|
break;
|
|
6253
6375
|
}
|
|
6254
6376
|
throw new Error(getSalesSubmitErrorMessage(syncResult.submitResult, '订单提交失败'));
|
|
6255
|
-
case
|
|
6377
|
+
case 47:
|
|
6256
6378
|
if (!this.store.payment) {
|
|
6257
|
-
|
|
6379
|
+
_context63.next = 52;
|
|
6258
6380
|
break;
|
|
6259
6381
|
}
|
|
6260
6382
|
committed = this.getCommittedWalletAssets();
|
|
6261
6383
|
walletState = this.store.payment.wallet.setCommittedWalletAssets(committed.ids, committed.assets);
|
|
6262
|
-
|
|
6384
|
+
_context63.next = 52;
|
|
6263
6385
|
return this.publishWalletAssetsState(walletState, 'local');
|
|
6264
|
-
case
|
|
6265
|
-
return
|
|
6386
|
+
case 52:
|
|
6387
|
+
return _context63.abrupt("return", {
|
|
6266
6388
|
payment: payment || {},
|
|
6267
6389
|
payments: this.store.order.getOrderPayments(),
|
|
6268
6390
|
syncResult: syncResult,
|
|
6269
6391
|
isOrderFullyPaid: syncResult.isOrderFullyPaid
|
|
6270
6392
|
});
|
|
6271
|
-
case
|
|
6272
|
-
|
|
6273
|
-
|
|
6393
|
+
case 55:
|
|
6394
|
+
_context63.prev = 55;
|
|
6395
|
+
_context63.t1 = _context63["catch"](41);
|
|
6274
6396
|
this.store.order.setOrderPayments(beforePayments);
|
|
6275
6397
|
restoredTempOrder = this.store.order.getTempOrder();
|
|
6276
6398
|
if (restoredTempOrder && beforePaymentStatus !== undefined) {
|
|
6277
6399
|
restoredTempOrder.payment_status = beforePaymentStatus;
|
|
6278
6400
|
this.store.order.persistTempOrder();
|
|
6279
6401
|
}
|
|
6280
|
-
|
|
6402
|
+
_context63.next = 62;
|
|
6281
6403
|
return this.store.order.recalculateSummary({
|
|
6282
6404
|
createIfMissing: true
|
|
6283
6405
|
});
|
|
6284
|
-
case
|
|
6285
|
-
throw
|
|
6286
|
-
case
|
|
6406
|
+
case 62:
|
|
6407
|
+
throw _context63.t1;
|
|
6408
|
+
case 63:
|
|
6287
6409
|
case "end":
|
|
6288
|
-
return
|
|
6410
|
+
return _context63.stop();
|
|
6289
6411
|
}
|
|
6290
|
-
},
|
|
6412
|
+
}, _callee63, this, [[41, 55]]);
|
|
6291
6413
|
}));
|
|
6292
6414
|
function payCash(_x49) {
|
|
6293
6415
|
return _payCash.apply(this, arguments);
|
|
@@ -6305,21 +6427,21 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
6305
6427
|
}, {
|
|
6306
6428
|
key: "commitPaymentMethodPayment",
|
|
6307
6429
|
value: (function () {
|
|
6308
|
-
var _commitPaymentMethodPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
6430
|
+
var _commitPaymentMethodPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee64(params) {
|
|
6309
6431
|
var _this$store$order$get14, _this$store$order29, _this$store$order$get15, _params$metadata, _params$originAmount;
|
|
6310
6432
|
var amount, paymentMethods, findPaymentMethod, paymentMethod, amountSnapshot, pendingWalletAmount, amountDue, beforePayments, beforePaymentStatus, paymentTimestamp, metadata, serviceCharge, serviceFee, payments, payment, syncResult, committed, walletState, restoredTempOrder;
|
|
6311
|
-
return _regeneratorRuntime().wrap(function
|
|
6312
|
-
while (1) switch (
|
|
6433
|
+
return _regeneratorRuntime().wrap(function _callee64$(_context64) {
|
|
6434
|
+
while (1) switch (_context64.prev = _context64.next) {
|
|
6313
6435
|
case 0:
|
|
6314
6436
|
if (this.store.order) {
|
|
6315
|
-
|
|
6437
|
+
_context64.next = 2;
|
|
6316
6438
|
break;
|
|
6317
6439
|
}
|
|
6318
6440
|
throw new Error('order 模块未初始化');
|
|
6319
6441
|
case 2:
|
|
6320
6442
|
amount = Number(params.amount || 0);
|
|
6321
6443
|
if (!(!Number.isFinite(amount) || amount <= 0)) {
|
|
6322
|
-
|
|
6444
|
+
_context64.next = 5;
|
|
6323
6445
|
break;
|
|
6324
6446
|
}
|
|
6325
6447
|
throw new Error('支付金额必须大于 0');
|
|
@@ -6335,17 +6457,17 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
6335
6457
|
};
|
|
6336
6458
|
paymentMethod = findPaymentMethod();
|
|
6337
6459
|
if (paymentMethod) {
|
|
6338
|
-
|
|
6460
|
+
_context64.next = 13;
|
|
6339
6461
|
break;
|
|
6340
6462
|
}
|
|
6341
|
-
|
|
6463
|
+
_context64.next = 11;
|
|
6342
6464
|
return this.getPaymentMethodsAsync();
|
|
6343
6465
|
case 11:
|
|
6344
|
-
paymentMethods =
|
|
6466
|
+
paymentMethods = _context64.sent;
|
|
6345
6467
|
paymentMethod = findPaymentMethod();
|
|
6346
6468
|
case 13:
|
|
6347
6469
|
if (paymentMethod) {
|
|
6348
|
-
|
|
6470
|
+
_context64.next = 15;
|
|
6349
6471
|
break;
|
|
6350
6472
|
}
|
|
6351
6473
|
throw new Error("\u672A\u627E\u5230\u53EF\u7528\u7684\u652F\u4ED8\u65B9\u5F0F\uFF1A".concat(params.paymentMethodCode || params.paymentMethodId || ''));
|
|
@@ -6354,13 +6476,13 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
6354
6476
|
pendingWalletAmount = this.getPendingWalletPaymentAmount();
|
|
6355
6477
|
amountDue = Decimal.max(new Decimal((amountSnapshot === null || amountSnapshot === void 0 ? void 0 : amountSnapshot.amountGap) || 0).minus(pendingWalletAmount), 0);
|
|
6356
6478
|
if (!amountDue.lte(0)) {
|
|
6357
|
-
|
|
6479
|
+
_context64.next = 20;
|
|
6358
6480
|
break;
|
|
6359
6481
|
}
|
|
6360
6482
|
throw new Error('当前订单没有待支付金额');
|
|
6361
6483
|
case 20:
|
|
6362
6484
|
if (!new Decimal(amount).gt(amountDue.plus(0.01))) {
|
|
6363
|
-
|
|
6485
|
+
_context64.next = 22;
|
|
6364
6486
|
break;
|
|
6365
6487
|
}
|
|
6366
6488
|
throw new Error('支付金额超过当前待支付金额');
|
|
@@ -6399,8 +6521,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
6399
6521
|
var _item$metadata3;
|
|
6400
6522
|
return (item === null || item === void 0 || (_item$metadata3 = item.metadata) === null || _item$metadata3 === void 0 ? void 0 : _item$metadata3.unique_payment_number) === metadata.unique_payment_number;
|
|
6401
6523
|
});
|
|
6402
|
-
|
|
6403
|
-
|
|
6524
|
+
_context64.prev = 30;
|
|
6525
|
+
_context64.next = 33;
|
|
6404
6526
|
return this.syncPaymentsToOrder({
|
|
6405
6527
|
payments: payments,
|
|
6406
6528
|
submitWhenPaid: true,
|
|
@@ -6408,48 +6530,48 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
6408
6530
|
confirmPendingVoucherPayments: true
|
|
6409
6531
|
});
|
|
6410
6532
|
case 33:
|
|
6411
|
-
syncResult =
|
|
6533
|
+
syncResult = _context64.sent;
|
|
6412
6534
|
if (!isRejectedSalesSubmitResult(syncResult.submitResult)) {
|
|
6413
|
-
|
|
6535
|
+
_context64.next = 36;
|
|
6414
6536
|
break;
|
|
6415
6537
|
}
|
|
6416
6538
|
throw new Error(getSalesSubmitErrorMessage(syncResult.submitResult, '订单提交失败'));
|
|
6417
6539
|
case 36:
|
|
6418
6540
|
if (!this.store.payment) {
|
|
6419
|
-
|
|
6541
|
+
_context64.next = 41;
|
|
6420
6542
|
break;
|
|
6421
6543
|
}
|
|
6422
6544
|
committed = this.getCommittedWalletAssets();
|
|
6423
6545
|
walletState = this.store.payment.wallet.setCommittedWalletAssets(committed.ids, committed.assets);
|
|
6424
|
-
|
|
6546
|
+
_context64.next = 41;
|
|
6425
6547
|
return this.publishWalletAssetsState(walletState, 'local');
|
|
6426
6548
|
case 41:
|
|
6427
|
-
return
|
|
6549
|
+
return _context64.abrupt("return", {
|
|
6428
6550
|
payment: payment || {},
|
|
6429
6551
|
payments: this.store.order.getOrderPayments(),
|
|
6430
6552
|
syncResult: syncResult,
|
|
6431
6553
|
isOrderFullyPaid: syncResult.isOrderFullyPaid
|
|
6432
6554
|
});
|
|
6433
6555
|
case 44:
|
|
6434
|
-
|
|
6435
|
-
|
|
6556
|
+
_context64.prev = 44;
|
|
6557
|
+
_context64.t0 = _context64["catch"](30);
|
|
6436
6558
|
this.store.order.setOrderPayments(beforePayments);
|
|
6437
6559
|
restoredTempOrder = this.store.order.getTempOrder();
|
|
6438
6560
|
if (restoredTempOrder && beforePaymentStatus !== undefined) {
|
|
6439
6561
|
restoredTempOrder.payment_status = beforePaymentStatus;
|
|
6440
6562
|
this.store.order.persistTempOrder();
|
|
6441
6563
|
}
|
|
6442
|
-
|
|
6564
|
+
_context64.next = 51;
|
|
6443
6565
|
return this.store.order.recalculateSummary({
|
|
6444
6566
|
createIfMissing: true
|
|
6445
6567
|
});
|
|
6446
6568
|
case 51:
|
|
6447
|
-
throw
|
|
6569
|
+
throw _context64.t0;
|
|
6448
6570
|
case 52:
|
|
6449
6571
|
case "end":
|
|
6450
|
-
return
|
|
6572
|
+
return _context64.stop();
|
|
6451
6573
|
}
|
|
6452
|
-
},
|
|
6574
|
+
}, _callee64, this, [[30, 44]]);
|
|
6453
6575
|
}));
|
|
6454
6576
|
function commitPaymentMethodPayment(_x50) {
|
|
6455
6577
|
return _commitPaymentMethodPayment.apply(this, arguments);
|
|
@@ -6466,38 +6588,38 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
6466
6588
|
}, {
|
|
6467
6589
|
key: "roundAmount",
|
|
6468
6590
|
value: (function () {
|
|
6469
|
-
var _roundAmount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
6591
|
+
var _roundAmount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee65(params) {
|
|
6470
6592
|
var _cashManualPayment$me, _this$otherParams$ord2, _this$otherParams$ord3;
|
|
6471
6593
|
var amount, cashManualPayment;
|
|
6472
|
-
return _regeneratorRuntime().wrap(function
|
|
6473
|
-
while (1) switch (
|
|
6594
|
+
return _regeneratorRuntime().wrap(function _callee65$(_context65) {
|
|
6595
|
+
while (1) switch (_context65.prev = _context65.next) {
|
|
6474
6596
|
case 0:
|
|
6475
6597
|
amount = params.amount;
|
|
6476
6598
|
cashManualPayment = this.paymentMethodsCache.find(function (paymentMethod) {
|
|
6477
6599
|
return paymentMethod.code === 'CASHMANUAL';
|
|
6478
6600
|
});
|
|
6479
6601
|
if (cashManualPayment !== null && cashManualPayment !== void 0 && (_cashManualPayment$me = cashManualPayment.metadata) !== null && _cashManualPayment$me !== void 0 && _cashManualPayment$me.order_rounding_switch) {
|
|
6480
|
-
|
|
6602
|
+
_context65.next = 4;
|
|
6481
6603
|
break;
|
|
6482
6604
|
}
|
|
6483
|
-
return
|
|
6605
|
+
return _context65.abrupt("return", {
|
|
6484
6606
|
originalAmount: amount.toString(),
|
|
6485
6607
|
roundedAmount: amount.toString(),
|
|
6486
6608
|
roundingDifference: '0.00'
|
|
6487
6609
|
});
|
|
6488
6610
|
case 4:
|
|
6489
6611
|
if (this.payment) {
|
|
6490
|
-
|
|
6612
|
+
_context65.next = 6;
|
|
6491
6613
|
break;
|
|
6492
6614
|
}
|
|
6493
6615
|
throw new Error('payment 模块未初始化');
|
|
6494
6616
|
case 6:
|
|
6495
|
-
return
|
|
6617
|
+
return _context65.abrupt("return", this.payment.roundAmountAsync(amount, (_this$otherParams$ord2 = this.otherParams.order_rounding_setting) === null || _this$otherParams$ord2 === void 0 ? void 0 : _this$otherParams$ord2.interval, (_this$otherParams$ord3 = this.otherParams.order_rounding_setting) === null || _this$otherParams$ord3 === void 0 ? void 0 : _this$otherParams$ord3.type));
|
|
6496
6618
|
case 7:
|
|
6497
6619
|
case "end":
|
|
6498
|
-
return
|
|
6620
|
+
return _context65.stop();
|
|
6499
6621
|
}
|
|
6500
|
-
},
|
|
6622
|
+
}, _callee65, this);
|
|
6501
6623
|
}));
|
|
6502
6624
|
function roundAmount(_x51) {
|
|
6503
6625
|
return _roundAmount.apply(this, arguments);
|
|
@@ -6514,47 +6636,47 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
6514
6636
|
}, {
|
|
6515
6637
|
key: "sendCustomerPayLink",
|
|
6516
6638
|
value: (function () {
|
|
6517
|
-
var _sendCustomerPayLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
6639
|
+
var _sendCustomerPayLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee66(params) {
|
|
6518
6640
|
var orderIds, _ref54, _ref55, _submitResult$data$or, _submitResult$data, _submitResult$data2, submitResult, orderId;
|
|
6519
|
-
return _regeneratorRuntime().wrap(function
|
|
6520
|
-
while (1) switch (
|
|
6641
|
+
return _regeneratorRuntime().wrap(function _callee66$(_context66) {
|
|
6642
|
+
while (1) switch (_context66.prev = _context66.next) {
|
|
6521
6643
|
case 0:
|
|
6522
6644
|
if (this.store.order) {
|
|
6523
|
-
|
|
6645
|
+
_context66.next = 2;
|
|
6524
6646
|
break;
|
|
6525
6647
|
}
|
|
6526
6648
|
throw new Error('order 模块未初始化');
|
|
6527
6649
|
case 2:
|
|
6528
6650
|
orderIds = params.order_ids || params.orderIds || [];
|
|
6529
6651
|
if (!(!orderIds.length || params.submitBeforeSend)) {
|
|
6530
|
-
|
|
6652
|
+
_context66.next = 11;
|
|
6531
6653
|
break;
|
|
6532
6654
|
}
|
|
6533
|
-
|
|
6655
|
+
_context66.next = 6;
|
|
6534
6656
|
return this.submitSalesOrder({
|
|
6535
6657
|
smallTicketDataFlag: 1
|
|
6536
6658
|
});
|
|
6537
6659
|
case 6:
|
|
6538
|
-
submitResult =
|
|
6660
|
+
submitResult = _context66.sent;
|
|
6539
6661
|
orderId = (_ref54 = (_ref55 = (_submitResult$data$or = submitResult === null || submitResult === void 0 || (_submitResult$data = submitResult.data) === null || _submitResult$data === void 0 ? void 0 : _submitResult$data.order_id) !== null && _submitResult$data$or !== void 0 ? _submitResult$data$or : submitResult === null || submitResult === void 0 ? void 0 : submitResult.order_id) !== null && _ref55 !== void 0 ? _ref55 : submitResult === null || submitResult === void 0 || (_submitResult$data2 = submitResult.data) === null || _submitResult$data2 === void 0 ? void 0 : _submitResult$data2.id) !== null && _ref54 !== void 0 ? _ref54 : submitResult === null || submitResult === void 0 ? void 0 : submitResult.id;
|
|
6540
6662
|
if (orderId) {
|
|
6541
|
-
|
|
6663
|
+
_context66.next = 10;
|
|
6542
6664
|
break;
|
|
6543
6665
|
}
|
|
6544
6666
|
throw new Error('本地订单提交云端失败,无法发送支付链接');
|
|
6545
6667
|
case 10:
|
|
6546
6668
|
orderIds = [orderId];
|
|
6547
6669
|
case 11:
|
|
6548
|
-
return
|
|
6670
|
+
return _context66.abrupt("return", this.store.order.sendCustomerPayLink({
|
|
6549
6671
|
emails: params.emails,
|
|
6550
6672
|
notify_action: params.notify_action,
|
|
6551
6673
|
order_ids: orderIds
|
|
6552
6674
|
}));
|
|
6553
6675
|
case 12:
|
|
6554
6676
|
case "end":
|
|
6555
|
-
return
|
|
6677
|
+
return _context66.stop();
|
|
6556
6678
|
}
|
|
6557
|
-
},
|
|
6679
|
+
}, _callee66, this);
|
|
6558
6680
|
}));
|
|
6559
6681
|
function sendCustomerPayLink(_x52) {
|
|
6560
6682
|
return _sendCustomerPayLink.apply(this, arguments);
|
|
@@ -6569,20 +6691,20 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
6569
6691
|
}, {
|
|
6570
6692
|
key: "calculateProductBookingPrice",
|
|
6571
6693
|
value: function () {
|
|
6572
|
-
var _calculateProductBookingPrice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
6694
|
+
var _calculateProductBookingPrice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee67(params) {
|
|
6573
6695
|
var _params$customer_id;
|
|
6574
6696
|
var useCustomerUserPricing, quotation, customerId, channel, _yield$this$resolvePr, _yield$this$resolvePr2, authoritativeProduct, product;
|
|
6575
|
-
return _regeneratorRuntime().wrap(function
|
|
6576
|
-
while (1) switch (
|
|
6697
|
+
return _regeneratorRuntime().wrap(function _callee67$(_context67) {
|
|
6698
|
+
while (1) switch (_context67.prev = _context67.next) {
|
|
6577
6699
|
case 0:
|
|
6578
6700
|
useCustomerUserPricing = this.isCustomerUserPriceQuery();
|
|
6579
6701
|
quotation = useCustomerUserPricing ? undefined : this.store.quotation;
|
|
6580
6702
|
customerId = (_params$customer_id = params.customer_id) !== null && _params$customer_id !== void 0 ? _params$customer_id : this.getCurrentOrderCustomerId();
|
|
6581
|
-
|
|
6703
|
+
_context67.next = 5;
|
|
6582
6704
|
return this.prepareProductPriceQueryContext(customerId);
|
|
6583
6705
|
case 5:
|
|
6584
6706
|
channel = this.getPriceQueryChannel(params.channel);
|
|
6585
|
-
|
|
6707
|
+
_context67.next = 8;
|
|
6586
6708
|
return this.resolveProductsForPriceQuery({
|
|
6587
6709
|
priceQueries: [params],
|
|
6588
6710
|
schedule: this.getPriceQuerySchedule(params),
|
|
@@ -6590,22 +6712,22 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
6590
6712
|
channel: channel
|
|
6591
6713
|
});
|
|
6592
6714
|
case 8:
|
|
6593
|
-
_yield$this$resolvePr =
|
|
6715
|
+
_yield$this$resolvePr = _context67.sent;
|
|
6594
6716
|
_yield$this$resolvePr2 = _slicedToArray(_yield$this$resolvePr, 1);
|
|
6595
6717
|
authoritativeProduct = _yield$this$resolvePr2[0];
|
|
6596
6718
|
product = this.mergeProductForPriceQuery(params.product, authoritativeProduct);
|
|
6597
6719
|
if (useCustomerUserPricing) {
|
|
6598
|
-
|
|
6720
|
+
_context67.next = 15;
|
|
6599
6721
|
break;
|
|
6600
6722
|
}
|
|
6601
|
-
|
|
6723
|
+
_context67.next = 15;
|
|
6602
6724
|
return this.loadQuotationForPriceQuery({
|
|
6603
6725
|
quotation: quotation,
|
|
6604
6726
|
customer_id: customerId,
|
|
6605
6727
|
channel: channel
|
|
6606
6728
|
});
|
|
6607
6729
|
case 15:
|
|
6608
|
-
return
|
|
6730
|
+
return _context67.abrupt("return", calculateBaseSalesProductBookingPrice(_objectSpread(_objectSpread({}, params), {}, {
|
|
6609
6731
|
channel: channel,
|
|
6610
6732
|
product: product,
|
|
6611
6733
|
fallback_price: authoritativeProduct ? undefined : params.fallback_price,
|
|
@@ -6614,9 +6736,9 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
6614
6736
|
})));
|
|
6615
6737
|
case 16:
|
|
6616
6738
|
case "end":
|
|
6617
|
-
return
|
|
6739
|
+
return _context67.stop();
|
|
6618
6740
|
}
|
|
6619
|
-
},
|
|
6741
|
+
}, _callee67, this);
|
|
6620
6742
|
}));
|
|
6621
6743
|
function calculateProductBookingPrice(_x53) {
|
|
6622
6744
|
return _calculateProductBookingPrice.apply(this, arguments);
|
|
@@ -6702,17 +6824,17 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
6702
6824
|
}, {
|
|
6703
6825
|
key: "calculateProductBookingPrices",
|
|
6704
6826
|
value: function () {
|
|
6705
|
-
var _calculateProductBookingPrices = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
6827
|
+
var _calculateProductBookingPrices = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee69(paramsList) {
|
|
6706
6828
|
var _this22 = this;
|
|
6707
6829
|
var useCustomerUserPricing, quotation, currentOrderCustomerId, resolvedChannels, authoritativeProducts, groups, quotationContexts;
|
|
6708
|
-
return _regeneratorRuntime().wrap(function
|
|
6709
|
-
while (1) switch (
|
|
6830
|
+
return _regeneratorRuntime().wrap(function _callee69$(_context69) {
|
|
6831
|
+
while (1) switch (_context69.prev = _context69.next) {
|
|
6710
6832
|
case 0:
|
|
6711
6833
|
if (paramsList.length) {
|
|
6712
|
-
|
|
6834
|
+
_context69.next = 2;
|
|
6713
6835
|
break;
|
|
6714
6836
|
}
|
|
6715
|
-
return
|
|
6837
|
+
return _context69.abrupt("return", []);
|
|
6716
6838
|
case 2:
|
|
6717
6839
|
useCustomerUserPricing = this.isCustomerUserPriceQuery();
|
|
6718
6840
|
quotation = useCustomerUserPricing ? undefined : this.store.quotation;
|
|
@@ -6739,20 +6861,20 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
6739
6861
|
group.indices.push(index);
|
|
6740
6862
|
groups.set(groupKey, group);
|
|
6741
6863
|
});
|
|
6742
|
-
|
|
6864
|
+
_context69.next = 11;
|
|
6743
6865
|
return Promise.all(Array.from(groups.values()).map( /*#__PURE__*/function () {
|
|
6744
|
-
var _ref56 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
6866
|
+
var _ref56 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee68(group) {
|
|
6745
6867
|
var priceQueries, resolvedProducts;
|
|
6746
|
-
return _regeneratorRuntime().wrap(function
|
|
6747
|
-
while (1) switch (
|
|
6868
|
+
return _regeneratorRuntime().wrap(function _callee68$(_context68) {
|
|
6869
|
+
while (1) switch (_context68.prev = _context68.next) {
|
|
6748
6870
|
case 0:
|
|
6749
|
-
|
|
6871
|
+
_context68.next = 2;
|
|
6750
6872
|
return _this22.prepareProductPriceQueryContext(group.customerId);
|
|
6751
6873
|
case 2:
|
|
6752
6874
|
priceQueries = group.indices.map(function (index) {
|
|
6753
6875
|
return paramsList[index];
|
|
6754
6876
|
});
|
|
6755
|
-
|
|
6877
|
+
_context68.next = 5;
|
|
6756
6878
|
return _this22.resolveProductsForPriceQuery({
|
|
6757
6879
|
priceQueries: priceQueries,
|
|
6758
6880
|
schedule: group.schedule,
|
|
@@ -6760,15 +6882,15 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
6760
6882
|
channel: group.channel
|
|
6761
6883
|
});
|
|
6762
6884
|
case 5:
|
|
6763
|
-
resolvedProducts =
|
|
6885
|
+
resolvedProducts = _context68.sent;
|
|
6764
6886
|
group.indices.forEach(function (originalIndex, groupIndex) {
|
|
6765
6887
|
authoritativeProducts[originalIndex] = resolvedProducts[groupIndex] || null;
|
|
6766
6888
|
});
|
|
6767
6889
|
case 7:
|
|
6768
6890
|
case "end":
|
|
6769
|
-
return
|
|
6891
|
+
return _context68.stop();
|
|
6770
6892
|
}
|
|
6771
|
-
},
|
|
6893
|
+
}, _callee68);
|
|
6772
6894
|
}));
|
|
6773
6895
|
return function (_x55) {
|
|
6774
6896
|
return _ref56.apply(this, arguments);
|
|
@@ -6776,7 +6898,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
6776
6898
|
}()));
|
|
6777
6899
|
case 11:
|
|
6778
6900
|
if (useCustomerUserPricing) {
|
|
6779
|
-
|
|
6901
|
+
_context69.next = 16;
|
|
6780
6902
|
break;
|
|
6781
6903
|
}
|
|
6782
6904
|
quotationContexts = new Map();
|
|
@@ -6790,14 +6912,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
6790
6912
|
customer_id: (_params$customer_id3 = params.customer_id) !== null && _params$customer_id3 !== void 0 ? _params$customer_id3 : currentOrderCustomerId
|
|
6791
6913
|
});
|
|
6792
6914
|
});
|
|
6793
|
-
|
|
6915
|
+
_context69.next = 16;
|
|
6794
6916
|
return Promise.all(Array.from(quotationContexts.values()).map(function (context) {
|
|
6795
6917
|
return _this22.loadQuotationForPriceQuery(_objectSpread({
|
|
6796
6918
|
quotation: quotation
|
|
6797
6919
|
}, context));
|
|
6798
6920
|
}));
|
|
6799
6921
|
case 16:
|
|
6800
|
-
return
|
|
6922
|
+
return _context69.abrupt("return", paramsList.map(function (params, index) {
|
|
6801
6923
|
var _params$customer_id4;
|
|
6802
6924
|
var productInput = params.product || {};
|
|
6803
6925
|
var authoritativeProduct = authoritativeProducts[index];
|
|
@@ -6814,9 +6936,9 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
6814
6936
|
}));
|
|
6815
6937
|
case 17:
|
|
6816
6938
|
case "end":
|
|
6817
|
-
return
|
|
6939
|
+
return _context69.stop();
|
|
6818
6940
|
}
|
|
6819
|
-
},
|
|
6941
|
+
}, _callee69, this);
|
|
6820
6942
|
}));
|
|
6821
6943
|
function calculateProductBookingPrices(_x54) {
|
|
6822
6944
|
return _calculateProductBookingPrices.apply(this, arguments);
|
|
@@ -6838,45 +6960,45 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
6838
6960
|
}, {
|
|
6839
6961
|
key: "addProductToOrder",
|
|
6840
6962
|
value: function () {
|
|
6841
|
-
var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
6963
|
+
var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee70(product, booking, options) {
|
|
6842
6964
|
var products;
|
|
6843
|
-
return _regeneratorRuntime().wrap(function
|
|
6844
|
-
while (1) switch (
|
|
6965
|
+
return _regeneratorRuntime().wrap(function _callee70$(_context70) {
|
|
6966
|
+
while (1) switch (_context70.prev = _context70.next) {
|
|
6845
6967
|
case 0:
|
|
6846
|
-
|
|
6968
|
+
_context70.prev = 0;
|
|
6847
6969
|
if (this.store.order) {
|
|
6848
|
-
|
|
6970
|
+
_context70.next = 3;
|
|
6849
6971
|
break;
|
|
6850
6972
|
}
|
|
6851
6973
|
throw new Error('order 模块未初始化');
|
|
6852
6974
|
case 3:
|
|
6853
6975
|
if (!(options === undefined)) {
|
|
6854
|
-
|
|
6976
|
+
_context70.next = 9;
|
|
6855
6977
|
break;
|
|
6856
6978
|
}
|
|
6857
|
-
|
|
6979
|
+
_context70.next = 6;
|
|
6858
6980
|
return this.store.order.addProductToOrder(product, booking);
|
|
6859
6981
|
case 6:
|
|
6860
|
-
|
|
6861
|
-
|
|
6982
|
+
_context70.t0 = _context70.sent;
|
|
6983
|
+
_context70.next = 12;
|
|
6862
6984
|
break;
|
|
6863
6985
|
case 9:
|
|
6864
|
-
|
|
6986
|
+
_context70.next = 11;
|
|
6865
6987
|
return this.store.order.addProductToOrder(product, booking, options);
|
|
6866
6988
|
case 11:
|
|
6867
|
-
|
|
6989
|
+
_context70.t0 = _context70.sent;
|
|
6868
6990
|
case 12:
|
|
6869
|
-
products =
|
|
6870
|
-
return
|
|
6991
|
+
products = _context70.t0;
|
|
6992
|
+
return _context70.abrupt("return", products);
|
|
6871
6993
|
case 16:
|
|
6872
|
-
|
|
6873
|
-
|
|
6874
|
-
throw
|
|
6994
|
+
_context70.prev = 16;
|
|
6995
|
+
_context70.t1 = _context70["catch"](0);
|
|
6996
|
+
throw _context70.t1;
|
|
6875
6997
|
case 19:
|
|
6876
6998
|
case "end":
|
|
6877
|
-
return
|
|
6999
|
+
return _context70.stop();
|
|
6878
7000
|
}
|
|
6879
|
-
},
|
|
7001
|
+
}, _callee70, this, [[0, 16]]);
|
|
6880
7002
|
}));
|
|
6881
7003
|
function addProductToOrder(_x56, _x57, _x58) {
|
|
6882
7004
|
return _addProductToOrder.apply(this, arguments);
|
|
@@ -6886,32 +7008,32 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
6886
7008
|
}, {
|
|
6887
7009
|
key: "updateOrderProduct",
|
|
6888
7010
|
value: function () {
|
|
6889
|
-
var _updateOrderProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
7011
|
+
var _updateOrderProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee71(params) {
|
|
6890
7012
|
var products;
|
|
6891
|
-
return _regeneratorRuntime().wrap(function
|
|
6892
|
-
while (1) switch (
|
|
7013
|
+
return _regeneratorRuntime().wrap(function _callee71$(_context71) {
|
|
7014
|
+
while (1) switch (_context71.prev = _context71.next) {
|
|
6893
7015
|
case 0:
|
|
6894
|
-
|
|
7016
|
+
_context71.prev = 0;
|
|
6895
7017
|
if (this.store.order) {
|
|
6896
|
-
|
|
7018
|
+
_context71.next = 3;
|
|
6897
7019
|
break;
|
|
6898
7020
|
}
|
|
6899
7021
|
throw new Error('order 模块未初始化');
|
|
6900
7022
|
case 3:
|
|
6901
|
-
|
|
7023
|
+
_context71.next = 5;
|
|
6902
7024
|
return this.store.order.updateOrderProduct(params);
|
|
6903
7025
|
case 5:
|
|
6904
|
-
products =
|
|
6905
|
-
return
|
|
7026
|
+
products = _context71.sent;
|
|
7027
|
+
return _context71.abrupt("return", products);
|
|
6906
7028
|
case 9:
|
|
6907
|
-
|
|
6908
|
-
|
|
6909
|
-
throw
|
|
7029
|
+
_context71.prev = 9;
|
|
7030
|
+
_context71.t0 = _context71["catch"](0);
|
|
7031
|
+
throw _context71.t0;
|
|
6910
7032
|
case 12:
|
|
6911
7033
|
case "end":
|
|
6912
|
-
return
|
|
7034
|
+
return _context71.stop();
|
|
6913
7035
|
}
|
|
6914
|
-
},
|
|
7036
|
+
}, _callee71, this, [[0, 9]]);
|
|
6915
7037
|
}));
|
|
6916
7038
|
function updateOrderProduct(_x59) {
|
|
6917
7039
|
return _updateOrderProduct.apply(this, arguments);
|
|
@@ -6921,32 +7043,32 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
6921
7043
|
}, {
|
|
6922
7044
|
key: "updateOrderProducts",
|
|
6923
7045
|
value: function () {
|
|
6924
|
-
var _updateOrderProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
7046
|
+
var _updateOrderProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee72(paramsList) {
|
|
6925
7047
|
var products;
|
|
6926
|
-
return _regeneratorRuntime().wrap(function
|
|
6927
|
-
while (1) switch (
|
|
7048
|
+
return _regeneratorRuntime().wrap(function _callee72$(_context72) {
|
|
7049
|
+
while (1) switch (_context72.prev = _context72.next) {
|
|
6928
7050
|
case 0:
|
|
6929
|
-
|
|
7051
|
+
_context72.prev = 0;
|
|
6930
7052
|
if (this.store.order) {
|
|
6931
|
-
|
|
7053
|
+
_context72.next = 3;
|
|
6932
7054
|
break;
|
|
6933
7055
|
}
|
|
6934
7056
|
throw new Error('order 模块未初始化');
|
|
6935
7057
|
case 3:
|
|
6936
|
-
|
|
7058
|
+
_context72.next = 5;
|
|
6937
7059
|
return this.store.order.updateOrderProducts(paramsList);
|
|
6938
7060
|
case 5:
|
|
6939
|
-
products =
|
|
6940
|
-
return
|
|
7061
|
+
products = _context72.sent;
|
|
7062
|
+
return _context72.abrupt("return", products);
|
|
6941
7063
|
case 9:
|
|
6942
|
-
|
|
6943
|
-
|
|
6944
|
-
throw
|
|
7064
|
+
_context72.prev = 9;
|
|
7065
|
+
_context72.t0 = _context72["catch"](0);
|
|
7066
|
+
throw _context72.t0;
|
|
6945
7067
|
case 12:
|
|
6946
7068
|
case "end":
|
|
6947
|
-
return
|
|
7069
|
+
return _context72.stop();
|
|
6948
7070
|
}
|
|
6949
|
-
},
|
|
7071
|
+
}, _callee72, this, [[0, 9]]);
|
|
6950
7072
|
}));
|
|
6951
7073
|
function updateOrderProducts(_x60) {
|
|
6952
7074
|
return _updateOrderProducts.apply(this, arguments);
|
|
@@ -6956,32 +7078,32 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
6956
7078
|
}, {
|
|
6957
7079
|
key: "updateOrderProductQuantity",
|
|
6958
7080
|
value: function () {
|
|
6959
|
-
var _updateOrderProductQuantity = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
7081
|
+
var _updateOrderProductQuantity = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee73(params) {
|
|
6960
7082
|
var products;
|
|
6961
|
-
return _regeneratorRuntime().wrap(function
|
|
6962
|
-
while (1) switch (
|
|
7083
|
+
return _regeneratorRuntime().wrap(function _callee73$(_context73) {
|
|
7084
|
+
while (1) switch (_context73.prev = _context73.next) {
|
|
6963
7085
|
case 0:
|
|
6964
|
-
|
|
7086
|
+
_context73.prev = 0;
|
|
6965
7087
|
if (this.store.order) {
|
|
6966
|
-
|
|
7088
|
+
_context73.next = 3;
|
|
6967
7089
|
break;
|
|
6968
7090
|
}
|
|
6969
7091
|
throw new Error('order 模块未初始化');
|
|
6970
7092
|
case 3:
|
|
6971
|
-
|
|
7093
|
+
_context73.next = 5;
|
|
6972
7094
|
return this.store.order.updateOrderProductQuantity(params);
|
|
6973
7095
|
case 5:
|
|
6974
|
-
products =
|
|
6975
|
-
return
|
|
7096
|
+
products = _context73.sent;
|
|
7097
|
+
return _context73.abrupt("return", products);
|
|
6976
7098
|
case 9:
|
|
6977
|
-
|
|
6978
|
-
|
|
6979
|
-
throw
|
|
7099
|
+
_context73.prev = 9;
|
|
7100
|
+
_context73.t0 = _context73["catch"](0);
|
|
7101
|
+
throw _context73.t0;
|
|
6980
7102
|
case 12:
|
|
6981
7103
|
case "end":
|
|
6982
|
-
return
|
|
7104
|
+
return _context73.stop();
|
|
6983
7105
|
}
|
|
6984
|
-
},
|
|
7106
|
+
}, _callee73, this, [[0, 9]]);
|
|
6985
7107
|
}));
|
|
6986
7108
|
function updateOrderProductQuantity(_x61) {
|
|
6987
7109
|
return _updateOrderProductQuantity.apply(this, arguments);
|
|
@@ -7006,12 +7128,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
7006
7128
|
}, {
|
|
7007
7129
|
key: "setOrderProductLineNote",
|
|
7008
7130
|
value: (function () {
|
|
7009
|
-
var _setOrderProductLineNote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
7131
|
+
var _setOrderProductLineNote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee74(identity, note) {
|
|
7010
7132
|
var params, products;
|
|
7011
|
-
return _regeneratorRuntime().wrap(function
|
|
7012
|
-
while (1) switch (
|
|
7133
|
+
return _regeneratorRuntime().wrap(function _callee74$(_context74) {
|
|
7134
|
+
while (1) switch (_context74.prev = _context74.next) {
|
|
7013
7135
|
case 0:
|
|
7014
|
-
|
|
7136
|
+
_context74.prev = 0;
|
|
7015
7137
|
params = {
|
|
7016
7138
|
product_id: identity.product_id,
|
|
7017
7139
|
product_variant_id: identity.product_variant_id,
|
|
@@ -7026,20 +7148,20 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
7026
7148
|
params.product_sku = identity.product_sku;
|
|
7027
7149
|
}
|
|
7028
7150
|
if (identity.product_bundle !== undefined) params.product_bundle = identity.product_bundle;
|
|
7029
|
-
|
|
7151
|
+
_context74.next = 7;
|
|
7030
7152
|
return this.updateOrderProduct(params);
|
|
7031
7153
|
case 7:
|
|
7032
|
-
products =
|
|
7033
|
-
return
|
|
7154
|
+
products = _context74.sent;
|
|
7155
|
+
return _context74.abrupt("return", products);
|
|
7034
7156
|
case 11:
|
|
7035
|
-
|
|
7036
|
-
|
|
7037
|
-
throw
|
|
7157
|
+
_context74.prev = 11;
|
|
7158
|
+
_context74.t0 = _context74["catch"](0);
|
|
7159
|
+
throw _context74.t0;
|
|
7038
7160
|
case 14:
|
|
7039
7161
|
case "end":
|
|
7040
|
-
return
|
|
7162
|
+
return _context74.stop();
|
|
7041
7163
|
}
|
|
7042
|
-
},
|
|
7164
|
+
}, _callee74, this, [[0, 11]]);
|
|
7043
7165
|
}));
|
|
7044
7166
|
function setOrderProductLineNote(_x62, _x63) {
|
|
7045
7167
|
return _setOrderProductLineNote.apply(this, arguments);
|
|
@@ -7056,43 +7178,43 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
7056
7178
|
}, {
|
|
7057
7179
|
key: "removeProductsFromOrder",
|
|
7058
7180
|
value: (function () {
|
|
7059
|
-
var _removeProductsFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
7060
|
-
return _regeneratorRuntime().wrap(function
|
|
7061
|
-
while (1) switch (
|
|
7181
|
+
var _removeProductsFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee75(identities, options) {
|
|
7182
|
+
return _regeneratorRuntime().wrap(function _callee75$(_context75) {
|
|
7183
|
+
while (1) switch (_context75.prev = _context75.next) {
|
|
7062
7184
|
case 0:
|
|
7063
|
-
|
|
7185
|
+
_context75.prev = 0;
|
|
7064
7186
|
if (this.store.order) {
|
|
7065
|
-
|
|
7187
|
+
_context75.next = 3;
|
|
7066
7188
|
break;
|
|
7067
7189
|
}
|
|
7068
7190
|
throw new Error('order 模块未初始化');
|
|
7069
7191
|
case 3:
|
|
7070
7192
|
if (!(options === undefined)) {
|
|
7071
|
-
|
|
7193
|
+
_context75.next = 9;
|
|
7072
7194
|
break;
|
|
7073
7195
|
}
|
|
7074
|
-
|
|
7196
|
+
_context75.next = 6;
|
|
7075
7197
|
return this.store.order.removeProductsFromOrder(identities);
|
|
7076
7198
|
case 6:
|
|
7077
|
-
|
|
7078
|
-
|
|
7199
|
+
_context75.t0 = _context75.sent;
|
|
7200
|
+
_context75.next = 12;
|
|
7079
7201
|
break;
|
|
7080
7202
|
case 9:
|
|
7081
|
-
|
|
7203
|
+
_context75.next = 11;
|
|
7082
7204
|
return this.store.order.removeProductsFromOrder(identities, options);
|
|
7083
7205
|
case 11:
|
|
7084
|
-
|
|
7206
|
+
_context75.t0 = _context75.sent;
|
|
7085
7207
|
case 12:
|
|
7086
|
-
return
|
|
7208
|
+
return _context75.abrupt("return", _context75.t0);
|
|
7087
7209
|
case 15:
|
|
7088
|
-
|
|
7089
|
-
|
|
7090
|
-
throw
|
|
7210
|
+
_context75.prev = 15;
|
|
7211
|
+
_context75.t1 = _context75["catch"](0);
|
|
7212
|
+
throw _context75.t1;
|
|
7091
7213
|
case 18:
|
|
7092
7214
|
case "end":
|
|
7093
|
-
return
|
|
7215
|
+
return _context75.stop();
|
|
7094
7216
|
}
|
|
7095
|
-
},
|
|
7217
|
+
}, _callee75, this, [[0, 15]]);
|
|
7096
7218
|
}));
|
|
7097
7219
|
function removeProductsFromOrder(_x64, _x65) {
|
|
7098
7220
|
return _removeProductsFromOrder.apply(this, arguments);
|
|
@@ -7102,16 +7224,16 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
7102
7224
|
}, {
|
|
7103
7225
|
key: "removeProductFromOrder",
|
|
7104
7226
|
value: function () {
|
|
7105
|
-
var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
7106
|
-
return _regeneratorRuntime().wrap(function
|
|
7107
|
-
while (1) switch (
|
|
7227
|
+
var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee76(identity, options) {
|
|
7228
|
+
return _regeneratorRuntime().wrap(function _callee76$(_context76) {
|
|
7229
|
+
while (1) switch (_context76.prev = _context76.next) {
|
|
7108
7230
|
case 0:
|
|
7109
|
-
return
|
|
7231
|
+
return _context76.abrupt("return", this.removeProductsFromOrder([identity], options));
|
|
7110
7232
|
case 1:
|
|
7111
7233
|
case "end":
|
|
7112
|
-
return
|
|
7234
|
+
return _context76.stop();
|
|
7113
7235
|
}
|
|
7114
|
-
},
|
|
7236
|
+
}, _callee76, this);
|
|
7115
7237
|
}));
|
|
7116
7238
|
function removeProductFromOrder(_x66, _x67) {
|
|
7117
7239
|
return _removeProductFromOrder.apply(this, arguments);
|
|
@@ -7163,23 +7285,23 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
7163
7285
|
}, {
|
|
7164
7286
|
key: "applyPromotion",
|
|
7165
7287
|
value: (function () {
|
|
7166
|
-
var _applyPromotion = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
7167
|
-
return _regeneratorRuntime().wrap(function
|
|
7168
|
-
while (1) switch (
|
|
7288
|
+
var _applyPromotion = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee77() {
|
|
7289
|
+
return _regeneratorRuntime().wrap(function _callee77$(_context77) {
|
|
7290
|
+
while (1) switch (_context77.prev = _context77.next) {
|
|
7169
7291
|
case 0:
|
|
7170
7292
|
if (this.store.order) {
|
|
7171
|
-
|
|
7293
|
+
_context77.next = 2;
|
|
7172
7294
|
break;
|
|
7173
7295
|
}
|
|
7174
7296
|
throw new Error('order 模块未初始化');
|
|
7175
7297
|
case 2:
|
|
7176
|
-
|
|
7298
|
+
_context77.next = 4;
|
|
7177
7299
|
return this.store.order.applyPromotion();
|
|
7178
7300
|
case 4:
|
|
7179
7301
|
case "end":
|
|
7180
|
-
return
|
|
7302
|
+
return _context77.stop();
|
|
7181
7303
|
}
|
|
7182
|
-
},
|
|
7304
|
+
}, _callee77, this);
|
|
7183
7305
|
}));
|
|
7184
7306
|
function applyPromotion() {
|
|
7185
7307
|
return _applyPromotion.apply(this, arguments);
|
|
@@ -7206,18 +7328,18 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
7206
7328
|
}, {
|
|
7207
7329
|
key: "getProductList",
|
|
7208
7330
|
value: function () {
|
|
7209
|
-
var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
7210
|
-
var _this$
|
|
7331
|
+
var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee78() {
|
|
7332
|
+
var _this$otherParams41;
|
|
7211
7333
|
var menu_list_ids, _this$store$products, res;
|
|
7212
|
-
return _regeneratorRuntime().wrap(function
|
|
7213
|
-
while (1) switch (
|
|
7334
|
+
return _regeneratorRuntime().wrap(function _callee78$(_context78) {
|
|
7335
|
+
while (1) switch (_context78.prev = _context78.next) {
|
|
7214
7336
|
case 0:
|
|
7215
7337
|
// 可以直接通过配置里的 menu 读取
|
|
7216
|
-
menu_list_ids = ((_this$
|
|
7338
|
+
menu_list_ids = ((_this$otherParams41 = this.otherParams) === null || _this$otherParams41 === void 0 || (_this$otherParams41 = _this$otherParams41.dineInConfig) === null || _this$otherParams41 === void 0 ? void 0 : _this$otherParams41['menu.associated_menus'].map(function (n) {
|
|
7217
7339
|
return Number(n.value);
|
|
7218
7340
|
})) || [];
|
|
7219
|
-
|
|
7220
|
-
|
|
7341
|
+
_context78.prev = 1;
|
|
7342
|
+
_context78.next = 4;
|
|
7221
7343
|
return (_this$store$products = this.store.products) === null || _this$store$products === void 0 ? void 0 : _this$store$products.loadProducts({
|
|
7222
7344
|
menu_list_ids: menu_list_ids,
|
|
7223
7345
|
cacheId: this.cacheId,
|
|
@@ -7225,17 +7347,17 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
7225
7347
|
schedule_datetime: dayjs().format('YYYY-MM-DD HH:mm:ss')
|
|
7226
7348
|
});
|
|
7227
7349
|
case 4:
|
|
7228
|
-
res =
|
|
7229
|
-
return
|
|
7350
|
+
res = _context78.sent;
|
|
7351
|
+
return _context78.abrupt("return", res);
|
|
7230
7352
|
case 8:
|
|
7231
|
-
|
|
7232
|
-
|
|
7233
|
-
throw
|
|
7353
|
+
_context78.prev = 8;
|
|
7354
|
+
_context78.t0 = _context78["catch"](1);
|
|
7355
|
+
throw _context78.t0;
|
|
7234
7356
|
case 11:
|
|
7235
7357
|
case "end":
|
|
7236
|
-
return
|
|
7358
|
+
return _context78.stop();
|
|
7237
7359
|
}
|
|
7238
|
-
},
|
|
7360
|
+
}, _callee78, this, [[1, 8]]);
|
|
7239
7361
|
}));
|
|
7240
7362
|
function getProductList() {
|
|
7241
7363
|
return _getProductList.apply(this, arguments);
|
|
@@ -7250,34 +7372,34 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
7250
7372
|
}, {
|
|
7251
7373
|
key: "setOtherParams",
|
|
7252
7374
|
value: function () {
|
|
7253
|
-
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
7254
|
-
var _this$
|
|
7375
|
+
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee79(params) {
|
|
7376
|
+
var _this$otherParams42;
|
|
7255
7377
|
var _ref57,
|
|
7256
7378
|
_ref57$cover,
|
|
7257
7379
|
cover,
|
|
7258
7380
|
previousPickupTimingScope,
|
|
7259
|
-
|
|
7260
|
-
return _regeneratorRuntime().wrap(function
|
|
7261
|
-
while (1) switch (
|
|
7381
|
+
_args79 = arguments;
|
|
7382
|
+
return _regeneratorRuntime().wrap(function _callee79$(_context79) {
|
|
7383
|
+
while (1) switch (_context79.prev = _context79.next) {
|
|
7262
7384
|
case 0:
|
|
7263
|
-
_ref57 =
|
|
7385
|
+
_ref57 = _args79.length > 1 && _args79[1] !== undefined ? _args79[1] : {}, _ref57$cover = _ref57.cover, cover = _ref57$cover === void 0 ? false : _ref57$cover;
|
|
7264
7386
|
previousPickupTimingScope = this.getPickupTimingScope();
|
|
7265
7387
|
if (cover) {
|
|
7266
7388
|
this.otherParams = _objectSpread({}, params);
|
|
7267
7389
|
} else {
|
|
7268
7390
|
this.otherParams = _objectSpread(_objectSpread({}, this.otherParams), params);
|
|
7269
7391
|
}
|
|
7270
|
-
this.cacheId = (_this$
|
|
7392
|
+
this.cacheId = (_this$otherParams42 = this.otherParams) === null || _this$otherParams42 === void 0 ? void 0 : _this$otherParams42.cacheId;
|
|
7271
7393
|
if (previousPickupTimingScope !== this.getPickupTimingScope()) this.resetPickupTimingCache();
|
|
7272
|
-
|
|
7394
|
+
_context79.next = 7;
|
|
7273
7395
|
return this.syncOtherParamsToSubModules(params, {
|
|
7274
7396
|
cover: cover
|
|
7275
7397
|
});
|
|
7276
7398
|
case 7:
|
|
7277
7399
|
case "end":
|
|
7278
|
-
return
|
|
7400
|
+
return _context79.stop();
|
|
7279
7401
|
}
|
|
7280
|
-
},
|
|
7402
|
+
}, _callee79, this);
|
|
7281
7403
|
}));
|
|
7282
7404
|
function setOtherParams(_x68) {
|
|
7283
7405
|
return _setOtherParams.apply(this, arguments);
|