coupon correct

This commit is contained in:
pawan-dot 2024-05-10 17:31:32 +05:30
parent 4ec18b7fb9
commit acf742cd63
4 changed files with 62 additions and 16 deletions

View File

@ -14,7 +14,7 @@ import { cibGmail } from "@coreui/icons";
import { createRoot } from "react-dom/client"; import { createRoot } from "react-dom/client";
const setupAxios = () => { const setupAxios = () => {
// axios.defaults.baseURL = "http://localhost:5000"; //axios.defaults.baseURL = "http://localhost:5000";
axios.defaults.baseURL = "https://api.smellika.com"; axios.defaults.baseURL = "https://api.smellika.com";
axios.defaults.headers = { axios.defaults.headers = {

View File

@ -54,7 +54,7 @@ const AffiliateHistory = () => {
}, },
}) })
.then((response) => { .then((response) => {
// console.log(response.data.message.affiliate_pay_history); console.log(response.data);
setApiData(response.data.message.affiliate_pay_history); setApiData(response.data.message.affiliate_pay_history);
setName(response.data.message.name); setName(response.data.message.name);
setLoading(false); setLoading(false);

View File

@ -43,7 +43,7 @@ const CouponHistory = () => {
const month = monthsMap[monthName]; const month = monthsMap[monthName];
// Create the rearranged date string // Create the rearranged date string
const rearrangedDate = `${day} ${month} ${year}`; const rearrangedDate = `${day}-${month}-${year}`;
return rearrangedDate; return rearrangedDate;
}; };
@ -65,7 +65,6 @@ const CouponHistory = () => {
}, },
}) })
.then((response) => { .then((response) => {
// console.log(response.data.message.coupon_used_history);
setLoading(false); setLoading(false);
setApiData(response.data.message.coupon_used_history); setApiData(response.data.message.coupon_used_history);
setCouponName(response.data.message.coupon_used_history[0].couponCode); setCouponName(response.data.message.coupon_used_history[0].couponCode);
@ -110,11 +109,11 @@ const CouponHistory = () => {
style={{ fontSize: "22px", fontWeight: "bold" }} style={{ fontSize: "22px", fontWeight: "bold" }}
className="fw-bold" className="fw-bold"
> >
Coupon History {couponName} Coupon Claim History:{couponName}
</div> </div>
<div className="page-title-right"> <div className="page-title-right">
<Link to="/affiliate/affiliates"> <Link to="/affiliate/coupons">
<Button <Button
variant="contained" variant="contained"
color="secondary" color="secondary"
@ -178,6 +177,8 @@ const CouponHistory = () => {
<tr> <tr>
<th>Order Id</th> <th>Order Id</th>
<th>User Id</th> <th>User Id</th>
<th>Customer Name</th>
<th>Date</th> <th>Date</th>
<th>Time</th> <th>Time</th>
</tr> </tr>
@ -204,7 +205,9 @@ const CouponHistory = () => {
?.map((item, i) => ( ?.map((item, i) => (
<tr key={i}> <tr key={i}>
<td>{item.orderId}</td> <td>{item.orderId}</td>
<td>{item.userId}</td> <td>{item?.userId?._id}</td>
<td>{item?.userId?.name}</td>
<td>{dateFormat(item.date)}</td> <td>{dateFormat(item.date)}</td>
<td>{moment(item.date).format("HH:mm:ss")}</td> <td>{moment(item.date).format("HH:mm:ss")}</td>
</tr> </tr>

View File

@ -52,7 +52,7 @@ function ViewOrders() {
setLoading(false); setLoading(false);
setOrderId(res.data?.order?.order_id); setOrderId(res.data?.order?.order_id);
setOrderDetails(res.data?.order); setOrderDetails(res.data?.order);
console.log(res.data); console.log("nnnnnnnnnnn", res.data?.order);
// let options = { // let options = {
// Franchisee: res.data?.order?.shippingInfo?.Franchisee?._id, // Franchisee: res.data?.order?.shippingInfo?.Franchisee?._id,
// name: res.data?.order?.shippingInfo?.name, // name: res.data?.order?.shippingInfo?.name,
@ -573,14 +573,57 @@ function ViewOrders() {
</div> </div>
) )
)} )}
<div className="m-0 contents-center mt-3 mb-2"> <div className="row">
<small className="mb-4">Shipping Charge: </small> <div className="col-6 ">
{orderDetails?.shipping_charge} <small className="mb-3">Shipping Charge: </small>{" "}
<br /> {orderDetails?.shipping_charge}
<h6 className="mt-2"> <br />
{" "} {orderDetails?.isCouponUsed && (
Total Order Value: {orderDetails?.total_amount} <h6 className="mt-1 text-success">
</h6>{" "} Coupon_Code:
{orderDetails?.couponUsed?.coupon_code}
</h6>
)}
</div>
<div className="col-6 ">
<h6
className=""
style={{
textDecoration: orderDetails?.isCouponUsed
? "line-through"
: "none",
// color: orderDetails?.isCouponUsed
// ? "red"
// : "inherit",
}}
>
{" "}
Total Amount:
{Number(orderDetails?.total_amount) +
Number(
orderDetails?.couponUsed?.discount_amount
? orderDetails?.couponUsed
?.discount_amount
: 0
)}
</h6>{" "}
{orderDetails?.isCouponUsed && (
<small className="mb-4">
Coupon Discount:
{Number(
orderDetails?.couponUsed?.discount_amount
)}
</small>
)}
<br />
{orderDetails?.isCouponUsed && (
<h6 className="">
{" "}
Total After Discount:
{Number(orderDetails?.total_amount)}
</h6>
)}
</div>
</div> </div>
</div> </div>
</div> </div>