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
<template>
	<view class="page">
		<view >
			<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>
									
									<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="userinfo.is_card==2" -->
								<view class="userType"   @click="cardrenzheng">身份认证 >></view>
								<!-- <view class="userActive" v-else>
									<image src="../../static/active.png" mode="widthFix" />
									已认证
								</view> -->
							</view>
							<view class="setup"  @click.stop="set">
								<image src="../../static/setup.png" mode="widthFix" />
							</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>
							<view class="orderItem"  @click.stop="fahuo" :data-id="2">
								<image src="../../static/order_b.png" ></image>
								<view>待发货</view>
							</view>
							<view class="orderItem"  @click.stop="fahuo" :data-id="3">
								<image src="../../static/order_c.png" ></image>
								<view>待收货</view>
							</view>
							<view class="orderItem"  @click.stop="fahuo" :data-id="4">
								<image src="../../static/order_d.png" ></image>
								<view>待评价</view>
							</view>
							
							<view class="orderItem"  @click.stop="fahuo" :data-id="0">
								<image src="../../static/order_e.png" class="dingorder"></image>
								<view>全部订单</view>
							</view>
						</view>
					</view>
					<view class="contanier">
						<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">
							<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">
							<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="5">
							<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="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>
					<tabBar :current="currentTabIndex" backgroundColor="#fbfbfb" color="#999" tintColor="#42b983" ></tabBar>
					<!-- 底部导航 -->
					<!-- <view class="teacherfooter">
						<view class="teacherfootitem"  @click.stop="selnav" :data-id="1">
							<view class="teacherfootitemtop shou">
								<image :src="footersel==1?'../../static/tieziactive.png':'../../static/tiezi.png'"></image>
							</view>
							<view class="teacherfootname " :class="footersel==1?'activename':''">首页</view>
						</view>
						<view class="teacherfootitem"  @click.stop="selnav" :data-id="2">
							<view class="teacherfootitemtop shou">
								<image :src="footersel==2?'../../static/nearshopactive.png':'../../static/nearshop.png'"></image>
							</view>
							<view class="teacherfootname" :class="footersel==2?'activename':''">附近店铺</view>
						</view>
						<view class="teacherfootitem"  @click.stop="selnav" :data-id="3">
							<view class="teacherfootitemtop shou">
								<image :src="footersel==3?'../../static/luntanctive.png':'../../static/luntan.png'"></image>
							</view>
							<view class="teacherfootname" :class="footersel==3?'activename':''">中面论坛</view>
						</view>
						<view class="teacherfootitem"  @click.stop="selnav" :data-id="4">
							<view class="teacherfootitemtop shou">
								<image :src="footersel==4?'../../static/useractive.png':'../../static/user.png'"></image>
							</view>
							<view class="teacherfootname" :class="footersel==4?'activename':''">个人中心</view>
						</view>
					</view>
			-->
		</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:'',
				label:'',
				currentTabIndex:3,
				token:''
				
				
			}
		},
		onLoad() {
			
		},
		methods: {
			// 认证
			cardrenzheng(){
				const face = uni.requireNativePlugin('AThree-Face');
				console.log(face)		
				// 调用 startFace方法
				face.startFace({ 
				    //biztoken获取方式请参考腾讯人脸核身文档(https://cloud.tencent.com/document/product/1007/31816).
				    biztoken:'21B821D3-2E7C-4A7C-9976-6BD3E0787803',
				    //userid测试版本的插件需要,正式的插件不需要这个参数,联系我们获取userid
				    userid:'6xRMIFTqFjLZ225'
				    }, result => {
				            const msg = JSON.stringify(result);
							console.log(msg)
				           
				    }
				);
			},
			
			// 设置
			set() {
				let token=uni.getStorageSync("token");
				console.log(token)
				if(token==''){
					uni.navigateTo({
						url:'/pages/login/loginindex'
					})
				}else{
					uni.navigateTo({
						url:'/pages/usercenter/setUp?avatar='+this.avatar+'&nickname='+this.nickname+"&mobile="+this.userinfo.mobile
					})
				}
				
			},
			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;


				}).catch((err) => {
					console.log(err)

				})
			},
			// 个人资料
			personziliao() {

			},
			// 列表跳转
			jump(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 == 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'
						})
					} else if (id == 6) {
						uni.navigateTo({
							url: '/pages/usercenter/sales'
						})
					}else if(id==7){
						uni.navigateTo({
							url:'/pages/usercenter/myfenxiao'
						})
					}
				}
				
			},

			// 代发货
			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.token=uni.getStorageSync("token")
			uni.hideTabBar({
				
			})
			//获取个人信息
			this.getuserinfo()
		}
	}
</script>

<style>
	page {
		background-color: #F9F9F9;
	}
	
	.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;
		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;
	}

	.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>