diff --git a/src/app/admin/agent/agent-list/agent-list.component.html b/src/app/admin/agent/agent-list/agent-list.component.html index 9cb7a24..ec2bc40 100644 --- a/src/app/admin/agent/agent-list/agent-list.component.html +++ b/src/app/admin/agent/agent-list/agent-list.component.html @@ -97,6 +97,7 @@
  • 分发卡券
  • 绑定优惠券
  • 优惠券列表
  • +
  • 分发列表
  • {{data.status === 1 ? '禁用': '启用'}}
  • @@ -196,3 +197,39 @@ + + + + + + + 卡券名称 + 卡券销售价格 + 库存数量 + 销售数量 + 分发时间 + + + + + {{data['couponName']}} + {{data['salesPrice']}}元 + {{data['stockCount']}} + {{data['salesCount']}} + {{data['createTime'] | date: 'yyyy-MM-dd HH:mm'}} + + + + diff --git a/src/app/admin/agent/agent-list/agent-list.component.ts b/src/app/admin/agent/agent-list/agent-list.component.ts index 175fbe8..54bddea 100644 --- a/src/app/admin/agent/agent-list/agent-list.component.ts +++ b/src/app/admin/agent/agent-list/agent-list.component.ts @@ -31,6 +31,7 @@ export class AgentListComponent implements OnInit { isVisible = false; isVisibleDiscount = false; isVisibleDistribute = false; + isVisibleList = false; id: number; isSpinning = false; isSpinningDistribute = false; @@ -40,7 +41,11 @@ export class AgentListComponent implements OnInit { pageSizeDiscount = 10; // 条码 loadingDiscount = true; agentId: number; - + requestDataList = []; // 列表数据 + totalList: number; // 页码 + pageNumList = 1; // 页码 + pageSizeList = 10; // 条码 + loadingList = true; constructor( private form: FormBuilder, private agent: AgentService, @@ -177,6 +182,16 @@ export class AgentListComponent implements OnInit { this.getRequestDiscount(true); } + public getDistributionList(id: number): void { + this.id = id; + this.isVisibleList = true; + this.getRequestList(true); + } + + handleCancelList() { + this.isVisibleList = false; + } + handleCancelDiscount() { this.isVisibleDiscount = false; } @@ -186,7 +201,7 @@ export class AgentListComponent implements OnInit { // 查询列表 public getRequestDiscount(reset: boolean = false) { const whereObject = {}; - this.loadingDiscount = false; + this.loadingDiscount = true; if (reset) { this.pageNumDiscount = 1; } @@ -194,6 +209,7 @@ export class AgentListComponent implements OnInit { whereObject['pageSize'] = this.pageSizeDiscount; whereObject['agentId'] = this.id; this.agent.getDiscountAgentList(whereObject, data => { + this.loadingDiscount = false; if (data['return_code'] === '000000') { this.requestDataDiscount = data['return_data'].list; this.totalDiscount = data['return_data'].total; @@ -221,6 +237,27 @@ export class AgentListComponent implements OnInit { this.isVisibleDistribute = true; } + // 查询f分发列表 + public getRequestList(reset: boolean = false) { + const whereObject = {}; + this.loadingList = true; + if (reset) { + this.pageNumList = 1; + } + whereObject['pageNum'] = this.pageNumList; + whereObject['pageSize'] = this.pageSizeList; + whereObject['agentId'] = this.id; + this.agent.getCouponByAgent(whereObject, data => { + this.loadingList = false; + if (data['return_code'] === '000000') { + this.requestDataList = data['return_data'].list; + this.totalList = data['return_data'].total; + } else { + this.message.error(data['return_msg']); + } + }); + } + // 提交分发 public handleOkDistribute(): void { // tslint:disable-next-line:forin @@ -235,6 +272,7 @@ export class AgentListComponent implements OnInit { this.validateFormDistribute.value['agentId'] = this.agentId; this.agent.assignCouponAgent(this.validateFormDistribute.value , data => { if (data['return_code'] === '000000') { + this.validateFormDistribute.reset(); this.message.success('分发成功'); this.isVisibleDistribute = false; } else { diff --git a/src/app/services/agent.service.ts b/src/app/services/agent.service.ts index b18f6e2..1433f6a 100644 --- a/src/app/services/agent.service.ts +++ b/src/app/services/agent.service.ts @@ -116,4 +116,16 @@ export class AgentService { }); } + /** + * 查询列表 + * + * @param paramsObject 对象 + * @param callBack 回调 + */ + public getCouponByAgent(paramsObject: object, callBack) { + this.http.get(environment.baseUrl + 'highCouponAgent/getCouponByAgent?' + this.common.getWhereCondition(paramsObject)).subscribe(data => { + callBack(data); + }); + } + }