From 46f4173524f3bd124991fd246fa8ed3d3fc319fd Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Fri, 1 Sep 2023 11:15:18 +0700 Subject: [PATCH 1/2] =?UTF-8?q?=E0=B8=9B=E0=B8=A3=E0=B8=B1=E0=B8=9A=20?= =?UTF-8?q?=E0=B8=AD=E0=B8=AD=E0=B8=81=E0=B8=84=E0=B8=B3=E0=B8=AA=E0=B8=B1?= =?UTF-8?q?=E0=B9=88=E0=B8=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/10_order/components/Detail.vue | 79 +++++++++++++------ .../10_order/components/step/step01.vue | 18 +++-- .../10_order/components/step/step02.vue | 48 +++++++++-- 3 files changed, 111 insertions(+), 34 deletions(-) diff --git a/src/modules/10_order/components/Detail.vue b/src/modules/10_order/components/Detail.vue index 603bdfbe2..57a149cc5 100644 --- a/src/modules/10_order/components/Detail.vue +++ b/src/modules/10_order/components/Detail.vue @@ -10,20 +10,16 @@ const route = useRoute(); const orderId_params = route.params.orderid; const step01 = defineAsyncComponent( - () => - import("@/modules/10_order/components/step/step01.vue") + () => import("@/modules/10_order/components/step/step01.vue") ); const step02 = defineAsyncComponent( - () => - import("@/modules/10_order/components/step/step02.vue") + () => import("@/modules/10_order/components/step/step02.vue") ); const step03 = defineAsyncComponent( - () => - import("@/modules/10_order/components/step/step03.vue") + () => import("@/modules/10_order/components/step/step03.vue") ); const step04 = defineAsyncComponent( - () => - import("@/modules/10_order/components/step/step04.vue") + () => import("@/modules/10_order/components/step/step04.vue") ); const router = useRouter(); @@ -37,12 +33,12 @@ onUnmounted(() => { const nextStep = async () => { stepper.value!.next(); - localStorage.setItem("currentStep", (step.value + 1).toString()); + localStorage.setItem("currentStep", step.value.toString()); if (orderId.value) { await http .put(config.API.nextStep(orderId.value)) - .then((res) => { - console.log(res); + .then(() => { + router.push(`/order/detail/${orderId.value}?step=${step.value}`); }) .catch((e) => { console.log(e); @@ -51,12 +47,12 @@ const nextStep = async () => { }; const previousStep = async () => { stepper.value!.previous(); - localStorage.setItem("currentStep", (step.value - 1).toString()); + localStorage.setItem("currentStep", step.value.toString()); if (orderId.value) { await http .put(config.API.prevStep(orderId.value)) - .then((res) => { - console.log(res); + .then(() => { + router.push(`/order/detail/${orderId.value}?step=${step.value}`); }) .catch((e) => { console.log(e); @@ -70,7 +66,7 @@ const destroyLocalStorage = () => { onMounted(() => { // console.log("route query===>", route.query) if (route.query.step) { - step.value = Number(route.query.step) + step.value = Number(route.query.step); localStorage.setItem("currentStep", step.value.toString()); } else { const currentStep = localStorage.getItem("currentStep"); @@ -90,16 +86,55 @@ onMounted(() => {