@pisell/pisellos 2.2.152 → 2.2.154

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.
Files changed (92) hide show
  1. package/dist/core/index.js +1 -0
  2. package/dist/model/strategy/adapter/promotion/index.js +9 -0
  3. package/dist/modules/Cart/utils/cartProduct.js +1 -1
  4. package/dist/modules/Discount/index.d.ts +6 -2
  5. package/dist/modules/Discount/index.js +14 -8
  6. package/dist/modules/Order/index.d.ts +2 -0
  7. package/dist/modules/Order/index.js +234 -161
  8. package/dist/modules/Order/types.d.ts +19 -0
  9. package/dist/modules/Order/utils.js +7 -6
  10. package/dist/modules/Payment/index.d.ts +4 -0
  11. package/dist/modules/Payment/index.js +567 -505
  12. package/dist/modules/Payment/types.d.ts +29 -9
  13. package/dist/modules/SalesSummary/index.d.ts +7 -5
  14. package/dist/modules/SalesSummary/index.js +35 -11
  15. package/dist/plugins/app.d.ts +2 -0
  16. package/dist/server/index.d.ts +2 -5
  17. package/dist/server/index.js +58 -66
  18. package/dist/server/modules/index.d.ts +1 -1
  19. package/dist/server/modules/products/index.d.ts +12 -1
  20. package/dist/server/modules/products/index.js +169 -78
  21. package/dist/server/modules/products/types.d.ts +11 -0
  22. package/dist/server/modules/products/types.js +4 -0
  23. package/dist/server/utils/product.js +2 -2
  24. package/dist/solution/BaseSales/index.d.ts +26 -2
  25. package/dist/solution/BaseSales/index.js +342 -112
  26. package/dist/solution/BaseSales/types.d.ts +4 -4
  27. package/dist/solution/BaseSales/types.js +4 -4
  28. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +62 -0
  29. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +116 -0
  30. package/dist/solution/BaseSales/utils.js +3 -3
  31. package/dist/solution/BookingByStep/index.d.ts +1 -1
  32. package/dist/solution/BookingTicket/index.d.ts +11 -13
  33. package/dist/solution/BookingTicket/index.js +23 -37
  34. package/dist/solution/BookingTicket/types.d.ts +9 -6
  35. package/dist/solution/BookingTicket/types.js +6 -3
  36. package/dist/solution/BookingTicket/utils/cartView.d.ts +7 -12
  37. package/dist/solution/BookingTicket/utils/cartView.js +52 -14
  38. package/dist/solution/BookingTicket/utils/orderCustomer.d.ts +4 -0
  39. package/dist/solution/BookingTicket/utils/orderCustomer.js +31 -0
  40. package/dist/solution/Sales/index.d.ts +3 -0
  41. package/dist/solution/Sales/index.js +85 -43
  42. package/dist/solution/Sales/types.d.ts +3 -0
  43. package/dist/solution/ScanOrder/types.d.ts +4 -4
  44. package/dist/solution/ScanOrder/types.js +4 -4
  45. package/dist/solution/ScanOrder/utils.js +3 -3
  46. package/dist/solution/ShopDiscount/index.d.ts +2 -1
  47. package/dist/solution/ShopDiscount/index.js +32 -20
  48. package/dist/solution/ShopDiscount/types.d.ts +1 -0
  49. package/lib/core/index.js +1 -0
  50. package/lib/modules/Cart/utils/cartProduct.js +1 -1
  51. package/lib/modules/Discount/index.d.ts +6 -2
  52. package/lib/modules/Discount/index.js +3 -1
  53. package/lib/modules/Order/index.d.ts +2 -0
  54. package/lib/modules/Order/index.js +40 -8
  55. package/lib/modules/Order/types.d.ts +19 -0
  56. package/lib/modules/Order/utils.js +4 -2
  57. package/lib/modules/Payment/index.d.ts +4 -0
  58. package/lib/modules/Payment/index.js +26 -2
  59. package/lib/modules/Payment/types.d.ts +29 -9
  60. package/lib/modules/SalesSummary/index.d.ts +7 -5
  61. package/lib/modules/SalesSummary/index.js +29 -9
  62. package/lib/plugins/app.d.ts +2 -0
  63. package/lib/server/index.d.ts +2 -5
  64. package/lib/server/index.js +38 -58
  65. package/lib/server/modules/index.d.ts +1 -1
  66. package/lib/server/modules/products/index.d.ts +12 -1
  67. package/lib/server/modules/products/index.js +69 -9
  68. package/lib/server/modules/products/types.d.ts +11 -0
  69. package/lib/server/utils/product.js +2 -2
  70. package/lib/solution/BaseSales/index.d.ts +26 -2
  71. package/lib/solution/BaseSales/index.js +169 -3
  72. package/lib/solution/BaseSales/types.d.ts +4 -4
  73. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +62 -0
  74. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +155 -0
  75. package/lib/solution/BaseSales/utils.js +3 -3
  76. package/lib/solution/BookingByStep/index.d.ts +1 -1
  77. package/lib/solution/BookingTicket/index.d.ts +11 -13
  78. package/lib/solution/BookingTicket/index.js +17 -27
  79. package/lib/solution/BookingTicket/types.d.ts +9 -6
  80. package/lib/solution/BookingTicket/utils/cartView.d.ts +7 -12
  81. package/lib/solution/BookingTicket/utils/cartView.js +44 -18
  82. package/lib/solution/BookingTicket/utils/orderCustomer.d.ts +4 -0
  83. package/lib/solution/BookingTicket/utils/orderCustomer.js +58 -0
  84. package/lib/solution/Sales/index.d.ts +3 -0
  85. package/lib/solution/Sales/index.js +50 -15
  86. package/lib/solution/Sales/types.d.ts +3 -0
  87. package/lib/solution/ScanOrder/types.d.ts +4 -4
  88. package/lib/solution/ScanOrder/utils.js +3 -3
  89. package/lib/solution/ShopDiscount/index.d.ts +2 -1
  90. package/lib/solution/ShopDiscount/index.js +10 -4
  91. package/lib/solution/ShopDiscount/types.d.ts +1 -0
  92. package/package.json +1 -1
@@ -29,6 +29,7 @@ import { createModule } from "../BookingByStep/types";
29
29
  import { composeLinePrice, sumOptionUnitPrice } from "../../modules/Order/utils";
30
30
  import dayjs from 'dayjs';
31
31
  export * from "./types";
32
+ import { transformBaseProductToOrderProduct as _transformBaseProductToOrderProduct } from "./utils/transformBaseProductToOrderProduct";
32
33
  export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
33
34
  _inherits(BaseSalesImpl, _BaseModule);
34
35
  var _super = _createSuper(BaseSalesImpl);
@@ -40,6 +41,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
40
41
  _defineProperty(_assertThisInitialized(_this), "defaultVersion", '1.0.0');
41
42
  _defineProperty(_assertThisInitialized(_this), "isSolution", true);
42
43
  _defineProperty(_assertThisInitialized(_this), "initializeOptions", {});
44
+ _defineProperty(_assertThisInitialized(_this), "logger", void 0);
45
+ // LoggerManager 实例
43
46
  _defineProperty(_assertThisInitialized(_this), "store", {
44
47
  order: undefined
45
48
  });
@@ -58,12 +61,65 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
58
61
 
59
62
  /**
60
63
  * 子类可覆盖此方法以追加/收敛要注册的子模块。
61
- * 默认包含通用销售模块:products / order / salesSummary / schedule。
64
+ * 默认包含通用销售模块:products / order / salesSummary / schedule / payment
62
65
  */
63
66
  _createClass(BaseSalesImpl, [{
64
67
  key: "getRegisteredModuleNames",
65
68
  value: function getRegisteredModuleNames() {
66
- return ['products', 'order', 'salesSummary', 'schedule'];
69
+ return ['products', 'order', 'salesSummary', 'schedule', 'payment'];
70
+ }
71
+
72
+ /**
73
+ * 记录信息日志
74
+ */
75
+ }, {
76
+ key: "logInfo",
77
+ value: function logInfo(title, metadata) {
78
+ if (this.logger) {
79
+ var tempOrder = this.getTempOrder();
80
+ this.logger.addLog({
81
+ type: 'info',
82
+ title: "[BaseSales] ".concat(tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.order_id, " ").concat(tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.external_sale_number, " ").concat(title),
83
+ metadata: metadata || {}
84
+ });
85
+ }
86
+ }
87
+
88
+ /**
89
+ * 记录警告日志
90
+ */
91
+ }, {
92
+ key: "logWarning",
93
+ value: function logWarning(title, metadata) {
94
+ if (this.logger) {
95
+ var tempOrder = this.getTempOrder();
96
+ this.logger.addLog({
97
+ type: 'warning',
98
+ title: "[BaseSales] ".concat(tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.order_id, " ").concat(tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.external_sale_number, " ").concat(title),
99
+ metadata: metadata || {}
100
+ });
101
+ }
102
+ }
103
+
104
+ /**
105
+ * 记录错误日志
106
+ */
107
+ }, {
108
+ key: "logError",
109
+ value: function logError(title, metadata) {
110
+ if (this.logger) {
111
+ var tempOrder = this.getTempOrder();
112
+ this.logger.addLog({
113
+ type: 'error',
114
+ title: "[BaseSales] ".concat(tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.order_id, " ").concat(tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.external_sale_number, " ").concat(title),
115
+ metadata: metadata || {}
116
+ });
117
+ }
118
+ }
119
+ }, {
120
+ key: "payment",
121
+ get: function get() {
122
+ return this.store.payment;
67
123
  }
68
124
 
69
125
  /**
@@ -76,6 +132,19 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
76
132
  value: function createSubModule(moduleName) {
77
133
  return createModule(moduleName, this.name);
78
134
  }
135
+ }, {
136
+ key: "getSubModuleHooks",
137
+ value: function getSubModuleHooks(moduleName) {
138
+ var _this$otherParams$mod;
139
+ var optionHooks = this.initializeOptions.hooks || {};
140
+ var otherHooks = this.otherParams.hooks || {};
141
+ if (moduleName === 'order') {
142
+ var _this$otherParams$ord;
143
+ var directOrderHooks = optionHooks;
144
+ return optionHooks.order || ((_this$otherParams$ord = this.otherParams.order) === null || _this$otherParams$ord === void 0 ? void 0 : _this$otherParams$ord.hooks) || otherHooks.order || (directOrderHooks.onBeforeMergeProductToOrder ? directOrderHooks : undefined);
145
+ }
146
+ return optionHooks[moduleName] || ((_this$otherParams$mod = this.otherParams[moduleName]) === null || _this$otherParams$mod === void 0 ? void 0 : _this$otherParams$mod.hooks) || otherHooks[moduleName];
147
+ }
79
148
 
80
149
  /**
81
150
  * 读取 sessionStorage[this.name][cacheId],作为子模块 initialState 的来源。
@@ -101,6 +170,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
101
170
  var _this$otherParams,
102
171
  _this2 = this;
103
172
  var options,
173
+ appPlugin,
174
+ app,
104
175
  targetCacheData,
105
176
  moduleNames,
106
177
  _args = arguments;
@@ -115,6 +186,17 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
115
186
  this.cacheId = (_this$otherParams = this.otherParams) === null || _this$otherParams === void 0 ? void 0 : _this$otherParams.cacheId;
116
187
  this.window = core.getPlugin('window');
117
188
  this.request = core.getPlugin('request');
189
+
190
+ // 获取 logger 实例
191
+ appPlugin = core.getPlugin('app');
192
+ if (appPlugin) {
193
+ _context.next = 10;
194
+ break;
195
+ }
196
+ throw new Error('Checkout 解决方案需要 app 插件支持');
197
+ case 10:
198
+ app = appPlugin.getApp();
199
+ this.logger = app.logger;
118
200
  targetCacheData = this.readSessionCacheData();
119
201
  moduleNames = this.getRegisteredModuleNames();
120
202
  moduleNames.forEach(function (step) {
@@ -122,26 +204,30 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
122
204
  if (!targetModule) {
123
205
  throw new Error("\u6A21\u5757 ".concat(step, " \u4E0D\u5B58\u5728"));
124
206
  }
207
+ var hooks = _this2.getSubModuleHooks(step);
125
208
  _this2.store[step] = targetModule;
126
- _this2.core.registerModule(targetModule, {
127
- initialState: (targetCacheData === null || targetCacheData === void 0 ? void 0 : targetCacheData[targetModule.name]) || {},
209
+ _this2.core.registerModule(targetModule, _objectSpread(_objectSpread({
210
+ initialState: (targetCacheData === null || targetCacheData === void 0 ? void 0 : targetCacheData[targetModule.name]) || {}
211
+ }, hooks ? {
212
+ hooks: hooks
213
+ } : {}), {}, {
128
214
  otherParams: _objectSpread(_objectSpread({}, _this2.otherParams), {}, {
129
215
  salesSummaryModuleName: "".concat(_this2.name, "_salesSummary"),
130
216
  fatherModule: _this2.name,
131
217
  openCache: _this2.cacheId ? true : false,
132
218
  cacheId: _this2.cacheId
133
219
  })
134
- });
220
+ }));
135
221
  });
136
222
  if (!this.store.schedule) {
137
- _context.next = 13;
223
+ _context.next = 18;
138
224
  break;
139
225
  }
140
- _context.next = 13;
226
+ _context.next = 18;
141
227
  return this.store.schedule.loadAllSchedule();
142
- case 13:
228
+ case 18:
143
229
  this.core.effects.emit("".concat(this.name, ":onInited"), {});
144
- case 14:
230
+ case 19:
145
231
  case "end":
146
232
  return _context.stop();
147
233
  }
@@ -431,11 +517,17 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
431
517
  }
432
518
  }
433
519
  }, {
434
- key: "updateOrderShopDiscount",
435
- value: function updateOrderShopDiscount(amount) {
520
+ key: "updateTempOrderShopDiscount",
521
+ value: function updateTempOrderShopDiscount(amount) {
436
522
  if (!this.store.order) throw new Error('order 模块未初始化');
437
523
  return this.store.order.updateTempOrderShopDiscount(amount);
438
524
  }
525
+ }, {
526
+ key: "updateTempOrderContactsInfo",
527
+ value: function updateTempOrderContactsInfo(contactsInfo) {
528
+ if (!this.store.order) throw new Error('order 模块未初始化');
529
+ return this.store.order.updateTempOrderContactsInfo(contactsInfo);
530
+ }
439
531
  }, {
440
532
  key: "ensureTempOrder",
441
533
  value: function ensureTempOrder() {
@@ -938,7 +1030,134 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
938
1030
  if (!this.store.order) throw new Error('order 模块未初始化');
939
1031
  return this.store.order.updateVoucherOrderPayments(payments);
940
1032
  }
941
-
1033
+ }, {
1034
+ key: "getWalletProductList",
1035
+ value: function getWalletProductList() {
1036
+ var _this$store$order2, _tempOrder$products;
1037
+ var tempOrder = (_this$store$order2 = this.store.order) === null || _this$store$order2 === void 0 ? void 0 : _this$store$order2.getTempOrder();
1038
+ if (!(tempOrder !== null && tempOrder !== void 0 && (_tempOrder$products = tempOrder.products) !== null && _tempOrder$products !== void 0 && _tempOrder$products.length)) return [];
1039
+ return tempOrder.products.map(function (product) {
1040
+ var _product$product_vari, _product$is_charge_ta, _product$holder_id, _metadata$main_produc, _metadata$main_produc2;
1041
+ var metadata = product.metadata || {};
1042
+ return {
1043
+ product_id: product.product_id,
1044
+ product_variant_id: String((_product$product_vari = product.product_variant_id) !== null && _product$product_vari !== void 0 ? _product$product_vari : ''),
1045
+ quantity: product.num || 1,
1046
+ is_price_include_tax: tempOrder.is_price_include_tax,
1047
+ is_charge_tax: (_product$is_charge_ta = product.is_charge_tax) !== null && _product$is_charge_ta !== void 0 ? _product$is_charge_ta : 0,
1048
+ tax_fee: product.tax_fee,
1049
+ selling_price: Number(product.selling_price || 0),
1050
+ holder_id: (_product$holder_id = product.holder_id) !== null && _product$holder_id !== void 0 ? _product$holder_id : metadata.holder_id,
1051
+ original_price: product.original_price,
1052
+ main_product_original_price: (_metadata$main_produc = metadata.main_product_original_price) !== null && _metadata$main_produc !== void 0 ? _metadata$main_produc : product.original_price,
1053
+ main_product_selling_price: (_metadata$main_produc2 = metadata.main_product_selling_price) !== null && _metadata$main_produc2 !== void 0 ? _metadata$main_produc2 : product.selling_price,
1054
+ metadata: {
1055
+ main_product_attached_bundle_tax_fee: metadata.main_product_attached_bundle_tax_fee,
1056
+ main_product_attached_bundle_surcharge_fee: metadata.main_product_attached_bundle_surcharge_fee,
1057
+ surcharge_rounding_remainder: metadata.surcharge_rounding_remainder
1058
+ },
1059
+ product_bundle: (product.product_bundle || []).map(function (bundle) {
1060
+ var bundleMetadata = bundle.metadata || {};
1061
+ return {
1062
+ is_price_include_tax: tempOrder.is_price_include_tax,
1063
+ bundle_id: bundle.bundle_id,
1064
+ bundle_product_id: bundle.bundle_product_id,
1065
+ bundle_variant_id: bundle.bundle_variant_id,
1066
+ price_type: bundle.price_type,
1067
+ price_type_ext: bundle.price_type_ext,
1068
+ bundle_sum_price: bundle.bundle_sum_price,
1069
+ bundle_selling_price: bundle.bundle_selling_price,
1070
+ num: bundle.num,
1071
+ is_charge_tax: bundle.is_charge_tax,
1072
+ tax_fee: bundle.tax_fee,
1073
+ metadata: {
1074
+ surcharge_fee: bundleMetadata.surcharge_fee,
1075
+ surcharge_rounding_remainder: bundleMetadata.surcharge_rounding_remainder
1076
+ }
1077
+ };
1078
+ })
1079
+ };
1080
+ });
1081
+ }
1082
+ }, {
1083
+ key: "initWalletData",
1084
+ value: function () {
1085
+ var _initWalletData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(params) {
1086
+ var _params$order_wait_pa, _ref, _tempOrder$is_price_i;
1087
+ var snapshot, tempOrder, amount, walletBusinessData, result;
1088
+ return _regeneratorRuntime().wrap(function _callee13$(_context13) {
1089
+ while (1) switch (_context13.prev = _context13.next) {
1090
+ case 0:
1091
+ if (this.store.order) {
1092
+ _context13.next = 2;
1093
+ break;
1094
+ }
1095
+ throw new Error('order 模块未初始化');
1096
+ case 2:
1097
+ if (this.store.payment) {
1098
+ _context13.next = 4;
1099
+ break;
1100
+ }
1101
+ throw new Error('payment 模块未初始化');
1102
+ case 4:
1103
+ snapshot = this.store.order.getOrderSnapshot();
1104
+ tempOrder = snapshot === null || snapshot === void 0 ? void 0 : snapshot.tempOrder;
1105
+ amount = snapshot === null || snapshot === void 0 ? void 0 : snapshot.amount;
1106
+ if (!(!tempOrder || !amount)) {
1107
+ _context13.next = 9;
1108
+ break;
1109
+ }
1110
+ return _context13.abrupt("return", {
1111
+ walletRecommendList: [],
1112
+ userIdentificationCodes: [],
1113
+ transformList: [],
1114
+ noApplicableVoucher: [],
1115
+ products: []
1116
+ });
1117
+ case 9:
1118
+ walletBusinessData = _objectSpread({
1119
+ customer_id: tempOrder.customer_id ? Number(tempOrder.customer_id) : undefined,
1120
+ holder: tempOrder.holder,
1121
+ amountInfo: {
1122
+ totalAmount: amount.totalAmount,
1123
+ subTotal: amount.summary.product_amount || amount.summary.product_expect_amount || amount.totalAmount,
1124
+ depositAmount: amount.depositAmount,
1125
+ isDeposit: tempOrder.is_deposit
1126
+ },
1127
+ products: this.getWalletProductList(),
1128
+ order_wait_pay_amount: (_params$order_wait_pa = params === null || params === void 0 ? void 0 : params.order_wait_pay_amount) !== null && _params$order_wait_pa !== void 0 ? _params$order_wait_pa : Number(amount.amountGap || 0),
1129
+ is_price_include_tax: (_ref = (_tempOrder$is_price_i = tempOrder.is_price_include_tax) !== null && _tempOrder$is_price_i !== void 0 ? _tempOrder$is_price_i : this.otherParams.is_price_include_tax) !== null && _ref !== void 0 ? _ref : 1
1130
+ }, snapshot.identity.orderId ? {
1131
+ payment_order_id: String(snapshot.identity.orderId)
1132
+ } : {});
1133
+ _context13.next = 12;
1134
+ return this.store.payment.wallet.initializeWalletDataFromBusinessAsync(walletBusinessData);
1135
+ case 12:
1136
+ result = _context13.sent;
1137
+ _context13.next = 15;
1138
+ return this.core.effects.emit("".concat(this.name, ":onWalletDataInitialized"), {
1139
+ orderId: snapshot.identity.orderId,
1140
+ customerId: walletBusinessData.customer_id,
1141
+ walletBusinessData: {
1142
+ customer_id: walletBusinessData.customer_id,
1143
+ amountInfo: walletBusinessData.amountInfo,
1144
+ order_wait_pay_amount: walletBusinessData.order_wait_pay_amount
1145
+ },
1146
+ timestamp: Date.now()
1147
+ });
1148
+ case 15:
1149
+ return _context13.abrupt("return", result);
1150
+ case 16:
1151
+ case "end":
1152
+ return _context13.stop();
1153
+ }
1154
+ }, _callee13, this);
1155
+ }));
1156
+ function initWalletData(_x9) {
1157
+ return _initWalletData.apply(this, arguments);
1158
+ }
1159
+ return initWalletData;
1160
+ }()
942
1161
  /**
943
1162
  * 更新当前订单客户字段。
944
1163
  *
@@ -961,21 +1180,27 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
961
1180
  }, {
962
1181
  key: "getPaymentMethodsAsync",
963
1182
  value: (function () {
964
- var _getPaymentMethodsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
1183
+ var _getPaymentMethodsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
965
1184
  var response;
966
- return _regeneratorRuntime().wrap(function _callee13$(_context13) {
967
- while (1) switch (_context13.prev = _context13.next) {
1185
+ return _regeneratorRuntime().wrap(function _callee14$(_context14) {
1186
+ while (1) switch (_context14.prev = _context14.next) {
968
1187
  case 0:
969
- _context13.next = 2;
970
- return this.request.get('/pay/custom-payment/all');
1188
+ if (!this.store.payment) {
1189
+ _context14.next = 2;
1190
+ break;
1191
+ }
1192
+ return _context14.abrupt("return", this.store.payment.getPayMethodListAsync());
971
1193
  case 2:
972
- response = _context13.sent;
973
- return _context13.abrupt("return", (response === null || response === void 0 ? void 0 : response.data) || []);
1194
+ _context14.next = 4;
1195
+ return this.request.get('/pay/custom-payment/all');
974
1196
  case 4:
1197
+ response = _context14.sent;
1198
+ return _context14.abrupt("return", (response === null || response === void 0 ? void 0 : response.data) || []);
1199
+ case 6:
975
1200
  case "end":
976
- return _context13.stop();
1201
+ return _context14.stop();
977
1202
  }
978
- }, _callee13, this);
1203
+ }, _callee14, this);
979
1204
  }));
980
1205
  function getPaymentMethodsAsync() {
981
1206
  return _getPaymentMethodsAsync.apply(this, arguments);
@@ -1016,84 +1241,89 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1016
1241
  }, {
1017
1242
  key: "sendCustomerPayLink",
1018
1243
  value: (function () {
1019
- var _sendCustomerPayLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(params) {
1020
- var orderIds, _ref, _ref2, _submitResult$data$or, _submitResult$data, _submitResult$data2, submitResult, orderId;
1021
- return _regeneratorRuntime().wrap(function _callee14$(_context14) {
1022
- while (1) switch (_context14.prev = _context14.next) {
1244
+ var _sendCustomerPayLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(params) {
1245
+ var orderIds, _ref2, _ref3, _submitResult$data$or, _submitResult$data, _submitResult$data2, submitResult, orderId;
1246
+ return _regeneratorRuntime().wrap(function _callee15$(_context15) {
1247
+ while (1) switch (_context15.prev = _context15.next) {
1023
1248
  case 0:
1024
1249
  if (this.store.order) {
1025
- _context14.next = 2;
1250
+ _context15.next = 2;
1026
1251
  break;
1027
1252
  }
1028
1253
  throw new Error('order 模块未初始化');
1029
1254
  case 2:
1030
1255
  orderIds = params.order_ids || params.orderIds || [];
1031
1256
  if (!(!orderIds.length || params.submitBeforeSend)) {
1032
- _context14.next = 11;
1257
+ _context15.next = 11;
1033
1258
  break;
1034
1259
  }
1035
- _context14.next = 6;
1260
+ _context15.next = 6;
1036
1261
  return this.submitSalesOrder({
1037
1262
  smallTicketDataFlag: 1
1038
1263
  });
1039
1264
  case 6:
1040
- submitResult = _context14.sent;
1041
- orderId = (_ref = (_ref2 = (_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 && _ref2 !== void 0 ? _ref2 : submitResult === null || submitResult === void 0 || (_submitResult$data2 = submitResult.data) === null || _submitResult$data2 === void 0 ? void 0 : _submitResult$data2.id) !== null && _ref !== void 0 ? _ref : submitResult === null || submitResult === void 0 ? void 0 : submitResult.id;
1265
+ submitResult = _context15.sent;
1266
+ orderId = (_ref2 = (_ref3 = (_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 && _ref3 !== void 0 ? _ref3 : submitResult === null || submitResult === void 0 || (_submitResult$data2 = submitResult.data) === null || _submitResult$data2 === void 0 ? void 0 : _submitResult$data2.id) !== null && _ref2 !== void 0 ? _ref2 : submitResult === null || submitResult === void 0 ? void 0 : submitResult.id;
1042
1267
  if (orderId) {
1043
- _context14.next = 10;
1268
+ _context15.next = 10;
1044
1269
  break;
1045
1270
  }
1046
1271
  throw new Error('本地订单提交云端失败,无法发送支付链接');
1047
1272
  case 10:
1048
1273
  orderIds = [orderId];
1049
1274
  case 11:
1050
- return _context14.abrupt("return", this.store.order.sendCustomerPayLink({
1275
+ return _context15.abrupt("return", this.store.order.sendCustomerPayLink({
1051
1276
  emails: params.emails,
1052
1277
  notify_action: params.notify_action,
1053
1278
  order_ids: orderIds
1054
1279
  }));
1055
1280
  case 12:
1056
1281
  case "end":
1057
- return _context14.stop();
1282
+ return _context15.stop();
1058
1283
  }
1059
- }, _callee14, this);
1284
+ }, _callee15, this);
1060
1285
  }));
1061
- function sendCustomerPayLink(_x9) {
1286
+ function sendCustomerPayLink(_x10) {
1062
1287
  return _sendCustomerPayLink.apply(this, arguments);
1063
1288
  }
1064
1289
  return sendCustomerPayLink;
1065
1290
  }())
1291
+ }, {
1292
+ key: "transformBaseProductToOrderProduct",
1293
+ value: function transformBaseProductToOrderProduct(params) {
1294
+ return _transformBaseProductToOrderProduct(params);
1295
+ }
1066
1296
  }, {
1067
1297
  key: "addProductToOrder",
1068
1298
  value: function () {
1069
- var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(product, booking) {
1299
+ var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(product, booking) {
1070
1300
  var products;
1071
- return _regeneratorRuntime().wrap(function _callee15$(_context15) {
1072
- while (1) switch (_context15.prev = _context15.next) {
1301
+ return _regeneratorRuntime().wrap(function _callee16$(_context16) {
1302
+ while (1) switch (_context16.prev = _context16.next) {
1073
1303
  case 0:
1074
- _context15.prev = 0;
1304
+ _context16.prev = 0;
1075
1305
  if (this.store.order) {
1076
- _context15.next = 3;
1306
+ _context16.next = 3;
1077
1307
  break;
1078
1308
  }
1079
1309
  throw new Error('order 模块未初始化');
1080
1310
  case 3:
1081
- _context15.next = 5;
1311
+ _context16.next = 5;
1082
1312
  return this.store.order.addProductToOrder(product, booking);
1083
1313
  case 5:
1084
- products = _context15.sent;
1085
- return _context15.abrupt("return", products);
1314
+ products = _context16.sent;
1315
+ return _context16.abrupt("return", products);
1086
1316
  case 9:
1087
- _context15.prev = 9;
1088
- _context15.t0 = _context15["catch"](0);
1089
- throw _context15.t0;
1317
+ _context16.prev = 9;
1318
+ _context16.t0 = _context16["catch"](0);
1319
+ throw _context16.t0;
1090
1320
  case 12:
1091
1321
  case "end":
1092
- return _context15.stop();
1322
+ return _context16.stop();
1093
1323
  }
1094
- }, _callee15, this, [[0, 9]]);
1324
+ }, _callee16, this, [[0, 9]]);
1095
1325
  }));
1096
- function addProductToOrder(_x10, _x11) {
1326
+ function addProductToOrder(_x11, _x12) {
1097
1327
  return _addProductToOrder.apply(this, arguments);
1098
1328
  }
1099
1329
  return addProductToOrder;
@@ -1101,34 +1331,34 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1101
1331
  }, {
1102
1332
  key: "updateProductInOrder",
1103
1333
  value: function () {
1104
- var _updateProductInOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(params) {
1334
+ var _updateProductInOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(params) {
1105
1335
  var products;
1106
- return _regeneratorRuntime().wrap(function _callee16$(_context16) {
1107
- while (1) switch (_context16.prev = _context16.next) {
1336
+ return _regeneratorRuntime().wrap(function _callee17$(_context17) {
1337
+ while (1) switch (_context17.prev = _context17.next) {
1108
1338
  case 0:
1109
- _context16.prev = 0;
1339
+ _context17.prev = 0;
1110
1340
  if (this.store.order) {
1111
- _context16.next = 3;
1341
+ _context17.next = 3;
1112
1342
  break;
1113
1343
  }
1114
1344
  throw new Error('order 模块未初始化');
1115
1345
  case 3:
1116
- _context16.next = 5;
1346
+ _context17.next = 5;
1117
1347
  return this.store.order.updateProductInOrder(params);
1118
1348
  case 5:
1119
- products = _context16.sent;
1120
- return _context16.abrupt("return", products);
1349
+ products = _context17.sent;
1350
+ return _context17.abrupt("return", products);
1121
1351
  case 9:
1122
- _context16.prev = 9;
1123
- _context16.t0 = _context16["catch"](0);
1124
- throw _context16.t0;
1352
+ _context17.prev = 9;
1353
+ _context17.t0 = _context17["catch"](0);
1354
+ throw _context17.t0;
1125
1355
  case 12:
1126
1356
  case "end":
1127
- return _context16.stop();
1357
+ return _context17.stop();
1128
1358
  }
1129
- }, _callee16, this, [[0, 9]]);
1359
+ }, _callee17, this, [[0, 9]]);
1130
1360
  }));
1131
- function updateProductInOrder(_x12) {
1361
+ function updateProductInOrder(_x13) {
1132
1362
  return _updateProductInOrder.apply(this, arguments);
1133
1363
  }
1134
1364
  return updateProductInOrder;
@@ -1140,12 +1370,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1140
1370
  }, {
1141
1371
  key: "setOrderProductLineNote",
1142
1372
  value: (function () {
1143
- var _setOrderProductLineNote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(identity, note) {
1373
+ var _setOrderProductLineNote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(identity, note) {
1144
1374
  var params, products;
1145
- return _regeneratorRuntime().wrap(function _callee17$(_context17) {
1146
- while (1) switch (_context17.prev = _context17.next) {
1375
+ return _regeneratorRuntime().wrap(function _callee18$(_context18) {
1376
+ while (1) switch (_context18.prev = _context18.next) {
1147
1377
  case 0:
1148
- _context17.prev = 0;
1378
+ _context18.prev = 0;
1149
1379
  params = {
1150
1380
  product_id: identity.product_id,
1151
1381
  product_variant_id: identity.product_variant_id,
@@ -1160,22 +1390,22 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1160
1390
  params.product_option_item = identity.product_option_item;
1161
1391
  }
1162
1392
  if (identity.product_bundle !== undefined) params.product_bundle = identity.product_bundle;
1163
- _context17.next = 7;
1393
+ _context18.next = 7;
1164
1394
  return this.updateProductInOrder(params);
1165
1395
  case 7:
1166
- products = _context17.sent;
1167
- return _context17.abrupt("return", products);
1396
+ products = _context18.sent;
1397
+ return _context18.abrupt("return", products);
1168
1398
  case 11:
1169
- _context17.prev = 11;
1170
- _context17.t0 = _context17["catch"](0);
1171
- throw _context17.t0;
1399
+ _context18.prev = 11;
1400
+ _context18.t0 = _context18["catch"](0);
1401
+ throw _context18.t0;
1172
1402
  case 14:
1173
1403
  case "end":
1174
- return _context17.stop();
1404
+ return _context18.stop();
1175
1405
  }
1176
- }, _callee17, this, [[0, 11]]);
1406
+ }, _callee18, this, [[0, 11]]);
1177
1407
  }));
1178
- function setOrderProductLineNote(_x13, _x14) {
1408
+ function setOrderProductLineNote(_x14, _x15) {
1179
1409
  return _setOrderProductLineNote.apply(this, arguments);
1180
1410
  }
1181
1411
  return setOrderProductLineNote;
@@ -1183,34 +1413,34 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1183
1413
  }, {
1184
1414
  key: "removeProductFromOrder",
1185
1415
  value: function () {
1186
- var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(identity) {
1416
+ var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(identity) {
1187
1417
  var products;
1188
- return _regeneratorRuntime().wrap(function _callee18$(_context18) {
1189
- while (1) switch (_context18.prev = _context18.next) {
1418
+ return _regeneratorRuntime().wrap(function _callee19$(_context19) {
1419
+ while (1) switch (_context19.prev = _context19.next) {
1190
1420
  case 0:
1191
- _context18.prev = 0;
1421
+ _context19.prev = 0;
1192
1422
  if (this.store.order) {
1193
- _context18.next = 3;
1423
+ _context19.next = 3;
1194
1424
  break;
1195
1425
  }
1196
1426
  throw new Error('order 模块未初始化');
1197
1427
  case 3:
1198
- _context18.next = 5;
1428
+ _context19.next = 5;
1199
1429
  return this.store.order.removeProductFromOrder(identity);
1200
1430
  case 5:
1201
- products = _context18.sent;
1202
- return _context18.abrupt("return", products);
1431
+ products = _context19.sent;
1432
+ return _context19.abrupt("return", products);
1203
1433
  case 9:
1204
- _context18.prev = 9;
1205
- _context18.t0 = _context18["catch"](0);
1206
- throw _context18.t0;
1434
+ _context19.prev = 9;
1435
+ _context19.t0 = _context19["catch"](0);
1436
+ throw _context19.t0;
1207
1437
  case 12:
1208
1438
  case "end":
1209
- return _context18.stop();
1439
+ return _context19.stop();
1210
1440
  }
1211
- }, _callee18, this, [[0, 9]]);
1441
+ }, _callee19, this, [[0, 9]]);
1212
1442
  }));
1213
- function removeProductFromOrder(_x15) {
1443
+ function removeProductFromOrder(_x16) {
1214
1444
  return _removeProductFromOrder.apply(this, arguments);
1215
1445
  }
1216
1446
  return removeProductFromOrder;
@@ -1219,18 +1449,18 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1219
1449
  }, {
1220
1450
  key: "getProductList",
1221
1451
  value: function () {
1222
- var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19() {
1452
+ var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20() {
1223
1453
  var _this$otherParams6;
1224
1454
  var menu_list_ids, _this$store$products, res;
1225
- return _regeneratorRuntime().wrap(function _callee19$(_context19) {
1226
- while (1) switch (_context19.prev = _context19.next) {
1455
+ return _regeneratorRuntime().wrap(function _callee20$(_context20) {
1456
+ while (1) switch (_context20.prev = _context20.next) {
1227
1457
  case 0:
1228
1458
  // 可以直接通过配置里的 menu 读取
1229
1459
  menu_list_ids = ((_this$otherParams6 = this.otherParams) === null || _this$otherParams6 === void 0 || (_this$otherParams6 = _this$otherParams6.dineInConfig) === null || _this$otherParams6 === void 0 ? void 0 : _this$otherParams6['menu.associated_menus'].map(function (n) {
1230
1460
  return Number(n.value);
1231
1461
  })) || [];
1232
- _context19.prev = 1;
1233
- _context19.next = 4;
1462
+ _context20.prev = 1;
1463
+ _context20.next = 4;
1234
1464
  return (_this$store$products = this.store.products) === null || _this$store$products === void 0 ? void 0 : _this$store$products.loadProducts({
1235
1465
  menu_list_ids: menu_list_ids,
1236
1466
  cacheId: this.cacheId,
@@ -1238,17 +1468,17 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1238
1468
  schedule_datetime: dayjs().format('YYYY-MM-DD HH:mm:ss')
1239
1469
  });
1240
1470
  case 4:
1241
- res = _context19.sent;
1242
- return _context19.abrupt("return", res);
1471
+ res = _context20.sent;
1472
+ return _context20.abrupt("return", res);
1243
1473
  case 8:
1244
- _context19.prev = 8;
1245
- _context19.t0 = _context19["catch"](1);
1246
- throw _context19.t0;
1474
+ _context20.prev = 8;
1475
+ _context20.t0 = _context20["catch"](1);
1476
+ throw _context20.t0;
1247
1477
  case 11:
1248
1478
  case "end":
1249
- return _context19.stop();
1479
+ return _context20.stop();
1250
1480
  }
1251
- }, _callee19, this, [[1, 8]]);
1481
+ }, _callee20, this, [[1, 8]]);
1252
1482
  }));
1253
1483
  function getProductList() {
1254
1484
  return _getProductList.apply(this, arguments);
@@ -1263,15 +1493,15 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1263
1493
  }, {
1264
1494
  key: "setOtherParams",
1265
1495
  value: function () {
1266
- var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(params) {
1267
- var _ref3,
1268
- _ref3$cover,
1496
+ var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(params) {
1497
+ var _ref4,
1498
+ _ref4$cover,
1269
1499
  cover,
1270
- _args20 = arguments;
1271
- return _regeneratorRuntime().wrap(function _callee20$(_context20) {
1272
- while (1) switch (_context20.prev = _context20.next) {
1500
+ _args21 = arguments;
1501
+ return _regeneratorRuntime().wrap(function _callee21$(_context21) {
1502
+ while (1) switch (_context21.prev = _context21.next) {
1273
1503
  case 0:
1274
- _ref3 = _args20.length > 1 && _args20[1] !== undefined ? _args20[1] : {}, _ref3$cover = _ref3.cover, cover = _ref3$cover === void 0 ? false : _ref3$cover;
1504
+ _ref4 = _args21.length > 1 && _args21[1] !== undefined ? _args21[1] : {}, _ref4$cover = _ref4.cover, cover = _ref4$cover === void 0 ? false : _ref4$cover;
1275
1505
  if (cover) {
1276
1506
  this.otherParams = params;
1277
1507
  } else {
@@ -1279,11 +1509,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1279
1509
  }
1280
1510
  case 2:
1281
1511
  case "end":
1282
- return _context20.stop();
1512
+ return _context21.stop();
1283
1513
  }
1284
- }, _callee20, this);
1514
+ }, _callee21, this);
1285
1515
  }));
1286
- function setOtherParams(_x16) {
1516
+ function setOtherParams(_x17) {
1287
1517
  return _setOtherParams.apply(this, arguments);
1288
1518
  }
1289
1519
  return setOtherParams;