|
|
@ -1,6 +1,6 @@ |
|
|
|
import React, { Component } from "react"; |
|
|
|
import React, { Component } from "react"; |
|
|
|
import { connect } from "react-redux"; |
|
|
|
import { connect } from "react-redux"; |
|
|
|
import { transport, userFactor } from "~/Redux/actions"; |
|
|
|
import { transport, userFactor, publicApi } from "~/Redux/actions"; |
|
|
|
|
|
|
|
|
|
|
|
import Navbar from "../Home/Navbar/index"; |
|
|
|
import Navbar from "../Home/Navbar/index"; |
|
|
|
import Footer from "../Home/Footer/index"; |
|
|
|
import Footer from "../Home/Footer/index"; |
|
|
@ -80,6 +80,9 @@ class Cart extends Component { |
|
|
|
|
|
|
|
|
|
|
|
componentDidMount() { |
|
|
|
componentDidMount() { |
|
|
|
window.scrollTo(0, 0); |
|
|
|
window.scrollTo(0, 0); |
|
|
|
|
|
|
|
this.props.getProvince(); |
|
|
|
|
|
|
|
if (this.props.factorInfo?.provinceId) |
|
|
|
|
|
|
|
this.props.getCity({ provinceId: this.props.factorInfo.provinceId }); |
|
|
|
this.props.getTransportList(); |
|
|
|
this.props.getTransportList(); |
|
|
|
this.props.getFactorInfo({}); |
|
|
|
this.props.getFactorInfo({}); |
|
|
|
} |
|
|
|
} |
|
|
@ -99,7 +102,12 @@ class Cart extends Component { |
|
|
|
})); |
|
|
|
})); |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
onChange(name, value) {} |
|
|
|
onChange(name, value) { |
|
|
|
|
|
|
|
if (name === "provinceId") { |
|
|
|
|
|
|
|
this.props.getCity({ provinceId: value }); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
this.setState({ [name]: value }); |
|
|
|
|
|
|
|
} |
|
|
|
handleDelete = (id) => { |
|
|
|
handleDelete = (id) => { |
|
|
|
let list = this.state.list.filter((item) => item.id !== id); |
|
|
|
let list = this.state.list.filter((item) => item.id !== id); |
|
|
|
this.setState({ |
|
|
|
this.setState({ |
|
|
@ -116,7 +124,16 @@ class Cart extends Component { |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
render() { |
|
|
|
render() { |
|
|
|
const { list, payPrice, payMethods, factorInfo, userId } = this.props; |
|
|
|
const { list, payPrice, payMethods, factorInfo } = this.props; |
|
|
|
|
|
|
|
const { |
|
|
|
|
|
|
|
description, |
|
|
|
|
|
|
|
provinceId, |
|
|
|
|
|
|
|
cityId, |
|
|
|
|
|
|
|
recieverName, |
|
|
|
|
|
|
|
recieverPhone, |
|
|
|
|
|
|
|
recieverAddress, |
|
|
|
|
|
|
|
recieverPostalCode, |
|
|
|
|
|
|
|
} = { ...factorInfo, ...this.state }; |
|
|
|
if (!factorInfo || list.length === 0) |
|
|
|
if (!factorInfo || list.length === 0) |
|
|
|
return ( |
|
|
|
return ( |
|
|
|
<div |
|
|
|
<div |
|
|
@ -170,78 +187,72 @@ class Cart extends Component { |
|
|
|
جزئیات صورتحساب |
|
|
|
جزئیات صورتحساب |
|
|
|
</h1> |
|
|
|
</h1> |
|
|
|
</header> |
|
|
|
</header> |
|
|
|
|
|
|
|
<span>مشخصات تحویل گیرنده</span> |
|
|
|
|
|
|
|
<br /> |
|
|
|
<div className="d-flex"> |
|
|
|
<div className="d-flex"> |
|
|
|
<div class="checkout__forms--right"> |
|
|
|
<div class="checkout__forms--right"> |
|
|
|
<Input |
|
|
|
<Input |
|
|
|
name="firstName" |
|
|
|
name="recieverName" |
|
|
|
label={"نام و نام خانوادگی"} |
|
|
|
label={"نام و نام خانوادگی"} |
|
|
|
parent={this} |
|
|
|
parent={this} |
|
|
|
// defaultValue={profile}
|
|
|
|
defaultValue={factorInfo.recieverName} |
|
|
|
onInput={onInput.persianOnly} |
|
|
|
onInput={onInput.persianOnly} |
|
|
|
required |
|
|
|
required |
|
|
|
/> |
|
|
|
/> |
|
|
|
<div className="mt-2" style={{ minWidth: "100%" }}> |
|
|
|
<Select |
|
|
|
<Select |
|
|
|
parent={this} |
|
|
|
parent={this} |
|
|
|
options={this.props.provinceList} |
|
|
|
options={this.props.provinceList} |
|
|
|
name="provinceId" |
|
|
|
name="provinceId" |
|
|
|
label={"استان"} |
|
|
|
label={"استان"} |
|
|
|
selectedOptions={provinceId} |
|
|
|
selectedOptions={this.state.provinceId} |
|
|
|
required |
|
|
|
/> |
|
|
|
/> |
|
|
|
</div> |
|
|
|
|
|
|
|
<Input |
|
|
|
<Input |
|
|
|
parent={this} |
|
|
|
parent={this} |
|
|
|
name="postalCode" |
|
|
|
name="recieverPostalCode" |
|
|
|
label={"کد پستی"} |
|
|
|
label={"کد پستی"} |
|
|
|
align="left" |
|
|
|
align="left" |
|
|
|
maxLength={10} |
|
|
|
maxLength={10} |
|
|
|
inputMode="numeric" |
|
|
|
inputMode="numeric" |
|
|
|
// defaultValue={profile}
|
|
|
|
defaultValue={factorInfo.recieverPostalCode} |
|
|
|
onInput={onInput.numberOnly} |
|
|
|
onInput={onInput.numberOnly} |
|
|
|
/>{" "} |
|
|
|
required |
|
|
|
|
|
|
|
/> |
|
|
|
<div className="mt-2"> |
|
|
|
<div className="mt-2"> |
|
|
|
<TextArea |
|
|
|
<TextArea |
|
|
|
parent={this} |
|
|
|
parent={this} |
|
|
|
label={"آدرس محل سکونت"} |
|
|
|
label={"آدرس "} |
|
|
|
name="address" |
|
|
|
name="recieverAddress" |
|
|
|
// defaultValue={profile}
|
|
|
|
defaultValue={factorInfo.recieverAddress} |
|
|
|
|
|
|
|
required |
|
|
|
/> |
|
|
|
/> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="checkout__forms--left"> |
|
|
|
<div class="checkout__forms--left"> |
|
|
|
<Input |
|
|
|
<Input |
|
|
|
label={"شماره تماس"} |
|
|
|
label={"شماره تماس"} |
|
|
|
name={"cellphone"} |
|
|
|
name={"recieverPhone"} |
|
|
|
parent={this} |
|
|
|
parent={this} |
|
|
|
|
|
|
|
defaultValue={factorInfo.recieverPhone} |
|
|
|
|
|
|
|
required |
|
|
|
/> |
|
|
|
/> |
|
|
|
<div className="mt-2"> |
|
|
|
|
|
|
|
<Select |
|
|
|
<Select |
|
|
|
parent={this} |
|
|
|
|
|
|
|
options={this.props.cityList} |
|
|
|
|
|
|
|
name="cityId" |
|
|
|
|
|
|
|
label={"شهرستان"} |
|
|
|
|
|
|
|
selectedOptions={this.state.cityId} |
|
|
|
|
|
|
|
/> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
<Input |
|
|
|
|
|
|
|
parent={this} |
|
|
|
parent={this} |
|
|
|
name="postalCode" |
|
|
|
options={this.props.cityList} |
|
|
|
label={"کد پستی"} |
|
|
|
name="cityId" |
|
|
|
align="left" |
|
|
|
label={"شهرستان"} |
|
|
|
maxLength={10} |
|
|
|
selectedOptions={cityId} |
|
|
|
inputMode="numeric" |
|
|
|
required |
|
|
|
// defaultValue={profile}
|
|
|
|
|
|
|
|
onInput={onInput.numberOnly} |
|
|
|
|
|
|
|
/> |
|
|
|
/> |
|
|
|
|
|
|
|
|
|
|
|
<div className="mt-2"> |
|
|
|
<div style={{ height: "60px" }}> </div> |
|
|
|
<TextArea |
|
|
|
<TextArea |
|
|
|
parent={this} |
|
|
|
parent={this} |
|
|
|
label={"توضیحات"} |
|
|
|
label={"توضیحات"} |
|
|
|
name="description" |
|
|
|
name="description" |
|
|
|
// defaultValue={profile}
|
|
|
|
defaultValue={factorInfo.description} |
|
|
|
/> |
|
|
|
/> |
|
|
|
</div> |
|
|
|
|
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</section> |
|
|
|
</section> |
|
|
@ -307,7 +318,17 @@ class Cart extends Component { |
|
|
|
</div> */} |
|
|
|
</div> */} |
|
|
|
<button |
|
|
|
<button |
|
|
|
className="cart__left--submit" |
|
|
|
className="cart__left--submit" |
|
|
|
onClick={() => this.props.payFactor({ userId: userId })} |
|
|
|
onClick={() => |
|
|
|
|
|
|
|
this.props.payFactor({ |
|
|
|
|
|
|
|
provinceId, |
|
|
|
|
|
|
|
cityId, |
|
|
|
|
|
|
|
recieverName, |
|
|
|
|
|
|
|
recieverPhone, |
|
|
|
|
|
|
|
recieverAddress, |
|
|
|
|
|
|
|
recieverPostalCode, |
|
|
|
|
|
|
|
description, |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
> |
|
|
|
> |
|
|
|
پرداخت |
|
|
|
پرداخت |
|
|
|
</button> |
|
|
|
</button> |
|
|
@ -332,7 +353,7 @@ class Cart extends Component { |
|
|
|
{window.location.search.includes("NOK") ? ( |
|
|
|
{window.location.search.includes("NOK") ? ( |
|
|
|
<div>پرداخت شما با خطا مواجه شد ، لطفا مجدد تلاش نمایید</div> |
|
|
|
<div>پرداخت شما با خطا مواجه شد ، لطفا مجدد تلاش نمایید</div> |
|
|
|
) : null} |
|
|
|
) : null} |
|
|
|
<h1 style={{ fontSize: fontSize.mobile.h1 }}>جزئیات صورتحساب</h1> |
|
|
|
<h1 style={{ fontSize: 19 }}>جزئیات صورتحساب</h1> |
|
|
|
<div className="d-flex"> |
|
|
|
<div className="d-flex"> |
|
|
|
<Table |
|
|
|
<Table |
|
|
|
list={list} |
|
|
|
list={list} |
|
|
@ -342,6 +363,71 @@ class Cart extends Component { |
|
|
|
route={"cart"} |
|
|
|
route={"cart"} |
|
|
|
/> |
|
|
|
/> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
<span>مشخصات تحویل گیرنده</span> |
|
|
|
|
|
|
|
<br /> |
|
|
|
|
|
|
|
<div className="d-flex"> |
|
|
|
|
|
|
|
<div class="checkout__forms--right2"> |
|
|
|
|
|
|
|
<Input |
|
|
|
|
|
|
|
name="recieverName" |
|
|
|
|
|
|
|
label={"نام و نام خانوادگی"} |
|
|
|
|
|
|
|
parent={this} |
|
|
|
|
|
|
|
defaultValue={factorInfo.recieverName} |
|
|
|
|
|
|
|
onInput={onInput.persianOnly} |
|
|
|
|
|
|
|
required |
|
|
|
|
|
|
|
/> |
|
|
|
|
|
|
|
<Input |
|
|
|
|
|
|
|
label={"شماره تماس"} |
|
|
|
|
|
|
|
name={"recieverPhone"} |
|
|
|
|
|
|
|
parent={this} |
|
|
|
|
|
|
|
defaultValue={factorInfo.recieverPhone} |
|
|
|
|
|
|
|
required |
|
|
|
|
|
|
|
/> |
|
|
|
|
|
|
|
<Select |
|
|
|
|
|
|
|
parent={this} |
|
|
|
|
|
|
|
options={this.props.provinceList} |
|
|
|
|
|
|
|
name="provinceId" |
|
|
|
|
|
|
|
label={"استان"} |
|
|
|
|
|
|
|
selectedOptions={provinceId} |
|
|
|
|
|
|
|
required |
|
|
|
|
|
|
|
/> |
|
|
|
|
|
|
|
<Select |
|
|
|
|
|
|
|
parent={this} |
|
|
|
|
|
|
|
options={this.props.cityList} |
|
|
|
|
|
|
|
name="cityId" |
|
|
|
|
|
|
|
label={"شهرستان"} |
|
|
|
|
|
|
|
selectedOptions={cityId} |
|
|
|
|
|
|
|
required |
|
|
|
|
|
|
|
/> |
|
|
|
|
|
|
|
<Input |
|
|
|
|
|
|
|
parent={this} |
|
|
|
|
|
|
|
name="recieverPostalCode" |
|
|
|
|
|
|
|
label={"کد پستی"} |
|
|
|
|
|
|
|
align="left" |
|
|
|
|
|
|
|
maxLength={10} |
|
|
|
|
|
|
|
inputMode="numeric" |
|
|
|
|
|
|
|
defaultValue={factorInfo.recieverPostalCode} |
|
|
|
|
|
|
|
onInput={onInput.numberOnly} |
|
|
|
|
|
|
|
required |
|
|
|
|
|
|
|
/> |
|
|
|
|
|
|
|
<div className="mt-2"> |
|
|
|
|
|
|
|
<TextArea |
|
|
|
|
|
|
|
parent={this} |
|
|
|
|
|
|
|
label={"آدرس "} |
|
|
|
|
|
|
|
name="recieverAddress" |
|
|
|
|
|
|
|
defaultValue={factorInfo.recieverAddress} |
|
|
|
|
|
|
|
required |
|
|
|
|
|
|
|
/> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<TextArea |
|
|
|
|
|
|
|
parent={this} |
|
|
|
|
|
|
|
label={"توضیحات"} |
|
|
|
|
|
|
|
name="description" |
|
|
|
|
|
|
|
defaultValue={factorInfo.description} |
|
|
|
|
|
|
|
/> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
{factorInfo.transportId ? ( |
|
|
|
{factorInfo.transportId ? ( |
|
|
|
<div className="mobile-cart__payMethods d-flex flex-column"> |
|
|
|
<div className="mobile-cart__payMethods d-flex flex-column"> |
|
|
|
<h2 style={{ fontSize: fontSize.mobile.h2 }}>روشهای ارسال</h2> |
|
|
|
<h2 style={{ fontSize: fontSize.mobile.h2 }}>روشهای ارسال</h2> |
|
|
@ -399,9 +485,20 @@ class Cart extends Component { |
|
|
|
پرداخت |
|
|
|
پرداخت |
|
|
|
</button> */} |
|
|
|
</button> */} |
|
|
|
<Link |
|
|
|
<Link |
|
|
|
|
|
|
|
style={{ textAlign: "center", textDecoration: "none" }} |
|
|
|
to="/checkout" |
|
|
|
to="/checkout" |
|
|
|
className="mobile-cart__submit" |
|
|
|
className="mobile-cart__submit" |
|
|
|
// onClick={() => this.props.payFactor({ userId: userId })}
|
|
|
|
onClick={() => |
|
|
|
|
|
|
|
this.props.payFactor({ |
|
|
|
|
|
|
|
provinceId, |
|
|
|
|
|
|
|
cityId, |
|
|
|
|
|
|
|
recieverName, |
|
|
|
|
|
|
|
recieverPhone, |
|
|
|
|
|
|
|
recieverAddress, |
|
|
|
|
|
|
|
recieverPostalCode, |
|
|
|
|
|
|
|
description, |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
> |
|
|
|
> |
|
|
|
پرداخت |
|
|
|
پرداخت |
|
|
|
</Link> |
|
|
|
</Link> |
|
|
@ -440,5 +537,7 @@ export default connect( |
|
|
|
getFactorInfo: userFactor.info, |
|
|
|
getFactorInfo: userFactor.info, |
|
|
|
payFactor: userFactor.payment, |
|
|
|
payFactor: userFactor.payment, |
|
|
|
getVerify: userFactor.verify, |
|
|
|
getVerify: userFactor.verify, |
|
|
|
|
|
|
|
getProvince: publicApi.getProvince, |
|
|
|
|
|
|
|
getCity: publicApi.getCity, |
|
|
|
} |
|
|
|
} |
|
|
|
)(Cart); |
|
|
|
)(Cart); |
|
|
|