|
|
|
@ -5,6 +5,7 @@ import {NzMessageService} from 'ng-zorro-antd'; |
|
|
|
|
import {IconService} from '../../../services/icon.service'; |
|
|
|
|
import {CommonsService} from '../../../services/commons.service'; |
|
|
|
|
import {environment} from '../../../../environments/environment'; |
|
|
|
|
import {OrderService} from '../../../services/order.service'; |
|
|
|
|
|
|
|
|
|
@Component({ |
|
|
|
|
selector: 'app-user-list', |
|
|
|
@ -20,11 +21,26 @@ export class UserListComponent implements OnInit { |
|
|
|
|
pageSize = 10; // 条码
|
|
|
|
|
loading = true; |
|
|
|
|
regTime; |
|
|
|
|
orderListModal = false; |
|
|
|
|
isVisible = false; |
|
|
|
|
orderListModalLoading = false; |
|
|
|
|
requestOrderData = []; |
|
|
|
|
|
|
|
|
|
percent = 0; |
|
|
|
|
processRateInterval; |
|
|
|
|
FILE_URL = environment.imageUrl; |
|
|
|
|
|
|
|
|
|
userId; |
|
|
|
|
loadingObject = { |
|
|
|
|
title: '加载中...', |
|
|
|
|
status: false, |
|
|
|
|
}; |
|
|
|
|
serialNumber; |
|
|
|
|
constructor( |
|
|
|
|
private form: FormBuilder, |
|
|
|
|
private user: UserService, |
|
|
|
|
private iconService: IconService, |
|
|
|
|
private orderService: OrderService, |
|
|
|
|
private message: NzMessageService, |
|
|
|
|
private common: CommonsService |
|
|
|
|
) { |
|
|
|
@ -38,6 +54,7 @@ export class UserListComponent implements OnInit { |
|
|
|
|
this.searchForm = this.form.group({ |
|
|
|
|
name: [null], |
|
|
|
|
status: [null], |
|
|
|
|
isAgent: [null], |
|
|
|
|
phone: [null], |
|
|
|
|
regTime: [null], |
|
|
|
|
}); |
|
|
|
@ -104,4 +121,59 @@ export class UserListComponent implements OnInit { |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public getList(userId: string): void { |
|
|
|
|
this.orderListModalLoading = true; |
|
|
|
|
this.orderListModal = true; |
|
|
|
|
this.userId = userId; |
|
|
|
|
this.orderService.getPopularizeUserOrderList(userId , data => { |
|
|
|
|
this.orderListModalLoading = false; |
|
|
|
|
if (data['return_code'] === '000000') { |
|
|
|
|
this.requestOrderData = data['return_data']; |
|
|
|
|
} else { |
|
|
|
|
this.message.error(data['return_msg']); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public excelOrder() { |
|
|
|
|
const whereObject = {}; |
|
|
|
|
this.percent = 0; |
|
|
|
|
this.serialNumber = new Date().getTime(); |
|
|
|
|
whereObject['serialNumber'] = this.serialNumber; |
|
|
|
|
whereObject['promoteCode'] = this.userId; |
|
|
|
|
this.isVisible = true; |
|
|
|
|
this.processRate(this.serialNumber); |
|
|
|
|
this.orderService.exportPopularizeUserOrderList(whereObject, data => { |
|
|
|
|
if (data['return_code'] !== '000000') { |
|
|
|
|
this.isVisible = false; |
|
|
|
|
this.message.error(data['return_msg']); |
|
|
|
|
} |
|
|
|
|
this.loadingObject.status = false; |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 获取导出百分比
|
|
|
|
|
processRate(key: string) { |
|
|
|
|
this.processRateInterval = setInterval(() => this.common.getRedisValueByType(key, data => { |
|
|
|
|
this.percent = data['return_data']; |
|
|
|
|
if (this.percent === 100) { |
|
|
|
|
clearTimeout(this.processRateInterval); |
|
|
|
|
this.loadingObject.status = true; |
|
|
|
|
this.loadingObject.title = '下载中...'; |
|
|
|
|
const interval = setInterval(() => this.common.getRedisValueByType(key + 'download', download => { |
|
|
|
|
if (download['return_data'] != null) { |
|
|
|
|
this.message.success('下载成功!'); |
|
|
|
|
this.loadingObject.status = false; |
|
|
|
|
window.location.href = this.FILE_URL + 'temporary/' + download['return_data']; |
|
|
|
|
this.isVisible = false; |
|
|
|
|
clearTimeout(interval); |
|
|
|
|
} |
|
|
|
|
}), 100); |
|
|
|
|
} |
|
|
|
|
}), 300); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|