fix: forgot price per unit

This commit is contained in:
puriphatt 2024-10-09 09:52:34 +07:00
parent 06c96d1136
commit 93b184d40d

View file

@ -207,27 +207,35 @@ function mapNode() {
const noNameObjects = v.work const noNameObjects = v.work
.filter((w: Work) => !w.name) .filter((w: Work) => !w.name)
.flatMap((w: Work) => .flatMap((w: Work) =>
w.productOnWork.map((p) => ({ w.productOnWork.map((p) => {
type: 'product', const price = prop.agentPrice
id: p.product.id, ? p.product.agentPrice
title: p.product.name, : p.product.price;
subtitle: p.product.code || ' ', const pricePerUnit = p.product.vatIncluded
detail: p.product.detail, ? precisionRound(price / (1 + (config.value?.vat || 0.07)))
remark: p.product.remark, : price;
value: { return {
vat: 0, type: 'product',
pricePerUnit: 0, id: p.product.id,
discount: 0, title: p.product.name,
amount: 0, subtitle: p.product.code || ' ',
service: v.raw, detail: p.product.detail,
work: w, remark: p.product.remark,
product: p.product, value: {
}, vat: 0,
checked: true, pricePerUnit,
icon: 'mdi-shopping-outline', discount: 0,
bg: 'hsla(var(--teal-10-hsl)/0.1)', amount: 0,
fg: 'var(--teal-10)', service: v.raw,
})), work: w,
product: p.product,
},
checked: true,
icon: 'mdi-shopping-outline',
bg: 'hsla(var(--teal-10-hsl)/0.1)',
fg: 'var(--teal-10)',
};
}),
); );
const withNameObjects = v.work const withNameObjects = v.work
.filter((w: Work) => w.name) .filter((w: Work) => w.name)
@ -490,6 +498,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
{{ {{
$t('general.list', { $t('general.list', {
msg: $t('productService.title'), msg: $t('productService.title'),