@pisell/pisellos 2.3.59 → 2.3.61
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/index.d.ts +0 -7
- package/dist/core/index.js +66 -109
- package/dist/model/strategy/adapter/walletPass/evaluator.js +0 -1
- package/dist/model/strategy/adapter/walletPass/type.d.ts +5 -0
- package/dist/model/strategy/adapter/walletPass/utils.js +57 -24
- package/dist/modules/Payment/types.d.ts +2 -0
- package/dist/modules/Payment/utils.js +4 -1
- package/dist/modules/Payment/walletpass.d.ts +11 -0
- package/dist/modules/Payment/walletpass.js +204 -49
- package/dist/modules/ProductList/index.js +2 -1
- package/dist/modules/Quotation/index.d.ts +0 -6
- package/dist/modules/Quotation/index.js +19 -75
- package/dist/plugins/request.d.ts +0 -1
- package/dist/server/index.js +62 -74
- package/dist/server/modules/floor-plan/index.d.ts +0 -4
- package/dist/server/modules/floor-plan/index.js +98 -240
- package/dist/server/modules/order/index.d.ts +5 -6
- package/dist/server/modules/order/index.js +78 -176
- package/dist/server/modules/products/index.d.ts +0 -2
- package/dist/server/modules/products/index.js +3 -17
- package/dist/server/modules/resource/index.js +13 -21
- package/dist/solution/BaseSales/index.d.ts +5 -0
- package/dist/solution/BaseSales/index.js +311 -281
- package/lib/core/index.d.ts +0 -7
- package/lib/core/index.js +3 -20
- package/lib/model/strategy/adapter/walletPass/evaluator.js +0 -1
- package/lib/model/strategy/adapter/walletPass/type.d.ts +5 -0
- package/lib/model/strategy/adapter/walletPass/utils.js +62 -10
- package/lib/modules/Payment/types.d.ts +2 -0
- package/lib/modules/Payment/utils.js +5 -1
- package/lib/modules/Payment/walletpass.d.ts +11 -0
- package/lib/modules/Payment/walletpass.js +183 -15
- package/lib/modules/ProductList/index.js +2 -1
- package/lib/modules/Quotation/index.d.ts +0 -6
- package/lib/modules/Quotation/index.js +5 -49
- package/lib/plugins/request.d.ts +0 -1
- package/lib/server/modules/floor-plan/index.d.ts +0 -4
- package/lib/server/modules/floor-plan/index.js +6 -54
- package/lib/server/modules/order/index.d.ts +5 -6
- package/lib/server/modules/order/index.js +23 -105
- package/lib/server/modules/products/index.d.ts +0 -2
- package/lib/server/modules/products/index.js +4 -15
- package/lib/server/modules/resource/index.js +2 -7
- package/lib/solution/BaseSales/index.d.ts +5 -0
- package/lib/solution/BaseSales/index.js +11 -0
- package/package.json +1 -1
|
@@ -4044,12 +4044,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4044
4044
|
return _selectWalletAsset.apply(this, arguments);
|
|
4045
4045
|
}
|
|
4046
4046
|
return selectWalletAsset;
|
|
4047
|
-
}() /**
|
|
4047
|
+
}() /** 更新已选钱包资产的手动使用金额,并同步 pending payment。 */)
|
|
4048
4048
|
}, {
|
|
4049
|
-
key: "
|
|
4049
|
+
key: "updateWalletAssetAmount",
|
|
4050
4050
|
value: (function () {
|
|
4051
|
-
var
|
|
4052
|
-
var
|
|
4051
|
+
var _updateWalletAssetAmount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42(params) {
|
|
4052
|
+
var state;
|
|
4053
4053
|
return _regeneratorRuntime().wrap(function _callee42$(_context42) {
|
|
4054
4054
|
while (1) switch (_context42.prev = _context42.next) {
|
|
4055
4055
|
case 0:
|
|
@@ -4058,34 +4058,64 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4058
4058
|
break;
|
|
4059
4059
|
}
|
|
4060
4060
|
throw new Error('payment 模块未初始化');
|
|
4061
|
+
case 2:
|
|
4062
|
+
state = this.store.payment.wallet.updateWalletAssetAmount(params.assetId, params.amount);
|
|
4063
|
+
_context42.next = 5;
|
|
4064
|
+
return this.syncSelectedWalletAssets(state);
|
|
4065
|
+
case 5:
|
|
4066
|
+
return _context42.abrupt("return", this.publishWalletAssetsState(state));
|
|
4067
|
+
case 6:
|
|
4068
|
+
case "end":
|
|
4069
|
+
return _context42.stop();
|
|
4070
|
+
}
|
|
4071
|
+
}, _callee42, this);
|
|
4072
|
+
}));
|
|
4073
|
+
function updateWalletAssetAmount(_x38) {
|
|
4074
|
+
return _updateWalletAssetAmount.apply(this, arguments);
|
|
4075
|
+
}
|
|
4076
|
+
return updateWalletAssetAmount;
|
|
4077
|
+
}() /** 扫码精确查券;仅可用资产会被自动选中。 */)
|
|
4078
|
+
}, {
|
|
4079
|
+
key: "scanWalletAsset",
|
|
4080
|
+
value: (function () {
|
|
4081
|
+
var _scanWalletAsset = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(code) {
|
|
4082
|
+
var wallet, businessData, result;
|
|
4083
|
+
return _regeneratorRuntime().wrap(function _callee43$(_context43) {
|
|
4084
|
+
while (1) switch (_context43.prev = _context43.next) {
|
|
4085
|
+
case 0:
|
|
4086
|
+
if (this.store.payment) {
|
|
4087
|
+
_context43.next = 2;
|
|
4088
|
+
break;
|
|
4089
|
+
}
|
|
4090
|
+
throw new Error('payment 模块未初始化');
|
|
4061
4091
|
case 2:
|
|
4062
4092
|
wallet = this.store.payment.wallet; // 扫码可能早于后台 Wallet 刷新,搜索参数必须以当前订单为准。
|
|
4063
4093
|
businessData = this.buildWalletInitBusinessData();
|
|
4064
4094
|
if (businessData) {
|
|
4065
4095
|
wallet.generateWalletParams(businessData);
|
|
4066
4096
|
}
|
|
4067
|
-
|
|
4097
|
+
_context43.next = 7;
|
|
4068
4098
|
return wallet.scanWalletAssetAsync(code);
|
|
4069
4099
|
case 7:
|
|
4070
|
-
result =
|
|
4100
|
+
result = _context43.sent;
|
|
4071
4101
|
if (!(result.type === 'normalCode')) {
|
|
4072
|
-
|
|
4102
|
+
_context43.next = 13;
|
|
4073
4103
|
break;
|
|
4074
4104
|
}
|
|
4075
|
-
|
|
4105
|
+
_context43.next = 11;
|
|
4076
4106
|
return this.syncSelectedWalletAssets(result.state);
|
|
4077
4107
|
case 11:
|
|
4078
|
-
|
|
4108
|
+
_context43.next = 13;
|
|
4079
4109
|
return this.publishWalletAssetsState(result.state);
|
|
4080
4110
|
case 13:
|
|
4081
|
-
return
|
|
4111
|
+
return _context43.abrupt("return", result);
|
|
4082
4112
|
case 14:
|
|
4083
4113
|
case "end":
|
|
4084
|
-
return
|
|
4114
|
+
return _context43.stop();
|
|
4085
4115
|
}
|
|
4086
|
-
},
|
|
4116
|
+
}, _callee43, this);
|
|
4087
4117
|
}));
|
|
4088
|
-
function scanWalletAsset(
|
|
4118
|
+
function scanWalletAsset(_x39) {
|
|
4089
4119
|
return _scanWalletAsset.apply(this, arguments);
|
|
4090
4120
|
}
|
|
4091
4121
|
return scanWalletAsset;
|
|
@@ -4093,27 +4123,27 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4093
4123
|
}, {
|
|
4094
4124
|
key: "clearWalletAssetSelection",
|
|
4095
4125
|
value: (function () {
|
|
4096
|
-
var _clearWalletAssetSelection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4126
|
+
var _clearWalletAssetSelection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44() {
|
|
4097
4127
|
var state;
|
|
4098
|
-
return _regeneratorRuntime().wrap(function
|
|
4099
|
-
while (1) switch (
|
|
4128
|
+
return _regeneratorRuntime().wrap(function _callee44$(_context44) {
|
|
4129
|
+
while (1) switch (_context44.prev = _context44.next) {
|
|
4100
4130
|
case 0:
|
|
4101
4131
|
if (this.store.payment) {
|
|
4102
|
-
|
|
4132
|
+
_context44.next = 2;
|
|
4103
4133
|
break;
|
|
4104
4134
|
}
|
|
4105
4135
|
throw new Error('payment 模块未初始化');
|
|
4106
4136
|
case 2:
|
|
4107
4137
|
state = this.store.payment.wallet.clearWalletAssetSelection();
|
|
4108
|
-
|
|
4138
|
+
_context44.next = 5;
|
|
4109
4139
|
return this.syncSelectedWalletAssets(state);
|
|
4110
4140
|
case 5:
|
|
4111
|
-
return
|
|
4141
|
+
return _context44.abrupt("return", this.publishWalletAssetsState(state));
|
|
4112
4142
|
case 6:
|
|
4113
4143
|
case "end":
|
|
4114
|
-
return
|
|
4144
|
+
return _context44.stop();
|
|
4115
4145
|
}
|
|
4116
|
-
},
|
|
4146
|
+
}, _callee44, this);
|
|
4117
4147
|
}));
|
|
4118
4148
|
function clearWalletAssetSelection() {
|
|
4119
4149
|
return _clearWalletAssetSelection.apply(this, arguments);
|
|
@@ -4143,35 +4173,35 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4143
4173
|
}, {
|
|
4144
4174
|
key: "getPaymentMethodsAsync",
|
|
4145
4175
|
value: (function () {
|
|
4146
|
-
var _getPaymentMethodsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4176
|
+
var _getPaymentMethodsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee45() {
|
|
4147
4177
|
var response, paymentMethods;
|
|
4148
|
-
return _regeneratorRuntime().wrap(function
|
|
4149
|
-
while (1) switch (
|
|
4178
|
+
return _regeneratorRuntime().wrap(function _callee45$(_context45) {
|
|
4179
|
+
while (1) switch (_context45.prev = _context45.next) {
|
|
4150
4180
|
case 0:
|
|
4151
|
-
|
|
4152
|
-
|
|
4181
|
+
_context45.prev = 0;
|
|
4182
|
+
_context45.next = 3;
|
|
4153
4183
|
return this.request.get('/pay/custom-payment/all', {
|
|
4154
4184
|
filterPaymentMethods: true
|
|
4155
4185
|
}, {
|
|
4156
4186
|
osServer: true
|
|
4157
4187
|
});
|
|
4158
4188
|
case 3:
|
|
4159
|
-
response =
|
|
4189
|
+
response = _context45.sent;
|
|
4160
4190
|
paymentMethods = (response === null || response === void 0 ? void 0 : response.data) || [];
|
|
4161
4191
|
this.paymentMethodsCache = Array.isArray(paymentMethods) ? _toConsumableArray(paymentMethods) : [];
|
|
4162
|
-
return
|
|
4192
|
+
return _context45.abrupt("return", this.getPaymentMethods());
|
|
4163
4193
|
case 9:
|
|
4164
|
-
|
|
4165
|
-
|
|
4194
|
+
_context45.prev = 9;
|
|
4195
|
+
_context45.t0 = _context45["catch"](0);
|
|
4166
4196
|
this.logWarning('getPaymentMethodsAsync: 获取支付方式列表失败,使用缓存列表', {
|
|
4167
|
-
error:
|
|
4197
|
+
error: _context45.t0 instanceof Error ? _context45.t0.message : String(_context45.t0)
|
|
4168
4198
|
});
|
|
4169
|
-
return
|
|
4199
|
+
return _context45.abrupt("return", this.getPaymentMethods());
|
|
4170
4200
|
case 13:
|
|
4171
4201
|
case "end":
|
|
4172
|
-
return
|
|
4202
|
+
return _context45.stop();
|
|
4173
4203
|
}
|
|
4174
|
-
},
|
|
4204
|
+
}, _callee45, this, [[0, 9]]);
|
|
4175
4205
|
}));
|
|
4176
4206
|
function getPaymentMethodsAsync() {
|
|
4177
4207
|
return _getPaymentMethodsAsync.apply(this, arguments);
|
|
@@ -4214,14 +4244,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4214
4244
|
}, {
|
|
4215
4245
|
key: "getCashPaymentConfig",
|
|
4216
4246
|
value: (function () {
|
|
4217
|
-
var _getCashPaymentConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4247
|
+
var _getCashPaymentConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee46() {
|
|
4218
4248
|
var _this$store$order11, _this$store$order11$g, _this$store$order12, _this$store$order12$g, _this$otherParams31;
|
|
4219
4249
|
var paymentMethods, paymentMethod, amountSnapshot, pendingWalletAmount, amountDue, currency, recommendedAmounts;
|
|
4220
|
-
return _regeneratorRuntime().wrap(function
|
|
4221
|
-
while (1) switch (
|
|
4250
|
+
return _regeneratorRuntime().wrap(function _callee46$(_context46) {
|
|
4251
|
+
while (1) switch (_context46.prev = _context46.next) {
|
|
4222
4252
|
case 0:
|
|
4223
4253
|
if (this.store.payment) {
|
|
4224
|
-
|
|
4254
|
+
_context46.next = 2;
|
|
4225
4255
|
break;
|
|
4226
4256
|
}
|
|
4227
4257
|
throw new Error('payment 模块未初始化');
|
|
@@ -4229,13 +4259,13 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4229
4259
|
paymentMethods = this.getPaymentMethods();
|
|
4230
4260
|
paymentMethod = this.findCashPaymentMethod(paymentMethods);
|
|
4231
4261
|
if (paymentMethod) {
|
|
4232
|
-
|
|
4262
|
+
_context46.next = 9;
|
|
4233
4263
|
break;
|
|
4234
4264
|
}
|
|
4235
|
-
|
|
4265
|
+
_context46.next = 7;
|
|
4236
4266
|
return this.getPaymentMethodsAsync();
|
|
4237
4267
|
case 7:
|
|
4238
|
-
paymentMethods =
|
|
4268
|
+
paymentMethods = _context46.sent;
|
|
4239
4269
|
paymentMethod = this.findCashPaymentMethod(paymentMethods);
|
|
4240
4270
|
case 9:
|
|
4241
4271
|
amountSnapshot = (_this$store$order11 = this.store.order) === null || _this$store$order11 === void 0 || (_this$store$order11$g = _this$store$order11.getOrderAmountSnapshot) === null || _this$store$order11$g === void 0 ? void 0 : _this$store$order11$g.call(_this$store$order11);
|
|
@@ -4243,7 +4273,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4243
4273
|
amountDue = Decimal.max(new Decimal((amountSnapshot === null || amountSnapshot === void 0 ? void 0 : amountSnapshot.amountGap) || 0).minus(pendingWalletAmount), 0).toDecimalPlaces(2).toNumber();
|
|
4244
4274
|
currency = ((_this$store$order12 = this.store.order) === null || _this$store$order12 === void 0 || (_this$store$order12$g = _this$store$order12.getTempOrder) === null || _this$store$order12$g === void 0 || (_this$store$order12$g = _this$store$order12$g.call(_this$store$order12)) === null || _this$store$order12$g === void 0 ? void 0 : _this$store$order12$g.currency_code) || ((_this$otherParams31 = this.otherParams) === null || _this$otherParams31 === void 0 ? void 0 : _this$otherParams31.currency) || 'USD';
|
|
4245
4275
|
recommendedAmounts = amountDue > 0 ? this.store.payment.cash.getRecommendedAmount(amountDue, currency) : [];
|
|
4246
|
-
return
|
|
4276
|
+
return _context46.abrupt("return", {
|
|
4247
4277
|
available: Boolean(paymentMethod && amountDue > 0),
|
|
4248
4278
|
paymentMethod: paymentMethod,
|
|
4249
4279
|
amountDue: amountDue,
|
|
@@ -4251,9 +4281,9 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4251
4281
|
});
|
|
4252
4282
|
case 15:
|
|
4253
4283
|
case "end":
|
|
4254
|
-
return
|
|
4284
|
+
return _context46.stop();
|
|
4255
4285
|
}
|
|
4256
|
-
},
|
|
4286
|
+
}, _callee46, this);
|
|
4257
4287
|
}));
|
|
4258
4288
|
function getCashPaymentConfig() {
|
|
4259
4289
|
return _getCashPaymentConfig.apply(this, arguments);
|
|
@@ -4270,14 +4300,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4270
4300
|
}, {
|
|
4271
4301
|
key: "confirmWalletPayment",
|
|
4272
4302
|
value: (function () {
|
|
4273
|
-
var _confirmWalletPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4303
|
+
var _confirmWalletPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee47() {
|
|
4274
4304
|
var _this$store$order$get3, _this$store$order13, _this$store$order$get4, _this$store$order$get5, _this$store$order14;
|
|
4275
4305
|
var beforePayments, pendingWalletAmount, amountSnapshot, effectiveAmountDue, beforePaymentStatus, submitResult, restoredTempOrder, committed, walletState, latestAmountSnapshot;
|
|
4276
|
-
return _regeneratorRuntime().wrap(function
|
|
4277
|
-
while (1) switch (
|
|
4306
|
+
return _regeneratorRuntime().wrap(function _callee47$(_context47) {
|
|
4307
|
+
while (1) switch (_context47.prev = _context47.next) {
|
|
4278
4308
|
case 0:
|
|
4279
4309
|
if (this.store.order) {
|
|
4280
|
-
|
|
4310
|
+
_context47.next = 2;
|
|
4281
4311
|
break;
|
|
4282
4312
|
}
|
|
4283
4313
|
throw new Error('order 模块未初始化');
|
|
@@ -4285,7 +4315,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4285
4315
|
beforePayments = cloneDeep(this.store.order.getOrderPayments());
|
|
4286
4316
|
pendingWalletAmount = this.getPendingWalletPaymentAmount(beforePayments);
|
|
4287
4317
|
if (!pendingWalletAmount.lte(0)) {
|
|
4288
|
-
|
|
4318
|
+
_context47.next = 6;
|
|
4289
4319
|
break;
|
|
4290
4320
|
}
|
|
4291
4321
|
throw new Error('当前订单没有待确认的 Wallet 支付');
|
|
@@ -4293,74 +4323,74 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4293
4323
|
amountSnapshot = (_this$store$order$get3 = (_this$store$order13 = this.store.order).getOrderAmountSnapshot) === null || _this$store$order$get3 === void 0 ? void 0 : _this$store$order$get3.call(_this$store$order13);
|
|
4294
4324
|
effectiveAmountDue = Decimal.max(new Decimal((amountSnapshot === null || amountSnapshot === void 0 ? void 0 : amountSnapshot.amountGap) || 0).minus(pendingWalletAmount), 0);
|
|
4295
4325
|
if (!effectiveAmountDue.gt(0.01)) {
|
|
4296
|
-
|
|
4326
|
+
_context47.next = 10;
|
|
4297
4327
|
break;
|
|
4298
4328
|
}
|
|
4299
4329
|
throw new Error('Wallet 支付尚未覆盖全部待支付金额');
|
|
4300
4330
|
case 10:
|
|
4301
4331
|
beforePaymentStatus = (_this$store$order$get4 = this.store.order.getTempOrder()) === null || _this$store$order$get4 === void 0 ? void 0 : _this$store$order$get4.payment_status;
|
|
4302
|
-
|
|
4303
|
-
|
|
4332
|
+
_context47.prev = 11;
|
|
4333
|
+
_context47.next = 14;
|
|
4304
4334
|
return this.submitSalesOrder({
|
|
4305
4335
|
smallTicketDataFlag: 1,
|
|
4306
4336
|
confirmPendingVoucherPayments: true
|
|
4307
4337
|
});
|
|
4308
4338
|
case 14:
|
|
4309
|
-
submitResult =
|
|
4339
|
+
submitResult = _context47.sent;
|
|
4310
4340
|
if (!isRejectedSalesSubmitResult(submitResult)) {
|
|
4311
|
-
|
|
4341
|
+
_context47.next = 17;
|
|
4312
4342
|
break;
|
|
4313
4343
|
}
|
|
4314
4344
|
throw new Error(getSalesSubmitErrorMessage(submitResult, 'Wallet 支付确认失败'));
|
|
4315
4345
|
case 17:
|
|
4316
|
-
|
|
4346
|
+
_context47.next = 27;
|
|
4317
4347
|
break;
|
|
4318
4348
|
case 19:
|
|
4319
|
-
|
|
4320
|
-
|
|
4349
|
+
_context47.prev = 19;
|
|
4350
|
+
_context47.t0 = _context47["catch"](11);
|
|
4321
4351
|
this.store.order.setOrderPayments(beforePayments);
|
|
4322
4352
|
restoredTempOrder = this.store.order.getTempOrder();
|
|
4323
4353
|
if (restoredTempOrder && beforePaymentStatus !== undefined) {
|
|
4324
4354
|
restoredTempOrder.payment_status = beforePaymentStatus;
|
|
4325
4355
|
this.store.order.persistTempOrder();
|
|
4326
4356
|
}
|
|
4327
|
-
|
|
4357
|
+
_context47.next = 26;
|
|
4328
4358
|
return this.store.order.recalculateSummary({
|
|
4329
4359
|
createIfMissing: true
|
|
4330
4360
|
});
|
|
4331
4361
|
case 26:
|
|
4332
|
-
throw
|
|
4362
|
+
throw _context47.t0;
|
|
4333
4363
|
case 27:
|
|
4334
4364
|
if (!this.store.payment) {
|
|
4335
|
-
|
|
4365
|
+
_context47.next = 38;
|
|
4336
4366
|
break;
|
|
4337
4367
|
}
|
|
4338
|
-
|
|
4368
|
+
_context47.prev = 28;
|
|
4339
4369
|
committed = this.getCommittedWalletAssets();
|
|
4340
4370
|
walletState = this.store.payment.wallet.setCommittedWalletAssets(committed.ids, committed.assets);
|
|
4341
|
-
|
|
4371
|
+
_context47.next = 33;
|
|
4342
4372
|
return this.publishWalletAssetsState(walletState);
|
|
4343
4373
|
case 33:
|
|
4344
|
-
|
|
4374
|
+
_context47.next = 38;
|
|
4345
4375
|
break;
|
|
4346
4376
|
case 35:
|
|
4347
|
-
|
|
4348
|
-
|
|
4377
|
+
_context47.prev = 35;
|
|
4378
|
+
_context47.t1 = _context47["catch"](28);
|
|
4349
4379
|
this.logWarning('confirmWalletPayment: Wallet committed 状态同步失败', {
|
|
4350
|
-
error:
|
|
4380
|
+
error: _context47.t1 instanceof Error ? _context47.t1.message : String(_context47.t1)
|
|
4351
4381
|
});
|
|
4352
4382
|
case 38:
|
|
4353
4383
|
latestAmountSnapshot = (_this$store$order$get5 = (_this$store$order14 = this.store.order).getOrderAmountSnapshot) === null || _this$store$order$get5 === void 0 ? void 0 : _this$store$order$get5.call(_this$store$order14);
|
|
4354
|
-
return
|
|
4384
|
+
return _context47.abrupt("return", {
|
|
4355
4385
|
submitResult: submitResult,
|
|
4356
4386
|
payments: this.store.order.getOrderPayments(),
|
|
4357
4387
|
isOrderFullyPaid: new Decimal((latestAmountSnapshot === null || latestAmountSnapshot === void 0 ? void 0 : latestAmountSnapshot.amountGap) || 0).lte(0)
|
|
4358
4388
|
});
|
|
4359
4389
|
case 40:
|
|
4360
4390
|
case "end":
|
|
4361
|
-
return
|
|
4391
|
+
return _context47.stop();
|
|
4362
4392
|
}
|
|
4363
|
-
},
|
|
4393
|
+
}, _callee47, this, [[11, 19], [28, 35]]);
|
|
4364
4394
|
}));
|
|
4365
4395
|
function confirmWalletPayment() {
|
|
4366
4396
|
return _confirmWalletPayment.apply(this, arguments);
|
|
@@ -4375,38 +4405,38 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4375
4405
|
}, {
|
|
4376
4406
|
key: "payCash",
|
|
4377
4407
|
value: (function () {
|
|
4378
|
-
var _payCash = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4408
|
+
var _payCash = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee48(params) {
|
|
4379
4409
|
var _this$store$order$get6, _params$actualPaidAmo, _this$otherParams32, _this$window, _this$window$postMess;
|
|
4380
4410
|
var amount, config, paymentMethod, roundingAmount, effectivePaymentAmount, beforePayments, beforePaymentStatus, uniquePaymentNumber, paymentTimestamp, actualPaidAmount, changeAmount, shopWalletPassId, payments, payment, syncResult, committed, walletState, restoredTempOrder;
|
|
4381
|
-
return _regeneratorRuntime().wrap(function
|
|
4382
|
-
while (1) switch (
|
|
4411
|
+
return _regeneratorRuntime().wrap(function _callee48$(_context48) {
|
|
4412
|
+
while (1) switch (_context48.prev = _context48.next) {
|
|
4383
4413
|
case 0:
|
|
4384
4414
|
if (this.store.order) {
|
|
4385
|
-
|
|
4415
|
+
_context48.next = 2;
|
|
4386
4416
|
break;
|
|
4387
4417
|
}
|
|
4388
4418
|
throw new Error('order 模块未初始化');
|
|
4389
4419
|
case 2:
|
|
4390
4420
|
amount = Number(params.amount || 0);
|
|
4391
4421
|
if (!(!Number.isFinite(amount) || amount <= 0)) {
|
|
4392
|
-
|
|
4422
|
+
_context48.next = 5;
|
|
4393
4423
|
break;
|
|
4394
4424
|
}
|
|
4395
4425
|
throw new Error('现金支付金额必须大于 0');
|
|
4396
4426
|
case 5:
|
|
4397
|
-
|
|
4427
|
+
_context48.next = 7;
|
|
4398
4428
|
return this.getCashPaymentConfig();
|
|
4399
4429
|
case 7:
|
|
4400
|
-
config =
|
|
4430
|
+
config = _context48.sent;
|
|
4401
4431
|
paymentMethod = config.paymentMethod;
|
|
4402
4432
|
if (paymentMethod) {
|
|
4403
|
-
|
|
4433
|
+
_context48.next = 11;
|
|
4404
4434
|
break;
|
|
4405
4435
|
}
|
|
4406
4436
|
throw new Error('未找到可用的 CASHMANUAL 支付方式');
|
|
4407
4437
|
case 11:
|
|
4408
4438
|
if (!(config.amountDue <= 0)) {
|
|
4409
|
-
|
|
4439
|
+
_context48.next = 13;
|
|
4410
4440
|
break;
|
|
4411
4441
|
}
|
|
4412
4442
|
throw new Error('当前订单没有待支付金额');
|
|
@@ -4414,7 +4444,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4414
4444
|
roundingAmount = Number(params.roundingAmount || 0);
|
|
4415
4445
|
effectivePaymentAmount = new Decimal(amount).minus(roundingAmount);
|
|
4416
4446
|
if (!effectivePaymentAmount.gt(new Decimal(config.amountDue).plus(0.01))) {
|
|
4417
|
-
|
|
4447
|
+
_context48.next = 17;
|
|
4418
4448
|
break;
|
|
4419
4449
|
}
|
|
4420
4450
|
throw new Error('现金支付金额超过当前待支付金额');
|
|
@@ -4427,7 +4457,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4427
4457
|
changeAmount = Number(params.changeAmount || 0);
|
|
4428
4458
|
shopWalletPassId = (_this$otherParams32 = this.otherParams) === null || _this$otherParams32 === void 0 ? void 0 : _this$otherParams32.shop_wallet_pass_id;
|
|
4429
4459
|
if (!(!Number.isFinite(actualPaidAmount) || actualPaidAmount + 0.01 < amount)) {
|
|
4430
|
-
|
|
4460
|
+
_context48.next = 26;
|
|
4431
4461
|
break;
|
|
4432
4462
|
}
|
|
4433
4463
|
throw new Error('顾客实收现金不能小于支付金额');
|
|
@@ -4462,8 +4492,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4462
4492
|
var _item$metadata2;
|
|
4463
4493
|
return (item === null || item === void 0 || (_item$metadata2 = item.metadata) === null || _item$metadata2 === void 0 ? void 0 : _item$metadata2.unique_payment_number) === uniquePaymentNumber;
|
|
4464
4494
|
});
|
|
4465
|
-
|
|
4466
|
-
|
|
4495
|
+
_context48.prev = 29;
|
|
4496
|
+
_context48.next = 32;
|
|
4467
4497
|
return this.syncPaymentsToOrder({
|
|
4468
4498
|
payments: payments,
|
|
4469
4499
|
submitWhenPaid: true,
|
|
@@ -4471,50 +4501,50 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4471
4501
|
confirmPendingVoucherPayments: true
|
|
4472
4502
|
});
|
|
4473
4503
|
case 32:
|
|
4474
|
-
syncResult =
|
|
4504
|
+
syncResult = _context48.sent;
|
|
4475
4505
|
if (!isRejectedSalesSubmitResult(syncResult.submitResult)) {
|
|
4476
|
-
|
|
4506
|
+
_context48.next = 35;
|
|
4477
4507
|
break;
|
|
4478
4508
|
}
|
|
4479
4509
|
throw new Error(getSalesSubmitErrorMessage(syncResult.submitResult, '订单提交失败'));
|
|
4480
4510
|
case 35:
|
|
4481
4511
|
if (!this.store.payment) {
|
|
4482
|
-
|
|
4512
|
+
_context48.next = 40;
|
|
4483
4513
|
break;
|
|
4484
4514
|
}
|
|
4485
4515
|
committed = this.getCommittedWalletAssets();
|
|
4486
4516
|
walletState = this.store.payment.wallet.setCommittedWalletAssets(committed.ids, committed.assets);
|
|
4487
|
-
|
|
4517
|
+
_context48.next = 40;
|
|
4488
4518
|
return this.publishWalletAssetsState(walletState);
|
|
4489
4519
|
case 40:
|
|
4490
|
-
return
|
|
4520
|
+
return _context48.abrupt("return", {
|
|
4491
4521
|
payment: payment || {},
|
|
4492
4522
|
payments: this.store.order.getOrderPayments(),
|
|
4493
4523
|
syncResult: syncResult,
|
|
4494
4524
|
isOrderFullyPaid: syncResult.isOrderFullyPaid
|
|
4495
4525
|
});
|
|
4496
4526
|
case 43:
|
|
4497
|
-
|
|
4498
|
-
|
|
4527
|
+
_context48.prev = 43;
|
|
4528
|
+
_context48.t0 = _context48["catch"](29);
|
|
4499
4529
|
this.store.order.setOrderPayments(beforePayments);
|
|
4500
4530
|
restoredTempOrder = this.store.order.getTempOrder();
|
|
4501
4531
|
if (restoredTempOrder && beforePaymentStatus !== undefined) {
|
|
4502
4532
|
restoredTempOrder.payment_status = beforePaymentStatus;
|
|
4503
4533
|
this.store.order.persistTempOrder();
|
|
4504
4534
|
}
|
|
4505
|
-
|
|
4535
|
+
_context48.next = 50;
|
|
4506
4536
|
return this.store.order.recalculateSummary({
|
|
4507
4537
|
createIfMissing: true
|
|
4508
4538
|
});
|
|
4509
4539
|
case 50:
|
|
4510
|
-
throw
|
|
4540
|
+
throw _context48.t0;
|
|
4511
4541
|
case 51:
|
|
4512
4542
|
case "end":
|
|
4513
|
-
return
|
|
4543
|
+
return _context48.stop();
|
|
4514
4544
|
}
|
|
4515
|
-
},
|
|
4545
|
+
}, _callee48, this, [[29, 43]]);
|
|
4516
4546
|
}));
|
|
4517
|
-
function payCash(
|
|
4547
|
+
function payCash(_x40) {
|
|
4518
4548
|
return _payCash.apply(this, arguments);
|
|
4519
4549
|
}
|
|
4520
4550
|
return payCash;
|
|
@@ -4530,21 +4560,21 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4530
4560
|
}, {
|
|
4531
4561
|
key: "commitPaymentMethodPayment",
|
|
4532
4562
|
value: (function () {
|
|
4533
|
-
var _commitPaymentMethodPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4563
|
+
var _commitPaymentMethodPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee49(params) {
|
|
4534
4564
|
var _this$store$order$get7, _this$store$order15, _this$store$order$get8, _params$metadata, _params$originAmount;
|
|
4535
4565
|
var amount, paymentMethods, findPaymentMethod, paymentMethod, amountSnapshot, pendingWalletAmount, amountDue, beforePayments, beforePaymentStatus, paymentTimestamp, metadata, serviceCharge, serviceFee, payments, payment, syncResult, committed, walletState, restoredTempOrder;
|
|
4536
|
-
return _regeneratorRuntime().wrap(function
|
|
4537
|
-
while (1) switch (
|
|
4566
|
+
return _regeneratorRuntime().wrap(function _callee49$(_context49) {
|
|
4567
|
+
while (1) switch (_context49.prev = _context49.next) {
|
|
4538
4568
|
case 0:
|
|
4539
4569
|
if (this.store.order) {
|
|
4540
|
-
|
|
4570
|
+
_context49.next = 2;
|
|
4541
4571
|
break;
|
|
4542
4572
|
}
|
|
4543
4573
|
throw new Error('order 模块未初始化');
|
|
4544
4574
|
case 2:
|
|
4545
4575
|
amount = Number(params.amount || 0);
|
|
4546
4576
|
if (!(!Number.isFinite(amount) || amount <= 0)) {
|
|
4547
|
-
|
|
4577
|
+
_context49.next = 5;
|
|
4548
4578
|
break;
|
|
4549
4579
|
}
|
|
4550
4580
|
throw new Error('支付金额必须大于 0');
|
|
@@ -4560,17 +4590,17 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4560
4590
|
};
|
|
4561
4591
|
paymentMethod = findPaymentMethod();
|
|
4562
4592
|
if (paymentMethod) {
|
|
4563
|
-
|
|
4593
|
+
_context49.next = 13;
|
|
4564
4594
|
break;
|
|
4565
4595
|
}
|
|
4566
|
-
|
|
4596
|
+
_context49.next = 11;
|
|
4567
4597
|
return this.getPaymentMethodsAsync();
|
|
4568
4598
|
case 11:
|
|
4569
|
-
paymentMethods =
|
|
4599
|
+
paymentMethods = _context49.sent;
|
|
4570
4600
|
paymentMethod = findPaymentMethod();
|
|
4571
4601
|
case 13:
|
|
4572
4602
|
if (paymentMethod) {
|
|
4573
|
-
|
|
4603
|
+
_context49.next = 15;
|
|
4574
4604
|
break;
|
|
4575
4605
|
}
|
|
4576
4606
|
throw new Error("\u672A\u627E\u5230\u53EF\u7528\u7684\u652F\u4ED8\u65B9\u5F0F\uFF1A".concat(params.paymentMethodCode || params.paymentMethodId || ''));
|
|
@@ -4579,13 +4609,13 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4579
4609
|
pendingWalletAmount = this.getPendingWalletPaymentAmount();
|
|
4580
4610
|
amountDue = Decimal.max(new Decimal((amountSnapshot === null || amountSnapshot === void 0 ? void 0 : amountSnapshot.amountGap) || 0).minus(pendingWalletAmount), 0);
|
|
4581
4611
|
if (!amountDue.lte(0)) {
|
|
4582
|
-
|
|
4612
|
+
_context49.next = 20;
|
|
4583
4613
|
break;
|
|
4584
4614
|
}
|
|
4585
4615
|
throw new Error('当前订单没有待支付金额');
|
|
4586
4616
|
case 20:
|
|
4587
4617
|
if (!new Decimal(amount).gt(amountDue.plus(0.01))) {
|
|
4588
|
-
|
|
4618
|
+
_context49.next = 22;
|
|
4589
4619
|
break;
|
|
4590
4620
|
}
|
|
4591
4621
|
throw new Error('支付金额超过当前待支付金额');
|
|
@@ -4624,8 +4654,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4624
4654
|
var _item$metadata3;
|
|
4625
4655
|
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;
|
|
4626
4656
|
});
|
|
4627
|
-
|
|
4628
|
-
|
|
4657
|
+
_context49.prev = 30;
|
|
4658
|
+
_context49.next = 33;
|
|
4629
4659
|
return this.syncPaymentsToOrder({
|
|
4630
4660
|
payments: payments,
|
|
4631
4661
|
submitWhenPaid: true,
|
|
@@ -4633,50 +4663,50 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4633
4663
|
confirmPendingVoucherPayments: true
|
|
4634
4664
|
});
|
|
4635
4665
|
case 33:
|
|
4636
|
-
syncResult =
|
|
4666
|
+
syncResult = _context49.sent;
|
|
4637
4667
|
if (!isRejectedSalesSubmitResult(syncResult.submitResult)) {
|
|
4638
|
-
|
|
4668
|
+
_context49.next = 36;
|
|
4639
4669
|
break;
|
|
4640
4670
|
}
|
|
4641
4671
|
throw new Error(getSalesSubmitErrorMessage(syncResult.submitResult, '订单提交失败'));
|
|
4642
4672
|
case 36:
|
|
4643
4673
|
if (!this.store.payment) {
|
|
4644
|
-
|
|
4674
|
+
_context49.next = 41;
|
|
4645
4675
|
break;
|
|
4646
4676
|
}
|
|
4647
4677
|
committed = this.getCommittedWalletAssets();
|
|
4648
4678
|
walletState = this.store.payment.wallet.setCommittedWalletAssets(committed.ids, committed.assets);
|
|
4649
|
-
|
|
4679
|
+
_context49.next = 41;
|
|
4650
4680
|
return this.publishWalletAssetsState(walletState);
|
|
4651
4681
|
case 41:
|
|
4652
|
-
return
|
|
4682
|
+
return _context49.abrupt("return", {
|
|
4653
4683
|
payment: payment || {},
|
|
4654
4684
|
payments: this.store.order.getOrderPayments(),
|
|
4655
4685
|
syncResult: syncResult,
|
|
4656
4686
|
isOrderFullyPaid: syncResult.isOrderFullyPaid
|
|
4657
4687
|
});
|
|
4658
4688
|
case 44:
|
|
4659
|
-
|
|
4660
|
-
|
|
4689
|
+
_context49.prev = 44;
|
|
4690
|
+
_context49.t0 = _context49["catch"](30);
|
|
4661
4691
|
this.store.order.setOrderPayments(beforePayments);
|
|
4662
4692
|
restoredTempOrder = this.store.order.getTempOrder();
|
|
4663
4693
|
if (restoredTempOrder && beforePaymentStatus !== undefined) {
|
|
4664
4694
|
restoredTempOrder.payment_status = beforePaymentStatus;
|
|
4665
4695
|
this.store.order.persistTempOrder();
|
|
4666
4696
|
}
|
|
4667
|
-
|
|
4697
|
+
_context49.next = 51;
|
|
4668
4698
|
return this.store.order.recalculateSummary({
|
|
4669
4699
|
createIfMissing: true
|
|
4670
4700
|
});
|
|
4671
4701
|
case 51:
|
|
4672
|
-
throw
|
|
4702
|
+
throw _context49.t0;
|
|
4673
4703
|
case 52:
|
|
4674
4704
|
case "end":
|
|
4675
|
-
return
|
|
4705
|
+
return _context49.stop();
|
|
4676
4706
|
}
|
|
4677
|
-
},
|
|
4707
|
+
}, _callee49, this, [[30, 44]]);
|
|
4678
4708
|
}));
|
|
4679
|
-
function commitPaymentMethodPayment(
|
|
4709
|
+
function commitPaymentMethodPayment(_x41) {
|
|
4680
4710
|
return _commitPaymentMethodPayment.apply(this, arguments);
|
|
4681
4711
|
}
|
|
4682
4712
|
return commitPaymentMethodPayment;
|
|
@@ -4691,40 +4721,40 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4691
4721
|
}, {
|
|
4692
4722
|
key: "roundAmount",
|
|
4693
4723
|
value: (function () {
|
|
4694
|
-
var _roundAmount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4724
|
+
var _roundAmount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee50(params) {
|
|
4695
4725
|
var _cashManualPayment$me, _this$otherParams$ord2, _this$otherParams$ord3;
|
|
4696
4726
|
var amount, cashManualPayment;
|
|
4697
|
-
return _regeneratorRuntime().wrap(function
|
|
4698
|
-
while (1) switch (
|
|
4727
|
+
return _regeneratorRuntime().wrap(function _callee50$(_context50) {
|
|
4728
|
+
while (1) switch (_context50.prev = _context50.next) {
|
|
4699
4729
|
case 0:
|
|
4700
4730
|
amount = params.amount;
|
|
4701
4731
|
cashManualPayment = this.paymentMethodsCache.find(function (paymentMethod) {
|
|
4702
4732
|
return paymentMethod.code === 'CASHMANUAL';
|
|
4703
4733
|
});
|
|
4704
4734
|
if (cashManualPayment !== null && cashManualPayment !== void 0 && (_cashManualPayment$me = cashManualPayment.metadata) !== null && _cashManualPayment$me !== void 0 && _cashManualPayment$me.order_rounding_switch) {
|
|
4705
|
-
|
|
4735
|
+
_context50.next = 4;
|
|
4706
4736
|
break;
|
|
4707
4737
|
}
|
|
4708
|
-
return
|
|
4738
|
+
return _context50.abrupt("return", {
|
|
4709
4739
|
originalAmount: amount.toString(),
|
|
4710
4740
|
roundedAmount: amount.toString(),
|
|
4711
4741
|
roundingDifference: '0.00'
|
|
4712
4742
|
});
|
|
4713
4743
|
case 4:
|
|
4714
4744
|
if (this.payment) {
|
|
4715
|
-
|
|
4745
|
+
_context50.next = 6;
|
|
4716
4746
|
break;
|
|
4717
4747
|
}
|
|
4718
4748
|
throw new Error('payment 模块未初始化');
|
|
4719
4749
|
case 6:
|
|
4720
|
-
return
|
|
4750
|
+
return _context50.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));
|
|
4721
4751
|
case 7:
|
|
4722
4752
|
case "end":
|
|
4723
|
-
return
|
|
4753
|
+
return _context50.stop();
|
|
4724
4754
|
}
|
|
4725
|
-
},
|
|
4755
|
+
}, _callee50, this);
|
|
4726
4756
|
}));
|
|
4727
|
-
function roundAmount(
|
|
4757
|
+
function roundAmount(_x42) {
|
|
4728
4758
|
return _roundAmount.apply(this, arguments);
|
|
4729
4759
|
}
|
|
4730
4760
|
return roundAmount;
|
|
@@ -4739,49 +4769,49 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4739
4769
|
}, {
|
|
4740
4770
|
key: "sendCustomerPayLink",
|
|
4741
4771
|
value: (function () {
|
|
4742
|
-
var _sendCustomerPayLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4772
|
+
var _sendCustomerPayLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee51(params) {
|
|
4743
4773
|
var orderIds, _ref37, _ref38, _submitResult$data$or, _submitResult$data, _submitResult$data2, submitResult, orderId;
|
|
4744
|
-
return _regeneratorRuntime().wrap(function
|
|
4745
|
-
while (1) switch (
|
|
4774
|
+
return _regeneratorRuntime().wrap(function _callee51$(_context51) {
|
|
4775
|
+
while (1) switch (_context51.prev = _context51.next) {
|
|
4746
4776
|
case 0:
|
|
4747
4777
|
if (this.store.order) {
|
|
4748
|
-
|
|
4778
|
+
_context51.next = 2;
|
|
4749
4779
|
break;
|
|
4750
4780
|
}
|
|
4751
4781
|
throw new Error('order 模块未初始化');
|
|
4752
4782
|
case 2:
|
|
4753
4783
|
orderIds = params.order_ids || params.orderIds || [];
|
|
4754
4784
|
if (!(!orderIds.length || params.submitBeforeSend)) {
|
|
4755
|
-
|
|
4785
|
+
_context51.next = 11;
|
|
4756
4786
|
break;
|
|
4757
4787
|
}
|
|
4758
|
-
|
|
4788
|
+
_context51.next = 6;
|
|
4759
4789
|
return this.submitSalesOrder({
|
|
4760
4790
|
smallTicketDataFlag: 1
|
|
4761
4791
|
});
|
|
4762
4792
|
case 6:
|
|
4763
|
-
submitResult =
|
|
4793
|
+
submitResult = _context51.sent;
|
|
4764
4794
|
orderId = (_ref37 = (_ref38 = (_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 && _ref38 !== void 0 ? _ref38 : submitResult === null || submitResult === void 0 || (_submitResult$data2 = submitResult.data) === null || _submitResult$data2 === void 0 ? void 0 : _submitResult$data2.id) !== null && _ref37 !== void 0 ? _ref37 : submitResult === null || submitResult === void 0 ? void 0 : submitResult.id;
|
|
4765
4795
|
if (orderId) {
|
|
4766
|
-
|
|
4796
|
+
_context51.next = 10;
|
|
4767
4797
|
break;
|
|
4768
4798
|
}
|
|
4769
4799
|
throw new Error('本地订单提交云端失败,无法发送支付链接');
|
|
4770
4800
|
case 10:
|
|
4771
4801
|
orderIds = [orderId];
|
|
4772
4802
|
case 11:
|
|
4773
|
-
return
|
|
4803
|
+
return _context51.abrupt("return", this.store.order.sendCustomerPayLink({
|
|
4774
4804
|
emails: params.emails,
|
|
4775
4805
|
notify_action: params.notify_action,
|
|
4776
4806
|
order_ids: orderIds
|
|
4777
4807
|
}));
|
|
4778
4808
|
case 12:
|
|
4779
4809
|
case "end":
|
|
4780
|
-
return
|
|
4810
|
+
return _context51.stop();
|
|
4781
4811
|
}
|
|
4782
|
-
},
|
|
4812
|
+
}, _callee51, this);
|
|
4783
4813
|
}));
|
|
4784
|
-
function sendCustomerPayLink(
|
|
4814
|
+
function sendCustomerPayLink(_x43) {
|
|
4785
4815
|
return _sendCustomerPayLink.apply(this, arguments);
|
|
4786
4816
|
}
|
|
4787
4817
|
return sendCustomerPayLink;
|
|
@@ -4794,27 +4824,27 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4794
4824
|
}, {
|
|
4795
4825
|
key: "calculateProductBookingPrice",
|
|
4796
4826
|
value: function () {
|
|
4797
|
-
var _calculateProductBookingPrice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4827
|
+
var _calculateProductBookingPrice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee52(params) {
|
|
4798
4828
|
var _params$customer_id;
|
|
4799
4829
|
var quotation, customerId, authoritativeProduct, product;
|
|
4800
|
-
return _regeneratorRuntime().wrap(function
|
|
4801
|
-
while (1) switch (
|
|
4830
|
+
return _regeneratorRuntime().wrap(function _callee52$(_context52) {
|
|
4831
|
+
while (1) switch (_context52.prev = _context52.next) {
|
|
4802
4832
|
case 0:
|
|
4803
4833
|
quotation = this.store.quotation;
|
|
4804
4834
|
customerId = (_params$customer_id = params.customer_id) !== null && _params$customer_id !== void 0 ? _params$customer_id : this.getCurrentOrderCustomerId();
|
|
4805
|
-
|
|
4835
|
+
_context52.next = 4;
|
|
4806
4836
|
return this.loadProductForPriceQuery(params, customerId);
|
|
4807
4837
|
case 4:
|
|
4808
|
-
authoritativeProduct =
|
|
4838
|
+
authoritativeProduct = _context52.sent;
|
|
4809
4839
|
product = this.mergeProductForPriceQuery(params.product, authoritativeProduct);
|
|
4810
|
-
|
|
4840
|
+
_context52.next = 8;
|
|
4811
4841
|
return this.loadQuotationForPriceQuery({
|
|
4812
4842
|
quotation: quotation,
|
|
4813
4843
|
customer_id: customerId,
|
|
4814
4844
|
channel: params.channel
|
|
4815
4845
|
});
|
|
4816
4846
|
case 8:
|
|
4817
|
-
return
|
|
4847
|
+
return _context52.abrupt("return", calculateBaseSalesProductBookingPrice(_objectSpread(_objectSpread({}, params), {}, {
|
|
4818
4848
|
product: product,
|
|
4819
4849
|
fallback_price: authoritativeProduct ? undefined : params.fallback_price,
|
|
4820
4850
|
customer_id: customerId,
|
|
@@ -4822,11 +4852,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4822
4852
|
})));
|
|
4823
4853
|
case 9:
|
|
4824
4854
|
case "end":
|
|
4825
|
-
return
|
|
4855
|
+
return _context52.stop();
|
|
4826
4856
|
}
|
|
4827
|
-
},
|
|
4857
|
+
}, _callee52, this);
|
|
4828
4858
|
}));
|
|
4829
|
-
function calculateProductBookingPrice(
|
|
4859
|
+
function calculateProductBookingPrice(_x44) {
|
|
4830
4860
|
return _calculateProductBookingPrice.apply(this, arguments);
|
|
4831
4861
|
}
|
|
4832
4862
|
return calculateProductBookingPrice;
|
|
@@ -4896,20 +4926,20 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4896
4926
|
}, {
|
|
4897
4927
|
key: "calculateProductBookingPrices",
|
|
4898
4928
|
value: function () {
|
|
4899
|
-
var _calculateProductBookingPrices = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4929
|
+
var _calculateProductBookingPrices = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee54(paramsList) {
|
|
4900
4930
|
var _paramsList$0$custome,
|
|
4901
4931
|
_paramsList$,
|
|
4902
4932
|
_this16 = this,
|
|
4903
4933
|
_paramsList$2;
|
|
4904
4934
|
var quotation, customerId, productMapsByGroup, groups;
|
|
4905
|
-
return _regeneratorRuntime().wrap(function
|
|
4906
|
-
while (1) switch (
|
|
4935
|
+
return _regeneratorRuntime().wrap(function _callee54$(_context54) {
|
|
4936
|
+
while (1) switch (_context54.prev = _context54.next) {
|
|
4907
4937
|
case 0:
|
|
4908
4938
|
if (paramsList.length) {
|
|
4909
|
-
|
|
4939
|
+
_context54.next = 2;
|
|
4910
4940
|
break;
|
|
4911
4941
|
}
|
|
4912
|
-
return
|
|
4942
|
+
return _context54.abrupt("return", []);
|
|
4913
4943
|
case 2:
|
|
4914
4944
|
quotation = this.store.quotation;
|
|
4915
4945
|
customerId = (_paramsList$0$custome = (_paramsList$ = paramsList[0]) === null || _paramsList$ === void 0 ? void 0 : _paramsList$.customer_id) !== null && _paramsList$0$custome !== void 0 ? _paramsList$0$custome : this.getCurrentOrderCustomerId();
|
|
@@ -4931,15 +4961,15 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4931
4961
|
group.ids.add(productId);
|
|
4932
4962
|
groups.set(groupKey, group);
|
|
4933
4963
|
});
|
|
4934
|
-
|
|
4964
|
+
_context54.next = 9;
|
|
4935
4965
|
return Promise.all(Array.from(groups.entries()).map( /*#__PURE__*/function () {
|
|
4936
|
-
var _ref40 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4966
|
+
var _ref40 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee53(_ref39) {
|
|
4937
4967
|
var _ref41, groupKey, group, productsById;
|
|
4938
|
-
return _regeneratorRuntime().wrap(function
|
|
4939
|
-
while (1) switch (
|
|
4968
|
+
return _regeneratorRuntime().wrap(function _callee53$(_context53) {
|
|
4969
|
+
while (1) switch (_context53.prev = _context53.next) {
|
|
4940
4970
|
case 0:
|
|
4941
4971
|
_ref41 = _slicedToArray(_ref39, 2), groupKey = _ref41[0], group = _ref41[1];
|
|
4942
|
-
|
|
4972
|
+
_context53.next = 3;
|
|
4943
4973
|
return _this16.loadProductsForPriceQuery({
|
|
4944
4974
|
ids: Array.from(group.ids),
|
|
4945
4975
|
schedule: group.schedule,
|
|
@@ -4947,27 +4977,27 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4947
4977
|
channel: group.channel
|
|
4948
4978
|
});
|
|
4949
4979
|
case 3:
|
|
4950
|
-
productsById =
|
|
4980
|
+
productsById = _context53.sent;
|
|
4951
4981
|
productMapsByGroup.set(groupKey, productsById);
|
|
4952
4982
|
case 5:
|
|
4953
4983
|
case "end":
|
|
4954
|
-
return
|
|
4984
|
+
return _context53.stop();
|
|
4955
4985
|
}
|
|
4956
|
-
},
|
|
4986
|
+
}, _callee53);
|
|
4957
4987
|
}));
|
|
4958
|
-
return function (
|
|
4988
|
+
return function (_x46) {
|
|
4959
4989
|
return _ref40.apply(this, arguments);
|
|
4960
4990
|
};
|
|
4961
4991
|
}()));
|
|
4962
4992
|
case 9:
|
|
4963
|
-
|
|
4993
|
+
_context54.next = 11;
|
|
4964
4994
|
return this.loadQuotationForPriceQuery({
|
|
4965
4995
|
quotation: quotation,
|
|
4966
4996
|
customer_id: customerId,
|
|
4967
4997
|
channel: (_paramsList$2 = paramsList[0]) === null || _paramsList$2 === void 0 ? void 0 : _paramsList$2.channel
|
|
4968
4998
|
});
|
|
4969
4999
|
case 11:
|
|
4970
|
-
return
|
|
5000
|
+
return _context54.abrupt("return", paramsList.map(function (params) {
|
|
4971
5001
|
var _this16$otherParams2, _productMapsByGroup$g;
|
|
4972
5002
|
var productInput = params.product || {};
|
|
4973
5003
|
var productId = _this16.getPriceQueryProductId(productInput);
|
|
@@ -4985,11 +5015,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4985
5015
|
}));
|
|
4986
5016
|
case 12:
|
|
4987
5017
|
case "end":
|
|
4988
|
-
return
|
|
5018
|
+
return _context54.stop();
|
|
4989
5019
|
}
|
|
4990
|
-
},
|
|
5020
|
+
}, _callee54, this);
|
|
4991
5021
|
}));
|
|
4992
|
-
function calculateProductBookingPrices(
|
|
5022
|
+
function calculateProductBookingPrices(_x45) {
|
|
4993
5023
|
return _calculateProductBookingPrices.apply(this, arguments);
|
|
4994
5024
|
}
|
|
4995
5025
|
return calculateProductBookingPrices;
|
|
@@ -4997,42 +5027,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4997
5027
|
}, {
|
|
4998
5028
|
key: "addProductToOrder",
|
|
4999
5029
|
value: function () {
|
|
5000
|
-
var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5001
|
-
var products;
|
|
5002
|
-
return _regeneratorRuntime().wrap(function _callee54$(_context54) {
|
|
5003
|
-
while (1) switch (_context54.prev = _context54.next) {
|
|
5004
|
-
case 0:
|
|
5005
|
-
_context54.prev = 0;
|
|
5006
|
-
if (this.store.order) {
|
|
5007
|
-
_context54.next = 3;
|
|
5008
|
-
break;
|
|
5009
|
-
}
|
|
5010
|
-
throw new Error('order 模块未初始化');
|
|
5011
|
-
case 3:
|
|
5012
|
-
_context54.next = 5;
|
|
5013
|
-
return this.store.order.addProductToOrder(product, booking, options);
|
|
5014
|
-
case 5:
|
|
5015
|
-
products = _context54.sent;
|
|
5016
|
-
return _context54.abrupt("return", products);
|
|
5017
|
-
case 9:
|
|
5018
|
-
_context54.prev = 9;
|
|
5019
|
-
_context54.t0 = _context54["catch"](0);
|
|
5020
|
-
throw _context54.t0;
|
|
5021
|
-
case 12:
|
|
5022
|
-
case "end":
|
|
5023
|
-
return _context54.stop();
|
|
5024
|
-
}
|
|
5025
|
-
}, _callee54, this, [[0, 9]]);
|
|
5026
|
-
}));
|
|
5027
|
-
function addProductToOrder(_x46, _x47, _x48) {
|
|
5028
|
-
return _addProductToOrder.apply(this, arguments);
|
|
5029
|
-
}
|
|
5030
|
-
return addProductToOrder;
|
|
5031
|
-
}()
|
|
5032
|
-
}, {
|
|
5033
|
-
key: "updateOrderProduct",
|
|
5034
|
-
value: function () {
|
|
5035
|
-
var _updateOrderProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee55(params) {
|
|
5030
|
+
var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee55(product, booking, options) {
|
|
5036
5031
|
var products;
|
|
5037
5032
|
return _regeneratorRuntime().wrap(function _callee55$(_context55) {
|
|
5038
5033
|
while (1) switch (_context55.prev = _context55.next) {
|
|
@@ -5045,7 +5040,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5045
5040
|
throw new Error('order 模块未初始化');
|
|
5046
5041
|
case 3:
|
|
5047
5042
|
_context55.next = 5;
|
|
5048
|
-
return this.store.order.
|
|
5043
|
+
return this.store.order.addProductToOrder(product, booking, options);
|
|
5049
5044
|
case 5:
|
|
5050
5045
|
products = _context55.sent;
|
|
5051
5046
|
return _context55.abrupt("return", products);
|
|
@@ -5059,15 +5054,15 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5059
5054
|
}
|
|
5060
5055
|
}, _callee55, this, [[0, 9]]);
|
|
5061
5056
|
}));
|
|
5062
|
-
function
|
|
5063
|
-
return
|
|
5057
|
+
function addProductToOrder(_x47, _x48, _x49) {
|
|
5058
|
+
return _addProductToOrder.apply(this, arguments);
|
|
5064
5059
|
}
|
|
5065
|
-
return
|
|
5060
|
+
return addProductToOrder;
|
|
5066
5061
|
}()
|
|
5067
5062
|
}, {
|
|
5068
|
-
key: "
|
|
5063
|
+
key: "updateOrderProduct",
|
|
5069
5064
|
value: function () {
|
|
5070
|
-
var
|
|
5065
|
+
var _updateOrderProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee56(params) {
|
|
5071
5066
|
var products;
|
|
5072
5067
|
return _regeneratorRuntime().wrap(function _callee56$(_context56) {
|
|
5073
5068
|
while (1) switch (_context56.prev = _context56.next) {
|
|
@@ -5080,7 +5075,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5080
5075
|
throw new Error('order 模块未初始化');
|
|
5081
5076
|
case 3:
|
|
5082
5077
|
_context56.next = 5;
|
|
5083
|
-
return this.store.order.
|
|
5078
|
+
return this.store.order.updateOrderProduct(params);
|
|
5084
5079
|
case 5:
|
|
5085
5080
|
products = _context56.sent;
|
|
5086
5081
|
return _context56.abrupt("return", products);
|
|
@@ -5094,15 +5089,15 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5094
5089
|
}
|
|
5095
5090
|
}, _callee56, this, [[0, 9]]);
|
|
5096
5091
|
}));
|
|
5097
|
-
function
|
|
5098
|
-
return
|
|
5092
|
+
function updateOrderProduct(_x50) {
|
|
5093
|
+
return _updateOrderProduct.apply(this, arguments);
|
|
5099
5094
|
}
|
|
5100
|
-
return
|
|
5095
|
+
return updateOrderProduct;
|
|
5101
5096
|
}()
|
|
5102
5097
|
}, {
|
|
5103
|
-
key: "
|
|
5098
|
+
key: "updateOrderProducts",
|
|
5104
5099
|
value: function () {
|
|
5105
|
-
var
|
|
5100
|
+
var _updateOrderProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee57(paramsList) {
|
|
5106
5101
|
var products;
|
|
5107
5102
|
return _regeneratorRuntime().wrap(function _callee57$(_context57) {
|
|
5108
5103
|
while (1) switch (_context57.prev = _context57.next) {
|
|
@@ -5115,7 +5110,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5115
5110
|
throw new Error('order 模块未初始化');
|
|
5116
5111
|
case 3:
|
|
5117
5112
|
_context57.next = 5;
|
|
5118
|
-
return this.store.order.
|
|
5113
|
+
return this.store.order.updateOrderProducts(paramsList);
|
|
5119
5114
|
case 5:
|
|
5120
5115
|
products = _context57.sent;
|
|
5121
5116
|
return _context57.abrupt("return", products);
|
|
@@ -5129,7 +5124,42 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5129
5124
|
}
|
|
5130
5125
|
}, _callee57, this, [[0, 9]]);
|
|
5131
5126
|
}));
|
|
5132
|
-
function
|
|
5127
|
+
function updateOrderProducts(_x51) {
|
|
5128
|
+
return _updateOrderProducts.apply(this, arguments);
|
|
5129
|
+
}
|
|
5130
|
+
return updateOrderProducts;
|
|
5131
|
+
}()
|
|
5132
|
+
}, {
|
|
5133
|
+
key: "updateOrderProductQuantity",
|
|
5134
|
+
value: function () {
|
|
5135
|
+
var _updateOrderProductQuantity = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee58(params) {
|
|
5136
|
+
var products;
|
|
5137
|
+
return _regeneratorRuntime().wrap(function _callee58$(_context58) {
|
|
5138
|
+
while (1) switch (_context58.prev = _context58.next) {
|
|
5139
|
+
case 0:
|
|
5140
|
+
_context58.prev = 0;
|
|
5141
|
+
if (this.store.order) {
|
|
5142
|
+
_context58.next = 3;
|
|
5143
|
+
break;
|
|
5144
|
+
}
|
|
5145
|
+
throw new Error('order 模块未初始化');
|
|
5146
|
+
case 3:
|
|
5147
|
+
_context58.next = 5;
|
|
5148
|
+
return this.store.order.updateOrderProductQuantity(params);
|
|
5149
|
+
case 5:
|
|
5150
|
+
products = _context58.sent;
|
|
5151
|
+
return _context58.abrupt("return", products);
|
|
5152
|
+
case 9:
|
|
5153
|
+
_context58.prev = 9;
|
|
5154
|
+
_context58.t0 = _context58["catch"](0);
|
|
5155
|
+
throw _context58.t0;
|
|
5156
|
+
case 12:
|
|
5157
|
+
case "end":
|
|
5158
|
+
return _context58.stop();
|
|
5159
|
+
}
|
|
5160
|
+
}, _callee58, this, [[0, 9]]);
|
|
5161
|
+
}));
|
|
5162
|
+
function updateOrderProductQuantity(_x52) {
|
|
5133
5163
|
return _updateOrderProductQuantity.apply(this, arguments);
|
|
5134
5164
|
}
|
|
5135
5165
|
return updateOrderProductQuantity;
|
|
@@ -5152,12 +5182,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5152
5182
|
}, {
|
|
5153
5183
|
key: "setOrderProductLineNote",
|
|
5154
5184
|
value: (function () {
|
|
5155
|
-
var _setOrderProductLineNote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5185
|
+
var _setOrderProductLineNote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee59(identity, note) {
|
|
5156
5186
|
var params, products;
|
|
5157
|
-
return _regeneratorRuntime().wrap(function
|
|
5158
|
-
while (1) switch (
|
|
5187
|
+
return _regeneratorRuntime().wrap(function _callee59$(_context59) {
|
|
5188
|
+
while (1) switch (_context59.prev = _context59.next) {
|
|
5159
5189
|
case 0:
|
|
5160
|
-
|
|
5190
|
+
_context59.prev = 0;
|
|
5161
5191
|
params = {
|
|
5162
5192
|
product_id: identity.product_id,
|
|
5163
5193
|
product_variant_id: identity.product_variant_id,
|
|
@@ -5172,22 +5202,22 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5172
5202
|
params.product_sku = identity.product_sku;
|
|
5173
5203
|
}
|
|
5174
5204
|
if (identity.product_bundle !== undefined) params.product_bundle = identity.product_bundle;
|
|
5175
|
-
|
|
5205
|
+
_context59.next = 7;
|
|
5176
5206
|
return this.updateOrderProduct(params);
|
|
5177
5207
|
case 7:
|
|
5178
|
-
products =
|
|
5179
|
-
return
|
|
5208
|
+
products = _context59.sent;
|
|
5209
|
+
return _context59.abrupt("return", products);
|
|
5180
5210
|
case 11:
|
|
5181
|
-
|
|
5182
|
-
|
|
5183
|
-
throw
|
|
5211
|
+
_context59.prev = 11;
|
|
5212
|
+
_context59.t0 = _context59["catch"](0);
|
|
5213
|
+
throw _context59.t0;
|
|
5184
5214
|
case 14:
|
|
5185
5215
|
case "end":
|
|
5186
|
-
return
|
|
5216
|
+
return _context59.stop();
|
|
5187
5217
|
}
|
|
5188
|
-
},
|
|
5218
|
+
}, _callee59, this, [[0, 11]]);
|
|
5189
5219
|
}));
|
|
5190
|
-
function setOrderProductLineNote(
|
|
5220
|
+
function setOrderProductLineNote(_x53, _x54) {
|
|
5191
5221
|
return _setOrderProductLineNote.apply(this, arguments);
|
|
5192
5222
|
}
|
|
5193
5223
|
return setOrderProductLineNote;
|
|
@@ -5202,32 +5232,32 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5202
5232
|
}, {
|
|
5203
5233
|
key: "removeProductsFromOrder",
|
|
5204
5234
|
value: (function () {
|
|
5205
|
-
var _removeProductsFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5206
|
-
return _regeneratorRuntime().wrap(function
|
|
5207
|
-
while (1) switch (
|
|
5235
|
+
var _removeProductsFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee60(identities, options) {
|
|
5236
|
+
return _regeneratorRuntime().wrap(function _callee60$(_context60) {
|
|
5237
|
+
while (1) switch (_context60.prev = _context60.next) {
|
|
5208
5238
|
case 0:
|
|
5209
|
-
|
|
5239
|
+
_context60.prev = 0;
|
|
5210
5240
|
if (this.store.order) {
|
|
5211
|
-
|
|
5241
|
+
_context60.next = 3;
|
|
5212
5242
|
break;
|
|
5213
5243
|
}
|
|
5214
5244
|
throw new Error('order 模块未初始化');
|
|
5215
5245
|
case 3:
|
|
5216
|
-
|
|
5246
|
+
_context60.next = 5;
|
|
5217
5247
|
return this.store.order.removeProductsFromOrder(identities, options);
|
|
5218
5248
|
case 5:
|
|
5219
|
-
return
|
|
5249
|
+
return _context60.abrupt("return", _context60.sent);
|
|
5220
5250
|
case 8:
|
|
5221
|
-
|
|
5222
|
-
|
|
5223
|
-
throw
|
|
5251
|
+
_context60.prev = 8;
|
|
5252
|
+
_context60.t0 = _context60["catch"](0);
|
|
5253
|
+
throw _context60.t0;
|
|
5224
5254
|
case 11:
|
|
5225
5255
|
case "end":
|
|
5226
|
-
return
|
|
5256
|
+
return _context60.stop();
|
|
5227
5257
|
}
|
|
5228
|
-
},
|
|
5258
|
+
}, _callee60, this, [[0, 8]]);
|
|
5229
5259
|
}));
|
|
5230
|
-
function removeProductsFromOrder(
|
|
5260
|
+
function removeProductsFromOrder(_x55, _x56) {
|
|
5231
5261
|
return _removeProductsFromOrder.apply(this, arguments);
|
|
5232
5262
|
}
|
|
5233
5263
|
return removeProductsFromOrder;
|
|
@@ -5235,18 +5265,18 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5235
5265
|
}, {
|
|
5236
5266
|
key: "removeProductFromOrder",
|
|
5237
5267
|
value: function () {
|
|
5238
|
-
var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5239
|
-
return _regeneratorRuntime().wrap(function
|
|
5240
|
-
while (1) switch (
|
|
5268
|
+
var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee61(identity, options) {
|
|
5269
|
+
return _regeneratorRuntime().wrap(function _callee61$(_context61) {
|
|
5270
|
+
while (1) switch (_context61.prev = _context61.next) {
|
|
5241
5271
|
case 0:
|
|
5242
|
-
return
|
|
5272
|
+
return _context61.abrupt("return", this.removeProductsFromOrder([identity], options));
|
|
5243
5273
|
case 1:
|
|
5244
5274
|
case "end":
|
|
5245
|
-
return
|
|
5275
|
+
return _context61.stop();
|
|
5246
5276
|
}
|
|
5247
|
-
},
|
|
5277
|
+
}, _callee61, this);
|
|
5248
5278
|
}));
|
|
5249
|
-
function removeProductFromOrder(
|
|
5279
|
+
function removeProductFromOrder(_x57, _x58) {
|
|
5250
5280
|
return _removeProductFromOrder.apply(this, arguments);
|
|
5251
5281
|
}
|
|
5252
5282
|
return removeProductFromOrder;
|
|
@@ -5296,23 +5326,23 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5296
5326
|
}, {
|
|
5297
5327
|
key: "applyPromotion",
|
|
5298
5328
|
value: (function () {
|
|
5299
|
-
var _applyPromotion = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5300
|
-
return _regeneratorRuntime().wrap(function
|
|
5301
|
-
while (1) switch (
|
|
5329
|
+
var _applyPromotion = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee62() {
|
|
5330
|
+
return _regeneratorRuntime().wrap(function _callee62$(_context62) {
|
|
5331
|
+
while (1) switch (_context62.prev = _context62.next) {
|
|
5302
5332
|
case 0:
|
|
5303
5333
|
if (this.store.order) {
|
|
5304
|
-
|
|
5334
|
+
_context62.next = 2;
|
|
5305
5335
|
break;
|
|
5306
5336
|
}
|
|
5307
5337
|
throw new Error('order 模块未初始化');
|
|
5308
5338
|
case 2:
|
|
5309
|
-
|
|
5339
|
+
_context62.next = 4;
|
|
5310
5340
|
return this.store.order.applyPromotion();
|
|
5311
5341
|
case 4:
|
|
5312
5342
|
case "end":
|
|
5313
|
-
return
|
|
5343
|
+
return _context62.stop();
|
|
5314
5344
|
}
|
|
5315
|
-
},
|
|
5345
|
+
}, _callee62, this);
|
|
5316
5346
|
}));
|
|
5317
5347
|
function applyPromotion() {
|
|
5318
5348
|
return _applyPromotion.apply(this, arguments);
|
|
@@ -5339,18 +5369,18 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5339
5369
|
}, {
|
|
5340
5370
|
key: "getProductList",
|
|
5341
5371
|
value: function () {
|
|
5342
|
-
var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5372
|
+
var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee63() {
|
|
5343
5373
|
var _this$otherParams33;
|
|
5344
5374
|
var menu_list_ids, _this$store$products, res;
|
|
5345
|
-
return _regeneratorRuntime().wrap(function
|
|
5346
|
-
while (1) switch (
|
|
5375
|
+
return _regeneratorRuntime().wrap(function _callee63$(_context63) {
|
|
5376
|
+
while (1) switch (_context63.prev = _context63.next) {
|
|
5347
5377
|
case 0:
|
|
5348
5378
|
// 可以直接通过配置里的 menu 读取
|
|
5349
5379
|
menu_list_ids = ((_this$otherParams33 = this.otherParams) === null || _this$otherParams33 === void 0 || (_this$otherParams33 = _this$otherParams33.dineInConfig) === null || _this$otherParams33 === void 0 ? void 0 : _this$otherParams33['menu.associated_menus'].map(function (n) {
|
|
5350
5380
|
return Number(n.value);
|
|
5351
5381
|
})) || [];
|
|
5352
|
-
|
|
5353
|
-
|
|
5382
|
+
_context63.prev = 1;
|
|
5383
|
+
_context63.next = 4;
|
|
5354
5384
|
return (_this$store$products = this.store.products) === null || _this$store$products === void 0 ? void 0 : _this$store$products.loadProducts({
|
|
5355
5385
|
menu_list_ids: menu_list_ids,
|
|
5356
5386
|
cacheId: this.cacheId,
|
|
@@ -5358,17 +5388,17 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5358
5388
|
schedule_datetime: dayjs().format('YYYY-MM-DD HH:mm:ss')
|
|
5359
5389
|
});
|
|
5360
5390
|
case 4:
|
|
5361
|
-
res =
|
|
5362
|
-
return
|
|
5391
|
+
res = _context63.sent;
|
|
5392
|
+
return _context63.abrupt("return", res);
|
|
5363
5393
|
case 8:
|
|
5364
|
-
|
|
5365
|
-
|
|
5366
|
-
throw
|
|
5394
|
+
_context63.prev = 8;
|
|
5395
|
+
_context63.t0 = _context63["catch"](1);
|
|
5396
|
+
throw _context63.t0;
|
|
5367
5397
|
case 11:
|
|
5368
5398
|
case "end":
|
|
5369
|
-
return
|
|
5399
|
+
return _context63.stop();
|
|
5370
5400
|
}
|
|
5371
|
-
},
|
|
5401
|
+
}, _callee63, this, [[1, 8]]);
|
|
5372
5402
|
}));
|
|
5373
5403
|
function getProductList() {
|
|
5374
5404
|
return _getProductList.apply(this, arguments);
|
|
@@ -5383,33 +5413,33 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
5383
5413
|
}, {
|
|
5384
5414
|
key: "setOtherParams",
|
|
5385
5415
|
value: function () {
|
|
5386
|
-
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5416
|
+
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee64(params) {
|
|
5387
5417
|
var _this$otherParams34;
|
|
5388
5418
|
var _ref42,
|
|
5389
5419
|
_ref42$cover,
|
|
5390
5420
|
cover,
|
|
5391
|
-
|
|
5392
|
-
return _regeneratorRuntime().wrap(function
|
|
5393
|
-
while (1) switch (
|
|
5421
|
+
_args64 = arguments;
|
|
5422
|
+
return _regeneratorRuntime().wrap(function _callee64$(_context64) {
|
|
5423
|
+
while (1) switch (_context64.prev = _context64.next) {
|
|
5394
5424
|
case 0:
|
|
5395
|
-
_ref42 =
|
|
5425
|
+
_ref42 = _args64.length > 1 && _args64[1] !== undefined ? _args64[1] : {}, _ref42$cover = _ref42.cover, cover = _ref42$cover === void 0 ? false : _ref42$cover;
|
|
5396
5426
|
if (cover) {
|
|
5397
5427
|
this.otherParams = _objectSpread({}, params);
|
|
5398
5428
|
} else {
|
|
5399
5429
|
this.otherParams = _objectSpread(_objectSpread({}, this.otherParams), params);
|
|
5400
5430
|
}
|
|
5401
5431
|
this.cacheId = (_this$otherParams34 = this.otherParams) === null || _this$otherParams34 === void 0 ? void 0 : _this$otherParams34.cacheId;
|
|
5402
|
-
|
|
5432
|
+
_context64.next = 5;
|
|
5403
5433
|
return this.syncOtherParamsToSubModules(params, {
|
|
5404
5434
|
cover: cover
|
|
5405
5435
|
});
|
|
5406
5436
|
case 5:
|
|
5407
5437
|
case "end":
|
|
5408
|
-
return
|
|
5438
|
+
return _context64.stop();
|
|
5409
5439
|
}
|
|
5410
|
-
},
|
|
5440
|
+
}, _callee64, this);
|
|
5411
5441
|
}));
|
|
5412
|
-
function setOtherParams(
|
|
5442
|
+
function setOtherParams(_x59) {
|
|
5413
5443
|
return _setOtherParams.apply(this, arguments);
|
|
5414
5444
|
}
|
|
5415
5445
|
return setOtherParams;
|