Commit 3b0abbe0 authored by GuanHua's avatar GuanHua

Merge branch 'dev' into test

parents c37de69f 5ef1bae9
...@@ -280,6 +280,8 @@ const Order: React.FC<OrderPropsType> = (props) => { ...@@ -280,6 +280,8 @@ const Order: React.FC<OrderPropsType> = (props) => {
temp.brand = orderItem.brand temp.brand = orderItem.brand
temp.logistics = orderItem.logistics temp.logistics = orderItem.logistics
temp.deliveryType = orderItem.logistics.deliveryType temp.deliveryType = orderItem.logistics.deliveryType
temp.memberId = orderInfo.supplyMembersId
temp.memberRoleId = orderInfo.supplyMembersRoleId
orderProductRequests.push(temp) orderProductRequests.push(temp)
} }
} }
...@@ -307,9 +309,9 @@ const Order: React.FC<OrderPropsType> = (props) => { ...@@ -307,9 +309,9 @@ const Order: React.FC<OrderPropsType> = (props) => {
if (res.code === 1000) { if (res.code === 1000) {
const data = res.data const data = res.data
if (selectPayWay.payType === 4) { if (selectPayWay.payType === 4) {
history.push(`/pay/result?orderId=${data.orderId}`) history.replace(`/pay/result?orderId=${data.orderId}`)
} else { } else {
history.push(`/pay?orderId=${data.orderId}&spam_id=${spam_id}`) history.replace(`/pay?orderId=${data.orderId}&spam_id=${spam_id}`)
} }
} }
setConfirmLoading(false) setConfirmLoading(false)
......
...@@ -32,12 +32,18 @@ const CreditPayWay: React.FC<CreditPayWayPropsType> = (props) => { ...@@ -32,12 +32,18 @@ const CreditPayWay: React.FC<CreditPayWayPropsType> = (props) => {
} }
useEffect(() => { useEffect(() => {
fetchCreditInfo() if (orderInfo) {
fetchSecurity() fetchCreditInfo()
}, []) fetchSecurity()
}
}, [orderInfo])
const fetchCreditInfo = () => { const fetchCreditInfo = () => {
PublicApi.getPayCreditGetCredit().then(res => { let param = {
parentMemberId: orderInfo.supplyMembersId,
parentMemberRoleId: orderInfo.supplyMembersRoleId
}
PublicApi.getPayCreditGetCredit(param).then(res => {
if (res.code === 1000) { if (res.code === 1000) {
if (res.data.isUsable === 0) { if (res.data.isUsable === 0) {
message.error("授信额度不可用") message.error("授信额度不可用")
...@@ -50,11 +56,8 @@ const CreditPayWay: React.FC<CreditPayWayPropsType> = (props) => { ...@@ -50,11 +56,8 @@ const CreditPayWay: React.FC<CreditPayWayPropsType> = (props) => {
} }
const fetchSecurity = () => { const fetchSecurity = () => {
let param = {
parentMemberId: orderInfo.supplyMembersId, PublicApi.getMemberSecurityGet().then(res => {
parentMemberRoleId: orderInfo.supplyMembersRoleId
}
PublicApi.getMemberSecurityGet(param).then(res => {
if(res.code === 1000) { if(res.code === 1000) {
setSecurityInfo(res.data) setSecurityInfo(res.data)
} }
...@@ -68,11 +71,12 @@ const CreditPayWay: React.FC<CreditPayWayPropsType> = (props) => { ...@@ -68,11 +71,12 @@ const CreditPayWay: React.FC<CreditPayWayPropsType> = (props) => {
} }
if (!payPassword || payPassword.length < 6) { if (!payPassword || payPassword.length < 6) {
message.error("请输入支付密码") message.error("请输入支付密码")
return
} }
let param = { let param = {
id: orderId, id: Number(orderId),
paymentInformationId: payInfo.paymentInformationId, paymentInformationId: Number(payInfo.paymentInformationId),
payPassword payPassword: Number(payPassword)
} }
setConfirmLoading(true) setConfirmLoading(true)
//@ts-ignore //@ts-ignore
...@@ -80,7 +84,7 @@ const CreditPayWay: React.FC<CreditPayWayPropsType> = (props) => { ...@@ -80,7 +84,7 @@ const CreditPayWay: React.FC<CreditPayWayPropsType> = (props) => {
if (res.code === 1000) { if (res.code === 1000) {
message.destroy() message.destroy()
message.success("支付成功") message.success("支付成功")
history.push(`/pay/result?orderId=${orderId}`) history.replace(`/pay/result?orderId=${orderId}`)
} else { } else {
setConfirmLoading(false) setConfirmLoading(false)
message.destroy() message.destroy()
......
...@@ -53,6 +53,7 @@ const PayPage: React.FC<PayPagePropsType> = (props) => { ...@@ -53,6 +53,7 @@ const PayPage: React.FC<PayPagePropsType> = (props) => {
const [payState, setPayState] = useState<boolean>(false) const [payState, setPayState] = useState<boolean>(false)
const { orderId, spam_id } = props.location.query const { orderId, spam_id } = props.location.query
const [pageTitle, setPageTitle] = useState<string>() const [pageTitle, setPageTitle] = useState<string>()
const [loading, setLoading] = useState<boolean>(true)
const [payType] = useState<string | number>(PayWayType.bank) const [payType] = useState<string | number>(PayWayType.bank)
const [payInfo, setPayInfo] = useState<GetOrderOrderPayDetailsResponse>() const [payInfo, setPayInfo] = useState<GetOrderOrderPayDetailsResponse>()
const [errMsg, setErrMsg] = useState<string>('') const [errMsg, setErrMsg] = useState<string>('')
...@@ -77,12 +78,15 @@ const PayPage: React.FC<PayPagePropsType> = (props) => { ...@@ -77,12 +78,15 @@ const PayPage: React.FC<PayPagePropsType> = (props) => {
const fetchOrderInfo = () => { const fetchOrderInfo = () => {
PublicApi.getOrderOrderPayDetails({ id: orderId }).then(res => { PublicApi.getOrderOrderPayDetails({ id: orderId }).then(res => {
message.destroy() message.destroy()
setLoading(false)
if (res.code === 1000) { if (res.code === 1000) {
setPayInfo(res.data) setPayInfo(res.data)
setPageTitle(getPayTypeTitle(res.data.paymentChannelsId)) setPageTitle(getPayTypeTitle(res.data.paymentChannelsId))
} else { } else {
setErrMsg(res.message) setErrMsg(res.message)
} }
}).catch(() => {
setLoading(false)
}) })
} }
...@@ -137,16 +141,19 @@ const PayPage: React.FC<PayPagePropsType> = (props) => { ...@@ -137,16 +141,19 @@ const PayPage: React.FC<PayPagePropsType> = (props) => {
<p>支付成功</p> <p>支付成功</p>
<Button type="primary" className={styles.backbtn} onClick={() => backHome()}>继续购物</Button> <Button type="primary" className={styles.backbtn} onClick={() => backHome()}>继续购物</Button>
</div> </div>
</div>) : <div> </div>) : loading ? null : (
<CommonHeader <div>
logoUrl={(layoutType === LAYOUT_TYPE.channel || layoutType === LAYOUT_TYPE.ichannel) ? shopInfo?.logo : mallInfo.logoUrl} <CommonHeader
title="支付错误" logoUrl={(layoutType === LAYOUT_TYPE.channel || layoutType === LAYOUT_TYPE.ichannel) ? shopInfo?.logo : mallInfo.logoUrl}
/> title="支付错误"
<div className={styles.errmsg}> />
<p>{errMsg}</p> <div className={styles.errmsg}>
<Button type="primary" className={styles.backbtn} onClick={() => backHome()}>返回首页</Button> <p>{errMsg}</p>
<Button type="primary" className={styles.backbtn} onClick={() => backHome()}>返回首页</Button>
</div>
</div> </div>
</div> )
} }
export default PayPage export default PayPage
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment