activityApply.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445
  1. <template>
  2. <view class="common_page adffc" :style="{'min-height':h+'px', 'padding-top':mt+'px'}">
  3. <cus-header title="报名信息填写" bgColor="transparent"></cus-header>
  4. <image src="https://oss.familydaf.cn/sxsnfile/20251218/ff31a76e0e1148378a318382b998a51f.png" class="top_bg_img" mode="widthFix"></image>
  5. <view class="box box1">
  6. <view class="box1-top">
  7. <view class="title">{{activity?.activityName||''}}</view>
  8. <view class="tip">活动时间:{{activity?.activityStartTime||''}} 到 {{activity?.activityEndTime||''}}</view>
  9. <view class="tip">活动地点:{{activity?.provinceName||''}}{{activity?.cityName||''}}{{activity?.address||''}}</view>
  10. </view>
  11. <view class="box1-bottom adfac">
  12. <image src="https://oss.familydaf.cn/sxsnfile/20251218/0a68f263fc1b464cba97b7a8fe130ccc.png"></image>
  13. <text>报名时间截止前可取消并返还{{activityLimitCfg[activity?.activityLimit]}},截止后不可取消。</text>
  14. </view>
  15. </view>
  16. <view class="box box2">
  17. <view class="box2-title">报名信息</view>
  18. <view class="box2-members" v-if="selectMemberList.length">
  19. <view class="box2-members-pre adfacjb" v-for="(item,index) in selectMemberList" :key="index">
  20. <view class="box2-members-pre-left">
  21. <view class="ltop adfac">
  22. <view class="name">{{item.name}}</view>
  23. <image class="sex" v-if="item.gender==1" src="https://oss.familydaf.cn/sxsnfile/20251218/473d5677fbdb4106acdb9a163377d27f.png"></image>
  24. <image class="sex" v-else-if="item.gender==0" src="https://oss.familydaf.cn/sxsnfile/20251218/02bc40a1c47b40f1a36b55cd0553211c.png"></image>
  25. <view class="age" :class="{'women':item.gender==1,'man':item.gender==0}">{{item.age}}岁</view>
  26. </view>
  27. <view class="lbottom">
  28. 身份证 {{item.idCardCopy}}
  29. </view>
  30. </view>
  31. <view class="box2-members-pre-right" @click="deleteMember(item,index)">
  32. <image src="https://oss.familydaf.cn/sxsnfile/20251218/f94c1d060eca4506a7e645919d158288.png"></image>
  33. </view>
  34. </view>
  35. </view>
  36. <view class="box2-add adfacjc" @click="handleAdd">
  37. <image src="https://oss.familydaf.cn/sxsnfile/20251218/5ae3736e1ca74d739b54578af5c7a56d.png"></image>
  38. <text>添加</text>
  39. </view>
  40. </view>
  41. <view class="box box3">
  42. <view class="box3-pre adfacjb">
  43. <view class="box3-pre-left">联系人姓名</view>
  44. <view class="box3-pre-right">
  45. <up-input v-model="submitDto.contact" border="none" style="font-size: 30rpx;color: #151B29;text-align: right;" placeholder="请输入联系人姓名"></up-input>
  46. </view>
  47. </view>
  48. <view class="box3-pre adfacjb">
  49. <view class="box3-pre-left">联系人电话</view>
  50. <view class="box3-pre-right">
  51. <up-input v-model="submitDto.contactPhone" border="none" style="font-size: 30rpx;color: #151B29;text-align: right;" placeholder="请输入联系人电话"></up-input>
  52. </view>
  53. </view>
  54. </view>
  55. <view class="box box4 adfacjb" v-if="activity?.activityLimit==2" @click="handleSelectTicket">
  56. <view class="box4-left">专享券抵扣</view>
  57. <view class="box4-right adfac">
  58. <text>{{ticketText}}</text>
  59. <image src="https://oss.familydaf.cn/sxsnfile/20251218/48d65d353fd748ccb33c0fa29c1cecb0.png"></image>
  60. </view>
  61. </view>
  62. <view class="cbottom">
  63. <view class="cbottom-top adfac" @click="changeAgree">
  64. <image v-if="agree" src="https://oss.familydaf.cn/sxsnfile/20251218/c11b9a1b56f34e1189621f4270f0349a.png"></image>
  65. <image v-else src="https://oss.familydaf.cn/sxsnfile/20251218/2a2f7bdefb474a3e93faa00aef6d0e1f.png"></image>
  66. <text>我已知晓并同意活动组织方获取以上我所提交的报名信息。</text>
  67. </view>
  68. <view class="cbottom-btn adfacjb">
  69. <view class="cbottom-btn-left adffcac">
  70. <template v-if="activity?.activityLimit<3">
  71. <view class="heart adfac">
  72. <image src="https://oss.familydaf.cn/sxsnfile/20251218/8ee2fca2eb514e8fb10507ef3a0ed7d3.png"></image>
  73. <text>{{payValue}}</text>
  74. </view>
  75. <view class="text">{{activityLimitCfg[activity?.activityLimit]||''}}</view>
  76. </template>
  77. <template v-else>
  78. <view class="free">免费</view>
  79. </template>
  80. </view>
  81. <view class="cbottom-btn-right" @click="handleApply">确定报名</view>
  82. </view>
  83. </view>
  84. </view>
  85. </template>
  86. <script setup name="">
  87. import CusHeader from '@/components/CusHeader/index.vue'
  88. import { ref, getCurrentInstance, onMounted } from 'vue'
  89. import { onLoad } from '@dcloudio/uni-app'
  90. const { proxy } = getCurrentInstance()
  91. const activity = ref(null)
  92. const activityLimitCfg = ref({
  93. 1:'爱心值',
  94. 2:'专享券',
  95. 3:'免费'
  96. })
  97. const selectMemberList = ref([])
  98. const submitDto = ref({
  99. activityId:'',
  100. contact:'',
  101. contactPhone:'',
  102. couponIds:[],
  103. memberIds:[],
  104. userId:''
  105. })
  106. const agree = ref(false)
  107. const payValue = ref(0)
  108. const userLoveTicket = ref(null)
  109. const selectCouponIds = ref([])
  110. const ticketText = ref('暂无可用专享券')
  111. const handleAdd = () => {
  112. uni.navigateTo({
  113. url:'/pagesHome/applyMember',
  114. events:{
  115. 'selectMembers': data => {
  116. selectMemberList.value = data;
  117. payValue.value = selectMemberList.value.length*activity.value?.valueLimit;
  118. }
  119. }
  120. })
  121. }
  122. const handleSelectTicket = () => {
  123. uni.navigateTo({
  124. url:'/pagesMy/exclusiveScroll?activityId='+activity.value?.id,
  125. events:{
  126. 'selectTickets': data => {
  127. selectCouponIds.value = data;
  128. ticketText.value = `已选${data?.length||0}张,剩余${userLoveTicket.value?.couponIds?.length-data?.length}张可用`;
  129. }
  130. }
  131. })
  132. }
  133. const handleApply = async () => {
  134. if(selectMemberList.value.length===0) return proxy.$showToast('请至少添加一位报名人员')
  135. if(!submitDto.value.contact) return proxy.$showToast('请输入联系人姓名')
  136. if(!proxy.$reg.mobile(submitDto.value.contactPhone)) return proxy.$showToast('请输入正确的联系电话')
  137. submitDto.value.memberIds = selectMemberList.value.map(m=>m.id);
  138. submitDto.value.activityId = activity.value.id;
  139. submitDto.value.userId = JSON.parse(uni.getStorageSync('userInfo')).id;
  140. if(activity.value?.activityLimit==2){
  141. let smnum = selectMemberList.value.length;
  142. let stnum = selectCouponIds.value.length;
  143. if(stnum<smnum) return proxy.$showToast(`请选择${smnum}张专享券`)
  144. }
  145. submitDto.value.couponIds = selectCouponIds.value;
  146. if(!agree.value) return proxy.$showToast('请勾选已知晓并同意')
  147. proxy.$api.post('/core/activity/signup/signup',submitDto.value).then(({data:res})=>{
  148. if(res.code!==0) return proxy.$showToast(res.msg)
  149. uni.redirectTo({
  150. url:'/pagesHome/applyResult'
  151. })
  152. })
  153. }
  154. const getUserLoveTicket = () => {
  155. let userId = JSON.parse(uni.getStorageSync('userInfo'))?.id;
  156. proxy.$api.get(`/core/activity/signup/userAsset/${userId}/${activity.value?.id}`).then(({data:res})=>{
  157. if(res.code!==0) return proxy.$showToast(res.msg)
  158. userLoveTicket.value = res.data;
  159. ticketText.value = `剩余${res.data?.couponIds?.length||0}张可用`;
  160. })
  161. }
  162. const changeAgree = () => {
  163. agree.value = !agree.value;
  164. }
  165. const deleteMember = (item,index) => {
  166. selectMemberList.value.splice(index,1);
  167. payValue.value = selectMemberList.value.length*activity.value?.valueLimit;
  168. }
  169. onLoad(options=>{
  170. activity.value = options.activity&&JSON.parse(decodeURIComponent(options.activity))
  171. })
  172. onMounted(()=>{
  173. getUserLoveTicket()
  174. })
  175. </script>
  176. <style scoped lang="scss">
  177. ::v-deep .u-input__content input{
  178. caret-color: #252525;
  179. }
  180. ::v-deep .u-input__content__field-wrapper__field{
  181. text-align: right !important;
  182. }
  183. .common_page{
  184. padding-bottom: 248rpx;
  185. .box{
  186. margin-top: 20rpx;
  187. background: #FFFFFF;
  188. border-radius: 20rpx;
  189. position: relative;
  190. }
  191. .box1{
  192. &-top{
  193. padding: 36rpx 24rpx 24rpx;
  194. border-bottom: 1rpx solid #E5E7EB;
  195. &>.title{
  196. font-family: PingFang-SC, PingFang-SC;
  197. font-weight: bold;
  198. font-size: 32rpx;
  199. color: #151B29;
  200. line-height: 32rpx;
  201. }
  202. &>.tip{
  203. font-family: PingFangSC, PingFang SC;
  204. font-weight: 400;
  205. font-size: 24rpx;
  206. color: #666666;
  207. line-height: 24rpx;
  208. margin-top: 30rpx;
  209. }
  210. }
  211. &-bottom{
  212. padding: 26rpx 24rpx;
  213. image{
  214. width: 20rpx;
  215. height: 20rpx;
  216. }
  217. text{
  218. font-family: PingFangSC, PingFang SC;
  219. font-weight: 400;
  220. font-size: 24rpx;
  221. color: #C9A771;
  222. line-height: 24rpx;
  223. margin-left: 10rpx;
  224. }
  225. }
  226. }
  227. .box2{
  228. padding: 40rpx 24rpx 48rpx;
  229. &-title{
  230. font-family: PingFang-SC, PingFang-SC;
  231. font-weight: bold;
  232. font-size: 36rpx;
  233. color: #151B29;
  234. line-height: 36rpx;
  235. margin-bottom: 26rpx;
  236. display: inline-block;
  237. }
  238. &-members{
  239. &-pre{
  240. padding: 36rpx 0;
  241. box-shadow: inset 0rpx -1rpx 0rpx 0rpx #F2F2F2;
  242. &-left{
  243. .ltop{
  244. .name{
  245. font-family: PingFang-SC, PingFang-SC;
  246. font-weight: bold;
  247. font-size: 32rpx;
  248. color: #151B29;
  249. line-height: 32rpx;
  250. }
  251. .sex{
  252. width: 44rpx;
  253. height: 32rpx;
  254. margin-left: 20rpx;
  255. }
  256. .age{
  257. border-radius: 13rpx;
  258. font-family: PingFangSC, PingFang SC;
  259. font-weight: 400;
  260. font-size: 20rpx;
  261. line-height: 24rpx;
  262. padding: 4rpx 10rpx;
  263. margin-left: 13rpx;
  264. &.women{
  265. background: rgba(244,101,122,0.14);
  266. color: #F4657A;
  267. }
  268. &.man{
  269. background: rgba(5,169,254,0.12);
  270. color: #05A9FE;
  271. }
  272. }
  273. }
  274. .lbottom{
  275. font-family: PingFangSC, PingFang SC;
  276. font-weight: 400;
  277. font-size: 24rpx;
  278. color: #989998;
  279. line-height: 24rpx;
  280. margin-top: 24rpx;
  281. }
  282. }
  283. &-right{
  284. width: 36rpx;
  285. height: 36rpx;
  286. image{
  287. width: 100%;
  288. height: 100%;
  289. }
  290. }
  291. }
  292. }
  293. &-add{
  294. width: 100%;
  295. height: 78rpx;
  296. background: rgba(112,207,82,0.08);
  297. border-radius: 24rpx;
  298. border: 1rpx dotted #70CF52;
  299. margin-top: 40rpx;
  300. image{
  301. width: 36rpx;
  302. height: 36rpx;
  303. }
  304. text{
  305. font-family: PingFang-SC, PingFang-SC;
  306. font-weight: bold;
  307. font-size: 28rpx;
  308. color: #70CF52;
  309. line-height: 40rpx;
  310. margin-left: 10rpx;
  311. }
  312. }
  313. }
  314. .box3{
  315. &-pre{
  316. padding: 36rpx 24rpx;
  317. &:first-child{
  318. box-shadow: inset 0rpx -1rpx 0rpx 0rpx #ECEEF5;
  319. }
  320. &-left{
  321. font-family: PingFangSC, PingFang SC;
  322. font-weight: 400;
  323. font-size: 30rpx;
  324. color: #151B29;
  325. line-height: 36rpx;
  326. }
  327. }
  328. }
  329. .box4{
  330. padding: 36rpx 24rpx;
  331. &-left{
  332. font-family: PingFangSC, PingFang SC;
  333. font-weight: 400;
  334. font-size: 30rpx;
  335. color: #151B29;
  336. line-height: 36rpx;
  337. }
  338. &-right{
  339. text{
  340. font-family: PingFangSC, PingFang SC;
  341. font-weight: 400;
  342. font-size: 24rpx;
  343. color: #989998;
  344. line-height: 33rpx;
  345. }
  346. image{
  347. width: 32rpx;
  348. height: 32rpx;
  349. margin-left: 20rpx;
  350. }
  351. }
  352. }
  353. .cbottom{
  354. width: 100%;
  355. position: fixed;
  356. left: 0;
  357. right: 0;
  358. bottom: 0;
  359. &-top{
  360. padding: 0 30rpx;
  361. image{
  362. width: 36rpx;
  363. height: 36rpx;
  364. }
  365. text{
  366. font-family: PingFangSC, PingFang SC;
  367. font-weight: 400;
  368. font-size: 24rpx;
  369. color: #989998;
  370. line-height: 33rpx;
  371. margin-left: 16rpx;
  372. }
  373. }
  374. &-btn{
  375. background: #FFFFFF;
  376. padding: 20rpx 30rpx 44rpx 36rpx;
  377. margin-top: 40rpx;
  378. &-left{
  379. .heart{
  380. image{
  381. width: 30rpx;
  382. height: 30rpx;
  383. }
  384. text{
  385. font-family: PingFang-SC, PingFang-SC;
  386. font-weight: bold;
  387. font-size: 36rpx;
  388. color: #F4657A;
  389. line-height: 36rpx;
  390. margin-left: 2rpx;
  391. }
  392. }
  393. .text{
  394. font-family: PingFangSC, PingFang SC;
  395. font-weight: 400;
  396. font-size: 24rpx;
  397. color: #252525;
  398. line-height: 24rpx;
  399. margin-top: 11rpx;
  400. }
  401. .free{
  402. font-family: PingFangSC, PingFang SC;
  403. font-weight: 400;
  404. font-size: 32rpx;
  405. color: #252525;
  406. line-height: 32rpx;
  407. }
  408. }
  409. &-right{
  410. width: 528rpx;
  411. height: 90rpx;
  412. background: #B7F358;
  413. border-radius: 45rpx;
  414. font-family: PingFang-SC, PingFang-SC;
  415. font-weight: bold;
  416. font-size: 32rpx;
  417. color: #151B29;
  418. line-height: 90rpx;
  419. text-align: center;
  420. letter-spacing: 2rpx;
  421. }
  422. }
  423. }
  424. }
  425. </style>