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,
CHILI: 2,
LITRI: 3,
PEZZI: 4,
MILLILITRI: 4,
PEZZI: 10,
},
TYPECASH: {
@@ -73,10 +74,15 @@ export const shared_consts = {
short: 'Lt',
value: 3,
},
{
label: 'MilliLitri (ml)',
short: 'ml',
value: 4,
},
{
label: 'Pezzi (p)',
short: 'p',
value: 4,
value: 10,
},
],

View File

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

View File

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

View File

@@ -8255,9 +8255,28 @@ export const tools = {
return 0
},
getUnitsMeasure(unit: number, short: boolean) {
const unitrec = shared_consts.Units_Of_Measure_ListBox.find((rec: any) => rec.value === unit)
return unitrec ? (short ? unitrec.short : unitrec.label) : ''
getUnitsMeasure(unit: number, short: boolean, weight: number | undefined) {
let unitrec = shared_consts.Units_Of_Measure_ListBox.find((rec: any) => rec.value === unit)
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) {