- Esporta Lista Carrello (Totale)

- Sconto Applicato
This commit is contained in:
Surya Paolo
2025-06-09 09:48:34 +02:00
parent 664975b1fd
commit 56d1870bc1
17 changed files with 1325 additions and 327 deletions

View File

@@ -696,6 +696,7 @@ export const getcolorderscart = [
AddCol({ name: 'items', label_trans: 'order.items' }),
AddCol({ name: 'userId', label_trans: 'order.users', fieldtype: costanti.FieldType.select, jointable: 'users' }),
AddCol({ name: 'note', label_trans: 'order.note' }),
AddCol({ name: 'codice_sconto', label_trans: 'order.codice_sconto' }),
AddCol({ name: 'confermato', label_trans: 'order.confermato', fieldtype: costanti.FieldType.boolean }),
AddCol({ name: 'date_confermato', label_trans: 'order.date_confermato', fieldtype: costanti.FieldType.date }),
AddCol({ name: 'consegnato', label_trans: 'order.consegnato', fieldtype: costanti.FieldType.boolean }),
@@ -892,6 +893,7 @@ export const colTableScontistica = [
AddCol({ name: 'qta', label_trans: 'scontistica.qta', fieldtype: costanti.FieldType.number }),
AddCol({ name: 'perc_sconto', label_trans: 'scontistica.perc_sconto', fieldtype: costanti.FieldType.number }),
AddCol({ name: 'price', label_trans: 'products.price', fieldtype: costanti.FieldType.number }),
AddCol({ name: 'applica', label_trans: 'products.applica', fieldtype: costanti.FieldType.number }),
AddCol({ name: 'comulativo', label_trans: 'products.comulativo', fieldtype: costanti.FieldType.boolean }),
AddCol(DeleteRec),
AddCol(DuplicateRec),

View File

@@ -61,6 +61,7 @@ function getRecordOrdersCartEmpty(): IOrderCart {
ricevuto: false,
note: '',
note_per_gestore: '',
codice_sconto:'',
note_per_admin: '',
note_ordine_gas: '',
};
@@ -1374,10 +1375,12 @@ export const useProducts = defineStore('Products', {
cart_id,
status,
note,
codice_sconto,
}: {
cart_id: string;
status: number;
note: string;
codice_sconto: string;
}) {
const userStore = useUserStore();
const globalStore = useGlobalStore();
@@ -1395,6 +1398,7 @@ export const useProducts = defineStore('Products', {
cart_id,
status,
note,
codice_sconto,
options: this.getOptions(true),
}
)
@@ -1494,6 +1498,49 @@ export const useProducts = defineStore('Products', {
return ris;
},
async ApplicaSconto({
cart_id,
codice_sconto,
}: {
cart_id: string;
codice_sconto: number;
}) {
const userStore = useUserStore();
const globalStore = useGlobalStore();
if (!globalStore.site.confpages.enableEcommerce) return null;
let ris = null;
ris = await Api.SendReq(
'/cart/' + this.userActive._id + '/app_sc',
'POST',
{
cart_id,
code: codice_sconto,
}
)
.then((res) => {
this.updateDataProduct(res);
return res.data;
})
.catch((error) => {
console.log('error ApplicaSconto', error);
userStore.setErrorCatch(error);
return new Types.AxiosError(
serv_constants.RIS_CODE_ERR,
null,
toolsext.ERR_GENERICO,
error
);
});
return ris;
},
async addtoCartBase({
$q,
t,