nonprofitDetail.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633
  1. <template>
  2. <view class="common_page" :style="{'min-height':h+'px', 'padding-top':mt+'px'}">
  3. <cus-header title="公益活动详情" bgColor="transparent"></cus-header>
  4. <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>
  5. <view class="top">
  6. <view class="top-status adfacjb">
  7. <view class="left">{{signupStateDict[info?.signupState]||'未知'}}</view>
  8. <view class="right" v-if="info?.activityLimit==1"><span>{{info?.valueLimit||0}}</span>爱心值</view>
  9. <view class="right" v-else-if="info?.activityLimit==2"><span>{{info?.valueLimit||0}}</span>张专享券</view>
  10. <view class="right" v-else-if="info?.activityLimit==3"><span>免费</span></view>
  11. </view>
  12. <view class="top-no">善行少年编号:{{info?.uniqueNo||''}}</view>
  13. </view>
  14. <view class="box box1 adf" style="margin-top: 30rpx;">
  15. <view class="box1-left">
  16. <image :src="info?.coverFile||''"></image>
  17. </view>
  18. <view class="box1-right">
  19. <view class="title">{{info?.activityName||''}}</view>
  20. <view class="memo">{{info?.loveValueContent||''}}</view>
  21. </view>
  22. </view>
  23. <view class="box box2">
  24. <view class="box-title">活动信息</view>
  25. <view class="box2-item adf">
  26. <view class="left">报名时间</view>
  27. <view class="right">{{info?.signupStartTime||''}} ~ {{info?.signupEndTime||''}}</view>
  28. </view>
  29. <view class="box2-item adf">
  30. <view class="left">活动时间</view>
  31. <view class="right">{{info?.activityStartTime||''}} ~ {{info?.activityEndTime||''}}</view>
  32. </view>
  33. <view class="box2-item adf">
  34. <view class="left">活动地点</view>
  35. <view class="right">{{info?.provinceName||''}}{{info?.cityName||''}}</view>
  36. </view>
  37. <view class="box2-item adf">
  38. <view class="left">招募人数</view>
  39. <view class="right">{{info?.recruitmentNow||0}}/{{info?.recruitmentMax||'无限制'}}</view>
  40. </view>
  41. <view class="box2-item adf">
  42. <view class="left">联系人</view>
  43. <view class="right">{{info?.activityContact||''}}/{{info?.activityContactPhone||''}}</view>
  44. </view>
  45. <view class="box2-item adf">
  46. <view class="left">公益支持</view>
  47. <view class="right">{{info?.channelName||''}}</view>
  48. </view>
  49. </view>
  50. <view class="box box3">
  51. <view class="box-title">报名信息</view>
  52. <view class="box3-list">
  53. <view class="box3-list-item adfacjb">
  54. <view class="left">
  55. <view class="top adfac">
  56. <view class="name">{{info?.memberName||''}}</view>
  57. <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>
  58. <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>
  59. <view class="age" :class="{'women':info?.gender==1,'man':info?.gender==0}">{{info?.age}}岁</view>
  60. </view>
  61. <view class="left-bottom">身份证 {{info?.idCardCopy}}</view>
  62. </view>
  63. </view>
  64. </view>
  65. </view>
  66. <view class="user">
  67. <view class="user-pre adfacjb">
  68. <view class="user-pre-left">联系人姓名</view>
  69. <view class="user-pre-right">{{info?.contact||''}}</view>
  70. </view>
  71. <view class="user-pre adfacjb">
  72. <view class="user-pre-left">联系人电话</view>
  73. <view class="user-pre-right">{{info?.contactPhone||''}}</view>
  74. </view>
  75. </view>
  76. <view class="user" v-if="info?.activityLimit==2">
  77. <view class="user-pre adfacjb" @click="handleSelectTicket">
  78. <view class="user-pre-left">专享券抵扣</view>
  79. <view class="user-pre-right adfac">
  80. <text>{{ticketText}}</text>
  81. <image src="https://transcend.ringzle.com/xiaozhi-app/profile/2025/10/10/4d3329f1-7421-4bde-a7dd-5175a7748f8f.png"></image>
  82. </view>
  83. </view>
  84. </view>
  85. <view class="bottom adfacjb">
  86. <view class="right" @click="handleCancel" v-if="info?.activeState==1&&info?.signupState==1">取消报名</view>
  87. <view class="right" @click="handleApply" v-else-if="info?.activeState==1&&info?.signupState==-1">立即报名</view>
  88. <view class="right" @click="handleSignup" v-else-if="info?.activeState==2&&info?.signupState==1">去签到</view>
  89. <view class="right grey" v-else-if="info?.activeState==2&&info?.signupState==2">已签到</view>
  90. <view class="right" @click="handleFill" v-else-if="info?.activeState==3&&info?.signupState==2">写档案</view>
  91. <view class="right" @click="handleReview" v-else-if="info?.activeState==3&&info?.signupState==3">查看档案</view>
  92. </view>
  93. </view>
  94. </template>
  95. <script setup name="">
  96. import CusHeader from '@/components/CusHeader/index.vue'
  97. import { ref, getCurrentInstance } from 'vue'
  98. import { onLoad } from '@dcloudio/uni-app'
  99. const { proxy } = getCurrentInstance()
  100. const info = ref(null)
  101. const memberSignupId = ref('')
  102. const signupStateDict = ref({
  103. '-1':'已取消',
  104. 1:'已报名',
  105. 2:'已签到',
  106. 3:'已填档案'
  107. })
  108. const userLoveTicket = ref(null)
  109. const selectCouponIds = ref([])
  110. const ticketText = ref('暂无可用专享券')
  111. const getUserActivityDetail = () => {
  112. proxy.$api.get(`/core/activity/signup/myActivityInfo/${memberSignupId.value}`).then(({data:res})=>{
  113. if(res.code!==0) return proxy.$showToast(res.msg)
  114. info.value = res.data;
  115. info.value.age = getAge(info.value.idCard);
  116. info.value.idCardCopy = info.value.idCard.replace(/^(\d{6})(\d{8})(\d{3}[\dX])$/i,'$1********$3');
  117. getUserLoveTicket()
  118. })
  119. }
  120. const isValid = (idCard) => {
  121. // 正则表达式校验18位身份证号码(最后一位可以是数字或X/x)
  122. 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]$/;
  123. return typeof idCard === 'string' && regex.test(idCard);
  124. }
  125. const getAge = (idCard) => {
  126. if (!isValid(idCard)) return 0
  127. // 从身份证的第7位开始,截取8位作为出生日期字符串 (YYYYMMDD)
  128. const birthDateStr = idCard.substring(6, 14);
  129. const birthYear = parseInt(birthDateStr.substring(0, 4), 10);
  130. const birthMonth = parseInt(birthDateStr.substring(4, 6), 10);
  131. const birthDay = parseInt(birthDateStr.substring(6, 8), 10);
  132. const today = new Date();
  133. const currentYear = today.getFullYear();
  134. const currentMonth = today.getMonth() + 1; // getMonth() 返回 0-11
  135. const currentDay = today.getDate();
  136. // 计算周岁
  137. let age = currentYear - birthYear;
  138. // 如果当前月份小于出生月份,或者月份相同但日期小于出生日期,说明今年的生日还没过
  139. if (currentMonth < birthMonth || (currentMonth === birthMonth && currentDay < birthDay)) {
  140. age--;
  141. }
  142. return age < 0 ? 0 : age;
  143. }
  144. const handleCancel = () => {
  145. uni.showModal({
  146. title:'温馨提示',
  147. content:'确认取消本次报名吗?取消后可再次报名本活动。',
  148. success: (res) => {
  149. if(res.confirm){
  150. proxy.$api.get(`/core/activity/signup/cancelSignupBySingle/${memberSignupId.value}`).then(({data:res})=>{
  151. if(res.code!==0) return proxy.$showToast(res.msg)
  152. getUserActivityDetail()
  153. proxy.$showToast('取消报名成功')
  154. })
  155. }
  156. }
  157. })
  158. }
  159. const handleApply = () => {
  160. let couponId = '';
  161. if(info.value?.activityLimit==2){
  162. if(selectCouponIds.value.length==0) return proxy.$showToast(`请选择1张专享券`)
  163. couponId = selectCouponIds.value[0];
  164. }
  165. proxy.$api.post(`/core/activity/signup/signupBySingle`,{
  166. couponId,
  167. memberSignupId:memberSignupId.value,
  168. userId:JSON.parse(uni.getStorageSync('userInfo')).id
  169. }).then(({data:res})=>{
  170. if(res.code!==0) return proxy.$showToast(res.msg)
  171. getUserActivityDetail()
  172. proxy.$showToast('报名成功')
  173. })
  174. }
  175. const handleSignup = () => {
  176. try{
  177. uni.scanCode({
  178. success: (res) => {
  179. if(res.errMsg=='scanCode:ok'){
  180. let { id } = JSON.parse(res.result)
  181. console.log(id,'id');
  182. proxy.$api.post('/core/activity/signup/signinBySingle',{
  183. activityId:id??'',
  184. memberSignupId:memberSignupId.value,
  185. userId:JSON.parse(uni.getStorageSync('userInfo')).id
  186. }).then(({data:res})=>{
  187. if(res.code!==0) return proxy.$showToast(res.msg)
  188. uni.navigateTo({
  189. url:'/pagesHome/signSuccess'
  190. })
  191. })
  192. }else proxy.$showToast(res.errMsg)
  193. },
  194. fail: (err) => {
  195. proxy.$showToast('扫描异常,请稍后再试')
  196. }
  197. })
  198. }catch(e){
  199. proxy.$showToast('签到异常,请稍后再试')
  200. }
  201. }
  202. const handleFill = () => {
  203. uni.navigateTo({
  204. url:'/pagesHome/fillNonprofitArchives?activity='+encodeURIComponent(JSON.stringify(info.value))
  205. })
  206. }
  207. const handleReview = () => {
  208. uni.navigateTo({
  209. url:'/pagesMy/archivesDetail?activityId='+info.value?.activityId+'&memberId='+info.value?.memberId
  210. })
  211. }
  212. const getUserLoveTicket = () => {
  213. let userId = JSON.parse(uni.getStorageSync('userInfo'))?.id;
  214. proxy.$api.get(`/core/activity/signup/userAsset/${userId}/${info.value?.activityId}`).then(({data:res})=>{
  215. if(res.code!==0) return proxy.$showToast(res.msg)
  216. userLoveTicket.value = res.data;
  217. ticketText.value = `剩余${res.data?.couponIds?.length||0}张可用`;
  218. })
  219. }
  220. const handleSelectTicket = () => {
  221. uni.navigateTo({
  222. url:'/pagesMy/exclusiveScroll?activityId='+info.value?.activityId,
  223. events:{
  224. 'selectTickets': data => {
  225. selectCouponIds.value = data;
  226. ticketText.value = `已选${data?.length||0}张,剩余${userLoveTicket.value?.couponIds?.length-data?.length}张可用`;
  227. }
  228. }
  229. })
  230. }
  231. onLoad((options)=>{
  232. memberSignupId.value = options?.memberSignupId;
  233. getUserActivityDetail()
  234. })
  235. </script>
  236. <style scoped lang="scss">
  237. .common_page{
  238. padding-bottom: 211rpx;
  239. box-sizing: border-box;
  240. .top{
  241. position: relative;
  242. margin-top: 39rpx;
  243. &-status{
  244. .left{
  245. font-family: PingFang-SC, PingFang-SC;
  246. font-weight: bold;
  247. font-size: 40rpx;
  248. color: #252525;
  249. line-height: 48rpx;
  250. }
  251. .right{
  252. font-family: PingFangSC, PingFang SC;
  253. font-weight: 400;
  254. font-size: 24rpx;
  255. color: #676775;
  256. line-height: 24rpx;
  257. label{
  258. font-family: PingFang-SC, PingFang-SC;
  259. font-weight: bold;
  260. font-size: 40rpx;
  261. color: #252525;
  262. line-height: 48rpx;
  263. margin-right: 6rpx;
  264. }
  265. }
  266. }
  267. &-no{
  268. font-family: PingFangSC, PingFang SC;
  269. font-weight: 400;
  270. font-size: 28rpx;
  271. color: #676775;
  272. line-height: 28rpx;
  273. margin-top: 30rpx;
  274. }
  275. }
  276. .box{
  277. background: #FFFFFF;
  278. border-radius: 24rpx;
  279. padding: 36rpx 24rpx;
  280. margin-top: 20rpx;
  281. position: relative;
  282. &-title{
  283. width: 170rpx;
  284. height: 44rpx;
  285. padding-left: 2rpx;
  286. font-family: PingFang-SC, PingFang-SC;
  287. font-weight: 800;
  288. font-size: 36rpx;
  289. color: #151B29;
  290. line-height: 36rpx;
  291. background-image: url('https://transcend.ringzle.com/xiaozhi-app/profile/2025/09/11/6ec1f999-fcbb-4a0b-a1a5-d0b5e1374bb1.png');
  292. background-size: 170rpx 31rpx;
  293. background-position: 0 20rpx;
  294. background-repeat: no-repeat;
  295. }
  296. }
  297. .box1{
  298. &-left{
  299. width: 158rpx;
  300. height: 214rpx;
  301. image{
  302. width: 100%;
  303. height: 100%;
  304. }
  305. }
  306. &-right{
  307. width: calc(100% - 158rpx);
  308. padding-left: 20rpx;
  309. box-sizing: border-box;
  310. .title{
  311. font-family: PingFang-SC, PingFang-SC;
  312. font-weight: bold;
  313. font-size: 32rpx;
  314. color: #151B29;
  315. line-height: 40rpx;
  316. }
  317. .memo{
  318. font-family: PingFangSC, PingFang SC;
  319. font-weight: 400;
  320. font-size: 24rpx;
  321. color: #C9A771;
  322. line-height: 37rpx;
  323. margin-top: 27rpx;
  324. }
  325. }
  326. }
  327. .box2{
  328. &-item{
  329. margin-top: 40rpx;
  330. justify-content: space-between;
  331. .left{
  332. font-family: PingFangSC, PingFang SC;
  333. font-weight: 400;
  334. font-size: 28rpx;
  335. color: #676775;
  336. line-height: 28rpx;
  337. width: 120rpx;
  338. }
  339. .right{
  340. width: calc(100% - 120rpx);
  341. padding-left: 20rpx;
  342. box-sizing: border-box;
  343. font-family: PingFangSC, PingFang SC;
  344. font-weight: 400;
  345. font-size: 28rpx;
  346. color: #252525;
  347. line-height: 28rpx;
  348. text-align: right;
  349. }
  350. }
  351. }
  352. .box3{
  353. &-list{
  354. margin-top: 15rpx;
  355. &-item{
  356. margin-top: 25rpx;
  357. .left{
  358. .top{
  359. .name{
  360. font-family: PingFang-SC, PingFang-SC;
  361. font-weight: bold;
  362. font-size: 32rpx;
  363. color: #151B29;
  364. line-height: 32rpx;
  365. }
  366. .sex{
  367. width: 44rpx;
  368. height: 32rpx;
  369. margin-left: 10rpx;
  370. }
  371. .age{
  372. border-radius: 13rpx;
  373. font-family: PingFangSC, PingFang SC;
  374. font-weight: 400;
  375. font-size: 20rpx;
  376. line-height: 24rpx;
  377. padding: 4rpx 10rpx;
  378. margin-left: 13rpx;
  379. &.women{
  380. background: rgba(244,101,122,0.14);
  381. color: #F4657A;
  382. }
  383. &.man{
  384. background: rgba(5,169,254,0.12);
  385. color: #05A9FE;
  386. }
  387. }
  388. }
  389. &-bottom{
  390. font-family: PingFangSC, PingFang SC;
  391. font-weight: 400;
  392. font-size: 24rpx;
  393. color: #989998;
  394. line-height: 24rpx;
  395. margin-top: 24rpx;
  396. }
  397. }
  398. .right{
  399. image{
  400. width: 36rpx;
  401. height: 36rpx;
  402. }
  403. }
  404. }
  405. }
  406. }
  407. .box4{
  408. &-detail{
  409. margin-top: 40rpx;
  410. }
  411. }
  412. .user{
  413. margin-top: 20rpx;
  414. border-radius: 20rpx;
  415. background: #FFFFFF;
  416. &-pre{
  417. padding: 40rpx 24rpx;
  418. box-shadow: inset 0rpx -1rpx 0rpx 0rpx #ECEEF5;
  419. &-left{
  420. font-family: PingFangSC, PingFang SC;
  421. font-weight: 400;
  422. font-size: 30rpx;
  423. color: #676775;
  424. line-height: 30rpx;
  425. }
  426. &-right{
  427. font-family: PingFangSC, PingFang SC;
  428. font-weight: 400;
  429. font-size: 30rpx;
  430. color: #252525;
  431. line-height: 30rpx;
  432. text-align: right;
  433. image{
  434. width: 32rpx;
  435. height: 32rpx;
  436. margin-left: 20rpx;
  437. }
  438. }
  439. }
  440. }
  441. .bottom{
  442. width: 100%;
  443. height: 191rpx;
  444. background: #FFFFFF;
  445. box-shadow: 0rpx -2rpx 8rpx 0rpx rgba(178,178,178,0.1);
  446. padding: 0 30rpx;
  447. box-sizing: border-box;
  448. position: fixed;
  449. left: 0;
  450. bottom: 0;
  451. .left{
  452. text{
  453. font-family: PingFangSC, PingFang SC;
  454. font-weight: 400;
  455. font-size: 26rpx;
  456. color: #151B29;
  457. line-height: 26rpx;
  458. margin-top: 17rpx;
  459. }
  460. }
  461. .right{
  462. width: 100%;
  463. height: 90rpx;
  464. background: #B7F358;
  465. border-radius: 45rpx;
  466. font-family: PingFang-SC, PingFang-SC;
  467. font-weight: bold;
  468. font-size: 32rpx;
  469. color: #151B29;
  470. line-height: 90rpx;
  471. text-align: center;
  472. letter-spacing: 2rpx;
  473. &.grey{
  474. background: #F7F7F7;
  475. }
  476. }
  477. }
  478. .dialog{
  479. position: fixed;
  480. left: 0;
  481. right: 0;
  482. top: 0;
  483. bottom: 0;
  484. background: rgba(0,0,0,0.4);
  485. display: flex;
  486. flex-direction: column;
  487. justify-content: flex-end;
  488. .dbox{
  489. position: relative;
  490. background: #FFFFFF;
  491. border-radius: 24rpx 24rpx 0rpx 0rpx;
  492. padding: 40rpx 0 64rpx;
  493. &-title{
  494. font-family: PingFang-SC, PingFang-SC;
  495. font-weight: bold;
  496. font-size: 36rpx;
  497. color: #151B29;
  498. line-height: 36rpx;
  499. text-align: center;
  500. }
  501. .close{
  502. width: 27rpx;
  503. height: 27rpx;
  504. position: absolute;
  505. top: 40rpx;
  506. right: 30rpx;
  507. }
  508. &-select{
  509. margin-top: 57rpx;
  510. padding: 27rpx 30rpx;
  511. background: #F7F7F7;
  512. &-left{
  513. font-family: PingFang-SC, PingFang-SC;
  514. font-weight: bold;
  515. font-size: 32rpx;
  516. color: #151B29;
  517. line-height: 36rpx;
  518. }
  519. &-right{
  520. text{
  521. font-family: PingFangSC, PingFang SC;
  522. font-weight: 400;
  523. font-size: 28rpx;
  524. color: #151B29;
  525. line-height: 36rpx;
  526. }
  527. image{
  528. width: 36rpx;
  529. height: 36rpx;
  530. margin-left: 10rpx;
  531. }
  532. }
  533. }
  534. &-list{
  535. padding: 0 30rpx;
  536. height: 820rpx;
  537. overflow-y: auto;
  538. &-item{
  539. padding: 36rpx 0;
  540. box-shadow: inset 0rpx -1rpx 0rpx 0rpx #E5E7EB;
  541. &-left{
  542. &-top{
  543. .name{
  544. font-family: PingFang-SC, PingFang-SC;
  545. font-weight: bold;
  546. font-size: 32rpx;
  547. color: #151B29;
  548. line-height: 32rpx;
  549. }
  550. .sex{
  551. width: 44rpx;
  552. height: 32rpx;
  553. margin-left: 20rpx;
  554. }
  555. .age{
  556. border-radius: 13rpx;
  557. font-family: PingFangSC, PingFang SC;
  558. font-weight: 400;
  559. font-size: 20rpx;
  560. line-height: 24rpx;
  561. padding: 4rpx 10rpx;
  562. margin-left: 13rpx;
  563. &.women{
  564. background: rgba(244,101,122,0.14);
  565. color: #F4657A;
  566. }
  567. &.man{
  568. background: rgba(5,169,254,0.12);
  569. color: #05A9FE;
  570. }
  571. }
  572. }
  573. &-bottom{
  574. font-family: PingFangSC, PingFang SC;
  575. font-weight: 400;
  576. font-size: 24rpx;
  577. color: #989998;
  578. line-height: 24rpx;
  579. margin-top: 18rpx;
  580. }
  581. }
  582. &-right{
  583. image{
  584. width: 36rpx;
  585. height: 36rpx;
  586. }
  587. }
  588. }
  589. }
  590. &-btn{
  591. margin: 43rpx 40rpx 0;
  592. width: calc(100% - 80rpx);
  593. height: 90rpx;
  594. background: #B7F358;
  595. border-radius: 45rpx;
  596. font-family: PingFang-SC, PingFang-SC;
  597. font-weight: bold;
  598. font-size: 32rpx;
  599. color: #151B29;
  600. line-height: 90rpx;
  601. text-align: center;
  602. letter-spacing: 2rpx;
  603. }
  604. }
  605. }
  606. }
  607. </style>