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

View File

@ -9,3 +9,11 @@
background-color: rgb(248, 220, 220); background-color: rgb(248, 220, 220);
color: red; 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="12">
<v-col cols="12" sm="12" md="8"> <v-col cols="12" sm="12" md="8">
<v-text-field <v-text-field
id="menu-activator" id="menu-activator"
prepend-inner-icon="mdi-magnify" prepend-inner-icon="mdi-magnify"
@ -33,16 +32,16 @@
v-bind="props" v-bind="props"
> >
</v-text-field> </v-text-field>
<v-menu activator="#menu-activator" contained location-strategy='connected' attach> <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-card tile flat v-if="searchData">
<v-container> <v-container>
<RetailerSearchProducts @actionClose="showSnackBarMessage"/> <RetailerSearchProducts @action-close="showSnackBarMessage"/>
</v-container> </v-container>
</v-card> </v-card>
<v-card v-else> <v-card v-else>
<div class="fontcolor-bordeaux pa-1">Please type Item, Name, or Keyword to search</div> <div class="fontcolor-bordeaux pa-1">Please type Item, Name, or Keyword to search</div>
</v-card> </v-card>
</v-menu> </v-menu>
</v-col> </v-col>
</v-col> </v-col>
@ -360,4 +359,4 @@ export default {
}, },
}; };
</script> </script>
<style src="./cart_products.scss" lang="scss" scoped /> <style src="./cart_products.scss" lang="scss" />