aggio modif

This commit is contained in:
Surya Paolo
2024-01-10 20:44:54 +01:00
parent c80b1da42d
commit ee064854a7
4 changed files with 38 additions and 12 deletions

View File

@@ -28,7 +28,8 @@ export const shared_consts = {
GRAMMI: 1, GRAMMI: 1,
CHILI: 2, CHILI: 2,
LITRI: 3, LITRI: 3,
PEZZI: 4, MILLILITRI: 4,
PEZZI: 10,
}, },
TYPECASH: { TYPECASH: {
@@ -73,10 +74,15 @@ export const shared_consts = {
short: 'Lt', short: 'Lt',
value: 3, value: 3,
}, },
{
label: 'MilliLitri (ml)',
short: 'ml',
value: 4,
},
{ {
label: 'Pezzi (p)', label: 'Pezzi (p)',
short: 'p', short: 'p',
value: 4, value: 10,
}, },
], ],

View File

@@ -87,9 +87,9 @@
class="text-black q-ml-xs text-h8" class="text-black q-ml-xs text-h8"
v-if="myproduct.productInfo.unit" v-if="myproduct.productInfo.unit"
> >
{{ myproduct.productInfo.weight }} {{ tools.getWeightByUnit(myproduct.productInfo.unit, true, myproduct.productInfo.weight) }}
{{ {{
tools.getUnitsMeasure(myproduct.productInfo.unit, true) tools.getUnitsMeasure(myproduct.productInfo.unit, true, myproduct.productInfo.weight)
}}</span }}</span
> >
</q-item-label> </q-item-label>
@@ -429,13 +429,13 @@
<span v-if="getpercqtaraggiunta() >= 1">{{ <span v-if="getpercqtaraggiunta() >= 1">{{
t('ecomm.offerta_gas_raggiunta', { t('ecomm.offerta_gas_raggiunta', {
qta: myproduct.qtyToReachForGas, qta: myproduct.qtyToReachForGas,
unit: tools.getUnitsMeasure(myproduct.productInfo.unit, true), unit: tools.getUnitsMeasure(myproduct.productInfo.unit, true, myproduct.productInfo.weight),
}) })
}}</span> }}</span>
<span v-else>{{ <span v-else>{{
t('ecomm.offerta_gas', { t('ecomm.offerta_gas', {
qta: myproduct.qtyToReachForGas, qta: myproduct.qtyToReachForGas,
unit: tools.getUnitsMeasure(myproduct.productInfo.unit, true), unit: tools.getUnitsMeasure(myproduct.productInfo.unit, true, myproduct.productInfo.weight),
}) })
}}</span> }}</span>
</q-item-label> </q-item-label>

View File

@@ -58,6 +58,7 @@
borderless borderless
rounded rounded
dense dense
@update:model-value="updateOrder"
:label="$t('ecomm.preord')" :label="$t('ecomm.preord')"
></q-input> ></q-input>
</div> </div>
@@ -85,7 +86,7 @@
<q-item-label> <q-item-label>
<div class="col-2 no-wrap text-subtitle3_short q-mr-sm"> <div class="col-2 no-wrap text-subtitle3_short q-mr-sm">
<span class="prezzo_singolo"> <span class="prezzo_singolo">
{{ order.quantity + order.quantitypreordered }} x {{ (order.quantity + order.quantitypreordered) }} x
{{ order.price ? order.price : 0 }} {{ order.price ? order.price : 0 }}
</span> </span>
<span :class="isApplicatoSconto() ? 'ordine_scontato_nuovo' : ''"> <span :class="isApplicatoSconto() ? 'ordine_scontato_nuovo' : ''">
@@ -102,8 +103,8 @@
> >
{{ {{
( (
order.price * order.quantity + (order.price * order.quantity) +
order.price * order.quantitypreordered (order.price * order.quantitypreordered)
).toFixed(2) ).toFixed(2)
}}</span }}</span
>)</span >)</span

View File

@@ -8255,9 +8255,28 @@ export const tools = {
return 0 return 0
}, },
getUnitsMeasure(unit: number, short: boolean) { getUnitsMeasure(unit: number, short: boolean, weight: number | undefined) {
const unitrec = shared_consts.Units_Of_Measure_ListBox.find((rec: any) => rec.value === unit) let unitrec = shared_consts.Units_Of_Measure_ListBox.find((rec: any) => rec.value === unit)
return unitrec ? (short ? unitrec.short : unitrec.label) : '' let mystr = ''
if (unitrec && unitrec.value === shared_consts.UNITS_OF_MEASURE.CHILI && weight && weight < 1) {
unitrec = shared_consts.Units_Of_Measure_ListBox.find((rec: any) => rec.value === shared_consts.UNITS_OF_MEASURE.GRAMMI)
}
if (unitrec && unitrec.value === shared_consts.UNITS_OF_MEASURE.LITRI && weight && weight < 1) {
unitrec = shared_consts.Units_Of_Measure_ListBox.find((rec: any) => rec.value === shared_consts.UNITS_OF_MEASURE.MILLILITRI)
}
mystr = unitrec ? (short ? unitrec.short : unitrec.label) : ''
return mystr
},
getWeightByUnit(unit: number, short: boolean, weight: number|undefined) {
let unitrec = shared_consts.Units_Of_Measure_ListBox.find((rec: any) => rec.value === unit)
if (unitrec && unitrec.value === shared_consts.UNITS_OF_MEASURE.CHILI && weight && weight < 1) {
return weight * 1000
}
if (unitrec && unitrec.value === shared_consts.UNITS_OF_MEASURE.LITRI && weight && weight < 1) {
return weight * 1000
}
return weight
}, },
getWeightTotalByOrder(order: IOrder) { getWeightTotalByOrder(order: IOrder) {