<template>
	<view class="container">
		<!-- 会员信息 上滑展示 start -->
		<view class="member_info_sliding" v-if="memberSliding">
			<view class="member_info_sliding_left">
				<image :src="userCenterData.memberAvatar != undefined ? userCenterData.memberAvatar : defaultAvatar"
					mode="aspectFill"></image>
			</view>
			<view class="member_info_sliding_center">
				{{$L('我的')}}
			</view>
			<view class="member_info_sliding_right">
				<view class="user_sets" @click="goSet()">
					<image :src="imgUrl + 'member/setting_icon1.png' " mode="" class="user_set_img"></image>
				</view>
				<view class="user_msg" @click="goMsg()">
					<image :src="imgUrl + 'member/msg_icon1.png'" mode="" class="user_msg_img"></image>
					<text
						v-if="userCenterData && userCenterData.msgNum > 0">{{userCenterData.msgNum > 9 ? '9+' : userCenterData.msgNum}}</text>
				</view>
			</view>
		</view>
		<view class="member_info_sliding" v-if="memberSliding">
			<view class="member_info_sliding_left">
				<image :src="userCenterData.memberAvatar != undefined ? userCenterData.memberAvatar : defaultAvatar"
					mode="aspectFill"></image>
			</view>
			<view class="member_info_sliding_center">
				{{$L('我的')}}
			</view>
			<view class="member_info_sliding_right">
				<view class="user_sets" @click="goSet()">
					<image :src="imgUrl + 'member/setting_icon1.png' " mode="" class="user_set_img"></image>
				</view>
				<view class="user_msg" @click="goMsg()">
					<image :src="imgUrl + 'member/msg_icon1.png'" mode="" class="user_msg_img"></image>
					<text
						v-if="userCenterData && userCenterData.msgNum > 0">{{userCenterData.msgNum > 9 ? '9+' : userCenterData.msgNum}}</text>
				</view>
			</view>
		</view>
		<!-- 会员信息 上滑展示 end -->


		<!-- 会员信息 start 未上滑 -->
		<view class="user-section">
			<view class="fixed_top_status_bar"></view>
			<image class="bg" :src="imgUrl+'member/member_bg.png'" mode="aspectFit"></image>
			<view class="user_set">
				<view class="user_msg" @click="goSet()">
					<image :src="imgUrl + 'member/setting_icon.png' " mode="" class="user_set_img"></image>
				</view>
				<view class="user_msg" @click="goMsg()">
					<image :src="imgUrl + 'member/msg_icon.png'" mode="" class="user_msg_img"></image>
					<text
						v-if="userCenterData && userCenterData.msgNum > 0">{{userCenterData.msgNum > 9 ? '9+' : userCenterData.msgNum}}</text>
				</view>
			</view>
			<view class="user-info-box">
				<view class="portrait-box">
					<view class="portrait-bgc">
						<image
							:src="userCenterData && userCenterData.memberAvatar != undefined ? userCenterData.memberAvatar : defaultAvatar"
							mode="aspectFill" class="portrait"></image>
					</view>
				</view>
				<view class="mem-info">

					<text class="nick-name"
						v-if="userCenterData && (userCenterData.memberName || userCenterData.memberNickName)"
						@click="navTo('/pages/user/info')">{{userCenterData.memberNickName||userCenterData.memberName}}</text>
					<!-- #ifdef MP-WEIXIN -->
					<button class="login_btn"
						v-if="(!userCenterData || (userCenterData && !userCenterData.memberName))&&canIUseGetUserProfile"
						@tap="getUserProfile">
						<text class="nick-name">{{$L('登录')}}</text>
					</button>
					<button class="login_btn" open-type="getUserInfo" @getuserinfo="getUser"
						v-if="(!userCenterData || (userCenterData && !userCenterData.memberName))&&!canIUseGetUserProfile">
						<text class="nick-name">{{$L('登录')}}</text>
					</button>
					<!-- #endif -->
					<!-- #ifdef H5||APP-PLUS -->
					<text class="nick-name" @tap="gotoLogin"
						v-if="!userCenterData || (userCenterData && !userCenterData.memberName)">{{$L('登录')}}</text>
					<!-- #endif -->

					<text class="member-name" @click="navTo('/pages/user/info')"
						v-if="userCenterData && userCenterData.memberName">{{$L('会员名:')}}{{userCenterData.memberName}}</text>
				</view>
			</view>

			<view v-if="isSignOpen" @click="navTo('/standard/signIn/signIn')">
				<view class="check-in">
					<image :src="imgUrl+ 'signIn/mine_time.png'" mode="widthFix"></image>
					{{isSign?'已签到':'去签到'}}
				</view>
			</view>
		</view>
		<!-- 会员信息 未上滑 end -->

		<!-- 关注店铺  我的收藏 我的足迹 start -->
		<view class="mine_record">
			<view class="mine_record_pre" @click="navTo('/pages/store/attentionStore')">
				<image :src="imgUrl + 'member/mine_stores.png'" mode=""></image>
				<text>{{$L('关注店铺')}}<text
						v-if="hasLogin && userCenterData && userCenterData.followStoreNum">({{userCenterData.followStoreNum ? userCenterData.followStoreNum : 0}})</text></text>
			</view>
			<view class="mine_record_pre" @click="navTo('/pages/member/collect')">
				<image :src="imgUrl + 'member/mine_collection.png'" mode=""></image>
				<text>{{$L('我的收藏')}}<text
						v-if="hasLogin && userCenterData && userCenterData.followProductNum">({{userCenterData.followProductNum ? userCenterData.followProductNum : 0}})</text></text>
			</view>
			<view class="mine_record_pre" @click="navTo('/pages/member/history')">
				<image :src="imgUrl + 'member/mine_footprint.png'" mode=""></image>
				<text>{{$L('我的足迹')}}<text
						v-if="hasLogin && userCenterData && userCenterData.lookLogNum">({{userCenterData.lookLogNum ? userCenterData.lookLogNum : 0}})</text></text>
			</view>
		</view>
		<!-- 关注店铺  我的收藏 我的足迹 end -->

		<view class="main-content">
			<!-- 我的订单 start-->
			<view class="order-part flex_column_start_start">
				<view class="title flex_row_between_center">
					<text class="left">{{$L('我的订单')}}</text>
					<view class="right flex_row_end_center" @click="navTo('/pages/order/list?state=0')">
						<text>{{$L('全部订单')}}</text>
						<image :src="imgUrl+'member/right_down.png'" />
					</view>
				</view>
				<view class="detail flex_row_around_center">
					<view class="wait-pay item flex_column_center_center" @click="navTo('/pages/order/list?state=1')">
						<image :src="imgUrl+'member/wait_pay_icon.png'" />
						<text class="show-text">{{$L('待付款')}}</text>
						<text class="nums" :class="{num:userCenterData.toPaidOrder <= 9}"
							v-if="userCenterData && userCenterData.toPaidOrder">{{userCenterData.toPaidOrder>99?'99+':userCenterData.toPaidOrder}}</text>
					</view>
					<view class="wait-pay item flex_column_center_center" @click="navTo('/pages/order/list?state=2')">
						<image :src="imgUrl+'member/wait_deliver_icon.png'" />
						<text class="show-text">{{$L('待发货')}}</text>
						<text v-if="userCenterData && userCenterData.toDeliverOrder" class="nums"
							:class="{num:userCenterData.toDeliverOrder <= 9}">{{userCenterData.toDeliverOrder>99?'99+':userCenterData.toDeliverOrder}}</text>
					</view>
					<view class="wait-pay item flex_column_center_center" @click="navTo('/pages/order/list?state=3')">
						<image :src="imgUrl+'member/wait_receive_icon.png'" />
						<text class="show-text">{{$L('待收货')}}</text>
						<text v-if="userCenterData && userCenterData.toReceivedOrder" class="nums"
							:class="{num:userCenterData.toReceivedOrder <= 9}">{{userCenterData.toReceivedOrder>99?'99+':userCenterData.toReceivedOrder}}</text>
					</view>
					<view class="wait-pay item flex_column_center_center" @click="navTo('/pages/order/list?state=4')">
						<image :src="imgUrl+'member/wait_evaluate_icon.png'" />
						<text class="show-text">{{$L('待评价')}}</text>
						<text v-if="userCenterData && userCenterData.toEvaluateOrder" class="nums"
							:class="{num:userCenterData.toEvaluateOrder <= 9}">{{userCenterData.toEvaluateOrder>99?'99+':userCenterData.toEvaluateOrder}}</text>
					</view>
					<view class="wait-pay item flex_column_center_center"
						@click="navTo('/pages/order/returnAndRefundList?state=0')">
						<image :src="imgUrl+'member/wait_service_icon.png'" />
						<text class="show-text">{{$L('退款/售后')}}</text>
						<text v-if="userCenterData && userCenterData.afterSaleNum" class="nums"
							:class="{num:userCenterData.afterSaleNum <= 9}">{{userCenterData.afterSaleNum>99?'99+':userCenterData.afterSaleNum}}</text>
					</view>
				</view>
			</view>
			<!-- 我的订单 end-->

			<view class="picture_adv_poster_con" @click="goMyVideo"
				v-if="(!hasLogin && setting.video_switch == '1') || hasLogin">
				<!-- <view class="video_poster" :style="'background-image:url('+imgUrl+ 'svideo/video_poster3x.png'+');'+bgStyle+';'+ bgStyle"> -->
				<image :src="imgUrl + 'svideo/video_poster3x.png'"></image>

				<!-- </view> -->
			</view>

			<!-- 开店横版广告展示 start -->
			<view class="picture_adv_poster_con" @click="sellerOpt" v-if="hasLogin&&userCenterData.sellerSwitch==1">
				<image :src="imgUrl+'store_poster.png'"></image>
			</view>
			<!-- 开店横版广告展示 end -->
			
			<!-- 常用服务 start -->
			<view class="common_services">
				<view class="common_services_title">{{$L('常用服务')}}</view>
				<view class="common_services_list">
					<view class="common_services_pre" @click="navTo('/pages/balance/balance')">
						<view class="common_serv_pre_left">
							<image :src="imgUrl + 'member/mine_wallet.png'" mode=""></image>
							<text>{{$L('我的钱包')}}</text>
						</view>
						<view class="common_serv_pre_right">
							<text
								v-if="userCenterData && userCenterData.memberBalance">￥{{userCenterData.memberBalance}}</text>
							<image :src="imgUrl+'member/right_down.png'" />
						</view>
					</view>
					<view class="common_services_pre" @click="toPointsPage">
						<view class="common_serv_pre_left">
							<image :src="imgUrl + 'member/mine_integral.png'" mode=""></image>
							<text>{{$L('我的积分')}}</text>
						</view>
						<view class="common_serv_pre_right">
							<text
								v-if="userCenterData && userCenterData.memberIntegral">{{userCenterData.memberIntegral}}</text>
							<image :src="imgUrl+'member/right_down.png'" />
						</view>
					</view>
					<view class="common_services_pre" @click="goMyCoupon">
						<view class="common_serv_pre_left">
							<image :src="imgUrl + 'member/my_coupon.png'" mode=""></image>
							<text>{{$L('我的优惠券')}}</text>
						</view>
						<view class="common_serv_pre_right">
							<text v-if="userCenterData && userCenterData.couponNum">{{userCenterData.couponNum}}</text>
							<image :src="imgUrl+'member/right_down.png'" />
						</view>
					</view>
					<view class="common_services_pre" @click="goMyPointOrder">
						<view class="common_serv_pre_left">
							<image :src="imgUrl + 'member/point_order.png'" mode=""></image>
							<text>{{$L('我的积分订单')}}</text>
						</view>
						<view class="common_serv_pre_right">
							<text v-if="pointOrderNums&&hasLogin">{{pointOrderNums}}</text>
							<image :src="imgUrl+'member/right_down.png'" />
						</view>
					</view>
					<view class="common_services_pre" @click="makeCall">
						<view class="common_serv_pre_left">
							<image :src="imgUrl + '/customer_help_icon.png'" mode=""></image>
							<text>平台客服</text>
						</view>
						<view class="common_serv_pre_right">
							<image :src="imgUrl+'member/right_down.png'" />
						</view>
					</view>
					<!-- <view class="common_services_pre" @click="sellerOpt" v-if="hasLogin&&userCenterData.sellerSwitch==1">
						<view class="common_serv_pre_left">
							<image :src="imgUrl + 'member/point_order.png'" mode=""></image>
							<text>商户中心</text>
						</view>
					</view> -->
				</view>
			</view>
			<!-- 常用服务 end -->
		</view>
		<!-- 推荐商品 start-->
		<recommendGoods ref='recomment_goods' />
		<!-- 推荐商品 end-->

		<!-- 开屏框 start -->

		<view class="open_screen" v-if="signOpenCookie&&!isSign">
			<view :style="{ width: width + 'rpx', 'height': height + 'rpx' }" class="open_screen_con"
				@click="navTo('/standard/signIn/signIn')">
				<view class="con_img" @click.stop="signOpenCookie = false">
					<image :src="imgUrl+'signIn/close_screen.png'"></image>
				</view>
				<image class="open_screen_con_img" :src="signNotice?signNotice:openscnImg" style="height:821rpx" mode="aspectFit"></image>
			</view>
		</view>
		<!-- 开屏框 end -->
		<uni-popup ref="popup" type="dialog">
			<uni-popup-dialog type="input" title="温馨提示" :content="sellerTip" :confirmText="'复制'" :duration="2000"
				@confirm="copyClipp"></uni-popup-dialog>
		</uni-popup>
	</view>
</template>
<script>
	import listCell from '@/components/mix-list-cell';
	import recommendGoods from "@/components/recommend-goods.vue"
	import uniPopup from '@/components/uni-popup/uni-popup.vue'
	import uniPopupDialog from '@/components/uni-popup/uni-popup-dialog.vue'
	import h5Copy from '@/utils/H5copy.js'
	import {
		mapState,
		mapMutations
	} from 'vuex';
	let startY = 0,
		moveY = 0,
		pageAtTop = true;
	export default {
		components: {
			listCell,
			recommendGoods,
			uniPopup,
			uniPopupDialog
		},
		data() {
			return {
				imgUrl: getApp().globalData.imgUrl,
				defaultAvatar: getApp().globalData.imgUrl + 'default/member-avatar.png', //默认头像
				coverTransform: 'translateY(0px)',
				coverTransition: '0s',
				moving: false,
				client: 1, //终端类型， 1、H5(微信内部浏览器) 2、H5(微信小程序)；3、app
				oriUrl: '', //不带code的页面地址
				memberSliding: false, //页面上滑效果是否显示
				pointOrderNums: 0, //为完成积分订单数量
				videoNum: 0, //我的视频数量
				setting: {}, //平台配置信息
				bgStyle: 'background-size:contain;background-position:center center;background-repeat: no-repeat;',
				canIUseGetUserProfile: false, //是否可以使用getUserProfile获取用户信息，用于微信小程序,
				openscnImg: getApp().globalData.imgUrl + 'signIn/signner.png',
				width: 636,
				height: 821,
				signOpenCookie: false, //签到提醒flag,
				isSignOpen: false, //签到活动是否可用
				isSign: false, //是否签到,
				showState: false,
				signNotice: {},
				adminTel: '',
				sellerTip: ''
			}
		},
		onLoad(option) {
			this.client = this.$getLoginClient();
			//#ifdef MP-WEIXIN
			if (uni.getUserProfile) {
				this.canIUseGetUserProfile = true;
			}
			//#endif
			//#ifdef H5
			let code = this.$getQueryVariable('code');
			if (code) {
				let oriUrl = option.ori_url + 'pages/user/user';
				let tmp_data = '';
				for (let i in option) {
					if (i != 'ori_url') {
						tmp_data += i + '=' + option[i] + '&'
					}
				}
				oriUrl += '?' + tmp_data;
				this.oriUrl = oriUrl;
				if (this.$isWeiXinBrower()) {
					//微信浏览器的话要把浏览器地址里面的code去掉
					history.replaceState({}, '', this.oriUrl);
				}
				this.toLogin(code, '');
			}
			//#endif
			this.initData();
			this.getSetting();
			this.getSysSetting()
			if (this.hasLogin) {
				this.signOpenScreen();
			}

		},
		onShow() {
			if (this.showState) {
				this.initData();
				this.getSetting();
				this.signOpenScreen();
			}
			uni.pageScrollTo({
				scrollTop: 0,
			})
		},

		onHide() {
			this.signOpenCookie = false
		},


		// #ifndef MP
		onNavigationBarButtonTap(e) {
			const index = e.index;
			if (index === 0) {
				this.navTo('/pages/set/set');
			} else if (index === 1) {
				// #ifdef APP-PLUS
				const pages = getCurrentPages();
				const page = pages[pages.length - 1];
				const currentWebview = page.$getAppWebview();
				currentWebview.hideTitleNViewButtonRedDot({
					index
				});
				// #endif
				uni.navigateTo({
					url: '/pages/notice/noticeCenter'
				})
			}
			this.showState = true
		},
		// #endif
		computed: {
			...mapState(['hasLogin', 'userInfo', 'userCenterData'])
		},
		onReachBottom() {
			this.$refs.recomment_goods.getMoreData();
		},
		//监听页面滚动，顶部上滑效果显示
		onPageScroll(res) {
			if (res.scrollTop > 191) {
				this.memberSliding = true;
			} else {
				this.memberSliding = false;
			}
		},
		methods: {
			...mapMutations(['login', 'setUserCenterData']),
			//获取个人中心数据
			initData() {
				if (this.userInfo.access_token) {
					this.$request({
						url: 'v3/member/front/member/getInfo',
					}).then(res => {
						if (res.state == 200) {
							this.setUserCenterData(res.data);
						} else {
							this.$api.msg(res.msg);
						}
					}).catch((e) => {})

					//获取订单订单未完成数量
					this.$request({
						url: 'v3/integral/front/integral/order/orderCount',
					}).then(res => {
						if (res.state == 200) {
							this.pointOrderNums = res.data;
						}
					}).catch((e) => {})

					this.$request({
						url: 'v3/video/front/video/author/personPage'
					}).then(res => {
						if (res.state == 200) {
							this.videoNum = res.data.videoNum
						}
					})
				}
			},
			// 获取设置信息
			getSetting() {
				let param = {};
				param.url = 'v3/video/front/video/setting/getSettingList';
				param.method = 'GET';
				param.data = {};
				param.data.str = 'video_switch';
				this.$request(param).then(res => {
					if (res.state == 200) {
						let result = res.data;
						result && result.map(settingItem => {
							if (settingItem.name == 'video_switch') { //绑定商品数
								this.setting.video_switch = settingItem.value;
							}
						})
					}
				})
			},

			getSysSetting() {
				let param = {
					url: 'v3/system/front/setting/getSettings',
					data: {
						names: 'basic_site_phone'
					}
				};
				this.$request(param).then(res => {
					if (res.state == 200) {
						this.adminTel = res.data[0]
					}
				})
			},

			makeCall() {
				uni.makePhoneCall({
					phoneNumber: this.adminTel
				})
			},

			sellerOpt() {
				this.sellerTip = `请复制地址到电脑端操作:\n${this.userCenterData.sellerUrl}`
				this.$refs.popup.open()
			},

			copyClipp() {
				this.$refs.popup.close()
				// #ifdef H5
				const result = h5Copy(this.userCenterData.sellerUrl)
				if (result === false) {
					this.$api.msg('不支持')
				} else {
					this.$api.msg('已复制到剪贴板')
				}
				// #endif
				
				// #ifdef APP-PLUS || MP-WEIXIN
				uni.setClipboardData({
				    data: this.userCenterData.sellerUrl,
				    success: function () {
				       this.$api.msg('已复制到剪贴板')
				    }
				});
				// #endif
				
			},


			gotoLogin() {
				uni.setStorageSync('fromurl', '/pages/user/user');
				this.showState = true
				uni.navigateTo({
					url: '/pages/public/login'
				});
				return;

				// #ifdef H5
				let isWexin = this.$isWeiXinBrower();
				if (isWexin) {
					let tar_url = location.href;
					tar_url += location.href.indexOf('?') > -1 ? '&' : '?';
					tar_url += 'ori_url=' + location.href;
					let uricode = encodeURIComponent(tar_url)
					window.location.href = 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=' + getApp()
						.globalData.h5AppId +
						'&redirect_uri=' + uricode +
						'&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect';
				} else {
					uni.navigateTo({
						url: '/pages/public/login'
					});
				}
				// #endif


			},

			getUser(e) {
				if (e.detail.errMsg == "getUserInfo:ok") {
					let userinfo = e.detail.userInfo;
					this.getWxXcxCoce(userinfo);
				}
			},

			getUserProfile(e) {
				// 推荐使用wx.getUserProfile获取用户信息，开发者每次通过该接口获取用户个人信息均需用户确认
				// 开发者妥善保管用户快速填写的头像昵称，避免重复弹窗
				uni.getUserProfile({
					desc: '用于完善个人信息', // 声明获取用户个人信息后的用途，后续会展示在弹窗中，请谨慎填写
					success: (res) => {
						if (res.errMsg == "getUserProfile:ok") {
							let userinfo = res.userInfo;
							this.getWxXcxCoce(userinfo);
						}
					}
				})
			},

			//微信小程序根据用户信息获取code
			getWxXcxCoce(userinfo) {
				uni.showLoading({
					title: '正在请求...',
					mask: true
				});
				uni.login({
					success: code => {
						this.toLogin(code.code, JSON.stringify(userinfo));
					}
				});
			},

			//登录 code为用户的code【微信小程序或者微信h5】  userInfo为获取到的微信用户信息
			toLogin(code, userInfo = '') {
				uni.setStorageSync('fromurl', '/pages/user/user');
				let {
					client,
				} = this;
				let _this = this;
				let param = {};
				param.url = 'v3/member/front/login/wechat/login';
				param.data = {};
				param.data.source = client;
				param.data.code = code;

				//如果有缓存的购物车数据，登录需要把数据同步，并清除本地缓存
				let local_cart_list = uni.getStorageSync('cart_list')
				let cartInfo = []
				if (local_cart_list) {
					local_cart_list.cartInfoList.map(item => {
						if (item.isChecked == 1) {
							cartInfo.push({
								goodsId: item.goodsId,
								productId: item.productId,
								buyNum: item.buyNum,
								productPrice: item.productPrice,
								checked: 1
							})
						}
					})
					param.data.cartInfo = JSON.stringify(cartInfo);
				}
				if (userInfo) {
					param.data.userInfo = userInfo;
				}
				param.method = 'POST';
				this.$request(param).then(res => {
					if (res.state == 200) {
						uni.removeStorage({
							key: 'cart_list'
						}); //清除购物车数据
						if (res.data.redirect == undefined) {
							uni.setStorage({
								key: 'userInfo',
								data: res.data,
								success() {
									//登录时间
									res.data.loginTime = Date.parse(new Date());
									_this.login(res.data);
									//登录成功 获取个人中心的数据
									_this.$request({
										url: 'v3/member/front/member/memberInfo',
									}).then(result => {
										_this.setUserCenterData(result.data);
										_this.$loginGoPage();
										_this.getSetting();
									}).catch((e) => {})
								}
							})
						} else if (res.data.redirect != undefined) {
							//用户未注册，需要绑定手机号进行注册
							this.showState = true
							uni.navigateTo({
								url: '/pages/public/bindMobile?code=' + res.data.bindKey
							})

						}
					} else {
						//错误提示
						_this.$api.msg(res.msg);
					}
					uni.hideLoading();
				}).catch((e) => {
					uni.hideLoading();
				})
			},

			/**
			 * 统一跳转接口,拦截未登录路由
			 * navigator标签现在默认没有转场动画，所以用view
			 */
			navTo(url) {
				this.showState = true
				if (url == '') {
					this.$sldCommonTip()
					return
				}
				if (!this.hasLogin) {
					if (url == '/pages/user/info') {
						uni.navigateTo({
							url: '/pages/public/login'
						})
					} else {
						uni.showToast({
							title: '请登录',
							icon: 'none',
							duration: 700
						})
					}
				} else {
					if (url == "/standard/signIn/signIn") {
						this.signOpenCookie = false
					}
					uni.navigateTo({
						url
					})
				}
			},

			/**
			 *  会员卡下拉和回弹
			 *  1.关闭bounce避免ios端下拉冲突
			 *  2.由于touchmove事件的缺陷（以前做小程序就遇到，比如20跳到40，h5反而好很多），下拉的时候会有掉帧的感觉
			 *    transition设置0.1秒延迟，让css来过渡这段空窗期
			 *  3.回弹效果可修改曲线值来调整效果，推荐一个好用的bezier生成工具 http://cubic-bezier.com/
			 */
			coverTouchstart(e) {
				if (pageAtTop === false) {
					return;
				}
				this.coverTransition = 'transform .1s linear';
				startY = e.touches[0].clientY;
			},
			coverTouchmove(e) {
				moveY = e.touches[0].clientY;
				let moveDistance = moveY - startY;
				if (moveDistance < 0) {
					this.moving = false;
					return;
				}
				this.moving = true;
				if (moveDistance >= 80 && moveDistance < 100) {
					moveDistance = 80;
				}

				if (moveDistance > 0 && moveDistance <= 80) {
					this.coverTransform = `translateY(${moveDistance}px)`;
				}
			},
			coverTouchend() {
				if (this.moving === false) {
					return;
				}
				this.moving = false;
				this.coverTransition = 'transform 0.3s cubic-bezier(.21,1.93,.53,.64)';
				this.coverTransform = 'translateY(0px)';
			},
			//去设置页面
			goSet() {

				if (!this.hasLogin) {
					uni.showToast({
						title: '请登录!',
						icon: 'none',
						duration: 700
					})
				} else {
					this.showState = true
					uni.navigateTo({
						url: '/pages/set/set'
					})
				}

			},
			//去消息页面
			goMsg() {
				if (!this.hasLogin) {
					uni.showToast({
						title: '请登录!',
						icon: 'none',
						duration: 700
					})
				} else {
					this.showState = true
					uni.navigateTo({
						url: '/pages/chat/list'
					})
				}
			},
			// 去我的积分页面
			toPointsPage() {
				if (!this.hasLogin) {
					uni.showToast({
						title: '请登录!',
						icon: 'none',
						duration: 700
					})
				} else {
					this.showState = true
					uni.navigateTo({
						url: '/pages/user/myIntegral'
					})
				}
			},
			//去我的优惠券页面
			goMyCoupon() {
				if (!this.hasLogin) {
					uni.showToast({
						title: '请登录!',
						icon: 'none',
						duration: 700
					})
				} else {
					this.showState = true
					uni.navigateTo({
						url: '/pages/coupon/myCoupon'
					})
				}
			},
			//去我的积分订单页面
			goMyPointOrder() {
				if (!this.hasLogin) {
					uni.showToast({
						title: '请登录！',
						icon: 'none',
						duration: 700
					})
				} else {
					this.showState = true
					uni.navigateTo({
						url: '/standard/point/order/list'
					})
				}
			},
			//去我的视频页面
			goMyVideo() {
				if (!this.hasLogin) {
					uni.showToast({
						title: '请登录！',
						icon: 'none',
						duration: 700
					})
				} else {
					this.showState = true
					uni.navigateTo({
						url: '/extra/svideo/myVideo'
					})
				}
			},

			/*
			 * 活动签到提醒
			 * 从签到信息接口获取是否提醒的字段(isRemind)
			 * isRemind为1，则开启提醒，设置cookie存入提醒字段，每天只显示一次
			 * 
			 */
			signOpenScreen() {
				this.$request({
					url: 'v3/promotion/front/sign/activity/detail'
				}).then(res => {
					console.log(new Date(new Date().toLocaleDateString()), 'kkkkk')
					if (res.state == 200) {
						this.signNotice = res.data.notice.imgUrl
						this.isSignOpen = true
						let isRemind = res.data.isRemind
						let signCookie = uni.getStorageSync('signCookie')
						this.isSign = res.data.isSign == 2 ? true : false
						if (isRemind == 1) {

							if (!signCookie) {
								this.signOpenCookie = true
								uni.setStorage({
									key: 'signCookie',
									data: new Date().getTime()
								})
							} else {
								if (new Date().getTime() > new Date(new Date().toLocaleDateString()).getTime() &&
									new Date().getTime() > signCookie) {
									this.signOpenCookie = false
								} else {
									this.signOpenCookie = true
									uni.setStorage({
										key: 'signCookie',
										data: new Date().getTime()
									})
								}
							}


						} else {
							this.signOpenCookie = false
							uni.removeStorage({
								key: 'signCookie'
							})
						}
					} else {
						this.isSignOpen = false
					}
				})
			}

		}
	}
</script>
<style lang='scss'>
	page {
		background: $bg-color-split;
		width: 750rpx;
		margin: 0 auto;
		position: relative;
	}

	.container {
		height: 100%;
		position: relative;
	}

	.picture_adv_poster_con image {
		width: 100%;
		height: 180rpx;
		display: block;
		cursor: pointer;
	}
	.picture_adv_poster_con{
		&:nth-child(2){
				margin-top: 20rpx;
				margin-bottom: 20rpx;
		}
				margin-top: 13rpx;
				margin-bottom: 16rpx;
	}
	.picture_adv_poster_con .video_poster {
		width: 100%;
		height: 100%;
	}

	%flex-center {
		display: flex;
		flex-direction: column;
		justify-content: center;
		align-items: center;
	}

	%section {
		display: flex;
		justify-content: space-around;
		align-content: center;
		background: #fff;
		border-radius: 10upx;
	}

	.check-in {
		position: absolute;
		/* #ifdef APP-PLUS */
		top: calc(var(--status-bar-height) + 160rpx);
		/* #endif */
		/* #ifndef APP-PLUS */
		top: 160rpx;
		/* #endif */
		right: 0;
		width: 140rpx;
		height: 48rpx;
		display: flex;
		align-items: center;
		justify-content: center;
		border-radius: 24rpx 0 0 24rpx;
		color: #fff;
		font-size: 24rpx;
		background: rgba(250, 250, 250, 0.2);
		z-index: 999;
	}

	.check-in image {
		width: 21rpx;
		height: 23rpx;
		margin-right: 5rpx;
	}

	/* 开屏 -- start */
	.open_screen {
		width: 750rpx;
		height: 100vh;
		position: absolute;
		top: 0;
		left: 0;
		background-color: rgba(0, 0, 0, 0.3);
		z-index: 99999;
	}

	.open_screen .open_screen_con {
		maring: 0 auto;
		position: absolute;
		top: 50%;
		left: 50%;
		transform: translate(-50%, -50%);
		border-radius: 15rpx;
		display: flex;
		align-items: center;
		flex-direction: column;
	}

	.open_screen .open_screen_con .open_screen_con_img {
		background-size: contain;
		border-radius: 15rpx;
	}

	.open_screen .open_screen_con .con_img {
		width: 58rpx;
		height: 58rpx;
		position: relative;
		top: 0;
		right: 0;
		z-index: 999;
		align-self: flex-end;
	}

	.open_screen_con .con_img image {
		width: 100%;
		height: 100%;
	}

	/* 开屏 -- end */




	/* 会员信息上滑 start */
	.member_info_sliding {
		width: 750rpx;
		height: 94rpx;
		background: linear-gradient(135deg, #FB3E31 0%, #FED600 0%, #FF4E00 0%, #FF001D 100%);
		display: flex;
		align-items: center;
		justify-content: space-between;
		padding: 0 30rpx 0 20rpx;
		box-sizing: border-box;
		position: fixed;
		top: 0;
		/* #ifdef APP-PLUS */
		top: var(--status-bar-height);
		/* #endif */
		left: 0;
		right: 0;
		margin: 0 auto;
		z-index: 10;

		.member_info_sliding_left {
			width: 78rpx;
			height: 78rpx;
			border: 4rpx solid rgba(255, 255, 255, .5);
			border-radius: 50%;

			image {
				width: 100%;
				height: 100%;
				border-radius: 50%;
				border: 4rpx solid #FFFFFF;
			}
		}

		.member_info_sliding_center {
			font-size: 36rpx;
			font-family: PingFang SC;
			font-weight: 500;
			color: #FFFFFF;
			line-height: 32rpx;
		}

		.member_info_sliding_right {
			display: flex;
			align-items: center;

			.user_sets {
				width: 42rpx;
				height: 42rpx;
				margin-right: 30rpx;

				image {
					width: 40rpx;
					height: 40rpx;
				}
			}

			.user_msg {
				position: relative;
				display: flex;
				align-items: center;

				.user_msg_img {
					width: 40rpx;
					height: 40rpx;
				}

				text {
					position: absolute;
					top: -10rpx;
					right: -10rpx;
					width: 30rpx;
					height: 30rpx;
					background: #FFFFFF;
					border-radius: 50%;
					font-size: 20rpx;
					font-family: PingFang SC;
					font-weight: 500;
					color: #FF152C;
					line-height: 30rpx;
					text-align: center;
				}
			}
		}
	}

	/* 会员信息上滑 end */

	.user-section {
		/* height: calc(418rpx + env(safe-area-inset-top));
		height: calc(418rpx + constant(safe-area-inset-top)); */
		height: 418rpx;
		position: relative;
		padding: 40rpx 30rpx 0;
		/* #ifdef APP-PLUS */
		padding: 90rpx 30rpx 0;
		padding-top: calc(30rpx + var(--status-bar-height));
		/* #endif */
		.bg {
			position: absolute;
			left: 0;
			top: 0;
			width: 100%;
			height: 382rpx;
			/* #ifdef APP-PLUS */
			height: calc(382rpx + var(--status-bar-height));
			/* #endif */
		}
	}

	.user_set {
		display: flex;
		justify-content: flex-end;

		.user_set_img {
			width: 50rpx;
			height: 50rpx;
			margin-right: 31rpx;
		}

		.user_msg {
			position: relative;

			.user_msg_img {
				width: 50rpx;
				height: 50rpx;
			}

			text {
				width: 30rpx;
				height: 30rpx;
				background: #FFFFFF;
				border-radius: 50%;
				font-size: 20rpx;
				font-family: PingFang SC;
				font-weight: 500;
				color: #FF152C;
				line-height: 30rpx;
				text-align: center;
				position: absolute;
				top: -8rpx;
				right: -10rpx;
			}
		}
	}



	.user-info-box {
		height: 134rpx;
		display: flex;
		align-items: center;
		position: relative;
		z-index: 1;
		/* #ifdef H5 */
		margin-top: 25rpx;

		/* #endif */
		.portrait-box {
			width: 128rpx;
			height: 128rpx;
			border-radius: 50%;
			border: 8rpx solid rgba(255, 255, 255, .5);
			box-sizing: border-box;
			overflow: hidden;
			display: flex;
			align-items: center;
			justify-content: center;

			.portrait-bgc {
				width: 124rpx;
				height: 124rpx;
				box-sizing: border-box;
				border-radius: 50%;
				overflow: hidden;
				background-color: #ffffff;
				display: flex;
				align-items: center;
				justify-content: center;

				.portrait {
					width: 100rpx;
					height: 100rpx;
					border-radius: 50%;
				}
			}

		}

		.mem-info {
			display: flex;
			flex-direction: column;
			justify-content: center;
			align-items: flex-start;
			margin-left: 20rpx;

			.nick-name {
				color: #fff;
				font-size: 40rpx;
				line-height: 44rpx;
				font-weight: bold;
				width: 520rpx;
				overflow: hidden;
				text-overflow: ellipsis;
				display: -webkit-box;
				-webkit-line-clamp: 1; //文字上限行
				-webkit-box-orient: vertical;

			}

			.member-name {
				color: #fff;
				font-size: 20rpx;
				border-radius: 13rpx;
				margin-top: 13rpx;
				height: 28rpx;
				display: flex;
				justify-content: center;
				align-items: center;
			}

			.login_btn {
				background: transparent;
				line-height: 44rpx;
				height: 44rpx;
				padding-left: 0;

				&::after {
					border: none;
				}

				text-align: left;
			}

		}

	}

	/* 我的记录 start */
	.mine_record {
		width: 710rpx;
		background: #FFFFFF;
		border-radius: 10rpx;
		display: flex;
		justify-content: space-around;
		padding: 35rpx 20rpx 41rpx;
		box-sizing: border-box;
		margin: -127rpx auto 20rpx;
		/* #ifdef APP-PLUS */
		margin-top: calc(-127rpx + env(safe-area-inset-top));
		/* #endif */
		position: relative;

		.mine_record_pre {
			display: flex;
			flex-direction: column;
			align-items: center;

			image {
				width: 45rpx;
				height: 45rpx;
				margin-bottom: 30rpx;
			}

			text {
				font-size: 26rpx;
				font-family: PingFang SC;
				font-weight: 500;
				color: #666666;
				line-height: 26rpx;
			}
		}
	}

	/* 我的记录 end */

	.main-content {
		width: 750rpx;
		padding: 0 $com-v-border;
		position: relative;

		.order-part {
			width: 100%;
			height: 277rpx;
			background: #fff;
			box-shadow: 0px 0px 20px 0px rgba(153, 153, 153, 0.15);
			border-radius: 15rpx;

			.title {
				width: 100%;
				height: 90rpx;
				border-bottom: 1px solid #F8F8F8;
				padding-right: 30rpx;
				box-sizing: border-box;

				.left {
					flex-shrink: 0;
					padding-left: 29rpx;
					color: #2D2D2D;
					font-size: 34rpx;
					line-height: 36rpx;
					font-weight: bold;
				}

				.right {
					text {
						flex-shrink: 0;
						color: #666;
						font-size: 28rpx;
						font-weight: 400;
						margin-right: 20rpx;
					}

					image {
						width: 11rpx;
						height: 19rpx;
					}
				}
			}

			.detail {
				flex: 1;
				width: 100%;

				.item {
					position: relative;

					.show-text {
						color: #333333;
						font-size: 28rpx;
						line-height: 28rpx;
						margin-top: 20rpx;
					}

					.nums {
						position: absolute;
						top: -5rpx;
						right: -5rpx;
						background: #FFFFFF;
						border: 1rpx solid #FF0000;
						border-radius: 11rpx;
						padding: 0rpx 5rpx;
						box-sizing: border-box;
						font-size: 20rpx;
						font-family: PingFang SC;
						font-weight: 500;
						color: #FF1D2E;
						text-align: center;
						height: 25rpx;
						line-height: 25rpx;
						display: flex;
						align-items: center;
						justify-content: center;
					}

					.num {
						position: absolute;
						top: -5rpx;
						right: -5rpx;
						width: 25rpx;
						height: 25rpx;
						background: #FFFFFF;
						border: 1rpx solid #FF0000;
						border-radius: 50%;
						font-size: 20rpx;
						font-family: PingFang SC;
						font-weight: 500;
						color: #FF1D2E;
						line-height: 25rpx;
						text-align: center;
						display: flex;
						align-items: center;
						justify-content: center;
					}

					image {
						width: 67rpx;
						height: 58rpx;
					}
				}
			}
		}

		/* 常用服务 start */
		.common_services {
			width: 710rpx;
			min-height: 485rpx;
			background: #FFFFFF;
			border-radius: 15rpx;
			margin: 20rpx auto 0;

			.common_services_title {
				width: 100%;
				height: 92rpx;
				border-bottom: 1rpx solid #F8F8F8;
				font-size: 34rpx;
				font-family: PingFang SC;
				font-weight: bold;
				color: #2D2D2D;
				line-height: 92rpx;
				padding-left: 30rpx;
			}

			.common_services_list {
				display: flex;
				flex-direction: column;

				.common_services_pre {
					height: 130rpx;
					display: flex;
					justify-content: space-between;
					align-items: center;
					margin: 0 30rpx;
					border-bottom: 1rpx solid #F8F8F8;

					&:nth-last-child(1) {
						border-bottom: none;
					}

					

					.common_serv_pre_left {
						display: flex;
						align-items: center;

						image {
							width: 51rpx;
							height: 51rpx;
						}

						text {
							font-size: 28rpx;
							font-family: PingFang SC;
							font-weight: 500;
							color: #2D2D2D;
							line-height: 39rpx;
							margin-left: 25rpx;
						}
					}

					.common_serv_pre_right {
						display: flex;
						align-items: center;

						text {
							font-size: 28rpx;
							font-family: PingFang SC;
							font-weight: bold;
							color: #333333;
							line-height: 39rpx;
							margin-right: 20rpx;
						}

						image {
							width: 11rpx;
							height: 19rpx;
						}
					}
				}
			}
		}

		/* 常用服务 end */

		.recommend-title {
			display: flex;
			justify-content: center;

			image {
				width: 387rpx;
				height: 34rpx;
				margin: 30rpx 0;
			}
		}

		.recommend-goods {
			flex-wrap: wrap;
		}
	}

	.fixed_top_status_bar {
		position: fixed;
		/* #ifdef APP-PLUS */
		height: var(--status-bar-height);
		/* #endif */
		/* #ifndef APP-PLUS */
		height: 0;
		/* #endif */
		top: 0;
		left: 0;
		right: 0;
		z-index: 99;
		background: #fff;
	}
</style>
