This commit is contained in:
rakesh 2022-01-20 15:08:46 +05:30
parent aecadf3107
commit ad63d7d012
2 changed files with 27 additions and 764 deletions

View File

@ -1 +1 @@
{"branch_name":"beta","last_commit_date":"2022-01-19T16:45:44.000Z","last_commit_author":"sidharth","last_commit_hash":"7f61304766a9347d1adbea8794f6276df2d35e68"} {"branch_name":"beta","last_commit_date":"2022-01-20T09:20:12.000Z","last_commit_author":"rakesh","last_commit_hash":"aecadf3107a47299cdc79a7ea795e944f95452fd"}

View File

@ -464,8 +464,8 @@
v-if="shippingInformations.totals.grandTotal !== 0" v-if="shippingInformations.totals.grandTotal !== 0"
> >
<v-radio <v-radio
:label="shippingInformations.paymentMethods[0].title" :label="shippingInformations.paymentMethods[1].title"
:value="shippingInformations.paymentMethods[0].code" :value="shippingInformations.paymentMethods[1].code"
class="black--text" class="black--text"
></v-radio> ></v-radio>
<div v-if="paymentMethod === 'purchaseorder'"> <div v-if="paymentMethod === 'purchaseorder'">
@ -491,34 +491,32 @@
>Edit</v-btn >Edit</v-btn
> >
</v-col> </v-col>
</v-row> </v-row> <v-form ref="poNumberForm" v-model="valid" :lazy-validation="lazy">
<v-row class="pl-3"> <v-row >
<v-col cols="12" align="right">
<v-text-field
v-model="poNumber"
type="text"
dense
placeholder="Purchase Order Number"
outlined
:rules="textRules"
></v-text-field>
</v-col>
<v-col cols="12" align="right"> <v-col cols="12" align="right">
<v-btn <v-btn
class="primary mx-3 text-uppercase" class="primary mx-3 text-uppercase"
@click="placeOrderFree()" @click="placeOrderFree($event)"
tile tile
depressed depressed
>Place Order</v-btn >Place Order</v-btn
> >
</v-col> </v-col>
<!-- <v-col cols="12" sm="6">
<v-braintree
:authorization="braintreeAuthKey"
:vaultManager="true"
@success="onPaymentSuccess"
@error="onPaymentError"
@load="onGatewayLoad"
@loadFail="onGatewayLoadFail"
>
<template v-slot:button="slotProps">
<v-btn @click="slotProps.submit" color="success">Place Order</v-btn>
</template>
</v-braintree>
</v-col>-->
</v-row> </v-row>
</v-form>
</div> </div>
<v-row v-else> <v-row v-else>
<v-col cols="12" sm="8" v-if="this.userAuth"> <v-col cols="12" sm="8" v-if="this.userAuth">
@ -701,226 +699,7 @@
</v-col> </v-col>
</div>--> </div>-->
</v-radio-group> </v-radio-group>
<v-radio-group
:mandatory="false"
v-model="paymentMethodFree"
v-else-if="shippingInformations.totals.grandTotal == 0"
>
<p class="h3 mb-5">Payment Method</p>
<v-radio
:label="shippingInformations.paymentMethods[2].title"
:value="paymentMethodFree"
class="black--text"
></v-radio>
<div>
<v-checkbox
label="My billing and shipping address are the same"
v-model="sameAddress"
@change="resetFields()"
dense
:readonly="readOnlyCheckBox"
hide-details
></v-checkbox>
<v-row v-if="sameAddress">
<v-col cols="12" class="pl-sm-10">
<BillingAddressComponent :address="address" />
<v-btn
class="primary my-3"
large
v-if="editBillingButton"
@click="editBillBook()"
>Edit</v-btn
>
</v-col>
</v-row>
<v-row v-else>
<v-col cols="12" sm="8" v-if="this.userAuth">
<v-row v-if="addressLength > 0">
<v-col cols="12">
<v-select
v-model="selectedBillingAddress"
dense
:items="billingAddressList"
outlined
return-object
class="billing-address-select"
@change="changeBillingAddress()"
item-value="id"
>
<template v-slot:selection="data">
<div v-if="data.item.value">
<span class>New Address</span>
</div>
<div
class="
d-inline-block
text-truncate
pt-sm-0
"
v-else
>
<span class
>{{ data.item.firstname }}
{{ data.item.lastname }}</span
>
<span
class="body pl-1"
v-if="data.item.streetNoOne"
>{{ data.item.streetNoOne }},
{{ data.item.streetNoTwo }}</span
>
<span class="body pl-1" v-else
>{{ data.item.street[0] }} ,{{
data.item.street[1]
}}</span
>
<span class="pl-1"
>{{ data.item.city }}
{{ data.item.postcode }}</span
>
</div>
</template>
<template v-slot:item="data">
<v-list-item-content>
<v-list-item-title
v-if="data.item.value"
>
<span class="ml-2">New Address</span>
</v-list-item-title>
<v-list-item-title v-else>
<span class="ml-2"
>{{ data.item.firstname }}
{{ data.item.lastname }},</span
>
<span
class="body"
v-if="data.item.streetNoOne"
>{{ data.item.streetNoOne }},
{{ data.item.streetNoTwo }}</span
>
<span class="body" v-else
>{{ data.item.street[0] }} ,{{
data.item.street[1]
}}</span
>
<span class
>{{ data.item.city }},
{{ data.item.postcode }}</span
>
</v-list-item-title>
</v-list-item-content>
</template>
</v-select>
</v-col>
<v-col
cols="12"
class="d-flex justify-end pa-0"
v-if="!showNewBillingForm"
>
<v-btn
class="primary ma-3 text-uppercase"
@click="cancelBillingAddress"
>Cancel</v-btn
>
<v-btn
class="success ma-3 text-uppercase"
@click="updateBillingAddress"
>Update</v-btn
>
</v-col>
</v-row>
<v-row v-if="showNewBillingForm">
<v-col cols="12">
<ShippingAddressFormComponent
@actionValid="checkFormValid"
:hideAndShowFields="hideAndShowFields"
@verifyAddress="verifyAddress"
ref="billingForm"
/>
</v-col>
<v-col cols="12" class="py-0">
<v-checkbox
label="Save in Address Book"
v-model="saveInBillingAddressBook"
class="mt-0"
dense
hide-details
></v-checkbox>
</v-col>
</v-row>
</v-col>
<v-col cols="12" sm="8" v-else>
<GuestShippingAddressForm
@actionValid="checkGuestFormValid"
:hideEmail="hideEmailField"
@verifyAddress="verifyAddress"
ref="addressForm"
/>
</v-col>
<v-col
cols="12"
sm="8"
class="d-flex justify-end pa-0"
v-if="showNewBillingForm"
>
<v-btn
class="primary ma-3 text-uppercase"
@click="cancelBillingAddress"
>Cancel</v-btn
>
<v-btn
class="success ma-3 text-uppercase"
@click="newBillingAddress"
>Update</v-btn
>
</v-col>
</v-row>
<v-row class="pl-3">
<v-col cols="12" align="right">
<v-btn
class="primary mx-3 text-uppercase"
@click="placeOrderFree()"
tile
depressed
>Place Order</v-btn
>
</v-col>
<!-- <v-col cols="12" sm="6">
<v-braintree
:authorization="braintreeAuthKey"
:vaultManager="true"
@success="onPaymentSuccess"
@error="onPaymentError"
@load="onGatewayLoad"
@loadFail="onGatewayLoadFail"
>
<template v-slot:button="slotProps">
<v-btn @click="slotProps.submit" color="success">Place Order</v-btn>
</template>
</v-braintree>
</v-col>-->
</v-row>
</div>
<!-- <v-divider class="my-3"></v-divider>
<v-radio
:label="shippingInformations.paymentMethods[0].title"
:value="shippingInformations.paymentMethods[0].code"
class="black--text"
></v-radio>
<div v-if="paymentMethod === 'braintree_paypal'">
<v-col cols="12" sm="12" class="pr-10 pt-10">
<v-btn
id="paypal-button"
tile
class="float-right text-uppercase"
color="primary"
>Continue To Paypal</v-btn>
</v-col>
</div>-->
</v-radio-group>
<v-divider></v-divider> <v-divider></v-divider>
</v-col> </v-col>
<v-col cols="12" v-else> <v-col cols="12" v-else>
@ -969,433 +748,7 @@
> >
</v-form> </v-form>
</v-col> </v-col>
<v-radio-group
:mandatory="false"
v-model="paymentMethod"
v-if="
giftCardProduct &&
cartProductTotalAmt.grandTotal !== 0
"
>
<p class="h3 mb-5">Payment Method</p>
<v-radio
:label="giftCardProductTitle"
:value="giftCardProductCode"
class="black--text"
></v-radio>
<div v-if="paymentMethod === 'braintree'">
<v-row>
<v-col cols="12" sm="8" v-if="this.userAuth">
<v-row v-if="addressLength > 0">
<v-col cols="12">
<v-select
v-model="selectedBillingAddress"
dense
:items="billingAddressList"
outlined
return-object
class="billing-address-select"
@change="changeBillingAddress()"
item-value="id"
>
<template v-slot:selection="data">
<div v-if="data.item.value">
<span class>New Address</span>
</div>
<div
class="
d-inline-block
text-truncate
pt-sm-0
"
v-else
>
<span class
>{{ data.item.firstname }}
{{ data.item.lastname }}</span
>
<span
class="body pl-1"
v-if="data.item.streetNoOne"
>{{ data.item.streetNoOne }},
{{ data.item.streetNoTwo }}</span
>
<span class="body pl-1" v-else
>{{ data.item.street[0] }} ,{{
data.item.street[1]
}}</span
>
<span class="pl-1"
>{{ data.item.city }}
{{ data.item.postcode }}</span
>
</div>
</template>
<template v-slot:item="data">
<v-list-item-content>
<v-list-item-title
v-if="data.item.value"
>
<span class="ml-2">New Address</span>
</v-list-item-title>
<v-list-item-title v-else>
<span class="ml-2"
>{{ data.item.firstname }}
{{ data.item.lastname }},</span
>
<span
class="body"
v-if="data.item.streetNoOne"
>{{ data.item.streetNoOne }},
{{ data.item.streetNoTwo }}</span
>
<span class="body" v-else
>{{ data.item.street[0] }} ,{{
data.item.street[1]
}}</span
>
<span class
>{{ data.item.city }},
{{ data.item.postcode }}</span
>
</v-list-item-title>
</v-list-item-content>
</template>
</v-select>
</v-col>
<v-col
cols="12"
class="d-flex justify-end pa-0"
v-if="!showNewBillingForm"
>
<v-btn
class="primary ma-3 text-uppercase"
@click="cancelBillingAddress"
>Cancel</v-btn
>
<v-btn
class="success ma-3 text-uppercase"
@click="updateBillingAddress"
>Update</v-btn
>
</v-col>
</v-row>
<v-row v-else-if="showNewBillingForm">
<v-col cols="12">
<ShippingAddressFormComponent
@actionValid="checkFormValid"
:hideAndShowFields="hideAndShowFields"
@verifyAddress="verifyAddress"
ref="billingForm"
/>
</v-col>
<v-col cols="12" class="py-0">
<v-checkbox
label="Save in Address Book"
v-model="saveInBillingAddressBook"
class="mt-0"
dense
hide-details
></v-checkbox>
</v-col>
</v-row>
</v-col>
<v-col cols="12" sm="8" v-else>
<GuestShippingAddressForm
@actionValid="checkGuestFormValid"
:hideHeader="true"
:hideEmail="hideEmailFieldGiftCardProduct"
@verifyAddress="verifyAddress"
ref="addressFormGuest"
/>
</v-col>
<v-col
cols="12"
sm="8"
class="d-flex justify-end pa-0"
v-if="showNewBillingForm"
>
<v-btn
class="primary ma-3 text-uppercase"
@click="cancelBillingAddress"
>Cancel</v-btn
>
<v-btn
class="success ma-3 text-uppercase"
@click="newBillingAddress"
>Update</v-btn
>
</v-col>
</v-row>
<v-row>
<CardPayment
@submitCardPayment="submitCardPayment"
/>
<!-- <v-col cols="12" sm="6">
<v-braintree
:authorization="braintreeAuthKey"
:vaultManager="true"
@success="onPaymentSuccess"
@error="onPaymentError"
@load="onGatewayLoad"
@loadFail="onGatewayLoadFail"
>
<template v-slot:button="slotProps">
<v-btn @click="slotProps.submit" color="success">Place Order</v-btn>
</template>
</v-braintree>
</v-col>-->
</v-row>
</div>
<!-- <v-divider class="my-3"></v-divider>
<v-radio
:label="shippingInformations.paymentMethods[0].title"
:value="shippingInformations.paymentMethods[0].code"
class="black--text"
></v-radio>
<div v-if="paymentMethod === 'braintree_paypal'">
<v-col cols="12" sm="12" class="pr-10 pt-10">
<v-btn
id="paypal-button"
tile
class="float-right text-uppercase"
color="primary"
>Continue To Paypal</v-btn>
</v-col>
</div>-->
</v-radio-group>
<v-radio-group
:mandatory="false"
v-model="paymentMethodFree"
v-else-if="
giftCardProduct && cartProductTotalAmt.grandTotal == 0
"
>
<p class="h3 mb-5">Payment Method</p>
<v-radio
:label="giftCardFreeProductTitle"
:value="paymentMethodFree"
class="black--text"
></v-radio>
<div>
<v-checkbox
label="My billing and shipping address are the same"
v-model="sameAddress"
@change="resetFields()"
dense
:readonly="readOnlyCheckBox"
hide-details
></v-checkbox>
<v-row v-if="sameAddress">
<v-col cols="12" class="pl-sm-10">
<BillingAddressComponent :address="address" />
<v-btn
class="primary my-3"
large
v-if="editBillingButton"
@click="editBillBook()"
>Edit</v-btn
>
</v-col>
</v-row>
<v-row v-else>
<v-col cols="12" sm="8" v-if="this.userAuth">
<v-row v-if="addressLength > 0">
<v-col cols="12">
<v-select
v-model="selectedBillingAddress"
dense
:items="billingAddressList"
outlined
return-object
class="billing-address-select"
@change="changeBillingAddress()"
item-value="id"
>
<template v-slot:selection="data">
<div v-if="data.item.value">
<span class>New Address</span>
</div>
<div
class="
d-inline-block
text-truncate
pt-sm-0
"
v-else
>
<span class
>{{ data.item.firstname }}
{{ data.item.lastname }}</span
>
<span
class="body pl-1"
v-if="data.item.streetNoOne"
>{{ data.item.streetNoOne }},
{{ data.item.streetNoTwo }}</span
>
<span class="body pl-1" v-else
>{{ data.item.street[0] }} ,{{
data.item.street[1]
}}</span
>
<span class="pl-1"
>{{ data.item.city }}
{{ data.item.postcode }}</span
>
</div>
</template>
<template v-slot:item="data">
<v-list-item-content>
<v-list-item-title
v-if="data.item.value"
>
<span class="ml-2">New Address</span>
</v-list-item-title>
<v-list-item-title v-else>
<span class="ml-2"
>{{ data.item.firstname }}
{{ data.item.lastname }},</span
>
<span
class="body"
v-if="data.item.streetNoOne"
>{{ data.item.streetNoOne }},
{{ data.item.streetNoTwo }}</span
>
<span class="body" v-else
>{{ data.item.street[0] }} ,{{
data.item.street[1]
}}</span
>
<span class
>{{ data.item.city }},
{{ data.item.postcode }}</span
>
</v-list-item-title>
</v-list-item-content>
</template>
</v-select>
</v-col>
<v-col
cols="12"
class="d-flex justify-end pa-0"
v-if="!showNewBillingForm"
>
<v-btn
class="primary ma-3 text-uppercase"
@click="cancelBillingAddress"
>Cancel</v-btn
>
<v-btn
class="success ma-3 text-uppercase"
@click="updateBillingAddress"
>Update</v-btn
>
</v-col>
</v-row>
<v-row v-if="showNewBillingForm">
<v-col cols="12">
<ShippingAddressFormComponent
@actionValid="checkFormValid"
:hideAndShowFields="hideAndShowFields"
@verifyAddress="verifyAddress"
ref="billingForm"
/>
</v-col>
<v-col cols="12" class="py-0">
<v-checkbox
label="Save in Address Book"
v-model="saveInBillingAddressBook"
class="mt-0"
dense
hide-details
></v-checkbox>
</v-col>
</v-row>
</v-col>
<v-col cols="12" sm="8" v-else>
<GuestShippingAddressForm
@actionValid="checkGuestFormValid"
:hideEmail="hideEmailField"
@verifyAddress="verifyAddress"
ref="addressForm"
/>
</v-col>
<v-col
cols="12"
sm="8"
class="d-flex justify-end pa-0"
v-if="showNewBillingForm"
>
<v-btn
class="primary ma-3 text-uppercase"
@click="cancelBillingAddress"
>Cancel</v-btn
>
<v-btn
class="success ma-3 text-uppercase"
@click="newBillingAddress"
>Update</v-btn
>
</v-col>
</v-row>
<v-row class="pl-3">
<v-col cols="12" align="right">
<v-text-field
v-model="poNumber"
type="text"
dense
placeholder="Purchase Order Number"
outlined
:rules="textRules"
></v-text-field>
</v-col>
<!-- <v-col cols="12" align="right">
<v-btn
class="primary mx-3 text-uppercase"
@click="placeOrderFree()"
tile
depressed
>Place Order</v-btn
>
</v-col>-->
<!-- <v-col cols="12" sm="6">
<v-braintree
:authorization="braintreeAuthKey"
:vaultManager="true"
@success="onPaymentSuccess"
@error="onPaymentError"
@load="onGatewayLoad"
@loadFail="onGatewayLoadFail"
>
<template v-slot:button="slotProps">
<v-btn @click="slotProps.submit" color="success">Place Order</v-btn>
</template>
</v-braintree>
</v-col>-->
</v-row>
</div>
<!-- <v-divider class="my-3"></v-divider>
<v-radio
:label="shippingInformations.paymentMethods[0].title"
:value="shippingInformations.paymentMethods[0].code"
class="black--text"
></v-radio>
<div v-if="paymentMethod === 'braintree_paypal'">
<v-col cols="12" sm="12" class="pr-10 pt-10">
<v-btn
id="paypal-button"
tile
class="float-right text-uppercase"
color="primary"
>Continue To Paypal</v-btn>
</v-col>
</div>-->
</v-radio-group>
<v-divider></v-divider> <v-divider></v-divider>
</v-col> </v-col>
<!-- <v-col cols="12" class="py-0"> <!-- <v-col cols="12" class="py-0">
@ -1852,7 +1205,7 @@ export default {
validLogin: false, validLogin: false,
passwordFields: false, passwordFields: false,
showAlert: false, showAlert: false,
valid: false, valid: true,
validDiscountCode: true, validDiscountCode: true,
chekoutFlag: false, chekoutFlag: false,
tabs: "", tabs: "",
@ -2754,8 +2107,10 @@ export default {
onGatewayLoadFail(instance) { onGatewayLoadFail(instance) {
console.log("load failed", instance); console.log("load failed", instance);
}, },
async placeOrderFree() { async placeOrderFree(e) {
try { try {
e.preventDefault();
if (this.$refs.poNumberForm.validate()) {
this.isPageLoader = true; this.isPageLoader = true;
if (this.userAuth) { if (this.userAuth) {
try { try {
@ -2773,101 +2128,9 @@ export default {
timeout: 5000, timeout: 5000,
}; };
} }
} else { }
try { }
let res = await this.$store.dispatch("guestInfo/setOrder", {
userEmail: this.email,
paymentMethod: {
method: this.freePaymentMethod,
},
});
await this.$store.dispatch("guestInfo/setPaymentInProgress", true);
if (res) {
try {
let resp = await this.$store.dispatch(
"meProductOne/fetchOrderProduct",
res
);
if (resp && resp.items) {
/*googleAanalyticsCheckout("checkout_progress", {
items: resp.items,
});
googleAanalyticsCheckout("set_checkout_option", {
checkout_step: 1,
checkout_option: "payment",
});*/
googleAanalyticsCheckoutAddPaymentInfo(
"add_payment_info",
resp
);
googleAanalyticsPurchase(resp, resp.incrementId);
let shippingAddress = [];
let ccid = "";
let webOrderNumber = resp.incrementId;
let magentoOrderNumber = res;
for (let i = 0; resp.items.length > i; i++) {
let obj = resp.items[i];
if (obj.extensionAttributes) {
ccid = obj.extensionAttributes.ccid;
if (ccid) {
shippingAddress =
resp.extensionAttributes.shippingAssignments[0]
.shipping.address;
try {
let response = await this.$store.dispatch(
"accountOne/setCCOrder",
{
orderNumber: ccid,
shippingAddress: shippingAddress,
webOrderNumber: webOrderNumber,
estimatedShipping: this.estimatedShipping,
}
);
} catch (error) {
console.log(error);
}
}
if (obj.extensionAttributes.personalizeDetails) {
await this.placeCraneOrder(
resp,
obj,
webOrderNumber,
magentoOrderNumber
);
}
}
}
}
} catch (error) {
await this.$store.dispatch(
"accountOne/setPaymentInProgress",
false
);
this.isPageLoader = false;
this.snackbar = {
message: error,
color: "error",
show: true,
timeout: 5000,
};
}
}
await this.$store.dispatch("guestInfo/setPaymentInProgress", false);
this.$router.push({
name: "OrderSuccess",
params: { orderNumber: res },
});
} catch (error) {
this.isPageLoader = false;
this.snackbar = {
message: error.message,
color: "error",
show: true,
timeout: 5000,
};
}
}
} catch (error) {} } catch (error) {}
}, },
async submitCardPayment(payment) { async submitCardPayment(payment) {