added promo. fixed bugs
This commit is contained in:
@@ -92,7 +92,6 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
@@ -143,13 +142,52 @@
|
||||
</div>
|
||||
|
||||
<div class="grid grid-cols-12 mb-5">
|
||||
|
||||
<div class="col-span-12 pt-3 font-bold">
|
||||
Price / Gallon:
|
||||
Payment Type:
|
||||
</div>
|
||||
<div class="col-span-12 text-gray-500">
|
||||
{{ delivery.customer_price }}
|
||||
<div class="col-span-12 text-gray-500" v-if="delivery.payment_type == 0">
|
||||
Cash
|
||||
</div>
|
||||
<div class="col-span-12 text-gray-500" v-if="delivery.payment_type == 1">
|
||||
Credit Card
|
||||
</div>
|
||||
<div class="col-span-12 text-gray-500" v-if="delivery.payment_type == 2">
|
||||
Credit Card / Cash
|
||||
</div>
|
||||
<div class="col-span-12 text-gray-500" v-if="delivery.payment_type == 3">
|
||||
Check with CC Hold
|
||||
</div>
|
||||
<div class="col-span-12 text-gray-500" v-if="delivery.payment_type == 4">
|
||||
Other (Rent, etc):
|
||||
</div>
|
||||
<div v-if="promo_active">
|
||||
<div class="col-span-12 pt-3 font-bold">
|
||||
Promo
|
||||
</div>
|
||||
|
||||
<div class="col-span-12 text-gray-500">
|
||||
{{ promo.name_of_promotion }}
|
||||
</div>
|
||||
<div class="col-span-12 pt-3 font-bold">
|
||||
Promo Discount:
|
||||
</div>
|
||||
<div class="col-span-12 text-gray-500">
|
||||
{{ promo.money_off_delivery }} off a gallon
|
||||
</div>
|
||||
<div class="col-span-12 text-gray-500">
|
||||
{{ discount }} off total delivery
|
||||
</div>
|
||||
<div class="col-span-12 text-gray-500">
|
||||
{{ total_amount_after_discount }} total price after discount
|
||||
</div>
|
||||
<div class="col-span-12 pt-3 font-bold">
|
||||
Price / Gallon:
|
||||
</div>
|
||||
<div class="col-span-12 text-gray-500">
|
||||
{{ delivery.customer_price }} ({{ delivery.customer_price - promo.money_off_delivery}})
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="col-span-12 pt-3 font-bold">
|
||||
@@ -171,6 +209,30 @@
|
||||
Same Day: {{ pricing.price_same_day }}
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-span-12 py-3" v-if="delivery.promo_id != 0">
|
||||
<div class="col-span-12 font-bold py-5 " v-if="delivery.payment_type == 0">
|
||||
<div class="">
|
||||
CASH Total: ${{ total_amount_after_discount }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-span-12 font-bold py-5 text-accent" v-if="delivery.payment_type == 1">
|
||||
<div class="">
|
||||
Pre Charge Credit Card Total: ${{ total_amount_after_discount }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-span-12 font-bold py-5 text-accent" v-if="delivery.payment_type == 2">
|
||||
<div class="">
|
||||
Pre Charge Credit Card Total: ${{ total_amount_after_discount }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-span-12 font-bold py-5 text-accent" v-if="delivery.payment_type == 3">
|
||||
<div class="">
|
||||
Check - Pre Charge Credit Card Total: ${{ total_amount_after_discount }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-span-12 py-3" v-else>
|
||||
<div class="col-span-12 font-bold py-5 " v-if="delivery.payment_type == 0">
|
||||
<div class="">
|
||||
CASH Total: ${{ total_amount }}
|
||||
@@ -192,10 +254,11 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="flex justify-between">
|
||||
<!-- <button class="btn" @click="checkoutOilCreditStripe()">-->
|
||||
<!-- Pay Credit Card (Stripe)-->
|
||||
<!-- </button>-->
|
||||
|
||||
<div class="" v-if="delivery.payment_type == 0">
|
||||
<button class="btn btn-accent btn-sm" @click="checkoutOilUpdatePayment(0)">
|
||||
Confirm Cash Payment
|
||||
@@ -282,6 +345,7 @@ export default defineComponent({
|
||||
customer_temperature: 0,
|
||||
dispatcher_notes: '',
|
||||
prime: 0,
|
||||
promo_id: 0,
|
||||
emergency: 0,
|
||||
same_day: 0,
|
||||
payment_type: 0,
|
||||
@@ -332,10 +396,19 @@ export default defineComponent({
|
||||
price_emergency: 0,
|
||||
date: "",
|
||||
},
|
||||
promo_active: false,
|
||||
promo: {
|
||||
name_of_promotion: '',
|
||||
description: '',
|
||||
money_off_delivery: 0,
|
||||
text_on_ticket: ''
|
||||
},
|
||||
priceprime: 0,
|
||||
pricesameday: 0,
|
||||
priceemergency: 0,
|
||||
total_amount: 0,
|
||||
discount: 0,
|
||||
total_amount_after_discount: 0,
|
||||
}
|
||||
},
|
||||
validations() {
|
||||
@@ -361,7 +434,6 @@ export default defineComponent({
|
||||
this.getOilOrder(this.$route.params.id)
|
||||
this.sumdelivery(this.$route.params.id);
|
||||
this.getOilPricing()
|
||||
// this.getStripePublishableKey();
|
||||
|
||||
},
|
||||
|
||||
@@ -379,6 +451,8 @@ export default defineComponent({
|
||||
this.pricesameday = response.data.pricesameday;
|
||||
this.priceemergency = response.data.priceemergency;
|
||||
this.total_amount = response.data.total_amount;
|
||||
this.discount = response.data.discount;
|
||||
this.total_amount_after_discount = response.data.total_amount_after_discount;
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
@@ -389,7 +463,21 @@ export default defineComponent({
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
getPromo(promo_id: any) {
|
||||
let path = import.meta.env.VITE_BASE_URL + "/promo/" + promo_id;
|
||||
axios({
|
||||
method: "get",
|
||||
url: path,
|
||||
withCredentials: true,
|
||||
headers: authHeader(),
|
||||
})
|
||||
.then((response: any) => {
|
||||
if (response.data) {
|
||||
this.promo = response.data
|
||||
|
||||
}
|
||||
})
|
||||
},
|
||||
userStatus() {
|
||||
let path = import.meta.env.VITE_BASE_URL + '/auth/whoami';
|
||||
axios({
|
||||
@@ -414,9 +502,6 @@ export default defineComponent({
|
||||
})
|
||||
.then((response: any) => {
|
||||
this.pricing = response.data;
|
||||
|
||||
|
||||
|
||||
})
|
||||
.catch(() => {
|
||||
notify({
|
||||
@@ -437,7 +522,10 @@ export default defineComponent({
|
||||
this.delivery = response.data;
|
||||
this.getCustomer(this.delivery.customer_id)
|
||||
this.getCreditCards(this.delivery.customer_id)
|
||||
|
||||
if (this.delivery.promo_id != null) {
|
||||
this.getPromo(this.delivery.promo_id);
|
||||
this.promo_active = true;
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
notify({
|
||||
@@ -468,31 +556,6 @@ export default defineComponent({
|
||||
this.customer = response.data
|
||||
})
|
||||
},
|
||||
|
||||
checkoutOilUpdateCreditStripe() {
|
||||
let path = import.meta.env.VITE_BASE_URL + "/delivery/cash/" + this.delivery.id + '/2';
|
||||
axios({
|
||||
method: "PUT",
|
||||
url: path,
|
||||
})
|
||||
.then((response: any) => {
|
||||
if (response.data.ok) {
|
||||
notify({
|
||||
title: "Success",
|
||||
text: "marked payment as STRIPE credit card",
|
||||
type: "error",
|
||||
});
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
notify({
|
||||
title: "Error",
|
||||
text: "Could not update with credit card",
|
||||
type: "error",
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
checkoutOilUpdatePayment(payment_type: number) {
|
||||
let path = import.meta.env.VITE_BASE_URL + "/delivery/cash/" + this.delivery.id + '/' + payment_type;
|
||||
axios({
|
||||
@@ -542,45 +605,7 @@ export default defineComponent({
|
||||
});
|
||||
},
|
||||
|
||||
// checkoutOilCreditStripe() {
|
||||
//
|
||||
// let path = import.meta.env.VITE_PAY_URL + "/pay/charge";
|
||||
// axios({
|
||||
// method: "get",
|
||||
// url: path,
|
||||
// })
|
||||
// .then((response: any) => {
|
||||
// this.checkoutOilUpdateCreditStripe();
|
||||
// // Redirect to Stripe Checkout
|
||||
// return this.stripe.redirectToCheckout({sessionId: response.data.sessionId});
|
||||
// })
|
||||
// .catch(() => {
|
||||
// notify({
|
||||
// title: "Error",
|
||||
// text: "Could not find customer",
|
||||
// type: "error",
|
||||
// });
|
||||
// });
|
||||
// },
|
||||
|
||||
// getStripePublishableKey() {
|
||||
// let path = import.meta.env.VITE_PAY_URL + "/pay/config";
|
||||
// axios({
|
||||
// method: "get",
|
||||
// url: path,
|
||||
// })
|
||||
// .then((response: any) => {
|
||||
// this.stripe = Stripe(response.data.publicKey);
|
||||
// })
|
||||
// .catch(() => {
|
||||
// notify({
|
||||
// title: "Error",
|
||||
// text: "Could not find customer",
|
||||
// type: "error",
|
||||
// });
|
||||
// });
|
||||
// },
|
||||
//
|
||||
|
||||
|
||||
},
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user