|
|
@ -1,120 +1,54 @@ |
|
|
|
import { useState } from "react"; |
|
|
|
import React, { Component } from "react"; |
|
|
|
import { userFactor } from "../../Redux/actions"; |
|
|
|
|
|
|
|
import { connect } from "react-redux"; |
|
|
|
import { connect } from "react-redux"; |
|
|
|
import Navbar from "../Home/Navbar"; |
|
|
|
import Navbar from "../Home/Navbar"; |
|
|
|
|
|
|
|
import { userFactor } from "~/Redux/actions"; |
|
|
|
|
|
|
|
import "./index.css"; |
|
|
|
import './index.css'; |
|
|
|
import moment from "jalali-moment"; |
|
|
|
|
|
|
|
const grades = [ |
|
|
|
const Orders=(props)=>{ |
|
|
|
"پیش دبستان", |
|
|
|
// const [data, set_data] = useState([
|
|
|
|
"اول", |
|
|
|
// {
|
|
|
|
"دوم", |
|
|
|
// id: "12345",
|
|
|
|
"سوم", |
|
|
|
// transactionId: "43448y35",
|
|
|
|
"چهارم", |
|
|
|
// payedAt: "1400/06/24",
|
|
|
|
"پنجم", |
|
|
|
// condition: 1,
|
|
|
|
"ششم", |
|
|
|
// payPrice: 2500000,
|
|
|
|
"هفتم", |
|
|
|
// offPrice: 10000,
|
|
|
|
"هشتم", |
|
|
|
// description: "",
|
|
|
|
"نهم", |
|
|
|
// products: [
|
|
|
|
"دهم", |
|
|
|
// {
|
|
|
|
"یازدهم", |
|
|
|
// id: 1,
|
|
|
|
"دوازدهم", |
|
|
|
// ARId: "",
|
|
|
|
]; |
|
|
|
// book: {
|
|
|
|
class Orders extends Component { |
|
|
|
// name: "",
|
|
|
|
componentDidMount() { |
|
|
|
// fileId: "",
|
|
|
|
console.log(this.props); |
|
|
|
// },
|
|
|
|
if (!this.props.list) this.props.getList(); |
|
|
|
// },
|
|
|
|
} |
|
|
|
// {
|
|
|
|
render() { |
|
|
|
// id: 2,
|
|
|
|
// props.getList();
|
|
|
|
// ARId: "",
|
|
|
|
let data = this.props.list; |
|
|
|
// book: {
|
|
|
|
console.log(data); |
|
|
|
// name: "",
|
|
|
|
|
|
|
|
// fileId: "",
|
|
|
|
|
|
|
|
// },
|
|
|
|
|
|
|
|
// },
|
|
|
|
|
|
|
|
// ],
|
|
|
|
|
|
|
|
// },
|
|
|
|
|
|
|
|
// {
|
|
|
|
|
|
|
|
// id: "45679f",
|
|
|
|
|
|
|
|
// transactionId: "43448y35",
|
|
|
|
|
|
|
|
// payedAt: "1400/06/24",
|
|
|
|
|
|
|
|
// condition: 2,
|
|
|
|
|
|
|
|
// payPrice: 2500000,
|
|
|
|
|
|
|
|
// offPrice: 0,
|
|
|
|
|
|
|
|
// description: "",
|
|
|
|
|
|
|
|
// products: [
|
|
|
|
|
|
|
|
// {
|
|
|
|
|
|
|
|
// id: '1',
|
|
|
|
|
|
|
|
// ARId: "",
|
|
|
|
|
|
|
|
// book: {
|
|
|
|
|
|
|
|
// name: "",
|
|
|
|
|
|
|
|
// fileId: "",
|
|
|
|
|
|
|
|
// },
|
|
|
|
|
|
|
|
// },
|
|
|
|
|
|
|
|
// {
|
|
|
|
|
|
|
|
// id: 2,
|
|
|
|
|
|
|
|
// ARId: "",
|
|
|
|
|
|
|
|
// book: {
|
|
|
|
|
|
|
|
// name: "",
|
|
|
|
|
|
|
|
// fileId: "",
|
|
|
|
|
|
|
|
// },
|
|
|
|
|
|
|
|
// },
|
|
|
|
|
|
|
|
// ],
|
|
|
|
|
|
|
|
// },
|
|
|
|
|
|
|
|
// {
|
|
|
|
|
|
|
|
// id: "509685f",
|
|
|
|
|
|
|
|
// transactionId: "43448y35",
|
|
|
|
|
|
|
|
// payedAt: "1400/06/24",
|
|
|
|
|
|
|
|
// condition: 3,
|
|
|
|
|
|
|
|
// payPrice: 2500000,
|
|
|
|
|
|
|
|
// offPrice: 10000,
|
|
|
|
|
|
|
|
// description: "",
|
|
|
|
|
|
|
|
// products: [
|
|
|
|
|
|
|
|
// {
|
|
|
|
|
|
|
|
// id: 1,
|
|
|
|
|
|
|
|
// ARId: "",
|
|
|
|
|
|
|
|
// book: {
|
|
|
|
|
|
|
|
// name: "",
|
|
|
|
|
|
|
|
// fileId: "",
|
|
|
|
|
|
|
|
// },
|
|
|
|
|
|
|
|
// },
|
|
|
|
|
|
|
|
// {
|
|
|
|
|
|
|
|
// id: 2,
|
|
|
|
|
|
|
|
// ARId: "",
|
|
|
|
|
|
|
|
// book: {
|
|
|
|
|
|
|
|
// name: "",
|
|
|
|
|
|
|
|
// fileId: "",
|
|
|
|
|
|
|
|
// },
|
|
|
|
|
|
|
|
// },
|
|
|
|
|
|
|
|
// ],
|
|
|
|
|
|
|
|
// },
|
|
|
|
|
|
|
|
// ]);
|
|
|
|
|
|
|
|
props.getList(); |
|
|
|
|
|
|
|
let data = props.list; |
|
|
|
|
|
|
|
return ( |
|
|
|
return ( |
|
|
|
<div className="order"> |
|
|
|
<div className="order"> |
|
|
|
<Navbar /> |
|
|
|
<Navbar /> |
|
|
|
<div className="order-title">سفارشات من</div> |
|
|
|
<div className="order-title" align="center"> |
|
|
|
|
|
|
|
سفارشات من |
|
|
|
|
|
|
|
</div> |
|
|
|
<div className="order-data-container"> |
|
|
|
<div className="order-data-container"> |
|
|
|
{data != null && |
|
|
|
{data != null && |
|
|
|
data.map((item) => ( |
|
|
|
data.map((item, i) => ( |
|
|
|
<div className="order-data-container-item"> |
|
|
|
<div key={i} className="order-data-container-item"> |
|
|
|
<div className="order-data-container-item-row1"> |
|
|
|
<div className="order-data-container-item-row1"> |
|
|
|
<div className="order-data-container-item-row1-order-id"> |
|
|
|
<div className="order-data-container-item-row1-order-id"> |
|
|
|
شناسه سفارش: <span>{item.id}</span> |
|
|
|
شناسه سفارش: <span>{item.id}</span> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div className="order-data-container-item-row1-order-status"> |
|
|
|
<div className="order-data-container-item-row1-order-status"> |
|
|
|
<div |
|
|
|
<div |
|
|
|
style={ |
|
|
|
style={{ |
|
|
|
item.condition == 1 |
|
|
|
backgroundColor: [0, "#11FA2F", "#11FADB", "#FA3011"][ |
|
|
|
? { backgroundColor: "#11FA2F" } |
|
|
|
item.condition |
|
|
|
: item.condition == 2 |
|
|
|
], |
|
|
|
? { backgroundColor: "#11FADB" } |
|
|
|
}} |
|
|
|
: item.condition == 3 |
|
|
|
|
|
|
|
? { backgroundColor: "#FA3011" } |
|
|
|
|
|
|
|
: null |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
className="order-data-container-item-row1-order-status-circle" |
|
|
|
className="order-data-container-item-row1-order-status-circle" |
|
|
|
></div> |
|
|
|
></div> |
|
|
|
<div |
|
|
|
<div |
|
|
@ -140,30 +74,47 @@ const Orders=(props)=>{ |
|
|
|
شناسه پرداخت : <span>{item.transactionId}</span> |
|
|
|
شناسه پرداخت : <span>{item.transactionId}</span> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div className="order-data-container-item-row2-order-date"> |
|
|
|
<div className="order-data-container-item-row2-order-date"> |
|
|
|
تاریخ سفارش : <span>{item.payedAt}</span> |
|
|
|
<span> |
|
|
|
|
|
|
|
{moment(item.payedAt).format("jYYYY/jMM/jDD hh:mm")} |
|
|
|
|
|
|
|
</span> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div className="order-data-container-item-row3"> |
|
|
|
|
|
|
|
<div className="order-data-container-item-row3-order-price"> |
|
|
|
<div className="order-data-container-item-row3 d-flex"> |
|
|
|
|
|
|
|
<div className="order-data-container-item-row3-order-price "> |
|
|
|
مبلغ : <span>{item.payPrice}</span>{" "} |
|
|
|
مبلغ : <span>{item.payPrice}</span>{" "} |
|
|
|
<span className="odcir2op-unit">تومان</span> |
|
|
|
<span className="odcir2op-unit">تومان</span> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
{item.offCodePrice != 0 && ( |
|
|
|
{item.offCodePrice != 0 && ( |
|
|
|
<div className="order-data-container-item-row3-order-offcodeprice"> |
|
|
|
<div className="order-data-container-item-row3-order-offcodeprice"> |
|
|
|
میزان تخفیف : <span>{item.offPrice}</span>{" "} |
|
|
|
تخفیف : <span>{item.offPrice}</span>{" "} |
|
|
|
<span className="odcir2oo-unit">تومان</span> |
|
|
|
<span className="odcir2oo-unit">تومان</span> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
)} |
|
|
|
)} |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div className="order-data-container-item-row4"> |
|
|
|
<div className="order-data-container-item-row4"> |
|
|
|
<div className="order-data-container-item-row4-imgs"> |
|
|
|
<div className="order-data-container-item-row4-imgs"> |
|
|
|
{item.products.map((item) => ( |
|
|
|
{item.products.map((item, i) => ( |
|
|
|
<div className="order-data-container-item-row4-imgs-container"> |
|
|
|
<div |
|
|
|
|
|
|
|
key={i} |
|
|
|
|
|
|
|
className="order-data-container-item-row4-imgs-container" |
|
|
|
|
|
|
|
> |
|
|
|
<img |
|
|
|
<img |
|
|
|
className="order-data-container-item-row4-imgs-img" |
|
|
|
className="order-data-container-item-row4-imgs-img" |
|
|
|
src={`https://dnvn.ir/api/v1/file/${item.book.fileIds.split(",")[0]}`} |
|
|
|
src={`https://dnvn.ir/api/v1/file/${ |
|
|
|
alt="order-img" |
|
|
|
item.book.fileIds.split(",")[0] |
|
|
|
|
|
|
|
}`}
|
|
|
|
|
|
|
|
alt="" |
|
|
|
/> |
|
|
|
/> |
|
|
|
|
|
|
|
<div style={{ height: 0 }}> |
|
|
|
|
|
|
|
<div className="order-data-container-item-row4-imgs-img-count"> |
|
|
|
|
|
|
|
{item.count}{" "} |
|
|
|
|
|
|
|
<span style={{ fontSize: "12px" }}>×</span> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
<div style={{ fontSize: "10px" }} align="center"> |
|
|
|
|
|
|
|
{`${item.book.name} ${grades[item.book.gradeId]}`} |
|
|
|
|
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
))} |
|
|
|
))} |
|
|
|
</div> |
|
|
|
</div> |
|
|
@ -176,22 +127,13 @@ const Orders=(props)=>{ |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const mapStateToPropS = state =>{ |
|
|
|
|
|
|
|
return{ |
|
|
|
|
|
|
|
list:state.list |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
export default connect( |
|
|
|
const mapDispatchToProps = dispatch =>{ |
|
|
|
(state) => ({ |
|
|
|
return{ |
|
|
|
list: state.userFactor.list, |
|
|
|
getList:()=> dispatch(userFactor.list()) |
|
|
|
}), |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
getList: userFactor.list, |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
)(Orders); |
|
|
|
|
|
|
|
|
|
|
|
export default connect(mapStateToPropS, mapDispatchToProps)(Orders); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|