Explorar el Código

fix: 对接分数,升级弹窗

刘秀芳 hace 3 semanas
padre
commit
b8b7960bb5

+ 8 - 0
api/tree.js

@@ -70,4 +70,12 @@ export default {
 	getSignInfo() {
 		return http.get(`mini/buy_sign_in/signInfo`)
 	},
+	// 获取等级奖励信息(包含奖励发放记录和奖励详情)
+	fetchLevelAwardInfo(data) {
+		return http.get('mini/buy/level-award/getLevelAwardInfo', data)
+	},
+	// 获取等级奖励信息(包含奖励发放记录和奖励详情)
+	fetchClaimAward(data) {
+		return http.get('mini/buy/level-award/claimAward', data)
+	},
 }

+ 4 - 1
pages/login/index.vue

@@ -83,6 +83,9 @@
 	}
 
 	const saveUserInfo = (params) => {
+		if (pageParams.value?.code) {
+			params = {...params, code: pageParams.value?.code}
+		}
 		USER.updateUser(params).then(response => {
 			uni.hideLoading()
 			if (response.success) {
@@ -93,7 +96,7 @@
 					mask: true
 				})
 				uni.setStorageSync('userInfo', userData.value);
-				if (pageParams.value?.isFromScan) {
+				if (pageParams.value?.code) {
 					uni.reLaunch({
 						url: `/pages/tabBar/home/subPages/gardenMap?isScanAuthSuccess=true`
 					});

+ 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"
+					url: "/pages/tabBar/home/subPages/gardenMap?code=7"
 				})
 			}
 		})

+ 4 - 4
pages/tabBar/home/subPages/allGardenMap.vue

@@ -14,10 +14,10 @@
 	const webViewUrl = ref('')
 
 	onMounted(() => {
+		webViewUrl.value =
+			`https://feiniao-mini-h5-dev.sysuimars.cn/youwei/#/allGardenMap?userId=${userInfo.id}&token=${userInfo.token}`
+		// webViewUrl.value = "http://localhost:8081/#/allGardenMap?userId=91754&token=034d7cf5-25fc-42d3-993e-460120419e5a"
 		// webViewUrl.value =
-		// 	`https://feiniao-mini-h5-dev.sysuimars.cn/youwei/#/allGardenMap?userId=${userInfo.id}&token=${userInfo.token}`
-		webViewUrl.value = "http://localhost:8081/#/allGardenMap?userId=91754&token=034d7cf5-25fc-42d3-993e-460120419e5a"
-		// webViewUrl.value =
-		// 	`https://feiniao-mini-h5-dev.sysuimars.cn/youwei/#/gardenMap?userId=${userInfo.id}&token=${userInfo.token}&isFromScan=true`
+		// 	`https://feiniao-mini-h5-dev.sysuimars.cn/youwei/#/gardenMap?userId=${userInfo.id}&token=${userInfo.token}&code=7`
 	})
 </script>

+ 5 - 1
pages/tabBar/home/subPages/gardenMap.vue

@@ -14,7 +14,7 @@
 	// 创建响应式的webview URL
 	const webViewUrl = ref('')
 	
-	onLoad(({enterSelectTree, isScanAuthSuccess}) => {
+	onLoad(({enterSelectTree, isScanAuthSuccess, code}) => {
 		if (enterSelectTree) {
 			webViewUrl.value =
 				`https://feiniao-mini-h5-dev.sysuimars.cn/youwei/#/gardenMap?userId=${userInfo.id}&token=${userInfo.token}&enterSelectTree=true`
@@ -23,6 +23,10 @@
 			webViewUrl.value =
 				`https://feiniao-mini-h5-dev.sysuimars.cn/youwei/#/gardenMap?userId=${userInfo.id}&token=${userInfo.token}&isScanAuthSuccess=true`
 				// webViewUrl.value = `http://localhost:8081/#/gardenMap?userId=${userInfo.id}&token=${userInfo.token}&isScanAuthSuccess=true`
+		} else if (code) {
+			webViewUrl.value =
+				`https://feiniao-mini-h5-dev.sysuimars.cn/youwei/#/gardenMap?userId=${userInfo.id}&token=${userInfo.token}&code=${code}`
+				// webViewUrl.value = "http://localhost:8081/#/gardenMap?userId=91754&token=034d7cf5-25fc-42d3-993e-460120419e5a"
 		} else {
 			webViewUrl.value =
 				`https://feiniao-mini-h5-dev.sysuimars.cn/youwei/#/gardenMap?userId=${userInfo.id}&token=${userInfo.token}`

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

@@ -93,6 +93,7 @@
 
 	const handleCancelSucess = () => {
 		sucessPopup.value = false;
+		emit("closeBlessings")
 	};
 
 	const getRandomPick = () => {
@@ -115,14 +116,14 @@
 
 	const sucessPopup = ref(false);
 
-	const emit = defineEmits(['clockinCallback'])
+	const emit = defineEmits(['clockinCallback', "closeBlessings"])
 	const handleSend = () => {
 		const params = {
 			farmBuyId: props.farmBuyId,
 			clockinType: props.clockinType,
 			msg: message.value,
-		};
-		if(props.clockinType!=4){
+		};
+		if(props.clockinType!=4){
 			TREE.clockin(params).then((res) => {
 				if (res.code === 0) {
 					handleCancel();
@@ -130,10 +131,17 @@
 					emit('clockinCallback')
 				}
 			});
-		}else{
-			sucessPopup.value = true;
+		}else{
+			sucessPopup.value = true;
 		}
 	};
+	
+	function handleUpgrade() {		
+		// 是否有200积分弹窗
+		TREE.fetchLevelAwardInfo({buyId: props.farmBuyId}).then(({data}) => {
+			console.log('da获取200积分ta', data)
+		})
+	}
 
 	onMounted(() => {
 		getRandomPick();
@@ -264,7 +272,7 @@
 	}
 
 	.sucess-popup {
-		width: 100vw;
+		width: 100vw;
 		min-height: 100vh;
 
 		.image {
@@ -282,7 +290,7 @@
 
 			.img {
 				width: 81%;
-				height: 410rpx;
+				height: 410rpx;
 			}
 		}
 

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

@@ -84,10 +84,10 @@
 		<!-- 果树相册弹窗 -->
 		<tree-album-popup :show="showAlbum" :farmBuyId="farmBuyId" :sampleId="sampleId"></tree-album-popup>
 		<!-- 等级升级成功弹窗 -->
-		<levelSuccessPopup></levelSuccessPopup>
+		<levelSuccessPopup :show="showUpgradePopup"></levelSuccessPopup>
 		<!-- 祝福弹窗 -->
 		<blessingsPopup :show="showBlessingsPopup" :showSuccess="showSuccess" :farmBuyId="farmBuyId"
-			:clockinType="clockinType" @clockinCallback="getBySampleId"></blessingsPopup>
+			:clockinType="clockinType" @clockinCallback="getBySampleId" @closeBlessings="closeBlessings"></blessingsPopup>
 	</view>
 </template>
 
@@ -267,6 +267,13 @@
 		})
 	}
 	
+	// 得到200分弹窗关闭
+	function closeBlessings() {
+		TREE.fetchClaimAward({buyId: farmBuyId.value, levelAwardId: 1}).then(({data}) => {
+			showUpgradePopup.value = true
+		})
+	}
+	
 	const closedCheckPopup = () =>{
 		showPoster.value = !showPoster.value
 	}
@@ -327,6 +334,7 @@
 	const footerList = ["每日阳光", "送ta祝福", "分享转发", "水果订购"]
 	const showBlessingsPopup = ref(false)
 	const showSuccess = ref(false)
+	const showUpgradePopup = ref(false)
 	const clockinType = ref('1')
 	
 	// 弹幕相关数据