提交代码

pull/1/head
胡锐 2 years ago
parent f04b2272a8
commit 0fba1e3e77
  1. 7
      src/app/admin/discount-package/discount-package-list/discount-package-list.component.html
  2. 30
      src/app/admin/discount-package/discount-package-list/discount-package-list.component.ts
  3. 7
      src/app/services/discount-package.service.ts

@ -114,7 +114,7 @@
<li class="li-a" *ngIf="data.status == 2 || data.status == 3" nz-menu-item><a (click)="upDiscountPackage(data.id)" >上架</a></li> <li class="li-a" *ngIf="data.status == 2 || data.status == 3" nz-menu-item><a (click)="upDiscountPackage(data.id)" >上架</a></li>
<li class="li-a" *ngIf="data.status == 1" nz-menu-item><a (click)="downDiscountPackage(data.id)">下架</a></li> <li class="li-a" *ngIf="data.status == 1" nz-menu-item><a (click)="downDiscountPackage(data.id)">下架</a></li>
<li class="li-a" *ngIf="data.status == 2 || data.status == 3" nz-menu-item><a (click)="deleteDiscountPackage(data.id)">删除</a></li> <li class="li-a" *ngIf="data.status == 2 || data.status == 3" nz-menu-item><a (click)="deleteDiscountPackage(data.id)">删除</a></li>
<li class="li-a" nz-menu-item><a (click)="showDeliverUserModal(data.id, data.title)">赠送用户</a></li> <li class="li-a" *ngIf="data.status == 1" nz-menu-item><a (click)="showDeliverUserModal(data.id, data.title)">赠送用户</a></li>
</ul> </ul>
</nz-dropdown-menu> </nz-dropdown-menu>
</td> </td>
@ -197,7 +197,8 @@
</div> </div>
</div> </div>
</form> </form>
<span nz-typography nzType="danger">注意:提交赠送时系统会自动过滤 ”有误“ 和 ”重复“ 的数据,有误的数据不会赠送卷包。</span> <span nz-typography nzType="danger">注意:提交赠送时系统会自动过滤 ”有误“ 和 ”重复“ 的数据,有误的数据不会赠送卷包。</span><br>
<span nz-typography >共计 {{deliverUserArray.length}} 条数据</span>
<nz-table #deliverUserTable [nzData]="deliverUserArray" [nzFrontPagination]="true"> <nz-table #deliverUserTable [nzData]="deliverUserArray" [nzFrontPagination]="true">
<thead> <thead>
<tr> <tr>
@ -250,6 +251,7 @@
</nz-modal> </nz-modal>
<nz-modal [(nzVisible)]="excelUserModal" nzTitle="导入用户" (nzOnCancel)="closeExcelUserModal()" [nzFooter]="null" nzWidth="450"> <nz-modal [(nzVisible)]="excelUserModal" nzTitle="导入用户" (nzOnCancel)="closeExcelUserModal()" [nzFooter]="null" nzWidth="450">
<nz-spin nzTip="{{spinObject.title}}" [nzSpinning]="spinObject.status">
<span *ngIf="deliverUserArray.length > 0" nz-typography nzType="danger">注意:导入用户会清空现有列表中的数据。 </span> <span *ngIf="deliverUserArray.length > 0" nz-typography nzType="danger">注意:导入用户会清空现有列表中的数据。 </span>
<div nz-row [nzGutter]="24"> <div nz-row [nzGutter]="24">
<div nz-col [nzSpan]="24"> <div nz-col [nzSpan]="24">
@ -274,4 +276,5 @@
<button nz-button style="width: 150px;" (click)="submitExcelUser()" [nzType]="'primary'">确定</button> <button nz-button style="width: 150px;" (click)="submitExcelUser()" [nzType]="'primary'">确定</button>
</div> </div>
</div> </div>
</nz-spin>
</nz-modal> </nz-modal>

@ -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,9 +226,21 @@ 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 => {
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; this.deliverUserModal = true;
} }
}
});
}
// 关闭 发送优惠券包给用户模态框 // 关闭 发送优惠券包给用户模态框
closeDeliverUserModal() { closeDeliverUserModal() {
@ -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']);
} }
}); });

@ -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) { public giveAway(paramsObject: object, callBack) {
this.http.post(environment.baseUrl + 'highDiscountPackage/giveAway', paramsObject).subscribe(data => { this.http.post(environment.baseUrl + 'highDiscountPackage/giveAway', paramsObject).subscribe(data => {
callBack(data); callBack(data);
@ -212,4 +218,5 @@ export class DiscountPackageService {
} }
} }

Loading…
Cancel
Save