Add tag to results
This commit is contained in:
@@ -41,15 +41,16 @@ const countryCurrency = ref({});
|
||||
const showItemFilter = ref(false);
|
||||
|
||||
let tproducts = computed(() => {
|
||||
console.log('PR=',products);
|
||||
console.log('CC=',countryCurrency.value);
|
||||
console.log('PR=', products);
|
||||
console.log('CC=', countryCurrency.value);
|
||||
return products.value.map((prod) => {
|
||||
prod.currency = countryCurrency.value[prod.countryName];
|
||||
if (currencyHash.value[prod.currency]) prod.calcPrice = prod.salesPrice/currencyHash.value[prod.currency];
|
||||
if (currencyHash.value[prod.currency]) prod.calcPrice = prod.salesPrice / currencyHash.value[prod.currency];
|
||||
else {
|
||||
prod.calcPrice = prod.salesPrice;
|
||||
prod.currency = 'EUR'
|
||||
}
|
||||
if (prod.tag == 'NONE') prod.tag = '';
|
||||
prod.calcPrice = (prod.calcPrice * currencyCoef.value).toFixed(2);
|
||||
prod.rate = currencyHash.value[prod.currency];
|
||||
|
||||
@@ -95,9 +96,9 @@ const hrates = ref([
|
||||
// { "country": "AT", "code": "50161321", "url": "https://www.ikea.com/at/de/p/hol-aufbewahrungstisch-akazie-50161321/", "name": "HOL", "typeName": "Aufbewahrungstisch", "mainImageUrl": "https://www.ikea.com/at/de/images/products/hol-aufbewahrungstisch-akazie__0104310_pe251255_s5.jpg", "itemNoGlobal": "50161321", "salesPrice": "80.99", "tag": "FAMILY_PRICE", "last_mod": "2023-12-03 16:44:24" },
|
||||
const hproducts = ref([
|
||||
{ text: "Country", value: "countryName", sortable: true },
|
||||
// { text: "Name", value: "name", sortable: true },
|
||||
{ text: "Tag", value: "tag", sortable: true },
|
||||
{ text: "Local Price", value: "salesPrice", sortable: true },
|
||||
{ text: "Cur", value: "currency", sortable: false},
|
||||
{ text: "Cur", value: "currency", sortable: false },
|
||||
{ text: "Rate", value: "rate" },
|
||||
{ text: "Price", value: "calcPrice", sortable: true }
|
||||
]);
|
||||
@@ -168,7 +169,7 @@ const fetch_rates = async () => {
|
||||
rates.value = response.data;
|
||||
currency.value = rates.value.map((currency) => currency.currency);
|
||||
countryCurrency.value = Object.fromEntries(
|
||||
rates.value.map((currency) => [currency.country_name, currency.currency ])
|
||||
rates.value.map((currency) => [currency.country_name, currency.currency])
|
||||
);
|
||||
currencyHash.value = Object.fromEntries(
|
||||
rates.value.map((currency) => [currency.currency, currency.rate]),
|
||||
|
||||
Reference in New Issue
Block a user