From 462f25020bac556a95ca71c2fee8ffed9f667e01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=91=E6=96=87=E5=8F=AF?= <1041367524@qq.com> Date: Mon, 13 Jun 2022 16:00:44 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=94=A8=E6=88=B7=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/sales/order/index.vue | 54 ++++++++++++++--------------- src/views/system/customer/index.vue | 27 +++++++++------ 2 files changed, 43 insertions(+), 38 deletions(-) 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;