orderiom-api-package 0.3.7 → 0.3.9
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 +13 -12
- package/src/modules/order.js +1 -0
- package/src/modules/product.js +2 -0
package/package.json
CHANGED
package/src/common.js
CHANGED
|
@@ -40,21 +40,22 @@ export function calculateBasketIdParameter(isLogin, restaurantId) {
|
|
|
40
40
|
|
|
41
41
|
export function updateBasket({commit, basketId, res, isOutsideProduct, restaurantId}){
|
|
42
42
|
const basketInfo = res.data.data;
|
|
43
|
-
|
|
43
|
+
const scope = isOutsideProduct ? 'product/' : '';
|
|
44
|
+
commit(`${scope}setBasketInfo`, basketInfo);
|
|
44
45
|
|
|
45
46
|
// TODO: why two separate states use same value?
|
|
46
|
-
commit(`${
|
|
47
|
-
commit(`${
|
|
47
|
+
commit(`${scope}SetSubtotalPrice`, basketInfo.totalPrice);
|
|
48
|
+
commit(`${scope}SetTotalPrice`, basketInfo.totalPrice);
|
|
48
49
|
|
|
49
|
-
commit(`${
|
|
50
|
-
commit(`${
|
|
51
|
-
commit(`${
|
|
52
|
-
commit(`${
|
|
53
|
-
commit(`${
|
|
54
|
-
commit(`${
|
|
55
|
-
commit(`${
|
|
56
|
-
commit(`${
|
|
57
|
-
commit(`${
|
|
50
|
+
commit(`${scope}SetShoppingCart`, basketInfo.products);
|
|
51
|
+
commit(`${scope}setDeliveryTime`, basketInfo.deliveryTime);
|
|
52
|
+
commit(`${scope}setVoucherCode`, basketInfo.voucher_code);
|
|
53
|
+
commit(`${scope}setVoucherValue`, basketInfo.voucherValue);
|
|
54
|
+
commit(`${scope}setTotalWithDiscount`, basketInfo.totalWithDiscount);
|
|
55
|
+
commit(`${scope}setDelivertType`, basketInfo.deliveryType);
|
|
56
|
+
commit(`${scope}setPostalCode`, basketInfo.postalCode);
|
|
57
|
+
commit(`${scope}setTip`, basketInfo.tip);
|
|
58
|
+
commit(`${scope}setshippingPrice`, basketInfo.shipping_price);
|
|
58
59
|
|
|
59
60
|
if (parseInt(basketInfo.id) !== parseInt(basketId)) {
|
|
60
61
|
const baskets = JSON.parse(localStorage.getItem('basket'));
|
package/src/modules/order.js
CHANGED
|
@@ -716,6 +716,7 @@ const actions = {
|
|
|
716
716
|
|
|
717
717
|
return axios.post('api/basket/update-extraInfo', {
|
|
718
718
|
basketId,
|
|
719
|
+
restaurantId: data.restaurantId || restaurantIdEnv,
|
|
719
720
|
...data
|
|
720
721
|
}).then(res =>
|
|
721
722
|
updateBasket({commit, basketId, res, isOutsideProduct: true, restaurantId: data.restaurantId})
|
package/src/modules/product.js
CHANGED
|
@@ -258,6 +258,8 @@ const actions = {
|
|
|
258
258
|
);
|
|
259
259
|
},
|
|
260
260
|
getBasket({ commit, rootState }, data) {
|
|
261
|
+
if(typeof data === 'string' || typeof data === 'number') data = {restaurantId: data};
|
|
262
|
+
|
|
261
263
|
let basketId = undefined;
|
|
262
264
|
try{
|
|
263
265
|
basketId = calculateBasketIdParameter(!!rootState.orderiomApiPackage.auth.privateToken, data ? data.restaurantId : undefined);
|