1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826
<template>
	<view class="page">
		<view style="overflow-y: scroll;">
			<view class="header">
						<view class="userinfo">
							<view class="avator" @click.stop="personziliao">
								<image :src="avatar==''?'../../static/headtou.png':avatar"  />
								<!-- <image src="../../static/userpic.png" mode="widthFix" /> -->
							</view>
							<view class="infoBox">
								<view class="identity">
									<view v-if="token==''">
										<view class="name" v-if="nickname==''" @click="registerlogin">登录/注册</view>
										<view class="name" v-else>{{nickname}}</view>
									</view>
									<view v-else>
										<view class="name" v-if="nickname==''" >暂无昵称</view>
										<view class="name" v-else>{{nickname}}</view>
									</view>
									<!-- /v-if="userinfo.is_bind_wx==0" -->
									<view class="vip flexone" v-if="userinfo.is_card==1||userinfo.is_vip==1||userinfo.is_company_vip==1">
										<image src="../../static/huiyuan.png" mode="widthFix" v-if="userinfo.is_card==1"/>
										<view class="vipname" v-if="userinfo.is_vip==1">{{userinfo.level.name1}}</view>
										<view class="vipname" v-if="userinfo.is_company_vip==1">{{userinfo.level.name2}}</view>
									</view>
									<!-- <view v-if="openclose==1">
									     <view class='weixinlogin' @click="weixinlogin" v-if="userinfo.is_bind_wx==0||userinfo==''">微信登录</view>
									 </view> -->
								</view>
								<!-- -->
								<!-- v-if="userinfo.is_card==2" -->
								<view v-if="openclose==1">
									<view class="userType"   @click="cardrenzheng" v-if="userinfo.is_card==2||userinfo==''">实名认证></view>
									<view class="userActive" v-else>
										<image src="../../static/activek.png" mode="widthFix" />
										已认证
									</view>
								</view>
								
							</view>
							
							<view class="setup"  @click.stop="set">
								<image src="../../static/setup.png" />
							</view>
						</view>
						<view class="orderBox">
							<view class="orderItem"  @click.stop="fahuo" :data-id="1">
								<image src="../../static/order_a.png" class="orderimg"></image>
								<view>待付款</view>
								<view class="fukuanyuan" v-if="ordertotal.wait_pay!=0&&ordertotal!=''">{{ordertotal.wait_pay}}</view>
							</view>
							<view class="orderItem"  @click.stop="fahuo" :data-id="2">
								<image src="../../static/order_b.png" ></image>
								<view>待发货</view>
								<view class="fukuanyuan" v-if="ordertotal.send!=0&&ordertotal!=''">{{ordertotal.send}}</view>
							</view>
							<view class="orderItem"  @click.stop="fahuo" :data-id="3">
								<image src="../../static/order_c.png" ></image>
								<view>待收货</view>
								<view class="fukuanyuan" v-if="ordertotal.receive!=0&&ordertotal!=''">{{ordertotal.receive}}</view>
							</view>
							<view class="orderItem"  @click.stop="fahuo" :data-id="4">
								<image src="../../static/order_d.png" ></image>
								<view>待评价</view>
								<view class="fukuanyuan" v-if="ordertotal.comment!=0&&ordertotal!=''">{{ordertotal.comment}}</view>
							</view>
							
							<view class="orderItem"  @click.stop="fahuo" :data-id="0">
								<image src="../../static/order_e.png" class="dingorder"></image>
								<view>全部订单</view>
								<view class="fukuanyuan" v-if="ordertotal.count!=0&&ordertotal!=''">{{ordertotal.count}}</view>
							</view>
						</view>
					</view>
					<view class="contanier" style="margin-bottom:120rpx">
						<view class="citem"  @click.stop="jump" data-id="1">
							<view class="left">
								<image src="../../static/icon_a.png" mode="widthFix" />
								我的钱包
							</view>
							<view class="right">
								<image src="../../static/right.png" mode="widthFix" />
							</view>
						</view>
						
						<view class="citem"  @click.stop="jump" data-id="2"  v-if="openclose==1">
							<view class="left">
								<image src="../../static/icon_b.png" mode="widthFix" />
								会员中心
							</view>
							<view class="right">
								<image src="../../static/right.png" mode="widthFix" />
							</view>
						</view>
						<view class="citem"  @click.stop="jump" data-id="7" v-if="myclose==1">
							<view class="left">
								<image src="../../static/fenxiao.png" mode="widthFix" />
								我的分销
							</view>
							<view class="right">
								<image src="../../static/right.png" mode="widthFix" />
							</view>
						</view>
						<view class="citem"  @click.stop="jump" data-id="3" >
							<view class="left">
								<image src="../../static/icon_c.png" mode="widthFix" />
								我的积分
							</view>
							<view class="right">
								<image src="../../static/right.png" mode="widthFix" />
							</view>
						</view>
						<view class="citem"  @click.stop="jump" data-id="4">
							<view class="left">
								<image src="../../static/icon_e.png" mode="widthFix" />
								我的优惠卷
							</view>
							<view class="right">
								<image src="../../static/right.png" mode="widthFix" />
							</view>
						</view>
						
						<view class="citem"  @click.stop="jump" data-id="6">
							<view class="left">
								<image src="../../static/icon_g.png" mode="widthFix" />
								销售管理
							</view>
							<view class="right">
								<image src="../../static/right.png" mode="widthFix" />
							</view>
						</view>
						<view class="citem"  @click.stop="jump" data-id="8">
							<view class="left">
								<image src="../../static/icon_f.png" mode="widthFix" />
								申请加盟
							</view>
							<view class="right">
								<image src="../../static/right.png" mode="widthFix" />
							</view>  
						</view>
						
						<view class="citem"  @click.stop="jump" data-id="9">
							<view class="left">
								<image src="../../static/phonek.png" mode="widthFix" />
								服务热线({{hotline}})
							</view>
							<view class="right">
								<image src="../../static/right.png" mode="widthFix" />
							</view>  
						</view>
						<view class="citem"  @click.stop="jump" data-id="10">
							<view class="left">
								<image src="../../static/wangqiu.png" mode="widthFix" />
								中面官网
							</view>
							<view class="right">
								<image src="../../static/right.png" mode="widthFix" />
							</view>  
						</view>
						<view class="citem"  @click.stop="jump" data-id="11">
							<view class="left">
								<image src="../../static/shangk.png" mode="widthFix" />
								商家后台
							</view>
							<view class="right">
								<image src="../../static/right.png" mode="widthFix" />
							</view>  
						</view>
					</view>
					<tabBar :current="currentTabIndex" backgroundColor="#fbfbfb" color="#999" tintColor="#42b983" ></tabBar>
					<!-- 底部导航 -->
					
		</view>
	
	</view>
</template>

<script>
	import app from "../../App.vue";
	import tabBar from '../../components/tabvue/tabvue.vue'
	
	export default {
		components:{
				tabBar
			},
		data() {
			return {
				footersel: 4,
				userinfo:'',
				nickname:'',
				avatar:'',
				address:'',
				label:'',
				currentTabIndex:3,
				token:'',
				biztoken:'',
				isuser:"",
				hotline:'',
				parent_id:'',
				openclose:'',
				// 订单统计
				ordertotal:'',
				guanwang:''
				
				
			}
		},
		onLoad() {
			
		},
		methods: {
			
			// 获取开关
			getkaiguan() {
				let that = this;
				var url = 'page/get_switch';
				var params = {
					
		
				}
				app.post(url, params).then((res) => {
					console.log(res,34343748748);
					that.openclose=res.data.data.switch
			
				}).catch((err) => {
					
			
				})
			},
			// 订单统计
			getordertotal(){
				let that = this;
				var url = 'order/get_order_count';
				var params = {
					
						
				}
				app.post(url, params).then((res) => {
					console.log(res,34343748748);
					that.ordertotal=res.data.data
							
				}).catch((err) => {
					
							
				})
			},
			
			
			// 微信登陆
			weixinlogin(){
				let that=this;
				uni.login({
					provider: 'weixin',
					success: function(loginRes) {
						console.log(loginRes.authResult);
						// 获取用户信息
						uni.getUserInfo({
							provider: 'weixin',
							success: function(infoRes) {
								console.log(infoRes)
								console.log('用户昵称为:' + infoRes.userInfo.nickName);
								var url = 'member/wechat_login';
								var params = {
									nickname: infoRes.userInfo.nickName,
									avatar: infoRes.userInfo.avatarUrl,
									openid: infoRes.userInfo.openId,
									gender: infoRes.userInfo.gender,
									city: infoRes.userInfo.city,
									province: infoRes.userInfo.province,
									country: infoRes.userInfo.country,
									more: JSON.stringify(infoRes.userInfo)
								}
				
								console.log('参数', params)
								app.post(url, params, "post").then((res) => {
									console.log(res);
									// uni.setStorageSync("third_id", res.data.data.third_id)
									that.getuserinfo()
				
				
								}).catch((err) => {
									console.log(err)
				
								})
				
							}
						});
					}
				});
			},
			// 获取加盟热线
			gethotline(){
				let that = this;
				var url = 'sundry/get_page';
				var params = {
					id:11
				}
				
				
				app.post(url, params).then((res) => {
					
					that.hotline = res.data.data.content;
				
				}).catch((err) => {
				
				})
			},
			// 获取中面官网
			getgaunwang(){
				let that = this;
				var url = 'sundry/get_page';
				var params = {
					id:13
				}
				
				
				app.post(url, params).then((res) => {
					console.log(res,999999)
					
					that.guanwang=res.data.data.content;
					console.log(that.guanwang)
				
				}).catch((err) => {
				
				})
			},
			
			//获取biztoken
			getbiztoken(){
				let that = this;
				var url = 'member/detect_auth';
				var params = {
				
				}
				console.log('7766554', params)
				app.post(url, params).then((res) => {
					console.log(res);
					that.biztoken=res.data.data.BizToken
					
				
				
				}).catch((err) => {
					console.log(err)
				
				})
			},
			// 认证
			cardrenzheng(){
				let that=this;
				if(that.isuser==1){
					uni.reLaunch({
						url:"/pages/login/loginindex"
					})
				}else{
					const face = uni.requireNativePlugin('AThree-Face');
					console.log(face);
					console.log(this.biztoken)
					// 调用 startFace方法
					face.startFace({ 
					    //biztoken获取方式请参考腾讯人脸核身文档(https://cloud.tencent.com/document/product/1007/31816).
					    // biztoken:'21B821D3-2E7C-4A7C-9976-6BD3E0787803',
						biztoken:this.biztoken,
					    //userid测试版本的插件需要,正式的插件不需要这个参数,联系我们获取userid
					    userid:'6xRMIFTqFjLZ225'
					    }, result => {
							console.log(result,'实名认证实名认证')
					            const msg = JSON.stringify(result);
								console.log(msg);
								if(result.errorcode==0){
									 that.getinfo()
								}
								
								
					           
					    }
					);
				}
				
			},
			getinfo(){
				let that = this;
				var url = 'member/get_detect_info';
				var params = {
				bizToken:that.biztoken
				}
				console.log('7766554', params)
				app.post(url, params).then((res) => {
					console.log('用户信息',res);
					this.getuserinfo()
					
				
				
				}).catch((err) => {
					console.log(err)
				
				})
			},
			
			// 设置
			set() {
				console.log(4374)
				
				let token=uni.getStorageSync("token");
				console.log(token)
				if(token==''){
					uni.navigateTo({
						url:'/pages/login/loginindex'
					})
				}else if(this.isuser==1){
						uni.reLaunch({
							url:"/pages/login/loginindex"
						})
					
				}else{
					uni.navigateTo({
						url:'/pages/usercenter/setUp?avatar='+this.avatar+'&nickname='+this.nickname+"&mobile="+this.userinfo.mobile+'&address='+this.address
					})
				}
				
			},
			registerlogin(){
				uni.navigateTo({
					url:'/pages/login/loginindex'
				})
			},
				
			// 获取用户信息
			getuserinfo() {
				let that = this;
				var url = 'member/index';
				var params = {

				}
				console.log('7766554', params)
				app.post(url, params).then((res) => {
					console.log(res,'用户信息用户信息');
					that.userinfo = res.data.data;
					uni.setStorageSync("user_id",res.data.data.id)
					that.label = res.data.data.label;
					that.nickname=res.data.data.nickname;
					that.avatar=res.data.data.avatar;
					that.address=res.data.data.address
					that.parent_id=res.data.data.parent_id;
					that.isuser=""
					
				}).catch((err) => {
					
					
					console.log(err)
					if(err.msg="用户未登录"){
						that.isuser=1
					}
					
					console.log('我是userusesue',that.isuser)
						

				})
			},
			
			// 个人资料
			personziliao() {
				let token=uni.getStorageSync("token");
				if(token==''){
					uni.navigateTo({
						url:'/pages/login/loginindex'
					})
				}else if(this.isuser==1){
						uni.reLaunch({
							url:"/pages/login/loginindex"
						})
					
				}else{
					uni.navigateTo({
						url: '/pages/usercenter/personalData?avatar='+this.avatar+'&nickname='+this.nickname+'&address='+this.address
					})
				}
			},
			// 列表跳转
			jump(e) {
				let token=uni.getStorageSync("token");
				console.log(token)
				if(token==''){
					uni.navigateTo({
						url:'/pages/login/loginindex'
					})
				}else if(this.isuser==1){
					uni.reLaunch({
						url:"/pages/login/loginindex"
					})
					
				}else{
					let id = e.currentTarget.dataset.id;
					if (id == 1) {
						uni.navigateTo({
							url: '/pages/usercenter/wallet'
						})
					} else if (id == 2) {
						uni.navigateTo({
							url: '/pages/usercenter/usercenter'
						})
					} else if (id == 3) { 
						uni.navigateTo({
							url: '/pages/usercenter/myIntegral'
						})
					} else if (id == 4) {
						uni.navigateTo({
							url: '/pages/usercenter/myCoupon'
						})
					} else if (id == 5) {
						// uni.navigateTo({
						// 	url: '/pages/usercenter/myPublish'
						// })
						uni.navigateTo({
							url: '/pages/luntan/examine'
						})
					} else if (id == 6) {
						uni.navigateTo({
							url: '/pages/usercenter/sales'
						})
					}else if(id==7){
						uni.navigateTo({
							url:'/pages/usercenter/myfenxiao'
						})
					}else if(id==8){
						uni.navigateTo({
							url:'/pages/usercenter/applayruzhu'
						})
					}else if(id==9){
						uni.makePhoneCall({
							phoneNumber: this.hotline //仅为示例
						});
					}else if(id==10){
						let url=this.guanwang;
						console.log(this.guanwang)
						plus.runtime.openURL(url);
						
					}else if(id==11){
						let url="http://zhongmian.w.brotop.cn/admin/index/login"
						plus.runtime.openURL(url);
						
					}
				}
				
			},

			// 代发货
			fahuo(e) {
				let token=uni.getStorageSync("token");
				console.log(token)
				if(token==''){
					uni.navigateTo({
						url:'/pages/login/loginindex'
					})
				}else{
					let id=e.currentTarget.dataset.id;
					// if(id==0){
					// 	id==''
					// }
					uni.navigateTo({
						url: '/pages/usercenter/myOrder?id='+id
					})
				}
				
			},
			// 底部导航跳转
			selnav(e) {
				console.log(e)

				let id = e.currentTarget.dataset.id;
				console.log(id)
				if (id == 1) {
					uni.navigateTo({
						url: '../homepage/homepage'
					})
				} else if (id == 2) {
					uni.navigateTo({
						url: "../nearshop/nearshop"
					})
				} else if (id == 3) {
					uni.navigateTo({
						url: "../luntan/luntan"
					})
				} else if (id == 4) {
					uni.navigateTo({
						url: "../usercenter/my"
					})
				}
			},

		},
		onShow() {
			this.getkaiguan();
			this.getgaunwang()
		// 获取订单统计
		this.getordertotal()
			// uni.clearStorageSync()
			this.token=uni.getStorageSync("token")
			console.log('我是tokenajdajkdjksjdsjdkffjkj',this.token)
			uni.hideTabBar({
				
			})
			//获取个人信息
			this.getuserinfo();
			this.getbiztoken();
			this.gethotline()
		}
	}
</script>

<style>
	page {
		background-color: #F9F9F9;
	}
	.weixinlogin{
		padding:5rpx 10rpx;
		color:#C29445;
		border:1rpx solid #C29445;
		border-radius: 20rpx;
		margin-left:20rpx;
		font-size: 28rpx;
		
	}
	
	.orderItem image{
		width:42rpx!important;
		height:38rpx;
	}
	.orderItem .dingorder{
		width:38rpx!important;
		
	}
	.header {
		background: #fff;
		padding: 0 32rpx;
		box-sizing: border-box;
	}

	.userinfo {
		padding: 32rpx 0;
		border-bottom: 1px solid #EEEEEE;
		box-sizing: border-box;
		display: flex;
		align-items: center;
		position: relative;
	}

	.avator {
		width: 128rpx;
		height: 128rpx;
		font-size: 0;
		border-radius: 50%;
		border-radius: 64rpx;
	}

	.avator image {
		width: 100%;
		border-radius: 50%;
	}

	.infoBox {
		max-width: 466rpx;
		margin-left: 28rpx;

	}

	.identity {
		display: flex;
		align-items: center;
		margin-top: 16rpx;
	}

	.name {
		font-size: 32rpx;
		font-family: PingFangSC-Medium, PingFang SC;
		font-weight: 500;
		color: rgba(19, 20, 21, 1);
	}

	.vip {
		padding: 0 20rpx;
		height: 40rpx;
		line-height: 40rpx;
		box-sizing: border-box;
		background: #F7CB8A;
		border-radius: 20rpx;
		margin-left: 16rpx;
		/* background: linear-gradient(90deg, rgba(244, 210, 151, 1) 0%, rgba(252, 191, 117, 1) 100%);
		border-radius: 20rpx;
		font-size: 22rpx;
		font-family: PingFangSC-Medium, PingFang SC;
		font-weight: 500;
		color: rgba(120, 71, 0, 1);
		padding: 4rpx 12rpx;
		margin-left: 16rpx; */
	}

	.vipname {
		color: #784700;
		font-size: 22rpx;
	}

	.vip image {
		width: 24rpx;
		margin-right: 6rpx;
	}

	.userType {
		font-size: 28rpx;
		font-family: PingFangSC-Medium, PingFang SC;
		font-weight: 500;
		color: rgba(61, 69, 76, 1);
		line-height: 40px;
	}

	.userActive {
		font-size: 28rpx;
		font-family: PingFangSC-Medium, PingFang SC;
		font-weight: 500;
		color: rgba(194, 148, 69, 1);
		display: flex;
		align-items: center;
		margin-top: 20rpx;
	}

	.userActive image {
		width: 32rpx;
		height:32rpx;
		margin-right: 8rpx;
	}

	.setup {
		width:40rpx;
		height: 40rpx;
		position: absolute;
		right: 32rpx;
		top: 52rpx;
	}

	.setup image {
		width: 100%;
	}

	.orderBox {
		padding: 24rpx;
		box-sizing: border-box;
		display: flex;
		justify-content: space-between;
		align-items: center;
	}

	.orderItem {
		display: flex;
		flex-wrap: wrap;
		flex-direction: column;
		justify-content: center;
		align-items: center;
		min-width: 84rpx;
		position: relative;
	}
	.fukuanyuan{
		width:39rpx;
		height:35rpx;
		background:#F19A38 ;
		border-radius: 50%;
		color:#fff!important;
		font-size: 16rpx;
		text-align: center;
		line-height: 35rpx;
		position: absolute;
		right:-13rpx;
		top:-16rpx
		}
	.orderItem image {
		width: 56rpx;
	}

	.orderItem view {
		font-size: 28rpx;
		font-family: PingFangSC-Regular, PingFang SC;
		font-weight: 400;
		color: rgba(6, 18, 32, 1);
		margin-top: 4rpx;
	}

	.contanier {
		margin-top: 16rpx;
		padding: 0 32rpx;
		box-sizing: border-box;
		background: #fff;
	}

	.citem {
		height: 108rpx;
		display: flex;
		justify-content: space-between;
		align-items: center;
		border-bottom: 1px solid #EDEDED;
	}

	.citem:last-child {
		border-bottom: none;
	}

	.left {
		width: calc(100% -50rpx);
		display: flex;
		align-items: center;
		font-size: 28rpx;
		font-family: PingFangHK-Regular, PingFangHK;
		font-weight: 400;
		color: rgba(8, 18, 31, 1);
	}

	.left image {
		width: 36rpx;
		margin-right: 16rpx;
	}

	.right {
		width: 32rpx;
	}

	.right image {
		width: 100%;
	}
</style>