@pisell/pisellos 0.0.123 → 0.0.124
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.
|
@@ -216,6 +216,7 @@ export var CartModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
216
216
|
}, {
|
|
217
217
|
key: "formatCartItem",
|
|
218
218
|
value: function formatCartItem(params) {
|
|
219
|
+
var _tempCartItem;
|
|
219
220
|
var _id = params._id,
|
|
220
221
|
cartItem = params.cartItem,
|
|
221
222
|
account = params.account,
|
|
@@ -226,11 +227,15 @@ export var CartModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
226
227
|
resources = params.resources,
|
|
227
228
|
note = params.note,
|
|
228
229
|
date = params.date,
|
|
229
|
-
relationForms = params.relationForms
|
|
230
|
-
|
|
230
|
+
relationForms = params.relationForms;
|
|
231
|
+
var quantity = params.quantity;
|
|
231
232
|
var tempCartItem = this.store.list.find(function (i) {
|
|
232
233
|
return i._id === _id;
|
|
233
234
|
});
|
|
235
|
+
if (!quantity && (_tempCartItem = tempCartItem) !== null && _tempCartItem !== void 0 && _tempCartItem.num) {
|
|
236
|
+
var _tempCartItem2;
|
|
237
|
+
quantity = ((_tempCartItem2 = tempCartItem) === null || _tempCartItem2 === void 0 ? void 0 : _tempCartItem2.num) || 1;
|
|
238
|
+
}
|
|
234
239
|
if (!tempCartItem) {
|
|
235
240
|
throw new Error('[CartModule] 格式化数据到购物车失败,商品不存在');
|
|
236
241
|
}
|
|
@@ -133,10 +133,13 @@ var CartModule = class extends import_BaseModule.BaseModule {
|
|
|
133
133
|
resources,
|
|
134
134
|
note,
|
|
135
135
|
date,
|
|
136
|
-
relationForms
|
|
137
|
-
quantity
|
|
136
|
+
relationForms
|
|
138
137
|
} = params;
|
|
138
|
+
let quantity = params.quantity;
|
|
139
139
|
let tempCartItem = this.store.list.find((i) => i._id === _id);
|
|
140
|
+
if (!quantity && (tempCartItem == null ? void 0 : tempCartItem.num)) {
|
|
141
|
+
quantity = (tempCartItem == null ? void 0 : tempCartItem.num) || 1;
|
|
142
|
+
}
|
|
140
143
|
if (!tempCartItem) {
|
|
141
144
|
throw new Error("[CartModule] 格式化数据到购物车失败,商品不存在");
|
|
142
145
|
}
|