@pisell/pisellos 2.2.164 → 2.2.165

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 (34) hide show
  1. package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +45 -15
  2. package/dist/modules/Order/index.d.ts +10 -3
  3. package/dist/modules/Order/index.js +272 -142
  4. package/dist/modules/Order/types.d.ts +14 -2
  5. package/dist/modules/Order/types.js +2 -0
  6. package/dist/modules/Order/utils.d.ts +10 -0
  7. package/dist/modules/Order/utils.js +67 -15
  8. package/dist/server/index.js +1 -0
  9. package/dist/solution/BaseSales/index.d.ts +9 -1
  10. package/dist/solution/BaseSales/index.js +369 -240
  11. package/dist/solution/BaseSales/types.d.ts +3 -0
  12. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +33 -14
  13. package/dist/solution/BaseSales/utils.js +36 -7
  14. package/dist/solution/BookingTicket/index.d.ts +3 -0
  15. package/dist/solution/BookingTicket/index.js +155 -86
  16. package/dist/solution/BookingTicket/utils/addProductDecision.js +19 -11
  17. package/dist/solution/ScanOrder/utils.js +36 -7
  18. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +35 -9
  19. package/lib/modules/Order/index.d.ts +10 -3
  20. package/lib/modules/Order/index.js +104 -4
  21. package/lib/modules/Order/types.d.ts +14 -2
  22. package/lib/modules/Order/utils.d.ts +10 -0
  23. package/lib/modules/Order/utils.js +58 -9
  24. package/lib/server/index.js +1 -0
  25. package/lib/solution/BaseSales/index.d.ts +9 -1
  26. package/lib/solution/BaseSales/index.js +65 -3
  27. package/lib/solution/BaseSales/types.d.ts +3 -0
  28. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +31 -10
  29. package/lib/solution/BaseSales/utils.js +37 -5
  30. package/lib/solution/BookingTicket/index.d.ts +3 -0
  31. package/lib/solution/BookingTicket/index.js +48 -6
  32. package/lib/solution/BookingTicket/utils/addProductDecision.js +16 -8
  33. package/lib/solution/ScanOrder/utils.js +37 -5
  34. package/package.json +1 -1
@@ -658,6 +658,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
658
658
  throw error;
659
659
  }
660
660
  }
661
+ }, {
662
+ key: "updateRemoteOrderNote",
663
+ value: function updateRemoteOrderNote(orderId, note) {
664
+ if (!this.store.order) throw new Error('order 模块未初始化');
665
+ this.store.order.syncTempOrderNoteToRemote(orderId, note);
666
+ }
661
667
  }, {
662
668
  key: "updateTempOrderShopDiscount",
663
669
  value: function updateTempOrderShopDiscount(amount) {
@@ -764,30 +770,97 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
764
770
  case 3:
765
771
  // this.store.resource = null;
766
772
  tempOrder = this.store.order.restoreOrder();
773
+ this.currentSalesDetail = null;
774
+ _context8.next = 7;
775
+ return this.effectsEmit('onTempOrderReplaced', {
776
+ tempOrder: tempOrder
777
+ });
778
+ case 7:
767
779
  if (!this.syncAppDataToTempOrder(tempOrder)) {
768
- _context8.next = 8;
780
+ _context8.next = 11;
769
781
  break;
770
782
  }
771
783
  this.store.order.persistTempOrder();
772
- _context8.next = 8;
784
+ _context8.next = 11;
773
785
  return this.store.order.saveDraft();
774
- case 8:
775
- return _context8.abrupt("return", tempOrder);
776
786
  case 11:
777
- _context8.prev = 11;
787
+ return _context8.abrupt("return", tempOrder);
788
+ case 14:
789
+ _context8.prev = 14;
778
790
  _context8.t0 = _context8["catch"](0);
779
791
  throw _context8.t0;
780
- case 14:
792
+ case 17:
781
793
  case "end":
782
794
  return _context8.stop();
783
795
  }
784
- }, _callee8, this, [[0, 11]]);
796
+ }, _callee8, this, [[0, 14]]);
785
797
  }));
786
798
  function restoreOrder() {
787
799
  return _restoreOrder.apply(this, arguments);
788
800
  }
789
801
  return restoreOrder;
790
802
  }()
803
+ /**
804
+ * 仅清空 tempOrder 购物车行(products / bookings / discount_list)。
805
+ * 同步清空内存中的 salesDetail 商品/预约视图,避免编辑态仍读到旧 bookings。
806
+ */
807
+ }, {
808
+ key: "clearOrderCartLines",
809
+ value: (function () {
810
+ var _clearOrderCartLines = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
811
+ var tempOrder;
812
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
813
+ while (1) switch (_context9.prev = _context9.next) {
814
+ case 0:
815
+ _context9.prev = 0;
816
+ if (this.store.order) {
817
+ _context9.next = 3;
818
+ break;
819
+ }
820
+ throw new Error('order 模块未初始化');
821
+ case 3:
822
+ _context9.next = 5;
823
+ return this.store.order.clearOrderCartLines();
824
+ case 5:
825
+ tempOrder = _context9.sent;
826
+ if (this.currentSalesDetail) {
827
+ this.currentSalesDetail = _objectSpread(_objectSpread({}, this.currentSalesDetail), {}, {
828
+ products: [],
829
+ bookings: [],
830
+ rootBooking: null,
831
+ bookingsByProductUid: {},
832
+ discount_list: []
833
+ });
834
+ }
835
+ _context9.next = 9;
836
+ return this.effectsEmit('onTempOrderReplaced', {
837
+ tempOrder: tempOrder
838
+ });
839
+ case 9:
840
+ if (!this.syncAppDataToTempOrder(tempOrder)) {
841
+ _context9.next = 13;
842
+ break;
843
+ }
844
+ this.store.order.persistTempOrder();
845
+ _context9.next = 13;
846
+ return this.store.order.saveDraft();
847
+ case 13:
848
+ return _context9.abrupt("return", tempOrder);
849
+ case 16:
850
+ _context9.prev = 16;
851
+ _context9.t0 = _context9["catch"](0);
852
+ throw _context9.t0;
853
+ case 19:
854
+ case "end":
855
+ return _context9.stop();
856
+ }
857
+ }, _callee9, this, [[0, 16]]);
858
+ }));
859
+ function clearOrderCartLines() {
860
+ return _clearOrderCartLines.apply(this, arguments);
861
+ }
862
+ return clearOrderCartLines;
863
+ }())
791
864
  }, {
792
865
  key: "getOrderProducts",
793
866
  value: function getOrderProducts() {
@@ -798,32 +871,32 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
798
871
  }, {
799
872
  key: "getSummary",
800
873
  value: function () {
801
- var _getSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
874
+ var _getSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
802
875
  var summary;
803
- return _regeneratorRuntime().wrap(function _callee9$(_context9) {
804
- while (1) switch (_context9.prev = _context9.next) {
876
+ return _regeneratorRuntime().wrap(function _callee10$(_context10) {
877
+ while (1) switch (_context10.prev = _context10.next) {
805
878
  case 0:
806
- _context9.prev = 0;
879
+ _context10.prev = 0;
807
880
  if (this.store.order) {
808
- _context9.next = 3;
881
+ _context10.next = 3;
809
882
  break;
810
883
  }
811
884
  throw new Error('order 模块未初始化');
812
885
  case 3:
813
- _context9.next = 5;
886
+ _context10.next = 5;
814
887
  return this.store.order.getOrderSummary();
815
888
  case 5:
816
- summary = _context9.sent;
817
- return _context9.abrupt("return", summary);
889
+ summary = _context10.sent;
890
+ return _context10.abrupt("return", summary);
818
891
  case 9:
819
- _context9.prev = 9;
820
- _context9.t0 = _context9["catch"](0);
821
- throw _context9.t0;
892
+ _context10.prev = 9;
893
+ _context10.t0 = _context10["catch"](0);
894
+ throw _context10.t0;
822
895
  case 12:
823
896
  case "end":
824
- return _context9.stop();
897
+ return _context10.stop();
825
898
  }
826
- }, _callee9, this, [[0, 9]]);
899
+ }, _callee10, this, [[0, 9]]);
827
900
  }));
828
901
  function getSummary() {
829
902
  return _getSummary.apply(this, arguments);
@@ -833,8 +906,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
833
906
  }, {
834
907
  key: "getHistoricalProductDiscountList",
835
908
  value: function getHistoricalProductDiscountList(products) {
909
+ var _this4 = this;
836
910
  var historyDiscountList = [];
837
911
  products.forEach(function (item) {
912
+ if (!_this4.isPersistedOrderProduct(item)) return;
838
913
  (item.discount_list || []).forEach(function (discount) {
839
914
  var _discount$discount, _discount$metadata, _discount$discount2, _discount$discount3, _discount$discount4;
840
915
  var discountId = ((_discount$discount = discount.discount) === null || _discount$discount === void 0 ? void 0 : _discount$discount.resource_id) || discount.id;
@@ -868,6 +943,17 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
868
943
  });
869
944
  return historyDiscountList;
870
945
  }
946
+ }, {
947
+ key: "isPersistedOrderProduct",
948
+ value: function isPersistedOrderProduct(product) {
949
+ var _product$order_detail, _product$booking_id;
950
+ var orderDetailId = (_product$order_detail = product.order_detail_id) !== null && _product$order_detail !== void 0 ? _product$order_detail : product.orderDetailId;
951
+ if (orderDetailId !== undefined && orderDetailId !== null && orderDetailId !== '') {
952
+ return true;
953
+ }
954
+ var bookingId = (_product$booking_id = product.booking_id) !== null && _product$booking_id !== void 0 ? _product$booking_id : product.bookingId;
955
+ return bookingId !== undefined && bookingId !== null && bookingId !== '';
956
+ }
871
957
  }, {
872
958
  key: "mergeHistoricalDiscountList",
873
959
  value: function mergeHistoricalDiscountList(discountList, products) {
@@ -882,14 +968,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
882
968
  }, {
883
969
  key: "loadDiscountConfig",
884
970
  value: function () {
885
- var _loadDiscountConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(params) {
971
+ var _loadDiscountConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(params) {
886
972
  var _this$getOrderIdentit, _tempOrder$customer, _tempOrder$_extend, _tempOrder$_extend2, _discountModule$getDi;
887
973
  var tempOrder, orderStore, discountModule, rulesModule, orderId, customerId, preparedDiscountList, _discountModule$setOr, nextDiscountList, _tempOrder$holder, _tempOrder$holder2, _orderStore$summary, holders, result;
888
- return _regeneratorRuntime().wrap(function _callee10$(_context10) {
889
- while (1) switch (_context10.prev = _context10.next) {
974
+ return _regeneratorRuntime().wrap(function _callee11$(_context11) {
975
+ while (1) switch (_context11.prev = _context11.next) {
890
976
  case 0:
891
977
  if (this.store.order) {
892
- _context10.next = 2;
978
+ _context11.next = 2;
893
979
  break;
894
980
  }
895
981
  throw new Error('order 模块未初始化');
@@ -902,10 +988,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
902
988
  customerId = Number((params === null || params === void 0 ? void 0 : params.customerId) || tempOrder.customer_id || ((_tempOrder$customer = tempOrder.customer) === null || _tempOrder$customer === void 0 ? void 0 : _tempOrder$customer.id) || ((_tempOrder$_extend = tempOrder._extend) === null || _tempOrder$_extend === void 0 || (_tempOrder$_extend = _tempOrder$_extend.customerSnapshot) === null || _tempOrder$_extend === void 0 ? void 0 : _tempOrder$_extend.id) || ((_tempOrder$_extend2 = tempOrder._extend) === null || _tempOrder$_extend2 === void 0 || (_tempOrder$_extend2 = _tempOrder$_extend2.customerSnapshot) === null || _tempOrder$_extend2 === void 0 ? void 0 : _tempOrder$_extend2.customer_id) || 0);
903
989
  preparedDiscountList = [];
904
990
  if (!(customerId && customerId !== 1)) {
905
- _context10.next = 15;
991
+ _context11.next = 15;
906
992
  break;
907
993
  }
908
- _context10.next = 12;
994
+ _context11.next = 12;
909
995
  return this.store.order.loadDiscountConfig({
910
996
  customerId: customerId,
911
997
  action: (params === null || params === void 0 ? void 0 : params.action) || (orderId ? 'edit' : 'create'),
@@ -913,16 +999,16 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
913
999
  apply: false
914
1000
  });
915
1001
  case 12:
916
- preparedDiscountList = _context10.sent;
917
- _context10.next = 15;
1002
+ preparedDiscountList = _context11.sent;
1003
+ _context11.next = 15;
918
1004
  return discountModule === null || discountModule === void 0 || (_discountModule$setOr = discountModule.setOriginalDiscountList) === null || _discountModule$setOr === void 0 ? void 0 : _discountModule$setOr.call(discountModule, preparedDiscountList);
919
1005
  case 15:
920
1006
  nextDiscountList = this.mergeHistoricalDiscountList(preparedDiscountList || (discountModule === null || discountModule === void 0 || (_discountModule$getDi = discountModule.getDiscountList) === null || _discountModule$getDi === void 0 ? void 0 : _discountModule$getDi.call(discountModule)) || [], tempOrder.products || []);
921
- _context10.next = 18;
1007
+ _context11.next = 18;
922
1008
  return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
923
1009
  case 18:
924
1010
  if (!rulesModule) {
925
- _context10.next = 28;
1011
+ _context11.next = 28;
926
1012
  break;
927
1013
  }
928
1014
  holders = (_tempOrder$holder = tempOrder.holder) !== null && _tempOrder$holder !== void 0 && _tempOrder$holder.form_record_id ? [{
@@ -942,12 +1028,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
942
1028
  tempOrder.products = result.productList;
943
1029
  }
944
1030
  if (!result.discountList) {
945
- _context10.next = 28;
1031
+ _context11.next = 28;
946
1032
  break;
947
1033
  }
948
1034
  nextDiscountList = this.mergeHistoricalDiscountList(result.discountList, tempOrder.products || []);
949
1035
  OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
950
- _context10.next = 27;
1036
+ _context11.next = 27;
951
1037
  return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
952
1038
  case 27:
953
1039
  tempOrder.discount_list = nextDiscountList.filter(function (discount) {
@@ -955,15 +1041,15 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
955
1041
  });
956
1042
  case 28:
957
1043
  this.store.order.persistTempOrder();
958
- return _context10.abrupt("return", {
1044
+ return _context11.abrupt("return", {
959
1045
  productList: tempOrder.products || [],
960
1046
  discountList: nextDiscountList
961
1047
  });
962
1048
  case 30:
963
1049
  case "end":
964
- return _context10.stop();
1050
+ return _context11.stop();
965
1051
  }
966
- }, _callee10, this);
1052
+ }, _callee11, this);
967
1053
  }));
968
1054
  function loadDiscountConfig(_x5) {
969
1055
  return _loadDiscountConfig.apply(this, arguments);
@@ -973,14 +1059,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
973
1059
  }, {
974
1060
  key: "bestDiscount",
975
1061
  value: function () {
976
- var _bestDiscount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(cb) {
1062
+ var _bestDiscount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(cb) {
977
1063
  var _discountModule$getOr;
978
1064
  var tempOrder, orderStore, discountModule, rulesModule, originalDiscountList, nextDiscountList, result, _tempOrder$holder3, _tempOrder$holder4, _orderStore$summary2, holders;
979
- return _regeneratorRuntime().wrap(function _callee11$(_context11) {
980
- while (1) switch (_context11.prev = _context11.next) {
1065
+ return _regeneratorRuntime().wrap(function _callee12$(_context12) {
1066
+ while (1) switch (_context12.prev = _context12.next) {
981
1067
  case 0:
982
1068
  if (this.store.order) {
983
- _context11.next = 2;
1069
+ _context12.next = 2;
984
1070
  break;
985
1071
  }
986
1072
  throw new Error('order 模块未初始化');
@@ -995,11 +1081,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
995
1081
  productList: tempOrder.products || [],
996
1082
  discountList: nextDiscountList
997
1083
  };
998
- _context11.next = 11;
1084
+ _context12.next = 11;
999
1085
  return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
1000
1086
  case 11:
1001
1087
  if (!rulesModule) {
1002
- _context11.next = 22;
1088
+ _context12.next = 22;
1003
1089
  break;
1004
1090
  }
1005
1091
  holders = (_tempOrder$holder3 = tempOrder.holder) !== null && _tempOrder$holder3 !== void 0 && _tempOrder$holder3.form_record_id ? [{
@@ -1016,12 +1102,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1016
1102
  tempOrder.products = result.productList;
1017
1103
  }
1018
1104
  if (!result.discountList) {
1019
- _context11.next = 22;
1105
+ _context12.next = 22;
1020
1106
  break;
1021
1107
  }
1022
1108
  nextDiscountList = this.mergeHistoricalDiscountList(result.discountList, tempOrder.products || []);
1023
1109
  OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
1024
- _context11.next = 20;
1110
+ _context12.next = 20;
1025
1111
  return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
1026
1112
  case 20:
1027
1113
  tempOrder.discount_list = nextDiscountList.filter(function (discount) {
@@ -1032,19 +1118,19 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1032
1118
  discountList: nextDiscountList
1033
1119
  };
1034
1120
  case 22:
1035
- _context11.next = 24;
1121
+ _context12.next = 24;
1036
1122
  return this.store.order.recalculateSummary({
1037
1123
  createIfMissing: true
1038
1124
  });
1039
1125
  case 24:
1040
1126
  this.store.order.persistTempOrder();
1041
1127
  cb === null || cb === void 0 || cb(result);
1042
- return _context11.abrupt("return", result);
1128
+ return _context12.abrupt("return", result);
1043
1129
  case 27:
1044
1130
  case "end":
1045
- return _context11.stop();
1131
+ return _context12.stop();
1046
1132
  }
1047
- }, _callee11, this);
1133
+ }, _callee12, this);
1048
1134
  }));
1049
1135
  function bestDiscount(_x6) {
1050
1136
  return _bestDiscount.apply(this, arguments);
@@ -1060,47 +1146,47 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1060
1146
  }, {
1061
1147
  key: "scanPromotionCode",
1062
1148
  value: function () {
1063
- var _scanPromotionCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(code, customerId) {
1149
+ var _scanPromotionCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(code, customerId) {
1064
1150
  var raw;
1065
- return _regeneratorRuntime().wrap(function _callee12$(_context12) {
1066
- while (1) switch (_context12.prev = _context12.next) {
1151
+ return _regeneratorRuntime().wrap(function _callee13$(_context13) {
1152
+ while (1) switch (_context13.prev = _context13.next) {
1067
1153
  case 0:
1068
- _context12.prev = 0;
1154
+ _context13.prev = 0;
1069
1155
  if (this.store.order) {
1070
- _context12.next = 3;
1156
+ _context13.next = 3;
1071
1157
  break;
1072
1158
  }
1073
1159
  throw new Error('order 模块未初始化');
1074
1160
  case 3:
1075
- _context12.next = 5;
1161
+ _context13.next = 5;
1076
1162
  return this.store.order.scanCode(code, customerId);
1077
1163
  case 5:
1078
- raw = _context12.sent;
1164
+ raw = _context13.sent;
1079
1165
  if (!raw.isAvailable) {
1080
- _context12.next = 10;
1166
+ _context13.next = 10;
1081
1167
  break;
1082
1168
  }
1083
- _context12.next = 9;
1169
+ _context13.next = 9;
1084
1170
  return this.store.order.recalculateSummary({
1085
1171
  createIfMissing: true
1086
1172
  });
1087
1173
  case 9:
1088
1174
  this.store.order.persistTempOrder();
1089
1175
  case 10:
1090
- return _context12.abrupt("return", {
1176
+ return _context13.abrupt("return", {
1091
1177
  isAvailable: raw.isAvailable,
1092
1178
  type: raw.type,
1093
1179
  unavailableReason: raw.unavailableReason
1094
1180
  });
1095
1181
  case 13:
1096
- _context12.prev = 13;
1097
- _context12.t0 = _context12["catch"](0);
1098
- throw _context12.t0;
1182
+ _context13.prev = 13;
1183
+ _context13.t0 = _context13["catch"](0);
1184
+ throw _context13.t0;
1099
1185
  case 16:
1100
1186
  case "end":
1101
- return _context12.stop();
1187
+ return _context13.stop();
1102
1188
  }
1103
- }, _callee12, this, [[0, 13]]);
1189
+ }, _callee13, this, [[0, 13]]);
1104
1190
  }));
1105
1191
  function scanPromotionCode(_x7, _x8) {
1106
1192
  return _scanPromotionCode.apply(this, arguments);
@@ -1110,14 +1196,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1110
1196
  }, {
1111
1197
  key: "setDiscountSelected",
1112
1198
  value: function () {
1113
- var _setDiscountSelected = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(params) {
1199
+ var _setDiscountSelected = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(params) {
1114
1200
  var _tempOrder$holder5, list, updated, tempOrder, orderStore, discountModule, rulesModule, holders, nextDiscountList, _tempOrder$holder6, result, beforeSelectedIds, _iterator, _step, d, selectedResourceIds, _iterator2, _step2, _product$metadata, _tempOrder$_extend3, _product$metadata2, _product$metadata$sou, _product$metadata3, _product$metadata4, _product$original_pri, product, productUid, runtimeOrigin, totalPerUnitDiscount, optionSum, sourcePrice, newSourceSellingPrice, newMainSellingPrice;
1115
- return _regeneratorRuntime().wrap(function _callee13$(_context13) {
1116
- while (1) switch (_context13.prev = _context13.next) {
1201
+ return _regeneratorRuntime().wrap(function _callee14$(_context14) {
1202
+ while (1) switch (_context14.prev = _context14.next) {
1117
1203
  case 0:
1118
- _context13.prev = 0;
1204
+ _context14.prev = 0;
1119
1205
  if (this.store.order) {
1120
- _context13.next = 3;
1206
+ _context14.next = 3;
1121
1207
  break;
1122
1208
  }
1123
1209
  throw new Error('order 模块未初始化');
@@ -1137,7 +1223,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1137
1223
  form_record_id: tempOrder.holder.form_record_id
1138
1224
  }] : [];
1139
1225
  nextDiscountList = updated;
1140
- _context13.next = 13;
1226
+ _context14.next = 13;
1141
1227
  return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(updated);
1142
1228
  case 13:
1143
1229
  if (rulesModule) {
@@ -1186,21 +1272,21 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1186
1272
  return d.id;
1187
1273
  }));
1188
1274
  _iterator2 = _createForOfIteratorHelper(tempOrder.products);
1189
- _context13.prev = 16;
1275
+ _context14.prev = 16;
1190
1276
  _iterator2.s();
1191
1277
  case 18:
1192
1278
  if ((_step2 = _iterator2.n()).done) {
1193
- _context13.next = 34;
1279
+ _context14.next = 34;
1194
1280
  break;
1195
1281
  }
1196
1282
  product = _step2.value;
1197
1283
  productUid = (_product$metadata = product.metadata) === null || _product$metadata === void 0 ? void 0 : _product$metadata.unique_identification_number;
1198
1284
  runtimeOrigin = productUid ? (_tempOrder$_extend3 = tempOrder._extend) === null || _tempOrder$_extend3 === void 0 || (_tempOrder$_extend3 = _tempOrder$_extend3.productsByUid) === null || _tempOrder$_extend3 === void 0 || (_tempOrder$_extend3 = _tempOrder$_extend3[productUid]) === null || _tempOrder$_extend3 === void 0 ? void 0 : _tempOrder$_extend3.origin : undefined;
1199
1285
  if (!(runtimeOrigin !== null && runtimeOrigin !== void 0 && runtimeOrigin.isManualDiscount || (_product$metadata2 = product.metadata) !== null && _product$metadata2 !== void 0 && _product$metadata2.is_manual_discount)) {
1200
- _context13.next = 24;
1286
+ _context14.next = 24;
1201
1287
  break;
1202
1288
  }
1203
- return _context13.abrupt("continue", 32);
1289
+ return _context14.abrupt("continue", 32);
1204
1290
  case 24:
1205
1291
  product.discount_list = (product.discount_list || []).filter(function (pd) {
1206
1292
  var _pd$discount$resource, _pd$discount;
@@ -1226,44 +1312,44 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1226
1312
  bundle: product.product_bundle
1227
1313
  });
1228
1314
  case 32:
1229
- _context13.next = 18;
1315
+ _context14.next = 18;
1230
1316
  break;
1231
1317
  case 34:
1232
- _context13.next = 39;
1318
+ _context14.next = 39;
1233
1319
  break;
1234
1320
  case 36:
1235
- _context13.prev = 36;
1236
- _context13.t0 = _context13["catch"](16);
1237
- _iterator2.e(_context13.t0);
1321
+ _context14.prev = 36;
1322
+ _context14.t0 = _context14["catch"](16);
1323
+ _iterator2.e(_context14.t0);
1238
1324
  case 39:
1239
- _context13.prev = 39;
1325
+ _context14.prev = 39;
1240
1326
  _iterator2.f();
1241
- return _context13.finish(39);
1327
+ return _context14.finish(39);
1242
1328
  case 42:
1243
1329
  OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
1244
- _context13.next = 45;
1330
+ _context14.next = 45;
1245
1331
  return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
1246
1332
  case 45:
1247
1333
  tempOrder.discount_list = (nextDiscountList || []).filter(function (d) {
1248
1334
  return d.isSelected;
1249
1335
  });
1250
- _context13.next = 48;
1336
+ _context14.next = 48;
1251
1337
  return this.store.order.recalculateSummary({
1252
1338
  createIfMissing: true
1253
1339
  });
1254
1340
  case 48:
1255
1341
  this.store.order.persistTempOrder();
1256
- _context13.next = 54;
1342
+ _context14.next = 54;
1257
1343
  break;
1258
1344
  case 51:
1259
- _context13.prev = 51;
1260
- _context13.t1 = _context13["catch"](0);
1261
- throw _context13.t1;
1345
+ _context14.prev = 51;
1346
+ _context14.t1 = _context14["catch"](0);
1347
+ throw _context14.t1;
1262
1348
  case 54:
1263
1349
  case "end":
1264
- return _context13.stop();
1350
+ return _context14.stop();
1265
1351
  }
1266
- }, _callee13, this, [[0, 51], [16, 36, 39, 42]]);
1352
+ }, _callee14, this, [[0, 51], [16, 36, 39, 42]]);
1267
1353
  }));
1268
1354
  function setDiscountSelected(_x9) {
1269
1355
  return _setDiscountSelected.apply(this, arguments);
@@ -1273,23 +1359,23 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1273
1359
  }, {
1274
1360
  key: "applyDiscountCalculationResult",
1275
1361
  value: function () {
1276
- var _applyDiscountCalculationResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(result) {
1362
+ var _applyDiscountCalculationResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(result) {
1277
1363
  var tempOrder, orderStore, discountModule;
1278
- return _regeneratorRuntime().wrap(function _callee14$(_context14) {
1279
- while (1) switch (_context14.prev = _context14.next) {
1364
+ return _regeneratorRuntime().wrap(function _callee15$(_context15) {
1365
+ while (1) switch (_context15.prev = _context15.next) {
1280
1366
  case 0:
1281
- _context14.prev = 0;
1367
+ _context15.prev = 0;
1282
1368
  if (this.store.order) {
1283
- _context14.next = 3;
1369
+ _context15.next = 3;
1284
1370
  break;
1285
1371
  }
1286
1372
  throw new Error('order 模块未初始化');
1287
1373
  case 3:
1288
1374
  if (result) {
1289
- _context14.next = 5;
1375
+ _context15.next = 5;
1290
1376
  break;
1291
1377
  }
1292
- return _context14.abrupt("return");
1378
+ return _context15.abrupt("return");
1293
1379
  case 5:
1294
1380
  tempOrder = this.store.order.ensureTempOrder();
1295
1381
  orderStore = this.store.order.store || {};
@@ -1298,34 +1384,34 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1298
1384
  tempOrder.products = result.productList;
1299
1385
  }
1300
1386
  if (!result.discountList) {
1301
- _context14.next = 14;
1387
+ _context15.next = 14;
1302
1388
  break;
1303
1389
  }
1304
1390
  OrderModule.populateSavedAmounts(tempOrder.products, result.discountList);
1305
- _context14.next = 13;
1391
+ _context15.next = 13;
1306
1392
  return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(result.discountList);
1307
1393
  case 13:
1308
1394
  tempOrder.discount_list = result.discountList.filter(function (discount) {
1309
1395
  return discount.isSelected;
1310
1396
  });
1311
1397
  case 14:
1312
- _context14.next = 16;
1398
+ _context15.next = 16;
1313
1399
  return this.store.order.recalculateSummary({
1314
1400
  createIfMissing: true
1315
1401
  });
1316
1402
  case 16:
1317
1403
  this.store.order.persistTempOrder();
1318
- _context14.next = 22;
1404
+ _context15.next = 22;
1319
1405
  break;
1320
1406
  case 19:
1321
- _context14.prev = 19;
1322
- _context14.t0 = _context14["catch"](0);
1323
- throw _context14.t0;
1407
+ _context15.prev = 19;
1408
+ _context15.t0 = _context15["catch"](0);
1409
+ throw _context15.t0;
1324
1410
  case 22:
1325
1411
  case "end":
1326
- return _context14.stop();
1412
+ return _context15.stop();
1327
1413
  }
1328
- }, _callee14, this, [[0, 19]]);
1414
+ }, _callee15, this, [[0, 19]]);
1329
1415
  }));
1330
1416
  function applyDiscountCalculationResult(_x10) {
1331
1417
  return _applyDiscountCalculationResult.apply(this, arguments);
@@ -1335,16 +1421,16 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1335
1421
  }, {
1336
1422
  key: "submitScanOrder",
1337
1423
  value: function () {
1338
- var _submitScanOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(params) {
1339
- return _regeneratorRuntime().wrap(function _callee15$(_context15) {
1340
- while (1) switch (_context15.prev = _context15.next) {
1424
+ var _submitScanOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(params) {
1425
+ return _regeneratorRuntime().wrap(function _callee16$(_context16) {
1426
+ while (1) switch (_context16.prev = _context16.next) {
1341
1427
  case 0:
1342
- return _context15.abrupt("return", this.submitSalesOrder(params));
1428
+ return _context16.abrupt("return", this.submitSalesOrder(params));
1343
1429
  case 1:
1344
1430
  case "end":
1345
- return _context15.stop();
1431
+ return _context16.stop();
1346
1432
  }
1347
- }, _callee15, this);
1433
+ }, _callee16, this);
1348
1434
  }));
1349
1435
  function submitScanOrder(_x11) {
1350
1436
  return _submitScanOrder.apply(this, arguments);
@@ -1360,14 +1446,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1360
1446
  }, {
1361
1447
  key: "submitSalesOrder",
1362
1448
  value: (function () {
1363
- var _submitSalesOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(params) {
1449
+ var _submitSalesOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(params) {
1364
1450
  var _this$otherParams4, _this$otherParams5, _this$otherParams6;
1365
1451
  var submitParams;
1366
- return _regeneratorRuntime().wrap(function _callee16$(_context16) {
1367
- while (1) switch (_context16.prev = _context16.next) {
1452
+ return _regeneratorRuntime().wrap(function _callee17$(_context17) {
1453
+ while (1) switch (_context17.prev = _context17.next) {
1368
1454
  case 0:
1369
1455
  if (this.store.order) {
1370
- _context16.next = 2;
1456
+ _context17.next = 2;
1371
1457
  break;
1372
1458
  }
1373
1459
  throw new Error('BaseSales 解决方案需要 order 模块支持');
@@ -1389,12 +1475,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1389
1475
  enhancePayload: params.enhancePayload
1390
1476
  } : {});
1391
1477
  console.log(submitParams, 'submitParams123');
1392
- return _context16.abrupt("return", this.store.order.submitTempOrder(submitParams));
1478
+ return _context17.abrupt("return", this.store.order.submitTempOrder(submitParams));
1393
1479
  case 6:
1394
1480
  case "end":
1395
- return _context16.stop();
1481
+ return _context17.stop();
1396
1482
  }
1397
- }, _callee16, this);
1483
+ }, _callee17, this);
1398
1484
  }));
1399
1485
  function submitSalesOrder(_x12) {
1400
1486
  return _submitSalesOrder.apply(this, arguments);
@@ -1404,22 +1490,27 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1404
1490
  }, {
1405
1491
  key: "syncPaymentsToOrder",
1406
1492
  value: function () {
1407
- var _syncPaymentsToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(params) {
1408
- return _regeneratorRuntime().wrap(function _callee17$(_context17) {
1409
- while (1) switch (_context17.prev = _context17.next) {
1493
+ var _syncPaymentsToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(params) {
1494
+ var _params$channel;
1495
+ var channel;
1496
+ return _regeneratorRuntime().wrap(function _callee18$(_context18) {
1497
+ while (1) switch (_context18.prev = _context18.next) {
1410
1498
  case 0:
1411
1499
  if (this.store.order) {
1412
- _context17.next = 2;
1500
+ _context18.next = 2;
1413
1501
  break;
1414
1502
  }
1415
1503
  throw new Error('order 模块未初始化');
1416
1504
  case 2:
1417
- return _context17.abrupt("return", this.store.order.syncPaymentsToOrder(params));
1418
- case 3:
1505
+ channel = (_params$channel = params.channel) !== null && _params$channel !== void 0 ? _params$channel : this.getSubmitOrderSalesChannel();
1506
+ return _context18.abrupt("return", this.store.order.syncPaymentsToOrder(_objectSpread(_objectSpread({}, params), channel !== undefined ? {
1507
+ channel: channel
1508
+ } : {})));
1509
+ case 4:
1419
1510
  case "end":
1420
- return _context17.stop();
1511
+ return _context18.stop();
1421
1512
  }
1422
- }, _callee17, this);
1513
+ }, _callee18, this);
1423
1514
  }));
1424
1515
  function syncPaymentsToOrder(_x13) {
1425
1516
  return _syncPaymentsToOrder.apply(this, arguments);
@@ -1500,11 +1591,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1500
1591
  surcharge_rounding_remainder: metadata.surcharge_rounding_remainder
1501
1592
  },
1502
1593
  product_bundle: (product.product_bundle || []).map(function (bundle) {
1594
+ var _bundle$bundle_id, _bundle$bundle_produc, _bundle$bundle_group_;
1503
1595
  var bundleMetadata = bundle.metadata || {};
1504
1596
  return {
1505
1597
  is_price_include_tax: tempOrder.is_price_include_tax,
1506
- bundle_id: bundle.bundle_id,
1507
- bundle_product_id: bundle.bundle_product_id,
1598
+ // 套餐子项在 tempOrder 上常为 id(如 1718),prepare/deduction 协议要求 bundle_id
1599
+ bundle_id: (_bundle$bundle_id = bundle.bundle_id) !== null && _bundle$bundle_id !== void 0 ? _bundle$bundle_id : bundle.id,
1600
+ bundle_product_id: (_bundle$bundle_produc = bundle.bundle_product_id) !== null && _bundle$bundle_produc !== void 0 ? _bundle$bundle_produc : bundle._bundle_product_id,
1601
+ bundle_group_id: (_bundle$bundle_group_ = bundle.bundle_group_id) !== null && _bundle$bundle_group_ !== void 0 ? _bundle$bundle_group_ : bundle.group_id,
1508
1602
  bundle_variant_id: bundle.bundle_variant_id,
1509
1603
  price_type: bundle.price_type,
1510
1604
  price_type_ext: bundle.price_type_ext,
@@ -1525,20 +1619,20 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1525
1619
  }, {
1526
1620
  key: "initWalletData",
1527
1621
  value: function () {
1528
- var _initWalletData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(params) {
1622
+ var _initWalletData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(params) {
1529
1623
  var _params$order_wait_pa, _ref, _tempOrder$is_price_i;
1530
1624
  var snapshot, tempOrder, amount, walletBusinessData, result;
1531
- return _regeneratorRuntime().wrap(function _callee18$(_context18) {
1532
- while (1) switch (_context18.prev = _context18.next) {
1625
+ return _regeneratorRuntime().wrap(function _callee19$(_context19) {
1626
+ while (1) switch (_context19.prev = _context19.next) {
1533
1627
  case 0:
1534
1628
  if (this.store.order) {
1535
- _context18.next = 2;
1629
+ _context19.next = 2;
1536
1630
  break;
1537
1631
  }
1538
1632
  throw new Error('order 模块未初始化');
1539
1633
  case 2:
1540
1634
  if (this.store.payment) {
1541
- _context18.next = 4;
1635
+ _context19.next = 4;
1542
1636
  break;
1543
1637
  }
1544
1638
  throw new Error('payment 模块未初始化');
@@ -1547,10 +1641,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1547
1641
  tempOrder = snapshot === null || snapshot === void 0 ? void 0 : snapshot.tempOrder;
1548
1642
  amount = snapshot === null || snapshot === void 0 ? void 0 : snapshot.amount;
1549
1643
  if (!(!tempOrder || !amount)) {
1550
- _context18.next = 9;
1644
+ _context19.next = 9;
1551
1645
  break;
1552
1646
  }
1553
- return _context18.abrupt("return", {
1647
+ return _context19.abrupt("return", {
1554
1648
  walletRecommendList: [],
1555
1649
  userIdentificationCodes: [],
1556
1650
  transformList: [],
@@ -1573,11 +1667,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1573
1667
  }, snapshot.identity.orderId ? {
1574
1668
  payment_order_id: String(snapshot.identity.orderId)
1575
1669
  } : {});
1576
- _context18.next = 12;
1670
+ _context19.next = 12;
1577
1671
  return this.store.payment.wallet.initializeWalletDataFromBusinessAsync(walletBusinessData);
1578
1672
  case 12:
1579
- result = _context18.sent;
1580
- _context18.next = 15;
1673
+ result = _context19.sent;
1674
+ _context19.next = 15;
1581
1675
  return this.core.effects.emit("".concat(this.name, ":onWalletDataInitialized"), {
1582
1676
  orderId: snapshot.identity.orderId,
1583
1677
  customerId: walletBusinessData.customer_id,
@@ -1589,12 +1683,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1589
1683
  timestamp: Date.now()
1590
1684
  });
1591
1685
  case 15:
1592
- return _context18.abrupt("return", result);
1686
+ return _context19.abrupt("return", result);
1593
1687
  case 16:
1594
1688
  case "end":
1595
- return _context18.stop();
1689
+ return _context19.stop();
1596
1690
  }
1597
- }, _callee18, this);
1691
+ }, _callee19, this);
1598
1692
  }));
1599
1693
  function initWalletData(_x14) {
1600
1694
  return _initWalletData.apply(this, arguments);
@@ -1623,27 +1717,27 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1623
1717
  }, {
1624
1718
  key: "getPaymentMethodsAsync",
1625
1719
  value: (function () {
1626
- var _getPaymentMethodsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19() {
1720
+ var _getPaymentMethodsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20() {
1627
1721
  var response;
1628
- return _regeneratorRuntime().wrap(function _callee19$(_context19) {
1629
- while (1) switch (_context19.prev = _context19.next) {
1722
+ return _regeneratorRuntime().wrap(function _callee20$(_context20) {
1723
+ while (1) switch (_context20.prev = _context20.next) {
1630
1724
  case 0:
1631
1725
  if (!this.store.payment) {
1632
- _context19.next = 2;
1726
+ _context20.next = 2;
1633
1727
  break;
1634
1728
  }
1635
- return _context19.abrupt("return", this.store.payment.getPayMethodListAsync());
1729
+ return _context20.abrupt("return", this.store.payment.getPayMethodListAsync());
1636
1730
  case 2:
1637
- _context19.next = 4;
1731
+ _context20.next = 4;
1638
1732
  return this.request.get('/pay/custom-payment/all');
1639
1733
  case 4:
1640
- response = _context19.sent;
1641
- return _context19.abrupt("return", (response === null || response === void 0 ? void 0 : response.data) || []);
1734
+ response = _context20.sent;
1735
+ return _context20.abrupt("return", (response === null || response === void 0 ? void 0 : response.data) || []);
1642
1736
  case 6:
1643
1737
  case "end":
1644
- return _context19.stop();
1738
+ return _context20.stop();
1645
1739
  }
1646
- }, _callee19, this);
1740
+ }, _callee20, this);
1647
1741
  }));
1648
1742
  function getPaymentMethodsAsync() {
1649
1743
  return _getPaymentMethodsAsync.apply(this, arguments);
@@ -1684,47 +1778,47 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1684
1778
  }, {
1685
1779
  key: "sendCustomerPayLink",
1686
1780
  value: (function () {
1687
- var _sendCustomerPayLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(params) {
1781
+ var _sendCustomerPayLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(params) {
1688
1782
  var orderIds, _ref2, _ref3, _submitResult$data$or, _submitResult$data, _submitResult$data2, submitResult, orderId;
1689
- return _regeneratorRuntime().wrap(function _callee20$(_context20) {
1690
- while (1) switch (_context20.prev = _context20.next) {
1783
+ return _regeneratorRuntime().wrap(function _callee21$(_context21) {
1784
+ while (1) switch (_context21.prev = _context21.next) {
1691
1785
  case 0:
1692
1786
  if (this.store.order) {
1693
- _context20.next = 2;
1787
+ _context21.next = 2;
1694
1788
  break;
1695
1789
  }
1696
1790
  throw new Error('order 模块未初始化');
1697
1791
  case 2:
1698
1792
  orderIds = params.order_ids || params.orderIds || [];
1699
1793
  if (!(!orderIds.length || params.submitBeforeSend)) {
1700
- _context20.next = 11;
1794
+ _context21.next = 11;
1701
1795
  break;
1702
1796
  }
1703
- _context20.next = 6;
1797
+ _context21.next = 6;
1704
1798
  return this.submitSalesOrder({
1705
1799
  smallTicketDataFlag: 1
1706
1800
  });
1707
1801
  case 6:
1708
- submitResult = _context20.sent;
1802
+ submitResult = _context21.sent;
1709
1803
  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;
1710
1804
  if (orderId) {
1711
- _context20.next = 10;
1805
+ _context21.next = 10;
1712
1806
  break;
1713
1807
  }
1714
1808
  throw new Error('本地订单提交云端失败,无法发送支付链接');
1715
1809
  case 10:
1716
1810
  orderIds = [orderId];
1717
1811
  case 11:
1718
- return _context20.abrupt("return", this.store.order.sendCustomerPayLink({
1812
+ return _context21.abrupt("return", this.store.order.sendCustomerPayLink({
1719
1813
  emails: params.emails,
1720
1814
  notify_action: params.notify_action,
1721
1815
  order_ids: orderIds
1722
1816
  }));
1723
1817
  case 12:
1724
1818
  case "end":
1725
- return _context20.stop();
1819
+ return _context21.stop();
1726
1820
  }
1727
- }, _callee20, this);
1821
+ }, _callee21, this);
1728
1822
  }));
1729
1823
  function sendCustomerPayLink(_x15) {
1730
1824
  return _sendCustomerPayLink.apply(this, arguments);
@@ -1739,30 +1833,30 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1739
1833
  }, {
1740
1834
  key: "calculateProductBookingPrice",
1741
1835
  value: function () {
1742
- var _calculateProductBookingPrice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(params) {
1836
+ var _calculateProductBookingPrice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(params) {
1743
1837
  var _params$customer_id;
1744
1838
  var quotation, customerId;
1745
- return _regeneratorRuntime().wrap(function _callee21$(_context21) {
1746
- while (1) switch (_context21.prev = _context21.next) {
1839
+ return _regeneratorRuntime().wrap(function _callee22$(_context22) {
1840
+ while (1) switch (_context22.prev = _context22.next) {
1747
1841
  case 0:
1748
1842
  quotation = this.store.quotation;
1749
1843
  customerId = (_params$customer_id = params.customer_id) !== null && _params$customer_id !== void 0 ? _params$customer_id : this.getCurrentOrderCustomerId();
1750
- _context21.next = 4;
1844
+ _context22.next = 4;
1751
1845
  return this.loadQuotationForPriceQuery({
1752
1846
  quotation: quotation,
1753
1847
  customer_id: customerId,
1754
1848
  channel: params.channel
1755
1849
  });
1756
1850
  case 4:
1757
- return _context21.abrupt("return", calculateBaseSalesProductBookingPrice(_objectSpread(_objectSpread({}, params), {}, {
1851
+ return _context22.abrupt("return", calculateBaseSalesProductBookingPrice(_objectSpread(_objectSpread({}, params), {}, {
1758
1852
  customer_id: customerId,
1759
1853
  quotation: quotation
1760
1854
  })));
1761
1855
  case 5:
1762
1856
  case "end":
1763
- return _context21.stop();
1857
+ return _context22.stop();
1764
1858
  }
1765
- }, _callee21, this);
1859
+ }, _callee22, this);
1766
1860
  }));
1767
1861
  function calculateProductBookingPrice(_x16) {
1768
1862
  return _calculateProductBookingPrice.apply(this, arguments);
@@ -1772,32 +1866,32 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1772
1866
  }, {
1773
1867
  key: "addProductToOrder",
1774
1868
  value: function () {
1775
- var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(product, booking) {
1869
+ var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(product, booking) {
1776
1870
  var products;
1777
- return _regeneratorRuntime().wrap(function _callee22$(_context22) {
1778
- while (1) switch (_context22.prev = _context22.next) {
1871
+ return _regeneratorRuntime().wrap(function _callee23$(_context23) {
1872
+ while (1) switch (_context23.prev = _context23.next) {
1779
1873
  case 0:
1780
- _context22.prev = 0;
1874
+ _context23.prev = 0;
1781
1875
  if (this.store.order) {
1782
- _context22.next = 3;
1876
+ _context23.next = 3;
1783
1877
  break;
1784
1878
  }
1785
1879
  throw new Error('order 模块未初始化');
1786
1880
  case 3:
1787
- _context22.next = 5;
1881
+ _context23.next = 5;
1788
1882
  return this.store.order.addProductToOrder(product, booking);
1789
1883
  case 5:
1790
- products = _context22.sent;
1791
- return _context22.abrupt("return", products);
1884
+ products = _context23.sent;
1885
+ return _context23.abrupt("return", products);
1792
1886
  case 9:
1793
- _context22.prev = 9;
1794
- _context22.t0 = _context22["catch"](0);
1795
- throw _context22.t0;
1887
+ _context23.prev = 9;
1888
+ _context23.t0 = _context23["catch"](0);
1889
+ throw _context23.t0;
1796
1890
  case 12:
1797
1891
  case "end":
1798
- return _context22.stop();
1892
+ return _context23.stop();
1799
1893
  }
1800
- }, _callee22, this, [[0, 9]]);
1894
+ }, _callee23, this, [[0, 9]]);
1801
1895
  }));
1802
1896
  function addProductToOrder(_x17, _x18) {
1803
1897
  return _addProductToOrder.apply(this, arguments);
@@ -1807,38 +1901,73 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1807
1901
  }, {
1808
1902
  key: "updateOrderProduct",
1809
1903
  value: function () {
1810
- var _updateOrderProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(params) {
1904
+ var _updateOrderProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(params) {
1811
1905
  var products;
1812
- return _regeneratorRuntime().wrap(function _callee23$(_context23) {
1813
- while (1) switch (_context23.prev = _context23.next) {
1906
+ return _regeneratorRuntime().wrap(function _callee24$(_context24) {
1907
+ while (1) switch (_context24.prev = _context24.next) {
1814
1908
  case 0:
1815
- _context23.prev = 0;
1909
+ _context24.prev = 0;
1816
1910
  if (this.store.order) {
1817
- _context23.next = 3;
1911
+ _context24.next = 3;
1818
1912
  break;
1819
1913
  }
1820
1914
  throw new Error('order 模块未初始化');
1821
1915
  case 3:
1822
- _context23.next = 5;
1916
+ _context24.next = 5;
1823
1917
  return this.store.order.updateOrderProduct(params);
1824
1918
  case 5:
1825
- products = _context23.sent;
1826
- return _context23.abrupt("return", products);
1919
+ products = _context24.sent;
1920
+ return _context24.abrupt("return", products);
1827
1921
  case 9:
1828
- _context23.prev = 9;
1829
- _context23.t0 = _context23["catch"](0);
1830
- throw _context23.t0;
1922
+ _context24.prev = 9;
1923
+ _context24.t0 = _context24["catch"](0);
1924
+ throw _context24.t0;
1831
1925
  case 12:
1832
1926
  case "end":
1833
- return _context23.stop();
1927
+ return _context24.stop();
1834
1928
  }
1835
- }, _callee23, this, [[0, 9]]);
1929
+ }, _callee24, this, [[0, 9]]);
1836
1930
  }));
1837
1931
  function updateOrderProduct(_x19) {
1838
1932
  return _updateOrderProduct.apply(this, arguments);
1839
1933
  }
1840
1934
  return updateOrderProduct;
1841
1935
  }()
1936
+ }, {
1937
+ key: "updateOrderProductQuantity",
1938
+ value: function () {
1939
+ var _updateOrderProductQuantity = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(params) {
1940
+ var products;
1941
+ return _regeneratorRuntime().wrap(function _callee25$(_context25) {
1942
+ while (1) switch (_context25.prev = _context25.next) {
1943
+ case 0:
1944
+ _context25.prev = 0;
1945
+ if (this.store.order) {
1946
+ _context25.next = 3;
1947
+ break;
1948
+ }
1949
+ throw new Error('order 模块未初始化');
1950
+ case 3:
1951
+ _context25.next = 5;
1952
+ return this.store.order.updateOrderProductQuantity(params);
1953
+ case 5:
1954
+ products = _context25.sent;
1955
+ return _context25.abrupt("return", products);
1956
+ case 9:
1957
+ _context25.prev = 9;
1958
+ _context25.t0 = _context25["catch"](0);
1959
+ throw _context25.t0;
1960
+ case 12:
1961
+ case "end":
1962
+ return _context25.stop();
1963
+ }
1964
+ }, _callee25, this, [[0, 9]]);
1965
+ }));
1966
+ function updateOrderProductQuantity(_x20) {
1967
+ return _updateOrderProductQuantity.apply(this, arguments);
1968
+ }
1969
+ return updateOrderProductQuantity;
1970
+ }()
1842
1971
  }, {
1843
1972
  key: "updateOrderBooking",
1844
1973
  value: function updateOrderBooking(params) {
@@ -1857,12 +1986,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1857
1986
  }, {
1858
1987
  key: "setOrderProductLineNote",
1859
1988
  value: (function () {
1860
- var _setOrderProductLineNote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(identity, note) {
1989
+ var _setOrderProductLineNote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(identity, note) {
1861
1990
  var params, products;
1862
- return _regeneratorRuntime().wrap(function _callee24$(_context24) {
1863
- while (1) switch (_context24.prev = _context24.next) {
1991
+ return _regeneratorRuntime().wrap(function _callee26$(_context26) {
1992
+ while (1) switch (_context26.prev = _context26.next) {
1864
1993
  case 0:
1865
- _context24.prev = 0;
1994
+ _context26.prev = 0;
1866
1995
  params = {
1867
1996
  product_id: identity.product_id,
1868
1997
  product_variant_id: identity.product_variant_id,
@@ -1877,22 +2006,22 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1877
2006
  params.product_option_item = identity.product_option_item;
1878
2007
  }
1879
2008
  if (identity.product_bundle !== undefined) params.product_bundle = identity.product_bundle;
1880
- _context24.next = 7;
2009
+ _context26.next = 7;
1881
2010
  return this.updateOrderProduct(params);
1882
2011
  case 7:
1883
- products = _context24.sent;
1884
- return _context24.abrupt("return", products);
2012
+ products = _context26.sent;
2013
+ return _context26.abrupt("return", products);
1885
2014
  case 11:
1886
- _context24.prev = 11;
1887
- _context24.t0 = _context24["catch"](0);
1888
- throw _context24.t0;
2015
+ _context26.prev = 11;
2016
+ _context26.t0 = _context26["catch"](0);
2017
+ throw _context26.t0;
1889
2018
  case 14:
1890
2019
  case "end":
1891
- return _context24.stop();
2020
+ return _context26.stop();
1892
2021
  }
1893
- }, _callee24, this, [[0, 11]]);
2022
+ }, _callee26, this, [[0, 11]]);
1894
2023
  }));
1895
- function setOrderProductLineNote(_x20, _x21) {
2024
+ function setOrderProductLineNote(_x21, _x22) {
1896
2025
  return _setOrderProductLineNote.apply(this, arguments);
1897
2026
  }
1898
2027
  return setOrderProductLineNote;
@@ -1900,34 +2029,34 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1900
2029
  }, {
1901
2030
  key: "removeProductFromOrder",
1902
2031
  value: function () {
1903
- var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(identity) {
2032
+ var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(identity) {
1904
2033
  var products;
1905
- return _regeneratorRuntime().wrap(function _callee25$(_context25) {
1906
- while (1) switch (_context25.prev = _context25.next) {
2034
+ return _regeneratorRuntime().wrap(function _callee27$(_context27) {
2035
+ while (1) switch (_context27.prev = _context27.next) {
1907
2036
  case 0:
1908
- _context25.prev = 0;
2037
+ _context27.prev = 0;
1909
2038
  if (this.store.order) {
1910
- _context25.next = 3;
2039
+ _context27.next = 3;
1911
2040
  break;
1912
2041
  }
1913
2042
  throw new Error('order 模块未初始化');
1914
2043
  case 3:
1915
- _context25.next = 5;
2044
+ _context27.next = 5;
1916
2045
  return this.store.order.removeProductFromOrder(identity);
1917
2046
  case 5:
1918
- products = _context25.sent;
1919
- return _context25.abrupt("return", products);
2047
+ products = _context27.sent;
2048
+ return _context27.abrupt("return", products);
1920
2049
  case 9:
1921
- _context25.prev = 9;
1922
- _context25.t0 = _context25["catch"](0);
1923
- throw _context25.t0;
2050
+ _context27.prev = 9;
2051
+ _context27.t0 = _context27["catch"](0);
2052
+ throw _context27.t0;
1924
2053
  case 12:
1925
2054
  case "end":
1926
- return _context25.stop();
2055
+ return _context27.stop();
1927
2056
  }
1928
- }, _callee25, this, [[0, 9]]);
2057
+ }, _callee27, this, [[0, 9]]);
1929
2058
  }));
1930
- function removeProductFromOrder(_x22) {
2059
+ function removeProductFromOrder(_x23) {
1931
2060
  return _removeProductFromOrder.apply(this, arguments);
1932
2061
  }
1933
2062
  return removeProductFromOrder;
@@ -1936,18 +2065,18 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1936
2065
  }, {
1937
2066
  key: "getProductList",
1938
2067
  value: function () {
1939
- var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26() {
2068
+ var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28() {
1940
2069
  var _this$otherParams7;
1941
2070
  var menu_list_ids, _this$store$products, res;
1942
- return _regeneratorRuntime().wrap(function _callee26$(_context26) {
1943
- while (1) switch (_context26.prev = _context26.next) {
2071
+ return _regeneratorRuntime().wrap(function _callee28$(_context28) {
2072
+ while (1) switch (_context28.prev = _context28.next) {
1944
2073
  case 0:
1945
2074
  // 可以直接通过配置里的 menu 读取
1946
2075
  menu_list_ids = ((_this$otherParams7 = this.otherParams) === null || _this$otherParams7 === void 0 || (_this$otherParams7 = _this$otherParams7.dineInConfig) === null || _this$otherParams7 === void 0 ? void 0 : _this$otherParams7['menu.associated_menus'].map(function (n) {
1947
2076
  return Number(n.value);
1948
2077
  })) || [];
1949
- _context26.prev = 1;
1950
- _context26.next = 4;
2078
+ _context28.prev = 1;
2079
+ _context28.next = 4;
1951
2080
  return (_this$store$products = this.store.products) === null || _this$store$products === void 0 ? void 0 : _this$store$products.loadProducts({
1952
2081
  menu_list_ids: menu_list_ids,
1953
2082
  cacheId: this.cacheId,
@@ -1955,17 +2084,17 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1955
2084
  schedule_datetime: dayjs().format('YYYY-MM-DD HH:mm:ss')
1956
2085
  });
1957
2086
  case 4:
1958
- res = _context26.sent;
1959
- return _context26.abrupt("return", res);
2087
+ res = _context28.sent;
2088
+ return _context28.abrupt("return", res);
1960
2089
  case 8:
1961
- _context26.prev = 8;
1962
- _context26.t0 = _context26["catch"](1);
1963
- throw _context26.t0;
2090
+ _context28.prev = 8;
2091
+ _context28.t0 = _context28["catch"](1);
2092
+ throw _context28.t0;
1964
2093
  case 11:
1965
2094
  case "end":
1966
- return _context26.stop();
2095
+ return _context28.stop();
1967
2096
  }
1968
- }, _callee26, this, [[1, 8]]);
2097
+ }, _callee28, this, [[1, 8]]);
1969
2098
  }));
1970
2099
  function getProductList() {
1971
2100
  return _getProductList.apply(this, arguments);
@@ -1980,15 +2109,15 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1980
2109
  }, {
1981
2110
  key: "setOtherParams",
1982
2111
  value: function () {
1983
- var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(params) {
2112
+ var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(params) {
1984
2113
  var _ref4,
1985
2114
  _ref4$cover,
1986
2115
  cover,
1987
- _args27 = arguments;
1988
- return _regeneratorRuntime().wrap(function _callee27$(_context27) {
1989
- while (1) switch (_context27.prev = _context27.next) {
2116
+ _args29 = arguments;
2117
+ return _regeneratorRuntime().wrap(function _callee29$(_context29) {
2118
+ while (1) switch (_context29.prev = _context29.next) {
1990
2119
  case 0:
1991
- _ref4 = _args27.length > 1 && _args27[1] !== undefined ? _args27[1] : {}, _ref4$cover = _ref4.cover, cover = _ref4$cover === void 0 ? false : _ref4$cover;
2120
+ _ref4 = _args29.length > 1 && _args29[1] !== undefined ? _args29[1] : {}, _ref4$cover = _ref4.cover, cover = _ref4$cover === void 0 ? false : _ref4$cover;
1992
2121
  if (cover) {
1993
2122
  this.otherParams = params;
1994
2123
  } else {
@@ -1996,11 +2125,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1996
2125
  }
1997
2126
  case 2:
1998
2127
  case "end":
1999
- return _context27.stop();
2128
+ return _context29.stop();
2000
2129
  }
2001
- }, _callee27, this);
2130
+ }, _callee29, this);
2002
2131
  }));
2003
- function setOtherParams(_x23) {
2132
+ function setOtherParams(_x24) {
2004
2133
  return _setOtherParams.apply(this, arguments);
2005
2134
  }
2006
2135
  return setOtherParams;