This commit is contained in:
rakesh 2023-06-16 14:04:24 +05:30
parent 3441d0c0fa
commit bbb14e698d
3 changed files with 38 additions and 27 deletions

View File

@ -80,13 +80,14 @@
<v-btn
:disabled="inProgress"
block
size="x-large"
size="large"
v-bind="props"
:variant="isHovering ? 'outlined' : 'outlined'"
:class="
isHovering ? ' bg-white text-primary' : 'bg-primary'
"
class="text-uppercase ls-0 body productpage-button"
rounded="0"
@click="addToCart(product.sku, product.mq)"
>
<v-progress-circular
@ -170,7 +171,7 @@ export default {
menu: false,
showDrawarFilter: false,
noProducts: "No products found.",
snackbar: {
snackbarVal: {
show: false,
message: null,
color: null,
@ -183,9 +184,10 @@ export default {
return with2Decimals;
},
async addToCart(sku, qty) {
if (sku) {
if (this.userAuth) {
debugger;
try{
await this.$store
.dispatch("userCartProduct/addToCart", {
sku: sku,
@ -193,27 +195,29 @@ export default {
ccid: null,
price: null,
personalizeDetails: null,
})
.then(() => {
this.snackbar = {
});
this.snackbarVal = {
message: "Product Added Successfully",
color: "success",
show: true,
timeout: 2000,
};
this.$store.dispatch("userCartProduct/cartProductList");
this.$emit("actionClose", this.snackbar);
})
.catch((error) => {
console.log("error", error);
this.snackbar = {
this.$store.dispatch("userCartProduct/cartProductList");
this.$emit("action-close", this.snackbarVal);
}
catch(error)
{
console.log("error", error);
this.snackbarVal = {
message: error.message,
color: "error",
show: true,
timeout: 2000,
};
this.$emit("actionClose", this.snackbar);
});
this.$emit("action-close", this.snackbarVal);
}
}
} else {
this.errorMessage = "Please Select Quantity";

View File

@ -9,3 +9,11 @@
background-color: rgb(248, 220, 220);
color: red;
}
.v-menu-position-relative
{
position:relative;
}
.v-menu-top.v-overlay__content{
top:0!important;
}

View File

@ -20,7 +20,6 @@
>
<v-col cols="12" sm="12" md="12">
<v-col cols="12" sm="12" md="8">
<v-text-field
id="menu-activator"
prepend-inner-icon="mdi-magnify"
@ -33,16 +32,16 @@
v-bind="props"
>
</v-text-field>
<v-menu activator="#menu-activator" contained location-strategy='connected' attach>
<v-card tile flat v-if="searchData">
<v-container>
<RetailerSearchProducts @actionClose="showSnackBarMessage"/>
</v-container>
</v-card>
<v-card v-else>
<div class="fontcolor-bordeaux pa-1">Please type Item, Name, or Keyword to search</div>
</v-card>
</v-menu>
<v-menu activator="#menu-activator" class="v-menu-position-relative" content-class="v-menu-top" contained origin="auto" attach>
<v-card tile flat v-if="searchData">
<v-container>
<RetailerSearchProducts @action-close="showSnackBarMessage"/>
</v-container>
</v-card>
<v-card v-else>
<div class="fontcolor-bordeaux pa-1">Please type Item, Name, or Keyword to search</div>
</v-card>
</v-menu>
</v-col>
</v-col>
@ -360,4 +359,4 @@ export default {
},
};
</script>
<style src="./cart_products.scss" lang="scss" scoped />
<style src="./cart_products.scss" lang="scss" />