@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.
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +45 -15
- package/dist/modules/Order/index.d.ts +10 -3
- package/dist/modules/Order/index.js +275 -142
- package/dist/modules/Order/types.d.ts +9 -2
- package/dist/modules/Order/types.js +2 -0
- package/dist/modules/Order/utils.d.ts +13 -0
- package/dist/modules/Order/utils.js +69 -15
- package/dist/server/index.js +1 -0
- package/dist/solution/BaseSales/index.d.ts +9 -1
- package/dist/solution/BaseSales/index.js +378 -241
- package/dist/solution/BaseSales/types.d.ts +3 -0
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +33 -14
- package/dist/solution/BaseSales/utils.js +36 -7
- package/dist/solution/BookingTicket/index.d.ts +3 -0
- package/dist/solution/BookingTicket/index.js +170 -86
- package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +4 -2
- package/dist/solution/BookingTicket/utils/addProductDecision.js +37 -19
- package/dist/solution/ScanOrder/utils.js +36 -7
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +35 -9
- package/lib/modules/Order/index.d.ts +10 -3
- package/lib/modules/Order/index.js +107 -4
- package/lib/modules/Order/types.d.ts +9 -2
- package/lib/modules/Order/utils.d.ts +13 -0
- package/lib/modules/Order/utils.js +57 -9
- package/lib/server/index.js +1 -0
- package/lib/solution/BaseSales/index.d.ts +9 -1
- package/lib/solution/BaseSales/index.js +71 -3
- package/lib/solution/BaseSales/types.d.ts +3 -0
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +31 -10
- package/lib/solution/BaseSales/utils.js +37 -5
- package/lib/solution/BookingTicket/index.d.ts +3 -0
- package/lib/solution/BookingTicket/index.js +57 -6
- package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +4 -2
- package/lib/solution/BookingTicket/utils/addProductDecision.js +28 -12
- package/lib/solution/ScanOrder/utils.js +37 -5
- package/package.json +1 -1
|
@@ -61,6 +61,8 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
61
61
|
_defineProperty(_assertThisInitialized(_this), "platform", void 0);
|
|
62
62
|
_defineProperty(_assertThisInitialized(_this), "scan", void 0);
|
|
63
63
|
_defineProperty(_assertThisInitialized(_this), "productCatalog", []);
|
|
64
|
+
_defineProperty(_assertThisInitialized(_this), "orderCustomerDiscountRefreshInFlight", null);
|
|
65
|
+
_defineProperty(_assertThisInitialized(_this), "orderCustomerDiscountRefreshCustomerId", null);
|
|
64
66
|
return _this;
|
|
65
67
|
}
|
|
66
68
|
_createClass(BookingTicketImpl, [{
|
|
@@ -135,7 +137,8 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
135
137
|
key: "loadSalesDetail",
|
|
136
138
|
value: (function () {
|
|
137
139
|
var _loadSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(orderIdOrParams) {
|
|
138
|
-
var
|
|
140
|
+
var _ref;
|
|
141
|
+
var sales, customerModule, detailCustomer, orderCustomerSnapshot, protocolCustomerId, protocolCustomer, selectedCustomer, _selectedCustomer$nam, _ref2, detailCustomerId, detailCustomerRest, rawId, customer;
|
|
139
142
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
140
143
|
while (1) switch (_context2.prev = _context2.next) {
|
|
141
144
|
case 0:
|
|
@@ -146,21 +149,36 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
146
149
|
console.log(sales, '1234sales');
|
|
147
150
|
customerModule = this.store.customer;
|
|
148
151
|
detailCustomer = sales === null || sales === void 0 ? void 0 : sales.customer;
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
152
|
+
orderCustomerSnapshot = this.store.order.getOrderCustomerSnapshot();
|
|
153
|
+
protocolCustomerId = sales === null || sales === void 0 ? void 0 : sales.customer_id;
|
|
154
|
+
protocolCustomer = protocolCustomerId !== undefined && protocolCustomerId !== null ? {
|
|
155
|
+
id: protocolCustomerId,
|
|
156
|
+
name: String((sales === null || sales === void 0 ? void 0 : sales.customer_name) || ''),
|
|
157
|
+
phone: sales === null || sales === void 0 ? void 0 : sales.phone,
|
|
158
|
+
email: sales === null || sales === void 0 ? void 0 : sales.email,
|
|
159
|
+
country_calling_code: sales === null || sales === void 0 ? void 0 : sales.country_calling_code
|
|
160
|
+
} : null;
|
|
161
|
+
selectedCustomer = (_ref = detailCustomer !== null && detailCustomer !== void 0 ? detailCustomer : orderCustomerSnapshot) !== null && _ref !== void 0 ? _ref : protocolCustomer;
|
|
162
|
+
if (!(customerModule && selectedCustomer)) {
|
|
163
|
+
_context2.next = 18;
|
|
164
|
+
break;
|
|
161
165
|
}
|
|
166
|
+
_ref2 = selectedCustomer !== null && selectedCustomer !== void 0 ? selectedCustomer : {}, detailCustomerId = _ref2.id, detailCustomerRest = _objectWithoutProperties(_ref2, _excluded);
|
|
167
|
+
rawId = detailCustomerId !== null && detailCustomerId !== void 0 ? detailCustomerId : '';
|
|
168
|
+
customer = _objectSpread(_objectSpread({}, detailCustomerRest), {}, {
|
|
169
|
+
id: rawId == null ? '' : rawId,
|
|
170
|
+
name: (_selectedCustomer$nam = selectedCustomer === null || selectedCustomer === void 0 ? void 0 : selectedCustomer.name) !== null && _selectedCustomer$nam !== void 0 ? _selectedCustomer$nam : '',
|
|
171
|
+
phone: selectedCustomer === null || selectedCustomer === void 0 ? void 0 : selectedCustomer.phone,
|
|
172
|
+
email: selectedCustomer === null || selectedCustomer === void 0 ? void 0 : selectedCustomer.email,
|
|
173
|
+
country_calling_code: selectedCustomer === null || selectedCustomer === void 0 ? void 0 : selectedCustomer.country_calling_code
|
|
174
|
+
});
|
|
175
|
+
customerModule.setSelectedCustomer(customer);
|
|
176
|
+
this.setOrderCustomer(customer);
|
|
177
|
+
_context2.next = 18;
|
|
178
|
+
return this.store.order.saveDraft();
|
|
179
|
+
case 18:
|
|
162
180
|
return _context2.abrupt("return", sales);
|
|
163
|
-
case
|
|
181
|
+
case 19:
|
|
164
182
|
case "end":
|
|
165
183
|
return _context2.stop();
|
|
166
184
|
}
|
|
@@ -678,6 +696,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
678
696
|
this.store.order.setOrderCustomer(patch, customer);
|
|
679
697
|
var next = this.buildOrderCustomerPayload();
|
|
680
698
|
this.core.effects.emit("".concat(this.name, ":onOrderCustomerChange"), next);
|
|
699
|
+
this.refreshDiscountConfigAfterOrderCustomerChange(patch.customer_id);
|
|
681
700
|
}
|
|
682
701
|
|
|
683
702
|
/**
|
|
@@ -704,7 +723,22 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
704
723
|
}, {
|
|
705
724
|
key: "clearOrderCustomer",
|
|
706
725
|
value: function clearOrderCustomer() {
|
|
726
|
+
var _discountModule$setOr,
|
|
727
|
+
_discountModule$setDi,
|
|
728
|
+
_this2 = this;
|
|
707
729
|
this.store.order.clearOrderCustomer();
|
|
730
|
+
var orderStore = this.store.order.store || {};
|
|
731
|
+
var discountModule = orderStore.discount;
|
|
732
|
+
void (discountModule === null || discountModule === void 0 || (_discountModule$setOr = discountModule.setOriginalDiscountList) === null || _discountModule$setOr === void 0 ? void 0 : _discountModule$setOr.call(discountModule, []));
|
|
733
|
+
void (discountModule === null || discountModule === void 0 || (_discountModule$setDi = discountModule.setDiscountList) === null || _discountModule$setDi === void 0 ? void 0 : _discountModule$setDi.call(discountModule, []));
|
|
734
|
+
this.store.order.applyDiscount();
|
|
735
|
+
void this.store.order.recalculateSummary({
|
|
736
|
+
createIfMissing: true
|
|
737
|
+
}).then(function () {
|
|
738
|
+
return _this2.store.order.persistTempOrder();
|
|
739
|
+
}).catch(function (error) {
|
|
740
|
+
console.error('Failed to recalculate summary after clearing customer:', error);
|
|
741
|
+
});
|
|
708
742
|
this.core.effects.emit("".concat(this.name, ":onOrderCustomerChange"), null);
|
|
709
743
|
}
|
|
710
744
|
|
|
@@ -754,6 +788,56 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
754
788
|
snapshot: this.store.order.getOrderCustomerSnapshot()
|
|
755
789
|
};
|
|
756
790
|
}
|
|
791
|
+
}, {
|
|
792
|
+
key: "refreshDiscountConfigAfterOrderCustomerChange",
|
|
793
|
+
value: function refreshDiscountConfigAfterOrderCustomerChange(customerId) {
|
|
794
|
+
var _this3 = this;
|
|
795
|
+
if (!customerId || customerId === 1) return;
|
|
796
|
+
if (this.orderCustomerDiscountRefreshInFlight && this.orderCustomerDiscountRefreshCustomerId === customerId) {
|
|
797
|
+
return;
|
|
798
|
+
}
|
|
799
|
+
var previousRefresh = this.orderCustomerDiscountRefreshInFlight;
|
|
800
|
+
var refreshTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
|
|
801
|
+
var currentCustomer;
|
|
802
|
+
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
803
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
804
|
+
case 0:
|
|
805
|
+
if (!previousRefresh) {
|
|
806
|
+
_context12.next = 3;
|
|
807
|
+
break;
|
|
808
|
+
}
|
|
809
|
+
_context12.next = 3;
|
|
810
|
+
return previousRefresh.catch(function () {
|
|
811
|
+
return undefined;
|
|
812
|
+
});
|
|
813
|
+
case 3:
|
|
814
|
+
currentCustomer = _this3.store.order.getOrderCustomer();
|
|
815
|
+
if (!(!currentCustomer || Number(currentCustomer.customer_id) !== customerId)) {
|
|
816
|
+
_context12.next = 6;
|
|
817
|
+
break;
|
|
818
|
+
}
|
|
819
|
+
return _context12.abrupt("return");
|
|
820
|
+
case 6:
|
|
821
|
+
_context12.next = 8;
|
|
822
|
+
return _this3.loadDiscountConfig({
|
|
823
|
+
customerId: customerId
|
|
824
|
+
});
|
|
825
|
+
case 8:
|
|
826
|
+
case "end":
|
|
827
|
+
return _context12.stop();
|
|
828
|
+
}
|
|
829
|
+
}, _callee12);
|
|
830
|
+
}))();
|
|
831
|
+
this.orderCustomerDiscountRefreshInFlight = refreshTask;
|
|
832
|
+
this.orderCustomerDiscountRefreshCustomerId = customerId;
|
|
833
|
+
refreshTask.catch(function (error) {
|
|
834
|
+
console.error('Failed to load discount config after customer change:', error);
|
|
835
|
+
}).finally(function () {
|
|
836
|
+
if (_this3.orderCustomerDiscountRefreshInFlight !== refreshTask) return;
|
|
837
|
+
_this3.orderCustomerDiscountRefreshInFlight = null;
|
|
838
|
+
_this3.orderCustomerDiscountRefreshCustomerId = null;
|
|
839
|
+
});
|
|
840
|
+
}
|
|
757
841
|
|
|
758
842
|
/**
|
|
759
843
|
* 获取客户分页信息
|
|
@@ -795,27 +879,27 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
795
879
|
}, {
|
|
796
880
|
key: "changeCustomerPage",
|
|
797
881
|
value: (function () {
|
|
798
|
-
var _changeCustomerPage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
882
|
+
var _changeCustomerPage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(page, pageSize) {
|
|
799
883
|
var _result3;
|
|
800
|
-
return _regeneratorRuntime().wrap(function
|
|
801
|
-
while (1) switch (
|
|
884
|
+
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
885
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
802
886
|
case 0:
|
|
803
|
-
|
|
804
|
-
|
|
887
|
+
_context13.prev = 0;
|
|
888
|
+
_context13.next = 3;
|
|
805
889
|
return this.store.customer.changeCustomerPage(page, pageSize);
|
|
806
890
|
case 3:
|
|
807
|
-
_result3 =
|
|
808
|
-
return
|
|
891
|
+
_result3 = _context13.sent;
|
|
892
|
+
return _context13.abrupt("return", _result3);
|
|
809
893
|
case 7:
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
console.error('Failed to change customer page:',
|
|
813
|
-
throw
|
|
894
|
+
_context13.prev = 7;
|
|
895
|
+
_context13.t0 = _context13["catch"](0);
|
|
896
|
+
console.error('Failed to change customer page:', _context13.t0);
|
|
897
|
+
throw _context13.t0;
|
|
814
898
|
case 11:
|
|
815
899
|
case "end":
|
|
816
|
-
return
|
|
900
|
+
return _context13.stop();
|
|
817
901
|
}
|
|
818
|
-
},
|
|
902
|
+
}, _callee13, this, [[0, 7]]);
|
|
819
903
|
}));
|
|
820
904
|
function changeCustomerPage(_x8, _x9) {
|
|
821
905
|
return _changeCustomerPage.apply(this, arguments);
|
|
@@ -830,28 +914,28 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
830
914
|
}, {
|
|
831
915
|
key: "loadMoreCustomers",
|
|
832
916
|
value: (function () {
|
|
833
|
-
var _loadMoreCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
917
|
+
var _loadMoreCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
|
|
834
918
|
var _result4;
|
|
835
|
-
return _regeneratorRuntime().wrap(function
|
|
836
|
-
while (1) switch (
|
|
919
|
+
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
920
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
837
921
|
case 0:
|
|
838
|
-
|
|
839
|
-
|
|
922
|
+
_context14.prev = 0;
|
|
923
|
+
_context14.next = 3;
|
|
840
924
|
return this.store.customer.loadMoreCustomers();
|
|
841
925
|
case 3:
|
|
842
|
-
_result4 =
|
|
926
|
+
_result4 = _context14.sent;
|
|
843
927
|
this.core.effects.emit("".concat(this.name, ":onCustomerListUpdate"), _result4);
|
|
844
|
-
return
|
|
928
|
+
return _context14.abrupt("return", _result4);
|
|
845
929
|
case 8:
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
console.error('Failed to load more customers:',
|
|
849
|
-
throw
|
|
930
|
+
_context14.prev = 8;
|
|
931
|
+
_context14.t0 = _context14["catch"](0);
|
|
932
|
+
console.error('Failed to load more customers:', _context14.t0);
|
|
933
|
+
throw _context14.t0;
|
|
850
934
|
case 12:
|
|
851
935
|
case "end":
|
|
852
|
-
return
|
|
936
|
+
return _context14.stop();
|
|
853
937
|
}
|
|
854
|
-
},
|
|
938
|
+
}, _callee14, this, [[0, 8]]);
|
|
855
939
|
}));
|
|
856
940
|
function loadMoreCustomers() {
|
|
857
941
|
return _loadMoreCustomers.apply(this, arguments);
|
|
@@ -867,31 +951,31 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
867
951
|
}, {
|
|
868
952
|
key: "resetAndLoadCustomers",
|
|
869
953
|
value: (function () {
|
|
870
|
-
var _resetAndLoadCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
954
|
+
var _resetAndLoadCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
|
|
871
955
|
var params,
|
|
872
956
|
_result5,
|
|
873
|
-
|
|
874
|
-
return _regeneratorRuntime().wrap(function
|
|
875
|
-
while (1) switch (
|
|
957
|
+
_args15 = arguments;
|
|
958
|
+
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
|
959
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
876
960
|
case 0:
|
|
877
|
-
params =
|
|
878
|
-
|
|
879
|
-
|
|
961
|
+
params = _args15.length > 0 && _args15[0] !== undefined ? _args15[0] : {};
|
|
962
|
+
_context15.prev = 1;
|
|
963
|
+
_context15.next = 4;
|
|
880
964
|
return this.store.customer.resetAndLoadCustomers(params);
|
|
881
965
|
case 4:
|
|
882
|
-
_result5 =
|
|
966
|
+
_result5 = _context15.sent;
|
|
883
967
|
this.core.effects.emit("".concat(this.name, ":onCustomerListReset"), _result5);
|
|
884
|
-
return
|
|
968
|
+
return _context15.abrupt("return", _result5);
|
|
885
969
|
case 9:
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
console.error('Failed to reset and load customers:',
|
|
889
|
-
throw
|
|
970
|
+
_context15.prev = 9;
|
|
971
|
+
_context15.t0 = _context15["catch"](1);
|
|
972
|
+
console.error('Failed to reset and load customers:', _context15.t0);
|
|
973
|
+
throw _context15.t0;
|
|
890
974
|
case 13:
|
|
891
975
|
case "end":
|
|
892
|
-
return
|
|
976
|
+
return _context15.stop();
|
|
893
977
|
}
|
|
894
|
-
},
|
|
978
|
+
}, _callee15, this, [[1, 9]]);
|
|
895
979
|
}));
|
|
896
980
|
function resetAndLoadCustomers() {
|
|
897
981
|
return _resetAndLoadCustomers.apply(this, arguments);
|
|
@@ -936,9 +1020,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
936
1020
|
}, {
|
|
937
1021
|
key: "scanGlobalListener",
|
|
938
1022
|
value: function scanGlobalListener(callback) {
|
|
939
|
-
var
|
|
1023
|
+
var _this4 = this;
|
|
940
1024
|
var localSearch = function localSearch(v) {
|
|
941
|
-
return
|
|
1025
|
+
return _this4.store.products.findProductsByCodeOrBarcode(v);
|
|
942
1026
|
};
|
|
943
1027
|
var scanCallback = handleGlobalScan(this.request, localSearch);
|
|
944
1028
|
var safeCallback = function safeCallback(d) {
|
|
@@ -1053,15 +1137,15 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1053
1137
|
}, {
|
|
1054
1138
|
key: "setOtherParams",
|
|
1055
1139
|
value: (function () {
|
|
1056
|
-
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1057
|
-
var
|
|
1058
|
-
|
|
1140
|
+
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(params) {
|
|
1141
|
+
var _ref4,
|
|
1142
|
+
_ref4$cover,
|
|
1059
1143
|
cover,
|
|
1060
|
-
|
|
1061
|
-
return _regeneratorRuntime().wrap(function
|
|
1062
|
-
while (1) switch (
|
|
1144
|
+
_args16 = arguments;
|
|
1145
|
+
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
|
1146
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
1063
1147
|
case 0:
|
|
1064
|
-
|
|
1148
|
+
_ref4 = _args16.length > 1 && _args16[1] !== undefined ? _args16[1] : {}, _ref4$cover = _ref4.cover, cover = _ref4$cover === void 0 ? false : _ref4$cover;
|
|
1065
1149
|
if (cover) {
|
|
1066
1150
|
this.otherParams = params;
|
|
1067
1151
|
} else {
|
|
@@ -1069,9 +1153,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1069
1153
|
}
|
|
1070
1154
|
case 2:
|
|
1071
1155
|
case "end":
|
|
1072
|
-
return
|
|
1156
|
+
return _context16.stop();
|
|
1073
1157
|
}
|
|
1074
|
-
},
|
|
1158
|
+
}, _callee16, this);
|
|
1075
1159
|
}));
|
|
1076
1160
|
function setOtherParams(_x10) {
|
|
1077
1161
|
return _setOtherParams.apply(this, arguments);
|
|
@@ -1086,16 +1170,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1086
1170
|
}, {
|
|
1087
1171
|
key: "getOtherParams",
|
|
1088
1172
|
value: (function () {
|
|
1089
|
-
var _getOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1090
|
-
return _regeneratorRuntime().wrap(function
|
|
1091
|
-
while (1) switch (
|
|
1173
|
+
var _getOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17() {
|
|
1174
|
+
return _regeneratorRuntime().wrap(function _callee17$(_context17) {
|
|
1175
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
1092
1176
|
case 0:
|
|
1093
|
-
return
|
|
1177
|
+
return _context17.abrupt("return", this.otherParams);
|
|
1094
1178
|
case 1:
|
|
1095
1179
|
case "end":
|
|
1096
|
-
return
|
|
1180
|
+
return _context17.stop();
|
|
1097
1181
|
}
|
|
1098
|
-
},
|
|
1182
|
+
}, _callee17, this);
|
|
1099
1183
|
}));
|
|
1100
1184
|
function getOtherParams() {
|
|
1101
1185
|
return _getOtherParams.apply(this, arguments);
|
|
@@ -1261,10 +1345,10 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1261
1345
|
}, {
|
|
1262
1346
|
key: "buildAddProductCtx",
|
|
1263
1347
|
value: function buildAddProductCtx(extra) {
|
|
1264
|
-
var _extra$date2,
|
|
1348
|
+
var _extra$date2, _ref5, _this$getOrderCustome, _this$getOrderCustome2, _this$store$order$get3, _extra$presetStartTim2;
|
|
1265
1349
|
var bookingContextState = this.store.bookingContext.getState();
|
|
1266
1350
|
var date = (_extra$date2 = extra === null || extra === void 0 ? void 0 : extra.date) !== null && _extra$date2 !== void 0 ? _extra$date2 : bookingContextState.date;
|
|
1267
|
-
var orderCustomerId = (
|
|
1351
|
+
var orderCustomerId = (_ref5 = (_this$getOrderCustome = (_this$getOrderCustome2 = this.getOrderCustomerSnapshot()) === null || _this$getOrderCustome2 === void 0 ? void 0 : _this$getOrderCustome2.id) !== null && _this$getOrderCustome !== void 0 ? _this$getOrderCustome : (_this$store$order$get3 = this.store.order.getTempOrder()) === null || _this$store$order$get3 === void 0 ? void 0 : _this$store$order$get3.customer_id) !== null && _ref5 !== void 0 ? _ref5 : undefined;
|
|
1268
1352
|
return _objectSpread({
|
|
1269
1353
|
bookingConfig: bookingContextState.bookingConfig,
|
|
1270
1354
|
resourcesOrigin: bookingContextState.resourcesOrigin,
|
|
@@ -1364,16 +1448,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1364
1448
|
}, {
|
|
1365
1449
|
key: "updateProductInOrder",
|
|
1366
1450
|
value: (function () {
|
|
1367
|
-
var _updateProductInOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1368
|
-
return _regeneratorRuntime().wrap(function
|
|
1369
|
-
while (1) switch (
|
|
1451
|
+
var _updateProductInOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(params) {
|
|
1452
|
+
return _regeneratorRuntime().wrap(function _callee18$(_context18) {
|
|
1453
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
1370
1454
|
case 0:
|
|
1371
|
-
return
|
|
1455
|
+
return _context18.abrupt("return", this.updateOrderProduct(params));
|
|
1372
1456
|
case 1:
|
|
1373
1457
|
case "end":
|
|
1374
|
-
return
|
|
1458
|
+
return _context18.stop();
|
|
1375
1459
|
}
|
|
1376
|
-
},
|
|
1460
|
+
}, _callee18, this);
|
|
1377
1461
|
}));
|
|
1378
1462
|
function updateProductInOrder(_x11) {
|
|
1379
1463
|
return _updateProductInOrder.apply(this, arguments);
|
|
@@ -1388,12 +1472,12 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1388
1472
|
}, {
|
|
1389
1473
|
key: "destroy",
|
|
1390
1474
|
value: (function () {
|
|
1391
|
-
var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1475
|
+
var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19() {
|
|
1392
1476
|
var _this$scan;
|
|
1393
|
-
return _regeneratorRuntime().wrap(function
|
|
1394
|
-
while (1) switch (
|
|
1477
|
+
return _regeneratorRuntime().wrap(function _callee19$(_context19) {
|
|
1478
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
1395
1479
|
case 0:
|
|
1396
|
-
|
|
1480
|
+
_context19.next = 2;
|
|
1397
1481
|
return _get(_getPrototypeOf(BookingTicketImpl.prototype), "destroy", this).call(this);
|
|
1398
1482
|
case 2:
|
|
1399
1483
|
try {
|
|
@@ -1404,9 +1488,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1404
1488
|
scanCache.clear();
|
|
1405
1489
|
case 4:
|
|
1406
1490
|
case "end":
|
|
1407
|
-
return
|
|
1491
|
+
return _context19.stop();
|
|
1408
1492
|
}
|
|
1409
|
-
},
|
|
1493
|
+
}, _callee19, this);
|
|
1410
1494
|
}));
|
|
1411
1495
|
function destroy() {
|
|
1412
1496
|
return _destroy.apply(this, arguments);
|
|
@@ -89,8 +89,10 @@ export declare function buildRequiresDetailPayload(item: any, ctx?: AddProductDe
|
|
|
89
89
|
*/
|
|
90
90
|
export declare function buildCacheItemFromCartDetail(item: any, ctx?: AddProductDecideContext): any;
|
|
91
91
|
/**
|
|
92
|
-
* 用 Info2 callback 的 (e, extension_type, detail)
|
|
93
|
-
*
|
|
92
|
+
* 用 Info2 callback 的 (e, extension_type, detail) 拼装 cacheItem。
|
|
93
|
+
*
|
|
94
|
+
* 保留 detail._extend 中的 pricing / note(规格弹窗改价、备注等),
|
|
95
|
+
* 再叠加 session 时间、ctx.quantity 等运行态字段;other 以 callback `e` 为准。
|
|
94
96
|
*/
|
|
95
97
|
export declare function buildCacheItemFromDetail(item: any, detailResult: {
|
|
96
98
|
e: any;
|
|
@@ -212,7 +212,7 @@ export function buildRequiresDetailPayload(item, ctx) {
|
|
|
212
212
|
* 这里只补 `_extend.start_date / quantity / other` 等运行态字段;后续走 getProductExtend 才会补齐资源 / 时间。
|
|
213
213
|
*/
|
|
214
214
|
export function buildCacheItemFromCartDetail(item, ctx) {
|
|
215
|
-
var _item$id, _item$_extend$price, _item$_extend;
|
|
215
|
+
var _item$id, _ref, _ctx$quantity, _item$_extend$price, _item$_extend;
|
|
216
216
|
var cartDetailValue = item.cartDetailValue || {};
|
|
217
217
|
var other = JSON.parse(JSON.stringify(cartDetailValue || {}));
|
|
218
218
|
other.session = cartDetailValue.session;
|
|
@@ -220,7 +220,8 @@ export function buildCacheItemFromCartDetail(item, ctx) {
|
|
|
220
220
|
var resolvedId = (_item$id = item.id) !== null && _item$id !== void 0 ? _item$id : item.product_id;
|
|
221
221
|
var extend = applySessionTimesToExtend(item, {
|
|
222
222
|
start_date: (ctx === null || ctx === void 0 ? void 0 : ctx.date) || undefined,
|
|
223
|
-
|
|
223
|
+
/** 列表连点 / 防抖合并时以 ctx.quantity 为准,避免 cartDetailValue 默认 1 盖掉合并数量 */
|
|
224
|
+
quantity: (_ref = (_ctx$quantity = ctx === null || ctx === void 0 ? void 0 : ctx.quantity) !== null && _ctx$quantity !== void 0 ? _ctx$quantity : cartDetailValue === null || cartDetailValue === void 0 ? void 0 : cartDetailValue.quantity) !== null && _ref !== void 0 ? _ref : 1,
|
|
224
225
|
product_name: item.title,
|
|
225
226
|
other: other,
|
|
226
227
|
isNormalProduct: !isBookingProduct(item),
|
|
@@ -238,34 +239,44 @@ export function buildCacheItemFromCartDetail(item, ctx) {
|
|
|
238
239
|
}
|
|
239
240
|
|
|
240
241
|
/**
|
|
241
|
-
* 用 Info2 callback 的 (e, extension_type, detail)
|
|
242
|
-
*
|
|
242
|
+
* 用 Info2 callback 的 (e, extension_type, detail) 拼装 cacheItem。
|
|
243
|
+
*
|
|
244
|
+
* 保留 detail._extend 中的 pricing / note(规格弹窗改价、备注等),
|
|
245
|
+
* 再叠加 session 时间、ctx.quantity 等运行态字段;other 以 callback `e` 为准。
|
|
243
246
|
*/
|
|
244
247
|
export function buildCacheItemFromDetail(item, detailResult, ctx) {
|
|
245
|
-
var _detailResult$e, _currentItem$id, _detail$extension_typ, _detailResult$e2, _detailResult$e3;
|
|
248
|
+
var _detailResult$e, _currentItem$id, _detail$extension_typ, _ref2, _ref3, _ctx$quantity2, _detailResult$e2, _ref4, _detailExtend$price, _currentItem$title, _detailExtend$note, _detailResult$e3;
|
|
246
249
|
var _currentItem = detailResult.detail || item;
|
|
247
250
|
var _detail = _currentItem;
|
|
251
|
+
var detailExtend = (_detail === null || _detail === void 0 ? void 0 : _detail._extend) || {};
|
|
248
252
|
var other = JSON.parse(JSON.stringify(detailResult.e || {}));
|
|
249
253
|
other.session = (_detailResult$e = detailResult.e) === null || _detailResult$e === void 0 ? void 0 : _detailResult$e.session;
|
|
250
254
|
var resolvedId = (_currentItem$id = _currentItem.id) !== null && _currentItem$id !== void 0 ? _currentItem$id : _currentItem.product_id;
|
|
251
255
|
var mergedItem = _objectSpread(_objectSpread(_objectSpread({}, item), _detail), {}, {
|
|
252
256
|
extension_type: (_detail$extension_typ = _detail.extension_type) !== null && _detail$extension_typ !== void 0 ? _detail$extension_typ : item.extension_type
|
|
253
257
|
});
|
|
254
|
-
var
|
|
255
|
-
start_date: (ctx === null || ctx === void 0 ? void 0 : ctx.date) || undefined,
|
|
256
|
-
quantity: ((_detailResult$e2 = detailResult.e) === null || _detailResult$e2 === void 0 ? void 0 : _detailResult$e2.quantity)
|
|
257
|
-
price: _detail === null || _detail === void 0 ? void 0 : _detail.price,
|
|
258
|
-
product_name: _currentItem.title,
|
|
258
|
+
var runtimeExtend = applySessionTimesToExtend(mergedItem, {
|
|
259
|
+
start_date: (ctx === null || ctx === void 0 ? void 0 : ctx.date) || detailExtend.start_date || undefined,
|
|
260
|
+
quantity: (_ref2 = (_ref3 = (_ctx$quantity2 = ctx === null || ctx === void 0 ? void 0 : ctx.quantity) !== null && _ctx$quantity2 !== void 0 ? _ctx$quantity2 : (_detailResult$e2 = detailResult.e) === null || _detailResult$e2 === void 0 ? void 0 : _detailResult$e2.quantity) !== null && _ref3 !== void 0 ? _ref3 : detailExtend.quantity) !== null && _ref2 !== void 0 ? _ref2 : 1,
|
|
261
|
+
price: (_ref4 = (_detailExtend$price = detailExtend.price) !== null && _detailExtend$price !== void 0 ? _detailExtend$price : _detail === null || _detail === void 0 ? void 0 : _detail.price) !== null && _ref4 !== void 0 ? _ref4 : item === null || item === void 0 ? void 0 : item.price,
|
|
262
|
+
product_name: (_currentItem$title = _currentItem.title) !== null && _currentItem$title !== void 0 ? _currentItem$title : detailExtend.product_name,
|
|
259
263
|
other: other,
|
|
260
264
|
isNormalProduct: !isBookingProduct(mergedItem)
|
|
261
265
|
}, {
|
|
262
266
|
date: ctx === null || ctx === void 0 ? void 0 : ctx.date
|
|
263
267
|
});
|
|
264
|
-
|
|
268
|
+
var extend = _objectSpread(_objectSpread(_objectSpread({}, detailExtend), runtimeExtend), {}, {
|
|
269
|
+
other: other
|
|
270
|
+
});
|
|
271
|
+
var note = (_detailExtend$note = detailExtend.note) !== null && _detailExtend$note !== void 0 ? _detailExtend$note : _detail === null || _detail === void 0 ? void 0 : _detail.note;
|
|
272
|
+
return _objectSpread(_objectSpread(_objectSpread({}, _detail), {}, {
|
|
265
273
|
id: resolvedId,
|
|
266
274
|
product_id: resolvedId,
|
|
267
275
|
extension_type: mergedItem.extension_type,
|
|
268
|
-
_key: (_detailResult$e3 = detailResult.e) === null || _detailResult$e3 === void 0 ? void 0 : _detailResult$e3.key
|
|
276
|
+
_key: (_detailResult$e3 = detailResult.e) === null || _detailResult$e3 === void 0 ? void 0 : _detailResult$e3.key
|
|
277
|
+
}, note != null && note !== '' ? {
|
|
278
|
+
note: String(note)
|
|
279
|
+
} : {}), {}, {
|
|
269
280
|
_extend: extend,
|
|
270
281
|
new: 1
|
|
271
282
|
});
|
|
@@ -306,21 +317,28 @@ export function transformDetailToProductAndBooking(cacheItem, ctx) {
|
|
|
306
317
|
* 把 cacheItem._extend.other 中的字段 + 顶层运行态拼成 `BaseProductDetailPayload`。
|
|
307
318
|
*/
|
|
308
319
|
function buildBasePayloadFromCacheItem(cacheItem, ctx) {
|
|
309
|
-
var _cacheItem$_extend,
|
|
320
|
+
var _cacheItem$_extend, _cacheItem$_extend$qu, _cacheItem$_extend2, _cacheItem$product_id, _cacheItem$id, _ref5, _other$product_varian, _extend$skuValue, _extend$_skuValue, _extend$price, _extend$price2;
|
|
310
321
|
var other = (cacheItem === null || cacheItem === void 0 || (_cacheItem$_extend = cacheItem._extend) === null || _cacheItem$_extend === void 0 ? void 0 : _cacheItem$_extend.other) || {};
|
|
311
|
-
var quantity = (
|
|
322
|
+
var quantity = (ctx === null || ctx === void 0 ? void 0 : ctx.quantity) != null && ctx.quantity > 0 ? ctx.quantity : (_cacheItem$_extend$qu = cacheItem === null || cacheItem === void 0 || (_cacheItem$_extend2 = cacheItem._extend) === null || _cacheItem$_extend2 === void 0 ? void 0 : _cacheItem$_extend2.quantity) !== null && _cacheItem$_extend$qu !== void 0 ? _cacheItem$_extend$qu : 1;
|
|
312
323
|
var resolvedPid = (_cacheItem$product_id = cacheItem === null || cacheItem === void 0 ? void 0 : cacheItem.product_id) !== null && _cacheItem$product_id !== void 0 ? _cacheItem$product_id : cacheItem === null || cacheItem === void 0 ? void 0 : cacheItem.id;
|
|
324
|
+
var extend = (cacheItem === null || cacheItem === void 0 ? void 0 : cacheItem._extend) || {};
|
|
313
325
|
return {
|
|
314
326
|
id: (_cacheItem$id = cacheItem === null || cacheItem === void 0 ? void 0 : cacheItem.id) !== null && _cacheItem$id !== void 0 ? _cacheItem$id : cacheItem === null || cacheItem === void 0 ? void 0 : cacheItem.product_id,
|
|
315
327
|
product_id: resolvedPid,
|
|
316
|
-
variant_id: (
|
|
328
|
+
variant_id: (_ref5 = (_other$product_varian = other === null || other === void 0 ? void 0 : other.product_variant_id) !== null && _other$product_varian !== void 0 ? _other$product_varian : other === null || other === void 0 ? void 0 : other.variant_id) !== null && _ref5 !== void 0 ? _ref5 : 0,
|
|
317
329
|
quantity: quantity,
|
|
318
330
|
option: (other === null || other === void 0 ? void 0 : other.option) || [],
|
|
319
|
-
bundle: (other === null || other === void 0 ? void 0 : other.bundle) || [],
|
|
331
|
+
bundle: (other === null || other === void 0 ? void 0 : other.bundle) || (extend === null || extend === void 0 || (_extend$skuValue = extend.skuValue) === null || _extend$skuValue === void 0 ? void 0 : _extend$skuValue.bundle) || (extend === null || extend === void 0 || (_extend$_skuValue = extend._skuValue) === null || _extend$_skuValue === void 0 ? void 0 : _extend$_skuValue.bundle) || [],
|
|
320
332
|
unique: other === null || other === void 0 ? void 0 : other.unique,
|
|
321
333
|
session: other === null || other === void 0 ? void 0 : other.session,
|
|
322
|
-
note:
|
|
323
|
-
price: (
|
|
324
|
-
selling_price: (
|
|
334
|
+
note: extend === null || extend === void 0 ? void 0 : extend.note,
|
|
335
|
+
price: (_extend$price = extend === null || extend === void 0 ? void 0 : extend.price) !== null && _extend$price !== void 0 ? _extend$price : cacheItem === null || cacheItem === void 0 ? void 0 : cacheItem.price,
|
|
336
|
+
selling_price: (_extend$price2 = extend === null || extend === void 0 ? void 0 : extend.price) !== null && _extend$price2 !== void 0 ? _extend$price2 : cacheItem === null || cacheItem === void 0 ? void 0 : cacheItem.price,
|
|
337
|
+
line_total: extend === null || extend === void 0 ? void 0 : extend.total,
|
|
338
|
+
total: extend === null || extend === void 0 ? void 0 : extend.total,
|
|
339
|
+
origin_total: extend === null || extend === void 0 ? void 0 : extend.origin_total,
|
|
340
|
+
price_override: extend === null || extend === void 0 ? void 0 : extend.priceOverride,
|
|
341
|
+
bundle_edit: extend === null || extend === void 0 ? void 0 : extend.bundle_edit,
|
|
342
|
+
_extend: extend
|
|
325
343
|
};
|
|
326
344
|
}
|
|
@@ -13,7 +13,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
13
13
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
14
14
|
import dayjs from 'dayjs';
|
|
15
15
|
import Decimal from 'decimal.js';
|
|
16
|
-
import { composeLinePrice, createUuidV4, sumOptionUnitPrice } from "../../modules/Order/utils";
|
|
16
|
+
import { composeLinePrice, createUuidV4, resolveManualOverrideLineOriginalPrice, sumOptionUnitPrice } from "../../modules/Order/utils";
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
* 构建金额全为 0 的空 summary。
|
|
@@ -480,17 +480,42 @@ export function getProductIdentityIndex(products, identity) {
|
|
|
480
480
|
* - 因此多次 normalize 不会重复叠加 option/bundle。
|
|
481
481
|
*/
|
|
482
482
|
export function normalizeOrderProduct(product) {
|
|
483
|
-
var _product$metadata, _metadata$origin, _variantList$find, _product$is_charge_ta;
|
|
483
|
+
var _product$metadata, _metadata$origin, _metadata$origin2, _variantList$find, _product$is_charge_ta;
|
|
484
484
|
var metadata = _objectSpread({}, product.metadata || {});
|
|
485
485
|
// 不透明 identity 契约:每条订单行必须带 identity_key。
|
|
486
486
|
// 调用方未传时由 SDK 自动生成 UUID,后续 update/remove 只做严格比对,避免猜测合成 key。
|
|
487
487
|
var resolvedIdentityKey = (_product$metadata = product.metadata) !== null && _product$metadata !== void 0 && _product$metadata.unique_identification_number ? String(product.metadata.unique_identification_number) : product.unique_identification_number && String(product.unique_identification_number).length > 0 ? String(product.unique_identification_number) : product.identity_key && String(product.identity_key).length > 0 ? String(product.identity_key) : createUuidV4();
|
|
488
488
|
metadata.unique_identification_number = resolvedIdentityKey;
|
|
489
|
-
var
|
|
490
|
-
|
|
489
|
+
var priceOverride = metadata.price_override;
|
|
490
|
+
var originOtherBundle = (_metadata$origin = metadata.origin) === null || _metadata$origin === void 0 || (_metadata$origin = _metadata$origin._extend) === null || _metadata$origin === void 0 || (_metadata$origin = _metadata$origin.other) === null || _metadata$origin === void 0 ? void 0 : _metadata$origin.bundle;
|
|
491
|
+
var bundleInput = product.product_bundle || [];
|
|
492
|
+
if (priceOverride !== undefined && priceOverride !== null && priceOverride !== '' && Array.isArray(originOtherBundle) && originOtherBundle.length > 0) {
|
|
493
|
+
var priceById = new Map();
|
|
494
|
+
originOtherBundle.forEach(function (item) {
|
|
495
|
+
var _item$price2;
|
|
496
|
+
if ((item === null || item === void 0 ? void 0 : item.id) == null) return;
|
|
497
|
+
var unit = (_item$price2 = item.price) !== null && _item$price2 !== void 0 ? _item$price2 : item.bundle_selling_price;
|
|
498
|
+
if (unit === undefined || unit === null) return;
|
|
499
|
+
priceById.set(String(item.id), String(unit));
|
|
500
|
+
});
|
|
501
|
+
var base = Array.isArray(bundleInput) && bundleInput.length > 0 ? bundleInput : originOtherBundle;
|
|
502
|
+
bundleInput = base.map(function (item) {
|
|
503
|
+
var unit = priceById.get(String(item === null || item === void 0 ? void 0 : item.id));
|
|
504
|
+
if (unit === undefined) return item;
|
|
505
|
+
return _objectSpread(_objectSpread({}, item), {}, {
|
|
506
|
+
price: unit,
|
|
507
|
+
bundle_selling_price: unit
|
|
508
|
+
});
|
|
509
|
+
});
|
|
510
|
+
}
|
|
511
|
+
var normalizedBundle = bundleInput.map(function (item) {
|
|
512
|
+
var _item$bundle_id2, _item$bundle_product_, _item$bundle_group_id, _ref4, _item$bundle_selling_, _ref5, _ref6, _item$price3, _ref7, _item$price_type, _ref8, _item$price_type_ext;
|
|
491
513
|
return _objectSpread(_objectSpread({}, item), {}, {
|
|
514
|
+
bundle_id: (_item$bundle_id2 = item.bundle_id) !== null && _item$bundle_id2 !== void 0 ? _item$bundle_id2 : item.id,
|
|
515
|
+
bundle_product_id: (_item$bundle_product_ = item.bundle_product_id) !== null && _item$bundle_product_ !== void 0 ? _item$bundle_product_ : item._bundle_product_id,
|
|
516
|
+
bundle_group_id: (_item$bundle_group_id = item.bundle_group_id) !== null && _item$bundle_group_id !== void 0 ? _item$bundle_group_id : item.group_id,
|
|
492
517
|
bundle_selling_price: (_ref4 = (_item$bundle_selling_ = item.bundle_selling_price) !== null && _item$bundle_selling_ !== void 0 ? _item$bundle_selling_ : item.price) !== null && _ref4 !== void 0 ? _ref4 : '0.00',
|
|
493
|
-
price: (_ref5 = (_ref6 = (_item$
|
|
518
|
+
price: (_ref5 = (_ref6 = (_item$price3 = item.price) !== null && _item$price3 !== void 0 ? _item$price3 : item.custom_price) !== null && _ref6 !== void 0 ? _ref6 : item.bundle_selling_price) !== null && _ref5 !== void 0 ? _ref5 : '0.00',
|
|
494
519
|
price_type: (_ref7 = (_item$price_type = item.price_type) !== null && _item$price_type !== void 0 ? _item$price_type : item.custom_price_type) !== null && _ref7 !== void 0 ? _ref7 : '',
|
|
495
520
|
price_type_ext: (_ref8 = (_item$price_type_ext = item.price_type_ext) !== null && _item$price_type_ext !== void 0 ? _item$price_type_ext : item.custom_price_type_ext) !== null && _ref8 !== void 0 ? _ref8 : ''
|
|
496
521
|
});
|
|
@@ -508,7 +533,7 @@ export function normalizeOrderProduct(product) {
|
|
|
508
533
|
// 6) 入参 selling_price(最末兜底,新添加路径 caller 只给 selling_price)
|
|
509
534
|
var isV2 = metadata.price_schema_version === 2 || metadata.price_schema_version === '2';
|
|
510
535
|
var variantId = Number(product.product_variant_id || 0);
|
|
511
|
-
var variantList = variantId ? metadata === null || metadata === void 0 || (_metadata$
|
|
536
|
+
var variantList = variantId ? metadata === null || metadata === void 0 || (_metadata$origin2 = metadata.origin) === null || _metadata$origin2 === void 0 ? void 0 : _metadata$origin2.variant : null;
|
|
512
537
|
var variantPrice = Array.isArray(variantList) ? (_variantList$find = variantList.find(function (v) {
|
|
513
538
|
return Number(v === null || v === void 0 ? void 0 : v.id) === variantId;
|
|
514
539
|
})) === null || _variantList$find === void 0 ? void 0 : _variantList$find.price : undefined;
|
|
@@ -578,6 +603,10 @@ export function normalizeOrderProduct(product) {
|
|
|
578
603
|
bundle: normalizedBundle,
|
|
579
604
|
useOriginalBundle: true
|
|
580
605
|
});
|
|
606
|
+
var finalOriginalPrice = resolveManualOverrideLineOriginalPrice({
|
|
607
|
+
num: product.num,
|
|
608
|
+
metadata: metadata
|
|
609
|
+
}, composedOriginalPrice);
|
|
581
610
|
return {
|
|
582
611
|
order_detail_id: product.order_detail_id || null,
|
|
583
612
|
product_id: product.product_id,
|
|
@@ -585,7 +614,7 @@ export function normalizeOrderProduct(product) {
|
|
|
585
614
|
product_variant_id: product.product_variant_id,
|
|
586
615
|
product_option_item: normalizedOptions,
|
|
587
616
|
selling_price: composedSellingPrice,
|
|
588
|
-
original_price:
|
|
617
|
+
original_price: finalOriginalPrice,
|
|
589
618
|
tax_fee: product.tax_fee || '0.00',
|
|
590
619
|
is_charge_tax: (_product$is_charge_ta = product.is_charge_tax) !== null && _product$is_charge_ta !== void 0 ? _product$is_charge_ta : 0,
|
|
591
620
|
discount_list: product.discount_list || [],
|