| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629 |
- <template>
- <view class="common_page" :style="{'min-height':h+'px', 'padding-top':mt+'px'}">
- <cus-header title="公益活动详情" bgColor="transparent"></cus-header>
- <image src="https://transcend.ringzle.com/xiaozhi-app/profile/2025/09/19/54b75bc8-d926-449b-95a5-1126f700b481.png" class="top_bg_img" mode="widthFix"></image>
- <view class="top">
- <view class="top-status adfacjb">
- <view class="left">{{signupStateDict[info?.signupState]||'未知'}}</view>
- <view class="right" v-if="info?.activityLimit==1"><span>{{info?.valueLimit||0}}</span>爱心值</view>
- <view class="right" v-else-if="info?.activityLimit==2"><span>{{info?.valueLimit||0}}</span>张专享券</view>
- <view class="right" v-else-if="info?.activityLimit==3"><span>免费</span></view>
- </view>
- <view class="top-no">善行少年编号:{{info?.uniqueNo||''}}</view>
- </view>
- <view class="box box1 adf" style="margin-top: 30rpx;">
- <view class="box1-left">
- <image :src="info?.coverFile||''"></image>
- </view>
- <view class="box1-right">
- <view class="title">{{info?.activityName||''}}</view>
- <view class="memo">{{info?.loveValueContent||''}}</view>
- </view>
- </view>
- <view class="box box2">
- <view class="box-title">活动信息</view>
- <view class="box2-item adf">
- <view class="left">报名时间</view>
- <view class="right">{{info?.signupStartTime||''}} ~ {{info?.signupEndTime||''}}</view>
- </view>
- <view class="box2-item adf">
- <view class="left">活动时间</view>
- <view class="right">{{info?.activityStartTime||''}} ~ {{info?.activityEndTime||''}}</view>
- </view>
- <view class="box2-item adf">
- <view class="left">活动地点</view>
- <view class="right">{{info?.provinceName||''}}{{info?.cityName||''}}</view>
- </view>
- <view class="box2-item adf">
- <view class="left">招募人数</view>
- <view class="right">{{info?.recruitmentNow||0}}/{{info?.recruitmentMax||'无限制'}}</view>
- </view>
- <view class="box2-item adf">
- <view class="left">联系人</view>
- <view class="right">{{info?.activityContact||''}}/{{info?.activityContactPhone||''}}</view>
- </view>
- <view class="box2-item adf">
- <view class="left">公益支持</view>
- <view class="right">{{info?.channelName||''}}</view>
- </view>
- </view>
- <view class="box box3">
- <view class="box-title">报名信息</view>
- <view class="box3-list">
- <view class="box3-list-item adfacjb">
- <view class="left">
- <view class="top adfac">
- <view class="name">{{info?.memberName||''}}</view>
- <image class="sex" v-if="info?.gender==1" src="https://transcend.ringzle.com/xiaozhi-app/profile/2025/09/12/b6d1fcb3-55ba-4104-b8cd-756b963a4da8.png"></image>
- <image class="sex" v-else-if="info?.gender==0" src="https://transcend.ringzle.com/xiaozhi-app/profile/2025/09/12/a1899fd0-c468-48d9-b554-2f17b75a4157.png"></image>
- <view class="age" :class="{'women':info?.gender==1,'man':info?.gender==0}">{{info?.age}}岁</view>
- </view>
- <view class="left-bottom">身份证 {{info?.idCardCopy}}</view>
- </view>
- </view>
- </view>
- </view>
- <view class="user">
- <view class="user-pre adfacjb">
- <view class="user-pre-left">联系人姓名</view>
- <view class="user-pre-right">{{info?.contact||''}}</view>
- </view>
- <view class="user-pre adfacjb">
- <view class="user-pre-left">联系人电话</view>
- <view class="user-pre-right">{{info?.contactPhone||''}}</view>
- </view>
- </view>
- <view class="user" v-if="info?.activityLimit==2">
- <view class="user-pre adfacjb" @click="handleSelectTicket">
- <view class="user-pre-left">专享券抵扣</view>
- <view class="user-pre-right adfac">
- <text>{{ticketText}}</text>
- <image src="https://transcend.ringzle.com/xiaozhi-app/profile/2025/10/10/4d3329f1-7421-4bde-a7dd-5175a7748f8f.png"></image>
- </view>
- </view>
- </view>
- <view class="bottom adfacjb">
- <view class="right" @click="handleCancel" v-if="info?.activeState==1&&info?.signupState==1">取消报名</view>
- <view class="right" @click="handleApply" v-else-if="info?.activeState==1&&info?.signupState==-1">立即报名</view>
- <view class="right" @click="handleSignup" v-else-if="info?.activeState==2&&info?.signupState==1">去签到</view>
- <view class="right grey" v-else-if="info?.activeState==2&&info?.signupState==2">已签到</view>
- <view class="right" @click="handleFill" v-else-if="info?.activeState==3&&info?.signupState==2">写档案</view>
- <view class="right" @click="handleReview" v-else-if="info?.activeState==3&&info?.signupState==3">查看档案</view>
- </view>
- </view>
- </template>
- <script setup name="">
- import CusHeader from '@/components/CusHeader/index.vue'
- import { ref, getCurrentInstance } from 'vue'
- import { onLoad } from '@dcloudio/uni-app'
- const { proxy } = getCurrentInstance()
-
- const info = ref(null)
- const memberSignupId = ref('')
- const signupStateDict = ref({
- '-1':'已取消',
- 1:'已报名',
- 2:'已签到',
- 3:'已填档案'
- })
- const userLoveTicket = ref(null)
- const selectCouponIds = ref([])
- const ticketText = ref('暂无可用专享券')
- const getUserActivityDetail = () => {
- proxy.$api.get(`/core/activity/signup/myActivityInfo/${memberSignupId.value}`).then(({data:res})=>{
- if(res.code!==0) return proxy.$showToast(res.msg)
- info.value = res.data;
- info.value.age = getAge(info.value.idCard);
- info.value.idCardCopy = info.value.idCard.replace(/^(\d{6})(\d{8})(\d{3}[\dX])$/i,'$1********$3');
- getUserLoveTicket()
- })
- }
-
- const isValid = (idCard) => {
- // 正则表达式校验18位身份证号码(最后一位可以是数字或X/x)
- const regex = /^[1-9]\d{5}(18|19|20)\d{2}((0[1-9])|(1[0-2]))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/;
- return typeof idCard === 'string' && regex.test(idCard);
- }
-
- const getAge = (idCard) => {
- if (!isValid(idCard)) return 0
-
- // 从身份证的第7位开始,截取8位作为出生日期字符串 (YYYYMMDD)
- const birthDateStr = idCard.substring(6, 14);
- const birthYear = parseInt(birthDateStr.substring(0, 4), 10);
- const birthMonth = parseInt(birthDateStr.substring(4, 6), 10);
- const birthDay = parseInt(birthDateStr.substring(6, 8), 10);
-
- const today = new Date();
- const currentYear = today.getFullYear();
- const currentMonth = today.getMonth() + 1; // getMonth() 返回 0-11
- const currentDay = today.getDate();
-
- // 计算周岁
- let age = currentYear - birthYear;
-
- // 如果当前月份小于出生月份,或者月份相同但日期小于出生日期,说明今年的生日还没过
- if (currentMonth < birthMonth || (currentMonth === birthMonth && currentDay < birthDay)) {
- age--;
- }
-
- return age < 0 ? 0 : age;
- }
-
- const handleCancel = () => {
- uni.showModal({
- title:'温馨提示',
- content:'确认取消本次报名吗?取消后可再次报名本活动。',
- success: (res) => {
- if(res.confirm){
- proxy.$api.get(`/core/activity/signup/cancelSignupBySingle/${memberSignupId.value}`).then(({data:res})=>{
- if(res.code!==0) return proxy.$showToast(res.msg)
- getUserActivityDetail()
- proxy.$showToast('取消报名成功')
- })
- }
- }
- })
- }
-
- const handleApply = () => {
- let couponId = '';
- if(info.value?.activityLimit==2){
- if(selectCouponIds.value.length==0) return proxy.$showToast(`请选择1张专享券`)
- couponId = selectCouponIds.value[0];
- }
- proxy.$api.post(`/core/activity/signup/signupBySingle`,{
- couponId,
- memberSignupId:memberSignupId.value,
- userId:JSON.parse(uni.getStorageSync('userInfo')).id
- }).then(({data:res})=>{
- if(res.code!==0) return proxy.$showToast(res.msg)
- getUserActivityDetail()
- proxy.$showToast('报名成功')
- })
- }
-
- const handleSignup = () => {
- try{
- uni.scanCode({
- success: (res) => {
- if(res.errMsg=='scanCode:ok'){
- let { id } = JSON.parse(res.result)
- proxy.$api.post('/core/activity/signup/signinBySingle',{
- memberSignupId:memberSignupId.value,
- userId:JSON.parse(uni.getStorageSync('userInfo')).id
- }).then(({data:res})=>{
- if(res.code!==0) return proxy.$showToast(res.msg)
- uni.navigateTo({
- url:'/pagesHome/signSuccess'
- })
- })
- }else proxy.$showToast(res.errMsg)
- },
- fail: (err) => {
- proxy.$showToast('扫描异常,请稍后再试')
- }
- })
- }catch(e){
- proxy.$showToast('签到异常,请稍后再试')
- }
- }
- const handleFill = () => {
- uni.navigateTo({
- url:'/pagesHome/fillNonprofitArchives?activity='+encodeURIComponent(JSON.stringify(info.value))
- })
- }
- const handleReview = () => {
-
- }
-
- const getUserLoveTicket = () => {
- let userId = JSON.parse(uni.getStorageSync('userInfo'))?.id;
- proxy.$api.get(`/core/activity/signup/userAsset/${userId}/${info.value?.activityId}`).then(({data:res})=>{
- if(res.code!==0) return proxy.$showToast(res.msg)
- userLoveTicket.value = res.data;
- ticketText.value = `剩余${res.data?.couponIds?.length||0}张可用`;
- })
- }
-
- const handleSelectTicket = () => {
- uni.navigateTo({
- url:'/pagesMy/exclusiveScroll?activityId='+info.value?.activityId,
- events:{
- 'selectTickets': data => {
- selectCouponIds.value = data;
- ticketText.value = `已选${data?.length||0}张,剩余${userLoveTicket.value?.couponIds?.length-data?.length}张可用`;
- }
- }
- })
- }
- onLoad((options)=>{
- memberSignupId.value = options?.memberSignupId;
- getUserActivityDetail()
- })
- </script>
- <style scoped lang="scss">
- .common_page{
- padding-bottom: 211rpx;
- box-sizing: border-box;
-
- .top{
- position: relative;
- margin-top: 39rpx;
- &-status{
- .left{
- font-family: PingFang-SC, PingFang-SC;
- font-weight: bold;
- font-size: 40rpx;
- color: #252525;
- line-height: 48rpx;
- }
- .right{
- font-family: PingFangSC, PingFang SC;
- font-weight: 400;
- font-size: 24rpx;
- color: #676775;
- line-height: 24rpx;
- label{
- font-family: PingFang-SC, PingFang-SC;
- font-weight: bold;
- font-size: 40rpx;
- color: #252525;
- line-height: 48rpx;
- margin-right: 6rpx;
- }
- }
- }
- &-no{
- font-family: PingFangSC, PingFang SC;
- font-weight: 400;
- font-size: 28rpx;
- color: #676775;
- line-height: 28rpx;
- margin-top: 30rpx;
- }
- }
-
- .box{
- background: #FFFFFF;
- border-radius: 24rpx;
- padding: 36rpx 24rpx;
- margin-top: 20rpx;
- position: relative;
- &-title{
- width: 170rpx;
- height: 44rpx;
- padding-left: 2rpx;
- font-family: PingFang-SC, PingFang-SC;
- font-weight: 800;
- font-size: 36rpx;
- color: #151B29;
- line-height: 36rpx;
- background-image: url('https://transcend.ringzle.com/xiaozhi-app/profile/2025/09/11/6ec1f999-fcbb-4a0b-a1a5-d0b5e1374bb1.png');
- background-size: 170rpx 31rpx;
- background-position: 0 20rpx;
- background-repeat: no-repeat;
- }
- }
-
- .box1{
- &-left{
- width: 158rpx;
- height: 214rpx;
- image{
- width: 100%;
- height: 100%;
- }
- }
- &-right{
- width: calc(100% - 158rpx);
- padding-left: 20rpx;
- box-sizing: border-box;
- .title{
- font-family: PingFang-SC, PingFang-SC;
- font-weight: bold;
- font-size: 32rpx;
- color: #151B29;
- line-height: 40rpx;
- }
- .memo{
- font-family: PingFangSC, PingFang SC;
- font-weight: 400;
- font-size: 24rpx;
- color: #C9A771;
- line-height: 37rpx;
- margin-top: 27rpx;
- }
- }
- }
-
- .box2{
- &-item{
- margin-top: 40rpx;
- justify-content: space-between;
- .left{
- font-family: PingFangSC, PingFang SC;
- font-weight: 400;
- font-size: 28rpx;
- color: #676775;
- line-height: 28rpx;
- width: 120rpx;
- }
- .right{
- width: calc(100% - 120rpx);
- padding-left: 20rpx;
- box-sizing: border-box;
- font-family: PingFangSC, PingFang SC;
- font-weight: 400;
- font-size: 28rpx;
- color: #252525;
- line-height: 28rpx;
- text-align: right;
- }
- }
- }
-
- .box3{
- &-list{
- margin-top: 15rpx;
- &-item{
- margin-top: 25rpx;
- .left{
- .top{
- .name{
- font-family: PingFang-SC, PingFang-SC;
- font-weight: bold;
- font-size: 32rpx;
- color: #151B29;
- line-height: 32rpx;
- }
- .sex{
- width: 44rpx;
- height: 32rpx;
- margin-left: 10rpx;
- }
- .age{
- border-radius: 13rpx;
- font-family: PingFangSC, PingFang SC;
- font-weight: 400;
- font-size: 20rpx;
- line-height: 24rpx;
- padding: 4rpx 10rpx;
- margin-left: 13rpx;
- &.women{
- background: rgba(244,101,122,0.14);
- color: #F4657A;
- }
- &.man{
- background: rgba(5,169,254,0.12);
- color: #05A9FE;
- }
- }
- }
- &-bottom{
- font-family: PingFangSC, PingFang SC;
- font-weight: 400;
- font-size: 24rpx;
- color: #989998;
- line-height: 24rpx;
- margin-top: 24rpx;
- }
- }
- .right{
- image{
- width: 36rpx;
- height: 36rpx;
- }
- }
- }
- }
- }
-
- .box4{
- &-detail{
- margin-top: 40rpx;
- }
- }
-
- .user{
- margin-top: 20rpx;
- border-radius: 20rpx;
- background: #FFFFFF;
- &-pre{
- padding: 40rpx 24rpx;
- box-shadow: inset 0rpx -1rpx 0rpx 0rpx #ECEEF5;
- &-left{
- font-family: PingFangSC, PingFang SC;
- font-weight: 400;
- font-size: 30rpx;
- color: #676775;
- line-height: 30rpx;
- }
- &-right{
- font-family: PingFangSC, PingFang SC;
- font-weight: 400;
- font-size: 30rpx;
- color: #252525;
- line-height: 30rpx;
- text-align: right;
- image{
- width: 32rpx;
- height: 32rpx;
- margin-left: 20rpx;
- }
- }
- }
- }
-
- .bottom{
- width: 100%;
- height: 191rpx;
- background: #FFFFFF;
- box-shadow: 0rpx -2rpx 8rpx 0rpx rgba(178,178,178,0.1);
- padding: 0 30rpx;
- box-sizing: border-box;
- position: fixed;
- left: 0;
- bottom: 0;
- .left{
- text{
- font-family: PingFangSC, PingFang SC;
- font-weight: 400;
- font-size: 26rpx;
- color: #151B29;
- line-height: 26rpx;
- margin-top: 17rpx;
- }
- }
- .right{
- width: 100%;
- height: 90rpx;
- background: #B7F358;
- border-radius: 45rpx;
- font-family: PingFang-SC, PingFang-SC;
- font-weight: bold;
- font-size: 32rpx;
- color: #151B29;
- line-height: 90rpx;
- text-align: center;
- letter-spacing: 2rpx;
- &.grey{
- background: #F7F7F7;
- }
- }
- }
-
- .dialog{
- position: fixed;
- left: 0;
- right: 0;
- top: 0;
- bottom: 0;
- background: rgba(0,0,0,0.4);
- display: flex;
- flex-direction: column;
- justify-content: flex-end;
- .dbox{
- position: relative;
- background: #FFFFFF;
- border-radius: 24rpx 24rpx 0rpx 0rpx;
- padding: 40rpx 0 64rpx;
- &-title{
- font-family: PingFang-SC, PingFang-SC;
- font-weight: bold;
- font-size: 36rpx;
- color: #151B29;
- line-height: 36rpx;
- text-align: center;
- }
- .close{
- width: 27rpx;
- height: 27rpx;
- position: absolute;
- top: 40rpx;
- right: 30rpx;
- }
- &-select{
- margin-top: 57rpx;
- padding: 27rpx 30rpx;
- background: #F7F7F7;
- &-left{
- font-family: PingFang-SC, PingFang-SC;
- font-weight: bold;
- font-size: 32rpx;
- color: #151B29;
- line-height: 36rpx;
- }
- &-right{
- text{
- font-family: PingFangSC, PingFang SC;
- font-weight: 400;
- font-size: 28rpx;
- color: #151B29;
- line-height: 36rpx;
- }
- image{
- width: 36rpx;
- height: 36rpx;
- margin-left: 10rpx;
- }
- }
- }
- &-list{
- padding: 0 30rpx;
- height: 820rpx;
- overflow-y: auto;
- &-item{
- padding: 36rpx 0;
- box-shadow: inset 0rpx -1rpx 0rpx 0rpx #E5E7EB;
- &-left{
- &-top{
- .name{
- font-family: PingFang-SC, PingFang-SC;
- font-weight: bold;
- font-size: 32rpx;
- color: #151B29;
- line-height: 32rpx;
- }
- .sex{
- width: 44rpx;
- height: 32rpx;
- margin-left: 20rpx;
- }
- .age{
- border-radius: 13rpx;
- font-family: PingFangSC, PingFang SC;
- font-weight: 400;
- font-size: 20rpx;
- line-height: 24rpx;
- padding: 4rpx 10rpx;
- margin-left: 13rpx;
- &.women{
- background: rgba(244,101,122,0.14);
- color: #F4657A;
- }
- &.man{
- background: rgba(5,169,254,0.12);
- color: #05A9FE;
- }
- }
- }
- &-bottom{
- font-family: PingFangSC, PingFang SC;
- font-weight: 400;
- font-size: 24rpx;
- color: #989998;
- line-height: 24rpx;
- margin-top: 18rpx;
- }
- }
- &-right{
- image{
- width: 36rpx;
- height: 36rpx;
- }
- }
- }
- }
- &-btn{
- margin: 43rpx 40rpx 0;
- width: calc(100% - 80rpx);
- height: 90rpx;
- background: #B7F358;
- border-radius: 45rpx;
- font-family: PingFang-SC, PingFang-SC;
- font-weight: bold;
- font-size: 32rpx;
- color: #151B29;
- line-height: 90rpx;
- text-align: center;
- letter-spacing: 2rpx;
- }
- }
- }
- }
- </style>
|