-
+
diff --git a/src/app/admin/discount-package/discount-package-list/discount-package-list.component.ts b/src/app/admin/discount-package/discount-package-list/discount-package-list.component.ts
index 1f98e47..c22ed83 100644
--- a/src/app/admin/discount-package/discount-package-list/discount-package-list.component.ts
+++ b/src/app/admin/discount-package/discount-package-list/discount-package-list.component.ts
@@ -33,6 +33,7 @@ export class DiscountPackageListComponent implements OnInit {
deliverUserAddForm: FormGroup;
deliverUserAddModal = false;
+ userInterval;
deliverUserSearchForm: FormGroup;
deliverUserModal = false;
@@ -225,8 +226,20 @@ export class DiscountPackageListComponent implements OnInit {
// 打开 发送优惠券包给用户模态框
showDeliverUserModal(packageId: number, packageName: string) {
- this.deliverUserForm.patchValue({ packageId: packageId, packageName: packageName})
- this.deliverUserModal = true;
+ this.discountPackage.getHandleByPackageId({ packageId: packageId}, data => {
+ 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() {
+ this.spinObject.status = false;
this.excelUploadBtn = true;
this.excelUploadFile = [];
this.excelUserModal = false;
@@ -260,12 +274,15 @@ export class DiscountPackageListComponent implements OnInit {
this.deliverUserForm.patchValue({ phoneArray: this.deliverUserArray.filter(o => o.errorStatus == false)});
this.spinObject.status = true;
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') {
this.serialNumber = data['return_data'];
- this.closeDeliverUserModal();
this.processRate(this.serialNumber);
} else {
+ this.showDeliverUserModal(this.deliverUserForm.controls.packageId.value, this.deliverUserForm.controls.packageName.value);
this.message.create('error', data['return_msg']);
this.spinObject.status = false;
}
@@ -275,24 +292,27 @@ export class DiscountPackageListComponent implements OnInit {
// 处理进度
processRate(serialNum: string) {
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) {
this.spinObject.title = '已处理' + data['return_data'] + '条数据';
} else {
this.spinObject.status = false;
- clearTimeout(time);
this.getRequest(true, this.searchForm.value);
+ clearTimeout(this.userInterval);
}
}), 1000);
}
// 提交excel数据
submitExcelUser() {
+ this.spinObject.title = '文件导入中... 数据太多会占用较长时间';
+ this.spinObject.status = true;
this.discountPackage.getPhoneListByFileUrl({ fileUrl: this.excelUploadFile[0]['url']}, data => {
if (data['return_code'] === '000000') {
this.deliverUserArray = data['return_data']['data'];
this.closeExcelUserModal();
} else {
+ this.spinObject.status = false;
this.message.error(data['return_msg']);
}
});
diff --git a/src/app/services/discount-package.service.ts b/src/app/services/discount-package.service.ts
index c33f233..0c0db0d 100644
--- a/src/app/services/discount-package.service.ts
+++ b/src/app/services/discount-package.service.ts
@@ -205,6 +205,12 @@ export class DiscountPackageService {
});
}
+ public getHandleByPackageId(paramsObject: object, callBack) {
+ this.http.post(environment.baseUrl + 'highDiscountPackage/getHandleByPackageId', paramsObject).subscribe(data => {
+ callBack(data);
+ });
+ }
+
public giveAway(paramsObject: object, callBack) {
this.http.post(environment.baseUrl + 'highDiscountPackage/giveAway', paramsObject).subscribe(data => {
callBack(data);
@@ -212,4 +218,5 @@ export class DiscountPackageService {
}
+
}