fix: แก้ ใช้ กับ service ได้

This commit is contained in:
Net 2024-06-21 11:38:59 +07:00
parent a94dab41bc
commit 63505dfa1d
2 changed files with 15 additions and 26 deletions

View file

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

Before After
Before After

View file

@ -3,13 +3,13 @@ import { ref } from 'vue';
import AppBox from 'components/app/AppBox.vue'; import AppBox from 'components/app/AppBox.vue';
const addedProduct = ref<boolean>(false); const addedProduct = ref<boolean>(false);
import { ProductList } from 'src/stores/product-service/types'; import { ProductList, Service } from 'src/stores/product-service/types';
const baseUrl = ref<string>(import.meta.env.VITE_API_BASE_URL); const baseUrl = ref<string>(import.meta.env.VITE_API_BASE_URL);
withDefaults( withDefaults(
defineProps<{ defineProps<{
data: ProductList; data?: ProductList;
title?: string; title?: string;
dense?: boolean; dense?: boolean;
@ -19,9 +19,13 @@ withDefaults(
typeProduct?: string; typeProduct?: string;
status?: boolean; status?: boolean;
index?: number;
isAddProduct?: boolean; isAddProduct?: boolean;
isSelected?: boolean; isSelected?: boolean;
code?: string;
price?: number;
id?: string;
process?: number;
}>(), }>(),
{ {
isSelected: false, isSelected: false,
@ -102,13 +106,13 @@ withDefaults(
size="18px" size="18px"
text-color="white" text-color="white"
> >
{{ index !== undefined ? index + 1 : 0 }} 1
</q-avatar> </q-avatar>
</div> </div>
<div class="app-text-muted">{{ data.code ?? 'code' }}</div> <div class="app-text-muted">{{ code ?? 'code' }}</div>
<div class="flex justify-start text-bold"> <div class="flex justify-start text-bold">
<div <div
v-if="typeProduct === 'work'" v-if="typeProduct === 'service'"
class="bordered q-pa-xs row surface-0" class="bordered q-pa-xs row surface-0"
style="font-size: 12px; border-radius: 5px; width: 80px" style="font-size: 12px; border-radius: 5px; width: 80px"
> >
@ -123,7 +127,7 @@ withDefaults(
class="flex justify-end text-bold" class="flex justify-end text-bold"
style="color: var(--green-10)" style="color: var(--green-10)"
> >
฿ {{ data.price }} ฿ {{ price }}
</div> </div>
<div <div
@ -131,7 +135,7 @@ withDefaults(
:style="`background-color: var(${typeProduct === 'product' ? '--green-0' : '--orange-0'})`" :style="`background-color: var(${typeProduct === 'product' ? '--green-0' : '--orange-0'})`"
> >
<q-img <q-img
:src="`${baseUrl}/product/${data.id}/image`" :src="`${baseUrl}/product/${id}/image`"
style="height: 86px; max-width: 100px" style="height: 86px; max-width: 100px"
> >
<template #error> <template #error>
@ -140,7 +144,7 @@ withDefaults(
:src=" :src="
typeProduct === 'product' typeProduct === 'product'
? '/shop-image.png' ? '/shop-image.png'
: '/work-image.png' : '/service-image.png'
" "
width="100%" width="100%"
/> />
@ -148,7 +152,7 @@ withDefaults(
</q-img> </q-img>
</div> </div>
<div class="row justify-between items-center q-mb-xs"> <div class="row justify-between items-center q-mb-xs">
<div class="q-pr-md" v-if="typeProduct === 'work'"> <div class="q-pr-md" v-if="typeProduct === 'service'">
<q-icon <q-icon
name="mdi-calendar-month" name="mdi-calendar-month"
class="surface-0 rounded q-pa-xs app-text-muted" class="surface-0 rounded q-pa-xs app-text-muted"
@ -163,22 +167,7 @@ withDefaults(
class="surface-0 rounded q-pa-xs app-text-muted" class="surface-0 rounded q-pa-xs app-text-muted"
size="20px" size="20px"
/> />
{{ data.process }} {{ process }}
</div>
<div v-if="isSelected === false">
<q-btn
unelevated
dense
class="q-mr-sm app-text-info"
label="รายละเอียด"
@click="$emit('viewDetail')"
style="
background-color: hsl(var(--blue-5-hsl) / 0.2);
max-width: 150px;
"
icon-right="mdi-chevron-right"
/>
</div> </div>
</div> </div>
</div> </div>