fix: product count

This commit is contained in:
puriphatt 2024-10-10 18:16:48 +07:00
parent 319777bd05
commit 01fa1ebe4e

View file

@ -185,11 +185,13 @@ function mapCard() {
productServiceCard.value = data; productServiceCard.value = data;
} }
const productCount = ref(0);
function mapNode() { function mapNode() {
refSelectZone.value?.assignSelect( refSelectZone.value?.assignSelect(
selectedItems.value, selectedItems.value,
preSelectedItems.value, preSelectedItems.value,
); );
productCount.value = 0;
const node = selectedItems.value.map((v) => { const node = selectedItems.value.map((v) => {
if (v.type === 'service') { if (v.type === 'service') {
@ -253,6 +255,7 @@ function mapNode() {
const pricePerUnit = p.product.vatIncluded const pricePerUnit = p.product.vatIncluded
? precisionRound(price / (1 + (config.value?.vat || 0.07))) ? precisionRound(price / (1 + (config.value?.vat || 0.07)))
: price; : price;
productCount.value++;
return { return {
id: p.product.id, id: p.product.id,
title: p.product.name, title: p.product.name,
@ -279,6 +282,7 @@ function mapNode() {
const pricePerUnit = v.raw.vatIncluded const pricePerUnit = v.raw.vatIncluded
? precisionRound(price / (1 + (config.value?.vat || 0.07))) ? precisionRound(price / (1 + (config.value?.vat || 0.07)))
: price; : price;
productCount.value++;
return { return {
id: v.id, id: v.id,
title: v.name, title: v.name,
@ -302,7 +306,6 @@ function mapNode() {
nodes.value = node; nodes.value = node;
pageState.addModal = false; pageState.addModal = false;
} }
watch( watch(
() => selectedNode.value, () => selectedNode.value,
(v) => { (v) => {
@ -492,7 +495,7 @@ watch(
class="q-py-sm q-px-lg" class="q-py-sm q-px-lg"
style="background: hsla(var(--info-bg) / 0.1)" style="background: hsla(var(--info-bg) / 0.1)"
> >
0 {{ productCount }}
{{ {{
$t('general.list', { $t('general.list', {
msg: $t('productService.title'), msg: $t('productService.title'),