feat: 产品选择列表

This commit is contained in:
ilhamtahir committed 2025-01-20 08:01:53 +08:00
1 parent a55a6d3586
commit dfadf3a8f0
25 files changed
+351 -54

No files matched your search

@@ -0,0 +1,44 @@
<script setup lang="ts">
import { useProductStore } from '@/stores/product'
const productStore = useProductStore()
onMounted(() => {
productStore.fetchAllProducts()
})
</script>
<template>
<view class="w-full h-full overflow-y-auto bg-regular px-4 py-5">
<view class="w-full flex gap-2">
<view
v-for="category in productStore.categoryList" :key="category.value" class="rounded-t-xl px-4 py-[9px] font-semibold" :class="{
'bg-white ': category.value === productStore.currentProductCategory,
'bg-disabled text-white': category.value !== productStore.currentProductCategory,
}"
@tap="() => productStore.switchCurrentProductCategory(category.value)"
>
{{ category.label }}
</view>
</view>
<view class="w-full bg-white rounded-tr-xl shadow-cell-group">
<view v-for="product in productStore.productList" :key="product.id" class="py-4 px-8 flex gap-3 items-center border-b-1">
<image :src="product.photo" class="w-[80px] h-[80px]" />
<view class="h-full flex flex-col gap-4">
<view class="font-semibold">
{{ product.name }}
</view>
<view class="flex gap-2">
<view v-for="tag in product.tags" :key="tag" class="px-2 py-0.5 bg-[#f3f3f3] rounded-0.75">
{{ tag }}
</view>
</view>
</view>
</view>
</view>
</view>
</template>
<style scoped>
</style>
+43
View File
@@ -0,0 +1,43 @@
<script setup lang="ts">
import AddFeedingPlan from '@/components/AddFeedingPlan.vue'
function goToChooseProductPage() {
uni.navigateTo({
url: '/pages/feed-plan-calculator/choose-product',
})
}
</script>
<template>
<view class="w-full h-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">
Kcal
</text>
</view>
<view class="font-semibold">
总热量
</view>
<view 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]">
<AddFeedingPlan @tap="goToChooseProductPage" />
</view>
<BButton disabled>
确认
</BButton>
</view>
</template>
<style scoped>
.gradient-text {
background: linear-gradient(180deg, #151515 0%, #7B7B7B 100%);
background-clip: text;
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
</style>
@@ -1,8 +1,8 @@
<script setup lang="ts">
import type { FeedFormQuestions, PetCard, StepInfo, UserList } from '@/model/pet-manual'
import FeedForm from '@/pages/feed-calculator/components/FeedForm.vue'
import FeedSlogan from '@/pages/feed-calculator/components/FeedSlogan.vue'
import ProgressBar from '@/pages/feed-calculator/components/ProgressBar.vue'
import FeedForm from '@/pages/feed-questionnaire/components/FeedForm.vue'
import FeedSlogan from '@/pages/feed-questionnaire/components/FeedSlogan.vue'
import ProgressBar from '@/pages/feed-questionnaire/components/ProgressBar.vue'
import avator from '@/static/image/pet-parameters/avatar.png'
const props = defineProps<{
@@ -1,6 +1,6 @@
<script setup lang="ts">
import type { StepInfo } from '@/model/pet-manual'
import FeedStep from '@/pages/feed-calculator/components/FeedStep.vue'
import type {StepInfo} from '@/model/pet-manual'
import FeedStep from '@/pages/feed-questionnaire/components/FeedStep.vue'
import feedTitle from '@/static/image/feed-plan/feed-title.png'
const props = defineProps<{
@@ -24,9 +24,9 @@ function handleReady() {
</view>
<FeedFlogan />
<view class="flex items-center justify-center">
<button class="w-[176px] h-[47px] flex items-center justify-center bg-[#4545E5] border-none text-[white] rounded-3xl mt-[87px]" @tap="handleReady">
<BButton class="w-[176px] h-[47px] flex items-center justify-center bg-[#4545E5] border-none text-[white] rounded-3xl mt-[87px]" @tap="handleReady">
准备好了
</button>
</BButton>
</view>
</template>
@@ -1,9 +1,9 @@
<script setup lang="ts">
import type { FeedFormQuestions, UserList } from '@/model/pet-manual'
import { PetBodyType } from '@/model/pet'
import FeedQuestionnaire from '@/pages/feed-calculator/components/FeedQuestionnaire.vue'
import FeedStart from '@/pages/feed-calculator/components/FeedStart.vue'
import FeedStep from '@/pages/feed-calculator/components/FeedStep.vue'
import FeedQuestionnaire from '@/pages/feed-questionnaire/components/FeedQuestionnaire.vue'
import FeedStart from '@/pages/feed-questionnaire/components/FeedStart.vue'
import FeedStep from '@/pages/feed-questionnaire/components/FeedStep.vue'
import extremelyObese from '@/static/image/body-type/extremely-obese.svg'
import extremelyThin from '@/static/image/body-type/extremely-thin.svg'
import ideal from '@/static/image/body-type/ideal.svg'
+2 -2
View File
@@ -1,6 +1,6 @@
<script setup lang="ts">
import PickerItem from '@/components/PickerItem.vue'
import FeedSlogan from '@/pages/feed-calculator/components/FeedSlogan.vue'
import FeedSlogan from '@/pages/feed-questionnaire/components/FeedSlogan.vue'
import edit from '@/static/image/start-filing/edit.png'
import { useFeedingPlanStore } from '@/stores/feeding-plan'
import ToolApi from '@/utils'
@@ -9,7 +9,7 @@ const safeHeight = ToolApi.getSafeHeight()
const feedSloganBottom = ref<number>(13)
function handleNext() {
uni.navigateTo({ url: '/pages/feed-calculator/index' })
uni.navigateTo({ url: '/pages/feed-questionnaire/index' })
}
const { pet, petTypeOptions, genderOptions } = useFeedingPlanStore()
+2 -2
View File
@@ -31,9 +31,9 @@ import union from '@/static/image/user-info/union.png'
<uni-list-item show-arrow title="地址" right-text="杭州" />
</uni-card>
<view class=" w-full flex justify-center items-center mt-[80px]">
<button class="w-[176px] h-[47px] font-normal bg-[#4545E5] text-[18px] rounded-[69px] text-[#fff] flex justify-center items-center">
<BButton class="w-[176px] h-[47px] font-normal bg-[#4545E5] text-[18px] rounded-[69px] text-[#fff] flex justify-center items-center">
确认
</button>
</BButton>
</view>
<view class="mt-[20px] flex justify-center items-center">
<image