|
@@ -26,6 +26,7 @@ import { MaterialService } from 'Material/Material.service'
|
|
|
import { INewestItem } from 'Newest/Newest.service'
|
|
|
import { IMyActivityItem } from 'Personal/Personal.service'
|
|
|
import styles from '../css/ActivityCard.module.scss'
|
|
|
+import UploadInfoModel from 'Material/components/UploadInfoModel'
|
|
|
|
|
|
export enum IActivityBtnType {
|
|
|
Appointment = 'appointment',
|
|
@@ -64,6 +65,7 @@ export interface IActivityBtnComponent {
|
|
|
selfChange?: boolean // 自身按钮状态改变
|
|
|
btnClass?: 'act-btn-sm' | 'research-btn-sm' // 按钮的自定义样式
|
|
|
btnGrous?: 'smcard' | 'detail' | 'bigcard' // smcard-如首页的小卡片,detail-如活动详情页,bigcard-如列表的大卡片
|
|
|
+ isType?: string
|
|
|
onChangeSomething?: (activityId?: number) => void // 子组件变更后的操作
|
|
|
onNeedToDoSome?: () => void // 父组件的操作
|
|
|
}
|
|
@@ -73,6 +75,7 @@ const ActivityBtnComponent: React.FC<IActivityBtnComponent> = props => {
|
|
|
isSpecial = false,
|
|
|
selfChange = false,
|
|
|
btnClass,
|
|
|
+ isType,
|
|
|
btnGrous = 'smcard',
|
|
|
onChangeSomething,
|
|
|
onNeedToDoSome
|
|
@@ -91,6 +94,7 @@ const ActivityBtnComponent: React.FC<IActivityBtnComponent> = props => {
|
|
|
const [actionType, setActionType] = useState<IActivityBtnType | IActivitySpecialBtnType>() // 记录点击了哪个按钮操作
|
|
|
const [resourceCountData, setResourceCountData] = useState({ CompanyPoints: '0', ActivityPoints: '0' }) // 记录活动扣点数据
|
|
|
// const [visibleApply, setVisibleApply] = useState(false) // 普通申请权限弹框
|
|
|
+ const [visibleUpload, setVisibleUpload] = useState(false) // 机构申请试用弹框
|
|
|
|
|
|
const login2p = useLogin2p()
|
|
|
const location = useLocation()
|
|
@@ -360,14 +364,21 @@ const ActivityBtnComponent: React.FC<IActivityBtnComponent> = props => {
|
|
|
return { title: title[type] }
|
|
|
}
|
|
|
// 权限判断
|
|
|
- const handleCheckPower = (HasPermission: INewPermissionType, isResearch: boolean, isResearchSpecial: boolean) => {
|
|
|
+ const handleCheckPower = (
|
|
|
+ HasPermission: INewPermissionType,
|
|
|
+ isResearch: boolean,
|
|
|
+ isResearchSpecial: boolean,
|
|
|
+ activityPay = true
|
|
|
+ ) => {
|
|
|
// 如果接口没返回权限则跳过
|
|
|
if (!HasPermission) return true
|
|
|
|
|
|
// 1.先判断权限,无权限则弹框
|
|
|
if (HasPermission !== INewPermissionType.OK) {
|
|
|
// 列表的按钮点击,无权限时,需要进入详情页
|
|
|
- if (btnGrous !== 'detail') {
|
|
|
+ console.log(activityPay)
|
|
|
+
|
|
|
+ if (btnGrous !== 'detail' && activityPay) {
|
|
|
isSpecial
|
|
|
? window.open(`/activity/info/${(item as IActivitySpecialListItem).ActivityId}`)
|
|
|
: window.open(`/activity/detail/${(item as IActivityTypeListItem).ActivityId}`)
|
|
@@ -408,12 +419,16 @@ const ActivityBtnComponent: React.FC<IActivityBtnComponent> = props => {
|
|
|
history.push(`/login2p?next=${encodeURIComponent(location.pathname + location.search)}`)
|
|
|
return
|
|
|
}
|
|
|
+ console.log((item as IActivityTypeListItem)?.IsShowWxPay, '(item as IActivityTypeListItem)?.IsShowWxPay')
|
|
|
+
|
|
|
//先简单的检查一下权限
|
|
|
const powerCheck = handleCheckPower(
|
|
|
item?.AuthInfo?.HasPermission,
|
|
|
item?.IsResearch,
|
|
|
- (item as IActivityTypeListItem)?.IsResearchSpecial
|
|
|
+ (item as IActivityTypeListItem)?.IsResearchSpecial,
|
|
|
+ (item as IActivityTypeListItem)?.IsShowWxPay
|
|
|
)
|
|
|
+
|
|
|
if (!powerCheck) return
|
|
|
// 易懂同步过来的活动 直接跳转
|
|
|
if ((item as IActivityTypeListItem)?.IsYidongActivity) {
|
|
@@ -701,7 +716,19 @@ const ActivityBtnComponent: React.FC<IActivityBtnComponent> = props => {
|
|
|
const handleReturnGoOn = (res: IActivityCheckRes) => {
|
|
|
// 1.权限
|
|
|
if (!res.CheckPermission) {
|
|
|
- handleCheckPower(res.HasPermission, res.IsResearch, res?.IsResearchSpecial)
|
|
|
+ handleCheckPower(res.HasPermission, res.IsResearch, res?.IsResearchSpecial, res.IsShowWxPaySet)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ // 1.1.人数
|
|
|
+ if (!res.CheckSiginUpNum) {
|
|
|
+ Modal.warning({
|
|
|
+ title: '提示',
|
|
|
+ content: (
|
|
|
+ <div dangerouslySetInnerHTML={{ __html: '此活动报名人数已满,请留意下期活动' }} className="reset-pm" />
|
|
|
+ ),
|
|
|
+ okText: '知道了',
|
|
|
+ centered: true
|
|
|
+ })
|
|
|
return
|
|
|
}
|
|
|
// 2.时间
|
|
@@ -714,6 +741,24 @@ const ActivityBtnComponent: React.FC<IActivityBtnComponent> = props => {
|
|
|
})
|
|
|
return
|
|
|
}
|
|
|
+ //3.已有归属机构 ?
|
|
|
+ if (res.IsNeedBusinessCard) {
|
|
|
+ setVisibleUpload(true)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ // 4.邮箱绑定
|
|
|
+ if (!res.CheckEmail) {
|
|
|
+ setEmailVisible(true)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ // ----3.0 需求 是否是付费活动
|
|
|
+ if (res.IsPayActivity) {
|
|
|
+ applyActivitySignup(
|
|
|
+ (item as IActivityTypeListItem).ActivityId || (item as INewestItem).SourceId,
|
|
|
+ actionType === IActivityBtnType.Call ? 1 : callType ? callType : 3
|
|
|
+ )
|
|
|
+ return
|
|
|
+ }
|
|
|
// 3.研选扣点
|
|
|
if (!res.CheckPoints) {
|
|
|
// todo 如果需要付费 需要判断一下(需要加字段,是否需要支付,提示文案里的价格需要替换)
|
|
@@ -723,7 +768,9 @@ const ActivityBtnComponent: React.FC<IActivityBtnComponent> = props => {
|
|
|
content: (
|
|
|
<div className="reset-pm">
|
|
|
<p>
|
|
|
- <span>点数不足,您可以通过单场付费 ¥{res.GoodsList[0].CurrentPrice} 参与或者联系销售机构充值</span>
|
|
|
+ 点数不足,您可以通过单场付费
|
|
|
+ <span className={styles['nopower-red']}> ¥{res.GoodsList[0].CurrentPrice} </span>
|
|
|
+ 参与或者联系销售机构充值
|
|
|
</p>
|
|
|
<div>
|
|
|
当前剩余点数:<span className={styles['link-text']}>{res.CompanyPoints}</span>
|
|
@@ -735,7 +782,11 @@ const ActivityBtnComponent: React.FC<IActivityBtnComponent> = props => {
|
|
|
),
|
|
|
okText: '付费报名',
|
|
|
onOk: () => {
|
|
|
- window.open(`/activity/detail/${(item as IActivityTypeListItem).ActivityId}`)
|
|
|
+ if (isType === '详情') {
|
|
|
+ onNeedToDoSome && onNeedToDoSome()
|
|
|
+ } else {
|
|
|
+ window.open(`/activity/detail/${(item as IActivityTypeListItem).ActivityId}`)
|
|
|
+ }
|
|
|
},
|
|
|
width: 520,
|
|
|
centered: true
|
|
@@ -768,11 +819,7 @@ const ActivityBtnComponent: React.FC<IActivityBtnComponent> = props => {
|
|
|
}
|
|
|
|
|
|
setResourceCountData({ CompanyPoints: res.CompanyPoints, ActivityPoints: res.ActivityPoints })
|
|
|
- // 4.邮箱绑定
|
|
|
- if (!res.CheckEmail) {
|
|
|
- setEmailVisible(true)
|
|
|
- return
|
|
|
- }
|
|
|
+
|
|
|
// 研选扣点校验通过时需要弹框扣点提示
|
|
|
if (res.CheckPoints && item.IsResearchPoints) {
|
|
|
Modal.confirm({
|
|
@@ -807,37 +854,68 @@ const ActivityBtnComponent: React.FC<IActivityBtnComponent> = props => {
|
|
|
const handleChangeEmail = (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
|
setEmailInput(e.target.value)
|
|
|
}
|
|
|
+
|
|
|
+ // 关闭上传名片弹框
|
|
|
+ const handleCloseUpload = () => {
|
|
|
+ setVisibleUpload(false)
|
|
|
+ }
|
|
|
+
|
|
|
+ // 上传名片成功后,关闭上传名片弹框,并请求创建订单接口
|
|
|
+ const handleUploadCardSuccess = () => {
|
|
|
+ handleCloseUpload()
|
|
|
+ }
|
|
|
+
|
|
|
// 邮箱填写后报名
|
|
|
const handleApplySignUpWithEmail = () => {
|
|
|
if (!emailInput) return message.error('请输入邮箱地址')
|
|
|
- // 研选扣点校验通过时需要弹框扣点提示
|
|
|
- if (item.IsResearchPoints) {
|
|
|
- Modal.confirm({
|
|
|
- title: '确定报名吗?',
|
|
|
- content: (
|
|
|
- <div className="reset-pm">
|
|
|
- <div>
|
|
|
- 当前剩余点数:<span className={styles['link-text']}>{resourceCountData.CompanyPoints}</span>
|
|
|
- </div>
|
|
|
- <div>
|
|
|
- 本次会议扣除点数:<span className={styles['link-text']}>{resourceCountData.ActivityPoints}</span>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- ),
|
|
|
- okText: '确定',
|
|
|
- onOk: () => {
|
|
|
- applyActivitySignup(
|
|
|
- (item as IActivityTypeListItem).ActivityId || (item as INewestItem).SourceId,
|
|
|
- item.IsResearchPoints ? 3 : actionType === IActivityBtnType.Call ? 1 : callType ? callType : 3,
|
|
|
- emailInput
|
|
|
- )
|
|
|
- },
|
|
|
- width: 520,
|
|
|
- centered: true
|
|
|
- })
|
|
|
- return
|
|
|
- }
|
|
|
+ bindingEmailUse(emailInput)
|
|
|
+ // return
|
|
|
+ // // 研选扣点校验通过时需要弹框扣点提示
|
|
|
+ // if (item.IsResearchPoints) {
|
|
|
+ // Modal.confirm({
|
|
|
+ // title: '确定报名吗?',
|
|
|
+ // content: (
|
|
|
+ // <div className="reset-pm">
|
|
|
+ // <div>
|
|
|
+ // 当前剩余点数:<span className={styles['link-text']}>{resourceCountData.CompanyPoints}</span>
|
|
|
+ // </div>
|
|
|
+ // <div>
|
|
|
+ // 本次会议扣除点数:<span className={styles['link-text']}>{resourceCountData.ActivityPoints}</span>
|
|
|
+ // </div>
|
|
|
+ // </div>
|
|
|
+ // ),
|
|
|
+ // okText: '确定',
|
|
|
+ // onOk: () => {
|
|
|
+ // applyActivitySignup(
|
|
|
+ // (item as IActivityTypeListItem).ActivityId || (item as INewestItem).SourceId,
|
|
|
+ // item.IsResearchPoints ? 3 : actionType === IActivityBtnType.Call ? 1 : callType ? callType : 3,
|
|
|
+ // emailInput
|
|
|
+ // )
|
|
|
+ // },
|
|
|
+ // width: 520,
|
|
|
+ // centered: true
|
|
|
+ // })
|
|
|
+ // return
|
|
|
+ // } else {
|
|
|
+ // // 填完邮箱后没有点数的话再次调用
|
|
|
+ // applyActivityCheck((item as IActivityTypeListItem).ActivityId || (item as INewestItem).SourceId)
|
|
|
+ // }
|
|
|
}
|
|
|
+
|
|
|
+ // 邮箱的填写
|
|
|
+ const { run: bindingEmailUse } = useRequest(ActivityService.bindingEmail, {
|
|
|
+ manual: true,
|
|
|
+ formatResult: response => response.data,
|
|
|
+ onSuccess: res => {
|
|
|
+ if (res.Ret !== 200) {
|
|
|
+ message.error(res.ErrMsg || res.Msg)
|
|
|
+ } else {
|
|
|
+ setEmailVisible(false)
|
|
|
+ // 填完邮箱后再次判断一下最新的权限
|
|
|
+ applyActivityCheck((item as IActivityTypeListItem).ActivityId || (item as INewestItem).SourceId)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
return (
|
|
|
<>
|
|
|
{emailVisible ? (
|
|
@@ -1101,6 +1179,11 @@ const ActivityBtnComponent: React.FC<IActivityBtnComponent> = props => {
|
|
|
)}
|
|
|
</>
|
|
|
)}
|
|
|
+ <UploadInfoModel
|
|
|
+ visible={visibleUpload}
|
|
|
+ onCloseModel={handleCloseUpload}
|
|
|
+ handleSuccess={handleUploadCardSuccess}
|
|
|
+ />
|
|
|
</>
|
|
|
)}
|
|
|
</>
|