|
@@ -1,7 +1,7 @@
|
|
|
import type { FeedingPlanProduct } from '@/model/feeding-plan'
|
|
import type { FeedingPlanProduct } from '@/model/feeding-plan'
|
|
|
import type { Product } from '@/model/product'
|
|
import type { Product } from '@/model/product'
|
|
|
import { createFeedingPlan, updateFeedingPlan } from '@/api/feeding-plan'
|
|
import { createFeedingPlan, updateFeedingPlan } from '@/api/feeding-plan'
|
|
|
-import { createPet } from '@/api/pet'
|
|
|
|
|
|
|
+import { createPet, petVarietiesList } from '@/api/pet'
|
|
|
import {
|
|
import {
|
|
|
type CreateFeedingPlanRequest,
|
|
type CreateFeedingPlanRequest,
|
|
|
type CreatePetRequest,
|
|
type CreatePetRequest,
|
|
@@ -25,6 +25,23 @@ export const useFeedingPlanStore = defineStore('feeding-plan', () => {
|
|
|
{ value: Gender.FEMALE, label: '女孩' },
|
|
{ value: Gender.FEMALE, label: '女孩' },
|
|
|
]
|
|
]
|
|
|
|
|
|
|
|
|
|
+ const petVarietiesOptions = ref<{
|
|
|
|
|
+ value: string
|
|
|
|
|
+ label: string
|
|
|
|
|
+ }[]>([])
|
|
|
|
|
+
|
|
|
|
|
+ const fetchPetVarieties = async () => {
|
|
|
|
|
+ const result = await petVarietiesList()
|
|
|
|
|
+ petVarietiesOptions.value = result.map((item) => {
|
|
|
|
|
+ return {
|
|
|
|
|
+ value: item.name,
|
|
|
|
|
+ label: item.name,
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ fetchPetVarieties()
|
|
|
|
|
+
|
|
|
const dailyCalories = ref(400)
|
|
const dailyCalories = ref(400)
|
|
|
// @ts-expect-error @ts-ignore
|
|
// @ts-expect-error @ts-ignore
|
|
|
const pet = ref <CreatePetRequest>({
|
|
const pet = ref <CreatePetRequest>({
|
|
@@ -39,6 +56,7 @@ export const useFeedingPlanStore = defineStore('feeding-plan', () => {
|
|
|
photo: '',
|
|
photo: '',
|
|
|
type: PetType.CAT,
|
|
type: PetType.CAT,
|
|
|
weight: 0,
|
|
weight: 0,
|
|
|
|
|
+ varietyName: '',
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
const savedPet = ref<Pet | null>(null)
|
|
const savedPet = ref<Pet | null>(null)
|
|
@@ -326,5 +344,6 @@ export const useFeedingPlanStore = defineStore('feeding-plan', () => {
|
|
|
confirm,
|
|
confirm,
|
|
|
initPet,
|
|
initPet,
|
|
|
initFeedingPlan,
|
|
initFeedingPlan,
|
|
|
|
|
+ petVarietiesOptions,
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|