Просмотр исходного кода

最新需求优化:我的公益列表操作不跳转详情(立即报名除外,有的需要选择专享券)

htc 14 часов назад
Родитель
Сommit
7ff1c687b0

+ 69 - 7
components/pages/nonprofitItem/index.vue

@@ -1,5 +1,5 @@
 <template>
-	<view class="ni" v-if="item" @click="toDetail(item)">
+	<view class="ni" v-if="item" @click.prevent="toDetail(item)">
 		<view class="ni-top adfacjb">
 			<view class="ni-top-left adfac">
 				<image class="avatar" src="https://oss.familydaf.cn/sxsnfile/20251218/3821654e080945998d464f3c3aa64122.png"></image>
@@ -31,11 +31,11 @@
 					<view class="tip-right">{{item?.provinceName||''}}{{item?.cityName||''}}</view>
 				</view>
 				<view class="bottom">
-					<view class="btn" v-if="item.activeState==1&&item.signupState==1">取消报名</view>
-					<view class="btn" v-if="item.activeState==1&&item.signupState==-1">立即报名</view>
-					<view class="btn" v-if="item.activeState==2&&item.signupState==1">去签到</view>
-					<view class="btn" v-if="item.activeState==3&&item.signupState==2">写档案</view>
-					<view class="btn" v-if="item.activeState==3&&item.signupState==3">查看档案</view>
+					<view class="btn" @click.stop="handleCancel" v-if="(item.activeState==1||item.activeState===0)&&item.signupState==1">取消报名</view>
+					<view class="btn" @click.stop="toDetail(item)" v-if="item.activeState==1&&item.signupState==-1">立即报名</view>
+					<view class="btn" @click.stop="handleSignup" v-if="item.activeState==2&&item.signupState==1">去签到</view>
+					<view class="btn" @click.stop="handleFill" v-if="item.activeState==3&&item.signupState==2">写档案</view>
+					<view class="btn" @click.stop="handleReview" v-if="item.activeState==3&&item.signupState==3">查看档案</view>
 				</view>
 			</view>
 		</view>
@@ -43,7 +43,8 @@
 </template>
 
 <script setup name="NonprofitItem">
-	import { ref } from 'vue'
+	import { ref, getCurrentInstance } from 'vue'
+	const { proxy } = getCurrentInstance()
 	
 	const props = defineProps({
 		item:{
@@ -69,6 +70,67 @@
 			url:'/pagesNonprofit/nonprofitDetail?memberSignupId='+item?.memberSignupId
 		})
 	}
+	
+	
+	const emits = defineEmits(['handleCancel'])
+	const handleCancel = () => {
+		uni.showModal({
+			title:'温馨提示',
+			content:'确认取消本次报名吗?取消后可再次报名本活动。',
+			success: (res) => {
+				if(res.confirm){
+					proxy.$api.get(`/core/activity/signup/cancelSignupBySingle/${props.item?.memberSignupId}`).then(({data:res})=>{
+						if(res.code!==0) return proxy.$showToast(res.msg)
+						emits('handleCancel')
+					})
+				}
+			}
+		})
+	}
+	
+	const handleSignup = () => {
+		try{
+			uni.scanCode({
+				success: (res) => {
+					if(res.errMsg=='scanCode:ok'){
+						let r = res.result.replace(/^\uFEFF/, '');
+						let d = JSON.parse(r);
+						if(!d.hasOwnProperty('id')||!d) return proxy.$showToast('请扫描正确的活动签到码');
+						
+						let { id } = d;
+						const userId = JSON.parse(uni.getStorageSync('userInfo'))?.id||'';
+						proxy.$api.post('/core/activity/signup/signinBySingle',{
+							activityId:id||'',
+							memberSignupId:props.item?.memberSignupId,
+							userId
+						}).then(({data:res})=>{
+							if(res.code!==0) return proxy.$showToast('签到失败,请稍后再试')
+							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(props.item))
+		})
+	}
+	
+	const handleReview = () => {
+		uni.navigateTo({
+			url:'/pagesMy/archivesDetail?activityId='+props.item?.activityId+'&memberId='+props.item?.memberId
+		})
+	}
 </script>
 
 <style scoped lang="scss">

+ 6 - 1
pages/nonprofit.vue

@@ -12,7 +12,7 @@
 		<view class="list" v-if="list.length">
 			<up-list @scrolltolower="scrolltolower" style="height: 100%;">
 				<up-list-item v-for="(item, index) in list" :key="index">
-					<NonprofitItem :item="item"></NonprofitItem>
+					<NonprofitItem :item="item" @handleCancel="handleCancel"></NonprofitItem>
 				</up-list-item>
 			</up-list>
 		</view>
@@ -79,6 +79,11 @@
 		})
 	}
 	
+	const handleCancel = () => {
+		initList();
+		getList();
+	}
+	
 	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]$/;

+ 3 - 3
pagesHome/fillNonprofitResult.vue

@@ -1,11 +1,11 @@
 <template>
 	<view class="common_page adffcac" :style="{'height':h+'px', 'padding-top':mt+'px'}">
-		<cus-header title="填写公益档案" bgColor="#FFFFFF"></cus-header>
+		<cus-header title="提交结果" bgColor="#FFFFFF"></cus-header>
 		<image src="https://oss.familydaf.cn/sxsnfile/20251218/26d151c0e4764236823268ecbe836ce5.png"></image>
 		<view class="title">公益档案提交成功</view>
-		<view class="tip">您可去我的公益里查看活动进度及详情~</view>
+		<!-- <view class="tip">您可去我的公益里查看活动进度及详情~</view> -->
 		<view class="btns adfacjb">
-			<view class="btn adfacjc" @click="handleTurn('/pages/nonprofit')">我的公益</view>
+			<view class="btn adfacjc" @click="handleTurn('/pages/nonprofit?type=3')">查看公益档案</view>
 			<view class="btn adfacjc home" @click="handleTurn('/pages/home')">返回首页</view>
 		</view>
 	</view>

+ 4 - 4
pagesMy/archivesDetail.vue

@@ -42,7 +42,7 @@
 	import { ref, getCurrentInstance } from 'vue'
 	const { proxy } = getCurrentInstance()
 	
-	const avatar = ref('')
+	const avatar = ref('https://oss.familydaf.cn/sxsnfile/20251218/3821654e080945998d464f3c3aa64122.png')
 	const info = ref(null)
 	const imgs = ref([])
 	
@@ -51,9 +51,9 @@
 	}
 	
 	onLoad(options=>{
-		if(uni.getStorageSync('userInfo')){
-			avatar.value = JSON.parse(uni.getStorageSync('userInfo'))?.avatarPath||'https://oss.familydaf.cn/sxsnfile/20251218/3821654e080945998d464f3c3aa64122.png';
-		}
+		// if(uni.getStorageSync('userInfo')){
+		// 	avatar.value = JSON.parse(uni.getStorageSync('userInfo'))?.avatarPath||'https://oss.familydaf.cn/sxsnfile/20251218/3821654e080945998d464f3c3aa64122.png';
+		// }
 		proxy.$api.get(`/core/activity/signup/getMemberProfile/${options?.activityId}/${options?.memberId}`).then(({data:res})=>{
 			if(res.code!==0) return proxy.$showToast(res.msg)
 			info.value = res.data;

+ 4 - 2
pagesNonprofit/nonprofitDetail.vue

@@ -4,7 +4,7 @@
 		<image src="https://oss.familydaf.cn/sxsnfile/20251218/ff31a76e0e1148378a318382b998a51f.png" class="top_bg_img" mode="widthFix"></image>
 		<view class="top">
 			<view class="top-status adfacjb">
-				<view class="left adfac">{{signupStateDict[info?.signupState]||'未知'}} <span v-if="info?.signupState==-1">报名人数不足,活动已取消</span></view>
+				<view class="left adfac">{{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>
@@ -89,7 +89,7 @@
 			<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 class="right grey" @click="handleReview" v-else-if="info?.activeState==-1">活动已取消</view>
+			<view class="right grey" v-else-if="info?.activeState==-1">活动已取消</view>
 		</view>
 	</view>
 </template>
@@ -217,11 +217,13 @@
 			proxy.$showToast('签到异常,请稍后再试')
 		}
 	}
+	
 	const handleFill = () => {
 		uni.navigateTo({
 			url:'/pagesHome/fillNonprofitArchives?activity='+encodeURIComponent(JSON.stringify(info.value))
 		})
 	}
+	
 	const handleReview = () => {
 		uni.navigateTo({
 			url:'/pagesMy/archivesDetail?activityId='+info.value?.activityId+'&memberId='+info.value?.memberId