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
/dist
# local env files
.env.local
.env.*.local
@ -10,6 +11,7 @@ node_modules
npm-debug.log*
yarn-debug.log*
yarn-error.log*
git_info.json
# Editor directories and files
.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 }}
</p>
</v-row>
<v-row>
<p
class="fontsize-14 text-uppercase"
v-show="cartProductPage"
>
UPC {{ product.customAttributes.upc }}
</p>
</v-row>
<v-row>
<p class="fontsize-14">
${{ priceFormatter(product.price) }}

View File

@ -109,7 +109,7 @@
sm="12"
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
}}</v-alert>
</v-col>

View File

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

View File

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

View File

@ -17,6 +17,7 @@
details will be made available when the shipping carrier has processed
your package.
</div>
<iframe
class="my-5"
:src="url"
@ -30,11 +31,29 @@ export default {
name: "PersonalizedOrderSummaryPage",
data() {
return {
url: "https://orderexplorer.crane.com//OrderExplorer/?account=customer",
url: "https://orderexplorer.crane.com/OrderExplorer/?account=customer",
frameHeight: "800px",
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>

View File

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

View File

@ -700,15 +700,20 @@ export const checkEncodeURI = (str) => {
}
}
export const priceFormatter = (price, pdp) => {
if (price != undefined) {
if (price != undefined) {
price = price.toString();
let decimals = (price.split("."))[1];
if ((!Number(decimals) || isNaN(decimals)) || decimals.length == 1) //if 2 or 2.1
return Number(price).toFixed(2);
if (decimals.length == 2 && pdp) //if 2 or 2.1
return price;
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 }) => {
try {
/* eslint-disable */
commit('inProgress', true);
const token = await doLogin(state.one);
if (token) {
commit('loginSuccess', {token:token,logged:state.one.logged});
dispatch('userCartProduct/checkUserToken', {}, { root: true });
@ -80,6 +83,11 @@ export const auth = {
redirectToInterruptedPage();
return true;
}
else{
commit('loginFailure', "Email id or password is incorrect");
commit('inProgress', false);
}
} catch (err) {
commit('inProgress', false);
commit('prepareWithMessage');

View File

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

View File

@ -16,7 +16,7 @@ import {
doFetchGiftMessage,
doPutCConectionCartItem
} 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 humps from 'lodash-humps';
import { getAuthUser } from '@/services/auth';
@ -186,66 +186,16 @@ export const userCartProduct = {
})
.catch(() => commit('cartTotalAmtProgress', false))
},
cartProductList: async({ commit, rootState, dispatch }) => {
cartProductList: async({ commit, dispatch }) => {
commit('setCartProductList', []);
commit('cartProductsProgress', true);
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 {
return doFetchQuote().then(async(quoteId) => {
let cartProductList = await doFetchCartProducts(quoteId);
commit('setCartProductDetails', humps(cartProductList))
commit('setCartProductList', humps(cartProductList))
commit('cartProductsProgress', false);
dispatch('productTotalAmt');
}
// }
})
.catch(() => commit('cartProductsProgress', false))
},