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