<template>
	<view class="posir">
		<!-- 背景图 -->
		<image class="zIn1 posiall mybei" :style="{width:newWidth+'px',height:newHeight+'px'}"
			src="/static/img/my/myb.png" mode="scaleToFill"></image>
		<view :style="{height:(statusBarHeight+50)+'px'}"></view>
		<!-- 内容框 -->
		<view class="posia zIn2 width100 padding-x120">
			<view class="disba padding20" style="margin: 0 20rpx 20rpx 20rpx;">
				<view class="disac width100">
					<!-- 头像 -->
					<image class="flexs myhead" :src="headImg" mode="aspectFill"></image>
					<view class="margin-z20 width100">
						<view class="colorb fon36 bold disba ">
							<!-- 姓名 -->
							<view class="clips1" style="max-width: 320rpx;">{{name}}</view>
							<!-- 消息 -->
							<!-- <view class="posir" @tap="checkMess">
								<image class="myxiaoimg" src="/static/img/my/xiaoximg.png" mode="aspectFill"></image>
								<view class="posia colorb disbcac fon24 myxiaoc">{{message}}</view>
							</view> -->
						</view>
						<!-- 电话 -->
						<view v-if="phone!=''" class="fon24 disbcac padding-zy10 margin-s20 myphone">{{phone}}</view>
					</view>
				</view>
			</view>
			<view v-if="user_type!='personal'" class="disaa padding-zy20" style="margin-top: -10rpx;">
				<!-- 我的收藏 -->
				<view class="discc" @tap="ziliao(0)">
					<view class="colorb fon36 bold">{{allCollection}}</view>
					<view class="fon24 colorb">我的收藏</view>
				</view>
				<!-- 个人资料 -->
				<view class="discc" @tap="ziliao(1)">
					<image style="width: 31rpx;height: 35rpx;" src="/static/img/my/deit.png" mode=""></image>
					<view class="fon24 colorb margin-s10">个人资料</view>
				</view>
				<!-- 个人邀请码 -->
				<view class="discc" @tap="ziliao(2)">
					<image style="width: 37rpx;height: 37rpx;" src="/static/img/my/ecode.png" mode=""></image>
					<view class="fon24 colorb margin-s10">个人邀请码</view>
				</view>
			</view>
			<!--  -->
			<view class="margin20">
				<!-- 收益 -->
				<view v-if="user_type!='personal'" class="disaa colorb padding-sx20 "
					style="background-color: #293140;border-top-left-radius: 10rpx;border-top-right-radius: 10rpx;">
					<view @tap="goShouy(indexs)" class="discc flexs" v-for="(item,indexs) in shouArr" :key="indexs"
						style="width: 25%;">
						<!-- <view class="disac">
							<view class="fon24">{{item.title}}</view>
						</view>
						<view class="fon32 bold margin-s10">{{item.sprice}}</view> -->
						<view v-if="item.price!=''" class="fon24 disba">
							{{item.title}}
							<!-- <image @tap.stop="zhuan(indexs)" v-if="item.title=='分红收益' || item.title=='可提现'" class="margin-z10" style="width: 19rpx;height: 19rpx;" src="../../../static/img/my/tis.png" mode=""></image> -->
						</view>
						<view v-if="item.price!=''" class="fon32 bold margin-s10 clips1">{{item.price}}</view>
						<view v-else class="fon28 colorb padding-sx10 padding-zy20 textc"
							style="width: 130rpx;height: 45rpx;line-height: 45rpx; background-color: #1b60d6;border-radius: 50rpx;margin-right: 16rpx;">
							{{item.title}}</view>
					</view>
				</view>
				<!-- 提现类 -->
				<view v-if="user_type!='personal'" class="disaa padding-sx20 bacb"
					style="border-bottom-left-radius: 10rpx;border-bottom-right-radius: 10rpx;">
					<view @tap="clickt(indext)" class="discc flexs" v-for="(item,indext) in tiArr" :key="indext"
						style="width: 25%;">
						<view v-if="item.price!=''" class="fon24">{{item.title}}</view>
						<view v-if="item.price!=''" :class="indext==2?'colorb':''" class="fon32 bold margin-s10 clips1">
							{{item.price}}</view>
						<view v-else class="fon28 colorb padding-sx10 padding-zy20 textc"
							style="width: 130rpx;height: 45rpx;line-height: 45rpx; background-color: #1b60d6;border-radius: 50rpx;margin-right: 16rpx;">
							{{item.title}}</view>
					</view>
				</view>
			</view>
			<!-- 我的订单 -->
			<view v-if="user_type!='personal'" class="margin20 bacb radius10">
				<view class="disba padding20 margin-zy10">
					<view class="fon32 bold">我的订单</view>
					<view class="disac" @tap="checkAll">
						<view class="fon26 color9 margin-y10">查看全部订单</view>
						<image style="width: 12rpx;height: 22rpx;" src="../../../static/img/my/youj.png" mode="">
						</image>
					</view>
				</view>
				<view class="borbot"></view>
				<view class="disaa padding-sx20">
					<view @tap="goOrder(index)" class="discc" v-for="(item,index) in cateOder" :key="index">
						<image style="width: 38rpx;height: 38rpx;margin-top: 10rpx;" :src="item.src"></image>
						<view class="margin-s10 margin-x10 color33 fon24">{{item.title}}</view>
					</view>
				</view>
			</view>
			<!-- 常用工具 -->
			<view class="margin20 bacb radius10">
				<view class="disba padding20 margin-zy10">
					<view class="fon32 bold">常用工具</view>
				</view>
				<view class="borbot"></view>
				<view class="disac padding-sx20 flw ">
					<view class="discc posir" @tap="goUtils(index)" v-for="(item,index) in useArr" :key="index"
						style="width: 25%;">
						<image class="margin-s20 mygong" :src="item.src"></image>
						<view class="margin-s10 margin-x10 color33 fon24">{{item.title}}</view>
						<button v-if="index==2" class="posia" style="opacity: 0;" open-type="contact" bindcontact="huik">客服</button>
					</view>
				</view>
			</view>
		</view>
		<!-- 个人邀请码弹框 -->
		<view v-if="isMa" @touchmove.stop.prevent="" class="disbcac"
			style="position: fixed;top: 0;left: 0;right: 0;bottom: 0;z-index: 100;background-color: rgba(0,0,0,.8);">
			<view class="padding20 tan-box">
				<view class="disbcac" style="margin-top: -60rpx;">
					<image src="/static/img/my/yaof.png" style="width: 96rpx;height: 96rpx;" mode="aspectFill"></image>
				</view>
				<view class="">
					<!-- <image class="margin20" style="width: 559rpx;height: 369rpx;" src="/static/img/my/yaoimg.png" mode="aspectFit"></image> -->
					<image :src="share_img" class="radius20 margin20" style="width: 559rpx;height: 369rpx;"></image>
					<view class="fon32 margin-zy20 padding-zy10 textc ">{{share_title}}</view>
				</view>
				<view class="borbot margin-sx26"></view>
				<view class="discc padding-x40">
					<!-- 二维码 -->
					<!-- <view class="disbcac">
						<canvas @longpress="longpress" class='qrcode-canvas' @click="previewImage" canvas-id='qrcode'></canvas>
					</view> -->
					<image @longpress="longpress" @tap="previewImage" style="width: 165rpx;height: 165rpx;" :src="logoImg" mode="aspectFit"></image>
					<view class="fon24 color9" style="transform: scale(0.9);">长按或扫描查看</view>
				</view>
				<view class="posir disbcac">
					<image @tap="closema" class="posia" style="width: 70rpx;height: 70rpx;top: 60rpx;"
						src="/static/img/my/maclose.png" mode=""></image>
				</view>
			</view>
			<!-- 功能弹框 -->
			<view v-if="showScan" class="discc animated bounceInUp fon28"
				style="position: fixed;bottom: 20rpx;left: 20rpx;right: 20rpx;background-color: #FFFFFF;padding: 20rpx 0;border-radius: 6rpx;z-index: 110;">
				<view @tap="scan" class="colorf78 padding-x20 borbot width100 textc">扫一扫</view>
				<view @tap="dosave" class="color33 padding-s20">保存到相册</view>
			</view>
		</view>
		<!-- 分红收益转化弹框 -->
		<view v-if="isInput" class="posiall disbcac" style="background-color: rgba(0,0,0,.5);z-index: 1002;">
			<view :class="isClose ? '':'bounceOut'" class="animated bounceIn" style="background-color: #FFFFFF;width: 70%;padding: 20rpx;border-radius: 10rpx;">
				<view style="font-size: 28rpx;">当前可转分红收益：{{xtitle}}</view>
				<view v-if="indexd==3" v-for="(itemd,indexd) in drawRule" :key="indexd" class="disac borbot padding-sx20">
					<view class="fon28">{{itemd.title}}：</view>
					<view class="fon24 color9">{{itemd.desc}}</view>
				</view>
				<input :focus="isfocus" type="number" v-model="inputVal" style="border: 1rpx solid #dddddd;border-radius: 10rpx;padding: 10rpx 20rpx;" />
				<view style="margin-top: 20rpx;display: flex;justify-content: space-between;align-items: center;font-size: 28rpx;">
					<view @tap="closeT" class="color9 width100" style="text-align: center;">取消</view>
					<view @tap="submit" class="colorf78 width100"style="text-align: center;">确认</view>
				</view>
			</view>
		</view>
		<!-- 提现规则 -->
		<view v-if="isGui" @tap="isGui=false" class="posiall disbcac" style="background-color: rgba(0,0,0,.5);z-index: 1002;">
			<view class="" style="background-color: #FFFFFF;width: 70%;padding: 20rpx;border-radius: 10rpx;">
				<view v-if="indexd!=3" v-for="(itemd,indexd) in drawRule" :key="indexd" class="disac borbot padding-sx20">
					<view class="fon28">{{itemd.title}}：</view>
					<view class="fon24 color9">{{itemd.desc}}</view>
				</view>
			</view>
		</view>
		<foot-tab :current="3"></foot-tab>
	</view>
</template>

<script>
	let QRCode = require('../../../jsFile/qrcode.js').default;
	export default {
		data() {
			return {
				statusBarHeight: uni.getSystemInfoSync().statusBarHeight,
				navigationBarHeight: uni.getSystemInfoSync().navigationBarHeight,
				newWidth: uni.getSystemInfoSync().windowWidth,
				newHeight: uni.getSystemInfoSync().windowHeight,
				headImg: '/static/img/my/myhead.png',
				name: '',
				phone: '',
				message: '99',
				shouArr: [
					{title: '分红收益',price: '0.00'},
					{title: '可提现',price: '0.00'},
					{title: '提现中',price: '0.00'},
					{title: '立即提现',price: ''},
				],
				tiArr: [
					{title: '直卖收益',price: '0.00'},
					{title: '提现中',price: '0.00'},
					{title: '',price: '0.00'},
					{title: '立即提现',price: ''},
				],
				cateOder: [
					{src: '/static/img/my/fah.png',title: '待发货'},
					{src: '/static/img/my/daif.png',title: '待收货'},
					{src: '/static/img/my/pingj.png',title: '待评价'},
					{src: '/static/img/my/shouh.png',title: '售后'},
				],
				useArr: [
					// {src: '/static/img/my/pingt.png',title: '平台说明'},
					// {src: '/static/img/my/hez.png',title: '商务合作'},
					// {src: '/static/img/my/kef.png',title: '在线客服'},
					// {src: '/static/img/my/diz.png',title: '地址管理'},
					// {src: '/static/img/my/wenj.png',title: '分红规则'},
				],
				isMa: false,
				qRcode: '/static/img/my/ma.png',
				showScan: false,
				allCollection: '0', //收藏总数
				share_img: '',
				share_title: '',
				QR: '',
				qrtext: '',
				canvasId: 'qrcode',
				logoImg: '',
				colorData: '#000000',
				invite_code:'',
				inputVal:'',
				isInput:false,
				isClose:true,
				isfocus:false,
				xtitle:'',
				drawRule:[],
				isGui:false,
				user_type:uni.getStorageSync('user_type')//权限
			}
		},
		onLoad() {
			let res = uni.getSystemInfoSync();
			var that = this;
			that.canvasWidth = res.windowWidth * 350 / 750;
			that.canvasHeight = res.windowWidth * 350 / 750;
			let qrcode = new QRCode(this.canvasId, {
			    width: 110,
			    height: 110,
			});
			this.QR = qrcode;
		},
		onShow() {
			if(uni.getStorageSync('is_active')==0) {
				this.$toolAll.tools.showToast('您目前是游客，请授权登录')
				setTimeout(()=>{
					uni.navigateTo({url:'/pages/login/login'})
				},1500)
			} else {
				this.isGui = false
				this.isInput = false
				this.inputVal = ''
				uni.login({
					provider: 'weixin',
					success: (res)=> {
						if (res.code) {
							var params = {code:res.code}
							this.$requst.post('user/wxAppletsLogin',params).then(res=>{
								if(res.code==0){
									if(res.data.token!=''){
										this.user_type = res.data.user_type//权限
										if(this.user_type=='personal'){
											this.useArr = [
												{src: '/static/img/public/shoucactive.png',title: '收藏'},
												{src: '/static/img/my/hez.png',title: '商务合作'},
											]
										} else {
											this.useArr = [
												{src: '/static/img/my/pingt.png',title: '平台说明'},
												{src: '/static/img/my/hez.png',title: '商务合作'},
												{src: '/static/img/my/kef.png',title: '在线客服'},
												{src: '/static/img/my/diz.png',title: '地址管理'},
												{src: '/static/img/my/wenj.png',title: '分红规则'},
											]
										}
										uni.setStorageSync('token',res.data.token)//缓存token
										uni.setStorageSync('openid',res.data.openid)//缓存Openid
										uni.setStorageSync('expire',res.data.expire)//缓存失效时间（时间戳格式）
										uni.setStorageSync('is_active',res.data.is_active)//是否第一次授权
										uni.setStorageSync('user_type',res.data.user_type)//权限
									}
								} else {
									this.$toolAll.tools.showToast(res.msg)
								}
							},error=>{})
						}
					},
				});
				// 查询收藏数量
				this.checkCollection()
				this.userInfo()//调用获取用户信息事件
			}
		},
		methods: {
			zhuan(index){//调起转换分红收益弹框
				if(index==0){
					this.isInput = true
					this.isfocus = true
					this.xtitle = this.shouArr[0].price
				} else {
					this.isGui = true
				}
				this.checkTG()
			},
			closeT(){//关闭分红收益转化弹框
				this.tankClose()
			},
			submit(){//分红收益转化确认事件
				if(uni.getStorageSync('sm').name=='' || uni.getStorageSync('sm').phone){
					this.$toolAll.tools.showToast('请前往个人资料完善信息')
				} else if(this.inputVal==0){
					this.tankClose()
				} else if(0<this.inputVal<1){
					this.$toolAll.tools.showToast('最小转换金额不得低于1元')
				} else if(this.inputVal>this.xtitle) {
					this.$toolAll.tools.showToast('转换金额不得大于可转金额')
				} else {
					this.$requst.post('user/bonus-to-balance',{amount:this.inputVal*100}).then(res=>{
						if(res.code==0){
							this.$toolAll.tools.showToast('转换成功，可在可提现查看')
							this.shouArr[1].price = this.inputVal
							this.tankClose()
						}
					},error=>{})
				}
			},
			tankClose(){
				let ya = this
				ya.isfocus = false
				ya.isClose = false
				setTimeout(function(){
					ya.isInput = false
					ya.isClose = true
					ya.xtitle = ''
					ya.inputVal = ''
				},1000)
			},
			// 查询提现规则
			checkTG(){
				this.$requst.post('user/withdraw-rule').then(res=>{
					// console.log(res);
					if(res.code==0){
						this.drawRule = res.data
					}
				},error=>{})
			},
			// 个人邀请码的logo图事件
			logoEv(){
				// this.$requst.post('user/qrcode').then(res=>{
				// 	if(res.code==0){
				// 		this.logoImg = res.data.qrcode
				// 	}
				// },error=>{})
				this.$requst.post('user/qrcode-original').then(res=>{
					if(res.code==0){
						this.logoImg = res.data.qrcode
					}
				},error=>{})
			},
			createQRCode: function() {
			    var that = this;
				that.doCreateQRCode();
			},
			doCreateQRCode: function() {
			    uni.showToast({
			        title: '邀请码生成中...',
					icon:'loading'
			    });
				
			    this.QR.clear();
			    this.QR._opts.colorDark = this.colorData;
			    this.QR._opts.logo =  this.logoImg;
			    this.QR._opts.successTips = true;
			    this.QR.makeCode(this.qrtext);
			    this.createQRCodeDone = true;
			},
			savePic: function() {
			    let that = this;
				uni.saveImageToPhotosAlbum({
				    filePath: that.logoImg,
				    success(res) {
				        uni.showToast({
				            title: '已保存相册',
				            icon: 'success',
				            duration: 1000
				        });
				    },
				    fail(res) {
				        uni.showToast({
				            title: '无相册权限',
				            icon: 'none',
				            duration: 2000
				        });
				    }
				});
			    // let res = uni.getSystemInfoSync();
			    // uni.canvasToTempFilePath({
			    //     x: 0,
			    //     y: 0,
			    //     width: 110,
			    //     height: 110,
			    //     destWidth: 110,
			    //     destHeight: 110,
			    //     canvasId: this.canvasId,
			    //     success(res) {
			    //         uni.saveImageToPhotosAlbum({
			    //             filePath: res.tempFilePath,
			    //             success(res) {
			    //                 uni.showToast({
			    //                     title: '已保存相册',
			    //                     icon: 'success',
			    //                     duration: 1000
			    //                 });
			    //             },
			    //             fail(res) {
			    //                 uni.showToast({
			    //                     title: '无相册权限',
			    //                     icon: 'none',
			    //                     duration: 2000
			    //                 });
			    //             }
			    //         });
			    //     }
			    // });
			},
			previewImage(e) {
				uni.previewImage({
				    urls: [this.logoImg],
				})
			    // if (this.createQRCodeDone) {
			    //     uni.canvasToTempFilePath({
			    //         x: 0,
			    //         y: 0,
			    //         width: this.canvasWidth,
			    //         height: this.canvasHeight,
			    //         destWidth: 472,
			    //         destHeight: 472,
			    //         canvasId: this.canvasId,
			    //         success(res) {
			    //             console.log(res.tempFilePath);
			    //             uni.previewImage({
			    //                 urls: [res.tempFilePath],
			    //             })
			    //         }
			    //     });
			    // }
			},
			checkCollection() {
				this.$requst.post('user/collection', {
					page: 1,
					size: 200
				}).then(res => {
					// console.log('获取收藏总数：',res);
					if (res.code == 0) {
						this.allCollection = res.data.length
					}
				}, error => {})
			},
			userInfo() { //查询用户信息
				this.$requst.post('user/info').then(res => {
					// console.log('信息=====>', res);
					if (res.code == 0) {
						let info = res.data
						this.name = info.nickname
						this.headImg = info.headimgurl
						uni.setStorageSync('sm',{name:info.username,phone:info.mobile})
						this.share_img = this.$http + info.share_img
						this.share_title = info.share_title
						this.qrtext = info.invite_url
						// this.qrtext = '/pages/login/login?invite_code='+info.invite_code
						this.invite_code = info.invite_code
						// this.logoImg = info.headimgurl
						// console.log(this.logoImg,this.qrtext);
						info.bonus == 0 ? this.shouArr[0].price = '0.00' : this.shouArr[0].price = (info.bonus/100).toFixed(2) //分红收益
						info.bonus_balance == 0 ? this.shouArr[1].price = '0.00' : this.shouArr[1].price = (info.bonus_balance / 100).toFixed(2) //分红可提现
						info.withdraw_bonus == 0 ? this.shouArr[2].price = '0.00' : this.shouArr[2].price = (info.withdraw_bonus / 100).toFixed(2) //分红提现中
						info.commission_balance == 0 ? this.tiArr[0].price = '0.00' : this.tiArr[0].price = (info.commission_balance / 100).toFixed(2) //直卖收益
						info.withdraw_sale == 0 ? this.tiArr[1].price = '0.00' : this.tiArr[1].price = (info.withdraw_sale / 100).toFixed(2) //直卖提现中
						if (info.mobile != '') {
							// 隐藏手机号中间四位
							this.phone = `${info.mobile.substr(0, 3)}****${info.mobile.substr(7)}`
						}
						uni.setStorageSync('userInfoObj', info)
						this.logoEv()
					}
				}, error => {})
			},
			longpress() {
				let _this = this;
				this.showScan = true
				// 判断平台
				// if (plus.os.name == 'Android') {
				//     plus.runtime.launchApplication({
				//             pname: 'com.tencent.mm'
				//         },
				//         function(e) {
				//             console.log('Open system default browser failed: ' + e.message);
				//         }
				//     );
				// } else if (plus.os.name == 'iOS') {
				//     plus.runtime.launchApplication({
				//         action: 'weixin://'
				//     }, function(e) {
				//         console.log('Open system default browser failed: ' + e.message);
				//     });
				// }
			},
			scan() {
				wx.scanCode({  // 微信扫码 调起客户端扫码界面进行扫码
					complete: (res) => {}, //接口调用结束的回调函数（调用成功、失败都会执行）
					fail: (res) => {}, //接口调用失败的回调函数
					onlyFromCamera: false, //是否只能从相机扫码，不允许从相册选择图片,这里是只允许相机扫码
					scanType: ['qrCode'], // scanType：扫码类型 : 二维码
					success: (result) => { // 接口调用成功的回调函数
						// console.log(result);
						wx.navigateTo({ //navigateTo:页面跳转 保留当前页面（页面隐藏，并未销毁，节省性能），跳转到应用内的某个页面。但是不能跳到 tabbar 页面  ，小程序使用页面跳转方法的时候 不能添加文件扩展名，否则会没有反应
							url: '/pages/login/login?invite_code='+this.invite_code,
						})
						wx.setStorage({ // 设置微信本地存储数据
							data: result,
							key: 'key',
							complete: (res) => {},
							fail: (res) => {},
							success: (res) => {},
						})
					}
				})
				// plus.barcode.scan(this.qRcode, (type, res) => {
				// 	if (type == 0) {
				// 		plus.runtime.openURL(res)
				// 	}
				// }, (e) => {
				// 	if (e.code == 3) {
				// 		tools.showToast('未识别到二维码')
				// 	} else {
				// 		tools.showToast('无法识别此图片')
				// 	}
				// })
			},
			async requestAndroidPermission(permisionID) {
				var result = await permision.requestAndroidPermission(permisionID)
				var strStatus
				if (result == 1) {
					strStatus = '已获得授权'
					this.savePic()
				} else if (result == 0) {
					strStatus = '未获得授权'
				} else {
					uni.showToast({
						title: '保存失败，请打开权限功能重试',
						icon: 'none'
					});
				}
			},
			dosave() {
				// this.savePic()
				var aa = wx.getFileSystemManager();
				aa.writeFile({
					filePath:wx.env.USER_DATA_PATH+'/test.png',
					data: this.logoImg.slice(22),
					encoding:'base64',
					success: res => {
						wx.saveImageToPhotosAlbum({
							filePath: wx.env.USER_DATA_PATH + '/test.png',
							success: function (res) {
								wx.showToast({
									title: '保存成功',
								})
							},
							fail: function (err) {
								// console.log(err)
							}
						})
						// console.log(res)
					}, fail: err => {
						// console.log(err)
					}
				})
				// wx.downloadFile({
				//       url: this.logoImg,//图片地址
				//       success: function (res) {
				// 		  console.log(res);
				//         //图片保存到本地
				//         wx.saveImageToPhotosAlbum({
				//           filePath: res.tempFilePath,
				//           success: function (data) {
				//             wx.hideLoading()
				//             wx.showModal({
				//               title: '提示',
				//               content: '您的二维码已保存到相册，赶快识别二维码添加小易进行咨询吧',
				//               showCancel: false,
				//             })
				//           },
				//           fail: function (err) {
				//             if (err.errMsg === "saveImageToPhotosAlbum:fail:auth denied" || err.errMsg === "saveImageToPhotosAlbum:fail auth deny" || err.errMsg === "saveImageToPhotosAlbum:fail authorize no response") {
				//               // 这边微信做过调整，必须要在按钮中触发，因此需要在弹框回调中进行调用
				//               wx.showModal({
				//                 title: '提示',
				//                 content: '需要您授权保存相册',
				//                 showCancel: false,
				//                 success: modalSuccess => {
				//                   wx.openSetting({
				//                     success(settingdata) {
				//                       console.log("settingdata", settingdata)
				//                       if (settingdata.authSetting['scope.writePhotosAlbum']) {
				//                         wx.showModal({
				//                           title: '提示',
				//                           content: '获取权限成功,再次点击图片即可保存',
				//                           showCancel: false,
				//                         })
				//                       } else {
				//                         wx.showModal({
				//                           title: '提示',
				//                           content: '获取权限失败，将无法保存到相册哦~',
				//                           showCancel: false,
				//                         })
				//                       }
				//                     },
				//                     fail(failData) {
				//                       console.log("failData", failData)
				//                     },
				//                     complete(finishData) {
				//                       console.log("finishData", finishData)
				//                     }
				//                   })
				//                 }
				//               })
				//             }
				//           },
				//           complete(res) {
				//             wx.hideLoading()
				//           }
				//         })
				//       }
				//     })
			},
			checkMess() {
				// console.log('查看消息');
				uni.navigateTo({
					url: '/pagesB/notices/notices?index=1'
				})
			},
			ziliao(index) {
				// console.log(index);
				switch (index) {
					case 0: //我的收藏
						uni.navigateTo({
							url: '/pagesB/myCollection/myCollection?index=1'
						})
						break;
					case 1: //个人资料
						uni.navigateTo({
							url: '/pagesB/personalInfo/personalInfo'
						})
						break;
					case 2: //个人邀请码
						this.isMa = true
						uni.hideTabBar()
						let ya = this
						// setTimeout(function(){
						// 	ya.createQRCode()
						// },1000)
						break;
				}
			},
			goShouy(index) {
				// console.log(index);
				switch (index) {
					case 0: //分红收益
						uni.navigateTo({
							url: '/pagesB/zIncome/zIncome?index=1'
						}) //index=1表示查询分红收益记录
						break;
					case 2: //提现中
						uni.navigateTo({
							url: '/pagesB/record/record?index=1'
						}) //index=1表示查询分红提现记录
						break;
					case 3: //分红收益的立即提现
						let price = this.shouArr[1].price
						this.$toolAll.tools.showToast('由于腾讯规定限制，本业务需3月后进行开放。具体时间请查看平台公告信息！','',3000)
						// uni.navigateTo({
						// 	url: '/pagesB/immediateWithdrawal/immediateWithdrawal?index=1&price=' + price +
						// 		'&type=bonus'
						// })
						break;
				}
			},
			clickt(index) {
				switch (index) {
					case 0: //直卖收益
						uni.navigateTo({
							url: '/pagesB/zIncome/zIncome?index=0'
						}) //index=0表示查询直卖收益记录
						break;
					case 1: //提现中
						uni.navigateTo({
							url: '/pagesB/record/record?index=0'
						}) //index=0表示查询直卖提现记录
						break;
					case 3: //直卖收益的立即提现
						let price = this.tiArr[0].price
						this.$toolAll.tools.showToast('由于腾讯规定限制，本业务需3月后进行开放。具体时间请查看平台公告信息！','',3000)
						// uni.navigateTo({
						// 	url: '/pagesB/immediateWithdrawal/immediateWithdrawal?index=1&price=' + price +
						// 		'&type=sale'
						// })
						break;
				}
			},
			checkAll() {
				// console.log('全部订单');
				uni.navigateTo({
					url: '/pagesA/myOrder/myOrder?index=0&num=0'
				})
			},
			goOrder(index) {
				// console.log('我的订单' + index);
				switch (index) {
					case 0:
						uni.navigateTo({
							url: '/pagesA/myOrder/myOrder?index=1&num=1'
						})
						break;
					case 1:
						uni.navigateTo({
							url: '/pagesA/myOrder/myOrder?index=1&num=2'
						})
						break;
					case 2:
						uni.navigateTo({
							url: '/pagesA/daiEvaluated/daiEvaluated'
						})
						break;
					case 3:
						uni.navigateTo({
							url: '/pagesA/afterSales/afterSales?index=1'
						})
						break;
				}
			},
			goUtils(index) {
				// console.log('常用工具：' + index);
				if(this.user_type=='personal'){
					if(index==0) uni.navigateTo({url:'/pagesB/myCollection/myCollection'})
					if(index==1) uni.navigateTo({url:'/pagesB/businessCooperation/businessCooperation'})
				} else {
					switch (index) {
						case 0:
							uni.navigateTo({
								url: '/pagesB/platformDescription/platformDescription'
							})
							break;
						case 1:
							uni.navigateTo({
								url: '/pagesB/businessCooperation/businessCooperation'
							})
							break;
						case 3:
							uni.navigateTo({
								url: '/pagesB/adManagement/adManagement?wherenum=1'
							})
							break;
						case 4:
							uni.navigateTo({
								url: '/pagesB/dividendRules/dividendRules'
							})
							break;
						default:
							break;
					}
				}
			},
			closema() {
				this.isMa = this.showScan = false
				uni.showTabBar()
			},
		}
	}
</script>

<style>
.qrcode-canvas {
	margin: 0rpx ;
	height: 110px;
	width: 110px;
}
</style>
