feat: 喂养计划回显
This commit is contained in:
1 parent
f99dca56ef
commit
b730f7966b
4 files changed
+76
-8
No files matched your search
@@ -37,6 +37,31 @@ async function selectPet(index: number) {
|
||||
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)
|
||||
</script>
|
||||
|
||||
@@ -54,9 +79,9 @@ onMounted(fetchPets)
|
||||
{{ item.name }}
|
||||
<view v-if="index === currentIndex" class="absolute w-[30%] h-[3px] bg-primary bottom-[-4px] rounded-full" />
|
||||
</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>
|
||||
<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>
|
||||
@@ -74,11 +99,11 @@ onMounted(fetchPets)
|
||||
</view>
|
||||
<image class="w-[20px] h-[20px]" src="@/static/icons/edit.svg" />
|
||||
</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" />
|
||||
</SectionCard>
|
||||
<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]" />
|
||||
<view class="text-xs text-disabled">
|
||||
添加您的喂养计划
|
||||
|
||||
Reference in new issue
Block a user