@pisell/pisellos 2.2.164 → 2.2.166

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 (36) 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 +275 -142
  4. package/dist/modules/Order/types.d.ts +9 -2
  5. package/dist/modules/Order/types.js +2 -0
  6. package/dist/modules/Order/utils.d.ts +13 -0
  7. package/dist/modules/Order/utils.js +69 -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 +378 -241
  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 +170 -86
  16. package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +4 -2
  17. package/dist/solution/BookingTicket/utils/addProductDecision.js +37 -19
  18. package/dist/solution/ScanOrder/utils.js +36 -7
  19. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +35 -9
  20. package/lib/modules/Order/index.d.ts +10 -3
  21. package/lib/modules/Order/index.js +107 -4
  22. package/lib/modules/Order/types.d.ts +9 -2
  23. package/lib/modules/Order/utils.d.ts +13 -0
  24. package/lib/modules/Order/utils.js +57 -9
  25. package/lib/server/index.js +1 -0
  26. package/lib/solution/BaseSales/index.d.ts +9 -1
  27. package/lib/solution/BaseSales/index.js +71 -3
  28. package/lib/solution/BaseSales/types.d.ts +3 -0
  29. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +31 -10
  30. package/lib/solution/BaseSales/utils.js +37 -5
  31. package/lib/solution/BookingTicket/index.d.ts +3 -0
  32. package/lib/solution/BookingTicket/index.js +57 -6
  33. package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +4 -2
  34. package/lib/solution/BookingTicket/utils/addProductDecision.js +28 -12
  35. package/lib/solution/ScanOrder/utils.js +37 -5
  36. 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,23 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
955
1041
  });
956
1042
  case 28:
957
1043
  this.store.order.persistTempOrder();
958
- return _context10.abrupt("return", {
1044
+ _context11.next = 31;
1045
+ return this.effectsEmit('onDiscountApplied', {
1046
+ productList: tempOrder.products || [],
1047
+ discountList: nextDiscountList,
1048
+ selectedDiscountList: tempOrder.discount_list || [],
1049
+ tempOrder: tempOrder
1050
+ });
1051
+ case 31:
1052
+ return _context11.abrupt("return", {
959
1053
  productList: tempOrder.products || [],
960
1054
  discountList: nextDiscountList
961
1055
  });
962
- case 30:
1056
+ case 32:
963
1057
  case "end":
964
- return _context10.stop();
1058
+ return _context11.stop();
965
1059
  }
966
- }, _callee10, this);
1060
+ }, _callee11, this);
967
1061
  }));
968
1062
  function loadDiscountConfig(_x5) {
969
1063
  return _loadDiscountConfig.apply(this, arguments);
@@ -973,14 +1067,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
973
1067
  }, {
974
1068
  key: "bestDiscount",
975
1069
  value: function () {
976
- var _bestDiscount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(cb) {
1070
+ var _bestDiscount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(cb) {
977
1071
  var _discountModule$getOr;
978
1072
  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) {
1073
+ return _regeneratorRuntime().wrap(function _callee12$(_context12) {
1074
+ while (1) switch (_context12.prev = _context12.next) {
981
1075
  case 0:
982
1076
  if (this.store.order) {
983
- _context11.next = 2;
1077
+ _context12.next = 2;
984
1078
  break;
985
1079
  }
986
1080
  throw new Error('order 模块未初始化');
@@ -995,11 +1089,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
995
1089
  productList: tempOrder.products || [],
996
1090
  discountList: nextDiscountList
997
1091
  };
998
- _context11.next = 11;
1092
+ _context12.next = 11;
999
1093
  return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
1000
1094
  case 11:
1001
1095
  if (!rulesModule) {
1002
- _context11.next = 22;
1096
+ _context12.next = 22;
1003
1097
  break;
1004
1098
  }
1005
1099
  holders = (_tempOrder$holder3 = tempOrder.holder) !== null && _tempOrder$holder3 !== void 0 && _tempOrder$holder3.form_record_id ? [{
@@ -1016,12 +1110,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1016
1110
  tempOrder.products = result.productList;
1017
1111
  }
1018
1112
  if (!result.discountList) {
1019
- _context11.next = 22;
1113
+ _context12.next = 22;
1020
1114
  break;
1021
1115
  }
1022
1116
  nextDiscountList = this.mergeHistoricalDiscountList(result.discountList, tempOrder.products || []);
1023
1117
  OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
1024
- _context11.next = 20;
1118
+ _context12.next = 20;
1025
1119
  return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
1026
1120
  case 20:
1027
1121
  tempOrder.discount_list = nextDiscountList.filter(function (discount) {
@@ -1032,19 +1126,19 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1032
1126
  discountList: nextDiscountList
1033
1127
  };
1034
1128
  case 22:
1035
- _context11.next = 24;
1129
+ _context12.next = 24;
1036
1130
  return this.store.order.recalculateSummary({
1037
1131
  createIfMissing: true
1038
1132
  });
1039
1133
  case 24:
1040
1134
  this.store.order.persistTempOrder();
1041
1135
  cb === null || cb === void 0 || cb(result);
1042
- return _context11.abrupt("return", result);
1136
+ return _context12.abrupt("return", result);
1043
1137
  case 27:
1044
1138
  case "end":
1045
- return _context11.stop();
1139
+ return _context12.stop();
1046
1140
  }
1047
- }, _callee11, this);
1141
+ }, _callee12, this);
1048
1142
  }));
1049
1143
  function bestDiscount(_x6) {
1050
1144
  return _bestDiscount.apply(this, arguments);
@@ -1060,47 +1154,47 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1060
1154
  }, {
1061
1155
  key: "scanPromotionCode",
1062
1156
  value: function () {
1063
- var _scanPromotionCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(code, customerId) {
1157
+ var _scanPromotionCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(code, customerId) {
1064
1158
  var raw;
1065
- return _regeneratorRuntime().wrap(function _callee12$(_context12) {
1066
- while (1) switch (_context12.prev = _context12.next) {
1159
+ return _regeneratorRuntime().wrap(function _callee13$(_context13) {
1160
+ while (1) switch (_context13.prev = _context13.next) {
1067
1161
  case 0:
1068
- _context12.prev = 0;
1162
+ _context13.prev = 0;
1069
1163
  if (this.store.order) {
1070
- _context12.next = 3;
1164
+ _context13.next = 3;
1071
1165
  break;
1072
1166
  }
1073
1167
  throw new Error('order 模块未初始化');
1074
1168
  case 3:
1075
- _context12.next = 5;
1169
+ _context13.next = 5;
1076
1170
  return this.store.order.scanCode(code, customerId);
1077
1171
  case 5:
1078
- raw = _context12.sent;
1172
+ raw = _context13.sent;
1079
1173
  if (!raw.isAvailable) {
1080
- _context12.next = 10;
1174
+ _context13.next = 10;
1081
1175
  break;
1082
1176
  }
1083
- _context12.next = 9;
1177
+ _context13.next = 9;
1084
1178
  return this.store.order.recalculateSummary({
1085
1179
  createIfMissing: true
1086
1180
  });
1087
1181
  case 9:
1088
1182
  this.store.order.persistTempOrder();
1089
1183
  case 10:
1090
- return _context12.abrupt("return", {
1184
+ return _context13.abrupt("return", {
1091
1185
  isAvailable: raw.isAvailable,
1092
1186
  type: raw.type,
1093
1187
  unavailableReason: raw.unavailableReason
1094
1188
  });
1095
1189
  case 13:
1096
- _context12.prev = 13;
1097
- _context12.t0 = _context12["catch"](0);
1098
- throw _context12.t0;
1190
+ _context13.prev = 13;
1191
+ _context13.t0 = _context13["catch"](0);
1192
+ throw _context13.t0;
1099
1193
  case 16:
1100
1194
  case "end":
1101
- return _context12.stop();
1195
+ return _context13.stop();
1102
1196
  }
1103
- }, _callee12, this, [[0, 13]]);
1197
+ }, _callee13, this, [[0, 13]]);
1104
1198
  }));
1105
1199
  function scanPromotionCode(_x7, _x8) {
1106
1200
  return _scanPromotionCode.apply(this, arguments);
@@ -1110,14 +1204,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1110
1204
  }, {
1111
1205
  key: "setDiscountSelected",
1112
1206
  value: function () {
1113
- var _setDiscountSelected = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(params) {
1207
+ var _setDiscountSelected = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(params) {
1114
1208
  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) {
1209
+ return _regeneratorRuntime().wrap(function _callee14$(_context14) {
1210
+ while (1) switch (_context14.prev = _context14.next) {
1117
1211
  case 0:
1118
- _context13.prev = 0;
1212
+ _context14.prev = 0;
1119
1213
  if (this.store.order) {
1120
- _context13.next = 3;
1214
+ _context14.next = 3;
1121
1215
  break;
1122
1216
  }
1123
1217
  throw new Error('order 模块未初始化');
@@ -1137,7 +1231,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1137
1231
  form_record_id: tempOrder.holder.form_record_id
1138
1232
  }] : [];
1139
1233
  nextDiscountList = updated;
1140
- _context13.next = 13;
1234
+ _context14.next = 13;
1141
1235
  return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(updated);
1142
1236
  case 13:
1143
1237
  if (rulesModule) {
@@ -1186,21 +1280,21 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1186
1280
  return d.id;
1187
1281
  }));
1188
1282
  _iterator2 = _createForOfIteratorHelper(tempOrder.products);
1189
- _context13.prev = 16;
1283
+ _context14.prev = 16;
1190
1284
  _iterator2.s();
1191
1285
  case 18:
1192
1286
  if ((_step2 = _iterator2.n()).done) {
1193
- _context13.next = 34;
1287
+ _context14.next = 34;
1194
1288
  break;
1195
1289
  }
1196
1290
  product = _step2.value;
1197
1291
  productUid = (_product$metadata = product.metadata) === null || _product$metadata === void 0 ? void 0 : _product$metadata.unique_identification_number;
1198
1292
  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
1293
  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;
1294
+ _context14.next = 24;
1201
1295
  break;
1202
1296
  }
1203
- return _context13.abrupt("continue", 32);
1297
+ return _context14.abrupt("continue", 32);
1204
1298
  case 24:
1205
1299
  product.discount_list = (product.discount_list || []).filter(function (pd) {
1206
1300
  var _pd$discount$resource, _pd$discount;
@@ -1226,44 +1320,44 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1226
1320
  bundle: product.product_bundle
1227
1321
  });
1228
1322
  case 32:
1229
- _context13.next = 18;
1323
+ _context14.next = 18;
1230
1324
  break;
1231
1325
  case 34:
1232
- _context13.next = 39;
1326
+ _context14.next = 39;
1233
1327
  break;
1234
1328
  case 36:
1235
- _context13.prev = 36;
1236
- _context13.t0 = _context13["catch"](16);
1237
- _iterator2.e(_context13.t0);
1329
+ _context14.prev = 36;
1330
+ _context14.t0 = _context14["catch"](16);
1331
+ _iterator2.e(_context14.t0);
1238
1332
  case 39:
1239
- _context13.prev = 39;
1333
+ _context14.prev = 39;
1240
1334
  _iterator2.f();
1241
- return _context13.finish(39);
1335
+ return _context14.finish(39);
1242
1336
  case 42:
1243
1337
  OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
1244
- _context13.next = 45;
1338
+ _context14.next = 45;
1245
1339
  return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
1246
1340
  case 45:
1247
1341
  tempOrder.discount_list = (nextDiscountList || []).filter(function (d) {
1248
1342
  return d.isSelected;
1249
1343
  });
1250
- _context13.next = 48;
1344
+ _context14.next = 48;
1251
1345
  return this.store.order.recalculateSummary({
1252
1346
  createIfMissing: true
1253
1347
  });
1254
1348
  case 48:
1255
1349
  this.store.order.persistTempOrder();
1256
- _context13.next = 54;
1350
+ _context14.next = 54;
1257
1351
  break;
1258
1352
  case 51:
1259
- _context13.prev = 51;
1260
- _context13.t1 = _context13["catch"](0);
1261
- throw _context13.t1;
1353
+ _context14.prev = 51;
1354
+ _context14.t1 = _context14["catch"](0);
1355
+ throw _context14.t1;
1262
1356
  case 54:
1263
1357
  case "end":
1264
- return _context13.stop();
1358
+ return _context14.stop();
1265
1359
  }
1266
- }, _callee13, this, [[0, 51], [16, 36, 39, 42]]);
1360
+ }, _callee14, this, [[0, 51], [16, 36, 39, 42]]);
1267
1361
  }));
1268
1362
  function setDiscountSelected(_x9) {
1269
1363
  return _setDiscountSelected.apply(this, arguments);
@@ -1273,23 +1367,23 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1273
1367
  }, {
1274
1368
  key: "applyDiscountCalculationResult",
1275
1369
  value: function () {
1276
- var _applyDiscountCalculationResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(result) {
1370
+ var _applyDiscountCalculationResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(result) {
1277
1371
  var tempOrder, orderStore, discountModule;
1278
- return _regeneratorRuntime().wrap(function _callee14$(_context14) {
1279
- while (1) switch (_context14.prev = _context14.next) {
1372
+ return _regeneratorRuntime().wrap(function _callee15$(_context15) {
1373
+ while (1) switch (_context15.prev = _context15.next) {
1280
1374
  case 0:
1281
- _context14.prev = 0;
1375
+ _context15.prev = 0;
1282
1376
  if (this.store.order) {
1283
- _context14.next = 3;
1377
+ _context15.next = 3;
1284
1378
  break;
1285
1379
  }
1286
1380
  throw new Error('order 模块未初始化');
1287
1381
  case 3:
1288
1382
  if (result) {
1289
- _context14.next = 5;
1383
+ _context15.next = 5;
1290
1384
  break;
1291
1385
  }
1292
- return _context14.abrupt("return");
1386
+ return _context15.abrupt("return");
1293
1387
  case 5:
1294
1388
  tempOrder = this.store.order.ensureTempOrder();
1295
1389
  orderStore = this.store.order.store || {};
@@ -1298,34 +1392,34 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1298
1392
  tempOrder.products = result.productList;
1299
1393
  }
1300
1394
  if (!result.discountList) {
1301
- _context14.next = 14;
1395
+ _context15.next = 14;
1302
1396
  break;
1303
1397
  }
1304
1398
  OrderModule.populateSavedAmounts(tempOrder.products, result.discountList);
1305
- _context14.next = 13;
1399
+ _context15.next = 13;
1306
1400
  return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(result.discountList);
1307
1401
  case 13:
1308
1402
  tempOrder.discount_list = result.discountList.filter(function (discount) {
1309
1403
  return discount.isSelected;
1310
1404
  });
1311
1405
  case 14:
1312
- _context14.next = 16;
1406
+ _context15.next = 16;
1313
1407
  return this.store.order.recalculateSummary({
1314
1408
  createIfMissing: true
1315
1409
  });
1316
1410
  case 16:
1317
1411
  this.store.order.persistTempOrder();
1318
- _context14.next = 22;
1412
+ _context15.next = 22;
1319
1413
  break;
1320
1414
  case 19:
1321
- _context14.prev = 19;
1322
- _context14.t0 = _context14["catch"](0);
1323
- throw _context14.t0;
1415
+ _context15.prev = 19;
1416
+ _context15.t0 = _context15["catch"](0);
1417
+ throw _context15.t0;
1324
1418
  case 22:
1325
1419
  case "end":
1326
- return _context14.stop();
1420
+ return _context15.stop();
1327
1421
  }
1328
- }, _callee14, this, [[0, 19]]);
1422
+ }, _callee15, this, [[0, 19]]);
1329
1423
  }));
1330
1424
  function applyDiscountCalculationResult(_x10) {
1331
1425
  return _applyDiscountCalculationResult.apply(this, arguments);
@@ -1335,16 +1429,16 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1335
1429
  }, {
1336
1430
  key: "submitScanOrder",
1337
1431
  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) {
1432
+ var _submitScanOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(params) {
1433
+ return _regeneratorRuntime().wrap(function _callee16$(_context16) {
1434
+ while (1) switch (_context16.prev = _context16.next) {
1341
1435
  case 0:
1342
- return _context15.abrupt("return", this.submitSalesOrder(params));
1436
+ return _context16.abrupt("return", this.submitSalesOrder(params));
1343
1437
  case 1:
1344
1438
  case "end":
1345
- return _context15.stop();
1439
+ return _context16.stop();
1346
1440
  }
1347
- }, _callee15, this);
1441
+ }, _callee16, this);
1348
1442
  }));
1349
1443
  function submitScanOrder(_x11) {
1350
1444
  return _submitScanOrder.apply(this, arguments);
@@ -1360,14 +1454,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1360
1454
  }, {
1361
1455
  key: "submitSalesOrder",
1362
1456
  value: (function () {
1363
- var _submitSalesOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(params) {
1457
+ var _submitSalesOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(params) {
1364
1458
  var _this$otherParams4, _this$otherParams5, _this$otherParams6;
1365
1459
  var submitParams;
1366
- return _regeneratorRuntime().wrap(function _callee16$(_context16) {
1367
- while (1) switch (_context16.prev = _context16.next) {
1460
+ return _regeneratorRuntime().wrap(function _callee17$(_context17) {
1461
+ while (1) switch (_context17.prev = _context17.next) {
1368
1462
  case 0:
1369
1463
  if (this.store.order) {
1370
- _context16.next = 2;
1464
+ _context17.next = 2;
1371
1465
  break;
1372
1466
  }
1373
1467
  throw new Error('BaseSales 解决方案需要 order 模块支持');
@@ -1389,12 +1483,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1389
1483
  enhancePayload: params.enhancePayload
1390
1484
  } : {});
1391
1485
  console.log(submitParams, 'submitParams123');
1392
- return _context16.abrupt("return", this.store.order.submitTempOrder(submitParams));
1486
+ return _context17.abrupt("return", this.store.order.submitTempOrder(submitParams));
1393
1487
  case 6:
1394
1488
  case "end":
1395
- return _context16.stop();
1489
+ return _context17.stop();
1396
1490
  }
1397
- }, _callee16, this);
1491
+ }, _callee17, this);
1398
1492
  }));
1399
1493
  function submitSalesOrder(_x12) {
1400
1494
  return _submitSalesOrder.apply(this, arguments);
@@ -1404,22 +1498,27 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1404
1498
  }, {
1405
1499
  key: "syncPaymentsToOrder",
1406
1500
  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) {
1501
+ var _syncPaymentsToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(params) {
1502
+ var _params$channel;
1503
+ var channel;
1504
+ return _regeneratorRuntime().wrap(function _callee18$(_context18) {
1505
+ while (1) switch (_context18.prev = _context18.next) {
1410
1506
  case 0:
1411
1507
  if (this.store.order) {
1412
- _context17.next = 2;
1508
+ _context18.next = 2;
1413
1509
  break;
1414
1510
  }
1415
1511
  throw new Error('order 模块未初始化');
1416
1512
  case 2:
1417
- return _context17.abrupt("return", this.store.order.syncPaymentsToOrder(params));
1418
- case 3:
1513
+ channel = (_params$channel = params.channel) !== null && _params$channel !== void 0 ? _params$channel : this.getSubmitOrderSalesChannel();
1514
+ return _context18.abrupt("return", this.store.order.syncPaymentsToOrder(_objectSpread(_objectSpread({}, params), channel !== undefined ? {
1515
+ channel: channel
1516
+ } : {})));
1517
+ case 4:
1419
1518
  case "end":
1420
- return _context17.stop();
1519
+ return _context18.stop();
1421
1520
  }
1422
- }, _callee17, this);
1521
+ }, _callee18, this);
1423
1522
  }));
1424
1523
  function syncPaymentsToOrder(_x13) {
1425
1524
  return _syncPaymentsToOrder.apply(this, arguments);
@@ -1500,11 +1599,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1500
1599
  surcharge_rounding_remainder: metadata.surcharge_rounding_remainder
1501
1600
  },
1502
1601
  product_bundle: (product.product_bundle || []).map(function (bundle) {
1602
+ var _bundle$bundle_id, _bundle$bundle_produc, _bundle$bundle_group_;
1503
1603
  var bundleMetadata = bundle.metadata || {};
1504
1604
  return {
1505
1605
  is_price_include_tax: tempOrder.is_price_include_tax,
1506
- bundle_id: bundle.bundle_id,
1507
- bundle_product_id: bundle.bundle_product_id,
1606
+ // 套餐子项在 tempOrder 上常为 id(如 1718),prepare/deduction 协议要求 bundle_id
1607
+ bundle_id: (_bundle$bundle_id = bundle.bundle_id) !== null && _bundle$bundle_id !== void 0 ? _bundle$bundle_id : bundle.id,
1608
+ bundle_product_id: (_bundle$bundle_produc = bundle.bundle_product_id) !== null && _bundle$bundle_produc !== void 0 ? _bundle$bundle_produc : bundle._bundle_product_id,
1609
+ bundle_group_id: (_bundle$bundle_group_ = bundle.bundle_group_id) !== null && _bundle$bundle_group_ !== void 0 ? _bundle$bundle_group_ : bundle.group_id,
1508
1610
  bundle_variant_id: bundle.bundle_variant_id,
1509
1611
  price_type: bundle.price_type,
1510
1612
  price_type_ext: bundle.price_type_ext,
@@ -1525,20 +1627,20 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1525
1627
  }, {
1526
1628
  key: "initWalletData",
1527
1629
  value: function () {
1528
- var _initWalletData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(params) {
1630
+ var _initWalletData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(params) {
1529
1631
  var _params$order_wait_pa, _ref, _tempOrder$is_price_i;
1530
1632
  var snapshot, tempOrder, amount, walletBusinessData, result;
1531
- return _regeneratorRuntime().wrap(function _callee18$(_context18) {
1532
- while (1) switch (_context18.prev = _context18.next) {
1633
+ return _regeneratorRuntime().wrap(function _callee19$(_context19) {
1634
+ while (1) switch (_context19.prev = _context19.next) {
1533
1635
  case 0:
1534
1636
  if (this.store.order) {
1535
- _context18.next = 2;
1637
+ _context19.next = 2;
1536
1638
  break;
1537
1639
  }
1538
1640
  throw new Error('order 模块未初始化');
1539
1641
  case 2:
1540
1642
  if (this.store.payment) {
1541
- _context18.next = 4;
1643
+ _context19.next = 4;
1542
1644
  break;
1543
1645
  }
1544
1646
  throw new Error('payment 模块未初始化');
@@ -1547,10 +1649,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1547
1649
  tempOrder = snapshot === null || snapshot === void 0 ? void 0 : snapshot.tempOrder;
1548
1650
  amount = snapshot === null || snapshot === void 0 ? void 0 : snapshot.amount;
1549
1651
  if (!(!tempOrder || !amount)) {
1550
- _context18.next = 9;
1652
+ _context19.next = 9;
1551
1653
  break;
1552
1654
  }
1553
- return _context18.abrupt("return", {
1655
+ return _context19.abrupt("return", {
1554
1656
  walletRecommendList: [],
1555
1657
  userIdentificationCodes: [],
1556
1658
  transformList: [],
@@ -1573,11 +1675,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1573
1675
  }, snapshot.identity.orderId ? {
1574
1676
  payment_order_id: String(snapshot.identity.orderId)
1575
1677
  } : {});
1576
- _context18.next = 12;
1678
+ _context19.next = 12;
1577
1679
  return this.store.payment.wallet.initializeWalletDataFromBusinessAsync(walletBusinessData);
1578
1680
  case 12:
1579
- result = _context18.sent;
1580
- _context18.next = 15;
1681
+ result = _context19.sent;
1682
+ _context19.next = 15;
1581
1683
  return this.core.effects.emit("".concat(this.name, ":onWalletDataInitialized"), {
1582
1684
  orderId: snapshot.identity.orderId,
1583
1685
  customerId: walletBusinessData.customer_id,
@@ -1589,12 +1691,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1589
1691
  timestamp: Date.now()
1590
1692
  });
1591
1693
  case 15:
1592
- return _context18.abrupt("return", result);
1694
+ return _context19.abrupt("return", result);
1593
1695
  case 16:
1594
1696
  case "end":
1595
- return _context18.stop();
1697
+ return _context19.stop();
1596
1698
  }
1597
- }, _callee18, this);
1699
+ }, _callee19, this);
1598
1700
  }));
1599
1701
  function initWalletData(_x14) {
1600
1702
  return _initWalletData.apply(this, arguments);
@@ -1623,27 +1725,27 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1623
1725
  }, {
1624
1726
  key: "getPaymentMethodsAsync",
1625
1727
  value: (function () {
1626
- var _getPaymentMethodsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19() {
1728
+ var _getPaymentMethodsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20() {
1627
1729
  var response;
1628
- return _regeneratorRuntime().wrap(function _callee19$(_context19) {
1629
- while (1) switch (_context19.prev = _context19.next) {
1730
+ return _regeneratorRuntime().wrap(function _callee20$(_context20) {
1731
+ while (1) switch (_context20.prev = _context20.next) {
1630
1732
  case 0:
1631
1733
  if (!this.store.payment) {
1632
- _context19.next = 2;
1734
+ _context20.next = 2;
1633
1735
  break;
1634
1736
  }
1635
- return _context19.abrupt("return", this.store.payment.getPayMethodListAsync());
1737
+ return _context20.abrupt("return", this.store.payment.getPayMethodListAsync());
1636
1738
  case 2:
1637
- _context19.next = 4;
1739
+ _context20.next = 4;
1638
1740
  return this.request.get('/pay/custom-payment/all');
1639
1741
  case 4:
1640
- response = _context19.sent;
1641
- return _context19.abrupt("return", (response === null || response === void 0 ? void 0 : response.data) || []);
1742
+ response = _context20.sent;
1743
+ return _context20.abrupt("return", (response === null || response === void 0 ? void 0 : response.data) || []);
1642
1744
  case 6:
1643
1745
  case "end":
1644
- return _context19.stop();
1746
+ return _context20.stop();
1645
1747
  }
1646
- }, _callee19, this);
1748
+ }, _callee20, this);
1647
1749
  }));
1648
1750
  function getPaymentMethodsAsync() {
1649
1751
  return _getPaymentMethodsAsync.apply(this, arguments);
@@ -1684,47 +1786,47 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1684
1786
  }, {
1685
1787
  key: "sendCustomerPayLink",
1686
1788
  value: (function () {
1687
- var _sendCustomerPayLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(params) {
1789
+ var _sendCustomerPayLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(params) {
1688
1790
  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) {
1791
+ return _regeneratorRuntime().wrap(function _callee21$(_context21) {
1792
+ while (1) switch (_context21.prev = _context21.next) {
1691
1793
  case 0:
1692
1794
  if (this.store.order) {
1693
- _context20.next = 2;
1795
+ _context21.next = 2;
1694
1796
  break;
1695
1797
  }
1696
1798
  throw new Error('order 模块未初始化');
1697
1799
  case 2:
1698
1800
  orderIds = params.order_ids || params.orderIds || [];
1699
1801
  if (!(!orderIds.length || params.submitBeforeSend)) {
1700
- _context20.next = 11;
1802
+ _context21.next = 11;
1701
1803
  break;
1702
1804
  }
1703
- _context20.next = 6;
1805
+ _context21.next = 6;
1704
1806
  return this.submitSalesOrder({
1705
1807
  smallTicketDataFlag: 1
1706
1808
  });
1707
1809
  case 6:
1708
- submitResult = _context20.sent;
1810
+ submitResult = _context21.sent;
1709
1811
  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
1812
  if (orderId) {
1711
- _context20.next = 10;
1813
+ _context21.next = 10;
1712
1814
  break;
1713
1815
  }
1714
1816
  throw new Error('本地订单提交云端失败,无法发送支付链接');
1715
1817
  case 10:
1716
1818
  orderIds = [orderId];
1717
1819
  case 11:
1718
- return _context20.abrupt("return", this.store.order.sendCustomerPayLink({
1820
+ return _context21.abrupt("return", this.store.order.sendCustomerPayLink({
1719
1821
  emails: params.emails,
1720
1822
  notify_action: params.notify_action,
1721
1823
  order_ids: orderIds
1722
1824
  }));
1723
1825
  case 12:
1724
1826
  case "end":
1725
- return _context20.stop();
1827
+ return _context21.stop();
1726
1828
  }
1727
- }, _callee20, this);
1829
+ }, _callee21, this);
1728
1830
  }));
1729
1831
  function sendCustomerPayLink(_x15) {
1730
1832
  return _sendCustomerPayLink.apply(this, arguments);
@@ -1739,30 +1841,30 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1739
1841
  }, {
1740
1842
  key: "calculateProductBookingPrice",
1741
1843
  value: function () {
1742
- var _calculateProductBookingPrice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(params) {
1844
+ var _calculateProductBookingPrice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(params) {
1743
1845
  var _params$customer_id;
1744
1846
  var quotation, customerId;
1745
- return _regeneratorRuntime().wrap(function _callee21$(_context21) {
1746
- while (1) switch (_context21.prev = _context21.next) {
1847
+ return _regeneratorRuntime().wrap(function _callee22$(_context22) {
1848
+ while (1) switch (_context22.prev = _context22.next) {
1747
1849
  case 0:
1748
1850
  quotation = this.store.quotation;
1749
1851
  customerId = (_params$customer_id = params.customer_id) !== null && _params$customer_id !== void 0 ? _params$customer_id : this.getCurrentOrderCustomerId();
1750
- _context21.next = 4;
1852
+ _context22.next = 4;
1751
1853
  return this.loadQuotationForPriceQuery({
1752
1854
  quotation: quotation,
1753
1855
  customer_id: customerId,
1754
1856
  channel: params.channel
1755
1857
  });
1756
1858
  case 4:
1757
- return _context21.abrupt("return", calculateBaseSalesProductBookingPrice(_objectSpread(_objectSpread({}, params), {}, {
1859
+ return _context22.abrupt("return", calculateBaseSalesProductBookingPrice(_objectSpread(_objectSpread({}, params), {}, {
1758
1860
  customer_id: customerId,
1759
1861
  quotation: quotation
1760
1862
  })));
1761
1863
  case 5:
1762
1864
  case "end":
1763
- return _context21.stop();
1865
+ return _context22.stop();
1764
1866
  }
1765
- }, _callee21, this);
1867
+ }, _callee22, this);
1766
1868
  }));
1767
1869
  function calculateProductBookingPrice(_x16) {
1768
1870
  return _calculateProductBookingPrice.apply(this, arguments);
@@ -1772,32 +1874,32 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1772
1874
  }, {
1773
1875
  key: "addProductToOrder",
1774
1876
  value: function () {
1775
- var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(product, booking) {
1877
+ var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(product, booking) {
1776
1878
  var products;
1777
- return _regeneratorRuntime().wrap(function _callee22$(_context22) {
1778
- while (1) switch (_context22.prev = _context22.next) {
1879
+ return _regeneratorRuntime().wrap(function _callee23$(_context23) {
1880
+ while (1) switch (_context23.prev = _context23.next) {
1779
1881
  case 0:
1780
- _context22.prev = 0;
1882
+ _context23.prev = 0;
1781
1883
  if (this.store.order) {
1782
- _context22.next = 3;
1884
+ _context23.next = 3;
1783
1885
  break;
1784
1886
  }
1785
1887
  throw new Error('order 模块未初始化');
1786
1888
  case 3:
1787
- _context22.next = 5;
1889
+ _context23.next = 5;
1788
1890
  return this.store.order.addProductToOrder(product, booking);
1789
1891
  case 5:
1790
- products = _context22.sent;
1791
- return _context22.abrupt("return", products);
1892
+ products = _context23.sent;
1893
+ return _context23.abrupt("return", products);
1792
1894
  case 9:
1793
- _context22.prev = 9;
1794
- _context22.t0 = _context22["catch"](0);
1795
- throw _context22.t0;
1895
+ _context23.prev = 9;
1896
+ _context23.t0 = _context23["catch"](0);
1897
+ throw _context23.t0;
1796
1898
  case 12:
1797
1899
  case "end":
1798
- return _context22.stop();
1900
+ return _context23.stop();
1799
1901
  }
1800
- }, _callee22, this, [[0, 9]]);
1902
+ }, _callee23, this, [[0, 9]]);
1801
1903
  }));
1802
1904
  function addProductToOrder(_x17, _x18) {
1803
1905
  return _addProductToOrder.apply(this, arguments);
@@ -1807,38 +1909,73 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1807
1909
  }, {
1808
1910
  key: "updateOrderProduct",
1809
1911
  value: function () {
1810
- var _updateOrderProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(params) {
1912
+ var _updateOrderProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(params) {
1811
1913
  var products;
1812
- return _regeneratorRuntime().wrap(function _callee23$(_context23) {
1813
- while (1) switch (_context23.prev = _context23.next) {
1914
+ return _regeneratorRuntime().wrap(function _callee24$(_context24) {
1915
+ while (1) switch (_context24.prev = _context24.next) {
1814
1916
  case 0:
1815
- _context23.prev = 0;
1917
+ _context24.prev = 0;
1816
1918
  if (this.store.order) {
1817
- _context23.next = 3;
1919
+ _context24.next = 3;
1818
1920
  break;
1819
1921
  }
1820
1922
  throw new Error('order 模块未初始化');
1821
1923
  case 3:
1822
- _context23.next = 5;
1924
+ _context24.next = 5;
1823
1925
  return this.store.order.updateOrderProduct(params);
1824
1926
  case 5:
1825
- products = _context23.sent;
1826
- return _context23.abrupt("return", products);
1927
+ products = _context24.sent;
1928
+ return _context24.abrupt("return", products);
1827
1929
  case 9:
1828
- _context23.prev = 9;
1829
- _context23.t0 = _context23["catch"](0);
1830
- throw _context23.t0;
1930
+ _context24.prev = 9;
1931
+ _context24.t0 = _context24["catch"](0);
1932
+ throw _context24.t0;
1831
1933
  case 12:
1832
1934
  case "end":
1833
- return _context23.stop();
1935
+ return _context24.stop();
1834
1936
  }
1835
- }, _callee23, this, [[0, 9]]);
1937
+ }, _callee24, this, [[0, 9]]);
1836
1938
  }));
1837
1939
  function updateOrderProduct(_x19) {
1838
1940
  return _updateOrderProduct.apply(this, arguments);
1839
1941
  }
1840
1942
  return updateOrderProduct;
1841
1943
  }()
1944
+ }, {
1945
+ key: "updateOrderProductQuantity",
1946
+ value: function () {
1947
+ var _updateOrderProductQuantity = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(params) {
1948
+ var products;
1949
+ return _regeneratorRuntime().wrap(function _callee25$(_context25) {
1950
+ while (1) switch (_context25.prev = _context25.next) {
1951
+ case 0:
1952
+ _context25.prev = 0;
1953
+ if (this.store.order) {
1954
+ _context25.next = 3;
1955
+ break;
1956
+ }
1957
+ throw new Error('order 模块未初始化');
1958
+ case 3:
1959
+ _context25.next = 5;
1960
+ return this.store.order.updateOrderProductQuantity(params);
1961
+ case 5:
1962
+ products = _context25.sent;
1963
+ return _context25.abrupt("return", products);
1964
+ case 9:
1965
+ _context25.prev = 9;
1966
+ _context25.t0 = _context25["catch"](0);
1967
+ throw _context25.t0;
1968
+ case 12:
1969
+ case "end":
1970
+ return _context25.stop();
1971
+ }
1972
+ }, _callee25, this, [[0, 9]]);
1973
+ }));
1974
+ function updateOrderProductQuantity(_x20) {
1975
+ return _updateOrderProductQuantity.apply(this, arguments);
1976
+ }
1977
+ return updateOrderProductQuantity;
1978
+ }()
1842
1979
  }, {
1843
1980
  key: "updateOrderBooking",
1844
1981
  value: function updateOrderBooking(params) {
@@ -1857,12 +1994,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1857
1994
  }, {
1858
1995
  key: "setOrderProductLineNote",
1859
1996
  value: (function () {
1860
- var _setOrderProductLineNote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(identity, note) {
1997
+ var _setOrderProductLineNote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(identity, note) {
1861
1998
  var params, products;
1862
- return _regeneratorRuntime().wrap(function _callee24$(_context24) {
1863
- while (1) switch (_context24.prev = _context24.next) {
1999
+ return _regeneratorRuntime().wrap(function _callee26$(_context26) {
2000
+ while (1) switch (_context26.prev = _context26.next) {
1864
2001
  case 0:
1865
- _context24.prev = 0;
2002
+ _context26.prev = 0;
1866
2003
  params = {
1867
2004
  product_id: identity.product_id,
1868
2005
  product_variant_id: identity.product_variant_id,
@@ -1877,22 +2014,22 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1877
2014
  params.product_option_item = identity.product_option_item;
1878
2015
  }
1879
2016
  if (identity.product_bundle !== undefined) params.product_bundle = identity.product_bundle;
1880
- _context24.next = 7;
2017
+ _context26.next = 7;
1881
2018
  return this.updateOrderProduct(params);
1882
2019
  case 7:
1883
- products = _context24.sent;
1884
- return _context24.abrupt("return", products);
2020
+ products = _context26.sent;
2021
+ return _context26.abrupt("return", products);
1885
2022
  case 11:
1886
- _context24.prev = 11;
1887
- _context24.t0 = _context24["catch"](0);
1888
- throw _context24.t0;
2023
+ _context26.prev = 11;
2024
+ _context26.t0 = _context26["catch"](0);
2025
+ throw _context26.t0;
1889
2026
  case 14:
1890
2027
  case "end":
1891
- return _context24.stop();
2028
+ return _context26.stop();
1892
2029
  }
1893
- }, _callee24, this, [[0, 11]]);
2030
+ }, _callee26, this, [[0, 11]]);
1894
2031
  }));
1895
- function setOrderProductLineNote(_x20, _x21) {
2032
+ function setOrderProductLineNote(_x21, _x22) {
1896
2033
  return _setOrderProductLineNote.apply(this, arguments);
1897
2034
  }
1898
2035
  return setOrderProductLineNote;
@@ -1900,34 +2037,34 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1900
2037
  }, {
1901
2038
  key: "removeProductFromOrder",
1902
2039
  value: function () {
1903
- var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(identity) {
2040
+ var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(identity) {
1904
2041
  var products;
1905
- return _regeneratorRuntime().wrap(function _callee25$(_context25) {
1906
- while (1) switch (_context25.prev = _context25.next) {
2042
+ return _regeneratorRuntime().wrap(function _callee27$(_context27) {
2043
+ while (1) switch (_context27.prev = _context27.next) {
1907
2044
  case 0:
1908
- _context25.prev = 0;
2045
+ _context27.prev = 0;
1909
2046
  if (this.store.order) {
1910
- _context25.next = 3;
2047
+ _context27.next = 3;
1911
2048
  break;
1912
2049
  }
1913
2050
  throw new Error('order 模块未初始化');
1914
2051
  case 3:
1915
- _context25.next = 5;
2052
+ _context27.next = 5;
1916
2053
  return this.store.order.removeProductFromOrder(identity);
1917
2054
  case 5:
1918
- products = _context25.sent;
1919
- return _context25.abrupt("return", products);
2055
+ products = _context27.sent;
2056
+ return _context27.abrupt("return", products);
1920
2057
  case 9:
1921
- _context25.prev = 9;
1922
- _context25.t0 = _context25["catch"](0);
1923
- throw _context25.t0;
2058
+ _context27.prev = 9;
2059
+ _context27.t0 = _context27["catch"](0);
2060
+ throw _context27.t0;
1924
2061
  case 12:
1925
2062
  case "end":
1926
- return _context25.stop();
2063
+ return _context27.stop();
1927
2064
  }
1928
- }, _callee25, this, [[0, 9]]);
2065
+ }, _callee27, this, [[0, 9]]);
1929
2066
  }));
1930
- function removeProductFromOrder(_x22) {
2067
+ function removeProductFromOrder(_x23) {
1931
2068
  return _removeProductFromOrder.apply(this, arguments);
1932
2069
  }
1933
2070
  return removeProductFromOrder;
@@ -1936,18 +2073,18 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1936
2073
  }, {
1937
2074
  key: "getProductList",
1938
2075
  value: function () {
1939
- var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26() {
2076
+ var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28() {
1940
2077
  var _this$otherParams7;
1941
2078
  var menu_list_ids, _this$store$products, res;
1942
- return _regeneratorRuntime().wrap(function _callee26$(_context26) {
1943
- while (1) switch (_context26.prev = _context26.next) {
2079
+ return _regeneratorRuntime().wrap(function _callee28$(_context28) {
2080
+ while (1) switch (_context28.prev = _context28.next) {
1944
2081
  case 0:
1945
2082
  // 可以直接通过配置里的 menu 读取
1946
2083
  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
2084
  return Number(n.value);
1948
2085
  })) || [];
1949
- _context26.prev = 1;
1950
- _context26.next = 4;
2086
+ _context28.prev = 1;
2087
+ _context28.next = 4;
1951
2088
  return (_this$store$products = this.store.products) === null || _this$store$products === void 0 ? void 0 : _this$store$products.loadProducts({
1952
2089
  menu_list_ids: menu_list_ids,
1953
2090
  cacheId: this.cacheId,
@@ -1955,17 +2092,17 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1955
2092
  schedule_datetime: dayjs().format('YYYY-MM-DD HH:mm:ss')
1956
2093
  });
1957
2094
  case 4:
1958
- res = _context26.sent;
1959
- return _context26.abrupt("return", res);
2095
+ res = _context28.sent;
2096
+ return _context28.abrupt("return", res);
1960
2097
  case 8:
1961
- _context26.prev = 8;
1962
- _context26.t0 = _context26["catch"](1);
1963
- throw _context26.t0;
2098
+ _context28.prev = 8;
2099
+ _context28.t0 = _context28["catch"](1);
2100
+ throw _context28.t0;
1964
2101
  case 11:
1965
2102
  case "end":
1966
- return _context26.stop();
2103
+ return _context28.stop();
1967
2104
  }
1968
- }, _callee26, this, [[1, 8]]);
2105
+ }, _callee28, this, [[1, 8]]);
1969
2106
  }));
1970
2107
  function getProductList() {
1971
2108
  return _getProductList.apply(this, arguments);
@@ -1980,15 +2117,15 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1980
2117
  }, {
1981
2118
  key: "setOtherParams",
1982
2119
  value: function () {
1983
- var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(params) {
2120
+ var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(params) {
1984
2121
  var _ref4,
1985
2122
  _ref4$cover,
1986
2123
  cover,
1987
- _args27 = arguments;
1988
- return _regeneratorRuntime().wrap(function _callee27$(_context27) {
1989
- while (1) switch (_context27.prev = _context27.next) {
2124
+ _args29 = arguments;
2125
+ return _regeneratorRuntime().wrap(function _callee29$(_context29) {
2126
+ while (1) switch (_context29.prev = _context29.next) {
1990
2127
  case 0:
1991
- _ref4 = _args27.length > 1 && _args27[1] !== undefined ? _args27[1] : {}, _ref4$cover = _ref4.cover, cover = _ref4$cover === void 0 ? false : _ref4$cover;
2128
+ _ref4 = _args29.length > 1 && _args29[1] !== undefined ? _args29[1] : {}, _ref4$cover = _ref4.cover, cover = _ref4$cover === void 0 ? false : _ref4$cover;
1992
2129
  if (cover) {
1993
2130
  this.otherParams = params;
1994
2131
  } else {
@@ -1996,11 +2133,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1996
2133
  }
1997
2134
  case 2:
1998
2135
  case "end":
1999
- return _context27.stop();
2136
+ return _context29.stop();
2000
2137
  }
2001
- }, _callee27, this);
2138
+ }, _callee29, this);
2002
2139
  }));
2003
- function setOtherParams(_x23) {
2140
+ function setOtherParams(_x24) {
2004
2141
  return _setOtherParams.apply(this, arguments);
2005
2142
  }
2006
2143
  return setOtherParams;