externalInfo.vue 21.1 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 630 631 632 633 634 635 636 637 638 639 640 641 642 643
<template>
	<div class="container" style="padding: 10px;" >
		<div v-if="isshowView==0">
		<el-form :inline="true" :model="model" class="demo-form-inline">
			<el-form-item label="关键字">
				<el-input v-model="model.KeyWord" placeholder="关键字"></el-input>
			</el-form-item>
			<el-form-item>
				<el-button type="primary" @click="onSubmit">查询</el-button>
			</el-form-item>
		</el-form>
		<el-table :data="tableData" style="width: 100%">
			<el-table-column prop="date" label="ID" >
				<template slot-scope="scope">
					{{scope.row.id}}
				</template>
			</el-table-column>
			<el-table-column prop="beijintupian" label="头像">
				<template slot-scope="scope">
					<img :src="scope.row.beijintupian" style="width: 50px;height: 50px;" />
					<!-- {{scope.row.beijintupian}} -->
				</template>
			</el-table-column>
			<el-table-column prop="date" label="微信名" >
				<template slot-scope="scope">
					{{scope.row.username}}
				</template>
			</el-table-column>
			<el-table-column prop="date" label="别名" >
				<template slot-scope="scope">
					{{scope.row.full_name}}
				</template>
			</el-table-column>
			<el-table-column prop="date" label="用户电话" >
				<template slot-scope="scope">
					{{scope.row.phone}}
				</template>
			</el-table-column>
			<el-table-column prop="date" label="备用电话" >
				<template slot-scope="scope">
					{{scope.row.updphone}}
				</template>
			</el-table-column>
			<el-table-column prop="[address]" label="地址" >
				<template slot-scope="scope">
					{{scope.row.address}}
				</template>
			</el-table-column>
			<el-table-column prop="date" label="性别"  v-if="false">
				<template slot-scope="scope">
					<!-- 0--男 1--女 -->
					<el-tag type="success">
						{{scope.row.sex==0?'男':'女'}}
					</el-tag>
				</template>
			</el-table-column>
			<el-table-column prop="date" label="生日"  v-if="false">
				<template slot-scope="scope">
					{{scope.row.birthday}}
				</template>
			</el-table-column>
			<el-table-column prop="date" label="用户角色" >
				<template slot-scope="scope">
					<el-tag type="success">
						{{scope.row.type==1?'管理员':scope.row.type==2?'普通用户':scope.row.type==3?'推广专员':scope.row.type==4?'客户经理':'未知'}}
					</el-tag>
				</template>
			</el-table-column>
			<el-table-column prop="date" label="用户状态" >
				<template slot-scope="scope">
					<el-tag :type="scope.row.status==0?'success':'warn'">
						{{scope.row.status==0?'使用中':'禁用中'}}
					</el-tag>
				</template>
			</el-table-column>
			<el-table-column prop="date" label="添加时间"  v-if="false">
				<template slot-scope="scope">
					{{scope.row.add_time}}
				</template>
			</el-table-column>
			<el-table-column prop="date" label="查看直推" >
				<template slot-scope="scope">
					<el-button type="success" @click="SelectOrder(scope.row.id)">查看直推</el-button>
				</template>
			</el-table-column>
			<el-table-column prop="date" label="查看下级" >
				<template slot-scope="scope">
					<el-button type="success" @click="SelectOrderW(scope.row.id)">查看下级</el-button>
				</template>
			</el-table-column>
		</el-table>
		<el-pagination background layout="prev, pager, next" :total="model.TotalCount" @current-page="Pages"
			style="text-align:right;margin-top:10px;">
		</el-pagination>
		<!-- 折叠面板 -->
		<el-collapse v-if="isshow==0">
			<el-collapse-item title="客户经理直推" name="1" >
				<div class="zt">
					<el-form :inline="true" :model="formCustomer" class="demo-form-inline">
						<el-form-item label="开始日期">
							<el-date-picker v-model="formCustomer.StartResultTime" type="datetime" placeholder="开始日期">
							</el-date-picker>
						</el-form-item>
						<el-form-item label="结束日期">
							<el-date-picker v-model="formCustomer.EndResultTime" type="datetime" placeholder="结束日期">
							</el-date-picker>
						</el-form-item>
						<el-form-item label="状态">
							<el-select v-model="formCustomer.RecordState" placeholder="预约状态" @change="cs">
								<el-option label="查所有" value="-1"></el-option>
								<el-option label="已预约" value="0"></el-option>
								<el-option label="已取消" value="1"></el-option>
								<el-option label="已完成" value="2"></el-option>
							</el-select>
						</el-form-item>
						<el-form-item>
							<el-button type="primary" @click="onSubmitTime">查询</el-button>
						</el-form-item>
					</el-form>
					<el-table :data="Direct" style="width: 100%">
						<el-table-column prop="date" label="ID" width="180">
							<template slot-scope="scope">
								{{scope.row.Id}}
							</template>
						</el-table-column>
						<el-table-column prop="beijintupian" label="头像" width="180">
							<template slot-scope="scope">
								<img :src="scope.row.beijintupian" style="width: 40px;height: 40px;" />
							</template>
						</el-table-column>
						<el-table-column prop="RecordName" label="微信名" width="180">
							<template slot-scope="scope">
								{{scope.row.RecordName}}
							</template>
						</el-table-column>
						<el-table-column prop="RecordPhone" label="电话号码" width="180">
							<template slot-scope="scope">
								{{scope.row.RecordPhone}}
							</template>
						</el-table-column>
						<el-table-column prop="date" label="用户名" width="180">
							<template slot-scope="scope">
								{{scope.row.UserName}}
							</template>
						</el-table-column>
						<el-table-column prop="UserId" label="用户ID" width="180">
							<template slot-scope="scope">
								{{scope.row.UserId}}
							</template>
						</el-table-column>
						<el-table-column prop="CarId" label="车辆ID" v-if="false">
							<template slot-scope="scope">
								{{scope.row.CarId}}
							</template>
						</el-table-column>

						<el-table-column prop="date" label="状态" width="180">
							<template slot-scope="scope">
								<el-tag type="success">
									{{scope.row.State==0?'已预约':scope.row.State==1?'已取消':scope.row.State==2?'已完成':'未知'}}
								</el-tag>
							</template>
						</el-table-column>
						<el-table-column prop="Remarks" label="备注" width="180">
							<template slot-scope="scope">
								{{scope.row.Remarks}}
							</template>
						</el-table-column>
						<el-table-column prop="date" label="车型" width="180">
							<template slot-scope="scope">
								{{scope.row.CarModel}}
							</template>
						</el-table-column>
						<el-table-column prop="date" label="颜色" width="180">
							<template slot-scope="scope">
								{{scope.row.CarColour}}
							</template>
						</el-table-column>
						<el-table-column prop="date" label="划痕" width="180">
							<template slot-scope="scope">
								{{scope.row.Scratch}}
							</template>
						</el-table-column>
						<el-table-column prop="date" label="腐蚀" width="180">
							<template slot-scope="scope">
								{{scope.row.Corrosion}}
							</template>
						</el-table-column>
						<el-table-column prop="date" label="破损" width="180">
							<template slot-scope="scope">
								{{scope.row.BeDamaged}}
							</template>
						</el-table-column>
						<el-table-column prop="date" label="飞漆" width="180">
							<template slot-scope="scope">
								{{scope.row.FlyingPaint}}
							</template>
						</el-table-column>
						<el-table-column prop="date" label="地址" width="180">
							<template slot-scope="scope">
								{{scope.row.Address}}
							</template>
						</el-table-column>
						<el-table-column prop="date" label="预约时间" width="180">
							<template slot-scope="scope">
								{{scope.row.MakeTime}}
							</template>
						</el-table-column>
						<el-table-column prop="date" label="添加时间" width="180" v-if="false">
							<template slot-scope="scope">
								{{scope.row.AddTime}}
							</template>
						</el-table-column>
						<el-table-column prop="ResultTime" label="付款时间" width="180">
							<template slot-scope="scope">
								<!-- {{scope.row.RecordTime}} -->
								{{scope.row.State==2?scope.row.ResultTime:''}}
							</template>
						</el-table-column>
					</el-table>
					<el-pagination background layout="prev, pager, next" :total="formCustomer.TotalCount"
						@current-page="PagesCustomer" style="text-align:right;margin-top:10px;">
					</el-pagination>
				</div>
			</el-collapse-item>
			<el-collapse-item title="专员推广" name="2">
				<div class="xj">
					<!-- 经理下级专员 -->
					<el-table :data="ManageData" style="width: 100%;">
						<el-table-column prop="date" label="ID" >
							<template slot-scope="scope">
								{{scope.row.id}}
							</template>
						</el-table-column>
						<el-table-column prop="beijintupian" label="头像">
							<template slot-scope="scope">
								<img :src="scope.row.beijintupian" style="width: 40px;height: 40px;" />
							</template>
						</el-table-column>
						<el-table-column prop="username" label="微信名" >
							<template slot-scope="scope">
								{{scope.row.username}}
							</template>
						</el-table-column>
						<el-table-column prop="phone" label="手机号" >
							<template slot-scope="scope">
								{{scope.row.phone}}
							</template>
						</el-table-column>
						<el-table-column prop="type" label="用户角色" >
							<template slot-scope="scope">
								<el-tag type="success">
									{{scope.row.type==0?'超级管理员':scope.row.type==1?'管理员':scope.row.type==2?'普通用户':scope.row.type==3?'推广专员':scope.row.type==4?'客户经理':'未知'}}
								</el-tag>
							</template>
						</el-table-column>
						<el-table-column prop="full_name" label="别名" >
							<template slot-scope="scope">
								{{scope.row.full_name}}
							</template>
						</el-table-column>
						<el-table-column prop="remark" label="备注" >
							<template slot-scope="scope">
								{{scope.row.remark}}
							</template>
						</el-table-column>
						<el-table-column prop="remark" label="查看推广" >
							<template slot-scope="scope">
								<el-button type="primary" @click="SelectW(scope.row.id)">查看推广</el-button>
							</template>
						</el-table-column>

					</el-table>
					
					<!-- 下级推广数据 -->
					<el-form :inline="true" :model="formCustomerW" class="demo-form-inline" style="margin-top:20px;">
						<el-form-item label="开始日期">
							<el-date-picker v-model="formCustomerW.StartResultTime" type="datetime" placeholder="开始日期">
							</el-date-picker>
						</el-form-item>
						<el-form-item label="结束日期">
							<el-date-picker v-model="formCustomerW.EndResultTime" type="datetime" placeholder="结束日期">
							</el-date-picker>
						</el-form-item>
						<el-form-item label="状态">
							<el-select v-model="formCustomerW.RecordState" placeholder="预约状态">
								<el-option label="查所有" value="-1"></el-option>
								<el-option label="已预约" value="0"></el-option>
								<el-option label="已取消" value="1"></el-option>
								<el-option label="已完成" value="2"></el-option>
							</el-select>
						</el-form-item>
						<el-form-item>
							<el-button type="primary" @click="onSubmitSub">查询</el-button>
						</el-form-item>
					</el-form>
					<!-- 下级数据展示 -->
					<el-table :data="SubData" style="width: 100%">
						<el-table-column prop="date" label="ID">
							<template slot-scope="scope">
								{{scope.row.Id}}
							</template>
						</el-table-column>
						<el-table-column prop="beijintupian" label="头像">
							<template slot-scope="scope">
								<img :src="scope.row.beijintupian" style="width: 40px;height: 40px;" />
							</template>
						</el-table-column>
						<el-table-column prop="RecordName" label="微信名">
							<template slot-scope="scope">
								{{scope.row.RecordName}}
							</template>
						</el-table-column>
						<el-table-column prop="RecordPhone" label="电话号码">
							<template slot-scope="scope">
								{{scope.row.RecordPhone}}
							</template>
						</el-table-column>
						<el-table-column prop="date" label="用户名">
							<template slot-scope="scope">
								{{scope.row.UserName}}
							</template>
						</el-table-column>
						<el-table-column prop="UserId" label="用户ID" >
							<template slot-scope="scope">
								{{scope.row.UserId}}
							</template>
						</el-table-column>
						<el-table-column prop="CarId" label="车辆ID" v-if="false">
							<template slot-scope="scope">
								{{scope.row.CarId}}
							</template>
						</el-table-column>

						<el-table-column prop="date" label="状态" >
							<template slot-scope="scope">
								<el-tag type="success">
									{{scope.row.State==0?'已预约':scope.row.State==1?'已取消':scope.row.State==2?'已完成':'未知'}}
								</el-tag>
							</template>
						</el-table-column>
						<el-table-column prop="Remarks" label="备注" >
							<template slot-scope="scope">
								{{scope.row.Remarks}}
							</template>
						</el-table-column>
						<el-table-column prop="date" label="车型" >
							<template slot-scope="scope">
								{{scope.row.CarModel}}
							</template>
						</el-table-column>
						<el-table-column prop="date" label="颜色" >
							<template slot-scope="scope">
								{{scope.row.CarColour}}
							</template>
						</el-table-column>
						<el-table-column prop="date" label="划痕" >
							<template slot-scope="scope">
								{{scope.row.Scratch}}
							</template>
						</el-table-column>
						<el-table-column prop="date" label="腐蚀" >
							<template slot-scope="scope">
								{{scope.row.Corrosion}}
							</template>
						</el-table-column>
						<el-table-column prop="date" label="破损" >
							<template slot-scope="scope">
								{{scope.row.BeDamaged}}
							</template>
						</el-table-column>
						<el-table-column prop="date" label="飞漆" >
							<template slot-scope="scope">
								{{scope.row.FlyingPaint}}
							</template>
						</el-table-column>
						<el-table-column prop="date" label="地址" >
							<template slot-scope="scope">
								{{scope.row.Address}}
							</template>
						</el-table-column>
						<el-table-column prop="date" label="预约时间" >
							<template slot-scope="scope">
								{{scope.row.MakeTime}}
							</template>
						</el-table-column>
						<el-table-column prop="date" label="添加时间" v-if="false">
							<template slot-scope="scope">
								{{scope.row.AddTime}}
							</template>
						</el-table-column>
						<el-table-column prop="ResultTime" label="付款时间">
							<template slot-scope="scope">
								<!-- {{scope.row.RecordTime}} -->
								{{scope.row.State==2?scope.row.ResultTime:''}}
							</template>
						</el-table-column>
					</el-table>
					<el-pagination background layout="prev, pager, next" :total="formCustomer.TotalCount"
						@current-page="PagesCustomer" style="text-align:right;margin-top:10px;">
					</el-pagination>
				</div>
			</el-collapse-item>

		</el-collapse>
</div>
<div class="footer" v-else>链接已失效</div>
	</div>
</template>

<script>
	import {
		GetRecordByCustomerX
	} from '../../api/AppointmentRecord.js'
	import utils from '../../utils/utils.js'
	import {
		GetCommissionerByManage
	} from '../../api/user.js'
	import {GetPartnerById} from '../../api/Partner.js'
	import {
		GetUserList
	} from '../../api/partneruser.js'
	export default {
		data() {
			return {
				// 0--展示折叠面板  1--不展示折叠面板
				isshow:1,
				Direct: [],
				// 获取某个用户下面的客户所有预约情况
				formCustomer: {
					"StartResultTime": "",
					"EndResultTime": "",
					"UserId": 0,
					"RecordState": '查所有',
					"KeyWord": "",
					"TotalCount": 0,
					"PageIndex": 1,
					"PageSize": 20,
					"Sort": [{
						"Field": "id",
						"Type": 0
					}]
				},
				// 获取某个销售专员下的客户所有预约情况
				formCustomerW: {
					"StartResultTime": "",
					"EndResultTime": "",
					"UserId": 0,
					"RecordState": '查所有',
					"KeyWord": "",
					"TotalCount": 0,
					"PageIndex": 1,
					"PageSize": 20,
					"Sort": [{
						"Field": "id",
						"Type": 0
					}]
				},
				tableData: [],
				model: {
					"id": 0,
					"KeyWord": "",
					"TotalCount": 0,
					"PageIndex": 1,
					"PageSize": 20,
					"Sort": [{
						"Field": "id",
						"Type": 0
					}]
				},
				// 销售经理ID
				ManageUserId: {
					UserId: 0,
				},
				// 销售专员数据
				ManageData: [],
				// 销售专员的下级推广数据
				SubData: [],
				//0---展示数据   1---隐藏数据 失效
				isshow:0,
				// 链接失效与否 0--不失效  1--失效
				isshowView:0,
			}
		},
		created() {
			this.model.id =utils.Decrypt(this.$route.query.id)
			console.log('数据',this.$route.query.id)
			console.log('数据2',this.model.id)
			this.SetShow(this.model.id)
			this.ShowManager()
		},
		methods: {
			//根据过期时间显示隐藏
			SetShow(id){
				GetPartnerById(id).then(res=>{
					console.log('时间',res)
					if(res.data.code==200){
							// 没过期
							this.isshowView=0
						}else{
							// 过期了
							this.isshowView=1
						}
						console.log('状态',this.isshow)
				})
			},
			// 直推提交查询
			onSubmitTime() {
				this.ShowZT()
			},
			// 下级提交查询
			onSubmitSub() {
				this.GetSubData()
			},
			// 查看销售经理下的销售专员
			SelectOrderW(id) {
				this.ManageUserId.UserId = id
				GetCommissionerByManage(this.ManageUserId).then(res => {
					console.log('查询客户经理下的推广专员数据', res)
					if (res.data.code == 200) {
						if(res.data.data.length==0){
							this.$message.error('暂无下级推广专员')
						}else{
							this.$message.success('查询下级推广专员成功')
						this.ManageData = res.data.data
						}
					} else {
						this.$message.error(res.data.message)
					}
				})
			},
			// 查看推广专员下的所有预约情况 id=推广专员
			SelectW(id) {
				this.formCustomerW.RecordState=-1
				this.formCustomerW.UserId = id
				console.log('wwww')
				GetRecordByCustomerX(this.formCustomerW).then(res => {
					console.log('查询出的数据', res)
					if(res.data.code==200){
						this.$message.success('查询下级成功')
					if (res.data.data.total == 0) {
						this.$message.error('暂无下级预约数据')
					} else {
						res.data.data.rows.forEach((item, index) => {
							item.ResultTime = utils.formatTime(item.ResultTime, "yyyy-MM-dd HH:mm:ss")
							item.AddTime = utils.formatTime(item.AddTime, "yyyy-MM-dd HH:mm:ss")
							item.MakeTime = utils.formatTime(item.MakeTime, "yyyy-MM-dd HH:mm:ss")
							
						})
						this.SubData = res.data.data.rows
						this.formCustomerW.TotalCount = res.data.data.total
					}
					}else{
						this.$message.error('查询下级失败')
					}
				})
			},
			// 查询
			GetSubData(){
				GetRecordByCustomerX(this.formCustomerW).then(res => {
					console.log('查询出的数据', res)
					if (res.data.data.total == 0) {
						this.$message.error('暂无下级预约数据')
						this.SubData=[]
					} else {
						res.data.data.rows.forEach((item, index) => {
							item.ResultTime = utils.formatTime(item.ResultTime, "yyyy-MM-dd HH:mm:ss")
							item.AddTime = utils.formatTime(item.AddTime, "yyyy-MM-dd HH:mm:ss")
							item.MakeTime = utils.formatTime(item.MakeTime, "yyyy-MM-dd HH:mm:ss")
						})
						this.SubData = res.data.data.rows
						this.formCustomerW.TotalCount = res.data.data.total
					}
				})
			},
			// 查看直推订单
			SelectOrder(id) {
				// 销售经理id传给查询销售专员接口
				this.formCustomer.UserId = id
				this.formCustomer.RecordState = -1
				GetRecordByCustomerX(this.formCustomer).then(res => {
					console.log('直推', res)
					if (res.data.data.total == 0) {
						this.$message.error('暂无下级预约数据')
					} else {
						res.data.data.rows.forEach((item, index) => {
							item.ResultTime = utils.formatTime(item.ResultTime, "yyyy-MM-dd HH:mm:ss")
							item.AddTime = utils.formatTime(item.AddTime, "yyyy-MM-dd HH:mm:ss")
							item.MakeTime = utils.formatTime(item.MakeTime, "yyyy-MM-dd HH:mm:ss")
						})
						this.Direct = res.data.data.rows
						this.formCustomer.TotalCount = res.data.data.total
					}
				})
			},
			//展示直推用户
			ShowZT() {
				GetRecordByCustomerX(this.formCustomer).then(res => {
					console.log('直推', res)
					res.data.data.rows.forEach((item, index) => {
						item.ResultTime = utils.formatTime(item.ResultTime, "yyyy-MM-dd HH:mm:ss")
						item.AddTime = utils.formatTime(item.AddTime, "yyyy-MM-dd HH:mm:ss")
					})
					this.Direct = res.data.data.rows
					this.formCustomer.TotalCount = res.data.data.total
				})
			},
			Pages(e) {
				this.model.PageIndex = e
				this.ShowManager()
			},
			PagesCustomer(e) {
				this.formCustomer.PageIndex = e
				this.ShowZT()
			},
			// 查询销售经理
			ShowManager() {
				GetUserList(this.model).then(res => {
					console.log('数据', res)
					if(res.data.data.total>0){
						this.isshow=0
					res.data.data.rows.forEach((item, index) => {
						item.add_time = utils.formatTime(item.add_time, "yyyy-MM-dd HH:mm:ss")
					})
					this.tableData = res.data.data.rows
					this.model.TotalCount = res.data.data.total
					}else{
						this.isshow=1
					}
				})
			},
			onSubmit() {
				this.ShowManager()
			}
		}
	}
</script>

<style>
	.footer{
		padding: 10px;
	}
</style>