<template>
	<view>
		<view :class="'mine' + (skinNotColor ? ' not-color' : '')">
			<image :src="'/static/pages/images/' + iconSrc + (skinNotColor ? 'wdbg1.png' : 'wdbg.png')" class="wdbg"
				@click="jumpUrl('mine/userinfo/userinfo')"></image>
			<view class="minec">
				<image :src="userInfos.avatar ? userInfos.avatar : '/static/pages/images/userimg.png'" mode="aspectFit"
					class="user" @click="jumpUrl('mine/userinfo/userinfo')"></image>
				<view class="mines" @click="jumpUrl('mine/userinfo/userinfo')" v-if="isLogin">
					<view class="ddflex">{{userInfos.nickName}}
						<image :src="config.ordinary_member_icon" class="common-vip"
							v-if="config.ordinary_member_icon&&!userinfovip.levelGrade"></image>
					</view>
					<text class="edu" v-if="userInfos.mobile">{{userInfos.mobile}}</text>
				</view>
				<view class="flex" v-else>
					<text class="login-btn" @click="jumpUrl('')">点击登录</text>
				</view>
				<!-- <navigator url="/mine/userinfo/userinfo" hover-class="none" class="set"> -->
				<!-- <view class="set">
					<image src="/static/pages/images/set.png" @click="signFun"></image>
				</view> -->
				<view class="rule dflex" @click="jumpUrl('integralshop/task/index')" v-if="isShowSign"><!-- isSign==0||sign==1?jumpUrl(''):signFun() -->
					<image src="/static/pages/images/qdico.png"></image>
					{{!isLogin ? '签到' : isSign==0||sign==1?'已签到':'签到'}}
				</view>
				<!-- </navigator> -->
			</view>
			<view class="datas dflex">
				<navigator url="" hover-class="none" class="li" v-if="is_open_wallet.isOpenWallet==1"
					@click="jumpUrl('wallet/index/index')"><text>{{userMoney?userMoney:'0.00'}}</text>钱包
				</navigator>
				<navigator url="" hover-class="none" class="li"
					:style="is_open_wallet.isOpenWallet!=1&&Open_Points_Mall!=1?'width:50%':''"
					@click="jumpUrl('mine/coupons/coupons')">
					<text>{{userInfos.coupon?userInfos.coupon:'0'}}</text>优惠券
				</navigator>
				<navigator url="" hover-class="none" class="li" @click="jumpUrl('integralshop/index/index')">
					<text>{{userInfos.integral?userInfos.integral:'0'}}</text>积分
				</navigator>
				<navigator url="" hover-class="none" class="li"
					:style="is_open_wallet.isOpenWallet!=1&&Open_Points_Mall!=1?'width:50%':''"
					@click="jumpUrl('mine/collect/collect')">
					<text>{{userInfos.collect?userInfos.collect:'0'}}</text>收藏
				</navigator>
				<!-- <navigator url="/mine/footprint/footprint" hover-class="none" class="li"><text>{{footprint?footprint:'0'}}</text>足迹</navigator> -->
			</view>
			<block v-if="isLogin">
				<view class="upgrade ddflex" v-if="config.is_show_member_upgrade == 1 && userinfovip.levelGrade < vipList.length"><!-- config.ordinary_member_icon -->
					<view :class="'li' + (!userinfovip.levelGrade ? ' active':'')">
						<view>普通会员</view>
					</view>
					<view class="li" :class="{active:userinfovip.level == item.id,cur:item.isShowInfo}" v-for="(item,index) in vipList" :key="index"
						@click="showInfo(index)">
						<view class="vip-info" v-if="item.isShowInfo&&item.upgradeTerm.terms.length>0">
							<text
								v-if="item.upgradeTerm.terms[0].bind == 'order_money'">累计消费金额达到{{item.upgradeTerm.terms[0].value}}元即可升级</text>
							<text
								v-if="item.upgradeTerm.terms[0].bind == 'order_num'">累计购买订单达到{{item.upgradeTerm.terms[0].value}}笔即可升级</text>
							<text
								v-if="item.upgradeTerm.terms[0].bind == 'share_new'">分享拉新人数累计达到{{item.upgradeTerm.terms[0].value}}人即可升级</text>
						</view>
						<view class="vip-tit">{{item.title}}</view>
					</view>
				</view>
				<view class="vip" v-if="vipList&&vipList.length>=1&&rongkang!='ZQ1VK5oc17I387E'"
					@click="jumpUrl('mine/vip/vip')">
					<image :src="picUrlss+'vip_bg.png'" class="vipbg"></image>
					<view class="vipc dflex">
						<view class="dflex flex" v-if="userinfovip.levelGrade>0&& !userinfovip.end">
							<!-- <image :src="userinfovip.icon"></image> -->
							<image src="/static/pages/images/hg_ico1.png" class="vipimg"></image>
							<view class="huiyuan">{{userinfovip.levelName}}</view>
							<!-- <text class="level" >{{userinfovip.levelGrade}}</text> -->
						</view>
						<view class="dflex flex" v-else>
							<image src="/static/pages/images/hg_ico1.png" class="vipimg"></image>
							<text class="huiyuan">会员立享专属权益</text>
						</view>
						<view class="cheng" v-if="userinfovip.levelGrade>0&& !userinfovip.end">
							{{userinfovip.expireTime}} 到期
						</view>
						<view class="ling" v-else>立即开通</view>
					</view>
				</view>
			</block>
			<view class="vip" v-else @click="jumpUrl('mine/vip/vip')">
				<image :src="picUrlss+'vip_bg.png'" class="vipbg"></image>
				<view class="vipc dflex">
					<view class="dflex flex">
						<image src="/static/pages/images/hg_ico1.png" class="vipimg"></image>
						<text class="huiyuan">会员立享专属权益</text>
					</view>
					<view class="ling">立即开通</view>
				</view>
			</view>
		</view>

		<view class="con">
			<view class="order">
				<navigator url="" hover-class="none" class="tits dflex" @click="jumpUrl('mine/order/order')">
					<view class="flex">我的订单</view>查看全部<image src="/static/pages/images/rico.png" class="rico"></image>
				</navigator>
				<view class="list1">
					<navigator url="" hover-class="none" class="li" @click="jumpUrl('mine/order/order')">
						<image :src="picUrlss+'ddico0.png'"></image>
						<view>全部订单</view>
					</navigator>
					<navigator url="" hover-class="none" class="li" @click="jumpUrl('mine/order/order?state=1')">
						<image :src="picUrlss+'ddico1.png'"></image>
						<text class="new" v-if="userInfos.dfk > 0">{{userInfos.dfk}}</text>
						<view>待付款</view>
					</navigator>
					<navigator url="" hover-class="none" class="li" @click="jumpUrl('mine/order/order?state=3')">
						<image :src="picUrlss+'ddico2.png'"></image>
						<text class="new" v-if="userInfos.yqr > 0">{{userInfos.yqr}}</text>
						<view>待发货</view>
					</navigator>
					<navigator url="" hover-class="none" class="li" @click="jumpUrl('mine/order/order?state=5')">
						<image :src="picUrlss+'ddico3.png'"></image>
						<text class="new" v-if="userInfos.yfh > 0">{{userInfos.yfh}}</text>
						<view>待收货</view>
					</navigator>
					<navigator url="" hover-class="none" class="li" @click="jumpUrl('mine/order/order?state=7')">
						<image :src="picUrlss+'ddico4.png'"></image>
						<text class="new" v-if="userInfos.ywc > 0">{{userInfos.ywc}}</text>
						<view>已完成</view>
					</navigator>
					<!-- <navigator url="/mine/order/order?state=21" hover-class="none" class="li">
				<image src="/pages/images/ddico0_1.png"></image>
				<text class="new" wx:if="{{ywc > 0}}">{{ywc}}</text>
				<view>退款售后</view>
			</navigator> -->
				</view>
			</view>
		</view>
		<!-- 店铺 -->
		<view class="order shopname"
			v-if="(userInfos.listMerchant&&userInfos.listMerchant!=null&&userInfos.listMerchant.length>0)||(is_open_shop == 1&&userInfos.listShopBase&&userInfos.listShopBase!=null&&userInfos.listShopBase.length>0)||userInfos.merchantId!=null">

			<image src="/static/pages/images/md_ic_bg.png" class="md_ic_bg"></image>
			<navigator url="" hover-class="none" class="tits dflex" @click="jumpMerchantManage()">
				<view class="dflex flex">
					<image src="/static/pages/images/position_b_icon.png" class="bico"></image>
					<block v-if="!userInfos.listShopBase||!userInfos.listMerchant">
						门店管理
					</block>
					<block v-else>
						<block v-if="userInfos.listMerchant.length>0&&userInfos.listShopBase.length<1">
							{{userInfos.listMerchant[0].title?userInfos.listMerchant[0].title:'门店管理'}}</block>
						<block v-else-if="userInfos.listShopBase.length>0">
							{{userInfos.listShopBase[0].title?userInfos.listShopBase[0].title:'门店管理'}}</block>
						<!-- {{!listShopBase?listMerchant[0].title:listShopBase.length==0?listMerchant[0].title:listShopBase[0].title}} -->
					</block>

				</view>
				查看更多<image src="/static/pages/images/rico.png" class="rico"></image>
			</navigator>
			<view class="datasw dflex">
				<navigator url="" hover-class="none" class="li" @click="jumpMerchantManage()">
					全部订单<text>{{statistics.total}}</text>
				</navigator>
				<navigator url="" hover-class="none" class="li" @click="jumpMerchantManage()">
					待发货<text>{{statistics.t3}}</text>
				</navigator>
				<navigator url="" hover-class="none" class="li" @click="jumpMerchantManage()">
					待提货<text>{{statistics.t4}}</text>
				</navigator>
			</view>
		</view>
		<view class="order" v-if="distr.distributionIsOpen==1&&userInfos.isDistriUser == 2">
			<navigator url hover-class="none" class="tits dflex">
				<view class="flex">全民推广</view>
				<!-- 查看更多<image src="/pages/images/rico.png" class="rico"></image> -->
			</navigator>
			<view class="list3 dflex">
				<navigator url="" hover-class="none" class="li" @click="jumpUrl('promote/team/team')">
					<image :src="picUrlss+'fxico1.png'"></image>
					<view>推广中心</view>
				</navigator>
				<navigator url="" hover-class="none" class="li"
					@click="jumpUrl('promote/teamList/teamList?IS_secondary_members=' + IS_secondary_members)">
					<image :src="picUrlss+'fxico2.png'"></image>
					<view>我的客户</view>
				</navigator>
				<navigator url="" hover-class="none" class="li" @click="jumpUrl('promote/sales/sales')">
					<image :src="picUrlss+'fxico3.png'"></image>
					<view>业绩订单</view>
				</navigator>
				<navigator url="" hover-class="none" class="li" @click="jumpUrl('promote/invite/invite')">
					<image :src="picUrlss+'fxico4.png'"></image>
					<view>我要推广</view>
				</navigator>
			</view>
		</view>
		<block v-if="isLogin">
			<block v-if="distr.distributionIsOpen==1&&config.is_hide_distribution_entry != 1">
				<navigator url="" hover-class="none" class="order tuig" v-if="userInfos.isDistriUser==1"
					@click="jumpUrl('promote/status/status')">
					<view class="tits dflex">
						<view class="flex">全民推广</view>
					</view>
					<image :src="picUrlss+'fenxiao.png'" class="fenxiao"></image>
				</navigator>
				<navigator url="" hover-class="none" class="order tuig"
					v-if="userInfos.isDistriUser!=2 && userInfos.isDistriUser!=1" @click="jumpUrl('promote/info/info')">
					<view class="tits dflex">
						<view class="flex">全民推广</view>
					</view>
					<image :src="picUrlss+'fenxiao.png'" class="fenxiao"></image>
				</navigator>
			</block>
		</block>
		<navigator url="" hover-class="none" class="order tuig" @click="jumpUrl('promote/apply/apply')"
			v-if="!isLogin&&config.is_hide_distribution_entry != 1">
			<view class="tits dflex">
				<view class="flex">全民推广</view>
			</view>
			<image :src="picUrlss+'fenxiao.png'" class="fenxiao"></image>
		</navigator>
		<view class="order">
			<view class="tits dflex">
				<view class="flex">我的服务</view>
			</view>
			<view class="list2 dflex">
				<!-- <navigator url="/mine/order/order?orderType=5" hover-class="none" class="li">
      <image src="/pages/images/ddico5_1.png"></image>
      <text>及时达订单</text>
    </navigator> -->
				<!-- <navigator url="/pages/supplier/supplier" hover-class="none" class="li">
					<image :src="picUrlss+'supplier.png'"></image>
					<text>我是供应商</text>
				</navigator> -->
				<!-- <navigator url="" hover-class="none" class="li" @click="jumpUrl('mine/order/order?orderType=2')">
					<image :src="picUrlss+'ddico5_2.png'"></image>
					<text>社区团购</text>
				</navigator> -->
				<navigator url="" hover-class="none" class="li" @click="jumpUrl('mine/order/order?orderType=4')">
					<image :src="picUrlss+'ddico4_1.png'"></image>
					<text>拼团订单</text>
				</navigator>
				<navigator url="" hover-class="none" class="li" @click="jumpUrl('mine/order/order?orderType=7')">
					<image :src="picUrlss+'ddico7_1.png'"></image>
					<text>砍价订单</text>
				</navigator>
				<navigator url="" hover-class="none" class="li" v-if="Open_Points_Mall==1"
					@click="jumpUrl('integralshop/index/index')">
					<image :src="picUrlss+'ddico8_1.png'"></image>
					<text>积分商城</text>
				</navigator>
				<!-- <navigator url="" hover-class="none" class="li" @click="jumpUrl('mine/remind/remind')">
					<image :src="picUrlss+'ddico7.png'"></image>
					<text>开团提醒</text>
				</navigator> -->
				<navigator url="" hover-class="none" class="li" @click="jumpUrl('product/coupon/coupon')">
					<image :src="picUrlss+'ddico5_3.png'"></image>
					<text>领券中心</text>
				</navigator>
				<navigator url="" hover-class="none" class="li" @click="jumpUrl('topics/release/release')">
					<image :src="picUrlss+'ddico7.png'"></image>
					<text>我的发布</text>
				</navigator>
				<navigator url="" hover-class="none" class="li" @click="jumpUrl('office/follow/index')">
					<image :src="picUrlss+'ddico5_2.png'"></image>
					<text>我的关注</text>
				</navigator>
				<navigator url="" hover-class="none" class="li" @click="jumpUrl('mine/news/news')">
					<image :src="picUrlss+'ddico5_1.png'"></image>
					<text>我的消息</text>
					<view class="new" v-if="newsCount > 0">{{newsCount}}</view>
				</navigator>
				<!-- <navigator url="/pages/nearby/nearby" hover-class="none" class="li">
      <image src="/pages/images/ddico5.png"></image>
      <text>附近门店</text>
    </navigator> -->
				<navigator url="" hover-class="none" class="li" @click="jumpUrl('mine/address/address')">
					<image :src="picUrlss+'ddico6.png'"></image>
					<text>收货地址</text>
				</navigator>
				<navigator url="" hover-class="none" class="li" @click="jumpUrl('mine/invoice/invoice')"
					v-if="config.is_open_invoice == 1">
					<image :src="picUrlss+'ddico11_4.png'"></image>
					<text>我的发票</text>
				</navigator>
				<view class="li" v-if="!isLogin" @click="jumpUrl('')">
					<image :src="picUrlss+'ddico11_1.png'"></image>
					<text>绑定手机号</text>
				</view>
				<button class="li" v-if="!userInfos.mobile && isLogin" open-type="getPhoneNumber"
					@getphonenumber="getphonenumber" hover-class="none">
					<image :src="picUrlss+'ddico11_1.png'"></image>
					<text>绑定手机号</text>
				</button>
				<view class="li">
					<contact-button :img-url="picUrlss+'ddico9.png'" img-style='width: 74rpx;height: 74rpx;margin: 0 auto 12rpx;' button-text="联系客服" styles="line-height:initial;"></contact-button>
				</view>
				<!-- <button open-type="contact" class="li" hover-class="none">
					<image :src="picUrlss+'ddico9.png'"></image>
					<text>联系客服</text>
				</button> -->
				<view class="li" @tap="callPhone" v-if="phone">
					<image :src="picUrlss+'ddico11_2.png'"></image>
					<text>服务热线</text>
				</view>
				<navigator url="/mine/help/help" hover-class="none" class="li">
					<image :src="picUrlss+'ddico8.png'"></image>
					<text>帮助中心</text>
				</navigator>
				<navigator url="/pages/about/about" hover-class="none" class="li">
					<image :src="picUrlss+'ddico11_3.png'"></image>
					<text>关于我们</text>
				</navigator>

				<navigator url="/mine/feedback/feedback" hover-class="none" class="li">
					<image :src="picUrlss+'ddico10.png'"></image>
					<text>建议反馈</text>
				</navigator>
				<!-- <navigator url="/pages/web/web" hover-class="none" class="li" wx:if="{{merchantId}}">
			<image src="/pages/images/ddico11.png"></image>
			<text>门店管理</text>
		</navigator> -->

			</view>
		</view>
		<!-- 注册成为会员 -->
		<view class="mask" :hidden="isHide" @tap="hideRegister"></view>
		<view class="regi" :hidden="isHide">
			<view class="regi-tit">注册会员<image src="/static/pages/images/close1.png" class="regi-close"
					@tap="hideRegister"></image>
			</view>
			<view class="phone dflex">
				<input placeholder="手机号" placeholder-class="placeholder" class="flex"></input>
				<button open-type="getPhoneNumber" @getphonenumber="getphonenumber" class="getphone dflex">
					<image src="/static/pages/images/wxico.png"></image>一键获取
				</button>
			</view>
			<view class="regi-btn">立即注册</view>
		</view>
		<footer-copyright></footer-copyright>
		<!-- <view class="placeholder-view" :style="'height:' + (bottomBlankHeignt + 115) + 'rpx'"></view> -->
		<foot channel="user" :isUpdate="isUpdate"></foot>
		<update-userinfo :update-info="isUpdateInfo" :update-mobile="isUpdateMobile" v-if="isShowUpdate" @closeUpdate="closeUpdate" @updateInfo="updateInfo" @updateMobile="updateMobile"></update-userinfo>
		<!-- <web-view src="https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx86937a61b8d50977&redirect_uri=https%3a%2f%2fwebtest.tongyu99.com&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"></web-view> -->
	</view>
</template>

<script>
	// pages/user/user.js
	const app = getApp();
	const req = require("../../utils/request.js");
	const route = require("../../utils/route");
	import foot from "../../components/nav-bar/index";
	import footerCopyright from "../../components/footer-copyright/footer-copyright";

	export default {
		data() {
			return {
				skinNotColor: req.public.skinNotColor,
				picUrlss: req.public.picUrls,
				bottomBlankHeignt: app.globalData.isIPhoneX ? 68 : 0,
				// merchantId: '',
				iconSrc: req.public.iconSrc,
				//头部页面背景链接
				isUpdate: false,
				// 是否更新消息
				isHideVip: true,
				//隐藏会员
				isVip: true,
				//是否是会员
				isHide: true,
				//是否隐藏注册会员弹窗
				IS_secondary_members: 0,
				distr: "",
				userinfovip: "",
				userMoney: "",
				istetphone: "",
				logo: "",
				name: "",
				is_open_wallet: "",
				Open_Points_Mall: "",
				statistics: "",
				vipList: "",
				rongkang: req.header.appId,
				isSign: '',
				sign: 0,
				isLogin: false,
				noLogin: false,
				is_open_shop: '',
				isShowSign: false, //是否显示签到按钮
				config: {},
				userInfos: {},
				newsCount: 0,
				isShowUpdate: false,//是否显示更新信息弹窗
				isUpdateInfo: false,//更新用户信息
				isUpdateMobile: false,//绑定手机号
			};
		},

		components: {
			foot,
			footerCopyright
		},
		props: {},

		onLoad(options) {
			app.globalData.getCheckSessoin(json => {
				this.sessionKey = json.session_key;
			});
			uni.setNavigationBarColor({
				frontColor: this.skinNotColor ? '#000' : '#ffffff',
				backgroundColor: this.skinNotColor ? '#fff' : req.public.titleTopBgColor
			});

			if (JSON.parse(req.getStorage('configRes')).IS_secondary_members) {
				let IS_secondary_members = JSON.parse(req.getStorage('configRes')).IS_secondary_members;
				console.log(IS_secondary_members)
				this.setData({
					IS_secondary_members: IS_secondary_members
				});
			}
			let userInfo = req.getStorage('userInfo');
			if(req.isAuth()){
				setTimeout(res=>{
					if(!userInfo.avatar || userInfo.nickName == '微信用户' || this.userInfos.nickName == '微信用户'){
						this.isShowUpdate = true
						this.isUpdateInfo = true
					}
					if(userInfo.avatar&&!userInfo.mobile&&(this.userInfos&&!this.userInfos.mobile)){
						this.isShowUpdate = true
						this.isUpdateMobile = true
					}
				},2000)
			}
		},

		onShow: function() {
			this.setData({
				isUpdate: !this.isUpdate
			}); // let merchantId = req.getStorage('userInfo').merchantId
			// this.setData({
			//   merchantId: merchantId,
			// })

			// console.log(this.merchantId);
			// this.getMy();
			// this.getAbout();
			// console.log(this.noLogin, 111111111111)
			let userInfo = req.getStorage('userInfo');
			// if (userInfo) this.isLogin = true;
			this.isLogin = req.isAuth();
			if (this.isLogin) {
				this.getMy();
				this.getNewsCount();
				this.getAbout();
				this.getRule();
				this.noLogin = true;
			} else {
				this.noLogin = false;
			}
		},
		methods: {
			jumpUrl(url) {
				if (!req.isLogin()) return false;
				app.globalData.navigateTo(url);
			},

			jumpMerchantManage() {
				// jumpUrl('pages/web/web')
				let token = req.getStorage('AUTH_TOKEN');
				this.jumpUrl('merchant/index?appId=' + req.header.appId + '&token=' + token);
			},
			// 是否签到{}
			isSignFun() {
				req.getRequest('/api/integral/isSign', {}, res => {
					this.setData({
						isSign: res
					});
				});
			},

			gouserInfo() {
				app.globalData.navigateTo('mine/userinfo/userinfo')
			},
			getDistributionConfig() {
				req.postRequest('/api/distribution/config', {}, res => {
					this.setData({
						distr: res
					});
				});
			},
			// 签到
			signFun() {
				req.postRequest('/api/integral/sign', {}, data => {
					if (data) {
						req.msg('连续签到' + data.continuityDay + '天' + ',获得' + data.IntegralChange + '积分');
						this.setData({
							sign: 1
						});
						this.getOpenPonints();
					}
				});
			},
			getuserVip() {
				req.getRequest('/api/user/levelDetails', {}, data => {
					let expireTime = Array;

					if (data.expireTime) {
						expireTime = data.expireTime.split(" ");
						data.expireTime = data.expireTime.replace(/-/g, '/');
					} // 解决苹果不兼容---日期
					// data.expireTime=data.expireTime.replace(/-/g, '/')


					let nowTime = new Date().getTime();
					let endTime = new Date(data.expireTime).getTime();
					let times = parseInt((endTime - nowTime) / 1000); // var expireTime= new Date(data.expireTime)
					// var time1=expireTime.getTime();

					// console.log(times, nowTime, endTime, data.expireTime);
					this.setData({
						userinfovip: data,
						['userinfovip.expireTime']: expireTime[0]
					});

					if (times <= 0) {
						this.setData({
							['userinfovip.end']: true
						});
					} else {
						this.setData({
							['userinfovip.end']: false
						});
					}

					// console.log(data);
				});
			},
			getOpenPonints() {
				req.getRequest('/api/integral/returnIntegral', {}, res => {
					this.setData({
						integral: res
					})
				})
			},
			getMy() {
				let that = this;
				req.getRequest('/api/user/my', {}, data => {
					// data.merchantId = req.getStorage('userInfo').merchantId
					data.nickName = req.excludeSpecial(data.nickName);
					this.userInfos = data;
					let userInfo = req.getStorage('userInfo');
					userInfo.isDistriUser = suc.isDistriUser;
					req.setStorage('userInfo', userInfo);
					// that.setData(data); // this.isbindmobile();
					console.log('userinfo==' + JSON.stringify(data))
					this.isSignFun();
					this.getstatistics(data);
					this.getDistributionConfig();
					this.getuserVip();
					this.getuserMoney();
					this.getVip();
					this.getOpenPonints();
					// console.log(this);
				});
			},

			getuserMoney() {
				let is_open_wallet = JSON.parse(req.getStorage('configRes')).is_open_wallet;

				if (is_open_wallet) {
					if (JSON.parse(is_open_wallet).isOpenWallet == 1) {
						route.extendNew({}, res => {
							// console.log(parseFloat(res.all).toFixed(2));
							if (res) this.setData({
								userMoney: parseFloat(res.all).toFixed(2)
							});
						});
					}
				}
			},
			getNewsCount(){
				req.getRequest('/api/v3/fabulous/countComment',{},res=>{
					this.newsCount = res;
				})
			},

			getAbout() {
				var _this = this;

				req.getRequest('/api/config', {}, function(res) {
					_this.phone = res.CONFIG_SERVICE_HOT_MOBILE;
					_this.config = res;
					_this.setData({
						istetphone: res.user_bind_mobile,
						logo: res.CONFIG_PROJECT_LOGO,
						name: res.CONFIG_PROJECT_TITLE
					});

					// console.log(res);
					if (res && res.is_open_wallet) {
						_this.setData({
							is_open_wallet: JSON.parse(res.is_open_wallet)
						});
					}

					if (res.is_open_shop) {
						_this.is_open_shop = res.is_open_shop;
					}

					// if (res.user_bind_mobile == '1') {
					// 	let userInfo = req.getStorage('userInfo');

					// 	if (userInfo && (userInfo.mobile == null || userInfo.mobile == '')) {
					// 		app.globalData.openPage('pages/authorize/authorize?bindmobile=1');
					// 	}
					// }
				});
				// 是否开启积分商城
				req.getRequest('/api/params/value', {
					type: 'Open_Points_Mall'
				}, res => {
					this.setData({
						Open_Points_Mall: res
					});
				});
			},

			getphonenumber(event) {
				const detail = event.detail;

				const _ts = this;

				if (!detail || !detail.encryptedData || !detail.iv) return false;
				req.postRequest('/api/weixin/mobile', {
					encryptedData: detail.encryptedData,
					iv: detail.iv,
					sessionKey: this.sessionKey
				}, res => {
					_ts.getMy();
				});
			},

			callPhone() {
				if (!req.isLogin()) return false;
				uni.makePhoneCall({
					phoneNumber: this.phone
				});
			},

			showRegister() {
				//显示注册会员弹窗
				this.setData({
					isHide: false
				});
			},

			hideRegister() {
				//隐藏注册会员弹窗
				this.setData({
					isHide: true
				});
			},

			goUrl() {
				app.globalData.openPage('mine/vip/vip');
			},

			// 门店统计
			getstatistics(data) {
				let from = {};

				if (data.listShopBase && data.listShopBase != null && data.listShopBase.length > 0) {
					from.shopId = data.listShopBase[0].id;
				}

				if (data.listMerchant && data.listMerchant != null && data.listMerchant.length > 0 && data.listShopBase
					.length < 1) {
					from.merchantId = data.listMerchant[0].id;
				}

				req.getRequest('/api/order/statistics', from, data => {
					this.setData({
						statistics: data
					});
					console.log(data);
				});
			},
			getRule() {
				let that = this;
				req.getRequest('/api/integral/config', {}, res => {
					if (res && res.length > 0) {
						res.map(it => {
							if (it.illustrate && it.illustrate.indexOf('签到') > -1) {
								if (it.state == 2) {
									that.isShowSign = true;
								}
							}
						})
					}
				})
			},
			getVipListOrg() {
				if (this.vipList && this.userinfovip) {
					if(!this.userinfovip.levelGrade){
						this.vipList.map((it,index)=>{
							this.vipList[0].isShowInfo = true;
						})
					}else{
						this.vipList.map((it,index)=>{
							if(this.userinfovip.level == it.id){
								if(index < this.vipList.length-1){
									this.vipList[index+1].isShowInfo = true;
								}
							}
						})
					}
				}
			},
			getVip() {
				req.getRequest('/api/levelStrategy/userLevelList', {}, data => {
					if (data && data.length > 0) {
						data.map((it,index) => {
							it.upgradeTerm = JSON.parse(it.upgradeTerm)
							it.isShowInfo = false
							// if(index == 0) it.isShowInfo = true;
							return it;
						})
						this.vipList = data
						this.getVipListOrg();
					}
				});
			},
			showInfo(index) {
				if(!this.vipList[index].isShowInfo){
					this.vipList.map(it=>{
						it.isShowInfo = false;
						return it
					})
				}
				this.vipList[index].isShowInfo = !this.vipList[index].isShowInfo
			},
			closeUpdate(){
				this.isShowUpdate = false
			},
			updateInfo(e){
				this.isUpdateInfo = e
				this.getMy()
			},
			updateMobile(e){
				this.isUpdateMobile = e
				this.getMy()
			},
			// 判断强制绑定手机号
			// isbindmobile() {
			//   if (req.getStorage('configRes')) {
			//     let configRes = JSON.parse(req.getStorage('configRes'))
			//     this.setData({ istetphone: configRes.user_bind_mobile, logo: configRes.CONFIG_PROJECT_LOGO, name: configRes.CONFIG_PROJECT_TITLE })
			//   } else {
			//     req.g('/api/config', (res) => {
			//       req.setStorage('configRes', JSON.stringify(res))
			//       this.setData({ istetphone: res.user_bind_mobile, logo: res.CONFIG_PROJECT_LOGO, name: res.CONFIG_PROJECT_TITLE })
			//     })
			//   }
			//   if(this.data.istetphone=='1'){
			//       // 获取用户手机号
			//     let userInfo= req.getStorage('userInfo')
			//     if(userInfo.mobile==null||userInfo.mobile==''){
			//       console.log("获取用户手机号===============================")
			//       app.openPage('pages/authorize/authorize?bindmobile=1')
			//     }
			//   }
			// },


		}
	};
</script>
<style>
	@import "./user.css";
</style>
