@pisell/pisellos 2.2.276 → 2.2.277

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