feat: 喂养计划

This commit is contained in:
ilhamtahir committed 2025-01-21 09:09:42 +08:00
1 parent dfadf3a8f0
commit b2d41fd537
22 files changed
+506 -17

No files matched your search

+29 -5
View File
@@ -1,15 +1,25 @@
<script setup lang="ts">
import AddFeedingPlan from '@/components/AddFeedingPlan.vue'
import ProductItem from '@/components/ProductItem.vue'
import { useFeedingPlanStore } from '@/stores/feeding-plan'
function goToChooseProductPage() {
uni.navigateTo({
url: '/pages/feed-plan-calculator/choose-product',
})
}
const feedingPlanStore = useFeedingPlanStore()
function handleNext() {
uni.navigateTo({
url: '/pages/feed-plan-calculator/confirm',
})
}
</script>
<template>
<view class="w-full h-full bg-regular flex flex-col items-center">
<view class="w-full bg-regular flex flex-col items-center">
<view class="mt-[54px] flex flex-col gap-1 mb-[60px] items-center">
<view class="gradient-text text-[48px] font-bold">
400<text class="text-[24px] font-semibold">
@@ -19,16 +29,30 @@ function goToChooseProductPage() {
<view class="font-semibold">
总热量
</view>
<view class="text-xs text-disabled font-semibold">
<view v-if="!feedingPlanStore.selectedProducts.length" class="text-xs text-disabled font-semibold">
(未添加产品)
</view>
</view>
<image src="@/static/svg/plate.svg" class="w-[289px] h-[176px] mb-[50px]" />
<view class="w-full px-4 mb-[52px]">
<view class="w-full px-4 mb-[52px] flex flex-col gap-3">
<SectionCard v-if="feedingPlanStore.selectedProducts.length" title="产品比例" subtitle="FEEDING PLAN" operation-title="推荐比例">
<view v-for="(item, index) in feedingPlanStore.selectedProducts" :key="item.product.id" class="p-4 flex flex-col gap-3">
<view class="w-full flex justify-between">
<view class="font-semibold">
{{ item.product.name }}
</view>
<view class="w-[48px] h-[28px] flex items-center justify-center rounded-1 bg-[#f3f3f3] font-semibold">
{{ feedingPlanStore.selectedProducts[index].percentage }}%
</view>
</view>
<BSlider :model-value="item.percentage" @change="(value) => feedingPlanStore.changePercentage(item.product.id, value)" />
</view>
</SectionCard>
<ProductItem v-for="item in feedingPlanStore.selectedProducts" :key="item.product.id" :data="item" />
<AddFeedingPlan @tap="goToChooseProductPage" />
</view>
<BButton disabled>
确认
<BButton class="fixed bottom-6 mb-safe-bottom z-3" :disabled="!feedingPlanStore.selectedProducts.length" @tap="handleNext">
下一步
</BButton>
</view>
</template>