orderiom-api-package 0.3.9 → 0.3.11
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/package.json +1 -1
- package/src/common.js +14 -15
- package/src/modules/order.js +2 -2
- package/src/modules/product.js +1 -1
package/package.json
CHANGED
package/src/common.js
CHANGED
|
@@ -38,24 +38,23 @@ export function calculateBasketIdParameter(isLogin, restaurantId) {
|
|
|
38
38
|
return foundBasket.basketId;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
export function updateBasket({commit, basketId, res,
|
|
41
|
+
export function updateBasket({commit, basketId, res, restaurantId}){
|
|
42
42
|
const basketInfo = res.data.data;
|
|
43
|
-
|
|
44
|
-
commit(`${scope}setBasketInfo`, basketInfo);
|
|
43
|
+
commit(`product/setBasketInfo`, basketInfo, { root: true });
|
|
45
44
|
|
|
46
45
|
// TODO: why two separate states use same value?
|
|
47
|
-
commit(
|
|
48
|
-
commit(
|
|
46
|
+
commit(`product/SetSubtotalPrice`, basketInfo.totalPrice, { root: true });
|
|
47
|
+
commit(`product/SetTotalPrice`, basketInfo.totalPrice, { root: true });
|
|
49
48
|
|
|
50
|
-
commit(
|
|
51
|
-
commit(
|
|
52
|
-
commit(
|
|
53
|
-
commit(
|
|
54
|
-
commit(
|
|
55
|
-
commit(
|
|
56
|
-
commit(
|
|
57
|
-
commit(
|
|
58
|
-
commit(
|
|
49
|
+
commit(`product/SetShoppingCart`, basketInfo.products, { root: true });
|
|
50
|
+
commit(`product/setDeliveryTime`, basketInfo.deliveryTime, { root: true });
|
|
51
|
+
commit(`product/setVoucherCode`, basketInfo.voucher_code, { root: true });
|
|
52
|
+
commit(`product/setVoucherValue`, basketInfo.voucherValue, { root: true });
|
|
53
|
+
commit(`product/setTotalWithDiscount`, basketInfo.totalWithDiscount, { root: true });
|
|
54
|
+
commit(`product/setDelivertType`, basketInfo.deliveryType, { root: true });
|
|
55
|
+
commit(`product/setPostalCode`, basketInfo.postalCode, { root: true });
|
|
56
|
+
commit(`product/setTip`, basketInfo.tip, { root: true });
|
|
57
|
+
commit(`product/setshippingPrice`, basketInfo.shipping_price, { root: true });
|
|
59
58
|
|
|
60
59
|
if (parseInt(basketInfo.id) !== parseInt(basketId)) {
|
|
61
60
|
const baskets = JSON.parse(localStorage.getItem('basket'));
|
|
@@ -68,6 +67,6 @@ export function updateBasket({commit, basketId, res, isOutsideProduct, restauran
|
|
|
68
67
|
localStorage.setItem('basket', JSON.stringify(baskets));
|
|
69
68
|
}
|
|
70
69
|
|
|
71
|
-
commit(
|
|
70
|
+
commit(`product/basketLoadedOnce`, null, { root: true });
|
|
72
71
|
return true;
|
|
73
72
|
}
|
package/src/modules/order.js
CHANGED
|
@@ -581,7 +581,7 @@ const actions = {
|
|
|
581
581
|
return axios
|
|
582
582
|
.post("api/basket/add-delivery-time", {
|
|
583
583
|
...basketId,
|
|
584
|
-
delivery_time: data.date + " " + data.time,
|
|
584
|
+
delivery_time: data.date && data.time ? data.date + " " + data.time : null,
|
|
585
585
|
restaurantId: data.restaurantId,
|
|
586
586
|
deliveryType: data.deliveryType
|
|
587
587
|
|
|
@@ -719,7 +719,7 @@ const actions = {
|
|
|
719
719
|
restaurantId: data.restaurantId || restaurantIdEnv,
|
|
720
720
|
...data
|
|
721
721
|
}).then(res =>
|
|
722
|
-
updateBasket({commit, basketId, res,
|
|
722
|
+
updateBasket({commit, basketId, res, restaurantId: data.restaurantId})
|
|
723
723
|
).catch(err => {
|
|
724
724
|
console.error(err);
|
|
725
725
|
return false;
|
package/src/modules/product.js
CHANGED
|
@@ -275,7 +275,7 @@ const actions = {
|
|
|
275
275
|
restaurantId: restaurantIdEnv
|
|
276
276
|
}
|
|
277
277
|
}).then(res =>
|
|
278
|
-
updateBasket({commit, basketId, res,
|
|
278
|
+
updateBasket({commit, basketId, res, restaurantId: data ? data.restaurantId : undefined})
|
|
279
279
|
).catch(error => {
|
|
280
280
|
console.error(error);
|
|
281
281
|
return false;
|