|
@@ -37,6 +37,31 @@ async function selectPet(index: number) {
|
|
|
currentIndex.value = index
|
|
currentIndex.value = index
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+const feedingPlanStore = useFeedingPlanStore()
|
|
|
|
|
+
|
|
|
|
|
+async function handleAddFeedingPlan() {
|
|
|
|
|
+ feedingPlanStore.initPet(currentPet.value)
|
|
|
|
|
+ uni.navigateTo({
|
|
|
|
|
+ url: '/pages/feed-plan-calculator/index',
|
|
|
|
|
+ })
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+function handleAddPet() {
|
|
|
|
|
+ uni.navigateTo({
|
|
|
|
|
+ url: '/pages/start-filing/index',
|
|
|
|
|
+ })
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+async function handleEdit() {
|
|
|
|
|
+ if (!feedingPlan.value)
|
|
|
|
|
+ return
|
|
|
|
|
+ feedingPlanStore.initPet(currentPet.value)
|
|
|
|
|
+ feedingPlanStore.initFeedingPlan(feedingPlan.value)
|
|
|
|
|
+ uni.navigateTo({
|
|
|
|
|
+ url: '/pages/feed-plan-calculator/index',
|
|
|
|
|
+ })
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
onMounted(fetchPets)
|
|
onMounted(fetchPets)
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|
|
@@ -54,9 +79,9 @@ onMounted(fetchPets)
|
|
|
{{ item.name }}
|
|
{{ item.name }}
|
|
|
<view v-if="index === currentIndex" class="absolute w-[30%] h-[3px] bg-primary bottom-[-4px] rounded-full" />
|
|
<view v-if="index === currentIndex" class="absolute w-[30%] h-[3px] bg-primary bottom-[-4px] rounded-full" />
|
|
|
</view>
|
|
</view>
|
|
|
- <image src="@/static/icons/plus-circle.svg" class="w-[24px] h-[24px]" />
|
|
|
|
|
|
|
+ <image src="@/static/icons/plus-circle.svg" class="w-[24px] h-[24px]" @tap="handleAddPet" />
|
|
|
</template>
|
|
</template>
|
|
|
- <view v-else class="text-primary text-xl relative flex justify-center font-semibold">
|
|
|
|
|
|
|
+ <view v-else class="text-primary text-xl relative flex justify-center font-semibold" @tap="handleAddPet">
|
|
|
待添加
|
|
待添加
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
@@ -74,11 +99,11 @@ onMounted(fetchPets)
|
|
|
</view>
|
|
</view>
|
|
|
<image class="w-[20px] h-[20px]" src="@/static/icons/edit.svg" />
|
|
<image class="w-[20px] h-[20px]" src="@/static/icons/edit.svg" />
|
|
|
</view>
|
|
</view>
|
|
|
- <SectionCard v-if="feedingPlan" title="喂养计划" subtitle="FEEDING PLAN" operation-title="编辑计划">
|
|
|
|
|
|
|
+ <SectionCard v-if="feedingPlan" title="喂养计划" subtitle="FEEDING PLAN" operation-title="编辑计划" :on-operation-click="handleEdit">
|
|
|
<ProductReadonlyItem v-for="item in feedingPlan.feedingPlanProducts" :key="item.product.id" :data="item" />
|
|
<ProductReadonlyItem v-for="item in feedingPlan.feedingPlanProducts" :key="item.product.id" :data="item" />
|
|
|
</SectionCard>
|
|
</SectionCard>
|
|
|
<SectionCard v-else title="喂养计划" subtitle="FEEDING PLAN" operation-title="无计划">
|
|
<SectionCard v-else title="喂养计划" subtitle="FEEDING PLAN" operation-title="无计划">
|
|
|
- <view class="w-full h-[120px] flex flex-col items-center justify-center gap-1.5">
|
|
|
|
|
|
|
+ <view class="w-full h-[120px] flex flex-col items-center justify-center gap-1.5" @tap="handleAddFeedingPlan">
|
|
|
<image src="@/static/icons/plus-circle-2.svg" class="w-[47px] h-[47px]" />
|
|
<image src="@/static/icons/plus-circle-2.svg" class="w-[47px] h-[47px]" />
|
|
|
<view class="text-xs text-disabled">
|
|
<view class="text-xs text-disabled">
|
|
|
添加您的喂养计划
|
|
添加您的喂养计划
|