@pisell/pisellos 2.3.21 → 2.3.23
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/Order/index.d.ts +2 -1
- package/dist/modules/Order/index.js +27 -12
- package/dist/modules/Order/utils.d.ts +2 -2
- package/dist/modules/Order/utils.js +41 -49
- package/dist/server/index.d.ts +1 -0
- package/dist/server/index.js +40 -6
- package/dist/server/modules/order/types.d.ts +2 -0
- package/dist/solution/BaseSales/index.d.ts +12 -0
- package/dist/solution/BaseSales/index.js +384 -320
- package/dist/solution/BaseSales/types.d.ts +4 -1
- package/dist/solution/BaseSales/types.js +1 -1
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +12 -1
- package/dist/solution/BookingByStep/index.d.ts +2 -2
- package/dist/solution/BookingTicket/index.js +42 -24
- package/lib/modules/Order/index.d.ts +2 -1
- package/lib/modules/Order/index.js +15 -3
- package/lib/modules/Order/utils.d.ts +2 -2
- package/lib/modules/Order/utils.js +7 -5
- package/lib/server/index.d.ts +1 -0
- package/lib/server/index.js +41 -3
- package/lib/server/modules/order/types.d.ts +2 -0
- package/lib/solution/BaseSales/index.d.ts +12 -0
- package/lib/solution/BaseSales/index.js +31 -2
- package/lib/solution/BaseSales/types.d.ts +4 -1
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +7 -1
- package/lib/solution/BookingByStep/index.d.ts +2 -2
- package/lib/solution/BookingTicket/index.js +15 -7
- package/package.json +1 -1
|
@@ -187,6 +187,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
187
187
|
_defineProperty(_assertThisInitialized(_this), "salesDetailLoadInFlight", false);
|
|
188
188
|
_defineProperty(_assertThisInitialized(_this), "serverOrderChangeUnsubscribe", null);
|
|
189
189
|
_defineProperty(_assertThisInitialized(_this), "serverOrderChangeHydrateInFlight", null);
|
|
190
|
+
_defineProperty(_assertThisInitialized(_this), "serverOrderChangeSyncEnabled", false);
|
|
190
191
|
return _this;
|
|
191
192
|
}
|
|
192
193
|
|
|
@@ -276,6 +277,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
276
277
|
return isSameBaseSalesOrderRecord(record, order);
|
|
277
278
|
});
|
|
278
279
|
}
|
|
280
|
+
}, {
|
|
281
|
+
key: "setServerOrderChangeSyncEnabled",
|
|
282
|
+
value: function setServerOrderChangeSyncEnabled(enabled) {
|
|
283
|
+
this.serverOrderChangeSyncEnabled = enabled;
|
|
284
|
+
}
|
|
279
285
|
}, {
|
|
280
286
|
key: "syncCurrentSalesDetailFromServerOrderChange",
|
|
281
287
|
value: function () {
|
|
@@ -286,7 +292,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
286
292
|
while (1) switch (_context2.prev = _context2.next) {
|
|
287
293
|
case 0:
|
|
288
294
|
changedOrders = Array.isArray(payload) ? payload : Array.isArray(payload === null || payload === void 0 ? void 0 : payload.changedOrders) ? payload.changedOrders : payload !== null && payload !== void 0 && payload.data && _typeof(payload.data) === 'object' ? [payload.data] : [];
|
|
289
|
-
if (!(this.salesDetailLoadInFlight || this.serverOrderChangeHydrateInFlight)) {
|
|
295
|
+
if (!(!this.serverOrderChangeSyncEnabled || this.salesDetailLoadInFlight || this.serverOrderChangeHydrateInFlight)) {
|
|
290
296
|
_context2.next = 3;
|
|
291
297
|
break;
|
|
292
298
|
}
|
|
@@ -1926,52 +1932,110 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1926
1932
|
if (!this.store.order) return [];
|
|
1927
1933
|
return this.store.order.getDiscountList();
|
|
1928
1934
|
}
|
|
1935
|
+
|
|
1936
|
+
/** 读取 Discount 模块原始券列表(未经过 bookingTime 等过滤)。 */
|
|
1937
|
+
}, {
|
|
1938
|
+
key: "getOriginalDiscountList",
|
|
1939
|
+
value: function getOriginalDiscountList() {
|
|
1940
|
+
var _store, _discountModule$getOr3;
|
|
1941
|
+
if (!this.store.order) return [];
|
|
1942
|
+
var discountModule = (_store = this.store.order.store) === null || _store === void 0 ? void 0 : _store.discount;
|
|
1943
|
+
return (discountModule === null || discountModule === void 0 || (_discountModule$getOr3 = discountModule.getOriginalDiscountList) === null || _discountModule$getOr3 === void 0 ? void 0 : _discountModule$getOr3.call(discountModule)) || [];
|
|
1944
|
+
}
|
|
1945
|
+
|
|
1946
|
+
/**
|
|
1947
|
+
* 同步写入 Discount 模块的 discountList / originalDiscountList。
|
|
1948
|
+
* 供 Holder 补全等场景在 OS store 层更新 machinecode holder 字段。
|
|
1949
|
+
*/
|
|
1950
|
+
}, {
|
|
1951
|
+
key: "replaceDiscountStoreLists",
|
|
1952
|
+
value: (function () {
|
|
1953
|
+
var _replaceDiscountStoreLists = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(params) {
|
|
1954
|
+
var _store2;
|
|
1955
|
+
var discountModule;
|
|
1956
|
+
return _regeneratorRuntime().wrap(function _callee19$(_context19) {
|
|
1957
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
1958
|
+
case 0:
|
|
1959
|
+
if (this.store.order) {
|
|
1960
|
+
_context19.next = 2;
|
|
1961
|
+
break;
|
|
1962
|
+
}
|
|
1963
|
+
throw new Error('order 模块未初始化');
|
|
1964
|
+
case 2:
|
|
1965
|
+
discountModule = (_store2 = this.store.order.store) === null || _store2 === void 0 ? void 0 : _store2.discount;
|
|
1966
|
+
if (discountModule) {
|
|
1967
|
+
_context19.next = 5;
|
|
1968
|
+
break;
|
|
1969
|
+
}
|
|
1970
|
+
return _context19.abrupt("return");
|
|
1971
|
+
case 5:
|
|
1972
|
+
if (!params.originalDiscountList) {
|
|
1973
|
+
_context19.next = 8;
|
|
1974
|
+
break;
|
|
1975
|
+
}
|
|
1976
|
+
_context19.next = 8;
|
|
1977
|
+
return discountModule.setOriginalDiscountList(params.originalDiscountList);
|
|
1978
|
+
case 8:
|
|
1979
|
+
_context19.next = 10;
|
|
1980
|
+
return discountModule.setDiscountList(params.discountList);
|
|
1981
|
+
case 10:
|
|
1982
|
+
case "end":
|
|
1983
|
+
return _context19.stop();
|
|
1984
|
+
}
|
|
1985
|
+
}, _callee19, this);
|
|
1986
|
+
}));
|
|
1987
|
+
function replaceDiscountStoreLists(_x13) {
|
|
1988
|
+
return _replaceDiscountStoreLists.apply(this, arguments);
|
|
1989
|
+
}
|
|
1990
|
+
return replaceDiscountStoreLists;
|
|
1991
|
+
}())
|
|
1929
1992
|
}, {
|
|
1930
1993
|
key: "scanPromotionCode",
|
|
1931
1994
|
value: function () {
|
|
1932
|
-
var _scanPromotionCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1995
|
+
var _scanPromotionCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(code, customerId) {
|
|
1933
1996
|
var raw;
|
|
1934
|
-
return _regeneratorRuntime().wrap(function
|
|
1935
|
-
while (1) switch (
|
|
1997
|
+
return _regeneratorRuntime().wrap(function _callee20$(_context20) {
|
|
1998
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
1936
1999
|
case 0:
|
|
1937
|
-
|
|
2000
|
+
_context20.prev = 0;
|
|
1938
2001
|
if (this.store.order) {
|
|
1939
|
-
|
|
2002
|
+
_context20.next = 3;
|
|
1940
2003
|
break;
|
|
1941
2004
|
}
|
|
1942
2005
|
throw new Error('order 模块未初始化');
|
|
1943
2006
|
case 3:
|
|
1944
|
-
|
|
2007
|
+
_context20.next = 5;
|
|
1945
2008
|
return this.store.order.scanCode(code, customerId);
|
|
1946
2009
|
case 5:
|
|
1947
|
-
raw =
|
|
2010
|
+
raw = _context20.sent;
|
|
1948
2011
|
if (!raw.isAvailable) {
|
|
1949
|
-
|
|
2012
|
+
_context20.next = 10;
|
|
1950
2013
|
break;
|
|
1951
2014
|
}
|
|
1952
|
-
|
|
2015
|
+
_context20.next = 9;
|
|
1953
2016
|
return this.store.order.recalculateSummary({
|
|
1954
2017
|
createIfMissing: true
|
|
1955
2018
|
});
|
|
1956
2019
|
case 9:
|
|
1957
2020
|
this.store.order.persistTempOrder();
|
|
1958
2021
|
case 10:
|
|
1959
|
-
return
|
|
2022
|
+
return _context20.abrupt("return", {
|
|
1960
2023
|
isAvailable: raw.isAvailable,
|
|
1961
2024
|
type: raw.type,
|
|
1962
|
-
unavailableReason: raw.unavailableReason
|
|
2025
|
+
unavailableReason: raw.unavailableReason,
|
|
2026
|
+
scannedDiscountList: raw.scannedDiscountList
|
|
1963
2027
|
});
|
|
1964
2028
|
case 13:
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
throw
|
|
2029
|
+
_context20.prev = 13;
|
|
2030
|
+
_context20.t0 = _context20["catch"](0);
|
|
2031
|
+
throw _context20.t0;
|
|
1968
2032
|
case 16:
|
|
1969
2033
|
case "end":
|
|
1970
|
-
return
|
|
2034
|
+
return _context20.stop();
|
|
1971
2035
|
}
|
|
1972
|
-
},
|
|
2036
|
+
}, _callee20, this, [[0, 13]]);
|
|
1973
2037
|
}));
|
|
1974
|
-
function scanPromotionCode(
|
|
2038
|
+
function scanPromotionCode(_x14, _x15) {
|
|
1975
2039
|
return _scanPromotionCode.apply(this, arguments);
|
|
1976
2040
|
}
|
|
1977
2041
|
return scanPromotionCode;
|
|
@@ -1979,14 +2043,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1979
2043
|
}, {
|
|
1980
2044
|
key: "setDiscountSelected",
|
|
1981
2045
|
value: function () {
|
|
1982
|
-
var _setDiscountSelected = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2046
|
+
var _setDiscountSelected = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(params) {
|
|
1983
2047
|
var list, updated, tempOrder, orderStore, discountModule, rulesModule, nextDiscountList, _orderStore$summary3, orderTotalAmount, result, beforeSelectedIds, _iterator2, _step2, d, selectedResourceIds, filterSelectedDiscountDetails, _iterator3, _step3, _product$metadata8, _tempOrder$_extend4, _product$metadata$sou2, _product$metadata9, _product$metadata10, _product$original_pri2, product, productUid, runtimeOrigin, totalPerUnitDiscount, optionSum, sourcePrice, newSourceSellingPrice, newMainSellingPrice;
|
|
1984
|
-
return _regeneratorRuntime().wrap(function
|
|
1985
|
-
while (1) switch (
|
|
2048
|
+
return _regeneratorRuntime().wrap(function _callee21$(_context21) {
|
|
2049
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
1986
2050
|
case 0:
|
|
1987
|
-
|
|
2051
|
+
_context21.prev = 0;
|
|
1988
2052
|
if (this.store.order) {
|
|
1989
|
-
|
|
2053
|
+
_context21.next = 3;
|
|
1990
2054
|
break;
|
|
1991
2055
|
}
|
|
1992
2056
|
throw new Error('order 模块未初始化');
|
|
@@ -2004,7 +2068,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2004
2068
|
discountModule = orderStore.discount;
|
|
2005
2069
|
rulesModule = orderStore.rules;
|
|
2006
2070
|
nextDiscountList = updated;
|
|
2007
|
-
|
|
2071
|
+
_context21.next = 13;
|
|
2008
2072
|
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(updated);
|
|
2009
2073
|
case 13:
|
|
2010
2074
|
if (rulesModule) {
|
|
@@ -2067,21 +2131,21 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2067
2131
|
});
|
|
2068
2132
|
};
|
|
2069
2133
|
_iterator3 = _createForOfIteratorHelper(tempOrder.products);
|
|
2070
|
-
|
|
2134
|
+
_context21.prev = 17;
|
|
2071
2135
|
_iterator3.s();
|
|
2072
2136
|
case 19:
|
|
2073
2137
|
if ((_step3 = _iterator3.n()).done) {
|
|
2074
|
-
|
|
2138
|
+
_context21.next = 36;
|
|
2075
2139
|
break;
|
|
2076
2140
|
}
|
|
2077
2141
|
product = _step3.value;
|
|
2078
2142
|
productUid = (_product$metadata8 = product.metadata) === null || _product$metadata8 === void 0 ? void 0 : _product$metadata8.unique_identification_number;
|
|
2079
2143
|
runtimeOrigin = productUid ? (_tempOrder$_extend4 = tempOrder._extend) === null || _tempOrder$_extend4 === void 0 || (_tempOrder$_extend4 = _tempOrder$_extend4.productsByUid) === null || _tempOrder$_extend4 === void 0 || (_tempOrder$_extend4 = _tempOrder$_extend4[productUid]) === null || _tempOrder$_extend4 === void 0 ? void 0 : _tempOrder$_extend4.origin : undefined;
|
|
2080
2144
|
if (!(runtimeOrigin !== null && runtimeOrigin !== void 0 && runtimeOrigin.isManualDiscount || isBaseSalesManualProductDiscountProduct(product))) {
|
|
2081
|
-
|
|
2145
|
+
_context21.next = 25;
|
|
2082
2146
|
break;
|
|
2083
2147
|
}
|
|
2084
|
-
return
|
|
2148
|
+
return _context21.abrupt("continue", 34);
|
|
2085
2149
|
case 25:
|
|
2086
2150
|
product.discount_list = filterSelectedDiscountDetails(product.discount_list);
|
|
2087
2151
|
if (Array.isArray(product.product_bundle)) {
|
|
@@ -2117,28 +2181,28 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2117
2181
|
bundle: product.product_bundle
|
|
2118
2182
|
});
|
|
2119
2183
|
case 34:
|
|
2120
|
-
|
|
2184
|
+
_context21.next = 19;
|
|
2121
2185
|
break;
|
|
2122
2186
|
case 36:
|
|
2123
|
-
|
|
2187
|
+
_context21.next = 41;
|
|
2124
2188
|
break;
|
|
2125
2189
|
case 38:
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
_iterator3.e(
|
|
2190
|
+
_context21.prev = 38;
|
|
2191
|
+
_context21.t0 = _context21["catch"](17);
|
|
2192
|
+
_iterator3.e(_context21.t0);
|
|
2129
2193
|
case 41:
|
|
2130
|
-
|
|
2194
|
+
_context21.prev = 41;
|
|
2131
2195
|
_iterator3.f();
|
|
2132
|
-
return
|
|
2196
|
+
return _context21.finish(41);
|
|
2133
2197
|
case 44:
|
|
2134
2198
|
OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
|
|
2135
|
-
|
|
2199
|
+
_context21.next = 47;
|
|
2136
2200
|
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
|
|
2137
2201
|
case 47:
|
|
2138
2202
|
tempOrder.discount_list = (nextDiscountList || []).filter(function (d) {
|
|
2139
2203
|
return d.isSelected;
|
|
2140
2204
|
});
|
|
2141
|
-
|
|
2205
|
+
_context21.next = 50;
|
|
2142
2206
|
return this.store.order.recalculateSummary({
|
|
2143
2207
|
createIfMissing: true
|
|
2144
2208
|
});
|
|
@@ -2150,19 +2214,19 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2150
2214
|
selectedDiscountList: tempOrder.discount_list,
|
|
2151
2215
|
tempOrder: tempOrder
|
|
2152
2216
|
});
|
|
2153
|
-
|
|
2217
|
+
_context21.next = 57;
|
|
2154
2218
|
break;
|
|
2155
2219
|
case 54:
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
throw
|
|
2220
|
+
_context21.prev = 54;
|
|
2221
|
+
_context21.t1 = _context21["catch"](0);
|
|
2222
|
+
throw _context21.t1;
|
|
2159
2223
|
case 57:
|
|
2160
2224
|
case "end":
|
|
2161
|
-
return
|
|
2225
|
+
return _context21.stop();
|
|
2162
2226
|
}
|
|
2163
|
-
},
|
|
2227
|
+
}, _callee21, this, [[0, 54], [17, 38, 41, 44]]);
|
|
2164
2228
|
}));
|
|
2165
|
-
function setDiscountSelected(
|
|
2229
|
+
function setDiscountSelected(_x16) {
|
|
2166
2230
|
return _setDiscountSelected.apply(this, arguments);
|
|
2167
2231
|
}
|
|
2168
2232
|
return setDiscountSelected;
|
|
@@ -2170,23 +2234,23 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2170
2234
|
}, {
|
|
2171
2235
|
key: "applyDiscountCalculationResult",
|
|
2172
2236
|
value: function () {
|
|
2173
|
-
var _applyDiscountCalculationResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2237
|
+
var _applyDiscountCalculationResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(result) {
|
|
2174
2238
|
var tempOrder, orderStore, discountModule;
|
|
2175
|
-
return _regeneratorRuntime().wrap(function
|
|
2176
|
-
while (1) switch (
|
|
2239
|
+
return _regeneratorRuntime().wrap(function _callee22$(_context22) {
|
|
2240
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
2177
2241
|
case 0:
|
|
2178
|
-
|
|
2242
|
+
_context22.prev = 0;
|
|
2179
2243
|
if (this.store.order) {
|
|
2180
|
-
|
|
2244
|
+
_context22.next = 3;
|
|
2181
2245
|
break;
|
|
2182
2246
|
}
|
|
2183
2247
|
throw new Error('order 模块未初始化');
|
|
2184
2248
|
case 3:
|
|
2185
2249
|
if (result) {
|
|
2186
|
-
|
|
2250
|
+
_context22.next = 5;
|
|
2187
2251
|
break;
|
|
2188
2252
|
}
|
|
2189
|
-
return
|
|
2253
|
+
return _context22.abrupt("return");
|
|
2190
2254
|
case 5:
|
|
2191
2255
|
tempOrder = this.store.order.ensureTempOrder();
|
|
2192
2256
|
orderStore = this.store.order.store || {};
|
|
@@ -2195,36 +2259,36 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2195
2259
|
tempOrder.products = preserveManualProductDiscountProducts(tempOrder.products, result.productList);
|
|
2196
2260
|
}
|
|
2197
2261
|
if (!result.discountList) {
|
|
2198
|
-
|
|
2262
|
+
_context22.next = 14;
|
|
2199
2263
|
break;
|
|
2200
2264
|
}
|
|
2201
2265
|
OrderModule.populateSavedAmounts(tempOrder.products, result.discountList);
|
|
2202
|
-
|
|
2266
|
+
_context22.next = 13;
|
|
2203
2267
|
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(result.discountList);
|
|
2204
2268
|
case 13:
|
|
2205
2269
|
tempOrder.discount_list = result.discountList.filter(function (discount) {
|
|
2206
2270
|
return discount.isSelected;
|
|
2207
2271
|
});
|
|
2208
2272
|
case 14:
|
|
2209
|
-
|
|
2273
|
+
_context22.next = 16;
|
|
2210
2274
|
return this.store.order.recalculateSummary({
|
|
2211
2275
|
createIfMissing: true
|
|
2212
2276
|
});
|
|
2213
2277
|
case 16:
|
|
2214
2278
|
this.store.order.persistTempOrder();
|
|
2215
|
-
|
|
2279
|
+
_context22.next = 22;
|
|
2216
2280
|
break;
|
|
2217
2281
|
case 19:
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
throw
|
|
2282
|
+
_context22.prev = 19;
|
|
2283
|
+
_context22.t0 = _context22["catch"](0);
|
|
2284
|
+
throw _context22.t0;
|
|
2221
2285
|
case 22:
|
|
2222
2286
|
case "end":
|
|
2223
|
-
return
|
|
2287
|
+
return _context22.stop();
|
|
2224
2288
|
}
|
|
2225
|
-
},
|
|
2289
|
+
}, _callee22, this, [[0, 19]]);
|
|
2226
2290
|
}));
|
|
2227
|
-
function applyDiscountCalculationResult(
|
|
2291
|
+
function applyDiscountCalculationResult(_x17) {
|
|
2228
2292
|
return _applyDiscountCalculationResult.apply(this, arguments);
|
|
2229
2293
|
}
|
|
2230
2294
|
return applyDiscountCalculationResult;
|
|
@@ -2232,18 +2296,18 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2232
2296
|
}, {
|
|
2233
2297
|
key: "submitScanOrder",
|
|
2234
2298
|
value: function () {
|
|
2235
|
-
var _submitScanOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2236
|
-
return _regeneratorRuntime().wrap(function
|
|
2237
|
-
while (1) switch (
|
|
2299
|
+
var _submitScanOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(params) {
|
|
2300
|
+
return _regeneratorRuntime().wrap(function _callee23$(_context23) {
|
|
2301
|
+
while (1) switch (_context23.prev = _context23.next) {
|
|
2238
2302
|
case 0:
|
|
2239
|
-
return
|
|
2303
|
+
return _context23.abrupt("return", this.submitSalesOrder(params));
|
|
2240
2304
|
case 1:
|
|
2241
2305
|
case "end":
|
|
2242
|
-
return
|
|
2306
|
+
return _context23.stop();
|
|
2243
2307
|
}
|
|
2244
|
-
},
|
|
2308
|
+
}, _callee23, this);
|
|
2245
2309
|
}));
|
|
2246
|
-
function submitScanOrder(
|
|
2310
|
+
function submitScanOrder(_x18) {
|
|
2247
2311
|
return _submitScanOrder.apply(this, arguments);
|
|
2248
2312
|
}
|
|
2249
2313
|
return submitScanOrder;
|
|
@@ -2257,14 +2321,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2257
2321
|
}, {
|
|
2258
2322
|
key: "submitSalesOrder",
|
|
2259
2323
|
value: (function () {
|
|
2260
|
-
var _submitSalesOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2324
|
+
var _submitSalesOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(params) {
|
|
2261
2325
|
var _this$otherParams6, _this$otherParams7, _this$otherParams8, _this$otherParams9;
|
|
2262
2326
|
var inferredPaymentStatus, submitParams;
|
|
2263
|
-
return _regeneratorRuntime().wrap(function
|
|
2264
|
-
while (1) switch (
|
|
2327
|
+
return _regeneratorRuntime().wrap(function _callee24$(_context24) {
|
|
2328
|
+
while (1) switch (_context24.prev = _context24.next) {
|
|
2265
2329
|
case 0:
|
|
2266
2330
|
if (this.store.order) {
|
|
2267
|
-
|
|
2331
|
+
_context24.next = 2;
|
|
2268
2332
|
break;
|
|
2269
2333
|
}
|
|
2270
2334
|
throw new Error('BaseSales 解决方案需要 order 模块支持');
|
|
@@ -2289,14 +2353,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2289
2353
|
} : {}), (params === null || params === void 0 ? void 0 : params.enhancePayload) !== undefined ? {
|
|
2290
2354
|
enhancePayload: params.enhancePayload
|
|
2291
2355
|
} : {});
|
|
2292
|
-
return
|
|
2356
|
+
return _context24.abrupt("return", this.store.order.submitTempOrder(submitParams));
|
|
2293
2357
|
case 5:
|
|
2294
2358
|
case "end":
|
|
2295
|
-
return
|
|
2359
|
+
return _context24.stop();
|
|
2296
2360
|
}
|
|
2297
|
-
},
|
|
2361
|
+
}, _callee24, this);
|
|
2298
2362
|
}));
|
|
2299
|
-
function submitSalesOrder(
|
|
2363
|
+
function submitSalesOrder(_x19) {
|
|
2300
2364
|
return _submitSalesOrder.apply(this, arguments);
|
|
2301
2365
|
}
|
|
2302
2366
|
return submitSalesOrder;
|
|
@@ -2304,14 +2368,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2304
2368
|
}, {
|
|
2305
2369
|
key: "submitTempOrderAsync",
|
|
2306
2370
|
value: function () {
|
|
2307
|
-
var _submitTempOrderAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2371
|
+
var _submitTempOrderAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(params) {
|
|
2308
2372
|
var _this$otherParams10, _this$otherParams11, _this$otherParams12, _this$otherParams13;
|
|
2309
2373
|
var inferredPaymentStatus, submitParams;
|
|
2310
|
-
return _regeneratorRuntime().wrap(function
|
|
2311
|
-
while (1) switch (
|
|
2374
|
+
return _regeneratorRuntime().wrap(function _callee25$(_context25) {
|
|
2375
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
2312
2376
|
case 0:
|
|
2313
2377
|
if (this.store.order) {
|
|
2314
|
-
|
|
2378
|
+
_context25.next = 2;
|
|
2315
2379
|
break;
|
|
2316
2380
|
}
|
|
2317
2381
|
throw new Error('BaseSales 解决方案需要 order 模块支持');
|
|
@@ -2334,14 +2398,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2334
2398
|
} : {}), (params === null || params === void 0 ? void 0 : params.enhancePayload) !== undefined ? {
|
|
2335
2399
|
enhancePayload: params.enhancePayload
|
|
2336
2400
|
} : {});
|
|
2337
|
-
return
|
|
2401
|
+
return _context25.abrupt("return", this.store.order.submitTempOrderAsync(submitParams));
|
|
2338
2402
|
case 5:
|
|
2339
2403
|
case "end":
|
|
2340
|
-
return
|
|
2404
|
+
return _context25.stop();
|
|
2341
2405
|
}
|
|
2342
|
-
},
|
|
2406
|
+
}, _callee25, this);
|
|
2343
2407
|
}));
|
|
2344
|
-
function submitTempOrderAsync(
|
|
2408
|
+
function submitTempOrderAsync(_x20) {
|
|
2345
2409
|
return _submitTempOrderAsync.apply(this, arguments);
|
|
2346
2410
|
}
|
|
2347
2411
|
return submitTempOrderAsync;
|
|
@@ -2349,14 +2413,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2349
2413
|
}, {
|
|
2350
2414
|
key: "printLocalOrderReceipt",
|
|
2351
2415
|
value: function () {
|
|
2352
|
-
var _printLocalOrderReceipt = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2416
|
+
var _printLocalOrderReceipt = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(lookup) {
|
|
2353
2417
|
var _this$otherParams14, _this$otherParams15, _this$otherParams16, _this$otherParams17;
|
|
2354
2418
|
var hasLookup, lookupPayload, context, payload, response, _this$store$order$app, _this$store$order4, _data;
|
|
2355
|
-
return _regeneratorRuntime().wrap(function
|
|
2356
|
-
while (1) switch (
|
|
2419
|
+
return _regeneratorRuntime().wrap(function _callee26$(_context26) {
|
|
2420
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
2357
2421
|
case 0:
|
|
2358
2422
|
if (this.store.order) {
|
|
2359
|
-
|
|
2423
|
+
_context26.next = 2;
|
|
2360
2424
|
break;
|
|
2361
2425
|
}
|
|
2362
2426
|
throw new Error('BaseSales 解决方案需要 order 模块支持');
|
|
@@ -2387,28 +2451,28 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2387
2451
|
channel: context.channel,
|
|
2388
2452
|
type: context.type
|
|
2389
2453
|
});
|
|
2390
|
-
|
|
2454
|
+
_context26.next = 8;
|
|
2391
2455
|
return this.request.post('/local/print-order', payload, {
|
|
2392
2456
|
osServer: true,
|
|
2393
2457
|
customToast: function customToast() {}
|
|
2394
2458
|
});
|
|
2395
2459
|
case 8:
|
|
2396
|
-
response =
|
|
2460
|
+
response = _context26.sent;
|
|
2397
2461
|
if (hasLookup) {
|
|
2398
|
-
|
|
2462
|
+
_context26.next = 12;
|
|
2399
2463
|
break;
|
|
2400
2464
|
}
|
|
2401
|
-
|
|
2465
|
+
_context26.next = 12;
|
|
2402
2466
|
return (_this$store$order$app = (_this$store$order4 = this.store.order).applyLocalPrintOrderNumbers) === null || _this$store$order$app === void 0 ? void 0 : _this$store$order$app.call(_this$store$order4, response === null || response === void 0 || (_data = response.data) === null || _data === void 0 ? void 0 : _data.order);
|
|
2403
2467
|
case 12:
|
|
2404
|
-
return
|
|
2468
|
+
return _context26.abrupt("return", response);
|
|
2405
2469
|
case 13:
|
|
2406
2470
|
case "end":
|
|
2407
|
-
return
|
|
2471
|
+
return _context26.stop();
|
|
2408
2472
|
}
|
|
2409
|
-
},
|
|
2473
|
+
}, _callee26, this);
|
|
2410
2474
|
}));
|
|
2411
|
-
function printLocalOrderReceipt(
|
|
2475
|
+
function printLocalOrderReceipt(_x21) {
|
|
2412
2476
|
return _printLocalOrderReceipt.apply(this, arguments);
|
|
2413
2477
|
}
|
|
2414
2478
|
return printLocalOrderReceipt;
|
|
@@ -2429,14 +2493,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2429
2493
|
}, {
|
|
2430
2494
|
key: "syncPaymentsToOrder",
|
|
2431
2495
|
value: function () {
|
|
2432
|
-
var _syncPaymentsToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2496
|
+
var _syncPaymentsToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(params) {
|
|
2433
2497
|
var _ref21, _params$businessCode, _this$otherParams18, _this$otherParams19, _params$channel;
|
|
2434
2498
|
var businessCode, channel, syncParams, syncState, payments, syncResult, latestPayments, amountSnapshot, orderSnapshot, syncPayload;
|
|
2435
|
-
return _regeneratorRuntime().wrap(function
|
|
2436
|
-
while (1) switch (
|
|
2499
|
+
return _regeneratorRuntime().wrap(function _callee27$(_context27) {
|
|
2500
|
+
while (1) switch (_context27.prev = _context27.next) {
|
|
2437
2501
|
case 0:
|
|
2438
2502
|
if (this.store.order) {
|
|
2439
|
-
|
|
2503
|
+
_context27.next = 2;
|
|
2440
2504
|
break;
|
|
2441
2505
|
}
|
|
2442
2506
|
throw new Error('order 模块未初始化');
|
|
@@ -2450,14 +2514,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2450
2514
|
} : {});
|
|
2451
2515
|
syncState = this.store.order.getOrderSyncState();
|
|
2452
2516
|
if (!(params.submitWhenPaid && syncState === 'submitting')) {
|
|
2453
|
-
|
|
2517
|
+
_context27.next = 9;
|
|
2454
2518
|
break;
|
|
2455
2519
|
}
|
|
2456
2520
|
this.queueLatestAutoPaymentSync();
|
|
2457
|
-
return
|
|
2521
|
+
return _context27.abrupt("return", this.store.order.syncPaymentsToOrder(syncParams));
|
|
2458
2522
|
case 9:
|
|
2459
2523
|
payments = params.payments || [];
|
|
2460
|
-
|
|
2524
|
+
_context27.next = 12;
|
|
2461
2525
|
return this.effectsEmit(BaseSalesHookNames.onPaymentSyncStart, {
|
|
2462
2526
|
payments: payments,
|
|
2463
2527
|
params: syncParams,
|
|
@@ -2465,11 +2529,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2465
2529
|
orderSnapshot: this.store.order.getOrderSnapshot()
|
|
2466
2530
|
});
|
|
2467
2531
|
case 12:
|
|
2468
|
-
|
|
2469
|
-
|
|
2532
|
+
_context27.prev = 12;
|
|
2533
|
+
_context27.next = 15;
|
|
2470
2534
|
return this.store.order.syncPaymentsToOrder(syncParams);
|
|
2471
2535
|
case 15:
|
|
2472
|
-
syncResult =
|
|
2536
|
+
syncResult = _context27.sent;
|
|
2473
2537
|
latestPayments = this.store.order.getOrderPayments();
|
|
2474
2538
|
amountSnapshot = this.store.order.getOrderAmountSnapshot();
|
|
2475
2539
|
orderSnapshot = this.store.order.getOrderSnapshot();
|
|
@@ -2487,25 +2551,25 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2487
2551
|
depositAmount: syncResult.depositAmount,
|
|
2488
2552
|
orderExpectedAmount: syncResult.orderExpectedAmount
|
|
2489
2553
|
};
|
|
2490
|
-
|
|
2554
|
+
_context27.next = 22;
|
|
2491
2555
|
return this.effectsEmit(BaseSalesHookNames.onPaymentSyncEnd, syncPayload);
|
|
2492
2556
|
case 22:
|
|
2493
2557
|
if (!(syncResult.isDepositFullyPaid && !syncResult.isOrderFullyPaid)) {
|
|
2494
|
-
|
|
2558
|
+
_context27.next = 25;
|
|
2495
2559
|
break;
|
|
2496
2560
|
}
|
|
2497
|
-
|
|
2561
|
+
_context27.next = 25;
|
|
2498
2562
|
return this.effectsEmit(BaseSalesHookNames.onDepositPaymentSyncEnd, syncPayload);
|
|
2499
2563
|
case 25:
|
|
2500
2564
|
this.scheduleQueuedAutoPaymentSyncFlush(0);
|
|
2501
|
-
return
|
|
2565
|
+
return _context27.abrupt("return", syncResult);
|
|
2502
2566
|
case 29:
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2567
|
+
_context27.prev = 29;
|
|
2568
|
+
_context27.t0 = _context27["catch"](12);
|
|
2569
|
+
_context27.next = 33;
|
|
2506
2570
|
return this.effectsEmit(BaseSalesHookNames.onPaymentSyncEnd, {
|
|
2507
2571
|
ok: false,
|
|
2508
|
-
error:
|
|
2572
|
+
error: _context27.t0,
|
|
2509
2573
|
payments: this.store.order.getOrderPayments(),
|
|
2510
2574
|
params: syncParams,
|
|
2511
2575
|
amountSnapshot: this.store.order.getOrderAmountSnapshot(),
|
|
@@ -2513,14 +2577,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2513
2577
|
});
|
|
2514
2578
|
case 33:
|
|
2515
2579
|
this.scheduleQueuedAutoPaymentSyncFlush(0);
|
|
2516
|
-
throw
|
|
2580
|
+
throw _context27.t0;
|
|
2517
2581
|
case 35:
|
|
2518
2582
|
case "end":
|
|
2519
|
-
return
|
|
2583
|
+
return _context27.stop();
|
|
2520
2584
|
}
|
|
2521
|
-
},
|
|
2585
|
+
}, _callee27, this, [[12, 29]]);
|
|
2522
2586
|
}));
|
|
2523
|
-
function syncPaymentsToOrder(
|
|
2587
|
+
function syncPaymentsToOrder(_x22) {
|
|
2524
2588
|
return _syncPaymentsToOrder.apply(this, arguments);
|
|
2525
2589
|
}
|
|
2526
2590
|
return syncPaymentsToOrder;
|
|
@@ -2569,46 +2633,46 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2569
2633
|
}, {
|
|
2570
2634
|
key: "flushQueuedAutoPaymentSync",
|
|
2571
2635
|
value: function () {
|
|
2572
|
-
var _flushQueuedAutoPaymentSync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2636
|
+
var _flushQueuedAutoPaymentSync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28() {
|
|
2573
2637
|
var payments;
|
|
2574
|
-
return _regeneratorRuntime().wrap(function
|
|
2575
|
-
while (1) switch (
|
|
2638
|
+
return _regeneratorRuntime().wrap(function _callee28$(_context28) {
|
|
2639
|
+
while (1) switch (_context28.prev = _context28.next) {
|
|
2576
2640
|
case 0:
|
|
2577
2641
|
if (this.store.order) {
|
|
2578
|
-
|
|
2642
|
+
_context28.next = 2;
|
|
2579
2643
|
break;
|
|
2580
2644
|
}
|
|
2581
|
-
return
|
|
2645
|
+
return _context28.abrupt("return");
|
|
2582
2646
|
case 2:
|
|
2583
2647
|
if (!(!this.queuedAutoPaymentSync || this.autoPaymentSyncFlushing)) {
|
|
2584
|
-
|
|
2648
|
+
_context28.next = 4;
|
|
2585
2649
|
break;
|
|
2586
2650
|
}
|
|
2587
|
-
return
|
|
2651
|
+
return _context28.abrupt("return");
|
|
2588
2652
|
case 4:
|
|
2589
2653
|
if (!(this.store.order.getOrderSyncState() === 'submitting')) {
|
|
2590
|
-
|
|
2654
|
+
_context28.next = 7;
|
|
2591
2655
|
break;
|
|
2592
2656
|
}
|
|
2593
2657
|
this.scheduleQueuedAutoPaymentSyncFlush();
|
|
2594
|
-
return
|
|
2658
|
+
return _context28.abrupt("return");
|
|
2595
2659
|
case 7:
|
|
2596
2660
|
this.autoPaymentSyncFlushing = true;
|
|
2597
|
-
|
|
2661
|
+
_context28.prev = 8;
|
|
2598
2662
|
case 9:
|
|
2599
2663
|
if (!this.queuedAutoPaymentSync) {
|
|
2600
|
-
|
|
2664
|
+
_context28.next = 18;
|
|
2601
2665
|
break;
|
|
2602
2666
|
}
|
|
2603
2667
|
this.queuedAutoPaymentSync = false;
|
|
2604
2668
|
payments = this.store.order.getOrderPayments();
|
|
2605
2669
|
if (payments.length) {
|
|
2606
|
-
|
|
2670
|
+
_context28.next = 14;
|
|
2607
2671
|
break;
|
|
2608
2672
|
}
|
|
2609
|
-
return
|
|
2673
|
+
return _context28.abrupt("continue", 9);
|
|
2610
2674
|
case 14:
|
|
2611
|
-
|
|
2675
|
+
_context28.next = 16;
|
|
2612
2676
|
return this.syncPaymentsToOrder({
|
|
2613
2677
|
payments: payments,
|
|
2614
2678
|
paymentStatus: this.getPaymentStatusForSync(payments),
|
|
@@ -2616,29 +2680,29 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2616
2680
|
smallTicketDataFlag: 1
|
|
2617
2681
|
});
|
|
2618
2682
|
case 16:
|
|
2619
|
-
|
|
2683
|
+
_context28.next = 9;
|
|
2620
2684
|
break;
|
|
2621
2685
|
case 18:
|
|
2622
|
-
|
|
2686
|
+
_context28.next = 23;
|
|
2623
2687
|
break;
|
|
2624
2688
|
case 20:
|
|
2625
|
-
|
|
2626
|
-
|
|
2689
|
+
_context28.prev = 20;
|
|
2690
|
+
_context28.t0 = _context28["catch"](8);
|
|
2627
2691
|
this.logError('queued auto sync payments failed', {
|
|
2628
|
-
error:
|
|
2692
|
+
error: _context28.t0 instanceof Error ? _context28.t0.message : String(_context28.t0)
|
|
2629
2693
|
});
|
|
2630
2694
|
case 23:
|
|
2631
|
-
|
|
2695
|
+
_context28.prev = 23;
|
|
2632
2696
|
this.autoPaymentSyncFlushing = false;
|
|
2633
2697
|
if (this.queuedAutoPaymentSync) {
|
|
2634
2698
|
this.scheduleQueuedAutoPaymentSyncFlush(0);
|
|
2635
2699
|
}
|
|
2636
|
-
return
|
|
2700
|
+
return _context28.finish(23);
|
|
2637
2701
|
case 27:
|
|
2638
2702
|
case "end":
|
|
2639
|
-
return
|
|
2703
|
+
return _context28.stop();
|
|
2640
2704
|
}
|
|
2641
|
-
},
|
|
2705
|
+
}, _callee28, this, [[8, 20, 23, 27]]);
|
|
2642
2706
|
}));
|
|
2643
2707
|
function flushQueuedAutoPaymentSync() {
|
|
2644
2708
|
return _flushQueuedAutoPaymentSync.apply(this, arguments);
|
|
@@ -2803,20 +2867,20 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2803
2867
|
}, {
|
|
2804
2868
|
key: "initWalletData",
|
|
2805
2869
|
value: function () {
|
|
2806
|
-
var _initWalletData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2870
|
+
var _initWalletData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(params) {
|
|
2807
2871
|
var _params$order_wait_pa, _ref23, _tempOrder$is_price_i;
|
|
2808
2872
|
var snapshot, tempOrder, amount, walletBusinessData, result;
|
|
2809
|
-
return _regeneratorRuntime().wrap(function
|
|
2810
|
-
while (1) switch (
|
|
2873
|
+
return _regeneratorRuntime().wrap(function _callee29$(_context29) {
|
|
2874
|
+
while (1) switch (_context29.prev = _context29.next) {
|
|
2811
2875
|
case 0:
|
|
2812
2876
|
if (this.store.order) {
|
|
2813
|
-
|
|
2877
|
+
_context29.next = 2;
|
|
2814
2878
|
break;
|
|
2815
2879
|
}
|
|
2816
2880
|
throw new Error('order 模块未初始化');
|
|
2817
2881
|
case 2:
|
|
2818
2882
|
if (this.store.payment) {
|
|
2819
|
-
|
|
2883
|
+
_context29.next = 4;
|
|
2820
2884
|
break;
|
|
2821
2885
|
}
|
|
2822
2886
|
throw new Error('payment 模块未初始化');
|
|
@@ -2825,10 +2889,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2825
2889
|
tempOrder = snapshot === null || snapshot === void 0 ? void 0 : snapshot.tempOrder;
|
|
2826
2890
|
amount = snapshot === null || snapshot === void 0 ? void 0 : snapshot.amount;
|
|
2827
2891
|
if (!(!tempOrder || !amount)) {
|
|
2828
|
-
|
|
2892
|
+
_context29.next = 9;
|
|
2829
2893
|
break;
|
|
2830
2894
|
}
|
|
2831
|
-
return
|
|
2895
|
+
return _context29.abrupt("return", {
|
|
2832
2896
|
walletRecommendList: [],
|
|
2833
2897
|
userIdentificationCodes: [],
|
|
2834
2898
|
transformList: [],
|
|
@@ -2851,11 +2915,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2851
2915
|
}, snapshot.identity.orderId ? {
|
|
2852
2916
|
payment_order_id: String(snapshot.identity.orderId)
|
|
2853
2917
|
} : {});
|
|
2854
|
-
|
|
2918
|
+
_context29.next = 12;
|
|
2855
2919
|
return this.store.payment.wallet.initializeWalletDataFromBusinessAsync(walletBusinessData);
|
|
2856
2920
|
case 12:
|
|
2857
|
-
result =
|
|
2858
|
-
|
|
2921
|
+
result = _context29.sent;
|
|
2922
|
+
_context29.next = 15;
|
|
2859
2923
|
return this.core.effects.emit("".concat(this.name, ":onWalletDataInitialized"), {
|
|
2860
2924
|
orderId: snapshot.identity.orderId,
|
|
2861
2925
|
customerId: walletBusinessData.customer_id,
|
|
@@ -2867,14 +2931,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2867
2931
|
timestamp: Date.now()
|
|
2868
2932
|
});
|
|
2869
2933
|
case 15:
|
|
2870
|
-
return
|
|
2934
|
+
return _context29.abrupt("return", result);
|
|
2871
2935
|
case 16:
|
|
2872
2936
|
case "end":
|
|
2873
|
-
return
|
|
2937
|
+
return _context29.stop();
|
|
2874
2938
|
}
|
|
2875
|
-
},
|
|
2939
|
+
}, _callee29, this);
|
|
2876
2940
|
}));
|
|
2877
|
-
function initWalletData(
|
|
2941
|
+
function initWalletData(_x23) {
|
|
2878
2942
|
return _initWalletData.apply(this, arguments);
|
|
2879
2943
|
}
|
|
2880
2944
|
return initWalletData;
|
|
@@ -2901,35 +2965,35 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2901
2965
|
}, {
|
|
2902
2966
|
key: "getPaymentMethodsAsync",
|
|
2903
2967
|
value: (function () {
|
|
2904
|
-
var _getPaymentMethodsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2968
|
+
var _getPaymentMethodsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30() {
|
|
2905
2969
|
var response, paymentMethods;
|
|
2906
|
-
return _regeneratorRuntime().wrap(function
|
|
2907
|
-
while (1) switch (
|
|
2970
|
+
return _regeneratorRuntime().wrap(function _callee30$(_context30) {
|
|
2971
|
+
while (1) switch (_context30.prev = _context30.next) {
|
|
2908
2972
|
case 0:
|
|
2909
|
-
|
|
2910
|
-
|
|
2973
|
+
_context30.prev = 0;
|
|
2974
|
+
_context30.next = 3;
|
|
2911
2975
|
return this.request.get('/pay/custom-payment/all', {
|
|
2912
2976
|
filterPaymentMethods: true
|
|
2913
2977
|
}, {
|
|
2914
2978
|
osServer: true
|
|
2915
2979
|
});
|
|
2916
2980
|
case 3:
|
|
2917
|
-
response =
|
|
2981
|
+
response = _context30.sent;
|
|
2918
2982
|
paymentMethods = (response === null || response === void 0 ? void 0 : response.data) || [];
|
|
2919
2983
|
this.paymentMethodsCache = Array.isArray(paymentMethods) ? _toConsumableArray(paymentMethods) : [];
|
|
2920
|
-
return
|
|
2984
|
+
return _context30.abrupt("return", this.getPaymentMethods());
|
|
2921
2985
|
case 9:
|
|
2922
|
-
|
|
2923
|
-
|
|
2986
|
+
_context30.prev = 9;
|
|
2987
|
+
_context30.t0 = _context30["catch"](0);
|
|
2924
2988
|
this.logWarning('getPaymentMethodsAsync: 获取支付方式列表失败,使用缓存列表', {
|
|
2925
|
-
error:
|
|
2989
|
+
error: _context30.t0 instanceof Error ? _context30.t0.message : String(_context30.t0)
|
|
2926
2990
|
});
|
|
2927
|
-
return
|
|
2991
|
+
return _context30.abrupt("return", this.getPaymentMethods());
|
|
2928
2992
|
case 13:
|
|
2929
2993
|
case "end":
|
|
2930
|
-
return
|
|
2994
|
+
return _context30.stop();
|
|
2931
2995
|
}
|
|
2932
|
-
},
|
|
2996
|
+
}, _callee30, this, [[0, 9]]);
|
|
2933
2997
|
}));
|
|
2934
2998
|
function getPaymentMethodsAsync() {
|
|
2935
2999
|
return _getPaymentMethodsAsync.apply(this, arguments);
|
|
@@ -2977,49 +3041,49 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2977
3041
|
}, {
|
|
2978
3042
|
key: "sendCustomerPayLink",
|
|
2979
3043
|
value: (function () {
|
|
2980
|
-
var _sendCustomerPayLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3044
|
+
var _sendCustomerPayLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(params) {
|
|
2981
3045
|
var orderIds, _ref24, _ref25, _submitResult$data$or, _submitResult$data, _submitResult$data2, submitResult, orderId;
|
|
2982
|
-
return _regeneratorRuntime().wrap(function
|
|
2983
|
-
while (1) switch (
|
|
3046
|
+
return _regeneratorRuntime().wrap(function _callee31$(_context31) {
|
|
3047
|
+
while (1) switch (_context31.prev = _context31.next) {
|
|
2984
3048
|
case 0:
|
|
2985
3049
|
if (this.store.order) {
|
|
2986
|
-
|
|
3050
|
+
_context31.next = 2;
|
|
2987
3051
|
break;
|
|
2988
3052
|
}
|
|
2989
3053
|
throw new Error('order 模块未初始化');
|
|
2990
3054
|
case 2:
|
|
2991
3055
|
orderIds = params.order_ids || params.orderIds || [];
|
|
2992
3056
|
if (!(!orderIds.length || params.submitBeforeSend)) {
|
|
2993
|
-
|
|
3057
|
+
_context31.next = 11;
|
|
2994
3058
|
break;
|
|
2995
3059
|
}
|
|
2996
|
-
|
|
3060
|
+
_context31.next = 6;
|
|
2997
3061
|
return this.submitSalesOrder({
|
|
2998
3062
|
smallTicketDataFlag: 1
|
|
2999
3063
|
});
|
|
3000
3064
|
case 6:
|
|
3001
|
-
submitResult =
|
|
3065
|
+
submitResult = _context31.sent;
|
|
3002
3066
|
orderId = (_ref24 = (_ref25 = (_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 && _ref25 !== void 0 ? _ref25 : submitResult === null || submitResult === void 0 || (_submitResult$data2 = submitResult.data) === null || _submitResult$data2 === void 0 ? void 0 : _submitResult$data2.id) !== null && _ref24 !== void 0 ? _ref24 : submitResult === null || submitResult === void 0 ? void 0 : submitResult.id;
|
|
3003
3067
|
if (orderId) {
|
|
3004
|
-
|
|
3068
|
+
_context31.next = 10;
|
|
3005
3069
|
break;
|
|
3006
3070
|
}
|
|
3007
3071
|
throw new Error('本地订单提交云端失败,无法发送支付链接');
|
|
3008
3072
|
case 10:
|
|
3009
3073
|
orderIds = [orderId];
|
|
3010
3074
|
case 11:
|
|
3011
|
-
return
|
|
3075
|
+
return _context31.abrupt("return", this.store.order.sendCustomerPayLink({
|
|
3012
3076
|
emails: params.emails,
|
|
3013
3077
|
notify_action: params.notify_action,
|
|
3014
3078
|
order_ids: orderIds
|
|
3015
3079
|
}));
|
|
3016
3080
|
case 12:
|
|
3017
3081
|
case "end":
|
|
3018
|
-
return
|
|
3082
|
+
return _context31.stop();
|
|
3019
3083
|
}
|
|
3020
|
-
},
|
|
3084
|
+
}, _callee31, this);
|
|
3021
3085
|
}));
|
|
3022
|
-
function sendCustomerPayLink(
|
|
3086
|
+
function sendCustomerPayLink(_x24) {
|
|
3023
3087
|
return _sendCustomerPayLink.apply(this, arguments);
|
|
3024
3088
|
}
|
|
3025
3089
|
return sendCustomerPayLink;
|
|
@@ -3032,27 +3096,27 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3032
3096
|
}, {
|
|
3033
3097
|
key: "calculateProductBookingPrice",
|
|
3034
3098
|
value: function () {
|
|
3035
|
-
var _calculateProductBookingPrice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3099
|
+
var _calculateProductBookingPrice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(params) {
|
|
3036
3100
|
var _params$customer_id;
|
|
3037
3101
|
var quotation, customerId, authoritativeProduct, product;
|
|
3038
|
-
return _regeneratorRuntime().wrap(function
|
|
3039
|
-
while (1) switch (
|
|
3102
|
+
return _regeneratorRuntime().wrap(function _callee32$(_context32) {
|
|
3103
|
+
while (1) switch (_context32.prev = _context32.next) {
|
|
3040
3104
|
case 0:
|
|
3041
3105
|
quotation = this.store.quotation;
|
|
3042
3106
|
customerId = (_params$customer_id = params.customer_id) !== null && _params$customer_id !== void 0 ? _params$customer_id : this.getCurrentOrderCustomerId();
|
|
3043
|
-
|
|
3107
|
+
_context32.next = 4;
|
|
3044
3108
|
return this.loadProductForPriceQuery(params, customerId);
|
|
3045
3109
|
case 4:
|
|
3046
|
-
authoritativeProduct =
|
|
3110
|
+
authoritativeProduct = _context32.sent;
|
|
3047
3111
|
product = this.mergeProductForPriceQuery(params.product, authoritativeProduct);
|
|
3048
|
-
|
|
3112
|
+
_context32.next = 8;
|
|
3049
3113
|
return this.loadQuotationForPriceQuery({
|
|
3050
3114
|
quotation: quotation,
|
|
3051
3115
|
customer_id: customerId,
|
|
3052
3116
|
channel: params.channel
|
|
3053
3117
|
});
|
|
3054
3118
|
case 8:
|
|
3055
|
-
return
|
|
3119
|
+
return _context32.abrupt("return", calculateBaseSalesProductBookingPrice(_objectSpread(_objectSpread({}, params), {}, {
|
|
3056
3120
|
product: product,
|
|
3057
3121
|
fallback_price: authoritativeProduct ? undefined : params.fallback_price,
|
|
3058
3122
|
customer_id: customerId,
|
|
@@ -3060,11 +3124,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3060
3124
|
})));
|
|
3061
3125
|
case 9:
|
|
3062
3126
|
case "end":
|
|
3063
|
-
return
|
|
3127
|
+
return _context32.stop();
|
|
3064
3128
|
}
|
|
3065
|
-
},
|
|
3129
|
+
}, _callee32, this);
|
|
3066
3130
|
}));
|
|
3067
|
-
function calculateProductBookingPrice(
|
|
3131
|
+
function calculateProductBookingPrice(_x25) {
|
|
3068
3132
|
return _calculateProductBookingPrice.apply(this, arguments);
|
|
3069
3133
|
}
|
|
3070
3134
|
return calculateProductBookingPrice;
|
|
@@ -3134,20 +3198,20 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3134
3198
|
}, {
|
|
3135
3199
|
key: "calculateProductBookingPrices",
|
|
3136
3200
|
value: function () {
|
|
3137
|
-
var _calculateProductBookingPrices = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3201
|
+
var _calculateProductBookingPrices = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(paramsList) {
|
|
3138
3202
|
var _paramsList$0$custome,
|
|
3139
3203
|
_paramsList$,
|
|
3140
3204
|
_this13 = this,
|
|
3141
3205
|
_paramsList$2;
|
|
3142
3206
|
var quotation, customerId, productMapsByGroup, groups;
|
|
3143
|
-
return _regeneratorRuntime().wrap(function
|
|
3144
|
-
while (1) switch (
|
|
3207
|
+
return _regeneratorRuntime().wrap(function _callee34$(_context34) {
|
|
3208
|
+
while (1) switch (_context34.prev = _context34.next) {
|
|
3145
3209
|
case 0:
|
|
3146
3210
|
if (paramsList.length) {
|
|
3147
|
-
|
|
3211
|
+
_context34.next = 2;
|
|
3148
3212
|
break;
|
|
3149
3213
|
}
|
|
3150
|
-
return
|
|
3214
|
+
return _context34.abrupt("return", []);
|
|
3151
3215
|
case 2:
|
|
3152
3216
|
quotation = this.store.quotation;
|
|
3153
3217
|
customerId = (_paramsList$0$custome = (_paramsList$ = paramsList[0]) === null || _paramsList$ === void 0 ? void 0 : _paramsList$.customer_id) !== null && _paramsList$0$custome !== void 0 ? _paramsList$0$custome : this.getCurrentOrderCustomerId();
|
|
@@ -3169,15 +3233,15 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3169
3233
|
group.ids.add(productId);
|
|
3170
3234
|
groups.set(groupKey, group);
|
|
3171
3235
|
});
|
|
3172
|
-
|
|
3236
|
+
_context34.next = 9;
|
|
3173
3237
|
return Promise.all(Array.from(groups.entries()).map( /*#__PURE__*/function () {
|
|
3174
|
-
var _ref27 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3238
|
+
var _ref27 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(_ref26) {
|
|
3175
3239
|
var _ref28, groupKey, group, productsById;
|
|
3176
|
-
return _regeneratorRuntime().wrap(function
|
|
3177
|
-
while (1) switch (
|
|
3240
|
+
return _regeneratorRuntime().wrap(function _callee33$(_context33) {
|
|
3241
|
+
while (1) switch (_context33.prev = _context33.next) {
|
|
3178
3242
|
case 0:
|
|
3179
3243
|
_ref28 = _slicedToArray(_ref26, 2), groupKey = _ref28[0], group = _ref28[1];
|
|
3180
|
-
|
|
3244
|
+
_context33.next = 3;
|
|
3181
3245
|
return _this13.loadProductsForPriceQuery({
|
|
3182
3246
|
ids: Array.from(group.ids),
|
|
3183
3247
|
schedule: group.schedule,
|
|
@@ -3185,27 +3249,27 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3185
3249
|
channel: group.channel
|
|
3186
3250
|
});
|
|
3187
3251
|
case 3:
|
|
3188
|
-
productsById =
|
|
3252
|
+
productsById = _context33.sent;
|
|
3189
3253
|
productMapsByGroup.set(groupKey, productsById);
|
|
3190
3254
|
case 5:
|
|
3191
3255
|
case "end":
|
|
3192
|
-
return
|
|
3256
|
+
return _context33.stop();
|
|
3193
3257
|
}
|
|
3194
|
-
},
|
|
3258
|
+
}, _callee33);
|
|
3195
3259
|
}));
|
|
3196
|
-
return function (
|
|
3260
|
+
return function (_x27) {
|
|
3197
3261
|
return _ref27.apply(this, arguments);
|
|
3198
3262
|
};
|
|
3199
3263
|
}()));
|
|
3200
3264
|
case 9:
|
|
3201
|
-
|
|
3265
|
+
_context34.next = 11;
|
|
3202
3266
|
return this.loadQuotationForPriceQuery({
|
|
3203
3267
|
quotation: quotation,
|
|
3204
3268
|
customer_id: customerId,
|
|
3205
3269
|
channel: (_paramsList$2 = paramsList[0]) === null || _paramsList$2 === void 0 ? void 0 : _paramsList$2.channel
|
|
3206
3270
|
});
|
|
3207
3271
|
case 11:
|
|
3208
|
-
return
|
|
3272
|
+
return _context34.abrupt("return", paramsList.map(function (params) {
|
|
3209
3273
|
var _this13$otherParams2, _productMapsByGroup$g;
|
|
3210
3274
|
var productInput = params.product || {};
|
|
3211
3275
|
var productId = _this13.getPriceQueryProductId(productInput);
|
|
@@ -3223,11 +3287,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3223
3287
|
}));
|
|
3224
3288
|
case 12:
|
|
3225
3289
|
case "end":
|
|
3226
|
-
return
|
|
3290
|
+
return _context34.stop();
|
|
3227
3291
|
}
|
|
3228
|
-
},
|
|
3292
|
+
}, _callee34, this);
|
|
3229
3293
|
}));
|
|
3230
|
-
function calculateProductBookingPrices(
|
|
3294
|
+
function calculateProductBookingPrices(_x26) {
|
|
3231
3295
|
return _calculateProductBookingPrices.apply(this, arguments);
|
|
3232
3296
|
}
|
|
3233
3297
|
return calculateProductBookingPrices;
|
|
@@ -3235,42 +3299,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3235
3299
|
}, {
|
|
3236
3300
|
key: "addProductToOrder",
|
|
3237
3301
|
value: function () {
|
|
3238
|
-
var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3239
|
-
var products;
|
|
3240
|
-
return _regeneratorRuntime().wrap(function _callee34$(_context34) {
|
|
3241
|
-
while (1) switch (_context34.prev = _context34.next) {
|
|
3242
|
-
case 0:
|
|
3243
|
-
_context34.prev = 0;
|
|
3244
|
-
if (this.store.order) {
|
|
3245
|
-
_context34.next = 3;
|
|
3246
|
-
break;
|
|
3247
|
-
}
|
|
3248
|
-
throw new Error('order 模块未初始化');
|
|
3249
|
-
case 3:
|
|
3250
|
-
_context34.next = 5;
|
|
3251
|
-
return this.store.order.addProductToOrder(product, booking);
|
|
3252
|
-
case 5:
|
|
3253
|
-
products = _context34.sent;
|
|
3254
|
-
return _context34.abrupt("return", products);
|
|
3255
|
-
case 9:
|
|
3256
|
-
_context34.prev = 9;
|
|
3257
|
-
_context34.t0 = _context34["catch"](0);
|
|
3258
|
-
throw _context34.t0;
|
|
3259
|
-
case 12:
|
|
3260
|
-
case "end":
|
|
3261
|
-
return _context34.stop();
|
|
3262
|
-
}
|
|
3263
|
-
}, _callee34, this, [[0, 9]]);
|
|
3264
|
-
}));
|
|
3265
|
-
function addProductToOrder(_x27, _x28) {
|
|
3266
|
-
return _addProductToOrder.apply(this, arguments);
|
|
3267
|
-
}
|
|
3268
|
-
return addProductToOrder;
|
|
3269
|
-
}()
|
|
3270
|
-
}, {
|
|
3271
|
-
key: "updateOrderProduct",
|
|
3272
|
-
value: function () {
|
|
3273
|
-
var _updateOrderProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35(params) {
|
|
3302
|
+
var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35(product, booking) {
|
|
3274
3303
|
var products;
|
|
3275
3304
|
return _regeneratorRuntime().wrap(function _callee35$(_context35) {
|
|
3276
3305
|
while (1) switch (_context35.prev = _context35.next) {
|
|
@@ -3283,7 +3312,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3283
3312
|
throw new Error('order 模块未初始化');
|
|
3284
3313
|
case 3:
|
|
3285
3314
|
_context35.next = 5;
|
|
3286
|
-
return this.store.order.
|
|
3315
|
+
return this.store.order.addProductToOrder(product, booking);
|
|
3287
3316
|
case 5:
|
|
3288
3317
|
products = _context35.sent;
|
|
3289
3318
|
return _context35.abrupt("return", products);
|
|
@@ -3297,15 +3326,15 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3297
3326
|
}
|
|
3298
3327
|
}, _callee35, this, [[0, 9]]);
|
|
3299
3328
|
}));
|
|
3300
|
-
function
|
|
3301
|
-
return
|
|
3329
|
+
function addProductToOrder(_x28, _x29) {
|
|
3330
|
+
return _addProductToOrder.apply(this, arguments);
|
|
3302
3331
|
}
|
|
3303
|
-
return
|
|
3332
|
+
return addProductToOrder;
|
|
3304
3333
|
}()
|
|
3305
3334
|
}, {
|
|
3306
|
-
key: "
|
|
3335
|
+
key: "updateOrderProduct",
|
|
3307
3336
|
value: function () {
|
|
3308
|
-
var
|
|
3337
|
+
var _updateOrderProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(params) {
|
|
3309
3338
|
var products;
|
|
3310
3339
|
return _regeneratorRuntime().wrap(function _callee36$(_context36) {
|
|
3311
3340
|
while (1) switch (_context36.prev = _context36.next) {
|
|
@@ -3318,7 +3347,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3318
3347
|
throw new Error('order 模块未初始化');
|
|
3319
3348
|
case 3:
|
|
3320
3349
|
_context36.next = 5;
|
|
3321
|
-
return this.store.order.
|
|
3350
|
+
return this.store.order.updateOrderProduct(params);
|
|
3322
3351
|
case 5:
|
|
3323
3352
|
products = _context36.sent;
|
|
3324
3353
|
return _context36.abrupt("return", products);
|
|
@@ -3332,15 +3361,15 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3332
3361
|
}
|
|
3333
3362
|
}, _callee36, this, [[0, 9]]);
|
|
3334
3363
|
}));
|
|
3335
|
-
function
|
|
3336
|
-
return
|
|
3364
|
+
function updateOrderProduct(_x30) {
|
|
3365
|
+
return _updateOrderProduct.apply(this, arguments);
|
|
3337
3366
|
}
|
|
3338
|
-
return
|
|
3367
|
+
return updateOrderProduct;
|
|
3339
3368
|
}()
|
|
3340
3369
|
}, {
|
|
3341
|
-
key: "
|
|
3370
|
+
key: "updateOrderProducts",
|
|
3342
3371
|
value: function () {
|
|
3343
|
-
var
|
|
3372
|
+
var _updateOrderProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37(paramsList) {
|
|
3344
3373
|
var products;
|
|
3345
3374
|
return _regeneratorRuntime().wrap(function _callee37$(_context37) {
|
|
3346
3375
|
while (1) switch (_context37.prev = _context37.next) {
|
|
@@ -3353,7 +3382,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3353
3382
|
throw new Error('order 模块未初始化');
|
|
3354
3383
|
case 3:
|
|
3355
3384
|
_context37.next = 5;
|
|
3356
|
-
return this.store.order.
|
|
3385
|
+
return this.store.order.updateOrderProducts(paramsList);
|
|
3357
3386
|
case 5:
|
|
3358
3387
|
products = _context37.sent;
|
|
3359
3388
|
return _context37.abrupt("return", products);
|
|
@@ -3367,7 +3396,42 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3367
3396
|
}
|
|
3368
3397
|
}, _callee37, this, [[0, 9]]);
|
|
3369
3398
|
}));
|
|
3370
|
-
function
|
|
3399
|
+
function updateOrderProducts(_x31) {
|
|
3400
|
+
return _updateOrderProducts.apply(this, arguments);
|
|
3401
|
+
}
|
|
3402
|
+
return updateOrderProducts;
|
|
3403
|
+
}()
|
|
3404
|
+
}, {
|
|
3405
|
+
key: "updateOrderProductQuantity",
|
|
3406
|
+
value: function () {
|
|
3407
|
+
var _updateOrderProductQuantity = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38(params) {
|
|
3408
|
+
var products;
|
|
3409
|
+
return _regeneratorRuntime().wrap(function _callee38$(_context38) {
|
|
3410
|
+
while (1) switch (_context38.prev = _context38.next) {
|
|
3411
|
+
case 0:
|
|
3412
|
+
_context38.prev = 0;
|
|
3413
|
+
if (this.store.order) {
|
|
3414
|
+
_context38.next = 3;
|
|
3415
|
+
break;
|
|
3416
|
+
}
|
|
3417
|
+
throw new Error('order 模块未初始化');
|
|
3418
|
+
case 3:
|
|
3419
|
+
_context38.next = 5;
|
|
3420
|
+
return this.store.order.updateOrderProductQuantity(params);
|
|
3421
|
+
case 5:
|
|
3422
|
+
products = _context38.sent;
|
|
3423
|
+
return _context38.abrupt("return", products);
|
|
3424
|
+
case 9:
|
|
3425
|
+
_context38.prev = 9;
|
|
3426
|
+
_context38.t0 = _context38["catch"](0);
|
|
3427
|
+
throw _context38.t0;
|
|
3428
|
+
case 12:
|
|
3429
|
+
case "end":
|
|
3430
|
+
return _context38.stop();
|
|
3431
|
+
}
|
|
3432
|
+
}, _callee38, this, [[0, 9]]);
|
|
3433
|
+
}));
|
|
3434
|
+
function updateOrderProductQuantity(_x32) {
|
|
3371
3435
|
return _updateOrderProductQuantity.apply(this, arguments);
|
|
3372
3436
|
}
|
|
3373
3437
|
return updateOrderProductQuantity;
|
|
@@ -3390,12 +3454,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3390
3454
|
}, {
|
|
3391
3455
|
key: "setOrderProductLineNote",
|
|
3392
3456
|
value: (function () {
|
|
3393
|
-
var _setOrderProductLineNote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3457
|
+
var _setOrderProductLineNote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39(identity, note) {
|
|
3394
3458
|
var params, products;
|
|
3395
|
-
return _regeneratorRuntime().wrap(function
|
|
3396
|
-
while (1) switch (
|
|
3459
|
+
return _regeneratorRuntime().wrap(function _callee39$(_context39) {
|
|
3460
|
+
while (1) switch (_context39.prev = _context39.next) {
|
|
3397
3461
|
case 0:
|
|
3398
|
-
|
|
3462
|
+
_context39.prev = 0;
|
|
3399
3463
|
params = {
|
|
3400
3464
|
product_id: identity.product_id,
|
|
3401
3465
|
product_variant_id: identity.product_variant_id,
|
|
@@ -3410,22 +3474,22 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3410
3474
|
params.product_sku = identity.product_sku;
|
|
3411
3475
|
}
|
|
3412
3476
|
if (identity.product_bundle !== undefined) params.product_bundle = identity.product_bundle;
|
|
3413
|
-
|
|
3477
|
+
_context39.next = 7;
|
|
3414
3478
|
return this.updateOrderProduct(params);
|
|
3415
3479
|
case 7:
|
|
3416
|
-
products =
|
|
3417
|
-
return
|
|
3480
|
+
products = _context39.sent;
|
|
3481
|
+
return _context39.abrupt("return", products);
|
|
3418
3482
|
case 11:
|
|
3419
|
-
|
|
3420
|
-
|
|
3421
|
-
throw
|
|
3483
|
+
_context39.prev = 11;
|
|
3484
|
+
_context39.t0 = _context39["catch"](0);
|
|
3485
|
+
throw _context39.t0;
|
|
3422
3486
|
case 14:
|
|
3423
3487
|
case "end":
|
|
3424
|
-
return
|
|
3488
|
+
return _context39.stop();
|
|
3425
3489
|
}
|
|
3426
|
-
},
|
|
3490
|
+
}, _callee39, this, [[0, 11]]);
|
|
3427
3491
|
}));
|
|
3428
|
-
function setOrderProductLineNote(
|
|
3492
|
+
function setOrderProductLineNote(_x33, _x34) {
|
|
3429
3493
|
return _setOrderProductLineNote.apply(this, arguments);
|
|
3430
3494
|
}
|
|
3431
3495
|
return setOrderProductLineNote;
|
|
@@ -3440,32 +3504,32 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3440
3504
|
}, {
|
|
3441
3505
|
key: "removeProductsFromOrder",
|
|
3442
3506
|
value: (function () {
|
|
3443
|
-
var _removeProductsFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3444
|
-
return _regeneratorRuntime().wrap(function
|
|
3445
|
-
while (1) switch (
|
|
3507
|
+
var _removeProductsFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40(identities) {
|
|
3508
|
+
return _regeneratorRuntime().wrap(function _callee40$(_context40) {
|
|
3509
|
+
while (1) switch (_context40.prev = _context40.next) {
|
|
3446
3510
|
case 0:
|
|
3447
|
-
|
|
3511
|
+
_context40.prev = 0;
|
|
3448
3512
|
if (this.store.order) {
|
|
3449
|
-
|
|
3513
|
+
_context40.next = 3;
|
|
3450
3514
|
break;
|
|
3451
3515
|
}
|
|
3452
3516
|
throw new Error('order 模块未初始化');
|
|
3453
3517
|
case 3:
|
|
3454
|
-
|
|
3518
|
+
_context40.next = 5;
|
|
3455
3519
|
return this.store.order.removeProductsFromOrder(identities);
|
|
3456
3520
|
case 5:
|
|
3457
|
-
return
|
|
3521
|
+
return _context40.abrupt("return", _context40.sent);
|
|
3458
3522
|
case 8:
|
|
3459
|
-
|
|
3460
|
-
|
|
3461
|
-
throw
|
|
3523
|
+
_context40.prev = 8;
|
|
3524
|
+
_context40.t0 = _context40["catch"](0);
|
|
3525
|
+
throw _context40.t0;
|
|
3462
3526
|
case 11:
|
|
3463
3527
|
case "end":
|
|
3464
|
-
return
|
|
3528
|
+
return _context40.stop();
|
|
3465
3529
|
}
|
|
3466
|
-
},
|
|
3530
|
+
}, _callee40, this, [[0, 8]]);
|
|
3467
3531
|
}));
|
|
3468
|
-
function removeProductsFromOrder(
|
|
3532
|
+
function removeProductsFromOrder(_x35) {
|
|
3469
3533
|
return _removeProductsFromOrder.apply(this, arguments);
|
|
3470
3534
|
}
|
|
3471
3535
|
return removeProductsFromOrder;
|
|
@@ -3473,18 +3537,18 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3473
3537
|
}, {
|
|
3474
3538
|
key: "removeProductFromOrder",
|
|
3475
3539
|
value: function () {
|
|
3476
|
-
var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3477
|
-
return _regeneratorRuntime().wrap(function
|
|
3478
|
-
while (1) switch (
|
|
3540
|
+
var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41(identity) {
|
|
3541
|
+
return _regeneratorRuntime().wrap(function _callee41$(_context41) {
|
|
3542
|
+
while (1) switch (_context41.prev = _context41.next) {
|
|
3479
3543
|
case 0:
|
|
3480
|
-
return
|
|
3544
|
+
return _context41.abrupt("return", this.removeProductsFromOrder([identity]));
|
|
3481
3545
|
case 1:
|
|
3482
3546
|
case "end":
|
|
3483
|
-
return
|
|
3547
|
+
return _context41.stop();
|
|
3484
3548
|
}
|
|
3485
|
-
},
|
|
3549
|
+
}, _callee41, this);
|
|
3486
3550
|
}));
|
|
3487
|
-
function removeProductFromOrder(
|
|
3551
|
+
function removeProductFromOrder(_x36) {
|
|
3488
3552
|
return _removeProductFromOrder.apply(this, arguments);
|
|
3489
3553
|
}
|
|
3490
3554
|
return removeProductFromOrder;
|
|
@@ -3534,23 +3598,23 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3534
3598
|
}, {
|
|
3535
3599
|
key: "applyPromotion",
|
|
3536
3600
|
value: (function () {
|
|
3537
|
-
var _applyPromotion = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3538
|
-
return _regeneratorRuntime().wrap(function
|
|
3539
|
-
while (1) switch (
|
|
3601
|
+
var _applyPromotion = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42() {
|
|
3602
|
+
return _regeneratorRuntime().wrap(function _callee42$(_context42) {
|
|
3603
|
+
while (1) switch (_context42.prev = _context42.next) {
|
|
3540
3604
|
case 0:
|
|
3541
3605
|
if (this.store.order) {
|
|
3542
|
-
|
|
3606
|
+
_context42.next = 2;
|
|
3543
3607
|
break;
|
|
3544
3608
|
}
|
|
3545
3609
|
throw new Error('order 模块未初始化');
|
|
3546
3610
|
case 2:
|
|
3547
|
-
|
|
3611
|
+
_context42.next = 4;
|
|
3548
3612
|
return this.store.order.applyPromotion();
|
|
3549
3613
|
case 4:
|
|
3550
3614
|
case "end":
|
|
3551
|
-
return
|
|
3615
|
+
return _context42.stop();
|
|
3552
3616
|
}
|
|
3553
|
-
},
|
|
3617
|
+
}, _callee42, this);
|
|
3554
3618
|
}));
|
|
3555
3619
|
function applyPromotion() {
|
|
3556
3620
|
return _applyPromotion.apply(this, arguments);
|
|
@@ -3577,18 +3641,18 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3577
3641
|
}, {
|
|
3578
3642
|
key: "getProductList",
|
|
3579
3643
|
value: function () {
|
|
3580
|
-
var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3644
|
+
var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43() {
|
|
3581
3645
|
var _this$otherParams21;
|
|
3582
3646
|
var menu_list_ids, _this$store$products, res;
|
|
3583
|
-
return _regeneratorRuntime().wrap(function
|
|
3584
|
-
while (1) switch (
|
|
3647
|
+
return _regeneratorRuntime().wrap(function _callee43$(_context43) {
|
|
3648
|
+
while (1) switch (_context43.prev = _context43.next) {
|
|
3585
3649
|
case 0:
|
|
3586
3650
|
// 可以直接通过配置里的 menu 读取
|
|
3587
3651
|
menu_list_ids = ((_this$otherParams21 = this.otherParams) === null || _this$otherParams21 === void 0 || (_this$otherParams21 = _this$otherParams21.dineInConfig) === null || _this$otherParams21 === void 0 ? void 0 : _this$otherParams21['menu.associated_menus'].map(function (n) {
|
|
3588
3652
|
return Number(n.value);
|
|
3589
3653
|
})) || [];
|
|
3590
|
-
|
|
3591
|
-
|
|
3654
|
+
_context43.prev = 1;
|
|
3655
|
+
_context43.next = 4;
|
|
3592
3656
|
return (_this$store$products = this.store.products) === null || _this$store$products === void 0 ? void 0 : _this$store$products.loadProducts({
|
|
3593
3657
|
menu_list_ids: menu_list_ids,
|
|
3594
3658
|
cacheId: this.cacheId,
|
|
@@ -3596,17 +3660,17 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3596
3660
|
schedule_datetime: dayjs().format('YYYY-MM-DD HH:mm:ss')
|
|
3597
3661
|
});
|
|
3598
3662
|
case 4:
|
|
3599
|
-
res =
|
|
3600
|
-
return
|
|
3663
|
+
res = _context43.sent;
|
|
3664
|
+
return _context43.abrupt("return", res);
|
|
3601
3665
|
case 8:
|
|
3602
|
-
|
|
3603
|
-
|
|
3604
|
-
throw
|
|
3666
|
+
_context43.prev = 8;
|
|
3667
|
+
_context43.t0 = _context43["catch"](1);
|
|
3668
|
+
throw _context43.t0;
|
|
3605
3669
|
case 11:
|
|
3606
3670
|
case "end":
|
|
3607
|
-
return
|
|
3671
|
+
return _context43.stop();
|
|
3608
3672
|
}
|
|
3609
|
-
},
|
|
3673
|
+
}, _callee43, this, [[1, 8]]);
|
|
3610
3674
|
}));
|
|
3611
3675
|
function getProductList() {
|
|
3612
3676
|
return _getProductList.apply(this, arguments);
|
|
@@ -3621,33 +3685,33 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3621
3685
|
}, {
|
|
3622
3686
|
key: "setOtherParams",
|
|
3623
3687
|
value: function () {
|
|
3624
|
-
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3688
|
+
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44(params) {
|
|
3625
3689
|
var _this$otherParams22;
|
|
3626
3690
|
var _ref29,
|
|
3627
3691
|
_ref29$cover,
|
|
3628
3692
|
cover,
|
|
3629
|
-
|
|
3630
|
-
return _regeneratorRuntime().wrap(function
|
|
3631
|
-
while (1) switch (
|
|
3693
|
+
_args44 = arguments;
|
|
3694
|
+
return _regeneratorRuntime().wrap(function _callee44$(_context44) {
|
|
3695
|
+
while (1) switch (_context44.prev = _context44.next) {
|
|
3632
3696
|
case 0:
|
|
3633
|
-
_ref29 =
|
|
3697
|
+
_ref29 = _args44.length > 1 && _args44[1] !== undefined ? _args44[1] : {}, _ref29$cover = _ref29.cover, cover = _ref29$cover === void 0 ? false : _ref29$cover;
|
|
3634
3698
|
if (cover) {
|
|
3635
3699
|
this.otherParams = _objectSpread({}, params);
|
|
3636
3700
|
} else {
|
|
3637
3701
|
this.otherParams = _objectSpread(_objectSpread({}, this.otherParams), params);
|
|
3638
3702
|
}
|
|
3639
3703
|
this.cacheId = (_this$otherParams22 = this.otherParams) === null || _this$otherParams22 === void 0 ? void 0 : _this$otherParams22.cacheId;
|
|
3640
|
-
|
|
3704
|
+
_context44.next = 5;
|
|
3641
3705
|
return this.syncOtherParamsToSubModules(params, {
|
|
3642
3706
|
cover: cover
|
|
3643
3707
|
});
|
|
3644
3708
|
case 5:
|
|
3645
3709
|
case "end":
|
|
3646
|
-
return
|
|
3710
|
+
return _context44.stop();
|
|
3647
3711
|
}
|
|
3648
|
-
},
|
|
3712
|
+
}, _callee44, this);
|
|
3649
3713
|
}));
|
|
3650
|
-
function setOtherParams(
|
|
3714
|
+
function setOtherParams(_x37) {
|
|
3651
3715
|
return _setOtherParams.apply(this, arguments);
|
|
3652
3716
|
}
|
|
3653
3717
|
return setOtherParams;
|