Procházet zdrojové kódy

ajuste precos da loja + correcao nao aparecer item inativo

Gustavo Zanatta před 1 týdnem
rodič
revize
e74f7235c9

+ 2 - 0
src/i18n/locales/en.json

@@ -633,6 +633,8 @@
     "filter_all": "All",
     "filter_recent": "Recent",
     "filter_others": "Others",
+    "price_non_associate": "Price for non-members",
+    "price_associate": "Price for members",
     "btn_want": "I WANT IT",
     "btn_interested": "INTERESTED",
     "whatsapp_dialog_title": "Talk on WhatsApp",

+ 2 - 0
src/i18n/locales/es.json

@@ -632,6 +632,8 @@
     "filter_all": "Todos",
     "filter_recent": "Recientes",
     "filter_others": "Otros",
+    "price_non_associate": "Precio para no asociado",
+    "price_associate": "Precio para asociado",
     "btn_want": "LO QUIERO",
     "btn_interested": "INTERESADO",
     "whatsapp_dialog_title": "Hablar por WhatsApp",

+ 2 - 0
src/i18n/locales/pt.json

@@ -633,6 +633,8 @@
     "filter_all": "Todos",
     "filter_recent": "Recentes",
     "filter_others": "Outros",
+    "price_non_associate": "Preço para não associado",
+    "price_associate": "Preço para associado",
     "btn_want": "EU QUERO",
     "btn_interested": "INTERESSADO",
     "whatsapp_dialog_title": "Falar no WhatsApp",

+ 22 - 7
src/pages/associado/loja/AssociadoLojaPage.vue

@@ -101,11 +101,19 @@
                   </div>
 
                   <div class="column items-start q-mt-sm">
-                    <span v-if="item.price" class="text-caption text-grey-5 text-strike">
-                      R$ {{ formatPrice(item.price) }}
+                    <span
+                      v-if="priceInfo(item).regular !== null"
+                      class="text-caption text-grey-7"
+                    >
+                      {{ $t("loja.price_non_associate") }}:
+                      R$ {{ formatPrice(priceInfo(item).regular) }}
                     </span>
-                    <span class="text-subtitle1 text-weight-bold text-violet-dark">
-                      R$ {{ formatPrice(displayPrice(item)) }}
+                    <span
+                      v-if="priceInfo(item).associate !== null"
+                      class="text-body2 text-weight-bold text-violet-dark"
+                    >
+                      {{ $t("loja.price_associate") }}:
+                      R$ {{ formatPrice(priceInfo(item).associate) }}
                     </span>
                   </div>
                 </div>
@@ -198,10 +206,17 @@ const selectVariation = (item, variation) => {
 const activeVariation = (item) =>
   selectedVariations.value[item.id] ?? item.variations?.[0] ?? null;
 
-const displayPrice = (item) => {
+const hasPrice = (price) => price !== null && price !== undefined && price !== "";
+
+const priceInfo = (item) => {
   const v = activeVariation(item);
-  if (v?.variation_value != null) return v.variation_value;
-  return item.associate_price ?? item.price;
+  const associate = hasPrice(v?.variation_value) ? v.variation_value : item.associate_price;
+
+  if (hasPrice(item.price) && hasPrice(associate)) {
+    return { regular: item.price, associate };
+  }
+  const single = hasPrice(associate) ? associate : item.price;
+  return { regular: null, associate: hasPrice(single) ? single : null };
 };
 
 const variationTypeLabel = (item) => {