py 2 yıl önce
ebeveyn
işleme
24ffc052c8
3 değiştirilmiş dosya ile 72 ekleme ve 9 silme
  1. 3 1
      api/member.js
  2. 22 0
      pages/index/index.vue
  3. 47 8
      pages/me/index.vue

+ 3 - 1
api/member.js

@@ -25,4 +25,6 @@ export const delAddress = (data) => request(newsUrl + 'del_address', 'post', { .
 // 新增&编辑地址时获取学校
 export const getAddressSchool = (data) => request(newsUrl + 'school', 'post', { ...data },false)
 // 新增&编辑地址时获取学校宿舍楼
-export const getAddressDorm = (data) => request(newsUrl + 'dorm', 'post', { ...data },false)
+export const getAddressDorm = (data) => request(newsUrl + 'dorm', 'post', { ...data },false)
+// 获取用户是否有未读消息
+export const membeRmessage = (data) => request(newsUrl + 'message', 'post', { ...data },false)

+ 22 - 0
pages/index/index.vue

@@ -219,6 +219,9 @@
 	import {
 		shopInfo
 	} from "@/api/shop.js"
+	import {
+		membeRmessage
+	} from "@/api/member.js"
 	export default {
 		components: {
 			enBlankVue
@@ -352,6 +355,7 @@
 				// this.couponHome()
 			}
 			uni.removeStorageSync('orderInfoType')
+			this.membeRmessage()
 		},
 		onLoad() {
 			this.page = 1;
@@ -394,6 +398,24 @@
 			})
 		},
 		methods: {
+			membeRmessage() {
+				membeRmessage().then((res) => {
+					if (res.code === 1) {
+						if (res.data.msg_count > 0) {
+							uni.showTabBarRedDot({
+								index: 2
+							})
+						} else {
+							uni.hideTabBarRedDot({
+								index: 2
+							})
+						}
+						setInterval(() => {
+							membeRmessage()
+						}, 60000)
+					}
+				})
+			},
 			commonPopNotice() {
 				commonPopNotice().then((res) => {
 					const noticeId = uni.getStorageSync('notice_id');

+ 47 - 8
pages/me/index.vue

@@ -4,7 +4,8 @@
 		<image class="bg-box" src="@/static/img/my/bg.png" mode=""></image>
 		<view class="user-box align-items-center" @click="goToUrl(0)">
 			<view class="user-img-box mr-24">
-				<image v-if="userInfoData.head_img" class="user-img b-rad-50" :src="userInfoData.head_img" mode="aspectFill">
+				<image v-if="userInfoData.head_img" class="user-img b-rad-50" :src="userInfoData.head_img"
+					mode="aspectFill">
 				</image>
 				<image v-else class="user-img b-rad-50" src="@/static/img/my/user-img.png" mode=""></image>
 				<image class="set-iimg" src="@/static/img/my/pen.png" mode=""></image>
@@ -46,8 +47,8 @@
 						<image class="lqzx-img" src="@/static/img/my/lqzx.png" mode=""></image>
 						<image class="to-right" src="@/static/img/toRight.png" mode=""></image>
 					</view>
-					<view class="fs-26 fc-9">
-						领券下单更优惠
+					<view class="fs-26 fc-ED301D">
+						{{couponHome_num?'有可领取的优惠券':'领券下单更优惠'}}
 					</view>
 				</view>
 				<image class="function-two-right" src="@/static/img/my/q.png" mode=""></image>
@@ -64,7 +65,7 @@
 							</view>
 						</view>
 						<view class="item-right align-items-center">
-							<view class="fs-24 fc-9" v-if="userInfoData.msg_count > 0">
+							<view class="fs-24 fc-ED301D" v-if="userInfoData.msg_count > 0">
 								{{userInfoData.msg_count}}条未读消息
 							</view>
 							<image class="to-right" src="@/static/img/toRight.png" mode=""></image>
@@ -152,6 +153,12 @@
 	import {
 		userInfo
 	} from '@/api/member.js'
+	import {
+		couponHome
+	} from '@/api/coupon.js'
+	import {
+		membeRmessage
+	} from "@/api/member.js"
 	export default {
 		components: {},
 		data() {
@@ -163,6 +170,7 @@
 					sex: '',
 					msg_count: '',
 				},
+				couponHome_num: false
 			};
 		},
 		onShow() {
@@ -171,14 +179,43 @@
 				this.userInfoData.nickname = '请先登录'
 			} else {
 				this.getUserInfo();
+				this.couponHome()
+				this.membeRmessage()
 			}
 		},
-
 		methods: {
+			membeRmessage() {
+				membeRmessage().then((res) => {
+					if (res.code === 1) {
+						if (res.data.msg_count > 0) {
+							uni.showTabBarRedDot({
+								index: 2
+							})
+						} else {
+							uni.hideTabBarRedDot({
+								index: 2
+							})
+						}
+					}
+				})
+			},
+			couponHome() {
+				let operate_id = uni.getStorageSync('operate_id');
+				couponHome({
+					operate_id: operate_id
+				}).then((res) => {
+					if (res.code == 1) {
+						if (res.data.length > 0) {
+							this.couponHome_num = true
+						} else {
+							this.couponHome_num = false
+						}
+					}
+				})
+			},
 			handleContact(e) {
 				console.log(e);
 			},
-
 			getUserInfo() {
 				userInfo().then((res) => {
 					if (res.code === 1) {
@@ -258,10 +295,11 @@
 </script>
 
 <style lang="scss" scoped>
-	.item-right{
+	.item-right {
 		position: relative;
 	}
-	.red-point{
+
+	.red-point {
 		position: absolute;
 		right: 32rpx;
 		top: 0;
@@ -271,6 +309,7 @@
 		background: red;
 		opacity: 0.5;
 	}
+
 	.item-box {
 		position: relative;