orderiom-api-package 0.3.41 → 0.3.42
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/modules/order.js +70 -2
package/package.json
CHANGED
package/src/modules/order.js
CHANGED
|
@@ -10,7 +10,9 @@ const state = () => ({
|
|
|
10
10
|
shippingPrice: null,
|
|
11
11
|
totalPrice: null,
|
|
12
12
|
orderList: [],
|
|
13
|
-
tableOrder: {}
|
|
13
|
+
tableOrder: {},
|
|
14
|
+
externalTableOrders: [],
|
|
15
|
+
tablePaymentStatus: null
|
|
14
16
|
|
|
15
17
|
});
|
|
16
18
|
const mutations = {
|
|
@@ -43,6 +45,12 @@ const mutations = {
|
|
|
43
45
|
},
|
|
44
46
|
setTableOrder(state, tableOrder) {
|
|
45
47
|
state.tableOrder = tableOrder
|
|
48
|
+
},
|
|
49
|
+
setExternalTableOrders(state , orders){
|
|
50
|
+
state.externalTableOrders = orders
|
|
51
|
+
},
|
|
52
|
+
setTablePaymentStatus(state, paymentStatus){
|
|
53
|
+
state.tablePaymentStatus = paymentStatus
|
|
46
54
|
}
|
|
47
55
|
|
|
48
56
|
}
|
|
@@ -753,7 +761,67 @@ const actions = {
|
|
|
753
761
|
console.error(err);
|
|
754
762
|
return false;
|
|
755
763
|
});
|
|
756
|
-
}
|
|
764
|
+
},
|
|
765
|
+
getTableExternalOrder({commit }, { restaurantId, tableName }) {
|
|
766
|
+
console.log("getTableExternalOrder");
|
|
767
|
+
$http
|
|
768
|
+
.post("api/table-payments/create", {
|
|
769
|
+
restaurantId,
|
|
770
|
+
tableName,
|
|
771
|
+
})
|
|
772
|
+
.then((res) => {
|
|
773
|
+
commit("setExternalTableOrders", res.data.data);
|
|
774
|
+
})
|
|
775
|
+
.catch(commonErrorCallback());
|
|
776
|
+
},
|
|
777
|
+
payTableExternalOrder({ rootState},{ tablePaymentId, paymentType, qrcode = null, pin = null }
|
|
778
|
+
) {
|
|
779
|
+
$http
|
|
780
|
+
.post("/api/table-payments/pay", {
|
|
781
|
+
tablePaymentId,
|
|
782
|
+
paymentType,
|
|
783
|
+
...(paymentType === "payFix" && {
|
|
784
|
+
qrCode: qrcode,
|
|
785
|
+
pin: pin,
|
|
786
|
+
}),
|
|
787
|
+
})
|
|
788
|
+
.then((res) => {
|
|
789
|
+
console.log(res);
|
|
790
|
+
window.location = res.data.data.paymentLink;
|
|
791
|
+
return {
|
|
792
|
+
type: "success",
|
|
793
|
+
msg: "ok",
|
|
794
|
+
};
|
|
795
|
+
})
|
|
796
|
+
.catch(commonErrorCallback());
|
|
797
|
+
},
|
|
798
|
+
updateTablePaymentStatus({ commit }, data) {
|
|
799
|
+
return $http
|
|
800
|
+
.get(`/api/table-payments/update`, {
|
|
801
|
+
params: { paymentId: data.paymentId, status: data.status },
|
|
802
|
+
})
|
|
803
|
+
.then((res) => {
|
|
804
|
+
const status = res.data.data.status;
|
|
805
|
+
commit("setTablePaymentStatus", status);
|
|
806
|
+
return {
|
|
807
|
+
type: "success",
|
|
808
|
+
msg: "ok",
|
|
809
|
+
};
|
|
810
|
+
})
|
|
811
|
+
.catch(commonErrorCallback());
|
|
812
|
+
},
|
|
813
|
+
getExternalTableOrdersFromPayment({commit }, { tablePaymentId }) {
|
|
814
|
+
return $http
|
|
815
|
+
.get(`/api/table-payments`, { params: { tablePaymentId } })
|
|
816
|
+
.then((res) => {
|
|
817
|
+
commit("setExternalTableOrders", res.data.data);
|
|
818
|
+
return {
|
|
819
|
+
type: "success",
|
|
820
|
+
msg: "ok",
|
|
821
|
+
};
|
|
822
|
+
})
|
|
823
|
+
.catch(commonErrorCallback());
|
|
824
|
+
},
|
|
757
825
|
}
|
|
758
826
|
export default {
|
|
759
827
|
namespaced: true,
|