import { CellGroup, Cell, Image, Button, Popup, List } from 'vant' import { defineComponent } from 'vue' import styles from './index.module.less' import award from './images/award.png' import cert from './images/cert.png' import request from '@/helpers/request' import ColResult from '@/components/col-result' import { state } from '@/state' import dayjs from 'dayjs' import ColPopup from '@/components/col-popup' import UserAuth from '../order-detail/userAuth' import ColHeader from '@/components/col-header' export default defineComponent({ name: 'award-activity', data() { return { status: false, type: 'auth', list: [], dataShow: true, // 判断是否有数据 loading: false, finished: false, params: { // receive: 2, page: 1, rows: 20 }, exists: false, popupShow: false, receiveRewardId: null as any } }, // /student-server/activity/receiveRewardList 学生端查看未领奖列表接口 // /student-server/activity/receiveReward/{receiveRewardId} 学生端领奖接口 // /teacher-server/activity/receiveRewardList 老师端查看未领奖列表接口 // /teacher-server/activity/receiveReward/{receiveRewardId} 学生端领奖接口 async mounted() { this.getUserRegisterProtocol() this.getList() }, methods: { async getUserRegisterProtocol() { // 获取是否签署过《用户注册协议》 try { const res = await request.get( state.platformApi + '/sysUserContractRecord/checkContractSign', { params: { contractType: 'REGISTER' } } ) this.exists = res.data } catch { // } }, async onGetAward() { try { const users = state.user.data // 判断是否需要实名认证, 姓名,卡号,是否签协议 if (!users?.realName || !users?.idCardNo || !this.exists) { this.status = true this.type = 'auth' return } await request.post( `${state.platformApi}/activity/receiveReward/${this.receiveRewardId}` ) this.status = true this.type = 'success' this.receiveRewardId = null } catch { // } }, async onAuthSuccess() { this.popupShow = false this.status = false await this.getUserRegisterProtocol() this.onGetAward() }, async getList() { try { const params = this.params const res = await request.post( `${state.platformApi}/activity/receiveRewardList`, { data: { ...params } } ) this.loading = false const result = res.data || {} // 处理重复请求数据 if (this.list.length > 0 && result.pageNo === 1) { return } this.list = this.list.concat(result.rows || []) this.finished = result.pageNo >= result.totalPage this.params.page = result.pageNo + 1 this.dataShow = this.list.length > 0 } catch { this.dataShow = false this.finished = true } } }, render() { return (
{this.dataShow ? ( {this.list.map((item: any) => ( ( ), title: () => (
{item.rewardName}
), label: () => (
{item.rewardDescribe}
) }} /> ( ) }} />
))}
) : ( )}
{this.type === 'auth' && ( <>

您还没有实名认证

完成实名认证后即可领取奖品

)} {this.type === 'success' && ( <>

奖品领取成功!

请耐心等待,活动奖品将会到达~

)}
) } })