|
|
import { get, find } from 'lodash';
|
|
|
|
|
|
export const Types = {
|
|
|
FETCH_ORDER_DETAIL_REQUEST: 'FETCH_ORDER_DETAIL_REQUEST',
|
|
|
FETCH_ORDER_DETAIL_FAIL: 'FETCH_ORDER_DETAIL_FAIL',
|
|
|
FETCH_ORDER_DETAIL_SUCCESS: 'FETCH_ORDER_DETAIL_SUCCESS'
|
|
|
FETCH_ORDER_DETAIL_SUCCESS: 'FETCH_ORDER_DETAIL_SUCCESS',
|
|
|
FETCH_ORDER_ADDRESS: 'FETCH_ORDER_ADDRESS'
|
|
|
};
|
|
|
|
|
|
export default function() {
|
...
|
...
|
@@ -9,7 +12,9 @@ export default function() { |
|
|
namespaced: true,
|
|
|
state: {
|
|
|
orderDetail: {},
|
|
|
fetchOrderDetail: false
|
|
|
fetchOrderDetail: false,
|
|
|
detail: {},
|
|
|
address: {}
|
|
|
},
|
|
|
mutations: {
|
|
|
[Types.FETCH_ORDER_DETAIL_REQUEST](state) {
|
...
|
...
|
@@ -21,6 +26,9 @@ export default function() { |
|
|
},
|
|
|
[Types.FETCH_ORDER_DETAIL_FAIL](state) {
|
|
|
state.fetchOrderDetail = false;
|
|
|
},
|
|
|
[Types.FETCH_ORDER_ADDRESS](state, data) {
|
|
|
state.address = data;
|
|
|
}
|
|
|
},
|
|
|
actions: {
|
...
|
...
|
@@ -38,7 +46,23 @@ export default function() { |
|
|
}
|
|
|
|
|
|
commit(Types.FETCH_ORDER_DETAIL_SUCCESS, result.data);
|
|
|
},
|
|
|
async fetchOrderAddress({ commit }, payload) {
|
|
|
const orderCount = await this.$api.get('/api/order/confirm/count', payload);
|
|
|
|
|
|
if (get(orderCount, 'data.cnt', 0)) {
|
|
|
const addressInfo = await this.$api.get('/api/order/confirm/address');
|
|
|
|
|
|
const address = find(get(addressInfo, 'data', []), { is_default: 'Y' });
|
|
|
|
|
|
commit(Types.FETCH_ORDER_ADDRESS, address);
|
|
|
}
|
|
|
},
|
|
|
|
|
|
async fetchOrderPrice({ commit }, payload) {
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
getters: {},
|
|
|
};
|
...
|
...
|
|