|
|
|
@ -10,207 +10,223 @@ import {RechargeService} from '../../../services/recharge.service'; |
|
|
|
|
import {NzMessageService, NzModalService, NzNotificationService, NzUploadChangeParam} from 'ng-zorro-antd'; |
|
|
|
|
import {FormBuilder, FormGroup, Validators} from '@angular/forms'; |
|
|
|
|
import {Router} from '@angular/router'; |
|
|
|
|
import {ADMIN_INFO_OBJECT} from "../../../services/local-storage.namespace"; |
|
|
|
|
import {CompanyService} from "../../../services/company.service"; |
|
|
|
|
import {MerchantService} from "../../../services/merchant.service"; |
|
|
|
|
import {LocalStorageService} from "../../../services/local-storage.service"; |
|
|
|
|
|
|
|
|
|
@Component({ |
|
|
|
|
selector: 'app-order-list', |
|
|
|
|
templateUrl: './order-list.component.html', |
|
|
|
|
styleUrls: ['./order-list.component.scss'] |
|
|
|
|
selector: 'app-order-list', |
|
|
|
|
templateUrl: './order-list.component.html', |
|
|
|
|
styleUrls: ['./order-list.component.scss'] |
|
|
|
|
}) |
|
|
|
|
export class OrderListComponent implements OnInit , OnDestroy { |
|
|
|
|
FILE_URL = environment.imageUrl; |
|
|
|
|
WEB_SERVE_URL = environment.baseUrl; |
|
|
|
|
searchForm: FormGroup; // 搜索框
|
|
|
|
|
validateForm: FormGroup; // 添加框
|
|
|
|
|
requestData = []; // 列表数据
|
|
|
|
|
childData = []; // 列表数据
|
|
|
|
|
importErrorStudentArray = []; |
|
|
|
|
errorStudentVisible = false; |
|
|
|
|
isVisibleChild = false; |
|
|
|
|
total: number; // 页码
|
|
|
|
|
pageNum = 1; // 页码
|
|
|
|
|
pageSize = 10; // 条码
|
|
|
|
|
loading = true; |
|
|
|
|
isVisible = false; |
|
|
|
|
id: number; |
|
|
|
|
edit = false; |
|
|
|
|
data = {}; |
|
|
|
|
private timer; // 定时器
|
|
|
|
|
constructor( |
|
|
|
|
private form: FormBuilder, |
|
|
|
|
private recharge: RechargeService, |
|
|
|
|
private discount: DiscountService, |
|
|
|
|
private modal: NzModalService, |
|
|
|
|
private coupon: CouponService, |
|
|
|
|
private iconService: IconService, |
|
|
|
|
private message: NzMessageService, |
|
|
|
|
private router: Router, |
|
|
|
|
private notification: NzNotificationService, |
|
|
|
|
private common: CommonsService |
|
|
|
|
) { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
ngOnInit(): void { |
|
|
|
|
this.init(); |
|
|
|
|
// this.timer = setInterval(() => { // 设置定时刷新事件,每隔1分钟刷新
|
|
|
|
|
// this.recharge.countOrder(data => {
|
|
|
|
|
// if (data['return_data'] > 0) {
|
|
|
|
|
// this.getRequest(true, this.searchForm.value);
|
|
|
|
|
// this.notification.info(
|
|
|
|
|
// '充值订单',
|
|
|
|
|
// '您有' + data['return_data'] + '条未充值的订单,请尽快充值,点击可查看未充值订单!'
|
|
|
|
|
// ).onClick.subscribe(() => {
|
|
|
|
|
// this.searchForm.value.status = 2;
|
|
|
|
|
// this.getRequest(true, this.searchForm.value);
|
|
|
|
|
// });
|
|
|
|
|
// }
|
|
|
|
|
// });
|
|
|
|
|
// }, 10000);
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 销毁
|
|
|
|
|
ngOnDestroy() { |
|
|
|
|
if (this.timer) { |
|
|
|
|
clearInterval(this.timer); |
|
|
|
|
export class OrderListComponent implements OnInit, OnDestroy { |
|
|
|
|
FILE_URL = environment.imageUrl; |
|
|
|
|
WEB_SERVE_URL = environment.baseUrl; |
|
|
|
|
searchForm: FormGroup; // 搜索框
|
|
|
|
|
validateForm: FormGroup; // 添加框
|
|
|
|
|
requestData = []; // 列表数据
|
|
|
|
|
childData = []; // 列表数据
|
|
|
|
|
importErrorStudentArray = []; |
|
|
|
|
errorStudentVisible = false; |
|
|
|
|
isVisibleChild = false; |
|
|
|
|
total: number; // 页码
|
|
|
|
|
pageNum = 1; // 页码
|
|
|
|
|
pageSize = 10; // 条码
|
|
|
|
|
loading = true; |
|
|
|
|
isVisible = false; |
|
|
|
|
id: number; |
|
|
|
|
edit = false; |
|
|
|
|
data = {}; |
|
|
|
|
roleType: number; |
|
|
|
|
companyData = []; // 列表数据
|
|
|
|
|
private timer; // 定时器
|
|
|
|
|
constructor( |
|
|
|
|
private form: FormBuilder, |
|
|
|
|
private recharge: RechargeService, |
|
|
|
|
private discount: DiscountService, |
|
|
|
|
private modal: NzModalService, |
|
|
|
|
private coupon: CouponService, |
|
|
|
|
private iconService: IconService, |
|
|
|
|
private message: NzMessageService, |
|
|
|
|
private company: CompanyService, |
|
|
|
|
private store: LocalStorageService, // 数据请求
|
|
|
|
|
) { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public init(): void { |
|
|
|
|
this.searchForm = this.form.group({ |
|
|
|
|
payStatus: [null], // 支付状态
|
|
|
|
|
rechargeStatus: [null], // 充值状态
|
|
|
|
|
orderNo: [null], // 订单号
|
|
|
|
|
operatorType: [null], // 运营商类型
|
|
|
|
|
laborUnionCard: [null], // 工会卡号
|
|
|
|
|
rechargeContent: [null], // 充值内容
|
|
|
|
|
userPhone: [null], // 用户电话
|
|
|
|
|
rechargeType: [null], // 充值类型
|
|
|
|
|
payTime: [null], // 支付时间
|
|
|
|
|
payType: [null], // 支付方式
|
|
|
|
|
createTime: [null], // 创建时间
|
|
|
|
|
}); |
|
|
|
|
this.validateForm = this.form.group({ |
|
|
|
|
type: [null, [Validators.required]], |
|
|
|
|
price: [null, [Validators.required]], |
|
|
|
|
realPrice: [null, [Validators.required]], |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
this.getRequest(true, this.searchForm.value); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 查询列表
|
|
|
|
|
public getRequest(reset: boolean = false, whereObject: object) { |
|
|
|
|
if (whereObject['payTime'] != null && whereObject['payTime'].length !== 0) { |
|
|
|
|
whereObject['payTimeS'] = whereObject['payTime'][0].getTime(); |
|
|
|
|
whereObject['payTimeE'] = whereObject['payTime'][1].getTime(); |
|
|
|
|
|
|
|
|
|
ngOnInit(): void { |
|
|
|
|
this.init(); |
|
|
|
|
this.roleType = this.store.get(ADMIN_INFO_OBJECT)['secRole']['roleType']; |
|
|
|
|
const whereObject = {}; |
|
|
|
|
whereObject['pageNum'] = 1; |
|
|
|
|
whereObject['pageSize'] = 10000; |
|
|
|
|
this.company.selectCompanyList(whereObject, data => { |
|
|
|
|
if (data['return_code'] === '000000') { |
|
|
|
|
this.companyData = data['return_data'].list; |
|
|
|
|
} else { |
|
|
|
|
this.message.error(data['return_msg']); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
// this.timer = setInterval(() => { // 设置定时刷新事件,每隔1分钟刷新
|
|
|
|
|
// this.recharge.countOrder(data => {
|
|
|
|
|
// if (data['return_data'] > 0) {
|
|
|
|
|
// this.getRequest(true, this.searchForm.value);
|
|
|
|
|
// this.notification.info(
|
|
|
|
|
// '充值订单',
|
|
|
|
|
// '您有' + data['return_data'] + '条未充值的订单,请尽快充值,点击可查看未充值订单!'
|
|
|
|
|
// ).onClick.subscribe(() => {
|
|
|
|
|
// this.searchForm.value.status = 2;
|
|
|
|
|
// this.getRequest(true, this.searchForm.value);
|
|
|
|
|
// });
|
|
|
|
|
// }
|
|
|
|
|
// });
|
|
|
|
|
// }, 10000);
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 销毁
|
|
|
|
|
ngOnDestroy() { |
|
|
|
|
if (this.timer) { |
|
|
|
|
clearInterval(this.timer); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (whereObject['createTime'] != null && whereObject['createTime'].length !== 0) { |
|
|
|
|
whereObject['createTimeS'] = whereObject['createTime'][0].getTime(); |
|
|
|
|
whereObject['createTimeE'] = whereObject['createTime'][1].getTime(); |
|
|
|
|
public init(): void { |
|
|
|
|
this.searchForm = this.form.group({ |
|
|
|
|
payStatus: [null], // 支付状态
|
|
|
|
|
rechargeStatus: [null], // 充值状态
|
|
|
|
|
companyId: [null], // 充值状态
|
|
|
|
|
orderNo: [null], // 订单号
|
|
|
|
|
operatorType: [null], // 运营商类型
|
|
|
|
|
laborUnionCard: [null], // 工会卡号
|
|
|
|
|
rechargeContent: [null], // 充值内容
|
|
|
|
|
userPhone: [null], // 用户电话
|
|
|
|
|
rechargeType: [null], // 充值类型
|
|
|
|
|
payTime: [null], // 支付时间
|
|
|
|
|
payType: [null], // 支付方式
|
|
|
|
|
createTime: [null], // 创建时间
|
|
|
|
|
}); |
|
|
|
|
this.validateForm = this.form.group({ |
|
|
|
|
type: [null, [Validators.required]], |
|
|
|
|
price: [null, [Validators.required]], |
|
|
|
|
realPrice: [null, [Validators.required]], |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
this.getRequest(true, this.searchForm.value); |
|
|
|
|
} |
|
|
|
|
this.loading = false; |
|
|
|
|
if (reset) { |
|
|
|
|
this.pageNum = 1; |
|
|
|
|
|
|
|
|
|
// 查询列表
|
|
|
|
|
public getRequest(reset: boolean = false, whereObject: object) { |
|
|
|
|
if (whereObject['payTime'] != null && whereObject['payTime'].length !== 0) { |
|
|
|
|
whereObject['payTimeS'] = whereObject['payTime'][0].getTime(); |
|
|
|
|
whereObject['payTimeE'] = whereObject['payTime'][1].getTime(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (whereObject['createTime'] != null && whereObject['createTime'].length !== 0) { |
|
|
|
|
whereObject['createTimeS'] = whereObject['createTime'][0].getTime(); |
|
|
|
|
whereObject['createTimeE'] = whereObject['createTime'][1].getTime(); |
|
|
|
|
} |
|
|
|
|
this.loading = false; |
|
|
|
|
if (reset) { |
|
|
|
|
this.pageNum = 1; |
|
|
|
|
} |
|
|
|
|
whereObject['pageNum'] = this.pageNum; |
|
|
|
|
whereObject['pageSize'] = this.pageSize; |
|
|
|
|
this.recharge.getOrderList(whereObject, data => { |
|
|
|
|
if (data['return_code'] === '000000') { |
|
|
|
|
this.requestData = data['return_data'].list; |
|
|
|
|
this.total = data['return_data'].total; |
|
|
|
|
} else { |
|
|
|
|
this.message.error(data['return_msg']); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
whereObject['pageNum'] = this.pageNum; |
|
|
|
|
whereObject['pageSize'] = this.pageSize; |
|
|
|
|
this.recharge.getOrderList(whereObject, data => { |
|
|
|
|
if (data['return_code'] === '000000') { |
|
|
|
|
this.requestData = data['return_data'].list; |
|
|
|
|
this.total = data['return_data'].total; |
|
|
|
|
} else { |
|
|
|
|
this.message.error(data['return_msg']); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 重置
|
|
|
|
|
public resetForm(): void { |
|
|
|
|
this.searchForm.reset(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 详情
|
|
|
|
|
public getDetail(id: number): void { |
|
|
|
|
this.id = id; |
|
|
|
|
this.recharge.getOrderById(id , data => { |
|
|
|
|
if (data['return_code'] === '000000') { |
|
|
|
|
console.log(data); |
|
|
|
|
this.data = data['return_data']; |
|
|
|
|
} else { |
|
|
|
|
this.message.error(data['return_msg']); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
this.isVisible = true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
handleCancel(): void { |
|
|
|
|
this.isVisible = false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 下载模板
|
|
|
|
|
downloadTemplate(whereObject) { |
|
|
|
|
if (whereObject['payTime'] != null && whereObject['payTime'].length !== 0) { |
|
|
|
|
whereObject['payTimeS'] = whereObject['payTime'][0].getTime(); |
|
|
|
|
whereObject['payTimeE'] = whereObject['payTime'][1].getTime(); |
|
|
|
|
|
|
|
|
|
// 重置
|
|
|
|
|
public resetForm(): void { |
|
|
|
|
this.searchForm.reset(); |
|
|
|
|
} |
|
|
|
|
if (whereObject['createTime'] != null && whereObject['createTime'].length !== 0) { |
|
|
|
|
whereObject['createTimeS'] = whereObject['createTimeS'][0].getTime(); |
|
|
|
|
whereObject['createTimeE'] = whereObject['createTimeE'][1].getTime(); |
|
|
|
|
|
|
|
|
|
// 详情
|
|
|
|
|
public getDetail(id: number): void { |
|
|
|
|
this.id = id; |
|
|
|
|
this.recharge.getOrderById(id, data => { |
|
|
|
|
if (data['return_code'] === '000000') { |
|
|
|
|
console.log(data); |
|
|
|
|
this.data = data['return_data']; |
|
|
|
|
} else { |
|
|
|
|
this.message.error(data['return_msg']); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
this.isVisible = true; |
|
|
|
|
} |
|
|
|
|
this.recharge.exportOrderList(whereObject, data => { |
|
|
|
|
if (data['return_code'] === '000000') { |
|
|
|
|
window.location.href = this.FILE_URL + data['return_data']; |
|
|
|
|
} else { |
|
|
|
|
this.message.error(data['return_msg']); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
handleChange(info: NzUploadChangeParam): void { |
|
|
|
|
if (info.file.status === 'done') { |
|
|
|
|
if (info.file.response.return_code === '000000') { |
|
|
|
|
this.loading = false; |
|
|
|
|
if (info.file.response.return_data == null || info.file.response.return_data.errorTotal === 0) { |
|
|
|
|
this.message.success('导入成功'); |
|
|
|
|
this.getRequest(true, this.searchForm.value); |
|
|
|
|
} else { |
|
|
|
|
this.modal.warning({ |
|
|
|
|
nzTitle: '提示', |
|
|
|
|
nzOkText: '查看失败数据', |
|
|
|
|
nzContent: '只有部分数据导入成功', |
|
|
|
|
nzOnOk: () => this.showErrorStudentModal(info.file.response.return_data) |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
handleCancel(): void { |
|
|
|
|
this.isVisible = false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 下载模板
|
|
|
|
|
downloadTemplate(whereObject) { |
|
|
|
|
if (whereObject['payTime'] != null && whereObject['payTime'].length !== 0) { |
|
|
|
|
whereObject['payTimeS'] = whereObject['payTime'][0].getTime(); |
|
|
|
|
whereObject['payTimeE'] = whereObject['payTime'][1].getTime(); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
this.loading = false; |
|
|
|
|
this.message.error(info.file.response.return_msg); |
|
|
|
|
} |
|
|
|
|
} else if (info.file.status === 'error') { |
|
|
|
|
this.message.error('上传错误'); |
|
|
|
|
if (whereObject['createTime'] != null && whereObject['createTime'].length !== 0) { |
|
|
|
|
whereObject['createTimeS'] = whereObject['createTimeS'][0].getTime(); |
|
|
|
|
whereObject['createTimeE'] = whereObject['createTimeE'][1].getTime(); |
|
|
|
|
} |
|
|
|
|
this.recharge.exportOrderList(whereObject, data => { |
|
|
|
|
if (data['return_code'] === '000000') { |
|
|
|
|
window.location.href = this.FILE_URL + data['return_data']; |
|
|
|
|
} else { |
|
|
|
|
this.message.error(data['return_msg']); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
handleChange(info: NzUploadChangeParam): void { |
|
|
|
|
if (info.file.status === 'done') { |
|
|
|
|
if (info.file.response.return_code === '000000') { |
|
|
|
|
this.loading = false; |
|
|
|
|
if (info.file.response.return_data == null || info.file.response.return_data.errorTotal === 0) { |
|
|
|
|
this.message.success('导入成功'); |
|
|
|
|
this.getRequest(true, this.searchForm.value); |
|
|
|
|
} else { |
|
|
|
|
this.modal.warning({ |
|
|
|
|
nzTitle: '提示', |
|
|
|
|
nzOkText: '查看失败数据', |
|
|
|
|
nzContent: '只有部分数据导入成功', |
|
|
|
|
nzOnOk: () => this.showErrorStudentModal(info.file.response.return_data) |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
this.loading = false; |
|
|
|
|
this.message.error(info.file.response.return_msg); |
|
|
|
|
} |
|
|
|
|
} else if (info.file.status === 'error') { |
|
|
|
|
this.message.error('上传错误'); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 打开模态框
|
|
|
|
|
showErrorStudentModal(data: []) { |
|
|
|
|
this.getRequest(true, this.searchForm.value); |
|
|
|
|
this.importErrorStudentArray = data['errorData']; |
|
|
|
|
this.errorStudentVisible = true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 查询子订单
|
|
|
|
|
public getChildOrder(id: number): void { |
|
|
|
|
this.isVisibleChild = true; |
|
|
|
|
this.recharge.getChildOrder(id, data => { |
|
|
|
|
if (data['return_code'] === '000000') { |
|
|
|
|
this.childData = data['return_data']; |
|
|
|
|
} else { |
|
|
|
|
this.message.error(data['return_msg']); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 打开模态框
|
|
|
|
|
showErrorStudentModal(data: []) { |
|
|
|
|
this.getRequest(true, this.searchForm.value); |
|
|
|
|
this.importErrorStudentArray = data['errorData']; |
|
|
|
|
this.errorStudentVisible = true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 查询子订单
|
|
|
|
|
public getChildOrder(id: number): void { |
|
|
|
|
this.isVisibleChild = true; |
|
|
|
|
this.recharge.getChildOrder(id , data => { |
|
|
|
|
if (data['return_code'] === '000000') { |
|
|
|
|
this.childData = data['return_data']; |
|
|
|
|
} else { |
|
|
|
|
this.message.error(data['return_msg']); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|