parent
ba1288f11e
commit
9d3cf40620
@ -0,0 +1,259 @@ |
|||||||
|
<!-- start 面包屑 --> |
||||||
|
<app-breadcrumb></app-breadcrumb> |
||||||
|
<!-- end 面包屑 --> |
||||||
|
|
||||||
|
<!--条件搜索--> |
||||||
|
<div class="inner-content"> |
||||||
|
<form nz-form [formGroup]="searchForm" (ngSubmit)="getRequest(true , searchForm.value)"> |
||||||
|
<div nz-row> |
||||||
|
|
||||||
|
<div nz-col nzSpan="8"> |
||||||
|
<nz-form-item> |
||||||
|
<nz-form-label [nzSpan]="6">名称</nz-form-label> |
||||||
|
<nz-form-control [nzSpan]="16"> |
||||||
|
<input nz-input formControlName="agentName"/> |
||||||
|
</nz-form-control> |
||||||
|
</nz-form-item> |
||||||
|
</div> |
||||||
|
<div nz-col nzSpan="8"> |
||||||
|
<nz-form-item> |
||||||
|
<nz-form-label [nzSpan]="6">电话</nz-form-label> |
||||||
|
<nz-form-control [nzSpan]="16"> |
||||||
|
<input nz-input formControlName="agentPhone"/> |
||||||
|
</nz-form-control> |
||||||
|
</nz-form-item> |
||||||
|
</div> |
||||||
|
<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="1"></nz-option> |
||||||
|
</nz-select> |
||||||
|
</nz-form-control> |
||||||
|
</nz-form-item> |
||||||
|
</div> |
||||||
|
|
||||||
|
</div> |
||||||
|
|
||||||
|
<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> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</form> |
||||||
|
</div> |
||||||
|
|
||||||
|
|
||||||
|
<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> |
||||||
|
</div> |
||||||
|
<nz-table |
||||||
|
class="table" |
||||||
|
#ajaxTable |
||||||
|
nzShowSizeChanger |
||||||
|
[nzFrontPagination]="false" |
||||||
|
[nzData]="requestData" |
||||||
|
[nzLoading]="loading" |
||||||
|
[nzTotal]="total" |
||||||
|
[(nzPageIndex)]="pageNum" |
||||||
|
[(nzPageSize)]="pageSize" |
||||||
|
[nzScroll]="{ x: '1200px' }" |
||||||
|
(nzPageIndexChange)="getRequest(false , searchForm.value)" |
||||||
|
(nzPageSizeChange)="getRequest(false , searchForm.value)"> |
||||||
|
<thead nzSingleSort> |
||||||
|
<tr> |
||||||
|
<th nzWidth="50px">编号</th> |
||||||
|
<th nzWidth="80px">代理商名称</th> |
||||||
|
<th nzWidth="80px">代理商地址</th> |
||||||
|
<th nzWidth="80px">联系人</th> |
||||||
|
<th nzWidth="70px">联系方式</th> |
||||||
|
<th nzWidth="100px">创建时间</th> |
||||||
|
<th nzWidth="80px" nzRight="0px">操作</th> |
||||||
|
</tr> |
||||||
|
</thead> |
||||||
|
<tbody> |
||||||
|
<tr *ngFor="let data of ajaxTable.data; let i = index"> |
||||||
|
<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)">编辑</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> |
||||||
|
</div> |
||||||
|
|
||||||
|
<nz-modal [(nzVisible)]="isVisible" nzTitle="分配优惠券" (nzOnCancel)="handleCancel()" (nzOnOk)="handleOk()"> |
||||||
|
<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-select nzShowSearch nzAllowClear formControlName="discountId" nzPlaceHolder="请选择优惠券"> |
||||||
|
<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> |
||||||
|
</nz-form-item> |
||||||
|
</form> |
||||||
|
</nz-modal> |
||||||
|
|
||||||
|
<nz-modal [(nzVisible)]="isVisibleDiscount" nzWidth="1000" nzTitle="分配优惠券列表" (nzOnCancel)="handleCancelDiscount()" |
||||||
|
(nzOnOk)="handleCancelDiscount()"> |
||||||
|
<nz-table |
||||||
|
class="table" |
||||||
|
#ajaxTableDiscount |
||||||
|
nzShowSizeChanger |
||||||
|
[nzFrontPagination]="false" |
||||||
|
[nzData]="requestDataDiscount" |
||||||
|
[nzLoading]="loadingDiscount" |
||||||
|
[nzTotal]="totalDiscount" |
||||||
|
[(nzPageIndex)]="pageNumDiscount" |
||||||
|
[(nzPageSize)]="pageSizeDiscount" |
||||||
|
[nzScroll]="{ x: '1200px' }" |
||||||
|
(nzPageIndexChange)="getRequestDiscount(false)" |
||||||
|
(nzPageSizeChange)="getRequestDiscount(false)"> |
||||||
|
<thead nzSingleSort> |
||||||
|
<tr> |
||||||
|
<th nzWidth="80px">优惠券KEY</th> |
||||||
|
<th nzWidth="80px">优惠券名称</th> |
||||||
|
<th nzWidth="80px">优惠券类型</th> |
||||||
|
<th nzWidth="70px">优惠内容</th> |
||||||
|
<th nzWidth="70px">有效天数</th> |
||||||
|
<th nzWidth="100px">截止日期</th> |
||||||
|
<th nzWidth="100px">库存数量</th> |
||||||
|
</tr> |
||||||
|
</thead> |
||||||
|
<tbody> |
||||||
|
<tr *ngFor="let data of ajaxTableDiscount.data; let i = index"> |
||||||
|
<td>{{data['highDiscount'].discountKey}}</td> |
||||||
|
<td>{{data['highDiscount'].discountName}}</td> |
||||||
|
<td>{{data['highDiscount'].discountType | discountType}}</td> |
||||||
|
<td> |
||||||
|
<span *ngIf="data['highDiscount'].discountType === 1"> |
||||||
|
满{{data['highDiscount'].discountCondition}}抵扣{{data['highDiscount'].discountPrice}} |
||||||
|
</span> |
||||||
|
<span *ngIf="data['highDiscount'].discountType === 2"> |
||||||
|
抵扣{{data['highDiscount'].discountPrice}} |
||||||
|
</span> |
||||||
|
<span *ngIf="data['highDiscount'].discountType === 3"> |
||||||
|
{{data['highDiscount'].discountPrice}}折 |
||||||
|
</span> |
||||||
|
</td> |
||||||
|
<td>{{data['highDiscount'].effectiveDay}}</td> |
||||||
|
<td>{{data['highDiscount'].salesEndTime | date: 'yyyy-MM-dd HH:mm'}}</td> |
||||||
|
<td>{{data.stockCount}}</td> |
||||||
|
</tbody> |
||||||
|
</nz-table> |
||||||
|
</nz-modal> |
||||||
|
|
||||||
|
|
||||||
|
<nz-modal [(nzVisible)]="isVisibleDistribute" nzTitle="分发卡券" (nzOnCancel)="handleCancelDistribute()" [nzOkLoading]="isOkLoading" (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> |
||||||
|
<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> |
||||||
|
<td> |
||||||
|
<a (click)="getList(data['id'])">分发历史</a> |
||||||
|
</td> |
||||||
|
|
||||||
|
</tbody> |
||||||
|
</nz-table> |
||||||
|
</nz-modal> |
||||||
|
|
||||||
|
<nz-modal [(nzVisible)]="isVisibleShow" nzWidth="700" nzTitle="分发记录" (nzOnCancel)="handleCancelListShow()" (nzOnOk)="handleCancelListShow()"> |
||||||
|
<nz-table #basicTable [nzData]="dataSet"> |
||||||
|
<thead> |
||||||
|
<tr> |
||||||
|
<th>卡券名称</th> |
||||||
|
<th>代理商</th> |
||||||
|
<th>分发数量</th> |
||||||
|
<th>分发时间</th> |
||||||
|
</tr> |
||||||
|
</thead> |
||||||
|
<tbody> |
||||||
|
<tr *ngFor="let data of basicTable.data"> |
||||||
|
<td>{{data.couponName}}</td> |
||||||
|
<td>{{data.agentName}}</td> |
||||||
|
<td>{{data.stockCount}}</td> |
||||||
|
<td>{{data['createTime'] | date: 'yyyy-MM-dd HH:mm'}}</td> |
||||||
|
</tr> |
||||||
|
</tbody> |
||||||
|
</nz-table> |
||||||
|
</nz-modal> |
@ -0,0 +1,12 @@ |
|||||||
|
.head_img { |
||||||
|
height: 80px; |
||||||
|
width: 80px; |
||||||
|
} |
||||||
|
.table-td-operation { |
||||||
|
a { |
||||||
|
margin-left: 8px; |
||||||
|
} |
||||||
|
} |
||||||
|
.li-a :hover { |
||||||
|
color: #1890ff; |
||||||
|
} |
@ -0,0 +1,307 @@ |
|||||||
|
import { Component, OnInit } from '@angular/core'; |
||||||
|
import {environment} from "../../../../environments/environment"; |
||||||
|
import {FormBuilder, FormGroup, Validators} from "_@angular_forms@9.0.7@@angular/forms"; |
||||||
|
import {AgentService} from "../../../services/agent.service"; |
||||||
|
import {DiscountService} from "../../../services/discount.service"; |
||||||
|
import {CouponService} from "../../../services/coupon.service"; |
||||||
|
import {IconService} from "../../../services/icon.service"; |
||||||
|
import {NzMessageService} from "_ng-zorro-antd@9.3.0@ng-zorro-antd"; |
||||||
|
import {Router} from "_@angular_router@9.0.7@@angular/router"; |
||||||
|
import {CommonsService} from "../../../services/commons.service"; |
||||||
|
|
||||||
|
@Component({ |
||||||
|
selector: 'app-order-list', |
||||||
|
templateUrl: './order-list.component.html', |
||||||
|
styleUrls: ['./order-list.component.scss'] |
||||||
|
}) |
||||||
|
export class OrderListComponent 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; |
||||||
|
isOkLoading = false; |
||||||
|
isVisibleShow = false; |
||||||
|
dataSet; |
||||||
|
constructor( |
||||||
|
private form: FormBuilder, |
||||||
|
private agent: AgentService, |
||||||
|
private discount: DiscountService, |
||||||
|
private coupon: CouponService, |
||||||
|
private iconService: IconService, |
||||||
|
private message: NzMessageService, |
||||||
|
private router: Router, |
||||||
|
private common: CommonsService |
||||||
|
) { |
||||||
|
} |
||||||
|
|
||||||
|
ngOnInit(): void { |
||||||
|
this.init(); |
||||||
|
} |
||||||
|
|
||||||
|
public init(): void { |
||||||
|
this.searchForm = this.form.group({ |
||||||
|
agentName: [null], |
||||||
|
agentPhone: [null], |
||||||
|
status: [null], |
||||||
|
}); |
||||||
|
this.validateForm = this.form.group({ |
||||||
|
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); |
||||||
|
} |
||||||
|
|
||||||
|
// 查询列表
|
||||||
|
public getRequest(reset: boolean = false, whereObject: object) { |
||||||
|
|
||||||
|
this.loading = false; |
||||||
|
if (reset) { |
||||||
|
this.pageNum = 1; |
||||||
|
} |
||||||
|
whereObject['pageNum'] = this.pageNum; |
||||||
|
whereObject['pageSize'] = this.pageSize; |
||||||
|
this.agent.getListAgent(whereObject, data => { |
||||||
|
if (data['return_code'] === '000000') { |
||||||
|
this.requestData = data['return_data'].list; |
||||||
|
this.total = data['return_data'].total; |
||||||
|
} else { |
||||||
|
this.message.error(data['return_msg']); |
||||||
|
} |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
// 重置
|
||||||
|
public resetForm(): void { |
||||||
|
this.searchForm.reset(); |
||||||
|
} |
||||||
|
|
||||||
|
public getForbiddenUser(id, status: any): void { |
||||||
|
const message = (status === 1 ? '是否禁用当前代理商' : '是否启用当前代理商'); |
||||||
|
|
||||||
|
this.common.showConfirm(message, data => { |
||||||
|
if (data) { |
||||||
|
this.agent.editStatus(id, dataUser => { |
||||||
|
this.getRequest(false, this.searchForm.value); |
||||||
|
}); |
||||||
|
} |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
// 修改
|
||||||
|
public getEdit(id: number): void { |
||||||
|
this.router.navigate(['/admin/agent/agent-edit'], { |
||||||
|
queryParams: { |
||||||
|
agentId: id |
||||||
|
} |
||||||
|
}).then(r => console.log(r)); |
||||||
|
} |
||||||
|
|
||||||
|
// 查看详情
|
||||||
|
public getDetail(id: number): void { |
||||||
|
this.router.navigate(['/admin/company/company-detail'], { |
||||||
|
queryParams: { |
||||||
|
companyId: id |
||||||
|
} |
||||||
|
}).then(r => console.log(r)); |
||||||
|
} |
||||||
|
|
||||||
|
// 绑定优惠券
|
||||||
|
public getDiscount(id: number): void { |
||||||
|
this.id = id; |
||||||
|
const whereObject = {}; |
||||||
|
whereObject['pageNum'] = 1; |
||||||
|
whereObject['pageSize'] = 10000; |
||||||
|
this.discount.getDiscountList(whereObject, data => { |
||||||
|
if (data['return_code'] === '000000') { |
||||||
|
this.discountList = data['return_data'].list; |
||||||
|
} else { |
||||||
|
this.message.error(data['return_msg']); |
||||||
|
} |
||||||
|
}); |
||||||
|
this.isVisible = true; |
||||||
|
} |
||||||
|
|
||||||
|
handleOk(): void { |
||||||
|
// tslint:disable-next-line:forin
|
||||||
|
for (const i in this.validateForm.controls) { |
||||||
|
this.validateForm.controls[i].markAsDirty(); |
||||||
|
this.validateForm.controls[i].updateValueAndValidity(); |
||||||
|
if (this.validateForm.controls[i].errors != null) { |
||||||
|
this.message.error('必填项不能为空'); |
||||||
|
return; |
||||||
|
} |
||||||
|
} |
||||||
|
// this.isSpinning = true;
|
||||||
|
this.validateForm.value['agentId'] = this.id; |
||||||
|
this.agent.insertDiscountAgent(this.validateForm.value , data => { |
||||||
|
if (data['return_code'] === '000000') { |
||||||
|
this.message.success('生成中,请耐心等待!'); |
||||||
|
this.isVisible = false; |
||||||
|
} else { |
||||||
|
this.message.error(data['return_msg']); |
||||||
|
} |
||||||
|
this.isSpinning = false; |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
handleCancel(): void { |
||||||
|
this.isVisible = false; |
||||||
|
} |
||||||
|
|
||||||
|
public getDiscountList(id: number): void { |
||||||
|
this.id = id; |
||||||
|
this.isVisibleDiscount = true; |
||||||
|
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 = true; |
||||||
|
if (reset) { |
||||||
|
this.pageNumDiscount = 1; |
||||||
|
} |
||||||
|
whereObject['pageNum'] = this.pageNumDiscount; |
||||||
|
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; |
||||||
|
} else { |
||||||
|
this.message.error(data['return_msg']); |
||||||
|
} |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
// 分发卡券
|
||||||
|
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.isOkLoading = true; |
||||||
|
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; |
||||||
|
this.isOkLoading = false; |
||||||
|
} else { |
||||||
|
this.message.error(data['return_msg']); |
||||||
|
} |
||||||
|
this.isSpinning = false; |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
public getList(id: number): void { |
||||||
|
const whereObject = {}; |
||||||
|
whereObject['pageNum'] = 1; |
||||||
|
whereObject['pageSize'] = 10000; |
||||||
|
whereObject['couponAgentId'] = id; |
||||||
|
this.isVisibleShow = true; |
||||||
|
this.agent.getRecordByCouponAgentId(whereObject , data => { |
||||||
|
if (data['return_code'] === '000000') { |
||||||
|
this.dataSet = data['return_data'].list; |
||||||
|
} else { |
||||||
|
this.message.error(data['return_msg']); |
||||||
|
} |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
handleCancelListShow() { |
||||||
|
this.isVisibleShow = false; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,106 @@ |
|||||||
|
<!-- start 面包屑 --> |
||||||
|
<app-breadcrumb></app-breadcrumb> |
||||||
|
<!-- end 面包屑 --> |
||||||
|
|
||||||
|
<!--条件搜索--> |
||||||
|
<div class="inner-content"> |
||||||
|
<form nz-form [formGroup]="searchForm" (ngSubmit)="getRequest(true , searchForm.value)"> |
||||||
|
<div nz-row> |
||||||
|
|
||||||
|
<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="type" nzPlaceHolder="请选择金额类型"> |
||||||
|
<nz-option nzLabel="话费充值" nzValue="1"></nz-option> |
||||||
|
<nz-option nzLabel="中石化" nzValue="2"></nz-option> |
||||||
|
<nz-option nzLabel="中石油" nzValue="3"></nz-option> |
||||||
|
</nz-select> |
||||||
|
</nz-form-control> |
||||||
|
</nz-form-item> |
||||||
|
</div> |
||||||
|
|
||||||
|
</div> |
||||||
|
|
||||||
|
<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> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</form> |
||||||
|
</div> |
||||||
|
|
||||||
|
|
||||||
|
<div class="inner-content"> |
||||||
|
<span>共计 {{total}} 条数据</span> |
||||||
|
<div class="operating-button"> |
||||||
|
<button nz-button nzType="primary" class="right-btn" (click)="getEdit()"><i nz-icon nzType="plus" nzTheme="outline"></i>添加 |
||||||
|
</button> |
||||||
|
</div> |
||||||
|
<nz-table |
||||||
|
class="table" |
||||||
|
#ajaxTable |
||||||
|
nzShowSizeChanger |
||||||
|
[nzFrontPagination]="false" |
||||||
|
[nzData]="requestData" |
||||||
|
[nzLoading]="loading" |
||||||
|
[nzTotal]="total" |
||||||
|
[(nzPageIndex)]="pageNum" |
||||||
|
[(nzPageSize)]="pageSize" |
||||||
|
(nzPageIndexChange)="getRequest(false , searchForm.value)" |
||||||
|
(nzPageSizeChange)="getRequest(false , searchForm.value)"> |
||||||
|
<thead nzSingleSort> |
||||||
|
<tr> |
||||||
|
<th>编号</th> |
||||||
|
<th>金额类型</th> |
||||||
|
<th>充值金额</th> |
||||||
|
<th>支付金额</th> |
||||||
|
<th>创建时间</th> |
||||||
|
<th>操作</th> |
||||||
|
</tr> |
||||||
|
</thead> |
||||||
|
<tbody> |
||||||
|
<tr *ngFor="let data of ajaxTable.data; let i = index"> |
||||||
|
<td>{{i + 1}}</td> |
||||||
|
<td>{{data.type | rechargePrice}}</td> |
||||||
|
<td>{{data.price}}</td> |
||||||
|
<td>{{data.realPrice}}</td> |
||||||
|
<td>{{data.createTime | date: 'yyyy-MM-dd HH:mm'}}</td> |
||||||
|
<td class="table-td-operation"> |
||||||
|
<a (click)="getEdit(data.id)">编辑</a> |
||||||
|
<a style="margin-left: 20px;" (click)="getEdit(data.id)">删除</a> |
||||||
|
</td> |
||||||
|
</tbody> |
||||||
|
</nz-table> |
||||||
|
</div> |
||||||
|
|
||||||
|
<nz-modal [(nzVisible)]="isVisible" nzTitle="金额编辑" (nzOnCancel)="handleCancel()" (nzOnOk)="handleOk()"> |
||||||
|
<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-select nzShowSearch nzAllowClear formControlName="type" nzPlaceHolder="请选择类型"> |
||||||
|
<nz-option nzLabel="话费充值" nzValue="1"></nz-option> |
||||||
|
<nz-option nzLabel="中石化" nzValue="2"></nz-option> |
||||||
|
<nz-option nzLabel="中石油" nzValue="3"></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="price"/> |
||||||
|
</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="realPrice"/> |
||||||
|
</nz-form-control> |
||||||
|
</nz-form-item> |
||||||
|
</form> |
||||||
|
</nz-modal> |
||||||
|
|
@ -0,0 +1,124 @@ |
|||||||
|
import { Component, OnInit } from '@angular/core'; |
||||||
|
import {environment} from '../../../../environments/environment'; |
||||||
|
import {FormBuilder, FormGroup, Validators} from '_@angular_forms@9.0.7@@angular/forms'; |
||||||
|
import {DiscountService} from '../../../services/discount.service'; |
||||||
|
import {CouponService} from '../../../services/coupon.service'; |
||||||
|
import {IconService} from '../../../services/icon.service'; |
||||||
|
import {NzMessageService} from '_ng-zorro-antd@9.3.0@ng-zorro-antd'; |
||||||
|
import {Router} from '_@angular_router@9.0.7@@angular/router'; |
||||||
|
import {CommonsService} from '../../../services/commons.service'; |
||||||
|
import {RechargeService} from '../../../services/recharge.service'; |
||||||
|
|
||||||
|
@Component({ |
||||||
|
selector: 'app-price-list', |
||||||
|
templateUrl: './price-list.component.html', |
||||||
|
styleUrls: ['./price-list.component.scss'] |
||||||
|
}) |
||||||
|
export class PriceListComponent implements OnInit { |
||||||
|
WEB_SERVE_URL = environment.imageUrl; |
||||||
|
searchForm: FormGroup; // 搜索框
|
||||||
|
validateForm: FormGroup; // 添加框
|
||||||
|
requestData = []; // 列表数据
|
||||||
|
|
||||||
|
total: number; // 页码
|
||||||
|
pageNum = 1; // 页码
|
||||||
|
pageSize = 10; // 条码
|
||||||
|
loading = true; |
||||||
|
isVisible = false; |
||||||
|
id: number; |
||||||
|
|
||||||
|
constructor( |
||||||
|
private form: FormBuilder, |
||||||
|
private recharge: RechargeService, |
||||||
|
private discount: DiscountService, |
||||||
|
private coupon: CouponService, |
||||||
|
private iconService: IconService, |
||||||
|
private message: NzMessageService, |
||||||
|
private router: Router, |
||||||
|
private common: CommonsService |
||||||
|
) { |
||||||
|
} |
||||||
|
|
||||||
|
ngOnInit(): void { |
||||||
|
this.init(); |
||||||
|
} |
||||||
|
|
||||||
|
public init(): void { |
||||||
|
this.searchForm = this.form.group({ |
||||||
|
type: [null], |
||||||
|
}); |
||||||
|
this.validateForm = this.form.group({ |
||||||
|
type: [null, [Validators.required]], |
||||||
|
price: [null, [Validators.required]], |
||||||
|
realPrice: [null, [Validators.required]], |
||||||
|
}); |
||||||
|
|
||||||
|
this.getRequest(true, this.searchForm.value); |
||||||
|
} |
||||||
|
|
||||||
|
// 查询列表
|
||||||
|
public getRequest(reset: boolean = false, whereObject: object) { |
||||||
|
|
||||||
|
this.loading = false; |
||||||
|
if (reset) { |
||||||
|
this.pageNum = 1; |
||||||
|
} |
||||||
|
whereObject['pageNum'] = this.pageNum; |
||||||
|
whereObject['pageSize'] = this.pageSize; |
||||||
|
this.recharge.getListOutRechargePrice(whereObject, data => { |
||||||
|
if (data['return_code'] === '000000') { |
||||||
|
this.requestData = data['return_data'].list; |
||||||
|
this.total = data['return_data'].total; |
||||||
|
} else { |
||||||
|
this.message.error(data['return_msg']); |
||||||
|
} |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
// 重置
|
||||||
|
public resetForm(): void { |
||||||
|
this.searchForm.reset(); |
||||||
|
} |
||||||
|
|
||||||
|
// 修改
|
||||||
|
public getEdit(id?: number): void { |
||||||
|
this.isVisible = true; |
||||||
|
} |
||||||
|
|
||||||
|
// 查看详情
|
||||||
|
public getDetail(id: number): void { |
||||||
|
this.router.navigate(['/admin/company/company-detail'], { |
||||||
|
queryParams: { |
||||||
|
companyId: id |
||||||
|
} |
||||||
|
}).then(r => console.log(r)); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
handleOk(): void { |
||||||
|
// tslint:disable-next-line:forin
|
||||||
|
for (const i in this.validateForm.controls) { |
||||||
|
this.validateForm.controls[i].markAsDirty(); |
||||||
|
this.validateForm.controls[i].updateValueAndValidity(); |
||||||
|
if (this.validateForm.controls[i].errors != null) { |
||||||
|
this.message.error('必填项不能为空'); |
||||||
|
return; |
||||||
|
} |
||||||
|
} |
||||||
|
this.validateForm.value['agentId'] = this.id; |
||||||
|
this.recharge.insertPrice(this.validateForm.value , data => { |
||||||
|
if (data['return_code'] === '000000') { |
||||||
|
this.message.success('添加成功'); |
||||||
|
this.isVisible = false; |
||||||
|
} else { |
||||||
|
this.message.error(data['return_msg']); |
||||||
|
} |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
handleCancel(): void { |
||||||
|
this.isVisible = false; |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,17 @@ |
|||||||
|
import { NgModule } from '@angular/core'; |
||||||
|
import { Routes, RouterModule } from '@angular/router'; |
||||||
|
import {OrderListComponent} from './order-list/order-list.component'; |
||||||
|
import {PriceListComponent} from './price-list/price-list.component'; |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const routes: Routes = [ |
||||||
|
{ path: 'order-list', component: OrderListComponent }, |
||||||
|
{ path: 'price-list', component: PriceListComponent}, |
||||||
|
]; |
||||||
|
|
||||||
|
@NgModule({ |
||||||
|
imports: [RouterModule.forChild(routes)], |
||||||
|
exports: [RouterModule] |
||||||
|
}) |
||||||
|
export class RechargeOrderRoutingModule { } |
@ -0,0 +1,29 @@ |
|||||||
|
import { NgModule } from '@angular/core'; |
||||||
|
import { CommonModule } from '@angular/common'; |
||||||
|
|
||||||
|
import { RechargeOrderRoutingModule } from './recharge-order-routing.module'; |
||||||
|
import { OrderListComponent } from './order-list/order-list.component'; |
||||||
|
import { PriceListComponent } from './price-list/price-list.component'; |
||||||
|
import {NgZorroAntdModule} from '_ng-zorro-antd@9.3.0@ng-zorro-antd'; |
||||||
|
import {SeparateModule} from '../../common/separate/separate.module'; |
||||||
|
import {FormsModule, ReactiveFormsModule} from '_@angular_forms@9.0.7@@angular/forms'; |
||||||
|
import {BreadcrumbModule} from '../../common/breadcrumb/breadcrumb.module'; |
||||||
|
import {RegionSelectorModule} from '../../common/region-selector/region-selector.module'; |
||||||
|
import {AppCommonModule} from '../../app-common.module'; |
||||||
|
|
||||||
|
|
||||||
|
@NgModule({ |
||||||
|
declarations: [OrderListComponent, PriceListComponent], |
||||||
|
imports: [ |
||||||
|
CommonModule, |
||||||
|
RechargeOrderRoutingModule, |
||||||
|
NgZorroAntdModule, |
||||||
|
SeparateModule, |
||||||
|
ReactiveFormsModule, |
||||||
|
FormsModule, |
||||||
|
BreadcrumbModule, |
||||||
|
RegionSelectorModule, |
||||||
|
AppCommonModule |
||||||
|
] |
||||||
|
}) |
||||||
|
export class RechargeOrderModule { } |
@ -0,0 +1,19 @@ |
|||||||
|
import { Pipe, PipeTransform } from '@angular/core'; |
||||||
|
|
||||||
|
@Pipe({ |
||||||
|
name: 'rechargePrice' |
||||||
|
}) |
||||||
|
export class RechargePricePipe implements PipeTransform { |
||||||
|
|
||||||
|
transform(value: number): string { |
||||||
|
switch (value) { |
||||||
|
case 1: |
||||||
|
return '话费充值'; |
||||||
|
case 2: |
||||||
|
return '中石化'; |
||||||
|
case 3: |
||||||
|
return '中石油'; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,66 @@ |
|||||||
|
import { Injectable } from '@angular/core'; |
||||||
|
import {HttpClient} from '_@angular_common@9.0.7@@angular/common/http'; |
||||||
|
import {CommonsService} from './commons.service'; |
||||||
|
import {environment} from '../../environments/environment'; |
||||||
|
|
||||||
|
@Injectable({ |
||||||
|
providedIn: 'root' |
||||||
|
}) |
||||||
|
export class RechargeService { |
||||||
|
|
||||||
|
constructor( |
||||||
|
private http: HttpClient, |
||||||
|
private common: CommonsService |
||||||
|
) { |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 查询列表 |
||||||
|
* |
||||||
|
* @param paramsObject 对象 |
||||||
|
* @param callBack 回调 |
||||||
|
*/ |
||||||
|
public getListOutRechargePrice(paramsObject: object, callBack) { |
||||||
|
this.http.get(environment.baseUrl + 'outRechargePrice/getListOutRechargePrice?' + this.common.getWhereCondition(paramsObject)).subscribe(data => { |
||||||
|
callBack(data); |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 新增 |
||||||
|
* |
||||||
|
* @param params 上传对象 |
||||||
|
* @param callBack 回调 |
||||||
|
* @return data 返回结果 |
||||||
|
*/ |
||||||
|
public insertPrice(params: object, callBack) { |
||||||
|
this.http.post(environment.baseUrl + 'outRechargePrice/insertPrice', params).subscribe(data => { |
||||||
|
callBack(data); |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 修改卡券 |
||||||
|
* |
||||||
|
* @param params 上传对象 |
||||||
|
* @param callBack 回调 |
||||||
|
* @return data 返回结果 |
||||||
|
*/ |
||||||
|
public updateAgent(params: object, callBack) { |
||||||
|
this.http.post(environment.baseUrl + 'outRechargePrice/updatePrice', params).subscribe(data => { |
||||||
|
callBack(data); |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 根据id查询详情 |
||||||
|
* |
||||||
|
* @param agentId id |
||||||
|
* @param callBack 回调 |
||||||
|
*/ |
||||||
|
public findByAgentId(agentId: number, callBack) { |
||||||
|
this.http.get(environment.baseUrl + 'highAgent/findByAgentId?agentId=' + agentId).subscribe(data => { |
||||||
|
callBack(data); |
||||||
|
}); |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue