Commit a0af7fb6 authored by GuanHua's avatar GuanHua

feat:店铺页面id的获取;微信支付方式支付结果查询

parent f611fc4d
...@@ -112,7 +112,7 @@ const LXShopLayout: React.FC<LXMallLayoutPropsType> = (props) => { ...@@ -112,7 +112,7 @@ const LXShopLayout: React.FC<LXMallLayoutPropsType> = (props) => {
return React.cloneElement(child, return React.cloneElement(child,
{ {
layoutType: LAYOUT_TYPE.shop, layoutType: LAYOUT_TYPE.shop,
shopId: query.shopId, shopId: shopInfo.id,
memberId: query.memberId, memberId: query.memberId,
shopUrlParam: shopId, shopUrlParam: shopId,
shopInfo, shopInfo,
......
...@@ -15,8 +15,6 @@ ...@@ -15,8 +15,6 @@
&_imgbox { &_imgbox {
padding: 20px; padding: 20px;
width: 180px;
height: 180px;
border: 1px solid rgba(245, 245, 245, 1); border: 1px solid rgba(245, 245, 245, 1);
&>img { &>img {
......
...@@ -4,6 +4,7 @@ import { LAYOUT_TYPE } from '@/constants' ...@@ -4,6 +4,7 @@ import { LAYOUT_TYPE } from '@/constants'
import wechatIcon from '@/assets/imgs/wechat_icon.png' import wechatIcon from '@/assets/imgs/wechat_icon.png'
import { priceFormat } from '@/utils/numberFomat' import { priceFormat } from '@/utils/numberFomat'
import { PublicApi } from '@/services/api' import { PublicApi } from '@/services/api'
import { linkToUrl } from '../../utils'
import { message, Spin } from 'antd' import { message, Spin } from 'antd'
import QRCode from 'qrcode' import QRCode from 'qrcode'
import styles from './index.less' import styles from './index.less'
...@@ -22,7 +23,8 @@ const WechatPayWay: React.FC<WechatPayWayPropsType> = (props) => { ...@@ -22,7 +23,8 @@ const WechatPayWay: React.FC<WechatPayWayPropsType> = (props) => {
const { payInfo, orderId, onChange, orderInfo, layoutType, shopUrlParam } = props const { payInfo, orderId, onChange, orderInfo, layoutType, shopUrlParam } = props
const [wechatPayUrl, setWechatPayUrl] = useState<any>('') const [wechatPayUrl, setWechatPayUrl] = useState<any>('')
const [pageLoading, setPageLoading] = useState<boolean>(true) const [pageLoading, setPageLoading] = useState<boolean>(true)
let checkCount = 0
let checkTimer = null
useEffect(() => { useEffect(() => {
pay() pay()
}, []) }, [])
...@@ -49,6 +51,9 @@ const WechatPayWay: React.FC<WechatPayWayPropsType> = (props) => { ...@@ -49,6 +51,9 @@ const WechatPayWay: React.FC<WechatPayWayPropsType> = (props) => {
if(res.code === 1000) { if(res.code === 1000) {
message.destroy() message.destroy()
generateQrCode(res.data) generateQrCode(res.data)
setTimeout(() => {
checkPayState()
}, 5000);
} }
setPageLoading(false) setPageLoading(false)
// setWechatPayUrl(res.data) // setWechatPayUrl(res.data)
...@@ -58,6 +63,38 @@ const WechatPayWay: React.FC<WechatPayWayPropsType> = (props) => { ...@@ -58,6 +63,38 @@ const WechatPayWay: React.FC<WechatPayWayPropsType> = (props) => {
}) })
} }
const checkPayState = () => {
if (checkCount < 12) {
let param = {
id: Number(orderId),
paymentInformationId: payInfo.paymentInformationId,
payTypeId: payInfo.paymentChannelsId,
}
//@ts-ignore
PublicApi.getOrderPayResultsl(param).then(res => {
const { data, code } = res
if (code === 1000) {
message.destroy()
if (data) {
message.success("支付成功")
linkToUrl(`/pay/result?orderId=${orderId}`, layoutType, shopUrlParam)
} else {
checkCount++
checkTimer = setTimeout(() => {
checkPayState()
}, 5000)
}
} else {
message.error(res.message)
}
})
} else {
clearTimeout(checkTimer)
checkTimer = null
}
}
return ( return (
<Spin spinning={pageLoading}> <Spin spinning={pageLoading}>
<div className={styles.common_title}> <div className={styles.common_title}>
......
...@@ -77,8 +77,8 @@ const CommodityList: React.FC<CommodityListPropsType> = (props) => { ...@@ -77,8 +77,8 @@ const CommodityList: React.FC<CommodityListPropsType> = (props) => {
</div> </div>
<div className={styles.shop_list_line}> <div className={styles.shop_list_line}>
<label>以上信息已通过会员认证|</label> <label>以上信息已通过会员认证|</label>
<Link to={`/shop/about?shopId=${btoa(JSON.stringify({ shopId: item.id, memberId: item.memberId }))}`} className={styles.shop_list_line_link}>资质证书 &gt;</Link> <Link to={`/shop/about?shopId=${btoa(JSON.stringify({ memberId: item.memberId }))}`} className={styles.shop_list_line_link}>资质证书 &gt;</Link>
<Link to={`/shop/about?shopId=${btoa(JSON.stringify({ shopId: item.id, memberId: item.memberId }))}`} className={styles.shop_list_line_link}>公司信息 &gt;</Link> <Link to={`/shop/about?shopId=${btoa(JSON.stringify({ memberId: item.memberId }))}`} className={styles.shop_list_line_link}>公司信息 &gt;</Link>
</div> </div>
</div> </div>
<div className={styles.shop_list_goods}> <div className={styles.shop_list_goods}>
......
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