pull/1/head
袁野 4 years ago
commit ec23be1da2
  1. 115
      src/app/admin/agent/agent-list/agent-list.component.html
  2. 8
      src/app/admin/agent/agent-list/agent-list.component.scss
  3. 104
      src/app/admin/agent/agent-list/agent-list.component.ts
  4. 2
      src/app/admin/discount/discount-edit/discount-edit.component.html
  5. 2
      src/app/admin/merchant/merchant-edit/merchant-edit.component.ts
  6. 25
      src/app/services/agent.service.ts

@ -7,7 +7,7 @@
<form nz-form [formGroup]="searchForm" (ngSubmit)="getRequest(true , searchForm.value)">
<div nz-row>
<div nz-col nzSpan="6">
<div nz-col nzSpan="8">
<nz-form-item>
<nz-form-label [nzSpan]="6">名称</nz-form-label>
<nz-form-control [nzSpan]="16">
@ -15,7 +15,7 @@
</nz-form-control>
</nz-form-item>
</div>
<div nz-col nzSpan="6">
<div nz-col nzSpan="8">
<nz-form-item>
<nz-form-label [nzSpan]="6">电话</nz-form-label>
<nz-form-control [nzSpan]="16">
@ -23,12 +23,12 @@
</nz-form-control>
</nz-form-item>
</div>
<div nz-col nzSpan="6">
<div nz-col nzSpan="8">
<nz-form-item>
<nz-form-label [nzSpan]="6">代理商状态</nz-form-label>
<nz-form-control [nzSpan]="16">
<nz-select nzShowSearch nzAllowClear formControlName="status" nzPlaceHolder="请选择代理商状态">
<nz-option nzLabel="禁用" nzValue="0"></nz-option>
<nz-option nzLabel="禁用" nzValue="0"></nz-option>
<nz-option nzLabel="正常" nzValue="1"></nz-option>
</nz-select>
</nz-form-control>
@ -40,7 +40,9 @@
<div nz-row>
<div nz-col nzSpan="24" class="search-button">
<button nz-button nzType="primary"><i nz-icon nzType="search" nzTheme="outline"></i>搜索</button>
<button nz-button nzType="default" (click)="resetForm()"><i nz-icon nzType="reload" nzTheme="outline"></i>重置</button>
<button nz-button nzType="default" (click)="resetForm()"><i nz-icon nzType="reload"
nzTheme="outline"></i>重置
</button>
</div>
</div>
</form>
@ -50,7 +52,10 @@
<div class="inner-content">
<span>共计 {{total}} 条数据</span>
<div class="operating-button">
<button nz-button nzType="primary" class="right-btn" [routerLink]="['/admin/agent/agent-edit']" ><i nz-icon nzType="plus" nzTheme="outline"></i>添加</button>
<button nz-button nzType="primary" class="right-btn" [routerLink]="['/admin/agent/agent-edit']"><i nz-icon
nzType="plus"
nzTheme="outline"></i>添加
</button>
</div>
<nz-table
class="table"
@ -78,23 +83,24 @@
</thead>
<tbody>
<tr *ngFor="let data of ajaxTable.data; let i = index">
<td>{{i+1}}</td>
<td>{{i + 1}}</td>
<td>{{data.agentName}}</td>
<td>{{data.agentAddress}}</td>
<td>{{data.agentUser}}</td>
<td>{{data.agentPhone}}</td>
<td>{{data.createTime | date: 'yyyy-MM-dd HH:mm'}}</td>
<td nzRight="0px" class="table-td-operation">
<a (click)="getEdit(data.id)"><i nz-icon nzType="form" nzTheme="outline" nz-tooltip="编辑"></i></a>
<!-- <nz-divider nzType="vertical"></nz-divider>-->
<!-- <a (click)="getDetail(data.id)"><i nz-icon [nzIconfont]="'icon-xiangqing'" nz-tooltip="公司详情"></i></a>-->
<nz-divider nzType="vertical"></nz-divider>
<a (click)="getDiscount(data.id)"><i nz-icon nzType="api" nzTheme="outline" nz-tooltip="绑定优惠券"></i></a>
<nz-divider nzType="vertical"></nz-divider>
<a (click)="getDiscountList(data.id)"><i nz-icon nzType="unordered-list" nzTheme="outline" nz-tooltip="优惠券列表"></i></a>
<nz-divider nzType="vertical"></nz-divider>
<a (click)='getForbiddenUser(data.id , data.status)'><i nz-icon nzType="{{data.status === 1 ? 'stop': 'check-circle'}}" nzTheme="outline" nz-tooltip="{{data.status === 1 ? '禁用': '启用'}}"></i></a>
<a (click)="getEdit(data.id)">编辑</a>
<a nz-dropdown [nzDropdownMenu]="menu">更多</a>
<nz-dropdown-menu #menu="nzDropdownMenu">
<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)="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>
</td>
</tbody>
</nz-table>
@ -104,22 +110,24 @@
<form nz-form [formGroup]="validateForm" class="login-form">
<nz-form-item>
<nz-form-label [nzSpan]="6" nzRequired>优惠券</nz-form-label>
<nz-form-control [nzSpan]="16" nzErrorTip="请选择优惠券!">
<nz-form-control [nzSpan]="16" nzErrorTip="请选择优惠券!">
<nz-select nzShowSearch nzAllowClear formControlName="discountId" nzPlaceHolder="请选择优惠券">
<nz-option *ngFor="let item of discountList" nzLabel="{{item.discountName}}" nzValue="{{item.id}}"></nz-option>
<nz-option *ngFor="let item of discountList" nzLabel="{{item.discountName}}"
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="分配优惠券数量!">
<input [type]="'number'" nz-input formControlName="stockCount"/>
<nz-form-control [nzSpan]="16" nzErrorTip="分配优惠券数量!">
<input [type]="'number'" nz-input formControlName="stockCount"/>
</nz-form-control>
</nz-form-item>
</form>
</nz-modal>
<nz-modal [(nzVisible)]="isVisibleDiscount" nzWidth="1000" nzTitle="分配优惠券列表" (nzOnCancel)="handleCancelDiscount()" (nzOnOk)="handleCancelDiscount()">
<nz-modal [(nzVisible)]="isVisibleDiscount" nzWidth="1000" nzTitle="分配优惠券列表" (nzOnCancel)="handleCancelDiscount()"
(nzOnOk)="handleCancelDiscount()">
<nz-table
class="table"
#ajaxTableDiscount
@ -142,7 +150,6 @@
<th nzWidth="70px">有效天数</th>
<th nzWidth="100px">截止日期</th>
<th nzWidth="100px">库存数量</th>
<th nzRight nzWidth="100px">二维码</th>
</tr>
</thead>
<tbody>
@ -164,9 +171,65 @@
<td>{{data['highDiscount'].effectiveDay}}</td>
<td>{{data['highDiscount'].salesEndTime | date: 'yyyy-MM-dd HH:mm'}}</td>
<td>{{data.stockCount}}</td>
<td nzRight>
<img class="head_img" src="{{WEB_SERVE_URL + 'agentQrCode/' + data.qrCode}}" onerror="this.src='../../../../assets/admin/navigation/icon.png'" alt="">
</td>
</tbody>
</nz-table>
</nz-modal>
<nz-modal [(nzVisible)]="isVisibleDistribute" nzTitle="分发卡券" (nzOnCancel)="handleCancelDistribute()" (nzOnOk)="handleOkDistribute()">
<nz-spin [nzSpinning]="isSpinningDistribute">
<form nz-form [formGroup]="validateFormDistribute" 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="couponId" nzPlaceHolder="请选择卡券">
<nz-option *ngFor="let item of distributeList" nzLabel="{{item.couponName + '-(有效库存:' + item.stockCount + ')'}}"
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="分发卡券数量!">
<input [type]="'number'" nz-input formControlName="stockCount"/>
</nz-form-control>
</nz-form-item>
</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>

@ -2,3 +2,11 @@
height: 80px;
width: 80px;
}
.table-td-operation {
a {
margin-left: 8px;
}
}
.li-a :hover {
color: #1890ff;
}

@ -8,6 +8,7 @@ import {Router} from '@angular/router';
import {CommonsService} from '../../../services/commons.service';
import {AgentService} from '../../../services/agent.service';
import {DiscountService} from '../../../services/discount.service';
import {CouponService} from '../../../services/coupon.service';
@Component({
selector: 'app-agent-list',
@ -19,25 +20,37 @@ export class AgentListComponent implements OnInit {
WEB_SERVE_URL = environment.imageUrl;
searchForm: FormGroup; // 搜索框
validateForm: FormGroup; // 搜索框
validateFormDistribute: FormGroup; // 搜索框
requestData = []; // 列表数据
discountList = []; // 列表数据
distributeList = []; // 列表数据
total: number; // 页码
pageNum = 1; // 页码
pageSize = 10; // 条码
loading = true;
isVisible = false;
isVisibleDiscount = false;
isVisibleDistribute = false;
isVisibleList = false;
id: number;
isSpinning = false;
isSpinningDistribute = false;
requestDataDiscount = []; // 列表数据
totalDiscount: number; // 页码
pageNumDiscount = 1; // 页码
pageSizeDiscount = 10; // 条码
loadingDiscount = true;
agentId: number;
requestDataList = []; // 列表数据
totalList: number; // 页码
pageNumList = 1; // 页码
pageSizeList = 10; // 条码
loadingList = true;
constructor(
private form: FormBuilder,
private agent: AgentService,
private discount: DiscountService,
private coupon: CouponService,
private iconService: IconService,
private message: NzMessageService,
private router: Router,
@ -59,6 +72,10 @@ export class AgentListComponent implements OnInit {
discountId: [null, [Validators.required]],
stockCount: [null, [Validators.required]],
});
this.validateFormDistribute = this.form.group({
couponId: [null, [Validators.required]],
stockCount: [null, [Validators.required]],
});
this.getRequest(true, this.searchForm.value);
}
@ -98,7 +115,6 @@ export class AgentListComponent implements OnInit {
});
}
// 修改
public getEdit(id: number): void {
this.router.navigate(['/admin/agent/agent-edit'], {
@ -143,14 +159,16 @@ export class AgentListComponent implements OnInit {
return;
}
}
// this.isSpinning = true;
this.validateForm.value['agentId'] = this.id;
this.agent.insertDiscountAgent(this.validateForm.value , data => {
if (data['return_code'] === '000000') {
console.log(data);
this.message.success('生成中,请耐心等待!');
this.isVisible = false;
} else {
this.message.error(data['return_msg']);
}
this.isSpinning = false;
});
}
@ -164,14 +182,26 @@ 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;
}
handleCancelDistribute() {
this.isVisibleDistribute = false;
}
// 查询列表
public getRequestDiscount(reset: boolean = false) {
const whereObject = {};
this.loadingDiscount = false;
this.loadingDiscount = true;
if (reset) {
this.pageNumDiscount = 1;
}
@ -179,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;
@ -187,5 +218,68 @@ export class AgentListComponent implements OnInit {
}
});
}
// 分发卡券
public getDistribution(id: number): void {
this.isSpinningDistribute = true;
this.agentId = id;
const whereObject = {};
whereObject['pageNum'] = 1;
whereObject['pageSize'] = 10000;
this.coupon.getCouponList(whereObject, data => {
if (data['return_code'] === '000000') {
this.distributeList = data['return_data'].list;
} else {
this.message.error(data['return_msg']);
}
this.isSpinningDistribute = false;
});
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
for (const i in this.validateFormDistribute.controls) {
this.validateFormDistribute.controls[i].markAsDirty();
this.validateFormDistribute.controls[i].updateValueAndValidity();
if (this.validateFormDistribute.controls[i].errors != null) {
this.message.error('必填项不能为空');
return;
}
}
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 {
this.message.error(data['return_msg']);
}
this.isSpinning = false;
});
}
}

@ -67,7 +67,7 @@
<nz-form-item>
<nz-form-label [nzFor]="'effectiveDay'" nzRequired>领取有效天数</nz-form-label>
<nz-form-control nzErrorTip="请输入领取有效天数!">
<nz-input-number [formControlName]="'effectiveDay'" [nzMin]="1" [nzMax]="100" [nzStep]="1"></nz-input-number>
<nz-input-number [formControlName]="'effectiveDay'" [nzMin]="1" [nzStep]="1"></nz-input-number>
</nz-form-control>
</nz-form-item>
</div>

@ -51,7 +51,7 @@ export class MerchantEditComponent implements OnInit {
this.validateForm = this.fb.group({
loginTelephone: [null, [Validators.required, ValidatorsService.mobile]],
password: [null, [Validators.required, ValidatorsService.minLength(6)]],
merchantName: [null, [Validators.required, ValidatorsService.pwdLength(2, 5)]],
merchantName: [null, [Validators.required]],
telephone: [null, [Validators.required]],
address: [null, [Validators.required]],
bankName: [null],

@ -91,6 +91,19 @@ export class AgentService {
});
}
/**
*
*
* @param params
* @param callBack
* @return data
*/
public assignCouponAgent(params: object, callBack) {
this.http.post(environment.baseUrl + 'highCouponAgent/assignCouponAgent', params).subscribe(data => {
callBack(data);
});
}
/**
*
*
@ -103,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