my.vue 15.5 KB
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
<template>
	<view>
		<image src="../../static/beijing.png" class="background" mode=""></image>
		<view class="onetop">
			<ul>
				<li class="onetop-1" @click='receive'>
					<view class="onetop-2">
						<view class="onetop-3">
							<image :src="UserInfo.beijintupian" mode="" style="border: 0px;"></image>
						</view>
						<text>{{UserInfo.username}}</text>
						<text
							style="font-size: 12px;position:absolute;left:85px;top: 45px; color:#f2e2ac;">身份:{{UserGrade}}</text>
						<text style="font-size: 12px;position: absolute;right: 50px;">ID:<text
								style="color: red;font-size: 12px;">{{UserInfo.id}}</text> </text>
					</view>
					<view class="onetop-4">
						<image :src="zhijiao" mode=""></image>
					</view>
				</li>
			</ul>
		</view>
		<view class="twotop">
			<ul>
				<li class="twotopLi" @click="addcom" v-if="IsShow[6]==6">
					<view class="iehicleInformation">
						<view class="iehicleInformation-1" style="width:30rpx;height:24rpx;">
							<image src="../../static/qiche.png" mode="" />
						</view>
						<text>添加专员</text>
					</view>
					<view class="iehicleInformation-2">
						<image :src="zhijiao" mode=""></image>
					</view>
				</li>
				<li class="twotopLi" @click="vehicle" v-if="IsShow[0]==0">
					<view class="iehicleInformation">
						<view class="iehicleInformation-1" style="width:30rpx;height:24rpx;">
							<image src="../../static/qiche.png" mode="" />
						</view>
						<text>车辆信息</text>
					</view>
					<view class="iehicleInformation-2">
						<image :src="zhijiao" mode=""></image>
					</view>
				</li>
				<li class="twotopLi" @click='qrCode' v-if="IsShow[1]==1">
					<view class="iehicleInformation">
						<view class="iehicleInformation-1">
							<image src="../../static/01.png" mode="" style="width: 32rpx;height:29rpx;"></image>
						</view>
						<text>专属二维码</text>
					</view>
					<view class="iehicleInformation-2">
						<image :src="zhijiao" mode=""></image>
					</view>
				</li>
				<li class="twotopLi" @click="wyPromotion" v-if="IsShow[2]==2">
					<view class="iehicleInformation">
						<view class="iehicleInformation-1" style="width:34rpx;height:32rpx;">
							<image src="../../static/02.png" mode=""></image>
						</view>
						<text>提现金额</text>
					</view>
					<view class="iehicleInformation-2">
						<image :src="zhijiao" mode=""></image>
					</view>
				</li>
				<li class="twotopLi" @click="customer" v-if="IsShow[3]==3">
					<view class="iehicleInformation">
						<view class="iehicleInformation-1" style="width: 32rpx;height:31rpx ;">
							<image src="../../static/03.png" mode=""></image>
						</view>
						<text>我的客户</text>
					</view>
					<view class="iehicleInformation-2">
						<image :src="zhijiao" mode=""></image>
					</view>
				</li>
				<li class="twotopLi" @click='commissioner' v-if="IsShow[4]==4">
					<view class="iehicleInformation">
						<view class="iehicleInformation-1" style="width:29rpx;height:32rpx;">
							<image src="../../static/04.png"></image>
						</view>
						<text>我的专员</text>
					</view>
					<view class="iehicleInformation-2">
						<image :src="zhijiao"></image>
					</view>
				</li>

				<li class="twotopLi" @click='record' v-if="IsShow[5]==5">
					<view class="iehicleInformation">
						<view class="iehicleInformation-1" style="width:26rpx;height:30rpx">
							<image src="../../static/06.png"></image>
						</view>
						<!-- {{recordnum}} -->
						<text>领取产品记录 </text>
					</view>
					<view class=" iehicleInformation-2">
						<image :src="zhijiao" mode=""></image>
					</view>
				</li>
				<li class="twotopLi" @click='Exsit' v-if="IsShow[10]==10">
					<view class="iehicleInformation">
						<view class="iehicleInformation-1" style="width:26rpx;height:30rpx">
							<image src="../../static/06.png"></image>
						</view>
						<!-- {{recordnum}} -->
						<text>退出系统 </text>
					</view>
					<view class=" iehicleInformation-2">
						<image :src="zhijiao" mode=""></image>
					</view>
				</li>

				<li class="twotopLi" @click='particulars' v-if="false">
					<view class="iehicleInformation">
						<view class="iehicleInformation-1" style="width:26rpx;height:30rpx">
							<image src="../../static/06.png"></image>
						</view>
						<text>进入明细</text>
					</view>
					<view class=" iehicleInformation-2">
						<image :src="zhijiao" mode=""></image>
					</view>
				</li>
			</ul>
		</view>
		<!-- 套餐详情 -->
		<view class="packagedetails" v-if="IsShow[8]==8">
			<view class="packagedetails-0">
				现金补贴规则
			</view>
			<view class="packagedetails-1">
				<text>{{rulelist[0].texts==null?'暂无规则':rulelist[0].texts}}</text>
			</view>
		</view>
		<view class="numview" style="display: block;text-align: center;" v-if="IsShow[9]==9">
			<view style="color:red;font-size: 12px;">任务单量:<text style="color:red;">{{HaveNumber}}</text> 单</view>
			<view style="color:red;font-size: 12px;">现已完成:<text style="color:red;">{{HaveNumberNow}}</text> 单</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				zhijiao: '../../static/zhijiao.png',
				UserGrade: '',
				// -----------------------------------------------------
				// 登录后的用户信息
				UserInfo: null,
				// 任务单量
				HaveNumber: 0,
				// 已完成单量
				HaveNumberNow: 0,
				userImg: '../../static/users.png',
				IsShow: [],
				// 规则model
				rulemodel: {
					"KeyWord": "",
					"TotalCount": 0,
					"PageIndex": 1,
					"PageSize": 1,
					"Sort": [{
						"Field": "add_time",
						"Type": 1
					}]
				},
				rulelist: [],
				// 领取记录
				recordnum: 0,
				modelrecord: {
					"KeyWord": "",
					"TotalCount": 0,
					"PageIndex": 1,
					"PageSize": 50,
					"Sort": [{
						"Field": "",
						"Type": 0
					}]
				},
				numModel: {
					"KeyWord": "",
					"TotalCount": 0,
					"PageIndex": 1,
					"PageSize": 1,
					"Sort": [{
						"Field": "",
						"Type": 0
					}]
				}
				// WxInfo: {
				// 	"ParentUserId": 0,
				// 	"InviteeUserId": 0,
				// 	"beijintupian": "",
				// 	"birthday": "",
				// 	"ID_card": "",
				// 	"address": "",
				// 	"id": 0,
				// 	"username": "",
				// 	"password": "",
				// 	"author": "",
				// 	"status": "",
				// 	"type": 0,
				// 	"full_name": "",
				// 	"add_time": "2022-01-25T09:57:09.828Z",
				// 	"update_time": "2022-01-25T09:57:09.828Z",
				// 	"remark": "",
				// 	"avatar": "",
				// 	"phone": "",
				// 	"updphone": "",
				// 	"openid": "",
				// 	"sex": "",
				// 	"balance": 0
				// },
			}
		},
		onLoad() {
			this.ShowRule()
			// 获取用户信息
			// this.GetUserInfo()
			// 获取经理专员固定单量
			this.ShowNum()
		},
		onShow() {
			// 判断是否登录
			this.IsLogin()
			// 实时更新用户信息
			this.ShowUserInfoByID()
			// 获取经理专员固定单量
			this.ShowNum()
			// 实时获取已完成单量
			this.ShownNowNum()
			// 获取缓存数据进行展示用户数据
			this.GetUserInfoByStoreage()
			// 根据角色展示开放权限
			this.IsShowModel()
			// 查询领取记录数量
			this.ShowRecordNum()
		},
		methods: {
			// 获取用户头像
			// GetUserInfo() {
			// 	let jsonstorage = uni.getStorageSync('userinfo').data
			// 	let that = this
			// 	uni.getUserProfile({
			// 		desc: '获取头像',
			// 		success(res) {
			// 			console.log('获取信息', res)
			// 			let datainfo = JSON.parse(res.rawData)
			// 			console.log('daainfo', datainfo)
			// 			that.WxInfo.id = jsonstorage.id
			// 			that.WxInfo.beijintupian = datainfo.avatarUrl
			// 			that.WxInfo.username = datainfo.nickName
			// 			that.UpdInfo()
			// 		}
			// 	})
			// },
			// // 修改用户信息
			// UpdInfo() {
			// 	let jsonstorage = uni.getStorageSync('userinfo')
			// 	let that = this
			// 	this.API.UpdateWXUserInfo(that.WxInfo).then(res => {
			// 		console.log('res修改', res)
			// 		jsonstorage.data.username = res.data.data.username
			// 		jsonstorage.data.beijintupian = res.data.data.beijintupian
			// 		uni.setStorageSync('userinfo', jsonstorage)
			// 	})
			// },

			Exsit() {
				uni.removeStorageSync('token')
				uni.removeStorage({
					key: 'userinfo',
					success() {
						uni.redirectTo({
							url: '../login/login'
						})
					}
				})
			},

			// 判断是否授权登录
			IsLogin() {
				let jsonstorage = uni.getStorageSync('userinfo')
				if (jsonstorage == undefined || jsonstorage == '' || jsonstorage == null) {
					uni.redirectTo({
						url: '../login/login',
					})
				}
			},

			// 跳转至用户下级信息
			particulars() {
				uni.navigateTo({
					url: '../userDetail/userDetail'
				})
			},
			// 查询领取记录
			ShowRecordNum() {
				let jsonstorage = uni.getStorageSync('userinfo').data
				// 	// 查询领取记录
				this.modelrecord.KeyWord = jsonstorage.id
				this.API.GetRecordList(this.modelrecord).then(res => {
					console.log('数据', res)
					this.recordnum = res.data.data.total
				})
			},
			// 查询规则
			ShowRule() {
				this.API.GetListRichTextrule(this.rulemodel).then(res => {
					console.log('规则', res)
					this.rulelist = res.data.data.rows
				})
			},
			// 根据角色展示开放权限
			IsShowModel() {
				// 超级管理员0 管理员1 普通用户2 销售专员3 销售经理4
				let jsonstorage = uni.getStorageSync('userinfo').data
				if (jsonstorage.type == 2) {
					this.IsShow[10] = 10
					this.IsShow[0] = 0
				} else if (jsonstorage.type == 4) {
					this.IsShow[0] = 0
					this.IsShow[1] = 1
					this.IsShow[2] = 2
					this.IsShow[3] = 3
					this.IsShow[4] = 4
					this.IsShow[5] = 5
					this.IsShow[6] = 6
					this.IsShow[9] = 9
					this.IsShow[8] = 8
					this.IsShow[10] = 10
				} else if (jsonstorage.type == 3) {
					this.IsShow[0] = 0
					this.IsShow[1] = 1
					this.IsShow[2] = 2
					this.IsShow[3] = 3
					this.IsShow[9] = 9
					this.IsShow[8] = 8
					this.IsShow[10] = 10
				}
			},
			// 根据ID实时查询用户数据并存入缓存
			ShowUserInfoByID(){
				let jsonstorage=uni.getStorageSync('userinfo')
				this.API.GetUserById(jsonstorage.data.id).then(res=>{
					console.log('实时数据',res)
					if(res.data.code==200){
						jsonstorage.data=res.data.data
						uni.setStorageSync('userinfo',jsonstorage)
					}
				})
			},
			// 实时查询已完成单量
			ShownNowNum() {
				let jsonstorage = uni.getStorageSync('userinfo').data
				this.API.GetUserById(jsonstorage.id).then(res => {
					console.log('数据', res)
					if (res.data.code == 200) {
						this.HaveNumberNow = res.data.data.nowNum

					}
				})
			},
			//实时查询固定经理专员单量
			ShowNum() {
				let jsonstorage=uni.getStorageSync('userinfo').data
				this.API.GetModelNum(this.numModel).then(res=>{
					console.log('数据',res)
					if(res.data.code==200){
						if(jsonstorage.type==3){
							this.HaveNumber=res.data.data.rows[0].commissionerNum
						}else if(jsonstorage.type==4){
							this.HaveNumber=res.data.data.rows[0].managerNum
						}else{
							this.HaveNumber=0
						}
					}else{
						this.HaveNumber = 0
					}
				})
			},
			// 获取登录后的缓存信息
			GetUserInfoByStoreage() {
				let jsonstorage = uni.getStorageSync('userinfo')
				if (jsonstorage.code == 200) {
					this.UserInfo = jsonstorage.data
					if (this.UserInfo.type == 0) {
						this.UserGrade = '超级管理员'
					} else if (this.UserInfo.type == 1) {
						this.UserGrade = '管理员'
					} else if (this.UserInfo.type == 2) {
						this.UserGrade = '普通用户'
					} else if (this.UserInfo.type == 3) {
						this.UserGrade = '推广专员'
						// this.HaveNumber = this.UserInfo.commissionerNum
						this.HaveNumberNow = this.UserInfo.nowNum
					} else if (this.UserInfo.type == 4) {
						this.UserGrade = '客户经理'
						// this.HaveNumber = this.UserInfo.managerNum
						this.HaveNumberNow = this.UserInfo.nowNum
					} else {
						this.UserGrade = '暂无身份'
					}
				}
				console.log('缓存数据', jsonstorage)
			},
			// 推广二维码
			qrCode() {
				uni.navigateTo({
					url: '../zhiwen-share/zhiwen-share'
				});
			},
			// 添加专员
			addcom() {
				uni.navigateTo({
					url: '../addcommiss/addcommiss'
				})
			},
			receive() {
				uni.navigateTo({
					url: '../personalinfo/personalinfo'
				});
			},
			vehicle() {
				// 跳转至车辆管理页面
				uni.navigateTo({
					url: '../makeAnAppointment/makeAnAppointment'
				});
			},
			// 提现金额
			wyPromotion() {
				let jsonstorage = uni.getStorageSync('userinfo').data
				if (jsonstorage.status == 0) {
					uni.navigateTo({
						url: '../wyPromotion/wyPromotion?usermodel=' + decodeURIComponent(JSON.stringify(this
							.UserInfo))
					});
				} else {
					uni.showToast({
						title: '已被拉黑,无法提现',
						icon: 'none'
					})
				}
			},
			customer() {
				uni.navigateTo({
					url: '../customer/customer'
				});
			},
			commissioner() {
				uni.navigateTo({
					url: '../commissioner/commissioner'
				});
			},
			record() {
				uni.navigateTo({
					url: '../record/record'
				});
			},
		}
	}
</script>

<style>
	.numview>view {
		margin-top: 5px;
	}

	/* 背景图片 */
	.background {
		width: 100%;
		height: 100%;
		position: fixed;
		/* border-radius:50% 50% 0 0 ; */
		background-size: 100% 100%;
		z-index: -1;
	}

	/* 头像 */
	.onetop {
		padding-top: 20rpx;
		width: 100%;
		height: 120rpx;
		background-color: #343434;
	}

	.onetop-1 {
		width: 700rpx;
		height: 80rpx;
		margin: 0 auto;
		display: flex;
		justify-content: space-between;
		align-items: center;
		border-radius: 40rpx;
	}

	.onetop-2 {
		display: flex;
		align-items: center;
	}

	.onetop-2 text {
		color: #FFFFFF;
		font-size: 30rpx;
	}

	.onetop-3 {
		display: flex;
		justify-content: ;
		align-items: center;
		width: 100rpx;
		height: 100rpx;
		border: #FFFFFF 2rpx solid;
		border-radius: 50rpx;
		overflow: hidden;
		margin-left: 20rpx;
		margin-right: 20rpx;
	}

	.onetop-3 image {
		width: 100%;
		height: 100%;
	}

	.onetop-4 {
		width: 20rpx;
		height: 18rpx;
		margin-right: 20rpx;
		display: flex;
		/* justify-content: ; */
	}

	.onetop-4 image {
		width: 100%;
		height: 100%;
	}

	/* 车辆信息 */
	.twotopLi {
		/* background-color: #F8F8F8; */
		margin: 20rpx auto;
		width: 700rpx;
		height: 80rpx;
		display: flex;
		justify-content: space-between;
		align-items: center;
		background-color: #212121;
		/* background-color: #F0AD4E; */
		border-radius: 40rpx;
	}

	.iehicleInformation {
		/* background-color: #DD524D; */
		display: flex;
		justify-content: ;
		align-items: center;
	}

	.iehicleInformation-1 {
		/* background-color: #4CD964; */
		display: flex;
		justify-content: ;
		align-items: center;
		/* width:30rpx;
		height: 24rpx; */
		margin-left: 35rpx;
		margin-right: 35rpx;
	}

	.iehicleInformation-1 image {
		width: 100%;
		height: 100%;
	}

	.iehicleInformation text {
		color: #FFFFFF;
		font-size: 30rpx;
	}

	.iehicleInformation-2 {
		width: 20rpx;
		height: 20rpx;
		margin-right: 35rpx;
		display: flex;
		justify-content: ;
	}

	.iehicleInformation-2 image {
		width: 100%;
		height: 100%;
	}

	/* 套餐详情 */
	.packagedetails {
		width: 700rpx;
		height: 300rpx;
		border-radius: 10rpx;
		margin: 0 auto;
		display: flex;
		flex-direction: column;
		/* justify-content: space-around; */
		align-items: center;
		/* background-color: #007AFF; */

	}

	.packagedetails-0 {
		margin-top: 20rpx;
		color: #f4e8b1;
		text-align: center;
		font-size: 26rpx;
	}

	.packagedetails-1 {
		width: 90%;
		height: 200rpx;
		line-height: 35rpx;
		/* margin: -20rpx auto; */
		font-size: 22rpx;
		text-align: justify;
		color: #FFFFFF;
		/* background-color: #4CD964; */
	}
</style>