nonprofitDetail.vue 15 KB

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