Commit 30203adb authored by GuanHua's avatar GuanHua

feat:修改支付页面参数接受

parent 2e1f3cb9
......@@ -332,7 +332,7 @@ const Order: React.FC<OrderPropsType> = (props) => {
if (selectPayWay.payType === 4) {
linkToUrl(`/pay/result?orderId=${data.orderId}`)
} else {
linkToUrl(`/pay?orderId=${data.orderId}&spam_id=${spam_id}`)
linkToUrl(`/pay?orderId=${btoa(JSON.stringify({orderId: data.orderId, memberId: orderInfo.supplyMembersId, memberRoleId: orderInfo.supplyMembersRoleId}))}`)
}
}
setConfirmLoading(false)
......
......@@ -15,7 +15,7 @@ import styles from './index.less'
interface BablancePayWayPropsType {
payInfo: GetOrderOrderPayDetailsResponse,
orderInfo: any,
queryParam: any,
orderId: number,
onChange: Function,
layoutType?: LAYOUT_TYPE,
......@@ -23,7 +23,7 @@ interface BablancePayWayPropsType {
}
const BablancePayWay: React.FC<BablancePayWayPropsType> = (props) => {
const { payInfo, orderId, orderInfo, layoutType, shopUrlParam, onChange } = props
const { payInfo, orderId, queryParam, layoutType, shopUrlParam, onChange } = props
const [balanceInfo, setBalanceInfo] = useState<GetPayAssetAccountGetUserBalanceResponse>(0)
const [securityInfo, setSecurityInfo] = useState<GetMemberSecurityGetResponse>()
const [payPassword, setPayPassword] = useState<string>('')
......@@ -36,17 +36,17 @@ const BablancePayWay: React.FC<BablancePayWayPropsType> = (props) => {
}
useEffect(() => {
if (orderInfo && payInfo) {
if (queryParam && payInfo) {
fetchBalanceInfo()
fetchSecurity()
}
}, [orderInfo, payInfo])
}, [queryParam, payInfo])
const fetchBalanceInfo = () => {
const param: any = {
payType: payInfo.ruleConfigurationId,
parentMemberId: orderInfo.supplyMembersId,
parentMemberRoleId: orderInfo.supplyMembersRoleId
parentMemberId: queryParam.memberId,
parentMemberRoleId: queryParam.memberRoleId
}
PublicApi.getPayAssetAccountGetUserBalance(param).then(res => {
......
......@@ -15,7 +15,7 @@ import { message, Button, Spin } from 'antd'
interface CreditPayWayPropsType {
payInfo: GetOrderOrderPayDetailsResponse,
orderInfo: any,
queryParam: any,
orderId: number,
onChange: Function,
layoutType?: LAYOUT_TYPE,
......@@ -23,9 +23,8 @@ interface CreditPayWayPropsType {
}
const CreditPayWay: React.FC<CreditPayWayPropsType> = (props) => {
const { payInfo, orderId, orderInfo, layoutType, shopUrlParam } = props
const { payInfo, orderId, queryParam, layoutType, shopUrlParam } = props
const [payPassword, setPayPassword] = useState<string>('')
const [type, setType] = useState<string>('normal') // normal: 普通;member:会员
const [creditInfo, setCreditInfo] = useState<GetPayCreditGetCreditResponse>()
const [confirmLoading, setConfirmLoading] = useState<boolean>(false)
const [securityInfo, setSecurityInfo] = useState<GetMemberSecurityGetResponse>()
......@@ -37,16 +36,16 @@ const CreditPayWay: React.FC<CreditPayWayPropsType> = (props) => {
}
useEffect(() => {
if (orderInfo) {
if (queryParam) {
fetchCreditInfo()
fetchSecurity()
}
}, [orderInfo])
}, [queryParam])
const fetchCreditInfo = () => {
const param: any = {
parentMemberId: orderInfo.supplyMembersId,
parentMemberRoleId: orderInfo.supplyMembersRoleId
parentMemberId: queryParam.memberId,
parentMemberRoleId: queryParam.memberRoleId
}
PublicApi.getPayCreditGetCredit(param).then(res => {
if (res.code === 1000) {
......
......@@ -14,7 +14,7 @@ import styles from './index.less'
interface PointPayWayPropsType {
payInfo: GetOrderOrderPayDetailsResponse,
orderInfo: any,
queryParam: any,
orderId: number,
onChange: Function,
layoutType?: LAYOUT_TYPE,
......@@ -22,7 +22,7 @@ interface PointPayWayPropsType {
}
const PointPayWay: React.FC<PointPayWayPropsType> = (props) => {
const { payInfo, orderId, orderInfo, layoutType, onChange, shopUrlParam } = props
const { payInfo, orderId, queryParam, layoutType, onChange, shopUrlParam } = props
const [securityInfo, setSecurityInfo] = useState<GetMemberSecurityGetResponse>()
const [payPassword, setPayPassword] = useState<string>('')
const [pointInfo, setPointInfo] = useState<GetMemberBusinessLrcRightPointGetResponse>()
......@@ -40,16 +40,16 @@ const PointPayWay: React.FC<PointPayWayPropsType> = (props) => {
}
useEffect(() => {
if (orderInfo) {
if (queryParam) {
fetchPointInfo()
fetchSecurity()
}
}, [orderInfo])
}, [queryParam])
const fetchPointInfo = () => {
const param: any = {
memberId: orderInfo.supplyMembersId,
roleId: orderInfo.supplyMembersRoleId
memberId: queryParam.memberId,
roleId: queryParam.memberRoleId
}
PublicApi.getMemberBusinessLrcRightPointGet(param).then(res => {
......
......@@ -12,7 +12,6 @@ import { useState } from 'react'
interface WechatPayWayPropsType {
payInfo: GetOrderOrderPayDetailsResponse,
orderInfo: any,
orderId: number,
onChange: Function,
layoutType?: LAYOUT_TYPE,
......@@ -20,7 +19,7 @@ interface WechatPayWayPropsType {
}
const WechatPayWay: React.FC<WechatPayWayPropsType> = (props) => {
const { payInfo, orderId, onChange, orderInfo, layoutType, shopUrlParam } = props
const { payInfo, orderId, onChange, layoutType, shopUrlParam } = props
const [wechatPayUrl, setWechatPayUrl] = useState<any>('')
const [pageLoading, setPageLoading] = useState<boolean>(true)
let checkCount = 0
......@@ -64,7 +63,7 @@ const WechatPayWay: React.FC<WechatPayWayPropsType> = (props) => {
}
const checkPayState = () => {
if (checkCount < 20) {
if (checkCount < 24) {
let param = {
id: Number(orderId),
paymentInformationId: payInfo.paymentInformationId,
......
......@@ -51,32 +51,32 @@ const getPayTypeTitle = (type) => {
const PayPage: React.FC<PayPagePropsType> = (props) => {
const { shopInfo, mallInfo, layoutType } = props
const [payState, setPayState] = useState<boolean>(false)
const { orderId, spam_id } = props.location.query
const { orderId } = 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>('')
const OrderStore = useLocalStore(() => store.OrderStore)
const [orderInfo, setOrderInfo] = useState<any>({})
const { getOrderInfo } = OrderStore
const [query, setQuery] = useState<any>({})
useEffect(() => {
initOrderInfo()
if (orderId) {
fetchOrderInfo()
try {
let queryParam: any = orderId ? atob(orderId) : undefined
queryParam = queryParam ? JSON.parse(queryParam) : {}
setQuery(queryParam)
} catch (error) {
console.log(error)
setLoading(false)
}
}, [])
const initOrderInfo = async () => {
if (spam_id) {
const sessionOrderInfo: any = await getOrderInfo(spam_id)
setOrderInfo(sessionOrderInfo)
useEffect(() => {
if (query.orderId) {
fetchOrderInfo()
}
}
}, [query])
const fetchOrderInfo = () => {
PublicApi.getOrderOrderPayDetails({ id: orderId }).then(res => {
PublicApi.getOrderOrderPayDetails({ id: query.orderId }).then(res => {
message.destroy()
setLoading(false)
if (res.code === 1000) {
......@@ -91,7 +91,6 @@ const PayPage: React.FC<PayPagePropsType> = (props) => {
}
const handlePayChangge = (state, errMsg?) => {
console.log(state, "state")
setPayState(state)
errMsg && setErrMsg(errMsg)
}
......@@ -103,17 +102,17 @@ const PayPage: React.FC<PayPagePropsType> = (props) => {
switch (payInfo.paymentChannelsId) {
case PayWayType.point:
return <PointPayWay payInfo={payInfo} orderInfo={orderInfo} orderId={orderId} onChange={(state, errMsg) => handlePayChangge(state, errMsg)} {...props} />
return <PointPayWay payInfo={payInfo} queryParam={query} orderId={query.orderId} onChange={(state, errMsg) => handlePayChangge(state, errMsg)} {...props} />
case PayWayType.balance:
return <BablancePayWay payInfo={payInfo} orderInfo={orderInfo} orderId={orderId} onChange={(state, errMsg) => handlePayChangge(state, errMsg)} {...props} />
return <BablancePayWay payInfo={payInfo} queryParam={query} orderId={query.orderId} onChange={(state, errMsg) => handlePayChangge(state, errMsg)} {...props} />
case PayWayType.credit:
return <CreditPayWay payInfo={payInfo} orderInfo={orderInfo} orderId={orderId} onChange={(state, errMsg) => handlePayChangge(state, errMsg)} {...props} />
return <CreditPayWay payInfo={payInfo} queryParam={query} orderId={query.orderId} onChange={(state, errMsg) => handlePayChangge(state, errMsg)} {...props} />
case PayWayType.wechat:
return <WechatPayWay payInfo={payInfo} orderInfo={orderInfo} orderId={orderId} onChange={(state, errMsg) => handlePayChangge(state, errMsg)} {...props} />
return <WechatPayWay payInfo={payInfo} orderId={query.orderId} onChange={(state, errMsg) => handlePayChangge(state, errMsg)} {...props} />
case PayWayType.bank:
return <BankPayWay />
case PayWayType.transfer:
return <TransferPayWay payInfo={payInfo} orderId={orderId} onChange={(state, errMsg) => handlePayChangge(state, errMsg)} {...props} />
return <TransferPayWay payInfo={payInfo} orderId={query.orderId} onChange={(state, errMsg) => handlePayChangge(state, errMsg)} {...props} />
default:
return null
}
......
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