|
|
@ -37,6 +37,7 @@ export class AgentListComponent implements OnInit { |
|
|
|
pageSize = 10; // 条码
|
|
|
|
pageSize = 10; // 条码
|
|
|
|
loading = true; |
|
|
|
loading = true; |
|
|
|
isVisible = false; |
|
|
|
isVisible = false; |
|
|
|
|
|
|
|
isVisibleDiscountPackage = false; |
|
|
|
isVisibleDiscount = false; |
|
|
|
isVisibleDiscount = false; |
|
|
|
isVisibleDistribute = false; |
|
|
|
isVisibleDistribute = false; |
|
|
|
isVisibleDistributeCoupons=false; |
|
|
|
isVisibleDistributeCoupons=false; |
|
|
@ -62,14 +63,21 @@ export class AgentListComponent implements OnInit { |
|
|
|
isOkLoading = false; |
|
|
|
isOkLoading = false; |
|
|
|
isOkCouponsLoading=false; |
|
|
|
isOkCouponsLoading=false; |
|
|
|
isVisibleShow = false; |
|
|
|
isVisibleShow = false; |
|
|
|
|
|
|
|
isVisiblePercent = false; |
|
|
|
|
|
|
|
percent = 0; |
|
|
|
dataSet; |
|
|
|
dataSet; |
|
|
|
|
|
|
|
type: number; |
|
|
|
|
|
|
|
processRateInterval; |
|
|
|
|
|
|
|
loadingObject = { |
|
|
|
|
|
|
|
title: '加载中...', |
|
|
|
|
|
|
|
status: false, |
|
|
|
|
|
|
|
}; |
|
|
|
constructor( |
|
|
|
constructor( |
|
|
|
private form: FormBuilder, |
|
|
|
private form: FormBuilder, |
|
|
|
private agent: AgentService, |
|
|
|
private agent: AgentService, |
|
|
|
private audit: AuditService, |
|
|
|
private audit: AuditService, |
|
|
|
private discount: DiscountService, |
|
|
|
private discount: DiscountService, |
|
|
|
private coupon: CouponService, |
|
|
|
private coupon: CouponService, |
|
|
|
private iconService: IconService, |
|
|
|
|
|
|
|
private message: NzMessageService, |
|
|
|
private message: NzMessageService, |
|
|
|
private router: Router, |
|
|
|
private router: Router, |
|
|
|
private clipboardService: ClipboardService, |
|
|
|
private clipboardService: ClipboardService, |
|
|
@ -88,6 +96,7 @@ export class AgentListComponent implements OnInit { |
|
|
|
status: [null], |
|
|
|
status: [null], |
|
|
|
type: [null], |
|
|
|
type: [null], |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
this.validateForm = this.form.group({ |
|
|
|
this.validateForm = this.form.group({ |
|
|
|
discountId: [null, [Validators.required]], |
|
|
|
discountId: [null, [Validators.required]], |
|
|
|
stockCount: [null, [Validators.required]], |
|
|
|
stockCount: [null, [Validators.required]], |
|
|
@ -217,6 +226,7 @@ export class AgentListComponent implements OnInit { |
|
|
|
this.getRequestDiscount(true); |
|
|
|
this.getRequestDiscount(true); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public getDistributionList(id: number): void { |
|
|
|
public getDistributionList(id: number): void { |
|
|
|
this.id = id; |
|
|
|
this.id = id; |
|
|
|
this.isVisibleList = true; |
|
|
|
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.validateFormDiscountPackage.reset(); |
|
|
|
|
|
|
|
|
|
|
|
this.isSpinningDistributeCoupons = true; |
|
|
|
this.isSpinningDistributeCoupons = true; |
|
|
|
this.agentId = id; |
|
|
|
this.agentId = id; |
|
|
|
const whereObject = {}; |
|
|
|
const whereObject = {}; |
|
|
@ -375,11 +386,19 @@ export class AgentListComponent implements OnInit { |
|
|
|
} |
|
|
|
} |
|
|
|
this.isSpinningDistributeCoupons=false; |
|
|
|
this.isSpinningDistributeCoupons=false; |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (type == 1) { |
|
|
|
this.isVisibleDistributeCoupons=true; |
|
|
|
this.isVisibleDistributeCoupons=true; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
this.isVisibleDiscountPackage = true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//分发优惠券包 确定
|
|
|
|
//分发优惠券包 确定
|
|
|
|
public addDisCoupon(): void{ |
|
|
|
public addDisCoupon(type: number): void{ |
|
|
|
for (const i in this.validateFormDiscountPackage.controls) { |
|
|
|
for (const i in this.validateFormDiscountPackage.controls) { |
|
|
|
this.validateFormDiscountPackage.controls[i].markAsDirty(); |
|
|
|
this.validateFormDiscountPackage.controls[i].markAsDirty(); |
|
|
|
this.validateFormDiscountPackage.controls[i].updateValueAndValidity(); |
|
|
|
this.validateFormDiscountPackage.controls[i].updateValueAndValidity(); |
|
|
@ -390,6 +409,9 @@ export class AgentListComponent implements OnInit { |
|
|
|
} |
|
|
|
} |
|
|
|
this.isOkCouponsLoading=true; |
|
|
|
this.isOkCouponsLoading=true; |
|
|
|
this.validateFormDiscountPackage.value['agentId'] = this.agentId; |
|
|
|
this.validateFormDiscountPackage.value['agentId'] = this.agentId; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (type == 1) { |
|
|
|
|
|
|
|
|
|
|
|
this.agent.distribute(this.validateFormDiscountPackage.value,(data)=>{ |
|
|
|
this.agent.distribute(this.validateFormDiscountPackage.value,(data)=>{ |
|
|
|
this.isOkCouponsLoading=false; |
|
|
|
this.isOkCouponsLoading=false; |
|
|
|
if (data['return_code'] === '000000') { |
|
|
|
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.agentId = id; |
|
|
|
this.isVisibleDistributeCouponsList=true; |
|
|
|
this.isVisibleDistributeCouponsList=true; |
|
|
|
this.loadingCouponsList=true; |
|
|
|
this.loadingCouponsList=true; |
|
|
|
this.distributeCouponsList=[]; |
|
|
|
this.distributeCouponsList=[]; |
|
|
|
this.agent.getDiscountPackageAgentRelList(this.agentId,(data)=>{ |
|
|
|
this.type = type; |
|
|
|
|
|
|
|
this.agent.getDiscountPackageAgentRelList(this.agentId, type ,(data)=>{ |
|
|
|
this.loadingCouponsList=false; |
|
|
|
this.loadingCouponsList=false; |
|
|
|
if (data['return_code'] === '000000') { |
|
|
|
if (data['return_code'] === '000000') { |
|
|
|
this.distributeCouponsList = data['return_data']; |
|
|
|
this.distributeCouponsList = data['return_data']; |
|
|
@ -429,6 +470,7 @@ export class AgentListComponent implements OnInit { |
|
|
|
const params={}; |
|
|
|
const params={}; |
|
|
|
params["discountPackageId"]=discountPackageId; |
|
|
|
params["discountPackageId"]=discountPackageId; |
|
|
|
params["agentId"]=this.agentId; |
|
|
|
params["agentId"]=this.agentId; |
|
|
|
|
|
|
|
params["type"]= this.type; |
|
|
|
|
|
|
|
|
|
|
|
this.isVisibleAgentRecordList=true; |
|
|
|
this.isVisibleAgentRecordList=true; |
|
|
|
this.packageAgentRecordList=[]; |
|
|
|
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); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|