fixes
This commit is contained in:
parent
8c3f940308
commit
e987740c1e
|
@ -1 +1 @@
|
|||
{"branch_name":"dev","last_commit_date":"2022-02-12T12:20:27.000Z","last_commit_author":"anjujangid","last_commit_hash":"a57b07eaa8b1f0f62e4854ee8176a6f7f88836e9"}
|
||||
{"branch_name":"dev","last_commit_date":"2022-02-14T10:30:18.000Z","last_commit_author":"anjujangid","last_commit_hash":"8c3f940308bc510defde9f95c815bd081f6b15b0"}
|
|
@ -17,6 +17,7 @@
|
|||
outlined
|
||||
hide-details
|
||||
v-model="orderNumber"
|
||||
dense
|
||||
></v-text-field>
|
||||
</v-col>
|
||||
<v-col cols="12" sm="12" md="6" lg="5">
|
||||
|
@ -36,6 +37,7 @@
|
|||
v-on="on"
|
||||
outlined
|
||||
hide-details
|
||||
dense
|
||||
></v-text-field>
|
||||
</template>
|
||||
<v-date-picker
|
||||
|
@ -65,6 +67,7 @@
|
|||
v-on="on"
|
||||
outlined
|
||||
hide-details
|
||||
dense
|
||||
></v-text-field>
|
||||
</template>
|
||||
<v-date-picker
|
||||
|
@ -102,12 +105,12 @@
|
|||
:class="hover ? 'white--text warning' : 'warning--text'"
|
||||
class="width-250px"
|
||||
outlined
|
||||
@click.prevent="searchOrder"
|
||||
@click.prevent="orderlistApi"
|
||||
>
|
||||
Search
|
||||
</v-btn>
|
||||
</v-hover>
|
||||
</v-col>-
|
||||
</v-col>
|
||||
<v-col cols="12" sm="12" md="6" lg="3">
|
||||
<v-hover v-slot:default="{ hover }">
|
||||
<router-link
|
||||
|
@ -144,10 +147,10 @@
|
|||
<span>{{ item.incrementId }}</span>
|
||||
</template>
|
||||
<template v-slot:item.retailername="{ item }">
|
||||
<span>{{ `-` }}</span>
|
||||
<span>{{ userInfo.firstname + '' + userInfo.lastname }}</span>
|
||||
</template>
|
||||
<template v-slot:item.salesrepname="{ item }">
|
||||
<span>{{ `-` }}</span>
|
||||
<span>{{ userInfo.firstname + '' + userInfo.lastname }}</span>
|
||||
</template>
|
||||
<template v-slot:item.status="{ item }">
|
||||
<span>{{ item.status }}</span>
|
||||
|
@ -178,6 +181,12 @@
|
|||
</template>
|
||||
<script>
|
||||
/* eslint-disable no-alert, no-console , no-debugger */
|
||||
import { createHelpers } from "vuex-map-fields";
|
||||
|
||||
const { mapFields } = createHelpers({
|
||||
getterType: "orderlist/getField",
|
||||
mutationType: "orderlist/updateField",
|
||||
});
|
||||
|
||||
export default {
|
||||
name: "BoxedOrderHistoryPage",
|
||||
|
@ -197,7 +206,6 @@ export default {
|
|||
{ text: "Action", value: "action" },
|
||||
|
||||
],
|
||||
orderNumber : ""
|
||||
}),
|
||||
computed: {
|
||||
createdDate() {
|
||||
|
@ -209,13 +217,15 @@ export default {
|
|||
OrderHistory() {
|
||||
return this.$store.state.orderlist.OrderHistory.items;
|
||||
},
|
||||
customerId() {
|
||||
userInfo() {
|
||||
return this.$store.state.accountOne.one;
|
||||
},
|
||||
|
||||
inProgress() {
|
||||
return this.$store.state.orderlist.inProgress;
|
||||
},
|
||||
...mapFields(["orderNumber"]),
|
||||
|
||||
},
|
||||
|
||||
methods: {
|
||||
|
@ -244,20 +254,20 @@ export default {
|
|||
this.$store.dispatch("orderlist/fetchSearchOrder");
|
||||
},
|
||||
reset(){
|
||||
this.$store.dispatch("orderlist/fetchReset");
|
||||
this.$store.dispatch("orderlist/fetchReset",this.userInfo.id);
|
||||
|
||||
},
|
||||
orderlistApi() {
|
||||
if(this.customerId && this.customerId.id)
|
||||
if(this.userInfo && this.userInfo.id)
|
||||
{
|
||||
|
||||
this.$store.dispatch("orderlist/fetchOrderList",this.customerId.id);
|
||||
this.$store.dispatch("orderlist/fetchOrderList",this.userInfo.id);
|
||||
}
|
||||
},
|
||||
},
|
||||
watch:
|
||||
{
|
||||
customerId()
|
||||
userInfo()
|
||||
{
|
||||
this.orderlistApi();
|
||||
}
|
||||
|
|
|
@ -676,7 +676,12 @@ export const doFetchProductTags = wrapRequest((sku) => {
|
|||
})
|
||||
|
||||
|
||||
export const doFetchOrderHistory = wrapRequest((customerId) => {
|
||||
export const doFetchOrderHistory = wrapRequest((obj) => {
|
||||
let query = "";
|
||||
query = `searchCriteria[pageSize]=5000&searchCriteria[currentPage]=1&searchCriteria[sortOrders][0][field]=created_at&searchCriteria[sortOrders][0][direction]=DESC&searchCriteria[filter_groups][0][filters][0][field]=customer_id&searchCriteria[filter_groups][0][filters][0][value]=${obj.customerId}&searchCriteria[filter_groups][0][filters][0][condition_type]=eq`;
|
||||
if(obj.incrementId){
|
||||
query = `&searchCriteria[filter_groups][1][filters][0][field]=increment_id&searchCriteria[filter_groups][1][filters][0][value]=${obj.incrementId}&searchCriteria[filter_groups][1][filters][0][condition_type]=eq`
|
||||
}
|
||||
const requestOptions = {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
|
@ -684,49 +689,5 @@ export const doFetchOrderHistory = wrapRequest((customerId) => {
|
|||
'Access-Control-Allow-Origin': '*',
|
||||
}
|
||||
};
|
||||
return fetch(`${vueAppMagenotApiUrl}/rest/crn_retailer/V1/crorders?searchCriteria[filter_groups][0][filters][0][field]=customer_id&searchCriteria[filter_groups][0][filters][0][value]=${customerId}&searchCriteria[filter_groups][0][filters][0][condition_type]=eq&searchCriteria[pageSize]=100&searchCriteria[currentPage]=1&searchCriteria[sortOrders][0][field]=created_at&searchCriteria[sortOrders][0][direction]=DESC`, requestOptions)
|
||||
});
|
||||
|
||||
|
||||
export const doFetchIncrementId = wrapRequest((customerId,incrementId) => {
|
||||
debugger
|
||||
const requestOptions = {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Content-type': 'application/json'
|
||||
},
|
||||
};
|
||||
|
||||
if(customerId){
|
||||
let query = "";
|
||||
query = `?
|
||||
searchCriteria[pageSize]=1000&searchCriteria[currentPage]=1
|
||||
&searchCriteria[filter_groups][1][filters][0][field]=customer_id
|
||||
&searchCriteria[filter_groups][1][filters][0][value]=${customerId}
|
||||
&searchCriteria[filter_groups][1][filters][0][condition_type]=eq`
|
||||
|
||||
console.log('CustomerId', `${vueAppMagenotApiUrl}/rest/crn_retailer/V1/crproducts/${query}`);
|
||||
return fetch(`${vueAppMagenotApiUrl}/rest/crn_retailer/V1/crproducts/${query}`, requestOptions)
|
||||
}
|
||||
if(incrementId){
|
||||
let query = "";
|
||||
query = `?
|
||||
searchCriteria[pageSize]=1000&searchCriteria[currentPage]=1
|
||||
&searchCriteria[filter_groups][1][filters][0][field]=increment_id
|
||||
&searchCriteria[filter_groups][1][filters][0][value]=${incrementId}
|
||||
&searchCriteria[filter_groups][1][filters][0][condition_type]=eq`
|
||||
|
||||
console.log('incrementId', `${vueAppMagenotApiUrl}/rest/crn_retailer/V1/crproducts/${query}`);
|
||||
return fetch(`${vueAppMagenotApiUrl}/rest/crn_retailer/V1/crproducts/${query}`, requestOptions)
|
||||
}
|
||||
if(incrementId && customerId){
|
||||
let query = "";
|
||||
query = `?searchCriteria[pageSize]=1000&searchCriteria[currentPage]=1&searchCriteria[filter_groups][1][filters][0][field]=increment_id&searchCriteria[filter_groups][0][filters][0][field]=customer_id&searchCriteria[filter_groups][0][filters][0][value]=${customerId}&searchCriteria[filter_groups][1][filters][0][value]=${incrementId}&searchCriteria[filter_groups][1][filters][0][condition_type]=eq`
|
||||
|
||||
console.log('incrementId & CustomerId', `${vueAppMagenotApiUrl}/rest/crn_retailer/V1/crproducts/${query}`);
|
||||
return fetch(`${vueAppMagenotApiUrl}/rest/crn_retailer/V1/crproducts/${query}`, requestOptions)
|
||||
}
|
||||
|
||||
|
||||
|
||||
return fetch(`${vueAppMagenotApiUrl}/rest/crn_retailer/V1/crorders?${query}`, requestOptions)
|
||||
});
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
/* eslint-disable no-alert, no-console , no-debugger */
|
||||
import { doFetchOrderHistory ,doFetchIncrementId} from '@/services/product.service';
|
||||
import { doFetchOrderHistory } from '@/services/product.service';
|
||||
import { getField, updateField } from 'vuex-map-fields';
|
||||
import humps from 'lodash-humps';
|
||||
|
||||
|
@ -11,7 +11,7 @@ export const orderlist = {
|
|||
OrderHistory: {},
|
||||
|
||||
customerId: "",
|
||||
incrementId: ""
|
||||
orderNumber: ""
|
||||
// createdDate: "",
|
||||
// toDate: "",
|
||||
// purchaseOrderNumber: "",
|
||||
|
@ -29,34 +29,13 @@ export const orderlist = {
|
|||
setOrderHistory(state, orderhistorydata) {
|
||||
state.OrderHistory = orderhistorydata
|
||||
},
|
||||
setSearchOrder(state, orderItem,customerId) {
|
||||
state.customerId=orderItem
|
||||
state.customerId=customerId
|
||||
|
||||
} ,
|
||||
// setReset(state,incrementId){
|
||||
// state.incrementId=incrementId
|
||||
|
||||
// }
|
||||
},
|
||||
|
||||
actions: {
|
||||
fetchSearchOrder:async ({ commit, state} ) => {
|
||||
debugger
|
||||
const filterOrderlist = await doFetchIncrementId( state.OrderHistory,state.incrementId)
|
||||
if(filterOrderlist){
|
||||
commit('setSearchOrder', humps(filterOrderlist));
|
||||
}
|
||||
},
|
||||
|
||||
// fetchReset({commit}){
|
||||
// commit('setReset');
|
||||
|
||||
// },
|
||||
fetchOrderList: async ({ commit },customerId) => {
|
||||
fetchOrderList: async ({state, commit },customerId) => {
|
||||
try {
|
||||
commit('inProgress', true);
|
||||
let OrderHistory = await doFetchOrderHistory(customerId);
|
||||
let OrderHistory = await doFetchOrderHistory({customerId:customerId,incrementId:state.orderNumber});
|
||||
if (OrderHistory) {
|
||||
commit('inProgress', false);
|
||||
commit('setOrderHistory', humps(OrderHistory));
|
||||
|
@ -67,8 +46,22 @@ export const orderlist = {
|
|||
throw error
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
fetchReset: async ({state,commit },customerId) => {
|
||||
try {
|
||||
state.orderNumber="";
|
||||
commit('inProgress', true);
|
||||
let orderHistory = await doFetchOrderHistory({customerId:customerId,incrementId:state.orderNumber});
|
||||
|
||||
if (orderHistory) {
|
||||
commit('inProgress', false);
|
||||
commit('setOrderHistory', humps(orderHistory));
|
||||
}
|
||||
}
|
||||
catch (error) {
|
||||
commit('inProgress', false);
|
||||
throw error
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue