Merge remote-tracking branch 'origin/ymt-dev'

dev
袁野 1 year ago
commit 605ce413e9
  1. 85
      src/app/admin/agent/agent-list/agent-list.component.html
  2. 102
      src/app/admin/agent/agent-list/agent-list.component.ts
  3. 34
      src/app/services/agent.service.ts

@ -109,9 +109,11 @@
<nz-dropdown-menu #menu="nzDropdownMenu"> <nz-dropdown-menu #menu="nzDropdownMenu">
<ul nz-menu nzSelectable> <ul nz-menu nzSelectable>
<li class="li-a" nz-menu-item><a (click)="getDistribution(data.id)">分发卡券</a></li> <li class="li-a" nz-menu-item><a (click)="getDistribution(data.id)">分发卡券</a></li>
<li class="li-a" nz-menu-item><a (click)="getDistributeCoupons(data.id)">分发优惠券包</a></li>
<li class="li-a" nz-menu-item><a (click)="generateAgentQrCode(data.id)">生成二维码</a></li> <li class="li-a" nz-menu-item><a (click)="generateAgentQrCode(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)="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)="getDiscountList(data.id)">优惠券列表</a></li>
<li class="li-a" nz-menu-item><a (click)="getDistributeCouponsList(data.id)">优惠券包分发列表</a></li>
<li class="li-a" nz-menu-item><a [routerLink]="['/admin/order-manage/discount-use-condition-list']" [queryParams]="{agentId: data.id}">优惠券使用</a></li> <li class="li-a" nz-menu-item><a [routerLink]="['/admin/order-manage/discount-use-condition-list']" [queryParams]="{agentId: 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)="getDistributionList(data.id)">分发列表</a></li>
<li class="li-a" nz-menu-item><a (click)='getForbiddenUser(data.id , data.status)'>{{data.status === 1 ? '禁用': '启用'}}</a></li> <li class="li-a" nz-menu-item><a (click)='getForbiddenUser(data.id , data.status)'>{{data.status === 1 ? '禁用': '启用'}}</a></li>
@ -231,6 +233,29 @@
</nz-spin> </nz-spin>
</nz-modal> </nz-modal>
<nz-modal [(nzVisible)]="isVisibleDistributeCoupons" nzTitle="分发优惠券" (nzOnCancel)="isVisibleDistributeCoupons=false" [nzOkLoading]="isOkCouponsLoading" (nzOnOk)="addDisCoupon()">
<nz-spin [nzSpinning]="isSpinningDistributeCoupons">
<form nz-form [formGroup]="validateFormDiscountPackage" class="login-form">
<nz-form-item>
<nz-form-label [nzSpan]="6" nzRequired>优惠券包</nz-form-label>
<nz-form-control [nzSpan]="16" nzErrorTip="请选择优惠券包!">
<nz-select nzShowSearch nzAllowClear formControlName="discountPackageId" nzPlaceHolder="请选择优惠券包">
<nz-option *ngFor="let item of discountPackageList" nzLabel="【{{item['title']}}】"
nzValue="{{item.id}}"></nz-option>
</nz-select>
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label [nzSpan]="6" nzRequired>数量</nz-form-label>
<nz-form-control [nzSpan]="16" nzErrorTip="分发数量不能小于1!">
<input [type]="'number'" nz-input formControlName="num" nzPlaceHolder="请填写分发数量" />
</nz-form-control>
</nz-form-item>
</form>
</nz-spin>
</nz-modal>
<nz-modal [(nzVisible)]="isVisibleList" nzWidth="1000" nzTitle="分发卡券列表" (nzOnCancel)="handleCancelList()" (nzOnOk)="handleCancelList()"> <nz-modal [(nzVisible)]="isVisibleList" nzWidth="1000" nzTitle="分发卡券列表" (nzOnCancel)="handleCancelList()" (nzOnOk)="handleCancelList()">
<nz-table <nz-table
class="table" class="table"
@ -271,6 +296,66 @@
</nz-table> </nz-table>
</nz-modal> </nz-modal>
<nz-modal [(nzVisible)]="isVisibleDistributeCouponsList" nzWidth="1000" nzTitle="优惠券包分发列表" (nzOnCancel)="isVisibleDistributeCouponsList=false" (nzOnOk)="isVisibleDistributeCouponsList=false">
<nz-table #basicTable1 [nzData]="distributeCouponsList" [nzLoading]="loadingCouponsList" [nzPageSize]="10" [nzScroll]="{ y: '500px' }">
<thead>
<tr>
<th nzWidth="50px">优惠券包名称</th>
<th nzWidth="50px">代理商名称</th>
<th nzWidth="50px">库存数量</th>
<th nzWidth="50px">销售数量</th>
<th nzWidth="70px">分发时间</th>
<th nzWidth="70px">操作</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let data of basicTable1.data">
<td>{{data.discountPackageTitle}}</td>
<td>{{data.agentName}}</td>
<td>{{data.stockCount}}</td>
<td>{{data.salesCount}}</td>
<td>{{data['createTime'] | date: 'yyyy-MM-dd HH:mm'}}</td>
<td>
<a (click)="getRecordList(data['discountPackageId'])">分发历史</a>
</td>
</tr>
</tbody>
</nz-table>
</nz-modal>
<nz-modal [(nzVisible)]="isVisibleAgentRecordList" nzWidth="900" nzTitle="分发记录列表" (nzOnCancel)="isVisibleAgentRecordList=false" (nzOnOk)="isVisibleAgentRecordList=false">
<nz-table #basicTable2 [nzData]="packageAgentRecordList" [nzPageSize]="10" [nzScroll]="{ y: '500px' }">
<thead>
<tr>
<th>优惠券包名称</th>
<th>代理商名称</th>
<th>分发数量</th>
<th>分发前数量</th>
<th>分发后数量</th>
<th>分发时间</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let data of basicTable2.data">
<td>{{data.discountPackageTitle}}</td>
<td>{{data.agentName}}</td>
<td>{{data.frontCount}}</td>
<td>{{data.frontCount}}</td>
<td>{{data.afterCount}}</td>
<td>{{data['createTime'] | date: 'yyyy-MM-dd HH:mm'}}</td>
</tr>
</tbody>
</nz-table>
</nz-modal>
<nz-modal [(nzVisible)]="isVisibleShow" nzWidth="700" nzTitle="分发记录" (nzOnCancel)="handleCancelListShow()" (nzOnOk)="handleCancelListShow()"> <nz-modal [(nzVisible)]="isVisibleShow" nzWidth="700" nzTitle="分发记录" (nzOnCancel)="handleCancelListShow()" (nzOnOk)="handleCancelListShow()">
<nz-table #basicTable [nzData]="dataSet"> <nz-table #basicTable [nzData]="dataSet">
<thead> <thead>

@ -23,10 +23,15 @@ export class AgentListComponent implements OnInit {
searchForm: FormGroup; // 搜索框 searchForm: FormGroup; // 搜索框
validateForm: FormGroup; // 搜索框 validateForm: FormGroup; // 搜索框
validateFormDistribute: FormGroup; // 搜索框 validateFormDistribute: FormGroup; // 搜索框
validateFormDiscountPackage:FormGroup;//搜索框
requestData = []; // 列表数据 requestData = []; // 列表数据
discountList = []; // 列表数据 discountList = []; // 列表数据
couponList = []; // 列表数据 couponList = []; // 列表数据
distributeList = []; // 列表数据 distributeList = []; // 列表数据
discountPackageList=[];//优惠券包列表
distributeCouponsList=[];//优惠券包分发列表
packageAgentRecordList=[];//优惠券包分发记录列表
total: number; // 页码 total: number; // 页码
pageNum = 1; // 页码 pageNum = 1; // 页码
pageSize = 10; // 条码 pageSize = 10; // 条码
@ -34,10 +39,14 @@ export class AgentListComponent implements OnInit {
isVisible = false; isVisible = false;
isVisibleDiscount = false; isVisibleDiscount = false;
isVisibleDistribute = false; isVisibleDistribute = false;
isVisibleDistributeCoupons=false;
isVisibleDistributeCouponsList=false;
isVisibleAgentRecordList=false;
isVisibleList = false; isVisibleList = false;
id: number; id: number;
isSpinning = false; isSpinning = false;
isSpinningDistribute = false; isSpinningDistribute = false;
isSpinningDistributeCoupons=false;
requestDataDiscount = []; // 列表数据 requestDataDiscount = []; // 列表数据
totalDiscount: number; // 页码 totalDiscount: number; // 页码
pageNumDiscount = 1; // 页码 pageNumDiscount = 1; // 页码
@ -49,7 +58,9 @@ export class AgentListComponent implements OnInit {
pageNumList = 1; // 页码 pageNumList = 1; // 页码
pageSizeList = 10; // 条码 pageSizeList = 10; // 条码
loadingList = true; loadingList = true;
loadingCouponsList=false;
isOkLoading = false; isOkLoading = false;
isOkCouponsLoading=false;
isVisibleShow = false; isVisibleShow = false;
dataSet; dataSet;
constructor( constructor(
@ -86,6 +97,12 @@ export class AgentListComponent implements OnInit {
type: [null, [Validators.required]], type: [null, [Validators.required]],
stockCount: [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.getRequest(true, this.searchForm.value);
this.coupon.getCouponListByAll({} , data => { 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 { public getList(id: number): void {
const whereObject = {}; const whereObject = {};
whereObject['pageNum'] = 1; whereObject['pageNum'] = 1;

@ -191,4 +191,38 @@ export class AgentService {
callBack(data); callBack(data);
}); });
} }
/*
*/
public distribute(params: object, callBack) {
this.http.post(environment.baseUrl + 'discountPackageAgent/distribute', params).subscribe(data => {
callBack(data);
});
}
/*
*/
public getDiscountPackageList(paramsObject: object, callBack) {
this.http.get(environment.baseUrl + 'highDiscountPackage/getDiscountPackageList?' + this.common.getWhereCondition(paramsObject)).subscribe(data => {
callBack(data);
});
}
/* 获取优惠券包代理商关联列表 */
public getDiscountPackageAgentRelList(agentId: number, callBack) {
this.http.get(environment.baseUrl + 'discountPackageAgent/getDiscountPackageAgentRelList?agentId=' + agentId).subscribe(data => {
callBack(data);
});
}
/* 获取优惠券包代理商分发记录列表 */
public getDiscountPackageAgentRecord(paramsObject: object, callBack) {
this.http.get(environment.baseUrl + 'discountPackageAgent/getDiscountPackageAgentRecord?' + this.common.getWhereCondition(paramsObject)).subscribe(data => {
callBack(data);
});
}
} }

Loading…
Cancel
Save