|
|
@ -33,6 +33,7 @@ export class DiscountPackageListComponent implements OnInit { |
|
|
|
|
|
|
|
|
|
|
|
deliverUserAddForm: FormGroup; |
|
|
|
deliverUserAddForm: FormGroup; |
|
|
|
deliverUserAddModal = false; |
|
|
|
deliverUserAddModal = false; |
|
|
|
|
|
|
|
userInterval; |
|
|
|
|
|
|
|
|
|
|
|
deliverUserSearchForm: FormGroup; |
|
|
|
deliverUserSearchForm: FormGroup; |
|
|
|
deliverUserModal = false; |
|
|
|
deliverUserModal = false; |
|
|
@ -225,8 +226,20 @@ export class DiscountPackageListComponent implements OnInit { |
|
|
|
|
|
|
|
|
|
|
|
// 打开 发送优惠券包给用户模态框
|
|
|
|
// 打开 发送优惠券包给用户模态框
|
|
|
|
showDeliverUserModal(packageId: number, packageName: string) { |
|
|
|
showDeliverUserModal(packageId: number, packageName: string) { |
|
|
|
this.deliverUserForm.patchValue({ packageId: packageId, packageName: packageName}) |
|
|
|
this.discountPackage.getHandleByPackageId({ packageId: packageId}, data => { |
|
|
|
this.deliverUserModal = true; |
|
|
|
if (data['return_code'] === '000000') { |
|
|
|
|
|
|
|
if (data['return_data'] != null) { |
|
|
|
|
|
|
|
this.modal.confirm({ |
|
|
|
|
|
|
|
nzTitle: '提示', |
|
|
|
|
|
|
|
nzContent: '当前卷包有赠送任务进行中,是否查看赠送进度?', |
|
|
|
|
|
|
|
nzOnOk: () => this.processRate(data['return_data']['serialNumber']) |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
this.deliverUserForm.patchValue({ packageId: packageId, packageName: packageName}); |
|
|
|
|
|
|
|
this.deliverUserModal = true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 关闭 发送优惠券包给用户模态框
|
|
|
|
// 关闭 发送优惠券包给用户模态框
|
|
|
@ -247,6 +260,7 @@ export class DiscountPackageListComponent implements OnInit { |
|
|
|
|
|
|
|
|
|
|
|
// 关闭导入模态框
|
|
|
|
// 关闭导入模态框
|
|
|
|
closeExcelUserModal() { |
|
|
|
closeExcelUserModal() { |
|
|
|
|
|
|
|
this.spinObject.status = false; |
|
|
|
this.excelUploadBtn = true; |
|
|
|
this.excelUploadBtn = true; |
|
|
|
this.excelUploadFile = []; |
|
|
|
this.excelUploadFile = []; |
|
|
|
this.excelUserModal = false; |
|
|
|
this.excelUserModal = false; |
|
|
@ -260,12 +274,15 @@ export class DiscountPackageListComponent implements OnInit { |
|
|
|
this.deliverUserForm.patchValue({ phoneArray: this.deliverUserArray.filter(o => o.errorStatus == false)}); |
|
|
|
this.deliverUserForm.patchValue({ phoneArray: this.deliverUserArray.filter(o => o.errorStatus == false)}); |
|
|
|
this.spinObject.status = true; |
|
|
|
this.spinObject.status = true; |
|
|
|
this.spinObject.title = '处理中...'; |
|
|
|
this.spinObject.title = '处理中...'; |
|
|
|
this.discountPackage.giveAway(this.deliverUserForm.value, data => { |
|
|
|
const param = this.deliverUserForm.value; |
|
|
|
|
|
|
|
this.closeDeliverUserModal(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.discountPackage.giveAway(param, data => { |
|
|
|
if (data['return_code'] === '000000') { |
|
|
|
if (data['return_code'] === '000000') { |
|
|
|
this.serialNumber = data['return_data']; |
|
|
|
this.serialNumber = data['return_data']; |
|
|
|
this.closeDeliverUserModal(); |
|
|
|
|
|
|
|
this.processRate(this.serialNumber); |
|
|
|
this.processRate(this.serialNumber); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
|
|
|
|
this.showDeliverUserModal(this.deliverUserForm.controls.packageId.value, this.deliverUserForm.controls.packageName.value); |
|
|
|
this.message.create('error', data['return_msg']); |
|
|
|
this.message.create('error', data['return_msg']); |
|
|
|
this.spinObject.status = false; |
|
|
|
this.spinObject.status = false; |
|
|
|
} |
|
|
|
} |
|
|
@ -275,24 +292,27 @@ export class DiscountPackageListComponent implements OnInit { |
|
|
|
// 处理进度
|
|
|
|
// 处理进度
|
|
|
|
processRate(serialNum: string) { |
|
|
|
processRate(serialNum: string) { |
|
|
|
this.spinObject.status = true; |
|
|
|
this.spinObject.status = true; |
|
|
|
let time = setInterval(() => this.commonsService.getRedisValueByType(serialNum, data => { |
|
|
|
this.userInterval = setInterval(() => this.commonsService.getRedisValueByType(serialNum, data => { |
|
|
|
if (data['return_data'] != null) { |
|
|
|
if (data['return_data'] != null) { |
|
|
|
this.spinObject.title = '已处理' + data['return_data'] + '条数据'; |
|
|
|
this.spinObject.title = '已处理' + data['return_data'] + '条数据'; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
this.spinObject.status = false; |
|
|
|
this.spinObject.status = false; |
|
|
|
clearTimeout(time); |
|
|
|
|
|
|
|
this.getRequest(true, this.searchForm.value); |
|
|
|
this.getRequest(true, this.searchForm.value); |
|
|
|
|
|
|
|
clearTimeout(this.userInterval); |
|
|
|
} |
|
|
|
} |
|
|
|
}), 1000); |
|
|
|
}), 1000); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 提交excel数据
|
|
|
|
// 提交excel数据
|
|
|
|
submitExcelUser() { |
|
|
|
submitExcelUser() { |
|
|
|
|
|
|
|
this.spinObject.title = '文件导入中... 数据太多会占用较长时间'; |
|
|
|
|
|
|
|
this.spinObject.status = true; |
|
|
|
this.discountPackage.getPhoneListByFileUrl({ fileUrl: this.excelUploadFile[0]['url']}, data => { |
|
|
|
this.discountPackage.getPhoneListByFileUrl({ fileUrl: this.excelUploadFile[0]['url']}, data => { |
|
|
|
if (data['return_code'] === '000000') { |
|
|
|
if (data['return_code'] === '000000') { |
|
|
|
this.deliverUserArray = data['return_data']['data']; |
|
|
|
this.deliverUserArray = data['return_data']['data']; |
|
|
|
this.closeExcelUserModal(); |
|
|
|
this.closeExcelUserModal(); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
|
|
|
|
this.spinObject.status = false; |
|
|
|
this.message.error(data['return_msg']); |
|
|
|
this.message.error(data['return_msg']); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|