diff --git a/src/views/sales/order/index.vue b/src/views/sales/order/index.vue index b41a8f8..f4f25da 100644 --- a/src/views/sales/order/index.vue +++ b/src/views/sales/order/index.vue @@ -90,33 +90,6 @@ endTime: null, }, }); - watch( - () => route.query.id, - (value) => { - state.condition.userId = value; - }, - { immediate: true, deep: true } - ); - watch( - () => state.condition, - (value) => { - store.commit('order/setCondition', _.cloneDeep(value)); - }, - { immediate: true, deep: true } - ); - watch( - () => state.condition.orderStatus, - () => { - handleSearch(); - }, - { deep: true } - ); - watch( - () => state.condition.userId, - () => { - handleSearch(); - } - ); const handleReset = () => { state.condition = { userId: null, @@ -154,6 +127,33 @@ await store.dispatch('order/search'); loading.value = false; }; + watch( + () => route.query.id, + (value) => { + state.condition.userId = value; + }, + { immediate: true, deep: true } + ); + watch( + () => state.condition, + (value) => { + store.commit('order/setCondition', _.cloneDeep(value)); + }, + { immediate: true, deep: true } + ); + watch( + () => state.condition.orderStatus, + () => { + handleSearch(); + }, + { deep: true } + ); + watch( + () => state.condition.userId, + () => { + handleSearch(); + } + ); onActivated(() => { if (route.query.status) { state.condition.orderStatus = route.query.status.split(',').map((item) => +item); diff --git a/src/views/system/customer/index.vue b/src/views/system/customer/index.vue index e59e3d1..29f3e5e 100644 --- a/src/views/system/customer/index.vue +++ b/src/views/system/customer/index.vue @@ -52,13 +52,6 @@ dateRange: [], }, }); - watch( - () => state.condition, - (value) => { - store.commit('customer/setCondition', _.cloneDeep(value)); - }, - { immediate: true, deep: true } - ); const handleReset = () => { state.condition = { phone: null, @@ -67,14 +60,26 @@ }; }; const handleSearch = async () => { - if (route.query.phone && !state.condition.phone) { - state.condition.phone = route.query.phone; - store.commit('customer/setCondition', _.cloneDeep(state.condition)); - } loading.value = true; await store.dispatch('customer/search'); loading.value = false; }; + watch( + () => route.query.phone, + (value) => { + state.condition.phone = value; + store.commit('customer/setCondition', _.cloneDeep(state.condition)); + handleSearch(); + }, + { immediate: true } + ); + watch( + () => state.condition, + (value) => { + store.commit('customer/setCondition', _.cloneDeep(value)); + }, + { immediate: true, deep: true } + ); onActivated(handleSearch); const handleEnable = async (row) => { loading.value = true;