@pisell/pisellos 0.0.36 → 0.0.37
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/Cart/utils.js +21 -13
- package/lib/modules/Cart/utils.js +22 -14
- package/package.json +1 -1
|
@@ -226,20 +226,28 @@ export var formatResourceToCartItemOrigin = function formatResourceToCartItemOri
|
|
|
226
226
|
if (resources && resources !== null && resources !== void 0 && resources.length) {
|
|
227
227
|
origin.resources = [];
|
|
228
228
|
// 接口只需要部分字段,需要处理
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
229
|
+
var checkResourcesFormat = function checkResourcesFormat(resources, arr) {
|
|
230
|
+
resources.forEach(function (resource) {
|
|
231
|
+
var _resource$children;
|
|
232
|
+
var childArr = [];
|
|
233
|
+
if (resource !== null && resource !== void 0 && (_resource$children = resource.children) !== null && _resource$children !== void 0 && _resource$children.length) {
|
|
234
|
+
checkResourcesFormat(resource.children, childArr);
|
|
235
|
+
}
|
|
236
|
+
arr.push({
|
|
237
|
+
relation_type: "form",
|
|
238
|
+
like_status: "common",
|
|
239
|
+
id: resource.id,
|
|
240
|
+
main_field: resource.main_field,
|
|
241
|
+
resourceType: resource.resourceType,
|
|
242
|
+
form_id: resource.form_id,
|
|
243
|
+
relation_id: resource.id,
|
|
244
|
+
capacity: (resource === null || resource === void 0 ? void 0 : resource.capacity) || 0,
|
|
245
|
+
children: childArr,
|
|
246
|
+
metadata: (resource === null || resource === void 0 ? void 0 : resource.metadata) || {} // 后端可以在这里挂一个前端用于计算的数据
|
|
247
|
+
});
|
|
241
248
|
});
|
|
242
|
-
}
|
|
249
|
+
};
|
|
250
|
+
checkResourcesFormat(resources, origin.resources);
|
|
243
251
|
var _resources$ = resources[0],
|
|
244
252
|
startTime = _resources$.startTime,
|
|
245
253
|
endTime = _resources$.endTime;
|
|
@@ -213,21 +213,29 @@ var formatResourceToCartItemOrigin = (params) => {
|
|
|
213
213
|
let origin = cartItem._origin;
|
|
214
214
|
if (resources && (resources == null ? void 0 : resources.length)) {
|
|
215
215
|
origin.resources = [];
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
216
|
+
const checkResourcesFormat = (resources2, arr) => {
|
|
217
|
+
resources2.forEach((resource) => {
|
|
218
|
+
var _a;
|
|
219
|
+
const childArr = [];
|
|
220
|
+
if ((_a = resource == null ? void 0 : resource.children) == null ? void 0 : _a.length) {
|
|
221
|
+
checkResourcesFormat(resource.children, childArr);
|
|
222
|
+
}
|
|
223
|
+
arr.push({
|
|
224
|
+
relation_type: "form",
|
|
225
|
+
like_status: "common",
|
|
226
|
+
id: resource.id,
|
|
227
|
+
main_field: resource.main_field,
|
|
228
|
+
resourceType: resource.resourceType,
|
|
229
|
+
form_id: resource.form_id,
|
|
230
|
+
relation_id: resource.id,
|
|
231
|
+
capacity: (resource == null ? void 0 : resource.capacity) || 0,
|
|
232
|
+
children: childArr,
|
|
233
|
+
metadata: (resource == null ? void 0 : resource.metadata) || {}
|
|
234
|
+
// 后端可以在这里挂一个前端用于计算的数据
|
|
235
|
+
});
|
|
229
236
|
});
|
|
230
|
-
}
|
|
237
|
+
};
|
|
238
|
+
checkResourcesFormat(resources, origin.resources);
|
|
231
239
|
const { startTime, endTime } = resources[0];
|
|
232
240
|
if (startTime && endTime) {
|
|
233
241
|
origin.select_date = (0, import_dayjs.default)(startTime).format("YYYY-MM-DD");
|