Merge branch 'beta' of git.treelet.net:crane/retailer-vue into dev

This commit is contained in:
anju j 2022-01-28 17:32:56 +05:30
commit defccce142
13 changed files with 92 additions and 80 deletions

2
.gitignore vendored
View File

@ -2,6 +2,7 @@
node_modules node_modules
/dist /dist
# local env files # local env files
.env.local .env.local
.env.*.local .env.*.local
@ -10,6 +11,7 @@ node_modules
npm-debug.log* npm-debug.log*
yarn-debug.log* yarn-debug.log*
yarn-error.log* yarn-error.log*
git_info.json
# Editor directories and files # Editor directories and files
.idea .idea

View File

@ -1 +1 @@
{"branch_name":"dev","last_commit_date":"2022-01-24T12:54:49.000Z","last_commit_author":"rakesh","last_commit_hash":"4ffb843e46532353dd9a1963aa9f3f079c2ebed2"} {"branch_name":"dev","last_commit_date":"2022-01-28T11:20:43.000Z","last_commit_author":"anju j","last_commit_hash":"5c28f2497848f94839ca29240c484e0a47d538ca"}

File diff suppressed because one or more lines are too long

View File

@ -310,6 +310,14 @@
Sku {{ product.sku }} Sku {{ product.sku }}
</p> </p>
</v-row> </v-row>
<v-row>
<p
class="fontsize-14 text-uppercase"
v-show="cartProductPage"
>
UPC {{ product.customAttributes.upc }}
</p>
</v-row>
<v-row> <v-row>
<p class="fontsize-14"> <p class="fontsize-14">
${{ priceFormatter(product.price) }} ${{ priceFormatter(product.price) }}

View File

@ -109,7 +109,7 @@
sm="12" sm="12"
cols="12" v-else> cols="12" v-else>
<v-alert type="error" text class="font-weight-300 body-font h3">{{ <v-alert small class="ma-0 pa-0" type="error" text >{{
noProducts noProducts
}}</v-alert> }}</v-alert>
</v-col> </v-col>

View File

@ -27,6 +27,7 @@
v-model="searchData" v-model="searchData"
v-on="on" v-on="on"
@input="searchProducts" @input="searchProducts"
hide-details
> >
</v-text-field> </v-text-field>
</template> </template>
@ -110,7 +111,8 @@
<v-col cols="12"> <v-col cols="12">
<p class="float-left pb-0 mb-0">Shipping</p> <p class="float-left pb-0 mb-0">Shipping</p>
<p class="float-right pb-0 mb-0"> <p class="float-right pb-0 mb-0">
${{ priceFormatter(cartProductTotalAmt.baseShippingAmount) }} <!-- ${{ priceFormatter(cartProductTotalAmt.baseShippingAmount) }}-->
TBD
</p> </p>
</v-col> </v-col>
<v-col <v-col

View File

@ -292,7 +292,7 @@
</v-col> </v-col>
<v-col cols="12" class="mt-3" v-if="!addressContainPOBox"> <v-col cols="12" class="mt-3" v-if="!addressContainPOBox">
<div> <div>
<p class="h3 mb-1"> <!--<p class="h3 mb-1">
<span class="primary--text">Verify Your Address</span> <span class="primary--text">Verify Your Address</span>
</p> </p>
<v-col class="pa-0" v-if="geoCodedAddress"> <v-col class="pa-0" v-if="geoCodedAddress">
@ -316,7 +316,7 @@
<v-alert type="error" class="my-2" text <v-alert type="error" class="my-2" text
>No Address is available</v-alert >No Address is available</v-alert
> >
</v-col> </v-col>-->
<p class="h3 mb-0"> <p class="h3 mb-0">
<span class="primary--text">Shipping Methods</span> <span class="primary--text">Shipping Methods</span>
</p> </p>
@ -358,8 +358,9 @@
method.methodTitle method.methodTitle
}}</v-col> }}</v-col>
<v-col cols="4" sm="2" class="text-right" <v-col cols="4" sm="2" class="text-right"
>${{ priceFormatter(method.amount) }}</v-col > {{ priceFormatter(method.amount) ==0 ? 'TBD' : '$' + priceFormatter(method.amount)}}</v-col
> >
</v-row> </v-row>
</div> </div>
</v-radio-group> </v-radio-group>
@ -464,8 +465,8 @@
v-if="shippingInformations.totals.grandTotal !== 0" v-if="shippingInformations.totals.grandTotal !== 0"
> >
<v-radio <v-radio
:label="shippingInformations.paymentMethods[1].title" :label="purchaseOrderPayment.title"
:value="shippingInformations.paymentMethods[1].code" :value="purchaseOrderPayment.code"
class="black--text" class="black--text"
></v-radio> ></v-radio>
<div v-if="paymentMethod === 'purchaseorder'"> <div v-if="paymentMethod === 'purchaseorder'">
@ -1493,6 +1494,14 @@ export default {
countryAndStatesList() { countryAndStatesList() {
return this.$store.state.accountOne.allCountries; return this.$store.state.accountOne.allCountries;
}, },
purchaseOrderPayment() {
let paymentMethods=this.shippingInformations.paymentMethods;
return paymentMethods.filter(method=>method.code==="purchaseorder")[0]
},
// freePayment() {
// let paymentMethods=this.shippingInformations.paymentMethods;
// return paymentMethods.filter(method=>method.code==="free")[0]
// },
}, },
methods: { methods: {
checkProductType() { checkProductType() {
@ -1864,12 +1873,12 @@ export default {
this.selectedAddressId = ""; this.selectedAddressId = "";
this.$store.dispatch("accountOne/setLocalShippAddress", address); this.$store.dispatch("accountOne/setLocalShippAddress", address);
} }
this.verifyAddress(); // this.verifyAddress();
this.$store.dispatch("accountOne/setSelectedShippAddressIndex", index); this.$store.dispatch("accountOne/setSelectedShippAddressIndex", index);
// this.verifyAddress(); this.verifyAddress();
}, },
async verifyAddress() { async verifyAddress() {
let vm = this; let vm = this;
try { try {
if ( if (
vm.address.regionId && vm.address.regionId &&
@ -1892,7 +1901,7 @@ export default {
}); });
stateName = stateName ? stateName[0].label : ""; stateName = stateName ? stateName[0].label : "";
let response = await vm.$store.dispatch( /* let response = await vm.$store.dispatch(
"accountOne/validateAddressCheckout", "accountOne/validateAddressCheckout",
{ address: vm.addressFields, stateName: stateName } { address: vm.addressFields, stateName: stateName }
); );
@ -1906,7 +1915,7 @@ export default {
vm.geoCodedAddressFlag = true; vm.geoCodedAddressFlag = true;
vm.validAddresses = response[0]; vm.validAddresses = response[0];
} }
} }*/
if (vm.userAuth) { if (vm.userAuth) {
await vm.$store.dispatch("accountOne/setEstimatedShipping"); await vm.$store.dispatch("accountOne/setEstimatedShipping");
} else if (vm.guestQuoteId) { } else if (vm.guestQuoteId) {

View File

@ -17,6 +17,7 @@
details will be made available when the shipping carrier has processed details will be made available when the shipping carrier has processed
your package. your package.
</div> </div>
<iframe <iframe
class="my-5" class="my-5"
:src="url" :src="url"
@ -30,11 +31,29 @@ export default {
name: "PersonalizedOrderSummaryPage", name: "PersonalizedOrderSummaryPage",
data() { data() {
return { return {
url: "https://orderexplorer.crane.com//OrderExplorer/?account=customer", url: "https://orderexplorer.crane.com/OrderExplorer/?account=customer",
frameHeight: "800px", frameHeight: "800px",
frameWidth: "100%", frameWidth: "100%",
}; };
}, },
computed: {
customerNumber() {
return this.$store.state.accountOne.customerNumber
},
},
watch: {
customerNumber() {
this.url =
"https://orderexplorer.crane.com/OrderExplorer/?account=" +
this.customerNumber;
},
},
mounted() {
if (this.customerNumber)
this.url =
"https://orderexplorer.crane.com/OrderExplorer/?account=" +
this.customerNumber;
},
}; };
</script> </script>

View File

@ -9,17 +9,20 @@ const vueMaintenanceMode = process.env.VUE_APP_MAINTENANCE_MODE;
const loginInterrupt = function(current_url, message) { const loginInterrupt = function(current_url, message) {
sessionStorage.cinterrupted_page = current_url; if(!current_url.includes("gate/sign-in"))
sessionStorage.cinterrupt_message = message; sessionStorage.crinterrupted_page = current_url;
sessionStorage.crinterrupt_message = message;
if(!current_url.includes("gate/sign-in"))
window.location.href = loginUrl; window.location.href = loginUrl;
} }
const redirectToInterruptedPage = function() { const redirectToInterruptedPage = function() {
//sessionStorage.cinterrupted_page.clear(); //sessionStorage.crinterrupted_page.clear();
const url = sessionStorage.cinterrupted_page; const url = sessionStorage.crinterrupted_page;
if (url) { if (url) {
window.location.href = url; window.location.href = url;
sessionStorage.removeItem("cinterrupted_page"); sessionStorage.removeItem("crinterrupted_page");
} }
//window.location.href = homeUrl; //window.location.href = homeUrl;
else else

View File

@ -700,15 +700,20 @@ export const checkEncodeURI = (str) => {
} }
} }
export const priceFormatter = (price, pdp) => { export const priceFormatter = (price, pdp) => {
if (price != undefined) { if (price != undefined) {
price = price.toString(); price = price.toString();
let decimals = (price.split("."))[1]; let decimals = (price.split("."))[1];
if ((!Number(decimals) || isNaN(decimals)) || decimals.length == 1) //if 2 or 2.1 if ((!Number(decimals) || isNaN(decimals)) || decimals.length == 1) //if 2 or 2.1
return Number(price).toFixed(2); return Number(price).toFixed(2);
if (decimals.length == 2 && pdp) //if 2 or 2.1 if (decimals.length == 2 && pdp) //if 2 or 2.1
return price; return price;
else if (decimals.length > 1) // if 2.34 or 2.56565 else if (decimals.length > 1) // if 2.34 or 2.56565
return Number(price.match(/^-?\d+(?:\.\d{0,2})?/)[0]); {
return price.toString().match(/^-?\d+(?:\.\d{0,2})?/)[0]
}
// if 2.34 or 2.56565
// return Number(price.match(/^-?\d+(?:\.\d{0,4})?/)[0]);
} }
} }

View File

@ -66,8 +66,11 @@ export const auth = {
}, },
login: async({ commit, state, dispatch }) => { login: async({ commit, state, dispatch }) => {
try { try {
/* eslint-disable */
commit('inProgress', true); commit('inProgress', true);
const token = await doLogin(state.one); const token = await doLogin(state.one);
if (token) { if (token) {
commit('loginSuccess', {token:token,logged:state.one.logged}); commit('loginSuccess', {token:token,logged:state.one.logged});
dispatch('userCartProduct/checkUserToken', {}, { root: true }); dispatch('userCartProduct/checkUserToken', {}, { root: true });
@ -80,6 +83,11 @@ export const auth = {
redirectToInterruptedPage(); redirectToInterruptedPage();
return true; return true;
} }
else{
commit('loginFailure', "Email id or password is incorrect");
commit('inProgress', false);
}
} catch (err) { } catch (err) {
commit('inProgress', false); commit('inProgress', false);
commit('prepareWithMessage'); commit('prepareWithMessage');

View File

@ -4,7 +4,7 @@ import { invalidPoBoxAddress } from '@/services/util.service';
import { doFetchQuote } from '@/services/user_cart.service'; import { doFetchQuote } from '@/services/user_cart.service';
import { getField, updateField } from 'vuex-map-fields'; import { getField, updateField } from 'vuex-map-fields';
import humps from 'lodash-humps'; import humps from 'lodash-humps';
import { criteoUpdateUserEmail ,listrakEmailCapture} from "@/services/util.service"; import { criteoUpdateUserEmail } from "@/services/util.service";
/*eslint-disable*/ /*eslint-disable*/
const addresses = { const addresses = {
@ -59,7 +59,8 @@ export const accountOne = {
wrongPasswordMessage: "", wrongPasswordMessage: "",
shippingInformationsInProgress: false, shippingInformationsInProgress: false,
addressContainPOBox: null, addressContainPOBox: null,
suggestedAddress: {} suggestedAddress: {},
customerNumber:""
}, },
getters: { getters: {
getField, getField,
@ -75,6 +76,11 @@ export const accountOne = {
setOne(state, one) { setOne(state, one) {
criteoUpdateUserEmail(one.email) criteoUpdateUserEmail(one.email)
state.one = Object.assign({}, state.one, defaultAddress, one); state.one = Object.assign({}, state.one, defaultAddress, one);
let customerNumber=state.one.customAttributes
.filter((customAttribute)=>customAttribute.attributeCode==="customer_number")[0]
if(customerNumber)
state.customerNumber=customerNumber.value;
state.one.defaultShipping = Number(state.one.defaultShipping); state.one.defaultShipping = Number(state.one.defaultShipping);
state.one.defaultBilling = Number(state.one.defaultBilling); state.one.defaultBilling = Number(state.one.defaultBilling);
}, },
@ -318,9 +324,9 @@ export const accountOne = {
const basicInfo = await doFetchBasicInfo(); const basicInfo = await doFetchBasicInfo();
if (basicInfo) { if (basicInfo) {
commit('setOne', humps(basicInfo)); commit('setOne', humps(basicInfo));
// commit('setAddress', humps(basicInfo.addresses[0]));
commit('setAddresses', { addresses: humps(basicInfo.addresses), addressId: addressId }); commit('setAddresses', { addresses: humps(basicInfo.addresses), addressId: addressId });
listrakEmailCapture(basicInfo.email); // listrakEmailCapture(basicInfo.email);
} }
commit('inProgress', false); commit('inProgress', false);
commit('fetchInProgress', false); commit('fetchInProgress', false);

View File

@ -16,7 +16,7 @@ import {
doFetchGiftMessage, doFetchGiftMessage,
doPutCConectionCartItem doPutCConectionCartItem
} from '@/services/user_cart.service'; } from '@/services/user_cart.service';
import { getCookieByName, removeCookieByName } from '@/services/auth'; // import { getCookieByName, removeCookieByName } from '@/services/auth';
import { getField, updateField } from 'vuex-map-fields'; import { getField, updateField } from 'vuex-map-fields';
import humps from 'lodash-humps'; import humps from 'lodash-humps';
import { getAuthUser } from '@/services/auth'; import { getAuthUser } from '@/services/auth';
@ -186,66 +186,16 @@ export const userCartProduct = {
}) })
.catch(() => commit('cartTotalAmtProgress', false)) .catch(() => commit('cartTotalAmtProgress', false))
}, },
cartProductList: async({ commit, rootState, dispatch }) => { cartProductList: async({ commit, dispatch }) => {
commit('setCartProductList', []); commit('setCartProductList', []);
commit('cartProductsProgress', true); commit('cartProductsProgress', true);
return doFetchQuote().then(async(quoteId) => { return doFetchQuote().then(async(quoteId) => {
let guestQuoteId = getCookieByName("cr_guestQuoteId");
if (guestQuoteId) {
dispatch('cartProduct/cartProductList', guestQuoteId, { root: true }).then(async(response) => {
console.log("response", response)
let guestCartProduct = rootState.cartProduct.cartProductList;
if (guestCartProduct.length > 0) {
for (let i = 0; i < guestCartProduct.length; i++) {
if (guestCartProduct[i].productType == 'configurable') {
await dispatch("addToConfiguredCart", {
sku: guestCartProduct[i].parentSku,
qty: guestCartProduct[i].qty,
typeId: guestCartProduct[i].productType,
optionId: guestCartProduct[i].productOption.attributesInfo[0].optionId,
optionValue: guestCartProduct[i].customAttributes.letter
})
} else if (guestCartProduct[i].productType == 'giftcard') {
await dispatch("addToGiftCart", {
sku: guestCartProduct[i].sku,
qty: guestCartProduct[i].qty,
senderName: guestCartProduct[i].productOption.infoBuyRequest.giftcardSenderName,
senderEmail: guestCartProduct[i].productOption.infoBuyRequest.giftcardSenderEmail,
giftCartDetails: {
recipientName: guestCartProduct[i].productOption.infoBuyRequest.giftcardRecipientName,
recipientEmail: guestCartProduct[i].productOption.infoBuyRequest.giftcardRecipientEmail,
senderMessage: guestCartProduct[i].productOption.infoBuyRequest.giftcardMessage,
giftCardAmt: guestCartProduct[i].productOption.infoBuyRequest.giftcardAmount
}
})
} else {
await dispatch("addToCart", {
sku: guestCartProduct[i].sku,
qty: guestCartProduct[i].qty,
ccid: guestCartProduct[i].ccid ? guestCartProduct[i].ccid : null,
price: guestCartProduct[i].personalizeDetails ? guestCartProduct[i].qty * guestCartProduct[i].price : null,
personalizeDetails: guestCartProduct[i].personalizeDetails ? guestCartProduct[i].personalizeDetails : null,
builderId: guestCartProduct[i].builderId ? guestCartProduct[i].builderId : null,
})
}
}
}
removeCookieByName("cr_guestQuoteId")
const cartProductList = await doFetchCartProducts(quoteId);
commit('setCartProductDetails', humps(cartProductList))
commit('setCartProductList', humps(cartProductList))
commit('cartProductsProgress', false);
dispatch('productTotalAmt');
})
.catch(() => commit('cartProductsProgress', false))
} else {
let cartProductList = await doFetchCartProducts(quoteId); let cartProductList = await doFetchCartProducts(quoteId);
commit('setCartProductDetails', humps(cartProductList)) commit('setCartProductDetails', humps(cartProductList))
commit('setCartProductList', humps(cartProductList)) commit('setCartProductList', humps(cartProductList))
commit('cartProductsProgress', false); commit('cartProductsProgress', false);
dispatch('productTotalAmt'); dispatch('productTotalAmt');
} // }
}) })
.catch(() => commit('cartProductsProgress', false)) .catch(() => commit('cartProductsProgress', false))
}, },