diff --git a/src/services/OrderService.ts b/src/services/OrderService.ts index d0d577c0..0dde0eae 100644 --- a/src/services/OrderService.ts +++ b/src/services/OrderService.ts @@ -40,9 +40,9 @@ const getProductStoreSetting = async (payload: any): Promise => { }); } -const getRerouteOrderBrokeringHistory = async (payload: any): Promise => { +const getRerouteOrderFacilityChangeHistory = async (payload: any): Promise => { return api({ - url: "getRerouteOrderBrokeringHistory", + url: "getRerouteOrderFacilityChangeHistory", method: "post", data: payload }); @@ -58,7 +58,7 @@ const releaseRerouteOrderItem = async (payload: any): Promise => { export const OrderService = { getOrder, - getRerouteOrderBrokeringHistory, + getRerouteOrderFacilityChangeHistory, updateShippingAddress, updatePickupFacility, cancelOrderItem, diff --git a/src/views/Order.vue b/src/views/Order.vue index 31594135..6adccde2 100644 --- a/src/views/Order.vue +++ b/src/views/Order.vue @@ -346,16 +346,14 @@ export default defineComponent({ let originFacilityName = "", resp; try { - resp = await OrderService.getRerouteOrderBrokeringHistory({ "token": this.token }) + resp = await OrderService.getRerouteOrderFacilityChangeHistory({ "token": this.token, facilityId: "PICKUP_REJECTED" }) - if(!hasError(resp) && resp.data?.brokeringHistory.length) { - const oldestBrokeringHistory = resp.data.brokeringHistory.reduce((oldest: any, current: any) => { - return current.changeDatetime < oldest.changeDatetime ? current : oldest; - }); + if(!hasError(resp) && resp.data?.facilityChangeHistory?.length) { + const fromFacilityId = resp.data.facilityChangeHistory[0]?.fromFacilityId resp = await FacilityService.getStores({ "viewSize": process.env.VUE_APP_VIEW_SIZE, - "filters": [`storeCode: ${oldestBrokeringHistory.facilityId}`] + "filters": [`storeCode: ${fromFacilityId}`] }) if(!hasError(resp) && resp.data.response.numFound) {