|
@@ -0,0 +1,215 @@
|
|
|
+import React, { useEffect, useState } from 'react'
|
|
|
+import useRequest from '@ahooksjs/use-request'
|
|
|
+import { useHistory } from 'react-router-dom'
|
|
|
+
|
|
|
+import { Popover, Result, Tooltip, message } from 'antd'
|
|
|
+import { InfoCircleOutlined } from '@ant-design/icons'
|
|
|
+
|
|
|
+import NoPowerImg from 'assets/nopower.png'
|
|
|
+import BagImg from 'assets/bag.png'
|
|
|
+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 { IArcticleInfo, MaterialService } from 'Material/Material.service'
|
|
|
+import { ITryType, ISpecialType, INewPermissionType } from './NoPermission'
|
|
|
+import ApplyResult from './ApplyResult'
|
|
|
+import styles from '../css/NoPermission.module.scss'
|
|
|
+import YiDongModel from './YiDongModel'
|
|
|
+import BuyModel, { PayType } from './BuyModel'
|
|
|
+import QRCodeModel from './QRCodeModel'
|
|
|
+import UploadInfoModel from './UploadInfoModel'
|
|
|
+
|
|
|
+interface IPayNoPermissionProps {
|
|
|
+ dataInfo: IArcticleInfo
|
|
|
+ tryType: ITryType
|
|
|
+ border?: boolean
|
|
|
+}
|
|
|
+/**购买权限 */
|
|
|
+const PayNoPermission: React.FC<IPayNoPermissionProps> = props => {
|
|
|
+ const { dataInfo, tryType, border = false } = props
|
|
|
+ const [visibleApply, setVisibleApply] = useState(false) // 普通申请权限弹框
|
|
|
+ const [visibleUpload, setVisibleUpload] = useState(false) // 机构申请试用弹框
|
|
|
+ const [visibleBuyCard, setVisibleBuyCard] = useState(false) // 购买畅读卡弹框
|
|
|
+
|
|
|
+ const [visibleResult, setVisibleResult] = useState(true) // 支付结果弹框
|
|
|
+
|
|
|
+ const history = useHistory()
|
|
|
+ const media = useMedia()
|
|
|
+ // const [isHideBack, setIsHideBack] = useState<boolean>(false) // 识别报告详情页+活动详情页,隐藏返回按钮
|
|
|
+
|
|
|
+ useEffect(() => {
|
|
|
+ // handleChangeMenuKey(history.location)
|
|
|
+ // history.listen(location => {
|
|
|
+ // window.scrollTo(0, 0)
|
|
|
+ // handleChangeMenuKey(location)
|
|
|
+ // })
|
|
|
+ // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
|
+ }, [])
|
|
|
+
|
|
|
+ // const handleChangeMenuKey = (location: any) => {
|
|
|
+ // // 识别报告详情页+活动详情页,适配移动菜单
|
|
|
+ // if (media.isSmallMax) {
|
|
|
+ // const routhStr = ['/material/info', '/activity/info', '/activity/detail', '/internal/article', '/column/detail']
|
|
|
+ // let flag = false
|
|
|
+ // routhStr.forEach(item => {
|
|
|
+ // if (location.pathname.includes(item)) {
|
|
|
+ // setIsHideBack(true)
|
|
|
+ // flag = true
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ // if (!flag) {
|
|
|
+ // setIsHideBack(false)
|
|
|
+ // }
|
|
|
+ // } else {
|
|
|
+ // setIsHideBack(false)
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+
|
|
|
+ const { run } = useRequest(MaterialService.postApplyTry, {
|
|
|
+ manual: true,
|
|
|
+ onSuccess: res => {
|
|
|
+ res.data.Ret === 200 ? message.success('提交成功,请等待销售人员与您联系') : message.info(res.data.Msg)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ const handleCloseResult = () => {
|
|
|
+ setVisibleResult(false)
|
|
|
+ }
|
|
|
+ // 关闭购买畅读卡弹框
|
|
|
+ const handleCloseBuy = () => {
|
|
|
+ setVisibleBuyCard(false)
|
|
|
+ }
|
|
|
+ // 关闭上传名片弹框
|
|
|
+ const handleCloseUpload = () => {
|
|
|
+ setVisibleUpload(false)
|
|
|
+ }
|
|
|
+ // 点击购买畅读卡按钮
|
|
|
+ const handleOpenBuyModel = () => {
|
|
|
+ // 判断是否需要上传名片
|
|
|
+ setVisibleUpload(true)
|
|
|
+ if (dataInfo.IsNeedBusinessCard) {
|
|
|
+ setVisibleUpload(true)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ // 打开畅读卡弹框
|
|
|
+ setVisibleBuyCard(true)
|
|
|
+ }
|
|
|
+ // 申请试用
|
|
|
+ const handleToAskTry = () => {
|
|
|
+ // HasPermission=2,4,6,已提交过申请的,提示:您已提交过申请,请等待销售与您联系。
|
|
|
+ const hasPermission = dataInfo.HasPermission
|
|
|
+ if (
|
|
|
+ hasPermission === INewPermissionType.HasApplyQY ||
|
|
|
+ hasPermission === INewPermissionType.HasApplyFICC ||
|
|
|
+ hasPermission === INewPermissionType.HasApplyPotential
|
|
|
+ ) {
|
|
|
+ message.info('您已提交过申请,请等待销售与您联系。')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ // HasPermission=3,5,不弹表单,直接提交申请
|
|
|
+ if (hasPermission === INewPermissionType.NoApplyQY || hasPermission === INewPermissionType.NoApplyFICC) {
|
|
|
+ run({ ApplyMethod: 1, DetailId: dataInfo.Detail.ArticleId, TryType: tryType })
|
|
|
+ return
|
|
|
+ }
|
|
|
+ // HasPermission=7,弹表单填写,提交申请
|
|
|
+ setVisibleApply(true)
|
|
|
+ }
|
|
|
+ // 关闭申请试用弹框
|
|
|
+ const handleCloseApply = () => {
|
|
|
+ setVisibleApply(false)
|
|
|
+ }
|
|
|
+
|
|
|
+ return (
|
|
|
+ <>
|
|
|
+ <div className={`${border ? styles['gray-boder-box'] : ''} ${styles['nopower-showwxpay-wrapper']}`}>
|
|
|
+ <img src={NoPowerImg} alt="无权限" className="nopower-big-img" />
|
|
|
+ <div className="nopower-content-wrapper">
|
|
|
+ <div className="nopower-title">
|
|
|
+ {tryType === ITryType.Article ? '暂无权限查看此报告' : '暂无权限参加此活动'}
|
|
|
+ </div>
|
|
|
+ <div className="nopower-text">
|
|
|
+ <span>您可以购买畅读卡后查看</span>
|
|
|
+ <span className="nopower-red">({dataInfo.PopupPriceMsg})</span>
|
|
|
+ <Tooltip
|
|
|
+ title={
|
|
|
+ <div>
|
|
|
+ 注释:畅读卡有效期内,可查阅无限量调研纪要及常规研选专栏,
|
|
|
+ 参与所有公开活动(日卡自付费完成顺延24小时,月卡自付费完成当天顺延一个自然月)
|
|
|
+ </div>
|
|
|
+ }
|
|
|
+ >
|
|
|
+ {/* <InfoCircleOutlined style={{ fontSize: 16 }} /> */}
|
|
|
+ <img src={TipsSvg} alt="icon" className="nopower-tips-icon" />
|
|
|
+ </Tooltip>
|
|
|
+ </div>
|
|
|
+ <NButton type="primary" onClick={handleOpenBuyModel} size="large" className="btn-line">
|
|
|
+ 购买畅读卡
|
|
|
+ </NButton>
|
|
|
+ <div className="nopower-text m-t-md">或向销售申请开通机构试用权限</div>
|
|
|
+ <NButton
|
|
|
+ type="default"
|
|
|
+ onClick={handleToAskTry}
|
|
|
+ size="auto-large"
|
|
|
+ className="btn-line"
|
|
|
+ disabled={dataInfo.IsCompanyApply}
|
|
|
+ >
|
|
|
+ <div className="nopower-disable-text">申请试用</div>
|
|
|
+ {dataInfo.IsCompanyApply && <span className="com-fz12">(贵司已申请过机构试用)</span>}
|
|
|
+ </NButton>
|
|
|
+ <div className="com-fz12 m-t-sm">(仅限机构投资者)</div>
|
|
|
+ <div className="g-inline-block">
|
|
|
+ <div className="nopower-bag-wrapper">
|
|
|
+ <img src={BagImg} alt="图片" className="nopower-bag-img" />
|
|
|
+ <div className="nopower-bag-right">
|
|
|
+ <div className="nopower-br-text com-fw-bold">
|
|
|
+ 机构订阅服务报价:
|
|
|
+ <span className="com-fz20">3w/年</span>
|
|
|
+ </div>
|
|
|
+ <div className="nopower-br-text com-fz12 mobile-sm-text">
|
|
|
+ 无限量调研纪要及常规研选专栏查阅, 公开活动参与
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ {/* <QRCodeModel
|
|
|
+ visible={visibleResult}
|
|
|
+ detailID={dataInfo.Detail.ArticleId}
|
|
|
+ tryType={tryType}
|
|
|
+ handleClose={handleCloseResult}
|
|
|
+ /> */}
|
|
|
+
|
|
|
+ {/* <ApplyResult
|
|
|
+ visible={visibleResult}
|
|
|
+ detailID={dataInfo.Detail.ArticleId}
|
|
|
+ tryType={tryType}
|
|
|
+ handleClose={handleCloseResult}
|
|
|
+ /> */}
|
|
|
+ <BuyModel
|
|
|
+ visible={visibleBuyCard}
|
|
|
+ detailID={dataInfo.Detail.ArticleId}
|
|
|
+ tryType={tryType}
|
|
|
+ payType={PayType.Single}
|
|
|
+ handleClose={handleCloseBuy}
|
|
|
+ />
|
|
|
+ <UploadInfoModel
|
|
|
+ visible={visibleUpload}
|
|
|
+ detailID={dataInfo.Detail.ArticleId}
|
|
|
+ tryType={tryType}
|
|
|
+ handleClose={handleCloseUpload}
|
|
|
+ />
|
|
|
+ <ApplyPermission
|
|
|
+ visible={visibleApply}
|
|
|
+ detailID={dataInfo.Detail.ArticleId}
|
|
|
+ tryType={tryType}
|
|
|
+ handleClose={handleCloseApply}
|
|
|
+ />
|
|
|
+ </>
|
|
|
+ )
|
|
|
+}
|
|
|
+
|
|
|
+export default PayNoPermission
|