Selaa lähdekoodia

fix: 扫码流程守护页面订购,升级弹窗

lxf 2 viikkoa sitten
vanhempi
commit
2097c19f35

+ 7 - 2
components/levelSuccessPopup/levelSuccessPopup.vue

@@ -19,7 +19,9 @@
 				</view>
 				<view class="button-group">
 					<view class="btn">开心收下</view>
-					<up-icon class="close" name="close-circle-fill" size="30" color="rgba(255, 255, 255, 0.7)"></up-icon>
+					<view class="close">
+						<up-icon name="close-circle-fill" size="30" color="rgba(255, 255, 255, 0.7)"></up-icon>
+					</view>
 				</view>
 			</view>
 		</view>
@@ -43,7 +45,9 @@
 	const showPopup = ref(false);
 	const handleClose = ()=>{
 		showPopup.value = false
+		emit("closeLevel")
 	}
+	const emit = defineEmits(["closeLevel"])
 	
 	watch(
 		() => props.show,
@@ -135,8 +139,9 @@
 				background: linear-gradient(120deg, #FFE6B2, #FFC339);
 				text-align: center;
 			}
-			.close{
+			.close {
 				margin-top: 64rpx;
+				display: flex;
 				justify-content: center;
 			}
 		}

+ 1 - 1
pages/tabBar/home/home.vue

@@ -263,7 +263,7 @@
 		HOME.fetchUserGarden({speciesId: '1'}).then(({data}) => {
 			if (!data || !data?.id) {
 				uni.navigateTo({
-					url: "/pages/tabBar/home/subPages/gardenMap?code=7"
+					url: "/pages/tabBar/home/subPages/gardenMap"
 				})
 			}
 		})

+ 0 - 7
pages/tabBar/tree/components/blessingsPopup.vue

@@ -135,13 +135,6 @@
 			sucessPopup.value = true;
 		}
 	};
-	
-	function handleUpgrade() {		
-		// 是否有200积分弹窗
-		TREE.fetchLevelAwardInfo({buyId: props.farmBuyId}).then(({data}) => {
-			console.log('da获取200积分ta', data)
-		})
-	}
 
 	onMounted(() => {
 		getRandomPick();

+ 36 - 10
pages/tabBar/tree/tree.vue

@@ -74,7 +74,7 @@
 		<up-picker :show="showPicker" :columns="columns" :defaultIndex="[0]" @cancel="handleCancel"
 			@confirm="handleConfirm" keyName="name" valueName="speciesId"></up-picker>
 		<!-- 签到打卡 -->
-		<checkinPopup @closedCheckPopup="closedCheckPopup"></checkinPopup>
+		<checkinPopup v-if="showCheckin" @closedCheckPopup="closedCheckPopup"></checkinPopup>
 		<!-- 编辑树名称 -->
 		<editNamePopup ref="editNameRef" @editEnd="getBySampleId"></editNamePopup>
 		<!-- 海报弹窗 -->
@@ -90,7 +90,7 @@
 		<!-- 果树相册弹窗 -->
 		<tree-album-popup :show="showAlbum" :farmBuyId="farmBuyId" :sampleId="sampleId"></tree-album-popup>
 		<!-- 等级升级成功弹窗 -->
-		<levelSuccessPopup :show="showUpgradePopup"></levelSuccessPopup>
+		<levelSuccessPopup :show="showUpgradePopup" @closeLevel="closeLevel"></levelSuccessPopup>
 		<!-- 祝福弹窗 -->
 		<blessingsPopup :show="showBlessingsPopup" :showSuccess="showSuccess" :farmBuyId="farmBuyId"
 			:clockinType="clockinType" @clockinCallback="getBySampleId"  @closeBlessings="closeBlessings"></blessingsPopup>
@@ -122,6 +122,7 @@
 	import USER from '@/api/user.js'
 	import { CanvasUtils } from '@/utils/canvasUtils.js'
 	import {
+		onMounted,
 		ref
 	} from 'vue';
 
@@ -180,6 +181,7 @@
 	]
 
 	const showGuardSuccess = ref(false)
+	const showCheckin = ref(false)
 
 	const editNameRef = ref(null)
 	const formatDate = (dateStr) => {
@@ -201,9 +203,11 @@
 	// 	featchCategoryList()
 	// })
 	
-	onShow(()=>{
+	onShow(async ()=>{
 		userInfo.value = uni.getStorageSync('userInfo')
-		featchLightTree()
+		await featchLightTree(() => {
+			handleUpgrade()
+		})
 		featchSessionStore()
 	})
 	
@@ -217,6 +221,22 @@
 		stopDanmaku()
 	})
 	
+	onMounted(() => {
+		featchIsLookedGuide()
+	})
+	
+	async function handleUpgrade() {
+		// 是否有200积分弹窗
+		await TREE.fetchLevelAwardInfo({buyId: farmBuyId.value}).then(({data}) => {
+			if (data?.hasAward) {
+				clockinType.value = 4
+				showSuccess.value = !showSuccess.value
+			} else {
+				showCheckin.value = true
+			}
+		})
+	}
+	
 	//品类查询所有
 	const featchCategoryList = () =>{
 		TREE.categoryList().then(({
@@ -254,9 +274,9 @@
 			miniUserId: userInfo.value.id
 		}).then((({data}) => {
 			if(data?.text === 'orderSuccess'){
-				clockinType.value = 4
-				showSuccess.value = !showSuccess.value
-				treeSetSessionStore()
+				// clockinType.value = 4
+				// showSuccess.value = !showSuccess.value
+				// treeSetSessionStore()
 			}else{
 				if (data?.val == 0) {
 					showGuardSuccess.value = !showGuardSuccess.value
@@ -284,23 +304,28 @@
 		})
 	}
 	
+	// 升级弹窗关闭方法
+	function closeLevel() {
+		showCheckin.value = true
+	}
+	
 	const closedCheckPopup = () =>{
 		showPoster.value = !showPoster.value
 	}
 	
 	const sampleId = ref('')
 	//通过品类查询当前树
-	const featchLightTree = () =>{
+	const featchLightTree = (callback) =>{
 		TREE.getLightTreeList().then((res =>{
 			sampleId.value = res.data[0].sampleId
-			getBySampleId()
+			getBySampleId(callback)
 		}))
 	}
 
 	const treeData = ref({})
 	const farmBuyId = ref('')
 	const treeName = ref('')
-	const getBySampleId = () => {
+	const getBySampleId = (callback) => {
 		TREE.getBySampleId({
 			sampleId: sampleId.value
 		}).then(({
@@ -314,6 +339,7 @@
 				treeName.value = '飞鸟守护'
 			}
 			farmBuyId.value = data.buyList[0].id
+			callback && callback()
 			featchSessionStore()
 			// 获取能量记录
 			// featchEnergyRecords()