- 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

@@ -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,