index.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  1. <template>
  2. <view class="ni" v-if="item" @click.prevent="toDetail(item)">
  3. <view class="ni-top adfacjb">
  4. <view class="ni-top-left adfac">
  5. <image class="avatar" src="https://oss.familydaf.cn/sxsnfile/20251218/3821654e080945998d464f3c3aa64122.png"></image>
  6. <view class="name">{{item?.memberName||''}}</view>
  7. <image class="sex" v-if="item?.gender==1" src="https://oss.familydaf.cn/sxsnfile/20251218/473d5677fbdb4106acdb9a163377d27f.png"></image>
  8. <image class="sex" v-else-if="item?.gender==0" src="https://oss.familydaf.cn/sxsnfile/20251218/02bc40a1c47b40f1a36b55cd0553211c.png"></image>
  9. <view class="age" :class="{'women':item?.gender==1,'man':item?.gender==0}">{{item?.age||0}}岁</view>
  10. </view>
  11. <view class="ni-top-right" :class="{'grey':item.signupState==-1||item.signupState==3}">{{statusDict[item?.signupState]||''}}</view>
  12. </view>
  13. <view class="ni-info adfacjb">
  14. <view class="ni-info-left">
  15. <image :src="item?.coverFile||''"></image>
  16. </view>
  17. <view class="ni-info-right">
  18. <view class="title">{{item?.activityName||''}}</view>
  19. <view class="tip adf">
  20. <view class="tip-left adfac">
  21. <image src="https://oss.familydaf.cn/sxsnfile/20251218/762878799914422d835e505291b9d4c6.png"></image>
  22. <text>活动时间:</text>
  23. </view>
  24. <view class="tip-right">{{item?.activityStartTime||''}} ~ {{item?.activityEndTime||''}}</view>
  25. </view>
  26. <view class="tip adf">
  27. <view class="tip-left adfac">
  28. <image src="https://oss.familydaf.cn/sxsnfile/20251218/57539643ab974aef9401d76818e1bf3b.png"></image>
  29. <text>活动地点:</text>
  30. </view>
  31. <view class="tip-right">{{item?.provinceName||''}}{{item?.cityName||''}}</view>
  32. </view>
  33. <view class="bottom adfac">
  34. <view class="btn" @click.stop="handleCancel" v-if="(item.activeState==1||item.activeState===0)&&item.signupState==1">取消报名</view>
  35. <view class="btn" @click.stop="toDetail(item)" v-if="item.activeState==1&&item.signupState==-1">立即报名</view>
  36. <view class="btn" @click.stop="handleSignup" v-if="item.activeState==2&&item.signupState==1">去签到</view>
  37. <view class="btn" @click.stop="handleFill" v-if="(item.activeState==2||item.activeState==3)&&(item.signupState==1||item.signupState==2)">写档案</view>
  38. <view class="btn" @click.stop="handleReview" v-if="item.activeState==3&&item.signupState==3">查看档案</view>
  39. </view>
  40. </view>
  41. </view>
  42. </view>
  43. </template>
  44. <script setup name="NonprofitItem">
  45. import { ref, getCurrentInstance } from 'vue'
  46. const { proxy } = getCurrentInstance()
  47. const props = defineProps({
  48. item:{
  49. typeof:Object,
  50. default:null
  51. }
  52. })
  53. const statusDict = ref({
  54. '-1':'已取消',
  55. 1:'已报名',
  56. 2:'已签到',
  57. 3:'已完成'
  58. })
  59. const btnTextDict = ref({
  60. 1:'取消报名',
  61. 2:'去签到',
  62. 3:'填写公益档案'
  63. })
  64. const toDetail = item => {
  65. uni.navigateTo({
  66. url:'/pagesNonprofit/nonprofitDetail?memberSignupId='+item?.memberSignupId
  67. })
  68. }
  69. const emits = defineEmits(['handleCancel'])
  70. const handleCancel = () => {
  71. uni.showModal({
  72. title:'温馨提示',
  73. content:'确认取消本次报名吗?取消后可再次报名本活动。',
  74. success: (res) => {
  75. if(res.confirm){
  76. proxy.$api.get(`/core/activity/signup/cancelSignupBySingle/${props.item?.memberSignupId}`).then(({data:res})=>{
  77. if(res.code!==0) return proxy.$showToast(res.msg)
  78. emits('handleCancel')
  79. })
  80. }
  81. }
  82. })
  83. }
  84. const handleSignup = () => {
  85. try{
  86. uni.scanCode({
  87. success: (res) => {
  88. if(res.errMsg=='scanCode:ok'){
  89. let r = res.result.replace(/^\uFEFF/, '');
  90. let d = JSON.parse(r);
  91. if(!d.hasOwnProperty('id')||!d) return proxy.$showToast('请扫描正确的活动签到码');
  92. let { id } = d;
  93. const userId = JSON.parse(uni.getStorageSync('userInfo'))?.id||'';
  94. proxy.$api.post('/core/activity/signup/signinBySingle',{
  95. activityId:id||'',
  96. memberSignupId:props.item?.memberSignupId,
  97. userId
  98. }).then(({data:res})=>{
  99. if(res.code!==0) return proxy.$showToast('签到失败,请稍后再试')
  100. uni.navigateTo({
  101. url:'/pagesHome/signSuccess'
  102. })
  103. })
  104. }else proxy.$showToast(res.errMsg)
  105. },
  106. fail: (err) => {
  107. proxy.$showToast('扫描异常,请稍后再试')
  108. }
  109. })
  110. }catch(e){
  111. proxy.$showToast('签到异常,请稍后再试')
  112. }
  113. }
  114. const handleFill = () => {
  115. uni.navigateTo({
  116. url:'/pagesHome/fillNonprofitArchives?activity='+encodeURIComponent(JSON.stringify(props.item))
  117. })
  118. }
  119. const handleReview = () => {
  120. uni.navigateTo({
  121. url:'/pagesMy/archivesDetail?activityId='+props.item?.activityId+'&memberId='+props.item?.memberId
  122. })
  123. }
  124. </script>
  125. <style scoped lang="scss">
  126. .ni{
  127. background: #FFFFFF;
  128. border-radius: 24rpx;
  129. padding: 40rpx 24rpx 32rpx;
  130. margin-top: 20rpx;
  131. &-top{
  132. &-left{
  133. .avatar{
  134. width: 48rpx;
  135. height: 48rpx;
  136. }
  137. .name{
  138. font-family: PingFang-SC, PingFang-SC;
  139. font-weight: bold;
  140. font-size: 32rpx;
  141. color: #151B29;
  142. line-height: 32rpx;
  143. margin-left: 16rpx;
  144. }
  145. .sex{
  146. width: 44rpx;
  147. height: 32rpx;
  148. margin-left: 10rpx;
  149. }
  150. .age{
  151. border-radius: 13rpx;
  152. font-family: PingFangSC, PingFang SC;
  153. font-weight: 400;
  154. font-size: 20rpx;
  155. line-height: 24rpx;
  156. padding: 4rpx 10rpx;
  157. margin-left: 13rpx;
  158. &.women{
  159. background: rgba(244,101,122,0.14);
  160. color: #F4657A;
  161. }
  162. &.man{
  163. background: rgba(5,169,254,0.12);
  164. color: #05A9FE;
  165. }
  166. }
  167. }
  168. &-right{
  169. background: rgba(183, 243, 88, .2);
  170. border-radius: 27rpx;
  171. padding: 12rpx 18rpx;
  172. font-family: PingFangSC, PingFang SC;
  173. font-weight: 400;
  174. font-size: 24rpx;
  175. color: #70CF52;
  176. line-height: 24rpx;
  177. &.grey{
  178. background: #F0F2F8;
  179. color: #646464;
  180. }
  181. }
  182. }
  183. &-info{
  184. margin-top: 40rpx;
  185. &-left{
  186. width: 158rpx;
  187. height: 214rpx;
  188. image{
  189. width: 100%;
  190. height: 100%;
  191. border-radius: 16rpx;
  192. }
  193. }
  194. &-right{
  195. width: calc(100% - 158rpx);
  196. padding-left: 20rpx;
  197. box-sizing: border-box;
  198. .title{
  199. font-family: PingFang-SC, PingFang-SC;
  200. font-weight: bold;
  201. font-size: 32rpx;
  202. color: #151B29;
  203. line-height: 40rpx;
  204. margin-bottom: 5rpx;
  205. }
  206. .tip{
  207. align-items: flex-start;
  208. margin-top: 25rpx;
  209. &-left{
  210. width: 160rpx;
  211. image{
  212. width: 24rpx;
  213. height: 24rpx;
  214. }
  215. text{
  216. font-family: PingFangSC, PingFang SC;
  217. font-weight: 400;
  218. font-size: 24rpx;
  219. color: #676775;
  220. line-height: 24rpx;
  221. padding-left: 10rpx;
  222. box-sizing: border-box;
  223. }
  224. }
  225. &-right{
  226. width: calc(100% - 160rpx);
  227. font-family: PingFangSC, PingFang SC;
  228. font-weight: 400;
  229. font-size: 24rpx;
  230. color: #676775;
  231. line-height: 24rpx;
  232. }
  233. }
  234. .bottom{
  235. margin-top: 30rpx;
  236. justify-content: flex-end;
  237. }
  238. .btn{
  239. background: #B7F358;
  240. border-radius: 27rpx;
  241. padding: 12rpx 26rpx;
  242. font-family: PingFang-SC, PingFang-SC;
  243. font-weight: bold;
  244. font-size: 24rpx;
  245. color: #252525;
  246. line-height: 30rpx;
  247. margin-left: 20rpx;
  248. }
  249. }
  250. }
  251. }
  252. </style>