|
|
|
@ -23,10 +23,15 @@ export class AgentListComponent implements OnInit { |
|
|
|
|
searchForm: FormGroup; // 搜索框
|
|
|
|
|
validateForm: FormGroup; // 搜索框
|
|
|
|
|
validateFormDistribute: FormGroup; // 搜索框
|
|
|
|
|
validateFormDiscountPackage:FormGroup;//搜索框
|
|
|
|
|
|
|
|
|
|
requestData = []; // 列表数据
|
|
|
|
|
discountList = []; // 列表数据
|
|
|
|
|
couponList = []; // 列表数据
|
|
|
|
|
distributeList = []; // 列表数据
|
|
|
|
|
discountPackageList=[];//优惠券包列表
|
|
|
|
|
distributeCouponsList=[];//优惠券包分发列表
|
|
|
|
|
packageAgentRecordList=[];//优惠券包分发记录列表
|
|
|
|
|
total: number; // 页码
|
|
|
|
|
pageNum = 1; // 页码
|
|
|
|
|
pageSize = 10; // 条码
|
|
|
|
@ -34,10 +39,14 @@ export class AgentListComponent implements OnInit { |
|
|
|
|
isVisible = false; |
|
|
|
|
isVisibleDiscount = false; |
|
|
|
|
isVisibleDistribute = false; |
|
|
|
|
isVisibleDistributeCoupons=false; |
|
|
|
|
isVisibleDistributeCouponsList=false; |
|
|
|
|
isVisibleAgentRecordList=false; |
|
|
|
|
isVisibleList = false; |
|
|
|
|
id: number; |
|
|
|
|
isSpinning = false; |
|
|
|
|
isSpinningDistribute = false; |
|
|
|
|
isSpinningDistributeCoupons=false; |
|
|
|
|
requestDataDiscount = []; // 列表数据
|
|
|
|
|
totalDiscount: number; // 页码
|
|
|
|
|
pageNumDiscount = 1; // 页码
|
|
|
|
@ -49,7 +58,9 @@ export class AgentListComponent implements OnInit { |
|
|
|
|
pageNumList = 1; // 页码
|
|
|
|
|
pageSizeList = 10; // 条码
|
|
|
|
|
loadingList = true; |
|
|
|
|
loadingCouponsList=false; |
|
|
|
|
isOkLoading = false; |
|
|
|
|
isOkCouponsLoading=false; |
|
|
|
|
isVisibleShow = false; |
|
|
|
|
dataSet; |
|
|
|
|
constructor( |
|
|
|
@ -86,6 +97,12 @@ export class AgentListComponent implements OnInit { |
|
|
|
|
type: [null, [Validators.required]], |
|
|
|
|
stockCount: [null, [Validators.required]], |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
this.validateFormDiscountPackage=this.form.group({ |
|
|
|
|
discountPackageId:[null,[Validators.required]], |
|
|
|
|
num:[null, [Validators.required,Validators.min(1)]] |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
this.getRequest(true, this.searchForm.value); |
|
|
|
|
|
|
|
|
|
this.coupon.getCouponListByAll({} , data => { |
|
|
|
@ -341,6 +358,91 @@ export class AgentListComponent implements OnInit { |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 获取优惠券包列表
|
|
|
|
|
public getDistributeCoupons(id: number): void{ |
|
|
|
|
this.validateFormDiscountPackage.reset(); |
|
|
|
|
this.isSpinningDistributeCoupons = true; |
|
|
|
|
this.agentId = id; |
|
|
|
|
const whereObject = {}; |
|
|
|
|
whereObject['pageNum'] = 1; |
|
|
|
|
whereObject['pageSize'] = 10000; |
|
|
|
|
whereObject['status']=1; |
|
|
|
|
this.agent.getDiscountPackageList(whereObject,(data)=>{ |
|
|
|
|
if (data['return_code'] === '000000') { |
|
|
|
|
this.discountPackageList = data['return_data'].list; |
|
|
|
|
} else { |
|
|
|
|
this.message.error(data['return_msg']); |
|
|
|
|
} |
|
|
|
|
this.isSpinningDistributeCoupons=false; |
|
|
|
|
}) |
|
|
|
|
this.isVisibleDistributeCoupons=true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//分发优惠券包 确定
|
|
|
|
|
public addDisCoupon(): void{ |
|
|
|
|
for (const i in this.validateFormDiscountPackage.controls) { |
|
|
|
|
this.validateFormDiscountPackage.controls[i].markAsDirty(); |
|
|
|
|
this.validateFormDiscountPackage.controls[i].updateValueAndValidity(); |
|
|
|
|
if (this.validateFormDiscountPackage.controls[i].errors != null) { |
|
|
|
|
this.message.error('必填项不能为空'); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
this.isOkCouponsLoading=true; |
|
|
|
|
this.validateFormDiscountPackage.value['agentId'] = this.agentId; |
|
|
|
|
this.agent.distribute(this.validateFormDiscountPackage.value,(data)=>{ |
|
|
|
|
this.isOkCouponsLoading=false; |
|
|
|
|
if (data['return_code'] === '000000') { |
|
|
|
|
this.validateFormDiscountPackage.reset(); |
|
|
|
|
this.message.success('分发成功'); |
|
|
|
|
this.isVisibleDistributeCoupons = false; |
|
|
|
|
} else { |
|
|
|
|
this.message.error(data['return_msg']); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 优惠券包分发列表
|
|
|
|
|
public getDistributeCouponsList(id:number):void{ |
|
|
|
|
this.agentId = id; |
|
|
|
|
this.isVisibleDistributeCouponsList=true; |
|
|
|
|
this.loadingCouponsList=true; |
|
|
|
|
this.distributeCouponsList=[]; |
|
|
|
|
this.agent.getDiscountPackageAgentRelList(this.agentId,(data)=>{ |
|
|
|
|
this.loadingCouponsList=false; |
|
|
|
|
if (data['return_code'] === '000000') { |
|
|
|
|
this.distributeCouponsList = data['return_data']; |
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
this.message.error(data['return_msg']); |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 获取优惠券包代理商分发记录列表
|
|
|
|
|
public getRecordList(discountPackageId:number):void{ |
|
|
|
|
|
|
|
|
|
const params={}; |
|
|
|
|
params["discountPackageId"]=discountPackageId; |
|
|
|
|
params["agentId"]=this.agentId; |
|
|
|
|
|
|
|
|
|
this.isVisibleAgentRecordList=true; |
|
|
|
|
this.packageAgentRecordList=[]; |
|
|
|
|
this.agent.getDiscountPackageAgentRecord(params,(data)=>{ |
|
|
|
|
if (data['return_code'] === '000000') { |
|
|
|
|
this.packageAgentRecordList = data['return_data']; |
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
this.message.error(data['return_msg']); |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public getList(id: number): void { |
|
|
|
|
const whereObject = {}; |
|
|
|
|
whereObject['pageNum'] = 1; |
|
|
|
|