冯诚 %!s(int64=3) %!d(string=hai) anos
pai
achega
310730312d

+ 2 - 3
src/pages/fill-order/index.vue

@@ -23,7 +23,7 @@ import { useRoute } from 'vue-router'
 import StepOne from './StepOne.vue'
 import StepTwo from './StepTwo.vue'
 import StepThree from './StepThree.vue'
-import { state } from './store'
+import { state, resetState } from './store'
 
 const step = ref(0)
 const Component = computed(() => [StepOne, StepTwo, StepThree][step.value])
@@ -33,8 +33,7 @@ state.form.from = from
 state.form.invitor = invitee
 
 onUnmounted(() => {
-  state.form = {} as any
-  state.modelList = []
+  resetState()
 })
 
 watch(step, () => window.scrollTo(0, 0))

+ 6 - 0
src/pages/fill-order/store.ts

@@ -47,6 +47,12 @@ export const getters = reactive({
   modelName,
 })
 
+export function resetState() {
+  state.modelList = []
+  state.form = {} as any
+  state.discount = null
+}
+
 export async function initProducts() {
   if (!state.productList.length) {
     state.productList = (await api.getProductList()).results

+ 3 - 1
src/pages/repaire/appointment.vue

@@ -33,7 +33,9 @@ onBeforeRouteLeave((to, from) => {
   }
 })
 
-onUnmounted(resetState)
+onUnmounted(() => {
+  resetState()
+})
 
 watch(
   () => state.step,