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