pull/1/head
袁野 4 years ago
parent 151a8028f9
commit aa383f9150
  1. 37
      src/app/admin/agent/agent-list/agent-list.component.html
  2. 42
      src/app/admin/agent/agent-list/agent-list.component.ts
  3. 12
      src/app/services/agent.service.ts

@ -97,6 +97,7 @@
<li class="li-a" nz-menu-item><a (click)="getDistribution(data.id)">分发卡券</a></li>
<li class="li-a" nz-menu-item><a (click)="getDiscount(data.id)">绑定优惠券</a></li>
<li class="li-a" nz-menu-item><a (click)="getDiscountList(data.id)">优惠券列表</a></li>
<li class="li-a" nz-menu-item><a (click)="getDistributionList(data.id)">分发列表</a></li>
<li class="li-a" nz-menu-item><a (click)='getForbiddenUser(data.id , data.status)'>{{data.status === 1 ? '禁用': '启用'}}</a></li>
</ul>
</nz-dropdown-menu>
@ -196,3 +197,39 @@
</form>
</nz-spin>
</nz-modal>
<nz-modal [(nzVisible)]="isVisibleList" nzWidth="1000" nzTitle="分发卡券列表" (nzOnCancel)="handleCancelList()"
(nzOnOk)="handleCancelList()">
<nz-table
class="table"
#ajaxTableList
nzShowSizeChanger
[nzFrontPagination]="false"
[nzData]="requestDataList"
[nzLoading]="loadingList"
[nzTotal]="totalList"
[(nzPageIndex)]="pageNumList"
[(nzPageSize)]="pageSizeList"
(nzPageIndexChange)="getRequestList(false)"
(nzPageSizeChange)="getRequestList(false)">
<thead nzSingleSort>
<tr>
<th nzWidth="80px">卡券名称</th>
<th nzWidth="80px">卡券销售价格</th>
<th nzWidth="80px">库存数量</th>
<th nzWidth="70px">销售数量</th>
<th nzWidth="70px">分发时间</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let data of ajaxTableList.data; let i = index">
<td>{{data['couponName']}}</td>
<td>{{data['salesPrice']}}元</td>
<td>{{data['stockCount']}}</td>
<td>{{data['salesCount']}}</td>
<td>{{data['createTime'] | date: 'yyyy-MM-dd HH:mm'}}</td>
</tbody>
</nz-table>
</nz-modal>

@ -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 {

@ -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);
});
}
}

Loading…
Cancel
Save