|
@@ -6,19 +6,13 @@ import { Tooltip, message } from 'antd'
|
|
import NoPowerImg from 'assets/nopower.png'
|
|
import NoPowerImg from 'assets/nopower.png'
|
|
import BagImg from 'assets/bag.png'
|
|
import BagImg from 'assets/bag.png'
|
|
import TipsSvg from 'assets/tips2.svg'
|
|
import TipsSvg from 'assets/tips2.svg'
|
|
-// import Introduce from 'assets/introduce.svg'
|
|
|
|
-// import Quotation from 'assets/quotation.svg'
|
|
|
|
|
|
|
|
-import { useMedia } from 'Context/Media/MediaContext'
|
|
|
|
-import ApplyPermission from './ApplyPermission'
|
|
|
|
import NButton from 'components/NButton/NButton'
|
|
import NButton from 'components/NButton/NButton'
|
|
-import { EOrderStatus, IArcticleInfo, IOrderPayStatusRes, MaterialService } from 'Material/Material.service'
|
|
+import { IArcticleInfo, MaterialService } from 'Material/Material.service'
|
|
import { ITryType, INewPermissionType } from './NoPermission'
|
|
import { ITryType, INewPermissionType } from './NoPermission'
|
|
-import ApplyResult from './ApplyResult'
|
|
+import { PayType } from './BuyModel'
|
|
-import BuyModel, { PayType } from './BuyModel'
|
|
|
|
-import QRCodeModel from './QRCodeModel'
|
|
|
|
-import UploadInfoModel from './UploadInfoModel'
|
|
|
|
import { IActivityTypeDetailRes } from 'Activity/Activity.service'
|
|
import { IActivityTypeDetailRes } from 'Activity/Activity.service'
|
|
|
|
+import PayProcessModel from './PayProcessModel'
|
|
import styles from '../css/NoPermission.module.scss'
|
|
import styles from '../css/NoPermission.module.scss'
|
|
|
|
|
|
interface IPayNoPermissionProps {
|
|
interface IPayNoPermissionProps {
|
|
@@ -31,38 +25,9 @@ interface IPayNoPermissionProps {
|
|
const PayNoPermission: React.FC<IPayNoPermissionProps> = props => {
|
|
const PayNoPermission: React.FC<IPayNoPermissionProps> = props => {
|
|
const { dataInfo, tryType, border = false, onRefresh } = props
|
|
const { dataInfo, tryType, border = false, onRefresh } = props
|
|
const [visibleApply, setVisibleApply] = useState(false) // 普通申请权限弹框
|
|
const [visibleApply, setVisibleApply] = useState(false) // 普通申请权限弹框
|
|
- const [visibleUpload, setVisibleUpload] = useState(false) // 机构申请试用弹框
|
|
|
|
const [visibleBuyCard, setVisibleBuyCard] = useState(false) // 购买畅读卡弹框
|
|
const [visibleBuyCard, setVisibleBuyCard] = useState(false) // 购买畅读卡弹框
|
|
- const [visibleOrderCode, setVisibleOrderCode] = useState(false) // 订单二维码弹框
|
|
|
|
- const [visibleResult, setVisibleResult] = useState(false) // 支付结果弹框
|
|
|
|
- // const [wantBuyGoodsId, setWantBuyGoodsId] = useState(0) // 购买畅读卡的选项
|
|
|
|
- const [payInfo, setPayInfo] = useState<IOrderPayStatusRes | null>(null) // 支付订单详情
|
|
|
|
const payType = dataInfo.GoodsList.length > 1 ? PayType.Card : PayType.Single // 支付类型[1:畅销卡,2:单场活动
|
|
const payType = dataInfo.GoodsList.length > 1 ? PayType.Card : PayType.Single // 支付类型[1:畅销卡,2:单场活动
|
|
|
|
|
|
- // 报告畅读卡购买,创建订单
|
|
|
|
- const { data: articleOrderInfo, run: postCreateOrderByArticle } = useRequest(
|
|
|
|
- MaterialService.postCreateOrderByArticle,
|
|
|
|
- {
|
|
|
|
- manual: true,
|
|
|
|
- formatResult: response => response.data,
|
|
|
|
- onSuccess: res => {
|
|
|
|
- // todo
|
|
|
|
- res.Success ? setVisibleOrderCode(true) : message.error(res.Msg || res.ErrMsg)
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- )
|
|
|
|
- // 活动报名购买,创建订单
|
|
|
|
- const { data: activityOrderInfo, run: postCreateOrderByActivity } = useRequest(
|
|
|
|
- MaterialService.postCreateOrderByActivity,
|
|
|
|
- {
|
|
|
|
- manual: true,
|
|
|
|
- formatResult: response => response.data,
|
|
|
|
- onSuccess: res => {
|
|
|
|
- // todo
|
|
|
|
- res.Success ? setVisibleOrderCode(true) : message.error(res.Msg || res.ErrMsg)
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- )
|
|
|
|
// 申请试用接口
|
|
// 申请试用接口
|
|
const { run: postApplyTry } = useRequest(MaterialService.postApplyTry, {
|
|
const { run: postApplyTry } = useRequest(MaterialService.postApplyTry, {
|
|
manual: true,
|
|
manual: true,
|
|
@@ -70,60 +35,11 @@ const PayNoPermission: React.FC<IPayNoPermissionProps> = props => {
|
|
res.data.Ret === 200 ? message.success('提交成功,请等待销售人员与您联系') : message.info(res.data.Msg)
|
|
res.data.Ret === 200 ? message.success('提交成功,请等待销售人员与您联系') : message.info(res.data.Msg)
|
|
}
|
|
}
|
|
})
|
|
})
|
|
- // 关闭支付结果弹框
|
|
|
|
- const handleCloseResult = () => {
|
|
|
|
- // 并刷新页面
|
|
|
|
- onRefresh && onRefresh()
|
|
|
|
- setVisibleResult(false)
|
|
|
|
- }
|
|
|
|
- // 关闭支付code弹框
|
|
|
|
- const handleCloseCode = () => {
|
|
|
|
- // 如果是单场购买,关闭后刷新页面
|
|
|
|
- if (payType === PayType.Single) {
|
|
|
|
- onRefresh && onRefresh()
|
|
|
|
- }
|
|
|
|
- setVisibleOrderCode(false)
|
|
|
|
- }
|
|
|
|
- // 关闭购买畅读卡弹框
|
|
|
|
- const handleCloseBuy = () => {
|
|
|
|
- setVisibleBuyCard(false)
|
|
|
|
- }
|
|
|
|
- // 上传名片成功后,关闭上传名片弹框
|
|
|
|
- const handleUploadCardSuccess = () => {
|
|
|
|
- // todo
|
|
|
|
- handleCloseUpload()
|
|
|
|
- }
|
|
|
|
- // 关闭上传名片弹框
|
|
|
|
- const handleCloseUpload = () => {
|
|
|
|
- setVisibleUpload(false)
|
|
|
|
- }
|
|
|
|
- // 关闭申请试用弹框
|
|
|
|
- const handleCloseApply = () => {
|
|
|
|
- setVisibleApply(false)
|
|
|
|
- }
|
|
|
|
// 点击购买畅读卡按钮
|
|
// 点击购买畅读卡按钮
|
|
const handleOpenBuyModel = () => {
|
|
const handleOpenBuyModel = () => {
|
|
// 打开畅读卡弹框
|
|
// 打开畅读卡弹框
|
|
setVisibleBuyCard(true)
|
|
setVisibleBuyCard(true)
|
|
}
|
|
}
|
|
- // 点击支付
|
|
|
|
- const handleClickPay = (GoodsId: number) => {
|
|
|
|
- console.log('GoodsId', GoodsId)
|
|
|
|
- // setWantBuyGoodsId(GoodsId)
|
|
|
|
- // 判断是否需要上传名片
|
|
|
|
- if (dataInfo.IsNeedBusinessCard) {
|
|
|
|
- setVisibleUpload(true)
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
- // 调接口获取支付二维码 todo
|
|
|
|
- if (tryType === ITryType.Article) {
|
|
|
|
- postCreateOrderByArticle(GoodsId, (dataInfo as IArcticleInfo).Detail.ArticleId)
|
|
|
|
- }
|
|
|
|
- if (tryType === ITryType.Activity) {
|
|
|
|
- postCreateOrderByActivity(GoodsId, (dataInfo as IActivityTypeDetailRes).Detail.ActivityId)
|
|
|
|
- }
|
|
|
|
- setVisibleBuyCard(false)
|
|
|
|
- }
|
|
|
|
// 申请试用
|
|
// 申请试用
|
|
const handleToAskTry = () => {
|
|
const handleToAskTry = () => {
|
|
// HasPermission=2,4,6,已提交过申请的,提示:您已提交过申请,请等待销售与您联系。
|
|
// HasPermission=2,4,6,已提交过申请的,提示:您已提交过申请,请等待销售与您联系。
|
|
@@ -149,37 +65,12 @@ const PayNoPermission: React.FC<IPayNoPermissionProps> = props => {
|
|
setVisibleApply(true)
|
|
setVisibleApply(true)
|
|
}
|
|
}
|
|
|
|
|
|
- // 订单支付结果
|
|
|
|
- const handleDoPayResult = (OrderRes: IOrderPayStatusRes) => {
|
|
|
|
- // todo
|
|
|
|
- console.log('OrderStatus', OrderRes)
|
|
|
|
- setPayInfo(OrderRes)
|
|
|
|
- switch (OrderRes.OrderStatus) {
|
|
|
|
- case EOrderStatus.Cancel:
|
|
|
|
- console.log('已取消')
|
|
|
|
- setVisibleResult(true)
|
|
|
|
- break
|
|
|
|
- case EOrderStatus.WaitPay:
|
|
|
|
- console.log('待支付')
|
|
|
|
- break
|
|
|
|
- case EOrderStatus.Payed:
|
|
|
|
- setVisibleResult(true)
|
|
|
|
- break
|
|
|
|
- case EOrderStatus.Refund:
|
|
|
|
- console.log('已退款')
|
|
|
|
- break
|
|
|
|
- default:
|
|
|
|
- console.log('未知状态')
|
|
|
|
- break
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
return (
|
|
return (
|
|
<>
|
|
<>
|
|
<div className={`${border ? styles['gray-boder-box'] : ''} ${styles['nopower-showwxpay-wrapper']} `}>
|
|
<div className={`${border ? styles['gray-boder-box'] : ''} ${styles['nopower-showwxpay-wrapper']} `}>
|
|
{tryType !== ITryType.Activity ? <img src={NoPowerImg} alt="无权限" className="nopower-big-img" /> : null}
|
|
{tryType !== ITryType.Activity ? <img src={NoPowerImg} alt="无权限" className="nopower-big-img" /> : null}
|
|
<div className="nopower-content-wrapper">
|
|
<div className="nopower-content-wrapper">
|
|
- <div className="nopower-title">
|
|
+ <div className={tryType !== ITryType.Activity ? 'nopower-title' : 'nopower-activity-title'}>
|
|
{tryType === ITryType.Article ? '暂无权限查看此报告' : '暂无权限参加此活动'}
|
|
{tryType === ITryType.Article ? '暂无权限查看此报告' : '暂无权限参加此活动'}
|
|
</div>
|
|
</div>
|
|
<div className="nopower-text">
|
|
<div className="nopower-text">
|
|
@@ -274,35 +165,12 @@ const PayNoPermission: React.FC<IPayNoPermissionProps> = props => {
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
- <QRCodeModel
|
|
+ <PayProcessModel
|
|
- visible={visibleOrderCode}
|
|
+ dataInfo={dataInfo}
|
|
- codeUrl={articleOrderInfo?.Data.CodeUrl || activityOrderInfo?.Data.CodeUrl || ''}
|
|
|
|
- orderCode={articleOrderInfo?.Data.OrderCode || activityOrderInfo?.Data.OrderCode || ''}
|
|
|
|
- onCloseModel={handleCloseCode}
|
|
|
|
- onSendPayResult={handleDoPayResult}
|
|
|
|
- />
|
|
|
|
- <ApplyResult visible={visibleResult} info={payInfo} onCloseModel={handleCloseResult} />
|
|
|
|
- <BuyModel
|
|
|
|
- visible={visibleBuyCard}
|
|
|
|
- goodsList={dataInfo.GoodsList}
|
|
|
|
- payType={payType} // todo
|
|
|
|
- onCloseModel={handleCloseBuy}
|
|
|
|
- handleCheckPay={handleClickPay}
|
|
|
|
- />
|
|
|
|
- <UploadInfoModel
|
|
|
|
- visible={visibleUpload}
|
|
|
|
- onCloseModel={handleCloseUpload}
|
|
|
|
- handleSuccess={handleUploadCardSuccess}
|
|
|
|
- />
|
|
|
|
- <ApplyPermission
|
|
|
|
- visible={visibleApply}
|
|
|
|
- detailID={
|
|
|
|
- tryType === ITryType.Article
|
|
|
|
- ? (dataInfo as IArcticleInfo).Detail.ArticleId
|
|
|
|
- : (dataInfo as IActivityTypeDetailRes).Detail.ActivityId
|
|
|
|
- }
|
|
|
|
tryType={tryType}
|
|
tryType={tryType}
|
|
- onCloseModel={handleCloseApply}
|
|
+ open={visibleBuyCard}
|
|
|
|
+ applyTrial={visibleApply}
|
|
|
|
+ onRefresh={onRefresh}
|
|
/>
|
|
/>
|
|
</>
|
|
</>
|
|
)
|
|
)
|