|
|
|
@ -37,6 +37,7 @@ export class AgentListComponent implements OnInit { |
|
|
|
|
pageSize = 10; // 条码
|
|
|
|
|
loading = true; |
|
|
|
|
isVisible = false; |
|
|
|
|
isVisibleDiscountPackage = false; |
|
|
|
|
isVisibleDiscount = false; |
|
|
|
|
isVisibleDistribute = false; |
|
|
|
|
isVisibleDistributeCoupons=false; |
|
|
|
@ -62,14 +63,21 @@ export class AgentListComponent implements OnInit { |
|
|
|
|
isOkLoading = false; |
|
|
|
|
isOkCouponsLoading=false; |
|
|
|
|
isVisibleShow = false; |
|
|
|
|
isVisiblePercent = false; |
|
|
|
|
percent = 0; |
|
|
|
|
dataSet; |
|
|
|
|
type: number; |
|
|
|
|
processRateInterval; |
|
|
|
|
loadingObject = { |
|
|
|
|
title: '加载中...', |
|
|
|
|
status: false, |
|
|
|
|
}; |
|
|
|
|
constructor( |
|
|
|
|
private form: FormBuilder, |
|
|
|
|
private agent: AgentService, |
|
|
|
|
private audit: AuditService, |
|
|
|
|
private discount: DiscountService, |
|
|
|
|
private coupon: CouponService, |
|
|
|
|
private iconService: IconService, |
|
|
|
|
private message: NzMessageService, |
|
|
|
|
private router: Router, |
|
|
|
|
private clipboardService: ClipboardService, |
|
|
|
@ -88,6 +96,7 @@ export class AgentListComponent implements OnInit { |
|
|
|
|
status: [null], |
|
|
|
|
type: [null], |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
this.validateForm = this.form.group({ |
|
|
|
|
discountId: [null, [Validators.required]], |
|
|
|
|
stockCount: [null, [Validators.required]], |
|
|
|
@ -217,6 +226,7 @@ export class AgentListComponent implements OnInit { |
|
|
|
|
this.getRequestDiscount(true); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public getDistributionList(id: number): void { |
|
|
|
|
this.id = id; |
|
|
|
|
this.isVisibleList = true; |
|
|
|
@ -359,8 +369,9 @@ export class AgentListComponent implements OnInit { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 获取优惠券包列表
|
|
|
|
|
public getDistributeCoupons(id: number): void{ |
|
|
|
|
public getDistributeCoupons(id: number , type: number): void{ |
|
|
|
|
this.validateFormDiscountPackage.reset(); |
|
|
|
|
|
|
|
|
|
this.isSpinningDistributeCoupons = true; |
|
|
|
|
this.agentId = id; |
|
|
|
|
const whereObject = {}; |
|
|
|
@ -375,11 +386,19 @@ export class AgentListComponent implements OnInit { |
|
|
|
|
} |
|
|
|
|
this.isSpinningDistributeCoupons=false; |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
if (type == 1) { |
|
|
|
|
this.isVisibleDistributeCoupons=true; |
|
|
|
|
} else { |
|
|
|
|
this.isVisibleDiscountPackage = true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//分发优惠券包 确定
|
|
|
|
|
public addDisCoupon(): void{ |
|
|
|
|
public addDisCoupon(type: number): void{ |
|
|
|
|
for (const i in this.validateFormDiscountPackage.controls) { |
|
|
|
|
this.validateFormDiscountPackage.controls[i].markAsDirty(); |
|
|
|
|
this.validateFormDiscountPackage.controls[i].updateValueAndValidity(); |
|
|
|
@ -390,6 +409,9 @@ export class AgentListComponent implements OnInit { |
|
|
|
|
} |
|
|
|
|
this.isOkCouponsLoading=true; |
|
|
|
|
this.validateFormDiscountPackage.value['agentId'] = this.agentId; |
|
|
|
|
|
|
|
|
|
if (type == 1) { |
|
|
|
|
|
|
|
|
|
this.agent.distribute(this.validateFormDiscountPackage.value,(data)=>{ |
|
|
|
|
this.isOkCouponsLoading=false; |
|
|
|
|
if (data['return_code'] === '000000') { |
|
|
|
@ -401,17 +423,36 @@ export class AgentListComponent implements OnInit { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
}) |
|
|
|
|
} else { |
|
|
|
|
this.percent = 0; |
|
|
|
|
this.validateFormDiscountPackage.value['serialNumber'] = new Date().getTime(); |
|
|
|
|
this.processRate(this.validateFormDiscountPackage.value['serialNumber']); |
|
|
|
|
this.isVisiblePercent = true; |
|
|
|
|
this.agent.generateDiscountPackageAgentCode(this.validateFormDiscountPackage.value,(data)=>{ |
|
|
|
|
this.isOkCouponsLoading=false; |
|
|
|
|
this.loadingObject.status = false; |
|
|
|
|
if (data['return_code'] === '000000') { |
|
|
|
|
this.validateFormDiscountPackage.reset(); |
|
|
|
|
this.isVisibleDiscountPackage = false; |
|
|
|
|
} else { |
|
|
|
|
this.message.error(data['return_msg']); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 优惠券包分发列表
|
|
|
|
|
public getDistributeCouponsList(id:number):void{ |
|
|
|
|
public getDistributeCouponsList(id:number , type: number):void{ |
|
|
|
|
this.agentId = id; |
|
|
|
|
this.isVisibleDistributeCouponsList=true; |
|
|
|
|
this.loadingCouponsList=true; |
|
|
|
|
this.distributeCouponsList=[]; |
|
|
|
|
this.agent.getDiscountPackageAgentRelList(this.agentId,(data)=>{ |
|
|
|
|
this.type = type; |
|
|
|
|
this.agent.getDiscountPackageAgentRelList(this.agentId, type ,(data)=>{ |
|
|
|
|
this.loadingCouponsList=false; |
|
|
|
|
if (data['return_code'] === '000000') { |
|
|
|
|
this.distributeCouponsList = data['return_data']; |
|
|
|
@ -429,6 +470,7 @@ export class AgentListComponent implements OnInit { |
|
|
|
|
const params={}; |
|
|
|
|
params["discountPackageId"]=discountPackageId; |
|
|
|
|
params["agentId"]=this.agentId; |
|
|
|
|
params["type"]= this.type; |
|
|
|
|
|
|
|
|
|
this.isVisibleAgentRecordList=true; |
|
|
|
|
this.packageAgentRecordList=[]; |
|
|
|
@ -484,5 +526,20 @@ export class AgentListComponent implements OnInit { |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 获取导出百分比
|
|
|
|
|
processRate(key: string) { |
|
|
|
|
this.processRateInterval = setInterval(() => this.common.getRedisValueByType(key, data => { |
|
|
|
|
this.percent = data['return_data']; |
|
|
|
|
if (this.percent === 100) { |
|
|
|
|
clearTimeout(this.processRateInterval); |
|
|
|
|
this.message.success('生成成功!'); |
|
|
|
|
this.loadingObject.status = false; |
|
|
|
|
this.isVisiblePercent = false; |
|
|
|
|
} |
|
|
|
|
}), 100); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|