parent
9fb247fef1
commit
3109fee9c1
@ -0,0 +1,78 @@ |
||||
<form nz-form [formGroup]="searchForm" class="search_form" [nzLayout]="'vertical'"> |
||||
<div nz-row [nzGutter]="24"> |
||||
<div nz-col [nzSpan]="6"> |
||||
<nz-form-item> |
||||
<nz-form-label>交易类型</nz-form-label> |
||||
<nz-form-control> |
||||
<nz-select formControlName="type" nzAllowClear [nzPlaceHolder]="'请选择'"> |
||||
<nz-option nzValue="1" nzLabel="入账"></nz-option> |
||||
<nz-option nzValue="2" nzLabel="出账"></nz-option> |
||||
</nz-select> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
|
||||
<div nz-col [nzSpan]="6"> |
||||
<nz-form-item> |
||||
<nz-form-label>交易来源</nz-form-label> |
||||
<nz-form-control> |
||||
<nz-select formControlName="sourceType" nzAllowClear [nzPlaceHolder]="'请选择'"> |
||||
<nz-option *ngFor="let item of sourceTypeArray" nzValue="{{item.codeValue}}" nzLabel="{{item.codeName}}"></nz-option> |
||||
</nz-select> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
|
||||
<div nz-col [nzSpan]="6"> |
||||
<nz-form-item> |
||||
<nz-form-label></nz-form-label> |
||||
<nz-form-control> |
||||
<button nz-button style="margin-right: 8px" [nzType]="'primary'" (click)="searchFormSubmit()">查询</button> |
||||
<button nz-button style="margin-right: 8px" (click)="searchFormReset()">重置</button> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
</div> |
||||
</form> |
||||
|
||||
<div class="csp-statistic"> |
||||
<div class="csp-statistic-title"> |
||||
<span>账户余额:</span> |
||||
<span class="csp-text-primary" style="margin-right: 50px;">¥ {{agentAccount.amount}}</span> |
||||
</div> |
||||
</div> |
||||
<nz-table #basicTable |
||||
[nzScroll]="{ x: '2400' }" |
||||
[nzBordered]="true" |
||||
[nzFrontPagination]="false" |
||||
[nzShowQuickJumper]="true" |
||||
[nzShowTotal]="totalTemplate" |
||||
[(nzPageIndex)]="tablePageNum" |
||||
(nzPageIndexChange)="queryData()" |
||||
nzShowSizeChanger |
||||
(nzPageSizeChange)="this.tablePageSize = $event;queryData()" |
||||
[nzPageSizeOptions]="[ 10, 20, 30, 50, 100 ]" |
||||
[nzTotal]="tableData.total" |
||||
[nzData]="tableData.list" > |
||||
<thead> |
||||
<tr> |
||||
<th nzWidth="90px">交易前金额</th> |
||||
<th nzWidth="80px">交易金额</th> |
||||
<th nzWidth="90px">交易后金额</th> |
||||
<th nzWidth="50px">交易类型</th> |
||||
<th nzWidth="100px">交易时间</th> |
||||
<th nzWidth="120px">交易来源</th> |
||||
<!-- <th nzRight nzWidth="50px">操作</th>--> |
||||
</tr> |
||||
</thead> |
||||
<tbody> |
||||
<tr *ngFor="let data of basicTable.data"> |
||||
<td>¥{{data.beforeAmount}}</td> |
||||
<td>¥{{data.transactionAmount}}</td> |
||||
<td>¥{{data.afterAmount}}</td> |
||||
<td>{{data.type==1?'入账':'出账'}}</td> |
||||
<td>{{data.createTime | date: 'yyyy-MM-dd HH:mm:ss'}}</td> |
||||
<td>{{data.sourceType | dictionary: 'MER_ACCOUNT_RECORD_SOURCE_TYPE'}}</td> |
||||
</tbody> |
||||
<ng-template #totalTemplate let-total>总计 {{ total }} 条</ng-template> |
||||
</nz-table> |
@ -0,0 +1,18 @@ |
||||
.csp-statistic { |
||||
font-feature-settings: "tnum"; |
||||
border: 1px solid #d9d9d9; |
||||
border-radius: 4px; |
||||
} |
||||
.csp-statistic-title { |
||||
padding: 0 16px; |
||||
height: 64px; |
||||
display: -ms-flexbox; |
||||
display: flex; |
||||
-ms-flex-align: center; |
||||
align-items: center; |
||||
background-color: #fafafa; |
||||
} |
||||
.csp-text-primary{ |
||||
font-size: 20px; |
||||
color: #1890ff; |
||||
} |
@ -0,0 +1,169 @@ |
||||
import {Component, Input, OnInit} from '@angular/core'; |
||||
import {DatePipe, NgForOf, NgIf} from "@angular/common"; |
||||
import {DictionaryPipe} from "../../../pipes/common/dictionary.pipe"; |
||||
import {FormGroup, FormsModule, NonNullableFormBuilder, ReactiveFormsModule, Validators} from "@angular/forms"; |
||||
import {NzButtonComponent} from "ng-zorro-antd/button"; |
||||
import { |
||||
NzCellFixedDirective, |
||||
NzTableCellDirective, |
||||
NzTableComponent, NzTableModule, |
||||
NzTbodyComponent, NzTheadComponent, |
||||
NzThMeasureDirective, NzTrDirective |
||||
} from "ng-zorro-antd/table"; |
||||
import {NzColDirective, NzRowDirective} from "ng-zorro-antd/grid"; |
||||
import {NzDividerComponent} from "ng-zorro-antd/divider"; |
||||
import {NzDropDownADirective, NzDropDownDirective, NzDropdownMenuComponent} from "ng-zorro-antd/dropdown"; |
||||
import {NzFormControlComponent, NzFormDirective, NzFormItemComponent, NzFormLabelComponent} from "ng-zorro-antd/form"; |
||||
import {NzIconDirective} from "ng-zorro-antd/icon"; |
||||
import {NzInputDirective} from "ng-zorro-antd/input"; |
||||
import {NzMenuDirective, NzMenuItemComponent} from "ng-zorro-antd/menu"; |
||||
import {NzOptionComponent, NzSelectComponent} from "ng-zorro-antd/select"; |
||||
import {NzModalModule, NzModalService} from "ng-zorro-antd/modal"; |
||||
import {NzFlexDirective} from "ng-zorro-antd/flex"; |
||||
import {NzDescriptionsModule} from "ng-zorro-antd/descriptions"; |
||||
import {NzUploadComponent} from "ng-zorro-antd/upload"; |
||||
import {NzAvatarModule} from "ng-zorro-antd/avatar"; |
||||
import {NzImageModule} from "ng-zorro-antd/image"; |
||||
import {NzSwitchComponent} from "ng-zorro-antd/switch"; |
||||
import {NzDatePickerComponent} from "ng-zorro-antd/date-picker"; |
||||
import {NzInputNumberModule} from "ng-zorro-antd/input-number"; |
||||
import {NzMessageService} from "ng-zorro-antd/message"; |
||||
import {AgentApiService} from "../../../services/agent/agent-api.service"; |
||||
import {CommonService} from "../../../services/common/common.service"; |
||||
import {AgentService} from "../../../services/agent/agent.service"; |
||||
import {BrowserStorageService} from "../../../utils/localStorage.service"; |
||||
import {NzStatisticComponent, NzStatisticModule} from "ng-zorro-antd/statistic"; |
||||
import {NzTypographyComponent} from "ng-zorro-antd/typography"; |
||||
|
||||
@Component({ |
||||
selector: 'app-agent-api-account', |
||||
standalone: true, |
||||
imports: [ |
||||
DatePipe, |
||||
DictionaryPipe, |
||||
FormsModule, |
||||
NgForOf, |
||||
NgIf, |
||||
NzButtonComponent, |
||||
NzCellFixedDirective, |
||||
NzColDirective, |
||||
NzDividerComponent, |
||||
NzDropDownADirective, |
||||
NzDropDownDirective, |
||||
NzDropdownMenuComponent, |
||||
NzFormControlComponent, |
||||
NzFormDirective, |
||||
NzFormItemComponent, |
||||
NzFormLabelComponent, |
||||
NzIconDirective, |
||||
NzInputDirective, |
||||
NzMenuDirective, |
||||
NzMenuItemComponent, |
||||
NzOptionComponent, |
||||
NzRowDirective, |
||||
NzSelectComponent, |
||||
NzTableCellDirective, |
||||
NzTableComponent, |
||||
NzTbodyComponent, |
||||
NzThMeasureDirective, |
||||
NzTheadComponent, |
||||
NzTrDirective, |
||||
ReactiveFormsModule, |
||||
NzTableModule, |
||||
NzModalModule, |
||||
NzFlexDirective, |
||||
NzDescriptionsModule, |
||||
NzUploadComponent, |
||||
NzAvatarModule, |
||||
NzImageModule, |
||||
NzSwitchComponent, |
||||
NzDatePickerComponent, |
||||
NzInputNumberModule, |
||||
NzStatisticModule, |
||||
NzTypographyComponent |
||||
], |
||||
templateUrl: './agent-api-account.component.html', |
||||
styleUrl: './agent-api-account.component.less' |
||||
}) |
||||
export class AgentApiAccountComponent implements OnInit { |
||||
@Input() agentId: any; |
||||
// 表单页数
|
||||
tablePageNum = 1; |
||||
// 每页数量
|
||||
tablePageSize = 10; |
||||
// 表单数据
|
||||
tableData: any = { |
||||
total: 0, |
||||
list: [], |
||||
}; |
||||
// 代理账户
|
||||
agentAccount: any = { |
||||
amount: 0 |
||||
}; |
||||
// 搜索表单
|
||||
searchForm: FormGroup; |
||||
// 代理商类型
|
||||
sourceTypeArray = new DictionaryPipe().getDictionaryList('MER_ACCOUNT_RECORD_SOURCE_TYPE'); |
||||
constructor(private fb: NonNullableFormBuilder, |
||||
private message: NzMessageService, |
||||
private storage: BrowserStorageService, |
||||
private agentService: AgentService, |
||||
private agentApiService: AgentApiService, |
||||
private commonService: CommonService, |
||||
private modal: NzModalService) { |
||||
// 初始化搜索框
|
||||
this.searchForm = this.fb.group({ |
||||
type: [null], |
||||
sourceType: [null], |
||||
}); |
||||
} |
||||
|
||||
ngOnInit(): void { |
||||
// 查询数据
|
||||
this.queryData(); |
||||
this.queryAccount(); |
||||
} |
||||
|
||||
/** |
||||
* 获取数据 |
||||
*/ |
||||
queryData() { |
||||
this.searchForm.value.agentId = this.agentId; |
||||
this.searchForm.value.pageNum = this.tablePageNum; |
||||
this.searchForm.value.pageSize = this.tablePageSize; |
||||
this.searchForm.value.time = new Date().getTime(); |
||||
this.agentApiService.getRecordList(this.searchForm.value, (data: any) => { |
||||
if (data['return_code'] == '000000') { |
||||
this.tableData = data['return_data']; |
||||
} |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 查询账户 |
||||
*/ |
||||
queryAccount() { |
||||
this.searchForm.value.agentId = this.agentId; |
||||
this.agentApiService.getAccount(this.searchForm.value, (data: any) => { |
||||
if (data['return_code'] == '000000') { |
||||
this.agentAccount = data['return_data']; |
||||
} |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 搜索表单提交 |
||||
*/ |
||||
searchFormSubmit(): void { |
||||
this.tablePageNum = 1; |
||||
this.queryData(); |
||||
} |
||||
|
||||
/** |
||||
* 搜索表单重置 |
||||
*/ |
||||
searchFormReset(): void { |
||||
this.searchForm.reset(); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,255 @@ |
||||
<form nz-form [formGroup]="searchForm" class="search_form" [nzLayout]="'vertical'"> |
||||
<div nz-row [nzGutter]="24"> |
||||
|
||||
<div nz-col [nzSpan]="6"> |
||||
<nz-form-item> |
||||
<nz-form-label>代理类型</nz-form-label> |
||||
<nz-form-control> |
||||
<nz-select formControlName="type" nzAllowClear [nzPlaceHolder]="'请选择'"> |
||||
<nz-option *ngFor="let item of agentTypeArray" nzValue="{{item.codeValue}}" nzLabel="{{item.codeName}}"></nz-option> |
||||
</nz-select> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
|
||||
<div nz-col [nzSpan]="6"> |
||||
<nz-form-item> |
||||
<nz-form-label>代理编号</nz-form-label> |
||||
<nz-form-control> |
||||
<input nz-input formControlName="agentNo" placeholder="请输入" /> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
|
||||
<div nz-col [nzSpan]="6"> |
||||
<nz-form-item> |
||||
<nz-form-label>代理名称</nz-form-label> |
||||
<nz-form-control> |
||||
<input nz-input formControlName="agentName" placeholder="请输入" /> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
|
||||
<div nz-col [nzSpan]="6"> |
||||
<nz-form-item> |
||||
<nz-form-label></nz-form-label> |
||||
<nz-form-control> |
||||
<button nz-button style="margin-right: 8px" [nzType]="'primary'" (click)="searchFormSubmit()">查询</button> |
||||
<button nz-button style="margin-right: 8px" (click)="searchFormReset()">重置</button> |
||||
<button nz-button style="margin-right: 8px" (click)="showEditAgentModal(null)" [nzType]="'primary'" >新增代理商</button> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
</div> |
||||
</form> |
||||
|
||||
<nz-table #basicTable |
||||
[nzScroll]="{ x: '2400' }" |
||||
[nzBordered]="true" |
||||
[nzFrontPagination]="false" |
||||
[nzShowQuickJumper]="true" |
||||
[nzShowTotal]="totalTemplate" |
||||
[(nzPageIndex)]="tablePageNum" |
||||
(nzPageIndexChange)="queryData()" |
||||
nzShowSizeChanger |
||||
(nzPageSizeChange)="this.tablePageSize = $event;queryData()" |
||||
[nzPageSizeOptions]="[ 10, 20, 30, 50, 100 ]" |
||||
[nzTotal]="tableData.total" |
||||
[nzData]="tableData.list" > |
||||
<thead> |
||||
<tr> |
||||
<th nzWidth="50px">代理类型</th> |
||||
<th nzWidth="50px">代理编号</th> |
||||
<th nzWidth="100px">代理名称</th> |
||||
<th nzWidth="100px">联系人</th> |
||||
<th nzWidth="100px">联系方式</th> |
||||
<th nzWidth="100px">创建时间</th> |
||||
<th nzRight nzWidth="70px">操作</th> |
||||
</tr> |
||||
</thead> |
||||
<tbody> |
||||
<tr *ngFor="let data of basicTable.data"> |
||||
<td>{{data.type | dictionary : 'AGENT_TYPE'}}</td> |
||||
<td>{{data.agentNo}}</td> |
||||
<td>{{data.name}}</td> |
||||
<td>{{data.contactsName}}</td> |
||||
<td>{{data.contactsTelephone}}</td> |
||||
<td>{{data.createTime | date : 'yyyy-MM-dd HH:mm:ss'}}</td> |
||||
<td nzRight> |
||||
<a nz-dropdown [nzDropdownMenu]="menu"> |
||||
操作列表 |
||||
<span nz-icon nzType="down"></span> |
||||
</a> |
||||
<nz-dropdown-menu #menu="nzDropdownMenu"> |
||||
<ul nz-menu nzSelectable> |
||||
<li nz-menu-item *ngIf="data.status == 1"><a (click)="showEditAgentModal(data)">修改资料</a></li> |
||||
<li nz-menu-item *ngIf="data.type == 2"><a (click)="showApiRecharge(data)">余额充值</a></li> |
||||
<li nz-menu-item *ngIf="data.type == 2"><a (click)="showRecord(data.id)">动账记录</a></li> |
||||
<li nz-menu-item *ngIf="data.type == 2"><a (click)="showApiParam(data)">接入参数</a></li> |
||||
</ul> |
||||
</nz-dropdown-menu></td> |
||||
</tr> |
||||
</tbody> |
||||
<ng-template #totalTemplate let-total>总计 {{ total }} 条</ng-template> |
||||
</nz-table> |
||||
|
||||
<nz-modal [(nzVisible)]="editAgentModal" |
||||
[nzWidth]="500" |
||||
nzTitle="{{this.editAgentForm.controls['agentNo'].value==null?'新增':'修改'}}" |
||||
[nzFooter]="null" |
||||
(nzOnCancel)="closeEditModal()"> |
||||
<ng-container *nzModalContent> |
||||
<form nz-form [formGroup]="editAgentForm"> |
||||
|
||||
<nz-form-item> |
||||
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>代理类型</nz-form-label> |
||||
<nz-form-control [nzSm]="14" [nzXs]="24"> |
||||
<nz-select formControlName="type" [nzPlaceHolder]="'请选择'"> |
||||
<nz-option *ngFor="let item of agentTypeArray" nzValue="{{item.codeValue}}" nzLabel="{{item.codeName}}"></nz-option> |
||||
</nz-select> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
|
||||
<nz-form-item *ngIf="this.editAgentForm.controls['agentNo'].value == null"> |
||||
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>登录账户</nz-form-label> |
||||
<nz-form-control [nzSm]="14" [nzXs]="24"> |
||||
<input nz-input formControlName="loginName" placeholder="请输入" /> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
|
||||
<nz-form-item> |
||||
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>代理名称</nz-form-label> |
||||
<nz-form-control [nzSm]="14" [nzXs]="24"> |
||||
<input nz-input formControlName="name" placeholder="请输入" /> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
|
||||
<nz-form-item> |
||||
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>联系人</nz-form-label> |
||||
<nz-form-control [nzSm]="14" [nzXs]="24"> |
||||
<input nz-input formControlName="contactsName" placeholder="请输入" /> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
|
||||
<nz-form-item> |
||||
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>联系方式</nz-form-label> |
||||
<nz-form-control [nzSm]="14" [nzXs]="24"> |
||||
<input nz-input formControlName="contactsTelephone" placeholder="请输入" /> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
|
||||
|
||||
<div nz-flex style="margin-top: 15px" [nzJustify]="'center'"> |
||||
<button nz-button nzType="primary" (click)="submitData()" class="submit-btn">保存</button> |
||||
</div> |
||||
</form> |
||||
</ng-container> |
||||
</nz-modal> |
||||
|
||||
<nz-modal [(nzVisible)]="agentApiRechargeModal" |
||||
[nzWidth]="500" |
||||
nzTitle="API余额充值" |
||||
[nzFooter]="null" |
||||
(nzOnCancel)="closeApiRecharge()"> |
||||
<ng-container *nzModalContent> |
||||
<form nz-form [formGroup]="agentApiRechargeForm"> |
||||
<nz-form-item> |
||||
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>代理编号</nz-form-label> |
||||
<nz-form-control [nzSm]="14" [nzXs]="24"> |
||||
<input nz-input formControlName="agentNo" placeholder="请输入" /> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
|
||||
<nz-form-item> |
||||
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>代理名称</nz-form-label> |
||||
<nz-form-control [nzSm]="14" [nzXs]="24"> |
||||
<input nz-input formControlName="agentName" placeholder="请输入" /> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
|
||||
<nz-form-item> |
||||
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>当前余额</nz-form-label> |
||||
<nz-form-control [nzSm]="14" [nzXs]="24"> |
||||
<input nz-input formControlName="currentAmount" placeholder="请输入" /> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
|
||||
<nz-form-item> |
||||
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>充值金额</nz-form-label> |
||||
<nz-form-control [nzSm]="14" [nzXs]="24"> |
||||
<nz-input-number formControlName="amount" [nzMin]="0.01" [nzMax]="9999999" [nzStep]="1" [nzPrecision]="2"></nz-input-number> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
|
||||
<div nz-flex style="margin-top: 15px" [nzJustify]="'center'"> |
||||
<button nz-button nzType="primary" (click)="apiRechargeConfirm()" class="submit-btn">确定</button> |
||||
</div> |
||||
</form> |
||||
</ng-container> |
||||
</nz-modal> |
||||
|
||||
<nz-modal [(nzVisible)]="agentApiParamModal" |
||||
[nzWidth]="700" |
||||
nzTitle="API参数" |
||||
[nzFooter]="null" |
||||
(nzOnCancel)="closeApiParam()"> |
||||
<ng-container *nzModalContent> |
||||
<form nz-form [formGroup]="agentApiParamForm"> |
||||
<nz-form-item> |
||||
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>代理编号</nz-form-label> |
||||
<nz-form-control [nzSm]="14" [nzXs]="24"> |
||||
<input nz-input formControlName="agentNo" placeholder="请输入" /> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
|
||||
<nz-form-item> |
||||
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>代理名称</nz-form-label> |
||||
<nz-form-control [nzSm]="14" [nzXs]="24"> |
||||
<input nz-input formControlName="agentName" placeholder="请输入" /> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
|
||||
<nz-form-item> |
||||
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>appId</nz-form-label> |
||||
<nz-form-control [nzSm]="14" [nzXs]="24"> |
||||
<input nz-input formControlName="appId" placeholder="请输入" /> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
|
||||
<nz-form-item> |
||||
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>appSecret</nz-form-label> |
||||
<nz-form-control [nzSm]="14" [nzXs]="24"> |
||||
<input nz-input formControlName="appSecret" placeholder="请输入" /> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
|
||||
<nz-form-item> |
||||
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>油站信息变更通知</nz-form-label> |
||||
<nz-form-control [nzSm]="14" [nzXs]="24"> |
||||
<input nz-input formControlName="merInfoNotify" placeholder="请输入油站信息变更通知地址" /> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
|
||||
<nz-form-item> |
||||
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>订单退款审核通知</nz-form-label> |
||||
<nz-form-control [nzSm]="14" [nzXs]="24"> |
||||
<input nz-input formControlName="orderRefundNotify" placeholder="请输入订单退款审核通知地址" /> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
|
||||
<div nz-flex style="margin-top: 15px" [nzJustify]="'center'"> |
||||
<button nz-button nzType="primary" (click)="submitApiParam()" class="submit-btn">保存</button> |
||||
</div> |
||||
</form> |
||||
</ng-container> |
||||
</nz-modal> |
||||
|
||||
<nz-modal [(nzVisible)]="agentApiRecordModal" |
||||
[nzWidth]="1000" |
||||
nzTitle="动账记录" |
||||
[nzFooter]="null" |
||||
(nzOnCancel)="closeRecord()"> |
||||
<ng-container *nzModalContent> |
||||
<app-agent-api-account [agentId]="currentAgentId"></app-agent-api-account> |
||||
</ng-container> |
||||
</nz-modal> |
@ -0,0 +1,9 @@ |
||||
nz-input-number { |
||||
width: 100%; |
||||
} |
||||
nz-date-picker { |
||||
width: 100%; |
||||
} |
||||
.submit-btn { |
||||
width: 150px; |
||||
} |
@ -0,0 +1,391 @@ |
||||
import {Component, OnInit} from '@angular/core'; |
||||
import {DatePipe, NgForOf, NgIf} from "@angular/common"; |
||||
import {DictionaryPipe} from "../../../pipes/common/dictionary.pipe"; |
||||
import {NzButtonComponent} from "ng-zorro-antd/button"; |
||||
import { |
||||
NzCellFixedDirective, |
||||
NzTableCellDirective, |
||||
NzTableComponent, NzTableModule, |
||||
NzTbodyComponent, NzTheadComponent, |
||||
NzThMeasureDirective, NzTrDirective |
||||
} from "ng-zorro-antd/table"; |
||||
import {NzColDirective, NzRowDirective} from "ng-zorro-antd/grid"; |
||||
import {NzDividerComponent} from "ng-zorro-antd/divider"; |
||||
import {NzDropDownADirective, NzDropDownDirective, NzDropdownMenuComponent} from "ng-zorro-antd/dropdown"; |
||||
import {NzFlexDirective} from "ng-zorro-antd/flex"; |
||||
import {NzFormControlComponent, NzFormDirective, NzFormItemComponent, NzFormLabelComponent} from "ng-zorro-antd/form"; |
||||
import {NzIconDirective} from "ng-zorro-antd/icon"; |
||||
import {NzInputDirective} from "ng-zorro-antd/input"; |
||||
import {NzMenuDirective, NzMenuItemComponent} from "ng-zorro-antd/menu"; |
||||
import {NzModalComponent, NzModalModule, NzModalService} from "ng-zorro-antd/modal"; |
||||
import {NzOptionComponent, NzSelectComponent} from "ng-zorro-antd/select"; |
||||
import {FormGroup, FormsModule, NonNullableFormBuilder, ReactiveFormsModule, Validators} from "@angular/forms"; |
||||
import {NzImageDirective, NzImageModule} from "ng-zorro-antd/image"; |
||||
import {NzUploadComponent, NzUploadFile} from "ng-zorro-antd/upload"; |
||||
import {NzDescriptionsModule} from "ng-zorro-antd/descriptions"; |
||||
import {NzAvatarModule} from "ng-zorro-antd/avatar"; |
||||
import {NzSwitchComponent} from "ng-zorro-antd/switch"; |
||||
import {NzDatePickerComponent} from "ng-zorro-antd/date-picker"; |
||||
import {NzInputNumberModule} from "ng-zorro-antd/input-number"; |
||||
import {NzMessageService} from "ng-zorro-antd/message"; |
||||
import {BrowserStorageService} from "../../../utils/localStorage.service"; |
||||
import {CommonService} from "../../../services/common/common.service"; |
||||
import {Observable, Observer} from "rxjs"; |
||||
import {AgentService} from "../../../services/agent/agent.service"; |
||||
import {DATA} from "../../../data/login/localStorage.namespace"; |
||||
import {AgentApiService} from "../../../services/agent/agent-api.service"; |
||||
import {AgentApiAccountComponent} from "../agent-api-account/agent-api-account.component"; |
||||
@Component({ |
||||
selector: 'app-agent-list', |
||||
standalone: true, |
||||
imports: [ |
||||
DatePipe, |
||||
DictionaryPipe, |
||||
FormsModule, |
||||
NgForOf, |
||||
NgIf, |
||||
NzButtonComponent, |
||||
NzCellFixedDirective, |
||||
NzColDirective, |
||||
NzDividerComponent, |
||||
NzDropDownADirective, |
||||
NzDropDownDirective, |
||||
NzDropdownMenuComponent, |
||||
NzFormControlComponent, |
||||
NzFormDirective, |
||||
NzFormItemComponent, |
||||
NzFormLabelComponent, |
||||
NzIconDirective, |
||||
NzInputDirective, |
||||
NzMenuDirective, |
||||
NzMenuItemComponent, |
||||
NzOptionComponent, |
||||
NzRowDirective, |
||||
NzSelectComponent, |
||||
NzTableCellDirective, |
||||
NzTableComponent, |
||||
NzTbodyComponent, |
||||
NzThMeasureDirective, |
||||
NzTheadComponent, |
||||
NzTrDirective, |
||||
ReactiveFormsModule, |
||||
NzTableModule, |
||||
NzModalModule, |
||||
NzFlexDirective, |
||||
NzDescriptionsModule, |
||||
NzUploadComponent, |
||||
NzAvatarModule, |
||||
NzImageModule, |
||||
NzSwitchComponent, |
||||
NzDatePickerComponent, |
||||
NzInputNumberModule, |
||||
AgentApiAccountComponent |
||||
], |
||||
templateUrl: './agent-list.component.html', |
||||
styleUrl: './agent-list.component.less' |
||||
}) |
||||
export class AgentListComponent { |
||||
// 表单页数
|
||||
tablePageNum = 1; |
||||
// 每页数量
|
||||
tablePageSize = 10; |
||||
// 表单数据
|
||||
tableData: any = { |
||||
total: 0, |
||||
list: [], |
||||
}; |
||||
// 搜索表单
|
||||
searchForm: FormGroup; |
||||
// 编辑表单
|
||||
editAgentForm: FormGroup; |
||||
editAgentModal = false; |
||||
// 代理商类型
|
||||
agentTypeArray = new DictionaryPipe().getDictionaryList('AGENT_TYPE'); |
||||
// 代理商API额度充值模态框
|
||||
agentApiRechargeModal = false; |
||||
agentApiRechargeForm: FormGroup; |
||||
// 代理商API参数
|
||||
agentApiParamModal = false; |
||||
agentApiParamForm: FormGroup; |
||||
// 代理商API交易记录
|
||||
currentAgentId: any; |
||||
agentApiRecordModal = false; |
||||
|
||||
constructor(private fb: NonNullableFormBuilder, |
||||
private message: NzMessageService, |
||||
private storage: BrowserStorageService, |
||||
private agentService: AgentService, |
||||
private agentApiService: AgentApiService, |
||||
private commonService: CommonService, |
||||
private modal: NzModalService) { |
||||
// 初始化搜索框
|
||||
this.searchForm = this.fb.group({ |
||||
type: [null], |
||||
agentNo: [null], |
||||
agentName: [null], |
||||
}); |
||||
|
||||
this.editAgentForm = this.fb.group({ |
||||
agentNo: [null], |
||||
type: ['', [Validators.required]], |
||||
name: ['', [Validators.required]], |
||||
contactsName: ['', [Validators.required]], |
||||
contactsTelephone: ['', [Validators.required]], |
||||
loginName: [''], |
||||
}); |
||||
|
||||
this.agentApiRechargeForm = this.fb.group({ |
||||
agentId: [{value: null, disabled: true}], |
||||
agentNo: [{value: null, disabled: true}], |
||||
agentName: [{value: null, disabled: true}], |
||||
currentAmount: [{value: null, disabled: true}], |
||||
amount: [0, [Validators.required]], |
||||
}); |
||||
|
||||
this.agentApiParamForm = this.fb.group({ |
||||
agentId: [{value: null, disabled: true}], |
||||
agentNo: [{value: null, disabled: true}], |
||||
agentName: [{value: null, disabled: true}], |
||||
appId: [{value: null, disabled: true}], |
||||
appSecret: [{value: null, disabled: true}], |
||||
merInfoNotify: [null], |
||||
orderRefundNotify: [null], |
||||
}); |
||||
|
||||
// 查询数据
|
||||
this.queryData(); |
||||
} |
||||
|
||||
/** |
||||
* 获取数据 |
||||
*/ |
||||
queryData() { |
||||
this.searchForm.value.pageNum = this.tablePageNum; |
||||
this.searchForm.value.pageSize = this.tablePageSize; |
||||
this.searchForm.value.time = new Date().getTime(); |
||||
this.agentService.queryAgentList(this.searchForm.value, (data: any) => { |
||||
if (data['return_code'] == '000000') { |
||||
this.tableData = data['return_data']; |
||||
} |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 搜索表单提交 |
||||
*/ |
||||
searchFormSubmit(): void { |
||||
this.tablePageNum = 1; |
||||
this.queryData(); |
||||
} |
||||
|
||||
/** |
||||
* 搜索表单重置 |
||||
*/ |
||||
searchFormReset(): void { |
||||
this.searchForm.reset(); |
||||
} |
||||
|
||||
/** |
||||
* 打开编辑模态框 |
||||
*/ |
||||
showEditAgentModal(data: any) { |
||||
if (data != null) { |
||||
data['type'] = String(data['type']); |
||||
this.editAgentForm.patchValue(data); |
||||
this.editAgentForm.controls['type'].disable(); |
||||
} |
||||
this.editAgentModal = true; |
||||
} |
||||
|
||||
/** |
||||
* 提交数据 |
||||
*/ |
||||
submitData() { |
||||
if (this.editAgentForm.valid) { |
||||
if (this.editAgentForm.controls['agentNo'].value == null) { |
||||
this.agentService.createAgent(this.editAgentForm.value, (data: any) => { |
||||
if (data['return_code'] == '000000') { |
||||
this.message.create('success', '操作成功'); |
||||
// 刷新数据
|
||||
this.queryData(); |
||||
// 关闭弹窗
|
||||
this.closeEditModal(); |
||||
// 表单重置
|
||||
this.editAgentForm.reset(); |
||||
} else { |
||||
this.message.create('error', data['return_msg']); |
||||
} |
||||
}); |
||||
} else { |
||||
this.agentService.updateAgent(this.editAgentForm.value, (data: any) => { |
||||
if (data['return_code'] == '000000') { |
||||
this.message.create('success', '操作成功'); |
||||
// 刷新数据
|
||||
this.queryData(); |
||||
// 关闭弹窗
|
||||
this.closeEditModal(); |
||||
// 表单重置
|
||||
this.editAgentForm.reset(); |
||||
} else { |
||||
this.message.create('error', data['return_msg']); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
} else { |
||||
Object.values(this.editAgentForm.controls).forEach(control => { |
||||
if (control.invalid) { |
||||
control.markAsDirty(); |
||||
control.updateValueAndValidity({ onlySelf: true }); |
||||
} |
||||
}); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 关闭编辑模态框 |
||||
*/ |
||||
closeEditModal() { |
||||
this.editAgentForm.reset(); |
||||
this.editAgentForm.controls['agentNo'].setValue(null); |
||||
this.editAgentForm.controls['type'].enable(); |
||||
this.editAgentModal = false; |
||||
} |
||||
|
||||
/** |
||||
* 打开API充值框 |
||||
* @param agent |
||||
*/ |
||||
showApiRecharge(agent: any) { |
||||
this.agentApiService.getAccount({agentId: agent['id']}, (data:any) => { |
||||
if (data['return_code'] == '000000') { |
||||
this.agentApiRechargeForm.patchValue({ |
||||
agentId: agent['id'], |
||||
agentNo: agent['agentNo'], |
||||
agentName: agent['name'], |
||||
currentAmount: data['return_data']['amount'], |
||||
}); |
||||
this.agentApiRechargeModal = true; |
||||
} else { |
||||
this.message.create('error', data['return_msg']); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* api余额充值确认框 |
||||
*/ |
||||
apiRechargeConfirm() { |
||||
if (this.agentApiRechargeForm.valid) { |
||||
this.modal.confirm({ |
||||
nzTitle: '充值提醒', |
||||
nzContent: '确认为【' + this.agentApiRechargeForm.controls['agentName'].value + '】代理API余额充值:¥' +this.agentApiRechargeForm.controls['amount'].value + '吗?', |
||||
nzOnOk: () => this.submitApiRecharge() |
||||
}); |
||||
|
||||
} else { |
||||
Object.values(this.agentApiRechargeForm.controls).forEach(control => { |
||||
if (control.invalid) { |
||||
control.markAsDirty(); |
||||
control.updateValueAndValidity({ onlySelf: true }); |
||||
} |
||||
}); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 提交api充值 |
||||
*/ |
||||
submitApiRecharge() { |
||||
const param = { |
||||
agentId: this.agentApiRechargeForm.controls['agentId'].value, |
||||
amount: this.agentApiRechargeForm.controls['amount'].value, |
||||
} |
||||
this.agentApiService.recharge(param, (data: any) => { |
||||
if (data['return_code'] == '000000') { |
||||
this.message.create('success', '操作成功'); |
||||
// 刷新数据
|
||||
this.queryData(); |
||||
// 关闭弹窗
|
||||
this.closeApiRecharge(); |
||||
} else { |
||||
this.message.create('error', data['return_msg']); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 关闭充值模态框 |
||||
*/ |
||||
closeApiRecharge() { |
||||
this.agentApiRechargeForm.reset(); |
||||
this.agentApiRechargeModal = false; |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 打开API充值框 |
||||
* @param agent |
||||
*/ |
||||
showApiParam(agent: any) { |
||||
this.agentApiService.getApiParam({agentId: agent['id']}, (data:any) => { |
||||
if (data['return_code'] == '000000') { |
||||
this.agentApiParamForm.patchValue({ |
||||
agentId: agent['id'], |
||||
agentNo: agent['agentNo'], |
||||
agentName: agent['name'], |
||||
appId: data['return_data']['appId'], |
||||
appSecret: data['return_data']['appSecret'], |
||||
merInfoNotify: data['return_data']['merInfoNotify'], |
||||
orderRefundNotify: data['return_data']['orderRefundNotify'], |
||||
}); |
||||
this.agentApiParamModal = true; |
||||
} else { |
||||
this.message.create('error', data['return_msg']); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 提交api充值 |
||||
*/ |
||||
submitApiParam() { |
||||
const param = { |
||||
agentId: this.agentApiParamForm.controls['agentId'].value, |
||||
merInfoNotify: this.agentApiParamForm.controls['merInfoNotify'].value, |
||||
orderRefundNotify: this.agentApiParamForm.controls['orderRefundNotify'].value, |
||||
} |
||||
this.agentApiService.updateApiParam(param, (data: any) => { |
||||
if (data['return_code'] == '000000') { |
||||
this.message.create('success', '操作成功'); |
||||
// 关闭弹窗
|
||||
this.closeApiParam(); |
||||
} else { |
||||
this.message.create('error', data['return_msg']); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 关闭API参数 |
||||
*/ |
||||
closeApiParam() { |
||||
this.agentApiParamForm.reset(); |
||||
this.agentApiParamModal = false; |
||||
} |
||||
|
||||
/** |
||||
* 展示交易记录 |
||||
*/ |
||||
showRecord(agentId: any) { |
||||
this.currentAgentId = agentId; |
||||
this.agentApiRecordModal = true; |
||||
} |
||||
|
||||
/** |
||||
* 关闭记录 |
||||
*/ |
||||
closeRecord() { |
||||
this.agentApiRecordModal = false; |
||||
} |
||||
} |
@ -0,0 +1,177 @@ |
||||
<form nz-form [formGroup]="searchForm" class="search_form" [nzLayout]="'vertical'"> |
||||
<div nz-row [nzGutter]="24"> |
||||
|
||||
<div nz-col [nzSpan]="6" *ngIf="accountType == 1"> |
||||
<nz-form-item> |
||||
<nz-form-label nzRequired>代理商<span style="color: red">【当前代理】</span></nz-form-label> |
||||
<nz-form-control> |
||||
<nz-select formControlName="agentId" [nzPlaceHolder]="'请选择'"> |
||||
<nz-option *ngFor="let item of agentData" nzValue="{{item.id}}" nzLabel="{{item.name}}"></nz-option> |
||||
</nz-select> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
|
||||
<div nz-col [nzSpan]="6"> |
||||
<nz-form-item> |
||||
<nz-form-label>地区</nz-form-label> |
||||
<nz-form-control> |
||||
<nz-select formControlName="provinceCode" nzAllowClear [nzPlaceHolder]="'请选择'"> |
||||
<nz-option *ngFor="let item of regionData" nzValue="{{item.regionId}}" nzLabel="{{item.regionName}}"></nz-option> |
||||
</nz-select> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
|
||||
<div nz-col [nzSpan]="6"> |
||||
<nz-form-item> |
||||
<nz-form-label>油站编号</nz-form-label> |
||||
<nz-form-control> |
||||
<input nz-input formControlName="merNo" placeholder="请输入" /> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
|
||||
<div nz-col [nzSpan]="6"> |
||||
<nz-form-item> |
||||
<nz-form-label>油站名称</nz-form-label> |
||||
<nz-form-control> |
||||
<input nz-input formControlName="merName" placeholder="请输入" /> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
|
||||
<div nz-col [nzSpan]="6"> |
||||
<nz-form-item> |
||||
<nz-form-label *ngIf="accountType != 1"></nz-form-label> |
||||
<nz-form-control> |
||||
<button nz-button style="margin-right: 8px" [nzType]="'primary'" (click)="searchFormSubmit()">查询</button> |
||||
<button nz-button style="margin-right: 8px" (click)="searchFormReset()">重置</button> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
</div> |
||||
</form> |
||||
|
||||
<nz-table #basicTable |
||||
[nzScroll]="{ x: '1100' }" |
||||
[nzBordered]="true" |
||||
[nzFrontPagination]="false" |
||||
[nzShowQuickJumper]="true" |
||||
[nzShowTotal]="totalTemplate" |
||||
[(nzPageIndex)]="tablePageNum" |
||||
(nzPageIndexChange)="queryData()" |
||||
nzShowSizeChanger |
||||
(nzPageSizeChange)="this.tablePageSize = $event;queryData()" |
||||
[nzPageSizeOptions]="[ 10, 20, 30, 50, 100 ]" |
||||
[nzTotal]="tableData.total" |
||||
[nzData]="tableData.list" > |
||||
<thead> |
||||
<tr> |
||||
<th nzWidth="60px">地区</th> |
||||
<th nzWidth="80px">油站编号</th> |
||||
<th nzWidth="100px">油站名称</th> |
||||
<th nzWidth="80px">油站余额</th> |
||||
<th nzWidth="80px">代理商余额</th> |
||||
<th nzRight nzWidth="70px">操作</th> |
||||
</tr> |
||||
</thead> |
||||
<tbody> |
||||
<tr *ngFor="let data of basicTable.data"> |
||||
<td>{{data.provinceName}}</td> |
||||
<td>{{data.merNo}}</td> |
||||
<td>{{data.merName}}</td> |
||||
<td>¥{{data.merAmount}}</td> |
||||
<td>¥{{data.amount}}</td> |
||||
<td nzRight> |
||||
<a *ngIf="accountType == 1" (click)="showRechargeModal(data)">余额充值</a> |
||||
<nz-divider *ngIf="accountType == 1" nzType="vertical"></nz-divider> |
||||
<a (click)="showRecordModal(data.merNo)">动账记录</a> |
||||
</tr> |
||||
</tbody> |
||||
<ng-template #totalTemplate let-total>总计 {{ total }} 条</ng-template> |
||||
</nz-table> |
||||
|
||||
|
||||
<nz-modal [(nzVisible)]="rechargeModal" |
||||
[nzWidth]="500" |
||||
nzTitle="充值" |
||||
[nzFooter]="null" |
||||
(nzOnCancel)="closeRechargeModal()"> |
||||
<ng-container *nzModalContent> |
||||
<form nz-form [formGroup]="rechargeForm"> |
||||
|
||||
<nz-form-item> |
||||
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>油站编号</nz-form-label> |
||||
<nz-form-control [nzSm]="14" [nzXs]="24"> |
||||
<input nz-input formControlName="merNo"/> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
|
||||
<nz-form-item> |
||||
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>油站名称</nz-form-label> |
||||
<nz-form-control [nzSm]="14" [nzXs]="24"> |
||||
<input nz-input formControlName="merName"/> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
|
||||
<nz-form-item> |
||||
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>充值金额</nz-form-label> |
||||
<nz-form-control [nzSm]="14" [nzXs]="24"> |
||||
<nz-input-number formControlName="amount" [nzMin]="1" [nzMax]="9999999" [nzStep]="1" [nzPrecision]="2" [nzPlaceHolder]="'充值金额'"></nz-input-number> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
|
||||
<div nz-flex style="margin-top: 15px" [nzJustify]="'center'"> |
||||
<button nz-button nzType="primary" class="submit-btn" (click)="rechargeConfirm()">确定</button> |
||||
</div> |
||||
|
||||
</form> |
||||
</ng-container> |
||||
</nz-modal> |
||||
|
||||
<nz-modal [(nzVisible)]="recordModal" |
||||
[nzWidth]="1000" |
||||
nzTitle="动账记录" |
||||
[nzFooter]="null" |
||||
(nzOnCancel)="recordModal = !recordModal"> |
||||
<ng-container *nzModalContent> |
||||
<nz-table #recordTable |
||||
nzSize="middle" |
||||
[nzScroll]="{ x: '1000px' }" |
||||
[nzBordered]="true" |
||||
[nzFrontPagination]="false" |
||||
[nzShowQuickJumper]="true" |
||||
[nzShowTotal]="totalTemplate" |
||||
[(nzPageIndex)]="recordTablePageNum" |
||||
(nzPageIndexChange)="queryRecord()" |
||||
[nzTotal]="recordData.total" |
||||
[nzData]="recordData.list" > |
||||
<thead> |
||||
<tr> |
||||
<th nzWidth="90px">交易前金额</th> |
||||
<th nzWidth="80px">交易金额</th> |
||||
<th nzWidth="90px">交易后金额</th> |
||||
<th nzWidth="50px">交易类型</th> |
||||
<th nzWidth="100px">交易时间</th> |
||||
<th nzWidth="120px">交易来源</th> |
||||
<!-- <th nzRight nzWidth="50px">操作</th>--> |
||||
</tr> |
||||
</thead> |
||||
<tbody> |
||||
<tr *ngFor="let data of recordTable.data"> |
||||
<td>{{data.beforeAmount}}</td> |
||||
<td>{{data.transactionAmount}}</td> |
||||
<td>{{data.afterAmount}}</td> |
||||
<td>{{data.type==1?'入账':'出账'}}</td> |
||||
<td>{{data.createTime | date: 'yyyy-MM-dd HH:mm:ss'}}</td> |
||||
<td>{{data.sourceType | dictionary: 'MER_ACCOUNT_RECORD_SOURCE_TYPE'}}</td> |
||||
<!-- <td nzRight> |
||||
<a >详情</a> |
||||
</td>--> |
||||
</tr> |
||||
</tbody> |
||||
<ng-template #totalTemplate let-total>总计 {{ total }} 条</ng-template> |
||||
</nz-table> |
||||
</ng-container> |
||||
</nz-modal> |
@ -0,0 +1,9 @@ |
||||
nz-input-number { |
||||
width: 100%; |
||||
} |
||||
nz-date-picker { |
||||
width: 100%; |
||||
} |
||||
.submit-btn { |
||||
width: 150px; |
||||
} |
@ -0,0 +1,279 @@ |
||||
import { Component } from '@angular/core'; |
||||
import {FormGroup, FormsModule, NonNullableFormBuilder, ReactiveFormsModule, Validators} from "@angular/forms"; |
||||
import {DictionaryPipe} from "../../../pipes/common/dictionary.pipe"; |
||||
import {NzMessageService} from "ng-zorro-antd/message"; |
||||
import {BrowserStorageService} from "../../../utils/localStorage.service"; |
||||
import {AgentService} from "../../../services/agent/agent.service"; |
||||
import {CommonService} from "../../../services/common/common.service"; |
||||
import {NzModalModule, NzModalService} from "ng-zorro-antd/modal"; |
||||
import {DatePipe, NgForOf, NgIf} from "@angular/common"; |
||||
import {NzButtonComponent} from "ng-zorro-antd/button"; |
||||
import { |
||||
NzCellFixedDirective, |
||||
NzTableCellDirective, |
||||
NzTableComponent, NzTableModule, |
||||
NzTbodyComponent, NzTheadComponent, |
||||
NzThMeasureDirective, NzTrDirective |
||||
} from "ng-zorro-antd/table"; |
||||
import {NzColDirective, NzRowDirective} from "ng-zorro-antd/grid"; |
||||
import {NzDividerComponent} from "ng-zorro-antd/divider"; |
||||
import {NzDropDownADirective, NzDropDownDirective, NzDropdownMenuComponent} from "ng-zorro-antd/dropdown"; |
||||
import {NzFormControlComponent, NzFormDirective, NzFormItemComponent, NzFormLabelComponent} from "ng-zorro-antd/form"; |
||||
import {NzIconDirective} from "ng-zorro-antd/icon"; |
||||
import {NzInputDirective} from "ng-zorro-antd/input"; |
||||
import {NzMenuDirective, NzMenuItemComponent} from "ng-zorro-antd/menu"; |
||||
import {NzOptionComponent, NzSelectComponent} from "ng-zorro-antd/select"; |
||||
import {NzFlexDirective} from "ng-zorro-antd/flex"; |
||||
import {NzDescriptionsModule} from "ng-zorro-antd/descriptions"; |
||||
import {NzUploadComponent} from "ng-zorro-antd/upload"; |
||||
import {NzAvatarModule} from "ng-zorro-antd/avatar"; |
||||
import {NzImageModule} from "ng-zorro-antd/image"; |
||||
import {NzSwitchComponent} from "ng-zorro-antd/switch"; |
||||
import {NzDatePickerComponent} from "ng-zorro-antd/date-picker"; |
||||
import {NzInputNumberModule} from "ng-zorro-antd/input-number"; |
||||
import {AgentMerAccountService} from "../../../services/agent/agent-mer-account.service"; |
||||
import {DATA} from "../../../data/login/localStorage.namespace"; |
||||
import {AgentStaffService} from "../../../services/agent/agent-staff.service"; |
||||
|
||||
@Component({ |
||||
selector: 'app-agent-mer-account', |
||||
standalone: true, |
||||
imports: [ |
||||
DatePipe, |
||||
DictionaryPipe, |
||||
FormsModule, |
||||
NgForOf, |
||||
NgIf, |
||||
NzButtonComponent, |
||||
NzCellFixedDirective, |
||||
NzColDirective, |
||||
NzDividerComponent, |
||||
NzDropDownADirective, |
||||
NzDropDownDirective, |
||||
NzDropdownMenuComponent, |
||||
NzFormControlComponent, |
||||
NzFormDirective, |
||||
NzFormItemComponent, |
||||
NzFormLabelComponent, |
||||
NzIconDirective, |
||||
NzInputDirective, |
||||
NzMenuDirective, |
||||
NzMenuItemComponent, |
||||
NzOptionComponent, |
||||
NzRowDirective, |
||||
NzSelectComponent, |
||||
NzTableCellDirective, |
||||
NzTableComponent, |
||||
NzTbodyComponent, |
||||
NzThMeasureDirective, |
||||
NzTheadComponent, |
||||
NzTrDirective, |
||||
ReactiveFormsModule, |
||||
NzTableModule, |
||||
NzModalModule, |
||||
NzFlexDirective, |
||||
NzDescriptionsModule, |
||||
NzUploadComponent, |
||||
NzAvatarModule, |
||||
NzImageModule, |
||||
NzSwitchComponent, |
||||
NzDatePickerComponent, |
||||
NzInputNumberModule |
||||
], |
||||
templateUrl: './agent-mer-account.component.html', |
||||
styleUrl: './agent-mer-account.component.less' |
||||
}) |
||||
export class AgentMerAccountComponent { |
||||
// 表单页数
|
||||
tablePageNum = 1; |
||||
// 每页数量
|
||||
tablePageSize = 10; |
||||
// 表单数据
|
||||
tableData: any = { |
||||
total: 0, |
||||
list: [], |
||||
}; |
||||
// 搜索表单
|
||||
searchForm: FormGroup; |
||||
// 地区数据
|
||||
regionData: any = []; |
||||
// 代理数据
|
||||
agentData: any = []; |
||||
// 登录账户类型
|
||||
accountType = null; |
||||
// 充值表单
|
||||
rechargeForm: FormGroup; |
||||
rechargeModal = false; |
||||
// 记录模态框
|
||||
recordModal = false; |
||||
recordMerNo: any = null; |
||||
// 表单页数
|
||||
recordTablePageNum = 1; |
||||
// 每页数量
|
||||
recordTablePageSize = 10; |
||||
recordData: any = { |
||||
total: 0, |
||||
list: [], |
||||
}; |
||||
constructor(private fb: NonNullableFormBuilder, |
||||
private message: NzMessageService, |
||||
private storage: BrowserStorageService, |
||||
private agentService: AgentService, |
||||
private agentMerAccountService: AgentMerAccountService, |
||||
private commonService: CommonService, |
||||
private modalService: NzModalService) { |
||||
this.accountType = this.storage.get(DATA)['account']['objectType']; |
||||
|
||||
// 初始化搜索框
|
||||
this.searchForm = this.fb.group({ |
||||
agentId: [''], |
||||
provinceCode: [null], |
||||
merNo: [null], |
||||
merName: [null], |
||||
}); |
||||
|
||||
// 初始化搜索框
|
||||
this.rechargeForm = this.fb.group({ |
||||
agentId: [null], |
||||
merNo: [null], |
||||
merName: [null], |
||||
amount: [null, [Validators.required]], |
||||
}); |
||||
|
||||
if (this.accountType == 1) { |
||||
// 获取代理商
|
||||
this.agentService.queryAgentList({pageNum:1,pageSize:999}, (data: any) => { |
||||
this.agentData = data['return_data']['list']; |
||||
this.searchForm.controls['agentId'].setValue(String(this.agentData[0]['id'])); |
||||
// 查询数据
|
||||
this.queryData(); |
||||
}); |
||||
} else { |
||||
// 查询数据
|
||||
this.queryData(); |
||||
} |
||||
// 获取地区
|
||||
this.commonService.getRegion("", (data: any) => { |
||||
this.regionData = data['return_data']; |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 获取数据 |
||||
*/ |
||||
queryData() { |
||||
this.searchForm.value.pageNum = this.tablePageNum; |
||||
this.searchForm.value.pageSize = this.tablePageSize; |
||||
this.searchForm.value.time = new Date().getTime(); |
||||
this.agentMerAccountService.getMerList(this.searchForm.value, (data: any) => { |
||||
if (data['return_code'] == '000000') { |
||||
this.tableData = data['return_data']; |
||||
} |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 搜索表单提交 |
||||
*/ |
||||
searchFormSubmit(): void { |
||||
this.tablePageNum = 1; |
||||
this.queryData(); |
||||
} |
||||
|
||||
/** |
||||
* 搜索表单重置 |
||||
*/ |
||||
searchFormReset(): void { |
||||
this.searchForm.reset(); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 打卡充值模态框 |
||||
* @param data |
||||
*/ |
||||
showRechargeModal(data: any) { |
||||
this.rechargeForm.patchValue(data); |
||||
this.rechargeForm.controls['amount'].setValue(0); |
||||
this.rechargeForm.controls['merNo'].disable(); |
||||
this.rechargeForm.controls['merName'].disable(); |
||||
this.rechargeModal = true; |
||||
} |
||||
|
||||
/** |
||||
* 充值确认框 |
||||
*/ |
||||
rechargeConfirm() { |
||||
if (this.rechargeForm.valid) { |
||||
this.modalService.confirm({ |
||||
nzTitle: '充值提醒', |
||||
nzContent: '确认对【' + this.rechargeForm.controls['merName'].value + '】油站充值:¥' +this.rechargeForm.controls['amount'].value + '吗?', |
||||
nzOnOk: () => this.submitRecharge() |
||||
}); |
||||
} else { |
||||
Object.values(this.rechargeForm.controls).forEach(control => { |
||||
if (control.invalid) { |
||||
control.markAsDirty(); |
||||
control.updateValueAndValidity({ onlySelf: true }); |
||||
} |
||||
}); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 提交表单数据 |
||||
*/ |
||||
submitRecharge() { |
||||
let param = this.rechargeForm.value; |
||||
param['agentId'] = this.searchForm.controls['agentId'].value; |
||||
param['merNo'] = this.rechargeForm.controls['merNo'].value; |
||||
this.agentMerAccountService.recharge(param, (data: any) => { |
||||
if (data['return_code'] == '000000') { |
||||
this.message.create('success', '操作成功'); |
||||
this.queryData(); |
||||
// 关闭弹窗
|
||||
this.closeRechargeModal(); |
||||
} else { |
||||
this.message.create('error', data['return_msg']); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 关闭充值模态框 |
||||
*/ |
||||
closeRechargeModal() { |
||||
this.rechargeForm.reset(); |
||||
this.rechargeModal = false; |
||||
} |
||||
|
||||
/** |
||||
* 打开动账记录模态框 |
||||
* @param merNo |
||||
*/ |
||||
showRecordModal(merNo: number) { |
||||
if (this.recordMerNo != merNo) { |
||||
this.recordMerNo = merNo; |
||||
// 查询数据
|
||||
this.queryRecord(); |
||||
} |
||||
this.recordModal = true; |
||||
} |
||||
|
||||
/** |
||||
* 获取数据 |
||||
*/ |
||||
queryRecord() { |
||||
const param = { |
||||
agentId: this.searchForm.controls['agentId'].value, |
||||
merNo: this.recordMerNo, |
||||
pageNum: this.recordTablePageNum, |
||||
pageSize: this.recordTablePageSize, |
||||
}; |
||||
this.agentMerAccountService.getRecordList(param, (data: any) => { |
||||
if (data['return_code'] == '000000') { |
||||
this.recordData = data['return_data']; |
||||
} |
||||
}); |
||||
} |
||||
} |
@ -0,0 +1,154 @@ |
||||
<form nz-form [formGroup]="searchForm" class="search_form" [nzLayout]="'vertical'"> |
||||
<div nz-row [nzGutter]="24"> |
||||
|
||||
<div nz-col [nzSpan]="6" *ngIf="accountType == 1"> |
||||
<nz-form-item> |
||||
<nz-form-label nzRequired>代理商<span style="color: red">【当前代理】</span></nz-form-label> |
||||
<nz-form-control> |
||||
<nz-select formControlName="agentId" [nzPlaceHolder]="'请选择'"> |
||||
<nz-option *ngFor="let item of agentData" nzValue="{{item.id}}" nzLabel="{{item.name}}"></nz-option> |
||||
</nz-select> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
|
||||
<div nz-col [nzSpan]="6" *ngIf="accountType == 1"> |
||||
<nz-form-item> |
||||
<nz-form-label nzRequired>分配状态</nz-form-label> |
||||
<nz-form-control> |
||||
<nz-select formControlName="isAgentAllot" [nzPlaceHolder]="'请选择'"> |
||||
<nz-option nzValue="true" nzLabel="已分配"></nz-option> |
||||
<nz-option nzValue="false" nzLabel="未分配"></nz-option> |
||||
</nz-select> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
|
||||
<div nz-col [nzSpan]="6" *ngIf="accountType == 4"> |
||||
<nz-form-item> |
||||
<nz-form-label nzRequired>业务员<span style="color: red">【当前业务员】</span></nz-form-label> |
||||
<nz-form-control> |
||||
<nz-select formControlName="agentStaffId" [nzPlaceHolder]="'请选择'"> |
||||
<nz-option *ngFor="let item of agentStaffData" nzValue="{{item.id}}" nzLabel="{{item.name}}"></nz-option> |
||||
</nz-select> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
|
||||
<div nz-col [nzSpan]="6" *ngIf="accountType == 4"> |
||||
<nz-form-item> |
||||
<nz-form-label nzRequired>分配状态</nz-form-label> |
||||
<nz-form-control> |
||||
<nz-select formControlName="isAgentStaffAllot" [nzPlaceHolder]="'请选择'"> |
||||
<nz-option nzValue="true" nzLabel="已分配"></nz-option> |
||||
<nz-option nzValue="false" nzLabel="未分配"></nz-option> |
||||
</nz-select> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
|
||||
<div nz-col [nzSpan]="6"> |
||||
<nz-form-item> |
||||
<nz-form-label>地区</nz-form-label> |
||||
<nz-form-control> |
||||
<nz-select formControlName="provinceCode" nzAllowClear [nzPlaceHolder]="'请选择'"> |
||||
<nz-option *ngFor="let item of regionData" nzValue="{{item.regionId}}" nzLabel="{{item.regionName}}"></nz-option> |
||||
</nz-select> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
|
||||
<div nz-col [nzSpan]="6"> |
||||
<nz-form-item> |
||||
<nz-form-label>油站来源</nz-form-label> |
||||
<nz-form-control> |
||||
<nz-select formControlName="merSourceType" nzAllowClear [nzPlaceHolder]="'请选择'"> |
||||
<nz-option *ngFor="let item of merSourceTypeArray" nzValue="{{item.codeValue}}" nzLabel="{{item.codeName}}"></nz-option> |
||||
</nz-select> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
|
||||
<div nz-col [nzSpan]="6"> |
||||
<nz-form-item> |
||||
<nz-form-label>油站编号</nz-form-label> |
||||
<nz-form-control> |
||||
<input nz-input formControlName="merNo" placeholder="请输入" /> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
|
||||
<div nz-col [nzSpan]="6"> |
||||
<nz-form-item> |
||||
<nz-form-label>油站名称</nz-form-label> |
||||
<nz-form-control> |
||||
<input nz-input formControlName="merName" placeholder="请输入" /> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
|
||||
<div nz-col [nzSpan]="6"> |
||||
<nz-form-item> |
||||
<nz-form-label>油站状态</nz-form-label> |
||||
<nz-form-control> |
||||
<nz-select formControlName="status" nzAllowClear [nzPlaceHolder]="'请选择'"> |
||||
<nz-option *ngFor="let item of merStatusArray" nzValue="{{item.codeValue}}" nzLabel="{{item.codeName}}"></nz-option> |
||||
</nz-select> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
|
||||
<div nz-col [nzSpan]="12"> |
||||
<nz-form-item> |
||||
<nz-form-label></nz-form-label> |
||||
<nz-form-control> |
||||
<button nz-button style="margin-right: 8px" [nzType]="'primary'" (click)="searchFormSubmit()">查询</button> |
||||
<button nz-button style="margin-right: 8px" (click)="searchFormReset()">重置</button> |
||||
<button nz-button style="margin-right: 8px" (click)="assign()" [nzType]="'primary'" >分配油站</button> |
||||
<button nz-button style="margin-right: 8px" (click)="unbind()" [nzType]="'primary'" nzDanger>解绑油站</button> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
</div> |
||||
</form> |
||||
|
||||
<div class="send-request"> |
||||
<span nz-typography>已选择 {{setOfCheckedId.size}} 家油站</span> |
||||
</div> |
||||
<nz-table #basicTable |
||||
[nzScroll]="{ x: '1100' }" |
||||
[nzBordered]="true" |
||||
[nzFrontPagination]="false" |
||||
[nzShowQuickJumper]="true" |
||||
[nzShowTotal]="totalTemplate" |
||||
[(nzPageIndex)]="tablePageNum" |
||||
(nzPageIndexChange)="queryData()" |
||||
nzShowSizeChanger |
||||
(nzPageSizeChange)="this.tablePageSize = $event;queryData()" |
||||
[nzPageSizeOptions]="[ 10, 20, 50, 100, 500 ]" |
||||
[nzTotal]="tableData.total" |
||||
[nzData]="tableData.list" > |
||||
<thead> |
||||
<tr> |
||||
<th nzWidth="50px" [nzChecked]="checked" (nzCheckedChange)="onAllChecked($event)"></th> |
||||
<th nzWidth="60px">地区</th> |
||||
<th nzWidth="80px">油站来源</th> |
||||
<th nzWidth="80px">油站编号</th> |
||||
<th nzWidth="100px">油站名称</th> |
||||
<th nzWidth="80px">油站状态</th> |
||||
<th nzWidth="80px">分配时间</th> |
||||
</tr> |
||||
</thead> |
||||
<tbody> |
||||
<tr *ngFor="let data of basicTable.data"> |
||||
<td [nzChecked]="setOfCheckedId.has(data.merNo)" (nzCheckedChange)="onItemChecked(data.merNo, $event)" ></td> |
||||
<td>{{data.provinceName}}</td> |
||||
<td>{{data.merSourceType | dictionary : 'MER_SOURCE_TYPE'}}</td> |
||||
<td>{{data.merNo}}</td> |
||||
<td>{{data.merName}}</td> |
||||
<td>{{data.status | dictionary : 'MERCHANT_STATUS'}}</td> |
||||
<td>{{data.createTime==null?'未分配':''}}{{data.createTime | date : 'yyyy-MM-dd HH:mm'}}</td> |
||||
</tr> |
||||
</tbody> |
||||
<ng-template #totalTemplate let-total>总计 {{ total }} 条</ng-template> |
||||
</nz-table> |
@ -0,0 +1,15 @@ |
||||
.search-area { |
||||
margin-bottom: 10px; |
||||
} |
||||
.search-area button { |
||||
margin-right: 8px; |
||||
} |
||||
nz-input-number { |
||||
width: 100%; |
||||
} |
||||
.submit-btn { |
||||
width: 150px; |
||||
} |
||||
.send-request { |
||||
margin-bottom: 16px; |
||||
} |
@ -0,0 +1,362 @@ |
||||
import { Component } from '@angular/core'; |
||||
import {FormGroup, FormsModule, NonNullableFormBuilder, ReactiveFormsModule, Validators} from "@angular/forms"; |
||||
import {DictionaryPipe} from "../../../pipes/common/dictionary.pipe"; |
||||
import {NzMessageService} from "ng-zorro-antd/message"; |
||||
import {BrowserStorageService} from "../../../utils/localStorage.service"; |
||||
import {AgentService} from "../../../services/agent/agent.service"; |
||||
import {CommonService} from "../../../services/common/common.service"; |
||||
import {NzModalModule, NzModalService} from "ng-zorro-antd/modal"; |
||||
import {DatePipe, NgForOf, NgIf} from "@angular/common"; |
||||
import {NzButtonComponent} from "ng-zorro-antd/button"; |
||||
import { |
||||
NzCellFixedDirective, |
||||
NzTableCellDirective, |
||||
NzTableComponent, NzTableModule, |
||||
NzTbodyComponent, NzTheadComponent, |
||||
NzThMeasureDirective, NzTrDirective |
||||
} from "ng-zorro-antd/table"; |
||||
import {NzColDirective, NzRowDirective} from "ng-zorro-antd/grid"; |
||||
import {NzDividerComponent} from "ng-zorro-antd/divider"; |
||||
import {NzDropDownADirective, NzDropDownDirective, NzDropdownMenuComponent} from "ng-zorro-antd/dropdown"; |
||||
import {NzFormControlComponent, NzFormDirective, NzFormItemComponent, NzFormLabelComponent} from "ng-zorro-antd/form"; |
||||
import {NzIconDirective} from "ng-zorro-antd/icon"; |
||||
import {NzInputDirective} from "ng-zorro-antd/input"; |
||||
import {NzMenuDirective, NzMenuItemComponent} from "ng-zorro-antd/menu"; |
||||
import {NzOptionComponent, NzSelectComponent} from "ng-zorro-antd/select"; |
||||
import {NzFlexDirective} from "ng-zorro-antd/flex"; |
||||
import {NzDescriptionsModule} from "ng-zorro-antd/descriptions"; |
||||
import {NzUploadComponent} from "ng-zorro-antd/upload"; |
||||
import {NzAvatarModule} from "ng-zorro-antd/avatar"; |
||||
import {NzImageModule} from "ng-zorro-antd/image"; |
||||
import {NzSwitchComponent} from "ng-zorro-antd/switch"; |
||||
import {NzDatePickerComponent} from "ng-zorro-antd/date-picker"; |
||||
import {NzInputNumberModule} from "ng-zorro-antd/input-number"; |
||||
import {AgentMerService} from "../../../services/agent/agent-mer.service"; |
||||
import {NzTypographyComponent} from "ng-zorro-antd/typography"; |
||||
import {DATA} from "../../../data/login/localStorage.namespace"; |
||||
import {AgentStaffService} from "../../../services/agent/agent-staff.service"; |
||||
|
||||
@Component({ |
||||
selector: 'app-agent-mer-list', |
||||
standalone: true, |
||||
imports: [ |
||||
DatePipe, |
||||
DictionaryPipe, |
||||
FormsModule, |
||||
NgForOf, |
||||
NgIf, |
||||
NzButtonComponent, |
||||
NzCellFixedDirective, |
||||
NzColDirective, |
||||
NzDividerComponent, |
||||
NzDropDownADirective, |
||||
NzDropDownDirective, |
||||
NzDropdownMenuComponent, |
||||
NzFormControlComponent, |
||||
NzFormDirective, |
||||
NzFormItemComponent, |
||||
NzFormLabelComponent, |
||||
NzIconDirective, |
||||
NzInputDirective, |
||||
NzMenuDirective, |
||||
NzMenuItemComponent, |
||||
NzOptionComponent, |
||||
NzRowDirective, |
||||
NzSelectComponent, |
||||
NzTableCellDirective, |
||||
NzTableComponent, |
||||
NzTbodyComponent, |
||||
NzThMeasureDirective, |
||||
NzTheadComponent, |
||||
NzTrDirective, |
||||
ReactiveFormsModule, |
||||
NzTableModule, |
||||
NzModalModule, |
||||
NzFlexDirective, |
||||
NzDescriptionsModule, |
||||
NzUploadComponent, |
||||
NzAvatarModule, |
||||
NzImageModule, |
||||
NzSwitchComponent, |
||||
NzDatePickerComponent, |
||||
NzInputNumberModule, |
||||
NzTypographyComponent |
||||
], |
||||
templateUrl: './agent-mer-list.component.html', |
||||
styleUrl: './agent-mer-list.component.less' |
||||
}) |
||||
export class AgentMerListComponent { |
||||
// 表单页数
|
||||
tablePageNum = 1; |
||||
// 每页数量
|
||||
tablePageSize = 10; |
||||
// 表单数据
|
||||
tableData: any = { |
||||
total: 0, |
||||
list: [], |
||||
}; |
||||
// 搜索表单
|
||||
searchForm: FormGroup; |
||||
// 登录的账户类型
|
||||
accountType = null; |
||||
// 油站来源
|
||||
merSourceTypeArray = new DictionaryPipe().getDictionaryList('MER_SOURCE_TYPE'); |
||||
// 商户状态
|
||||
merStatusArray = new DictionaryPipe().getDictionaryList('MERCHANT_STATUS'); |
||||
// 地区数据
|
||||
regionData: any = []; |
||||
// 代理数据
|
||||
agentData: any = []; |
||||
// 代理工作人员
|
||||
agentStaffData: any = []; |
||||
// 列表中全选状态
|
||||
checked = false; |
||||
// 已选择的数据
|
||||
setOfCheckedId = new Set<string>(); |
||||
constructor(private fb: NonNullableFormBuilder, |
||||
private message: NzMessageService, |
||||
private storage: BrowserStorageService, |
||||
private agentService: AgentService, |
||||
private agentStaffService: AgentStaffService, |
||||
private agentMerService: AgentMerService, |
||||
private commonService: CommonService, |
||||
private modal: NzModalService) { |
||||
|
||||
this.accountType = this.storage.get(DATA)['account']['objectType']; |
||||
|
||||
// 初始化搜索框
|
||||
this.searchForm = this.fb.group({ |
||||
agentId: [''], |
||||
agentStaffId: [''], |
||||
isAgentAllot: ['true'], |
||||
isAgentStaffAllot: ['true'], |
||||
provinceCode: [null], |
||||
merSourceType: [null], |
||||
merNo: [null], |
||||
merName: [null], |
||||
status: [null], |
||||
}); |
||||
if (this.accountType == 1) { |
||||
// 获取代理商
|
||||
this.agentService.queryAgentList({pageNum:1,pageSize:999}, (data: any) => { |
||||
this.agentData = data['return_data']['list']; |
||||
this.searchForm.controls['agentId'].setValue(String(this.agentData[0]['id'])); |
||||
// 查询数据
|
||||
this.queryData(); |
||||
}); |
||||
|
||||
} else if (this.accountType == 4) { |
||||
// 获取代理商工作人员
|
||||
this.agentStaffService.getStaffList({pageNum:1,pageSize:999}, (data: any) => { |
||||
this.agentStaffData = data['return_data']['list']; |
||||
if (this.agentStaffData.length > 0) { |
||||
this.searchForm.controls['agentStaffId'].setValue(String(this.agentStaffData[0]['id'])); |
||||
// 查询数据
|
||||
this.queryData(); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
// 获取地区
|
||||
this.commonService.getRegion("", (data: any) => { |
||||
this.regionData = data['return_data']; |
||||
}); |
||||
|
||||
} |
||||
|
||||
/** |
||||
* 获取数据 |
||||
*/ |
||||
queryData() { |
||||
if (this.accountType == 1) { |
||||
this.searchForm.value.isAgentStaffAllot = false; |
||||
} |
||||
this.searchForm.value.pageNum = this.tablePageNum; |
||||
this.searchForm.value.pageSize = this.tablePageSize; |
||||
this.searchForm.value.time = new Date().getTime(); |
||||
this.agentMerService.getAllotList(this.searchForm.value, (data: any) => { |
||||
if (data['return_code'] == '000000') { |
||||
this.tableData = data['return_data']; |
||||
} |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 搜索表单提交 |
||||
*/ |
||||
searchFormSubmit(): void { |
||||
this.tablePageNum = 1; |
||||
this.queryData(); |
||||
} |
||||
|
||||
/** |
||||
* 搜索表单重置 |
||||
*/ |
||||
searchFormReset(): void { |
||||
this.searchForm.reset(); |
||||
} |
||||
|
||||
/** |
||||
* 打开分配模态框 |
||||
*/ |
||||
assign() { |
||||
if (this.setOfCheckedId.size == 0) { |
||||
this.modal.warning({ |
||||
nzTitle: '提示', |
||||
nzContent: '请在列表中勾选需要分配的油站' |
||||
}); |
||||
return; |
||||
} |
||||
this.modal.confirm({ |
||||
nzTitle: '提示', |
||||
nzContent: '确定将已勾选的'+this.setOfCheckedId.size+'个油站,分配给代理商吗?', |
||||
nzOnOk: () => this.submitAssign() |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 提交数据 |
||||
*/ |
||||
submitAssign() { |
||||
let merNoList = []; |
||||
for (let merNo of this.setOfCheckedId) { |
||||
merNoList.push({merNo: merNo}); |
||||
} |
||||
if (this.accountType == 1) { |
||||
const param = { |
||||
agentId: this.searchForm.controls['agentId'].value, |
||||
merNoList: merNoList |
||||
}; |
||||
this.agentMerService.assignAgent(param, (data: any) => { |
||||
if (data['return_code'] == '000000') { |
||||
this.message.create('success', '操作成功'); |
||||
// 清除已勾选的油站
|
||||
this.setOfCheckedId.clear(); |
||||
// 刷新数据
|
||||
this.queryData(); |
||||
} else { |
||||
this.message.create('error', data['return_msg']); |
||||
} |
||||
}); |
||||
} else if (this.accountType == 4) { |
||||
const param = { |
||||
staffId: this.searchForm.controls['agentStaffId'].value, |
||||
merNoList: merNoList |
||||
}; |
||||
this.agentMerService.assignStaff(param, (data: any) => { |
||||
if (data['return_code'] == '000000') { |
||||
this.message.create('success', '操作成功'); |
||||
// 刷新数据
|
||||
this.queryData(); |
||||
} else { |
||||
this.message.create('error', data['return_msg']); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
} |
||||
|
||||
/** |
||||
* 打开解绑模态框 |
||||
*/ |
||||
unbind() { |
||||
if (this.setOfCheckedId.size == 0) { |
||||
this.modal.warning({ |
||||
nzTitle: '提示', |
||||
nzContent: '请在列表中勾选需要解绑的油站' |
||||
}); |
||||
return; |
||||
} |
||||
this.modal.confirm({ |
||||
nzTitle: '提示', |
||||
nzContent: '确定将已勾选的'+this.setOfCheckedId.size+'个油站解绑吗?', |
||||
nzOnOk: () => this.submitUnbind() |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 提交数据 |
||||
*/ |
||||
submitUnbind() { |
||||
let merNoList = []; |
||||
for (let merNo of this.setOfCheckedId) { |
||||
merNoList.push({merNo: merNo}); |
||||
} |
||||
|
||||
if (this.accountType == 1) { |
||||
const param = { |
||||
agentId: this.searchForm.controls['agentId'].value, |
||||
merNoList: merNoList |
||||
}; |
||||
this.agentMerService.unbindAgent(param, (data: any) => { |
||||
if (data['return_code'] == '000000') { |
||||
this.message.create('success', '操作成功'); |
||||
// 清除已勾选的油站
|
||||
this.setOfCheckedId.clear(); |
||||
// 刷新数据
|
||||
this.queryData(); |
||||
} else { |
||||
this.message.create('error', data['return_msg']); |
||||
} |
||||
}); |
||||
} else if (this.accountType == 4) { |
||||
const param = { |
||||
staffId: this.searchForm.controls['agentStaffId'].value, |
||||
merNoList: merNoList |
||||
}; |
||||
this.agentMerService.unbindStaff(param, (data: any) => { |
||||
if (data['return_code'] == '000000') { |
||||
this.message.create('success', '操作成功'); |
||||
// 刷新数据
|
||||
this.queryData(); |
||||
} else { |
||||
this.message.create('error', data['return_msg']); |
||||
} |
||||
}); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 修改选择状态 |
||||
* @param merNo |
||||
* @param checked |
||||
*/ |
||||
updateCheckedSet(merNo: string, checked: boolean): void { |
||||
if (checked) { |
||||
this.setOfCheckedId.add(merNo); |
||||
} else { |
||||
this.setOfCheckedId.delete(merNo); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 单选 |
||||
* @param merNo |
||||
* @param checked |
||||
*/ |
||||
onItemChecked(merNo: string, checked: boolean): void { |
||||
this.updateCheckedSet(merNo, checked); |
||||
this.refreshCheckedStatus(); |
||||
} |
||||
|
||||
/** |
||||
* 全选 |
||||
* @param checked |
||||
*/ |
||||
onAllChecked(checked: boolean): void { |
||||
// @ts-ignore
|
||||
this.tableData.list.forEach(({ merNo }) => this.updateCheckedSet(merNo, checked)); |
||||
this.refreshCheckedStatus(); |
||||
} |
||||
|
||||
/** |
||||
* 刷新数据 |
||||
*/ |
||||
refreshCheckedStatus(): void { |
||||
// @ts-ignore
|
||||
this.checked = this.tableData.list.every(({ merNo }) => this.setOfCheckedId.has(merNo)); |
||||
console.log(this.setOfCheckedId); |
||||
} |
||||
|
||||
|
||||
} |
@ -0,0 +1,200 @@ |
||||
<form nz-form [formGroup]="searchForm" class="search_form" [nzLayout]="'vertical'"> |
||||
<div nz-row [nzGutter]="24"> |
||||
<div nz-col [nzSpan]="6"> |
||||
<nz-form-item> |
||||
<nz-form-label>地区</nz-form-label> |
||||
<nz-form-control> |
||||
<nz-select formControlName="provinceCode" nzAllowClear [nzPlaceHolder]="'请选择'" nzShowSearch> |
||||
<nz-option *ngFor="let item of regionData" nzValue="{{item.regionId}}" nzLabel="{{item.regionName}}"></nz-option> |
||||
</nz-select> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
<div nz-col [nzSpan]="6"> |
||||
<nz-form-item> |
||||
<nz-form-label>来源渠道</nz-form-label> |
||||
<nz-form-control> |
||||
<nz-select formControlName="sourceType" nzAllowClear [nzPlaceHolder]="'请选择'"> |
||||
<nz-option *ngFor="let item of merSourceTypeArray" nzValue="{{item.codeValue}}" nzLabel="{{item.codeName}}"></nz-option> |
||||
</nz-select> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
<div nz-col [nzSpan]="6"> |
||||
<nz-form-item> |
||||
<nz-form-label>油站编号</nz-form-label> |
||||
<nz-form-control> |
||||
<input nz-input formControlName="merNo" placeholder="请输入" /> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
<div nz-col [nzSpan]="6"> |
||||
<nz-form-item> |
||||
<nz-form-label>油站名称</nz-form-label> |
||||
<nz-form-control> |
||||
<input nz-input formControlName="merName" placeholder="请输入" /> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
<div nz-col [nzSpan]="24" class="search-area"> |
||||
<button nz-button [nzType]="'primary'" (click)="searchFormSubmit()">查询</button> |
||||
<button nz-button (click)="searchFormReset()">重置</button> |
||||
<button nz-button [nzType]="'primary'" (click)="showBatchUpdateDiscount()">批量调整优惠</button> |
||||
<!-- <a class="collapse" (click)="isCollapse = !isCollapse"> |
||||
更多查询条件 |
||||
<i nz-icon [nzType]="!isCollapse ? 'down' : 'up'"></i> |
||||
</a>--> |
||||
</div> |
||||
</div> |
||||
</form> |
||||
<div class="send-request"> |
||||
<span nz-typography>已选择 {{setOfCheckedId.size}} 家油站</span> |
||||
</div> |
||||
<nz-table #basicTable |
||||
[nzScroll]="{ x: '1200px' }" |
||||
[nzBordered]="true" |
||||
[nzFrontPagination]="false" |
||||
[nzShowQuickJumper]="true" |
||||
[nzShowTotal]="totalTemplate" |
||||
[(nzPageIndex)]="tablePageNum" |
||||
(nzPageIndexChange)="queryData()" |
||||
nzShowSizeChanger |
||||
(nzPageSizeChange)="this.tablePageSize = $event;queryData()" |
||||
[nzPageSizeOptions]="[ 10, 20, 30, 50, 100 ]" |
||||
[nzTotal]="tableData.total" |
||||
[nzData]="tableData.list" > |
||||
<thead> |
||||
<tr> |
||||
<th nzWidth="50px" [nzChecked]="checked" (nzCheckedChange)="onAllChecked($event)"></th> |
||||
<th nzWidth="120px">来源渠道</th> |
||||
<th nzWidth="110px">油站编号</th> |
||||
<th nzWidth="230px">油站名称</th> |
||||
<th nzWidth="180px">油站地区</th> |
||||
<th nzRight nzWidth="90px">操作</th> |
||||
</tr> |
||||
</thead> |
||||
<tbody> |
||||
<tr *ngFor="let data of basicTable.data"> |
||||
<td [nzChecked]="setOfCheckedId.has(data.merNo)" (nzCheckedChange)="onItemChecked(data.merNo, $event)" ></td> |
||||
<td>{{data.merSourceType | dictionary: "MER_SOURCE_TYPE"}}</td> |
||||
<td>{{data.merNo}}</td> |
||||
<td>{{data.merName}}</td> |
||||
<td>{{data.provinceName}}</td> |
||||
<td nzRight> |
||||
<a (click)="showDiscountDetail(data.merNo)">调整优惠</a> |
||||
</td> |
||||
</tr> |
||||
</tbody> |
||||
<ng-template #totalTemplate let-total>总计 {{ total }} 条</ng-template> |
||||
</nz-table> |
||||
|
||||
<nz-modal [(nzVisible)]="batchUpdateDiscountModal" |
||||
[nzWidth]="500" |
||||
[nzTitle]="'调整优惠(已选择'+setOfCheckedId.size+'家油站)'" |
||||
[nzFooter]="null" |
||||
(nzOnCancel)="closeBatchUpdateDiscount()"> |
||||
<ng-container *nzModalContent> |
||||
<form nz-form [formGroup]="updateDiscountForm"> |
||||
<nz-form-item> |
||||
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>油号</nz-form-label> |
||||
<nz-form-control [nzSm]="14" [nzXs]="24"> |
||||
<nz-select formControlName="oilNo" nzAllowClear [nzPlaceHolder]="'请选择'"> |
||||
<nz-option *ngFor="let item of oilNoArray" nzValue="{{item.codeValue}}" nzLabel="{{item.codeName}}"></nz-option> |
||||
</nz-select> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
|
||||
<nz-form-item> |
||||
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>折扣</nz-form-label> |
||||
<nz-form-control [nzSm]="14" [nzXs]="24"> |
||||
<nz-input-number formControlName="priceRate" [nzMin]="0" [nzMax]="200" [nzStep]="1" [nzPrecision]="2" [nzPlaceHolder]="'执行价格'"></nz-input-number> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
|
||||
<nz-form-item> |
||||
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>服务费</nz-form-label> |
||||
<nz-form-control [nzSm]="14" [nzXs]="24"> |
||||
<nz-input-number formControlName="serviceFeeRate" [nzMin]="0" [nzMax]="200" [nzStep]="1" [nzPrecision]="2" [nzPlaceHolder]="'执行价格'"></nz-input-number> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
|
||||
<div nz-flex style="margin-top: 15px" [nzJustify]="'center'"> |
||||
<button nz-button nzType="primary" (click)="submitBatchUpdateDiscount()" class="submit-btn">确定</button> |
||||
</div> |
||||
</form> |
||||
</ng-container> |
||||
</nz-modal> |
||||
|
||||
<nz-modal [(nzVisible)]="discountDetailModal" |
||||
[nzWidth]="500" |
||||
[nzTitle]="'调整优惠'" |
||||
[nzFooter]="null" |
||||
(nzOnCancel)="closeDiscountDetail()"> |
||||
<ng-container *nzModalContent> |
||||
<nz-table #basicTable |
||||
[nzData]="discountDetailObj" |
||||
[nzShowPagination]="false" |
||||
[nzBordered]="true" |
||||
[nzSize]="'small'" |
||||
> |
||||
<thead> |
||||
<tr> |
||||
<th>油站</th> |
||||
<th>油号</th> |
||||
<th>折扣</th> |
||||
<th>服务费</th> |
||||
<th>操作</th> |
||||
</tr> |
||||
</thead> |
||||
<tbody> |
||||
<tr *ngFor="let data of basicTable.data"> |
||||
<td>{{data.merName}}</td> |
||||
<td>{{data.oilNoName}}</td> |
||||
<td>{{data.priceRate}}%</td> |
||||
<td>{{data.serviceFeeRate}}%</td> |
||||
<td> |
||||
<a (click)="showUpdateDiscount(data)">调整</a> |
||||
</td> |
||||
</tr> |
||||
</tbody> |
||||
</nz-table> |
||||
</ng-container> |
||||
</nz-modal> |
||||
|
||||
<nz-modal [(nzVisible)]="updateDiscountModal" |
||||
[nzWidth]="500" |
||||
nzTitle="调整优惠" |
||||
[nzFooter]="null" |
||||
(nzOnCancel)="closeUpdateDiscount()"> |
||||
<ng-container *nzModalContent> |
||||
<form nz-form [formGroup]="updateDiscountForm"> |
||||
|
||||
<nz-form-item> |
||||
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>油号</nz-form-label> |
||||
<nz-form-control [nzSm]="14" [nzXs]="24"> |
||||
<nz-select formControlName="oilNo" nzAllowClear [nzPlaceHolder]="'请选择'"> |
||||
<nz-option *ngFor="let item of oilNoArray" nzValue="{{item.codeValue}}" nzLabel="{{item.codeName}}"></nz-option> |
||||
</nz-select> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
|
||||
<nz-form-item> |
||||
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>折扣</nz-form-label> |
||||
<nz-form-control [nzSm]="14" [nzXs]="24"> |
||||
<nz-input-number formControlName="priceRate" [nzMin]="0" [nzMax]="200" [nzStep]="1" [nzPrecision]="2" [nzPlaceHolder]="'执行价格'"></nz-input-number> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
|
||||
<nz-form-item> |
||||
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>服务费</nz-form-label> |
||||
<nz-form-control [nzSm]="14" [nzXs]="24"> |
||||
<nz-input-number formControlName="serviceFeeRate" [nzMin]="0" [nzMax]="200" [nzStep]="1" [nzPrecision]="2" [nzPlaceHolder]="'执行价格'"></nz-input-number> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
|
||||
<div nz-flex style="margin-top: 15px" [nzJustify]="'center'"> |
||||
<button nz-button nzType="primary" (click)="submitUpdateDiscount()" class="submit-btn">确定</button> |
||||
</div> |
||||
</form> |
||||
</ng-container> |
||||
</nz-modal> |
@ -0,0 +1,15 @@ |
||||
.search-area { |
||||
margin-bottom: 10px; |
||||
} |
||||
.search-area button { |
||||
margin-right: 8px; |
||||
} |
||||
nz-input-number { |
||||
width: 100%; |
||||
} |
||||
.submit-btn { |
||||
width: 150px; |
||||
} |
||||
.send-request { |
||||
margin-bottom: 16px; |
||||
} |
@ -0,0 +1,338 @@ |
||||
import { Component } from '@angular/core'; |
||||
import {DatePipe, NgForOf, NgIf} from "@angular/common"; |
||||
import {DictionaryPipe} from "../../../pipes/common/dictionary.pipe"; |
||||
import {FormGroup, FormsModule, NonNullableFormBuilder, ReactiveFormsModule, Validators} from "@angular/forms"; |
||||
import {NzButtonComponent} from "ng-zorro-antd/button"; |
||||
import { |
||||
NzCellFixedDirective, |
||||
NzTableCellDirective, |
||||
NzTableComponent, NzTableModule, |
||||
NzTbodyComponent, NzTheadComponent, |
||||
NzThMeasureDirective, NzTrDirective |
||||
} from "ng-zorro-antd/table"; |
||||
import {NzColDirective, NzRowDirective} from "ng-zorro-antd/grid"; |
||||
import {NzDividerComponent} from "ng-zorro-antd/divider"; |
||||
import {NzDropDownADirective, NzDropDownDirective, NzDropdownMenuComponent} from "ng-zorro-antd/dropdown"; |
||||
import {NzFormControlComponent, NzFormDirective, NzFormItemComponent, NzFormLabelComponent} from "ng-zorro-antd/form"; |
||||
import {NzIconDirective} from "ng-zorro-antd/icon"; |
||||
import {NzInputDirective} from "ng-zorro-antd/input"; |
||||
import {NzMenuDirective, NzMenuItemComponent} from "ng-zorro-antd/menu"; |
||||
import {NzOptionComponent, NzSelectComponent} from "ng-zorro-antd/select"; |
||||
import {NzModalModule, NzModalService} from "ng-zorro-antd/modal"; |
||||
import {NzFlexDirective} from "ng-zorro-antd/flex"; |
||||
import {NzDescriptionsModule} from "ng-zorro-antd/descriptions"; |
||||
import {NzUploadComponent} from "ng-zorro-antd/upload"; |
||||
import {NzAvatarModule} from "ng-zorro-antd/avatar"; |
||||
import {NzImageModule} from "ng-zorro-antd/image"; |
||||
import {NzSwitchComponent} from "ng-zorro-antd/switch"; |
||||
import {NzDatePickerComponent} from "ng-zorro-antd/date-picker"; |
||||
import {NzInputNumberModule} from "ng-zorro-antd/input-number"; |
||||
import {NzTypographyComponent} from "ng-zorro-antd/typography"; |
||||
import {NzMessageService} from "ng-zorro-antd/message"; |
||||
import {BrowserStorageService} from "../../../utils/localStorage.service"; |
||||
import {AgentService} from "../../../services/agent/agent.service"; |
||||
import {AgentStaffService} from "../../../services/agent/agent-staff.service"; |
||||
import {AgentMerService} from "../../../services/agent/agent-mer.service"; |
||||
import {CommonService} from "../../../services/common/common.service"; |
||||
import {DATA} from "../../../data/login/localStorage.namespace"; |
||||
import {MerService} from "../../../services/merchant/mer.service"; |
||||
import {AgentPriceService} from "../../../services/agent/agent-price.service"; |
||||
|
||||
@Component({ |
||||
selector: 'app-agent-price-list', |
||||
standalone: true, |
||||
imports: [ |
||||
DatePipe, |
||||
DictionaryPipe, |
||||
FormsModule, |
||||
NgForOf, |
||||
NgIf, |
||||
NzButtonComponent, |
||||
NzCellFixedDirective, |
||||
NzColDirective, |
||||
NzDividerComponent, |
||||
NzDropDownADirective, |
||||
NzDropDownDirective, |
||||
NzDropdownMenuComponent, |
||||
NzFormControlComponent, |
||||
NzFormDirective, |
||||
NzFormItemComponent, |
||||
NzFormLabelComponent, |
||||
NzIconDirective, |
||||
NzInputDirective, |
||||
NzMenuDirective, |
||||
NzMenuItemComponent, |
||||
NzOptionComponent, |
||||
NzRowDirective, |
||||
NzSelectComponent, |
||||
NzTableCellDirective, |
||||
NzTableComponent, |
||||
NzTbodyComponent, |
||||
NzThMeasureDirective, |
||||
NzTheadComponent, |
||||
NzTrDirective, |
||||
ReactiveFormsModule, |
||||
NzTableModule, |
||||
NzModalModule, |
||||
NzFlexDirective, |
||||
NzDescriptionsModule, |
||||
NzUploadComponent, |
||||
NzAvatarModule, |
||||
NzImageModule, |
||||
NzSwitchComponent, |
||||
NzDatePickerComponent, |
||||
NzInputNumberModule, |
||||
NzTypographyComponent |
||||
], |
||||
templateUrl: './agent-price-list.component.html', |
||||
styleUrl: './agent-price-list.component.less' |
||||
}) |
||||
export class AgentPriceListComponent { |
||||
// 表单页数
|
||||
tablePageNum = 1; |
||||
// 每页数量
|
||||
tablePageSize = 10; |
||||
// 表单数据
|
||||
tableData: any = { |
||||
total: 0, |
||||
list: [], |
||||
}; |
||||
// 搜索表单
|
||||
searchForm: FormGroup; |
||||
// 油站来源
|
||||
merSourceTypeArray = new DictionaryPipe().getDictionaryList('MER_SOURCE_TYPE'); |
||||
// 油号
|
||||
oilNoArray = new DictionaryPipe().getDictionaryList('OIL_NO'); |
||||
// 地区数据
|
||||
regionData: any = []; |
||||
// 优惠详情模态框
|
||||
discountDetailModal = false; |
||||
// 优惠详情数据
|
||||
discountDetailObj: any = []; |
||||
// 修改优惠模态框
|
||||
updateDiscountModal = false; |
||||
updateDiscountForm: FormGroup; |
||||
// 批量修改优惠模态框
|
||||
batchUpdateDiscountModal = false; |
||||
// 列表中全选状态
|
||||
checked = false; |
||||
// 已选择的数据
|
||||
setOfCheckedId = new Set<string>(); |
||||
constructor(private fb: NonNullableFormBuilder, |
||||
private merService: MerService, |
||||
private message: NzMessageService, |
||||
private agentPriceService: AgentPriceService, |
||||
private agentMerService: AgentMerService, |
||||
private commonService: CommonService, |
||||
private modal: NzModalService) { |
||||
// 初始化搜索框
|
||||
this.searchForm = this.fb.group({ |
||||
sourceType: [''], |
||||
provinceCode: [''], |
||||
merNo: [''], |
||||
merName: [''], |
||||
status: [''], |
||||
}); |
||||
|
||||
this.updateDiscountForm = this.fb.group({ |
||||
merNo: [''], |
||||
oilNo: ['', [Validators.required]], |
||||
priceRate: ['', [Validators.required]], |
||||
serviceFeeRate: ['', [Validators.required]], |
||||
}); |
||||
// 获取地区
|
||||
this.commonService.getRegion("", (data: any) => { |
||||
this.regionData = data['return_data']; |
||||
}); |
||||
|
||||
this.queryData(); |
||||
} |
||||
|
||||
/** |
||||
* 获取数据 |
||||
*/ |
||||
queryData() { |
||||
this.searchForm.value.pageNum = this.tablePageNum; |
||||
this.searchForm.value.pageSize = this.tablePageSize; |
||||
this.searchForm.value.time = new Date().getTime(); |
||||
this.agentMerService.getAllotList(this.searchForm.value, (data: any) => { |
||||
if (data['return_code'] == '000000') { |
||||
this.tableData = data['return_data']; |
||||
this.refreshCheckedStatus(); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
updateCheckedSet(merNo: string, checked: boolean): void { |
||||
if (checked) { |
||||
this.setOfCheckedId.add(merNo); |
||||
} else { |
||||
this.setOfCheckedId.delete(merNo); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 单选 |
||||
* @param merNo |
||||
* @param checked |
||||
*/ |
||||
onItemChecked(merNo: string, checked: boolean): void { |
||||
this.updateCheckedSet(merNo, checked); |
||||
this.refreshCheckedStatus(); |
||||
} |
||||
|
||||
/** |
||||
* 全选 |
||||
* @param checked |
||||
*/ |
||||
onAllChecked(checked: boolean): void { |
||||
// @ts-ignore
|
||||
this.tableData.list.forEach(({ merNo }) => this.updateCheckedSet(merNo, checked)); |
||||
this.refreshCheckedStatus(); |
||||
} |
||||
|
||||
/** |
||||
* 刷新数据 |
||||
*/ |
||||
refreshCheckedStatus(): void { |
||||
// @ts-ignore
|
||||
this.checked = this.tableData.list.every(({ merNo }) => this.setOfCheckedId.has(merNo)); |
||||
console.log(this.setOfCheckedId); |
||||
} |
||||
|
||||
/** |
||||
* 搜索表单提交 |
||||
*/ |
||||
searchFormSubmit(): void { |
||||
this.tablePageNum = 1; |
||||
this.queryData(); |
||||
} |
||||
|
||||
/** |
||||
* 搜索表单重置 |
||||
*/ |
||||
searchFormReset(): void { |
||||
this.searchForm.reset(); |
||||
} |
||||
|
||||
/** |
||||
* 打开批量调整弹出框 |
||||
*/ |
||||
showBatchUpdateDiscount() { |
||||
this.batchUpdateDiscountModal = true; |
||||
this.searchForm.controls['oilNo'].enable(); |
||||
} |
||||
|
||||
/** |
||||
* 提交批量修改 |
||||
*/ |
||||
submitBatchUpdateDiscount() { |
||||
if (this.setOfCheckedId.size == 0) { |
||||
this.modal.warning({ |
||||
nzTitle: '提示', |
||||
nzContent: '请再列中勾选需要调整油站' |
||||
}); |
||||
return; |
||||
} |
||||
if (this.updateDiscountForm.valid) { |
||||
let param = this.updateDiscountForm.value; |
||||
let merNoList = []; |
||||
for (let merNo of this.setOfCheckedId) { |
||||
merNoList.push({merNo: merNo}); |
||||
} |
||||
param['merNoList'] = merNoList; |
||||
param['oilNo'] = this.updateDiscountForm.controls['oilNo'].value; |
||||
this.agentPriceService.batchConfigPrice(param, (data: any) => { |
||||
if (data['return_code'] == '000000') { |
||||
this.message.create('success', '操作成功'); |
||||
// 关闭弹窗
|
||||
this.closeBatchUpdateDiscount(); |
||||
} else { |
||||
this.message.create('error', data['return_msg']); |
||||
} |
||||
}); |
||||
} else { |
||||
Object.values(this.updateDiscountForm.controls).forEach(control => { |
||||
if (control.invalid) { |
||||
control.markAsDirty(); |
||||
control.updateValueAndValidity({ onlySelf: true }); |
||||
} |
||||
}); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 关闭批量调整弹出框 |
||||
*/ |
||||
closeBatchUpdateDiscount() { |
||||
this.batchUpdateDiscountModal = false; |
||||
} |
||||
/** |
||||
* 打开优惠详情 |
||||
*/ |
||||
showDiscountDetail(merNo: string) { |
||||
this.agentPriceService.getOilNoPrice({merNo: merNo}, (data: any) => { |
||||
if (data['return_code'] == '000000') { |
||||
this.discountDetailObj = data['return_data']; |
||||
} |
||||
}); |
||||
this.discountDetailModal = true; |
||||
} |
||||
|
||||
/** |
||||
* 关闭优惠详情 |
||||
*/ |
||||
closeDiscountDetail() { |
||||
this.discountDetailModal = false; |
||||
} |
||||
|
||||
/** |
||||
* 打开修改优惠模态框 |
||||
* @param data |
||||
*/ |
||||
showUpdateDiscount(data: any) { |
||||
this.updateDiscountForm.patchValue(data); |
||||
this.updateDiscountForm.controls['oilNo'].disable(); |
||||
this.updateDiscountModal = true; |
||||
} |
||||
|
||||
/** |
||||
* 提交修改优惠 |
||||
*/ |
||||
submitUpdateDiscount() { |
||||
if (this.updateDiscountForm.valid) { |
||||
this.updateDiscountForm.value; |
||||
let paramArr = []; |
||||
let param = this.updateDiscountForm.value; |
||||
param['oilNo'] = this.updateDiscountForm.controls['oilNo'].value; |
||||
paramArr.push(param); |
||||
this.agentPriceService.editPrice(paramArr, (data: any) => { |
||||
if (data['return_code'] == '000000') { |
||||
this.message.create('success', '操作成功'); |
||||
// 关闭弹窗
|
||||
this.closeUpdateDiscount(); |
||||
// 刷新数据
|
||||
this.showDiscountDetail(param['merNo']); |
||||
// 表单重置
|
||||
this.updateDiscountForm.reset(); |
||||
} else { |
||||
this.message.create('error', data['return_msg']); |
||||
} |
||||
}); |
||||
} else { |
||||
Object.values(this.updateDiscountForm.controls).forEach(control => { |
||||
if (control.invalid) { |
||||
control.markAsDirty(); |
||||
control.updateValueAndValidity({ onlySelf: true }); |
||||
} |
||||
}); |
||||
} |
||||
} |
||||
/** |
||||
* 关闭修改优惠模态框 |
||||
*/ |
||||
closeUpdateDiscount() { |
||||
this.updateDiscountForm.reset(); |
||||
this.updateDiscountModal = false; |
||||
} |
||||
} |
@ -0,0 +1,124 @@ |
||||
<form nz-form [formGroup]="searchForm" class="search_form" [nzLayout]="'vertical'"> |
||||
<div nz-row [nzGutter]="24"> |
||||
<div nz-col [nzSpan]="6"> |
||||
<nz-form-item> |
||||
<nz-form-label nzRequired>代理商<span style="color: red">【当前代理】</span></nz-form-label> |
||||
<nz-form-control> |
||||
<nz-select formControlName="agentId" [nzPlaceHolder]="'请选择'" (ngModelChange)="queryAgentStaff(this.searchForm.controls['agentId'].value)"> |
||||
<nz-option *ngFor="let item of agentData" nzValue="{{item.id}}" nzLabel="{{item.name}}"></nz-option> |
||||
</nz-select> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
<div nz-col [nzSpan]="6"> |
||||
<nz-form-item> |
||||
<nz-form-label nzRequired>业务员<span style="color: red">【当前业务员】</span></nz-form-label> |
||||
<nz-form-control> |
||||
<nz-select formControlName="agentStaffId" [nzPlaceHolder]="'请选择'"> |
||||
<nz-option *ngFor="let item of agentStaffData" nzValue="{{item.id}}" nzLabel="{{item.name}}"></nz-option> |
||||
</nz-select> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
<div nz-col [nzSpan]="6"> |
||||
<nz-form-item> |
||||
<nz-form-label>地区</nz-form-label> |
||||
<nz-form-control> |
||||
<nz-select formControlName="provinceCode" nzAllowClear [nzPlaceHolder]="'请选择'" nzShowSearch> |
||||
<nz-option *ngFor="let item of regionData" nzValue="{{item.regionId}}" nzLabel="{{item.regionName}}"></nz-option> |
||||
</nz-select> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
<div nz-col [nzSpan]="6"> |
||||
<nz-form-item> |
||||
<nz-form-label>来源渠道</nz-form-label> |
||||
<nz-form-control> |
||||
<nz-select formControlName="sourceType" nzAllowClear [nzPlaceHolder]="'请选择'"> |
||||
<nz-option *ngFor="let item of merSourceTypeArray" nzValue="{{item.codeValue}}" nzLabel="{{item.codeName}}"></nz-option> |
||||
</nz-select> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
<div nz-col [nzSpan]="6"> |
||||
<nz-form-item> |
||||
<nz-form-label>油号</nz-form-label> |
||||
<nz-form-control> |
||||
<nz-select formControlName="oilNo" nzAllowClear [nzPlaceHolder]="'请选择'"> |
||||
<nz-option *ngFor="let item of oilNoArray" nzValue="{{item.codeValue}}" nzLabel="{{item.codeName}}"></nz-option> |
||||
</nz-select> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
<div nz-col [nzSpan]="6"> |
||||
<nz-form-item> |
||||
<nz-form-label>油站编号</nz-form-label> |
||||
<nz-form-control> |
||||
<input nz-input formControlName="merNo" placeholder="请输入" /> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
<div nz-col [nzSpan]="6"> |
||||
<nz-form-item> |
||||
<nz-form-label>油站名称</nz-form-label> |
||||
<nz-form-control> |
||||
<input nz-input formControlName="merName" placeholder="请输入" /> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
<div nz-col [nzSpan]="6"> |
||||
<nz-form-item> |
||||
<nz-form-label></nz-form-label> |
||||
<nz-form-control> |
||||
<button nz-button style="margin-right: 8px" [nzType]="'primary'" (click)="searchFormSubmit()">查询</button> |
||||
<button nz-button style="margin-right: 8px" (click)="searchFormReset()">重置</button> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
</div> |
||||
</form> |
||||
<nz-table #basicTable |
||||
[nzScroll]="{ x: '1400px' }" |
||||
[nzBordered]="true" |
||||
[nzFrontPagination]="false" |
||||
[nzShowQuickJumper]="true" |
||||
[nzShowTotal]="totalTemplate" |
||||
[(nzPageIndex)]="tablePageNum" |
||||
(nzPageIndexChange)="queryData()" |
||||
nzShowSizeChanger |
||||
(nzPageSizeChange)="this.tablePageSize = $event;queryData()" |
||||
[nzPageSizeOptions]="[ 10, 20, 30, 50, 100 ]" |
||||
[nzTotal]="tableData.total" |
||||
[nzData]="tableData.list" > |
||||
<thead> |
||||
<tr> |
||||
<th nzWidth="120px">来源渠道</th> |
||||
<th nzWidth="120px">油站地区</th> |
||||
<th nzWidth="110px">油站编号</th> |
||||
<th nzWidth="200px">油站名称</th> |
||||
<th nzWidth="100px">油号</th> |
||||
<th nzWidth="100px">国标价</th> |
||||
<th nzWidth="100px">油枪价</th> |
||||
<th nzWidth="100px">优惠价</th> |
||||
<th nzWidth="100px">代理折扣</th> |
||||
<th nzWidth="100px">代理加油价</th> |
||||
<th nzWidth="100px">服务费</th> |
||||
</tr> |
||||
</thead> |
||||
<tbody> |
||||
<tr *ngFor="let data of basicTable.data"> |
||||
<td>{{data.sourceType | dictionary: "MER_SOURCE_TYPE"}}</td> |
||||
<td>{{data.provinceName}}</td> |
||||
<td>{{data.merNo}}</td> |
||||
<td>{{data.merName}}</td> |
||||
<td>{{data.oilNo}}</td> |
||||
<td>¥ {{data.priceOfficial}}</td> |
||||
<td>¥ {{data.priceGun}}</td> |
||||
<td>¥ {{data.priceVip}}</td> |
||||
<td>{{data.priceRate}} %</td> |
||||
<td>¥ {{data.terminalPrice}}</td> |
||||
<td>{{data.serviceFeeRate}} %</td> |
||||
</tr> |
||||
</tbody> |
||||
<ng-template #totalTemplate let-total>总计 {{ total }} 条</ng-template> |
||||
</nz-table> |
@ -0,0 +1,15 @@ |
||||
.search-area { |
||||
margin-bottom: 10px; |
||||
} |
||||
.search-area button { |
||||
margin-right: 8px; |
||||
} |
||||
nz-input-number { |
||||
width: 100%; |
||||
} |
||||
.submit-btn { |
||||
width: 150px; |
||||
} |
||||
.send-request { |
||||
margin-bottom: 16px; |
||||
} |
@ -0,0 +1,193 @@ |
||||
import { Component } from '@angular/core'; |
||||
import {DictionaryPipe} from "../../../pipes/common/dictionary.pipe"; |
||||
import {DatePipe, NgForOf, NgIf} from "@angular/common"; |
||||
import {NzButtonComponent} from "ng-zorro-antd/button"; |
||||
import { |
||||
NzCellFixedDirective, |
||||
NzTableCellDirective, |
||||
NzTableComponent, NzTableModule, |
||||
NzTbodyComponent, |
||||
NzTdAddOnComponent, NzTheadComponent, NzThMeasureDirective, NzThSelectionComponent, NzTrDirective |
||||
} from "ng-zorro-antd/table"; |
||||
import {NzColDirective, NzRowDirective} from "ng-zorro-antd/grid"; |
||||
import {NzFlexDirective} from "ng-zorro-antd/flex"; |
||||
import {NzFormControlComponent, NzFormDirective, NzFormItemComponent, NzFormLabelComponent} from "ng-zorro-antd/form"; |
||||
import {NzInputDirective} from "ng-zorro-antd/input"; |
||||
import {NzInputNumberComponent, NzInputNumberModule} from "ng-zorro-antd/input-number"; |
||||
import {NzModalComponent, NzModalModule, NzModalService} from "ng-zorro-antd/modal"; |
||||
import {NzOptionComponent, NzSelectComponent} from "ng-zorro-antd/select"; |
||||
import {NzTypographyComponent} from "ng-zorro-antd/typography"; |
||||
import {FormGroup, FormsModule, NonNullableFormBuilder, ReactiveFormsModule, Validators} from "@angular/forms"; |
||||
import {MerService} from "../../../services/merchant/mer.service"; |
||||
import {NzMessageService} from "ng-zorro-antd/message"; |
||||
import {AgentPriceService} from "../../../services/agent/agent-price.service"; |
||||
import {AgentMerService} from "../../../services/agent/agent-mer.service"; |
||||
import {CommonService} from "../../../services/common/common.service"; |
||||
import {NzDividerComponent} from "ng-zorro-antd/divider"; |
||||
import {NzDropDownADirective, NzDropDownDirective, NzDropdownMenuComponent} from "ng-zorro-antd/dropdown"; |
||||
import {NzIconDirective} from "ng-zorro-antd/icon"; |
||||
import {NzMenuDirective, NzMenuItemComponent} from "ng-zorro-antd/menu"; |
||||
import {NzDescriptionsModule} from "ng-zorro-antd/descriptions"; |
||||
import {NzUploadComponent} from "ng-zorro-antd/upload"; |
||||
import {NzAvatarModule} from "ng-zorro-antd/avatar"; |
||||
import {NzImageModule} from "ng-zorro-antd/image"; |
||||
import {NzSwitchComponent} from "ng-zorro-antd/switch"; |
||||
import {NzDatePickerComponent} from "ng-zorro-antd/date-picker"; |
||||
import {AgentService} from "../../../services/agent/agent.service"; |
||||
import {AgentStaffService} from "../../../services/agent/agent-staff.service"; |
||||
|
||||
@Component({ |
||||
selector: 'app-agent-refer-price-list', |
||||
standalone: true, |
||||
imports: [ |
||||
DatePipe, |
||||
DictionaryPipe, |
||||
FormsModule, |
||||
NgForOf, |
||||
NgIf, |
||||
NzButtonComponent, |
||||
NzCellFixedDirective, |
||||
NzColDirective, |
||||
NzDividerComponent, |
||||
NzDropDownADirective, |
||||
NzDropDownDirective, |
||||
NzDropdownMenuComponent, |
||||
NzFormControlComponent, |
||||
NzFormDirective, |
||||
NzFormItemComponent, |
||||
NzFormLabelComponent, |
||||
NzIconDirective, |
||||
NzInputDirective, |
||||
NzMenuDirective, |
||||
NzMenuItemComponent, |
||||
NzOptionComponent, |
||||
NzRowDirective, |
||||
NzSelectComponent, |
||||
NzTableCellDirective, |
||||
NzTableComponent, |
||||
NzTbodyComponent, |
||||
NzThMeasureDirective, |
||||
NzTheadComponent, |
||||
NzTrDirective, |
||||
ReactiveFormsModule, |
||||
NzTableModule, |
||||
NzModalModule, |
||||
NzFlexDirective, |
||||
NzDescriptionsModule, |
||||
NzUploadComponent, |
||||
NzAvatarModule, |
||||
NzImageModule, |
||||
NzSwitchComponent, |
||||
NzDatePickerComponent, |
||||
NzInputNumberModule, |
||||
NzTypographyComponent |
||||
], |
||||
templateUrl: './agent-refer-price-list.component.html', |
||||
styleUrl: './agent-refer-price-list.component.less' |
||||
}) |
||||
export class AgentReferPriceListComponent { |
||||
// 表单页数
|
||||
tablePageNum = 1; |
||||
// 每页数量
|
||||
tablePageSize = 10; |
||||
// 表单数据
|
||||
tableData: any = { |
||||
total: 0, |
||||
list: [], |
||||
}; |
||||
// 搜索表单
|
||||
searchForm: FormGroup; |
||||
// 油站来源
|
||||
merSourceTypeArray = new DictionaryPipe().getDictionaryList('MER_SOURCE_TYPE'); |
||||
// 油号
|
||||
oilNoArray = new DictionaryPipe().getDictionaryList('OIL_NO'); |
||||
// 地区数据
|
||||
regionData: any = []; |
||||
// 代理商
|
||||
agentData: any = []; |
||||
// 代理商业务员
|
||||
agentStaffData: any = []; |
||||
|
||||
constructor(private fb: NonNullableFormBuilder, |
||||
private merService: MerService, |
||||
private message: NzMessageService, |
||||
private agentService: AgentService, |
||||
private agentStaffService: AgentStaffService, |
||||
private agentPriceService: AgentPriceService, |
||||
private agentMerService: AgentMerService, |
||||
private commonService: CommonService, |
||||
private modal: NzModalService) { |
||||
// 初始化搜索框
|
||||
this.searchForm = this.fb.group({ |
||||
agentId: [''], |
||||
agentStaffId: [''], |
||||
sourceType: [''], |
||||
provinceCode: [''], |
||||
oilNo: [''], |
||||
merNo: [''], |
||||
merName: [''], |
||||
}); |
||||
|
||||
// 获取地区
|
||||
this.commonService.getRegion("", (data: any) => { |
||||
this.regionData = data['return_data']; |
||||
}); |
||||
|
||||
// 获取代理商
|
||||
this.agentService.queryAgentList({pageNum:1,pageSize:999}, (data: any) => { |
||||
this.agentData = data['return_data']['list']; |
||||
this.searchForm.controls['agentId'].setValue(String(this.agentData[0]['id'])); |
||||
// 查询业务员
|
||||
this.queryAgentStaff(String(this.agentData[0]['id'])); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 获取数据 |
||||
*/ |
||||
queryData() { |
||||
this.searchForm.value.pageNum = this.tablePageNum; |
||||
this.searchForm.value.pageSize = this.tablePageSize; |
||||
this.agentPriceService.getPriceList(this.searchForm.value, (data: any) => { |
||||
if (data['return_code'] == '000000') { |
||||
this.tableData = data['return_data']; |
||||
} |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 获取数据 |
||||
*/ |
||||
queryAgentStaff(agentId: string) { |
||||
this.searchForm.controls['agentStaffId'].setValue(null); |
||||
this.agentStaffService.getStaffList({agentId: agentId, pageNum:1, pageSize:9999}, (data: any) => { |
||||
if (data['return_code'] == '000000') { |
||||
this.agentStaffData = data['return_data']['list']; |
||||
if (this.agentStaffData.length > 0) { |
||||
this.searchForm.controls['agentStaffId'].setValue(''+this.agentStaffData[0]['id']); |
||||
// 查询数据
|
||||
this.queryData(); |
||||
} |
||||
} |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 搜索表单提交 |
||||
*/ |
||||
searchFormSubmit(): void { |
||||
this.tablePageNum = 1; |
||||
this.queryData(); |
||||
} |
||||
|
||||
/** |
||||
* 搜索表单重置 |
||||
*/ |
||||
searchFormReset(): void { |
||||
this.searchForm.controls['provinceCode'].setValue(null); |
||||
this.searchForm.controls['sourceType'].setValue(null); |
||||
this.searchForm.controls['merNo'].setValue(null); |
||||
this.searchForm.controls['merName'].setValue(null); |
||||
this.searchForm.controls['oilNo'].setValue(null); |
||||
} |
||||
} |
@ -0,0 +1,105 @@ |
||||
<form nz-form [formGroup]="searchForm" class="search_form" [nzLayout]="'vertical'"> |
||||
<div nz-row [nzGutter]="24"> |
||||
|
||||
<div nz-col [nzSpan]="6"> |
||||
<nz-form-item> |
||||
<nz-form-label>名称</nz-form-label> |
||||
<nz-form-control> |
||||
<input nz-input formControlName="name" placeholder="请输入" /> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
|
||||
<div nz-col [nzSpan]="6"> |
||||
<nz-form-item> |
||||
<nz-form-label>手机号</nz-form-label> |
||||
<nz-form-control> |
||||
<input nz-input formControlName="telephone" placeholder="请输入" /> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
|
||||
<div nz-col [nzSpan]="6"> |
||||
<nz-form-item> |
||||
<nz-form-label></nz-form-label> |
||||
<nz-form-control> |
||||
<button nz-button style="margin-right: 8px" [nzType]="'primary'" (click)="searchFormSubmit()">查询</button> |
||||
<button nz-button style="margin-right: 8px" (click)="searchFormReset()">重置</button> |
||||
<button nz-button style="margin-right: 8px" (click)="showEditModal(null)" [nzType]="'primary'" >新增人员</button> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
</div> |
||||
</form> |
||||
|
||||
<nz-table #basicTable |
||||
[nzScroll]="{ x: '1000' }" |
||||
[nzBordered]="true" |
||||
[nzFrontPagination]="false" |
||||
[nzShowQuickJumper]="true" |
||||
[nzShowTotal]="totalTemplate" |
||||
[(nzPageIndex)]="tablePageNum" |
||||
(nzPageIndexChange)="queryData()" |
||||
nzShowSizeChanger |
||||
(nzPageSizeChange)="this.tablePageSize = $event;queryData()" |
||||
[nzPageSizeOptions]="[ 10, 20, 30, 50, 100 ]" |
||||
[nzTotal]="tableData.total" |
||||
[nzData]="tableData.list" > |
||||
<thead> |
||||
<tr> |
||||
<th nzWidth="50px">名称</th> |
||||
<th nzWidth="50px">手机号</th> |
||||
<th nzWidth="50px">创建时间</th> |
||||
<th nzRight nzWidth="30px">操作</th> |
||||
</tr> |
||||
</thead> |
||||
<tbody> |
||||
<tr *ngFor="let data of basicTable.data"> |
||||
<td>{{data.name}}</td> |
||||
<td>{{data.telephone}}</td> |
||||
<td>{{data.createTime | date : 'yyyy-MM-dd HH:mm:ss'}}</td> |
||||
<td nzRight> |
||||
<a nz-dropdown [nzDropdownMenu]="menu"> |
||||
操作列表 |
||||
<span nz-icon nzType="down"></span> |
||||
</a> |
||||
<nz-dropdown-menu #menu="nzDropdownMenu"> |
||||
<ul nz-menu nzSelectable> |
||||
<li nz-menu-item ><a (click)="showEditModal(data)">修改</a></li> |
||||
<li nz-menu-item ><a (click)="delStaff(data.id)">删除</a></li> |
||||
</ul> |
||||
</nz-dropdown-menu></td> |
||||
</tr> |
||||
</tbody> |
||||
<ng-template #totalTemplate let-total>总计 {{ total }} 条</ng-template> |
||||
</nz-table> |
||||
|
||||
<nz-modal [(nzVisible)]="editModal" |
||||
[nzWidth]="500" |
||||
nzTitle="{{this.editForm.controls['id'].value==null?'新增':'修改'}}" |
||||
[nzFooter]="null" |
||||
(nzOnCancel)="closeEditModal()"> |
||||
<ng-container *nzModalContent> |
||||
<form nz-form [formGroup]="editForm"> |
||||
|
||||
<nz-form-item> |
||||
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>名称</nz-form-label> |
||||
<nz-form-control [nzSm]="14" [nzXs]="24"> |
||||
<input nz-input formControlName="name" placeholder="请输入" /> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
|
||||
<nz-form-item> |
||||
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>手机号</nz-form-label> |
||||
<nz-form-control [nzSm]="14" [nzXs]="24"> |
||||
<input nz-input formControlName="telephone" placeholder="请输入" /> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
|
||||
|
||||
<div nz-flex style="margin-top: 15px" [nzJustify]="'center'"> |
||||
<button nz-button nzType="primary" (click)="submitData()" class="submit-btn">保存</button> |
||||
</div> |
||||
</form> |
||||
</ng-container> |
||||
</nz-modal> |
@ -0,0 +1,9 @@ |
||||
nz-input-number { |
||||
width: 100%; |
||||
} |
||||
nz-date-picker { |
||||
width: 100%; |
||||
} |
||||
.submit-btn { |
||||
width: 150px; |
||||
} |
@ -0,0 +1,234 @@ |
||||
import { Component } from '@angular/core'; |
||||
import {DatePipe, NgForOf, NgIf} from "@angular/common"; |
||||
import {DictionaryPipe} from "../../../pipes/common/dictionary.pipe"; |
||||
import {NzButtonComponent} from "ng-zorro-antd/button"; |
||||
import { |
||||
NzCellFixedDirective, |
||||
NzTableCellDirective, |
||||
NzTableComponent, NzTableModule, |
||||
NzTbodyComponent, NzTheadComponent, |
||||
NzThMeasureDirective, NzTrDirective |
||||
} from "ng-zorro-antd/table"; |
||||
import {NzColDirective, NzRowDirective} from "ng-zorro-antd/grid"; |
||||
import {NzDropDownADirective, NzDropDownDirective, NzDropdownMenuComponent} from "ng-zorro-antd/dropdown"; |
||||
import {NzFlexDirective} from "ng-zorro-antd/flex"; |
||||
import {NzFormControlComponent, NzFormDirective, NzFormItemComponent, NzFormLabelComponent} from "ng-zorro-antd/form"; |
||||
import {NzIconDirective} from "ng-zorro-antd/icon"; |
||||
import {NzInputDirective} from "ng-zorro-antd/input"; |
||||
import {NzMenuDirective, NzMenuItemComponent} from "ng-zorro-antd/menu"; |
||||
import {NzModalComponent, NzModalModule, NzModalService} from "ng-zorro-antd/modal"; |
||||
import {NzOptionComponent, NzSelectComponent} from "ng-zorro-antd/select"; |
||||
import {FormGroup, FormsModule, NonNullableFormBuilder, ReactiveFormsModule, Validators} from "@angular/forms"; |
||||
import {NzMessageService} from "ng-zorro-antd/message"; |
||||
import {BrowserStorageService} from "../../../utils/localStorage.service"; |
||||
import {AgentService} from "../../../services/agent/agent.service"; |
||||
import {AgentStaffService} from "../../../services/agent/agent-staff.service"; |
||||
import {CommonService} from "../../../services/common/common.service"; |
||||
import {NzDividerComponent} from "ng-zorro-antd/divider"; |
||||
import {NzDescriptionsModule} from "ng-zorro-antd/descriptions"; |
||||
import {NzUploadComponent} from "ng-zorro-antd/upload"; |
||||
import {NzAvatarModule} from "ng-zorro-antd/avatar"; |
||||
import {NzImageModule} from "ng-zorro-antd/image"; |
||||
import {NzSwitchComponent} from "ng-zorro-antd/switch"; |
||||
import {NzDatePickerComponent} from "ng-zorro-antd/date-picker"; |
||||
import {NzInputNumberModule} from "ng-zorro-antd/input-number"; |
||||
import {NzTypographyComponent} from "ng-zorro-antd/typography"; |
||||
|
||||
@Component({ |
||||
selector: 'app-agent-staff', |
||||
standalone: true, |
||||
imports: [ |
||||
DatePipe, |
||||
DictionaryPipe, |
||||
FormsModule, |
||||
NgForOf, |
||||
NgIf, |
||||
NzButtonComponent, |
||||
NzCellFixedDirective, |
||||
NzColDirective, |
||||
NzDividerComponent, |
||||
NzDropDownADirective, |
||||
NzDropDownDirective, |
||||
NzDropdownMenuComponent, |
||||
NzFormControlComponent, |
||||
NzFormDirective, |
||||
NzFormItemComponent, |
||||
NzFormLabelComponent, |
||||
NzIconDirective, |
||||
NzInputDirective, |
||||
NzMenuDirective, |
||||
NzMenuItemComponent, |
||||
NzOptionComponent, |
||||
NzRowDirective, |
||||
NzSelectComponent, |
||||
NzTableCellDirective, |
||||
NzTableComponent, |
||||
NzTbodyComponent, |
||||
NzThMeasureDirective, |
||||
NzTheadComponent, |
||||
NzTrDirective, |
||||
ReactiveFormsModule, |
||||
NzTableModule, |
||||
NzModalModule, |
||||
NzFlexDirective, |
||||
NzDescriptionsModule, |
||||
NzUploadComponent, |
||||
NzAvatarModule, |
||||
NzImageModule, |
||||
NzSwitchComponent, |
||||
NzDatePickerComponent, |
||||
NzInputNumberModule, |
||||
NzTypographyComponent |
||||
], |
||||
templateUrl: './agent-staff.component.html', |
||||
styleUrl: './agent-staff.component.less' |
||||
}) |
||||
export class AgentStaffComponent { |
||||
// 表单页数
|
||||
tablePageNum = 1; |
||||
// 每页数量
|
||||
tablePageSize = 10; |
||||
// 表单数据
|
||||
tableData: any = { |
||||
total: 0, |
||||
list: [], |
||||
}; |
||||
// 搜索表单
|
||||
searchForm: FormGroup; |
||||
// 编辑表单
|
||||
editForm: FormGroup; |
||||
editModal = false; |
||||
constructor(private fb: NonNullableFormBuilder, |
||||
private message: NzMessageService, |
||||
private storage: BrowserStorageService, |
||||
private agentStaffService: AgentStaffService, |
||||
private commonService: CommonService, |
||||
private modal: NzModalService) { |
||||
|
||||
// 初始化搜索框
|
||||
this.searchForm = this.fb.group({ |
||||
name: [null], |
||||
telephone: [null], |
||||
}); |
||||
|
||||
this.editForm = this.fb.group({ |
||||
id: [null], |
||||
name: [null, [Validators.required]], |
||||
telephone: [null, [Validators.required]], |
||||
}); |
||||
// 查询数据
|
||||
this.queryData(); |
||||
} |
||||
|
||||
/** |
||||
* 获取数据 |
||||
*/ |
||||
queryData() { |
||||
this.searchForm.value.pageNum = this.tablePageNum; |
||||
this.searchForm.value.pageSize = this.tablePageSize; |
||||
this.searchForm.value.time = new Date().getTime(); |
||||
this.agentStaffService.getStaffList(this.searchForm.value, (data: any) => { |
||||
if (data['return_code'] == '000000') { |
||||
this.tableData = data['return_data']; |
||||
} |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 搜索表单提交 |
||||
*/ |
||||
searchFormSubmit(): void { |
||||
this.tablePageNum = 1; |
||||
this.queryData(); |
||||
} |
||||
|
||||
/** |
||||
* 搜索表单重置 |
||||
*/ |
||||
searchFormReset(): void { |
||||
this.searchForm.reset(); |
||||
} |
||||
|
||||
/** |
||||
* 打开编辑模态框 |
||||
*/ |
||||
showEditModal(data: any) { |
||||
if (data != null) { |
||||
this.editForm.patchValue(data); |
||||
} |
||||
this.editModal = true; |
||||
} |
||||
|
||||
/** |
||||
* 提交数据 |
||||
*/ |
||||
submitData() { |
||||
if (this.editForm.valid) { |
||||
if (this.editForm.controls['id'].value == null) { |
||||
this.agentStaffService.addStaff(this.editForm.value, (data: any) => { |
||||
if (data['return_code'] == '000000') { |
||||
this.message.create('success', '操作成功'); |
||||
// 刷新数据
|
||||
this.queryData(); |
||||
// 关闭弹窗
|
||||
this.closeEditModal(); |
||||
// 表单重置
|
||||
this.editForm.reset(); |
||||
} else { |
||||
this.message.create('error', data['return_msg']); |
||||
} |
||||
}); |
||||
} else { |
||||
this.agentStaffService.updateStaff(this.editForm.value, (data: any) => { |
||||
if (data['return_code'] == '000000') { |
||||
this.message.create('success', '操作成功'); |
||||
// 刷新数据
|
||||
this.queryData(); |
||||
// 关闭弹窗
|
||||
this.closeEditModal(); |
||||
// 表单重置
|
||||
this.editForm.reset(); |
||||
} else { |
||||
this.message.create('error', data['return_msg']); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
} else { |
||||
Object.values(this.editForm.controls).forEach(control => { |
||||
if (control.invalid) { |
||||
control.markAsDirty(); |
||||
control.updateValueAndValidity({ onlySelf: true }); |
||||
} |
||||
}); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 关闭编辑模态框 |
||||
*/ |
||||
closeEditModal() { |
||||
this.editForm.reset(); |
||||
this.editModal = false; |
||||
} |
||||
|
||||
/** |
||||
* 删除 |
||||
*/ |
||||
delStaff(id: number) { |
||||
this.modal.confirm({ |
||||
nzTitle: '提示', |
||||
nzContent: '确定删除账户吗?', |
||||
nzOnOk: () => |
||||
this.agentStaffService.delStaff({id: id}, (data: any) => { |
||||
if (data['return_code'] == '000000') { |
||||
// 刷新数据
|
||||
this.queryData(); |
||||
this.message.create('success', '操作成功'); |
||||
} else { |
||||
this.message.create('error', data['return_msg']); |
||||
} |
||||
}) |
||||
}); |
||||
} |
||||
} |
@ -0,0 +1,12 @@ |
||||
import { NgModule } from '@angular/core'; |
||||
import { CommonModule } from '@angular/common'; |
||||
|
||||
|
||||
|
||||
@NgModule({ |
||||
declarations: [], |
||||
imports: [ |
||||
CommonModule |
||||
] |
||||
}) |
||||
export class AgentModule { } |
@ -0,0 +1,18 @@ |
||||
import { Routes } from '@angular/router'; |
||||
import {AgentListComponent} from "./agent-list/agent-list.component"; |
||||
import {AgentMerAccountComponent} from "./agent-mer-account/agent-mer-account.component"; |
||||
import {AgentMerListComponent} from "./agent-mer-list/agent-mer-list.component"; |
||||
import {AgentStaffComponent} from "./agent-staff/agent-staff.component"; |
||||
import {AgentPriceListComponent} from "./agent-price-list/agent-price-list.component"; |
||||
import {AgentReferPriceListComponent} from "./agent-refer-price-list/agent-refer-price-list.component"; |
||||
import {AgentApiAccountComponent} from "./agent-api-account/agent-api-account.component"; |
||||
|
||||
export const AGENT_ROUTES: Routes = [ |
||||
{ path: 'agent-list', component: AgentListComponent }, |
||||
{ path: 'agent-mer-list', component: AgentMerListComponent }, |
||||
{ path: 'agent-mer-account', component: AgentMerAccountComponent }, |
||||
{ path: 'agent-staff', component: AgentStaffComponent }, |
||||
{ path: 'agent-price-list', component: AgentPriceListComponent }, |
||||
{ path: 'agent-refer-price-list', component: AgentReferPriceListComponent }, |
||||
{ path: 'agent-api-account', component: AgentApiAccountComponent }, |
||||
]; |
@ -0,0 +1,123 @@ |
||||
<form nz-form [formGroup]="form"> |
||||
<nz-form-item> |
||||
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>优惠券包名称</nz-form-label> |
||||
<nz-form-control [nzSm]="14" [nzXs]="24"> |
||||
<input nz-input formControlName="discountPkName" placeholder="请输入" /> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
|
||||
<nz-form-item> |
||||
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>销售价格</nz-form-label> |
||||
<nz-form-control [nzSm]="14" [nzXs]="24"> |
||||
<nz-input-number formControlName="salePrice" [nzMin]="0" [nzMax]="200" [nzStep]="1" [nzPrecision]="2" [nzPlaceHolder]="'执行价格'"></nz-input-number> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
|
||||
<nz-form-item> |
||||
<nz-form-label [nzSm]="6" [nzXs]="24">描述</nz-form-label> |
||||
<nz-form-control [nzSm]="14" [nzXs]="24"> |
||||
<textarea rows="2" formControlName="describe" nz-input [placeholder]="'请输入'"></textarea> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
|
||||
<nz-form-item> |
||||
<nz-form-label [nzSm]="6" [nzXs]="24">列表图片</nz-form-label> |
||||
<nz-form-control [nzSm]="14" [nzXs]="24"> |
||||
<nz-upload |
||||
class="logo-uploader" |
||||
nzAction="{{BASE_URL}}fileUpload/uploadfile" |
||||
nzName="avatar" |
||||
nzListType="picture-card" |
||||
[nzAccept]="'.jpg,.png'" |
||||
[nzShowUploadList]="false" |
||||
[nzBeforeUpload]="beforeUpload" |
||||
(nzChange)="handleChange($event)" |
||||
> |
||||
<ng-container *ngIf="!listImgUrl"> |
||||
<i class="upload-icon" nz-icon [nzType]="listImgLoading ? 'loading' : 'plus'"></i> |
||||
<div class="ant-upload-text">上传</div> |
||||
</ng-container> |
||||
<img *ngIf="listImgUrl" [src]="listImgUrl" style="width: 100%" /> |
||||
</nz-upload> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
|
||||
<nz-form-item> |
||||
<nz-form-label [nzSm]="6" [nzXs]="24">内容图片</nz-form-label> |
||||
<nz-form-control [nzSm]="14" [nzXs]="24"> |
||||
<nz-upload |
||||
nzAction="{{BASE_URL}}fileUpload/uploadfile" |
||||
nzListType="picture-card" |
||||
[nzAccept]="'.jpg,.png'" |
||||
[(nzFileList)]="contentFileList" |
||||
[nzShowButton]="contentFileList.length < 5" |
||||
> |
||||
<div> |
||||
<span nz-icon nzType="plus"></span> |
||||
<div style="margin-top: 8px">上传</div> |
||||
</div> |
||||
</nz-upload> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
|
||||
<button nz-button nzType="primary" class="submit-btn" (click)="showCheckedModal()">选择优惠券</button> |
||||
<nz-table #checkedTable [nzData]="checkedDiscountData"> |
||||
<thead> |
||||
<tr> |
||||
<th>优惠券编码</th> |
||||
<th>优惠券名称</th> |
||||
<th>数量</th> |
||||
</tr> |
||||
</thead> |
||||
<tbody> |
||||
<tr *ngFor="let data of checkedTable.data"> |
||||
<td>{{data.discountNo}}</td> |
||||
<td>{{data.discountName}}</td> |
||||
<td>{{data.number}}</td> |
||||
</tr> |
||||
</tbody> |
||||
</nz-table> |
||||
|
||||
<div nz-flex [nzJustify]="'center'"> |
||||
<button nz-button nzType="primary" class="submit-btn" (click)="submitForm()">保存</button> |
||||
</div> |
||||
</form> |
||||
|
||||
|
||||
|
||||
<nz-modal [(nzVisible)]="checkedDiscountModal" |
||||
[nzWidth]="1000" |
||||
[nzTitle]="'选择优惠券'" |
||||
(nzOnOk)="submitCheckedDiscount()" |
||||
(nzOnCancel)="closeCheckedModal()"> |
||||
<ng-container *nzModalContent> |
||||
<nz-table #basicTable [nzData]="discountData" [nzSize]="'small'"> |
||||
<thead> |
||||
<tr> |
||||
<th nzWidth="50px" [nzChecked]="checked" (nzCheckedChange)="onAllChecked($event)"></th> |
||||
<th nzWidth="70px">优惠券编码</th> |
||||
<th nzWidth="150px">优惠券名称</th> |
||||
<th nzWidth="70px">优惠类型</th> |
||||
<th nzWidth="70px">优惠券金额</th> |
||||
<th nzWidth="70px">优惠券条件</th> |
||||
<th nzWidth="100px">使用范围</th> |
||||
<th nzWidth="80px">领取有效期</th> |
||||
<th nzWidth="100px">结束时间</th> |
||||
</tr> |
||||
</thead> |
||||
<tbody> |
||||
<tr *ngFor="let data of basicTable.data"> |
||||
<td [nzChecked]="setOfCheckedId.has(data.discountNo)" (nzCheckedChange)="onItemChecked(data.discountNo, $event)" ></td> |
||||
<td>{{data.discountNo}}</td> |
||||
<td>{{data.discountName}}</td> |
||||
<td>{{data.discountType | dictionary: 'DISCOUNT_TYPE'}}</td> |
||||
<td>{{data.discountPrice}}</td> |
||||
<td>{{data.discountCondition}}</td> |
||||
<td>{{data.useScope}}</td> |
||||
<td>{{data.receiveExpirationDate}}天</td> |
||||
<td>{{data.endTime | date : 'yyyy-MM-dd HH:mm:ss'}}</td> |
||||
</tr> |
||||
</tbody> |
||||
</nz-table> |
||||
</ng-container> |
||||
</nz-modal> |
@ -0,0 +1,19 @@ |
||||
|
||||
.logo-uploader { |
||||
text-align: left; |
||||
} |
||||
.submit-btn { |
||||
width: 150px; |
||||
} |
||||
nz-input-number { |
||||
width: 100%; |
||||
} |
||||
nz-input-number-group { |
||||
width: 100%; |
||||
} |
||||
[nz-form] { |
||||
max-width: 800px; |
||||
} |
||||
nz-date-picker { |
||||
width: 100%; |
||||
} |
@ -0,0 +1,299 @@ |
||||
import { Component } from '@angular/core'; |
||||
import {FormGroup, FormsModule, NonNullableFormBuilder, ReactiveFormsModule, Validators} from "@angular/forms"; |
||||
import {DatePipe, NgForOf, NgIf} from "@angular/common"; |
||||
import {NzButtonComponent} from "ng-zorro-antd/button"; |
||||
import {NzColDirective} from "ng-zorro-antd/grid"; |
||||
import { NzDatePickerModule} from "ng-zorro-antd/date-picker"; |
||||
import {NzFlexDirective} from "ng-zorro-antd/flex"; |
||||
import { |
||||
NzFormControlComponent, |
||||
NzFormDirective, |
||||
NzFormItemComponent, |
||||
NzFormLabelComponent, |
||||
NzFormModule |
||||
} from "ng-zorro-antd/form"; |
||||
import {NzInputDirective, NzInputGroupComponent} from "ng-zorro-antd/input"; |
||||
import {NzInputNumberComponent, NzInputNumberGroupComponent} from "ng-zorro-antd/input-number"; |
||||
import {NzOptionComponent, NzSelectComponent} from "ng-zorro-antd/select"; |
||||
import {DictionaryPipe} from "../../../pipes/common/dictionary.pipe"; |
||||
import {MerService} from "../../../services/merchant/mer.service"; |
||||
import {DiscountService} from "../../../services/discount/discount.service"; |
||||
import {NzMessageService} from "ng-zorro-antd/message"; |
||||
import {ActivatedRoute} from "@angular/router"; |
||||
import {NzModalModule} from "ng-zorro-antd/modal"; |
||||
import {NzUploadFile, NzUploadModule} from "ng-zorro-antd/upload"; |
||||
import {NzIconDirective} from "ng-zorro-antd/icon"; |
||||
import {NzCascaderModule} from "ng-zorro-antd/cascader"; |
||||
import {NzTabsModule} from "ng-zorro-antd/tabs"; |
||||
import {NzCheckboxModule} from "ng-zorro-antd/checkbox"; |
||||
import {DiscountPkService} from "../../../services/discount/discount-pk.service"; |
||||
import {environment} from "../../../../environments/environment"; |
||||
import {Observable, Observer} from "rxjs"; |
||||
import {ka_GE} from "ng-zorro-antd/i18n"; |
||||
import { |
||||
NzCellFixedDirective, |
||||
NzTableCellDirective, |
||||
NzTableComponent, |
||||
NzTbodyComponent, NzTdAddOnComponent, |
||||
NzTheadComponent, |
||||
NzThMeasureDirective, NzThSelectionComponent, NzTrDirective |
||||
} from "ng-zorro-antd/table"; |
||||
|
||||
@Component({ |
||||
selector: 'app-discount-pk-edit', |
||||
standalone: true, |
||||
imports: [ |
||||
FormsModule, |
||||
NgForOf, |
||||
NzButtonComponent, |
||||
NzColDirective, |
||||
NzFlexDirective, |
||||
NzFormControlComponent, |
||||
NzFormDirective, |
||||
ReactiveFormsModule, |
||||
NzFormItemComponent, |
||||
NzFormLabelComponent, |
||||
NzInputDirective, |
||||
NzSelectComponent, |
||||
NzOptionComponent, |
||||
NzModalModule, |
||||
NzFormModule, |
||||
NzUploadModule, |
||||
NzIconDirective, |
||||
NgIf, |
||||
NzInputGroupComponent, |
||||
NzInputNumberComponent, |
||||
NzCascaderModule, |
||||
NzTabsModule, |
||||
NzCheckboxModule, |
||||
NzDatePickerModule, |
||||
NzInputNumberGroupComponent, |
||||
DatePipe, |
||||
DictionaryPipe, |
||||
NzTableCellDirective, |
||||
NzTableComponent, |
||||
NzTbodyComponent, |
||||
NzThMeasureDirective, |
||||
NzTheadComponent, |
||||
NzTrDirective, |
||||
NzCellFixedDirective, |
||||
NzTdAddOnComponent, |
||||
NzThSelectionComponent |
||||
], |
||||
templateUrl: './discount-pk-edit.component.html', |
||||
styleUrl: './discount-pk-edit.component.less' |
||||
}) |
||||
export class DiscountPkEditComponent { |
||||
BASE_URL = environment.baseUrl; |
||||
FILE_URL = environment.imageUrl; |
||||
listImgLoading = false; |
||||
listImgUrl?: string; |
||||
|
||||
contentFileList: NzUploadFile[] = []; |
||||
form: FormGroup; |
||||
|
||||
discountData: any = []; |
||||
checkedDiscountModal = false; |
||||
// 列表中全选状态
|
||||
checked = false; |
||||
// 已选择的数据
|
||||
setOfCheckedId = new Set<string>(); |
||||
// 选中的优惠券数据
|
||||
checkedDiscountData: any = []; |
||||
|
||||
constructor(private fb: NonNullableFormBuilder, |
||||
private merService: MerService, |
||||
private discountService: DiscountService, |
||||
private discountPkService: DiscountPkService, |
||||
private message: NzMessageService, |
||||
private activatedRoute: ActivatedRoute) { |
||||
// 初始化表单
|
||||
this.form = this.fb.group({ |
||||
discountPkNo: [null], |
||||
discountPkName: [null, [Validators.required]], |
||||
salePrice: [null, [Validators.required]], |
||||
describe: [null], |
||||
listImg: [null], |
||||
content: [null], |
||||
}); |
||||
// 查询优惠券数据
|
||||
this.queryDiscount(); |
||||
|
||||
this.activatedRoute.queryParams.subscribe(queryParams => { |
||||
// 接收到路由参数
|
||||
if (queryParams['discountPkNo'] != null) { |
||||
// 查询详情
|
||||
this.discountPkService.getDetail({discountPkNo: queryParams['discountPkNo']}, (data: any) => { |
||||
if (data['return_code'] == '000000') { |
||||
const discountData = data['return_data']; |
||||
discountData['discountType'] = String(discountData['discountType']); |
||||
discountData['useScope'] = String(discountData['useScope']).split(','); |
||||
this.form.patchValue(discountData); |
||||
} |
||||
}); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 查询优惠券列表 |
||||
*/ |
||||
queryDiscount() { |
||||
this.discountService.queryList({pageNum:1, pageSize:9999, status: 2}, (data: any) => { |
||||
if (data['return_code'] == '000000') { |
||||
this.discountData = data['return_data']['list']; |
||||
} |
||||
}); |
||||
} |
||||
|
||||
showCheckedModal() { |
||||
this.checkedDiscountModal = true; |
||||
} |
||||
|
||||
|
||||
closeCheckedModal() { |
||||
this.checkedDiscountModal = false; |
||||
} |
||||
/** |
||||
* 提交选择的优惠券 |
||||
*/ |
||||
submitCheckedDiscount() { |
||||
let array = []; |
||||
for (let discountNo of this.setOfCheckedId) { |
||||
let data = this.discountData.find((o: any) => o.discountNo == discountNo); |
||||
if (data != null) { |
||||
let checkedDiscount = this.checkedDiscountData.find((o: any) => o.discountNo == discountNo); |
||||
if (checkedDiscount == null) { |
||||
data['number'] = 1; |
||||
let s = { |
||||
discountNo: data.discountNo |
||||
} |
||||
array.push(data); |
||||
} |
||||
} |
||||
} |
||||
this.checkedDiscountData = array; |
||||
this.closeCheckedModal(); |
||||
} |
||||
/** |
||||
* 提交表单 |
||||
*/ |
||||
submitForm() { |
||||
if (this.form.controls['useScope'].value == null || this.form.controls['useScope'].value.length == 0) { |
||||
this.message.create('warning', '请选择使用范围'); |
||||
return; |
||||
} |
||||
if (this.form.valid) { |
||||
const param = this.form.value; |
||||
param['useScope'] = this.form.controls['useScope'].value.join(','); |
||||
param['endTime'] = new Date(this.form.controls['endTime'].value).getTime(); |
||||
this.discountPkService.edit(param, (data: any) => { |
||||
if (data['return_code'] == '000000') { |
||||
this.message.create('success', '操作成功'); |
||||
if (param['discountNo'] == null) { |
||||
// 清空表单
|
||||
this.form.reset(); |
||||
} |
||||
} else { |
||||
this.message.create('error', data['return_msg']); |
||||
} |
||||
}); |
||||
} else { |
||||
Object.values(this.form.controls).forEach(control => { |
||||
if (control.invalid) { |
||||
control.markAsDirty(); |
||||
control.updateValueAndValidity({ onlySelf: true }); |
||||
} |
||||
}); |
||||
} |
||||
} |
||||
|
||||
|
||||
private getBase64(img: File, callback: (img: string) => void): void { |
||||
const reader = new FileReader(); |
||||
reader.addEventListener('load', () => callback(reader.result!.toString())); |
||||
reader.readAsDataURL(img); |
||||
} |
||||
|
||||
handleChange(info: { file: NzUploadFile }): void { |
||||
switch (info.file.status) { |
||||
case 'uploading': |
||||
this.listImgLoading = true; |
||||
break; |
||||
case 'done': |
||||
// Get this url from response in real world.
|
||||
this.getBase64(info.file!.originFileObj!, (img: string) => { |
||||
this.listImgLoading = false; |
||||
this.listImgUrl = img; |
||||
}); |
||||
this.form.patchValue({ merLogo: info.file.response['return_data'][0]}); |
||||
break; |
||||
case 'error': |
||||
this.message.error('网络错误!'); |
||||
this.listImgLoading = false; |
||||
break; |
||||
} |
||||
} |
||||
|
||||
beforeUpload = (file: NzUploadFile, _fileList: NzUploadFile[]) => { |
||||
return new Observable((observer: Observer<boolean>) => { |
||||
const isJpgOrPng = file.type === 'image/jpeg' || file.type === 'image/png'; |
||||
if (!isJpgOrPng) { |
||||
this.message.error('只能上传JPG文件!'); |
||||
observer.complete(); |
||||
return; |
||||
} |
||||
const isLt2M = file.size! / 1024 / 1024 < 2; |
||||
if (!isLt2M) { |
||||
this.message.error('图片必须小于2MB!'); |
||||
observer.complete(); |
||||
return; |
||||
} |
||||
observer.next(isJpgOrPng && isLt2M); |
||||
observer.complete(); |
||||
}); |
||||
}; |
||||
|
||||
|
||||
updateCheckedSet(discountNo: string, checked: boolean): void { |
||||
if (checked) { |
||||
this.setOfCheckedId.add(discountNo); |
||||
} else { |
||||
this.setOfCheckedId.delete(discountNo); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 单选 |
||||
* @param merNo |
||||
* @param checked |
||||
*/ |
||||
onItemChecked(discountNo: string, checked: boolean): void { |
||||
this.updateCheckedSet(discountNo, checked); |
||||
this.refreshCheckedStatus(); |
||||
} |
||||
|
||||
/** |
||||
* 全选 |
||||
* @param checked |
||||
*/ |
||||
onAllChecked(checked: boolean): void { |
||||
// @ts-ignore
|
||||
this.discountData.forEach(({ discountNo }) => this.updateCheckedSet(discountNo, checked)); |
||||
this.refreshCheckedStatus(); |
||||
} |
||||
|
||||
/** |
||||
* 刷新数据 |
||||
*/ |
||||
refreshCheckedStatus(): void { |
||||
// @ts-ignore
|
||||
this.checked = this.discountData.every(({ discountNo }) => this.setOfCheckedId.has(discountNo)); |
||||
|
||||
console.log(this.setOfCheckedId); |
||||
} |
||||
|
||||
|
||||
|
||||
|
||||
} |
@ -0,0 +1 @@ |
||||
<p>discount-pk-list works!</p> |
@ -0,0 +1,12 @@ |
||||
import { Component } from '@angular/core'; |
||||
|
||||
@Component({ |
||||
selector: 'app-discount-pk-list', |
||||
standalone: true, |
||||
imports: [], |
||||
templateUrl: './discount-pk-list.component.html', |
||||
styleUrl: './discount-pk-list.component.less' |
||||
}) |
||||
export class DiscountPkListComponent { |
||||
|
||||
} |
@ -0,0 +1 @@ |
||||
<p>discount-pk-stock-code works!</p> |
@ -0,0 +1,12 @@ |
||||
import { Component } from '@angular/core'; |
||||
|
||||
@Component({ |
||||
selector: 'app-discount-pk-stock-code', |
||||
standalone: true, |
||||
imports: [], |
||||
templateUrl: './discount-pk-stock-code.component.html', |
||||
styleUrl: './discount-pk-stock-code.component.less' |
||||
}) |
||||
export class DiscountPkStockCodeComponent { |
||||
|
||||
} |
@ -0,0 +1 @@ |
||||
<p>discount-pk-stock works!</p> |
@ -0,0 +1,12 @@ |
||||
import { Component } from '@angular/core'; |
||||
|
||||
@Component({ |
||||
selector: 'app-discount-pk-stock', |
||||
standalone: true, |
||||
imports: [], |
||||
templateUrl: './discount-pk-stock.component.html', |
||||
styleUrl: './discount-pk-stock.component.less' |
||||
}) |
||||
export class DiscountPkStockComponent { |
||||
|
||||
} |
@ -0,0 +1,63 @@ |
||||
<form nz-form [formGroup]="form"> |
||||
<nz-form-item> |
||||
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>优惠券名称</nz-form-label> |
||||
<nz-form-control [nzSm]="14" [nzXs]="24"> |
||||
<input nz-input formControlName="discountName" placeholder="请输入" /> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
|
||||
<nz-form-item> |
||||
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>优惠券类型</nz-form-label> |
||||
<nz-form-control [nzSm]="14" [nzXs]="24"> |
||||
<nz-select formControlName="discountType" nzPlaceHolder="请选择"> |
||||
<nz-option *ngFor="let item of discountTypeArray" nzLabel="{{item.codeName}}" nzValue="{{item.codeValue}}"></nz-option> |
||||
</nz-select> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
|
||||
<nz-form-item *ngIf="form.controls['discountType'].value == 1"> |
||||
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>优惠条件</nz-form-label> |
||||
<nz-form-control [nzSm]="14" [nzXs]="24"> |
||||
<nz-input-number-group nzAddOnAfter="元"> |
||||
<nz-input-number formControlName="discountCondition" [nzPrecision]="2" [nzPlaceHolder]="'请输入'"></nz-input-number> |
||||
</nz-input-number-group> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
|
||||
<nz-form-item> |
||||
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>优惠金额</nz-form-label> |
||||
<nz-form-control [nzSm]="14" [nzXs]="24"> |
||||
<nz-input-number-group nzAddOnAfter="{{form.controls['discountType'].value != 3?'元':'%'}}"> |
||||
<nz-input-number formControlName="discountPrice" [nzPrecision]="2" [nzPlaceHolder]="'请输入'"></nz-input-number> |
||||
</nz-input-number-group> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
|
||||
<nz-form-item> |
||||
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>使用范围</nz-form-label> |
||||
<nz-form-control [nzSm]="14" [nzXs]="24"> |
||||
<nz-select nzMode="multiple" formControlName="useScope" [nzPlaceHolder]="'请选择使用范围,可以多选'"> |
||||
<nz-option *ngFor="let item of discountUseScopeArray" [nzLabel]="item.codeName" [nzValue]="item.codeValue"></nz-option> |
||||
</nz-select> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
|
||||
<nz-form-item> |
||||
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>领取有效天数</nz-form-label> |
||||
<nz-form-control [nzSm]="14" [nzXs]="24"> |
||||
<nz-input-number formControlName="receiveExpirationDate" [nzPrecision]="0" [nzPlaceHolder]="'请输入'"></nz-input-number> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
|
||||
<nz-form-item> |
||||
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>结束时间</nz-form-label> |
||||
<nz-form-control [nzSm]="14" [nzXs]="24"> |
||||
<nz-date-picker formControlName="endTime" nzShowTime nzFormat="yyyy-MM-dd HH:mm:ss" [nzPlaceHolder]="'请选择'"></nz-date-picker> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
|
||||
<div nz-flex [nzJustify]="'center'"> |
||||
<button nz-button nzType="primary" class="submit-btn" (click)="submitForm()">保存</button> |
||||
</div> |
||||
|
||||
</form> |
@ -0,0 +1,19 @@ |
||||
|
||||
.logo-uploader { |
||||
text-align: left; |
||||
} |
||||
.submit-btn { |
||||
width: 150px; |
||||
} |
||||
nz-input-number { |
||||
width: 100%; |
||||
} |
||||
nz-input-number-group { |
||||
width: 100%; |
||||
} |
||||
[nz-form] { |
||||
max-width: 600px; |
||||
} |
||||
nz-date-picker { |
||||
width: 100%; |
||||
} |
@ -0,0 +1,141 @@ |
||||
import { Component } from '@angular/core'; |
||||
import {environment} from "../../../../environments/environment"; |
||||
import {FormGroup, FormsModule, NonNullableFormBuilder, ReactiveFormsModule, Validators} from "@angular/forms"; |
||||
import {DictionaryPipe} from "../../../pipes/common/dictionary.pipe"; |
||||
import {MerService} from "../../../services/merchant/mer.service"; |
||||
import {MerChainBrandService} from "../../../services/merchant/mer-chain-brand.service"; |
||||
import {RoleService} from "../../../services/role/role.service"; |
||||
import {NzMessageService} from "ng-zorro-antd/message"; |
||||
import {ActivatedRoute} from "@angular/router"; |
||||
import {HttpClient} from "@angular/common/http"; |
||||
import {NzUploadFile, NzUploadModule} from "ng-zorro-antd/upload"; |
||||
import {Observable, Observer} from "rxjs"; |
||||
import {NgForOf, NgIf} from "@angular/common"; |
||||
import {NzButtonComponent} from "ng-zorro-antd/button"; |
||||
import {NzColDirective} from "ng-zorro-antd/grid"; |
||||
import {NzFlexDirective} from "ng-zorro-antd/flex"; |
||||
import { |
||||
NzFormControlComponent, |
||||
NzFormDirective, |
||||
NzFormItemComponent, |
||||
NzFormLabelComponent, |
||||
NzFormModule |
||||
} from "ng-zorro-antd/form"; |
||||
import {NzInputDirective, NzInputGroupComponent} from "ng-zorro-antd/input"; |
||||
import {NzOptionComponent, NzSelectComponent} from "ng-zorro-antd/select"; |
||||
import {NzModalModule} from "ng-zorro-antd/modal"; |
||||
import {NzIconDirective} from "ng-zorro-antd/icon"; |
||||
import {NzInputNumberComponent, NzInputNumberGroupComponent} from "ng-zorro-antd/input-number"; |
||||
import {NzCascaderModule} from "ng-zorro-antd/cascader"; |
||||
import {NzTabsModule} from "ng-zorro-antd/tabs"; |
||||
import {DiscountService} from "../../../services/discount/discount.service"; |
||||
import {NzCheckboxModule} from "ng-zorro-antd/checkbox"; |
||||
import {NzDatePickerModule} from "ng-zorro-antd/date-picker"; |
||||
|
||||
@Component({ |
||||
selector: 'app-discount-edit', |
||||
standalone: true, |
||||
imports: [ |
||||
FormsModule, |
||||
NgForOf, |
||||
NzButtonComponent, |
||||
NzColDirective, |
||||
NzFlexDirective, |
||||
NzFormControlComponent, |
||||
NzFormDirective, |
||||
ReactiveFormsModule, |
||||
NzFormItemComponent, |
||||
NzFormLabelComponent, |
||||
NzInputDirective, |
||||
NzSelectComponent, |
||||
NzOptionComponent, |
||||
NzModalModule, |
||||
NzFormModule, |
||||
NzUploadModule, |
||||
NzIconDirective, |
||||
NgIf, |
||||
NzInputGroupComponent, |
||||
NzInputNumberComponent, |
||||
NzCascaderModule, |
||||
NzTabsModule, |
||||
NzCheckboxModule, |
||||
NzDatePickerModule, |
||||
NzInputNumberGroupComponent |
||||
], |
||||
templateUrl: './discount-edit.component.html', |
||||
styleUrl: './discount-edit.component.less' |
||||
}) |
||||
export class DiscountEditComponent { |
||||
form: FormGroup; |
||||
// 优惠券类型
|
||||
discountTypeArray = new DictionaryPipe().getDictionaryList('DISCOUNT_TYPE'); |
||||
// 优惠券使用范围
|
||||
discountUseScopeArray = new DictionaryPipe().getDictionaryList('DISCOUNT_USE_SCOPE'); |
||||
|
||||
constructor(private fb: NonNullableFormBuilder, |
||||
private merService: MerService, |
||||
private discountService: DiscountService, |
||||
private message: NzMessageService, |
||||
private activatedRoute: ActivatedRoute) { |
||||
// 初始化表单
|
||||
this.form = this.fb.group({ |
||||
discountNo: [null], |
||||
discountName: [null, [Validators.required]], |
||||
discountType: [null, [Validators.required]], |
||||
discountPrice: [null, [Validators.required]], |
||||
discountCondition: [null], |
||||
useScope: [null], |
||||
receiveExpirationDate: [null, [Validators.required]], |
||||
endTime: [null, [Validators.required]], |
||||
}); |
||||
|
||||
this.activatedRoute.queryParams.subscribe(queryParams => { |
||||
// 接收到路由参数
|
||||
if (queryParams['discountNo'] != null) { |
||||
// 查询详情
|
||||
this.discountService.queryDetail({discountNo: queryParams['discountNo']}, (data: any) => { |
||||
if (data['return_code'] == '000000') { |
||||
const discountData = data['return_data']; |
||||
discountData['discountType'] = String(discountData['discountType']); |
||||
discountData['useScope'] = String(discountData['useScope']).split(','); |
||||
this.form.patchValue(discountData); |
||||
} |
||||
}); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 提交表单 |
||||
*/ |
||||
submitForm() { |
||||
if (this.form.controls['useScope'].value == null || this.form.controls['useScope'].value.length == 0) { |
||||
this.message.create('warning', '请选择使用范围'); |
||||
return; |
||||
} |
||||
if (this.form.valid) { |
||||
const param = this.form.value; |
||||
param['useScope'] = this.form.controls['useScope'].value.join(','); |
||||
param['endTime'] = new Date(this.form.controls['endTime'].value).getTime(); |
||||
this.discountService.editDiscount(param, (data: any) => { |
||||
if (data['return_code'] == '000000') { |
||||
this.message.create('success', '操作成功'); |
||||
if (param['discountNo'] == null) { |
||||
// 清空表单
|
||||
this.form.reset(); |
||||
} |
||||
} else { |
||||
this.message.create('error', data['return_msg']); |
||||
} |
||||
}); |
||||
} else { |
||||
Object.values(this.form.controls).forEach(control => { |
||||
if (control.invalid) { |
||||
control.markAsDirty(); |
||||
control.updateValueAndValidity({ onlySelf: true }); |
||||
} |
||||
}); |
||||
} |
||||
} |
||||
|
||||
} |
@ -0,0 +1,280 @@ |
||||
<form nz-form [formGroup]="searchForm" class="search_form" [nzLayout]="'vertical'"> |
||||
<div nz-row [nzGutter]="24"> |
||||
<div nz-col [nzSpan]="6"> |
||||
<nz-form-item> |
||||
<nz-form-label>优惠券编码</nz-form-label> |
||||
<nz-form-control> |
||||
<input nz-input formControlName="discountNo" placeholder="请输入" /> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
|
||||
<div nz-col [nzSpan]="6"> |
||||
<nz-form-item> |
||||
<nz-form-label>优惠券名称</nz-form-label> |
||||
<nz-form-control> |
||||
<input nz-input formControlName="discountName" placeholder="请输入" /> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
|
||||
<div nz-col [nzSpan]="6"> |
||||
<nz-form-item> |
||||
<nz-form-label>优惠券类型</nz-form-label> |
||||
<nz-form-control> |
||||
<nz-select formControlName="discountType" nzAllowClear [nzPlaceHolder]="'请选择'"> |
||||
<nz-option *ngFor="let item of discountTypeArray" nzValue="{{item.codeValue}}" nzLabel="{{item.codeName}}"></nz-option> |
||||
</nz-select> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
|
||||
<div nz-col [nzSpan]="6"> |
||||
<nz-form-item> |
||||
<nz-form-label>优惠券状态</nz-form-label> |
||||
<nz-form-control> |
||||
<nz-select formControlName="status" nzAllowClear [nzPlaceHolder]="'请选择'"> |
||||
<nz-option *ngFor="let item of discountStatusArray" nzValue="{{item.codeValue}}" nzLabel="{{item.codeName}}"></nz-option> |
||||
</nz-select> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
|
||||
<div nz-col [nzSpan]="6"> |
||||
<nz-form-item> |
||||
<nz-form-control> |
||||
<button nz-button style="margin-right: 8px" [nzType]="'primary'" (click)="searchFormSubmit()">查询</button> |
||||
<button nz-button style="margin-right: 8px" (click)="searchFormReset()">重置</button> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
</div> |
||||
</form> |
||||
<nz-table #basicTable |
||||
[nzScroll]="{ x: '1600px' }" |
||||
[nzBordered]="true" |
||||
[nzFrontPagination]="false" |
||||
[nzShowQuickJumper]="true" |
||||
[nzShowTotal]="totalTemplate" |
||||
[(nzPageIndex)]="tablePageNum" |
||||
(nzPageIndexChange)="queryData()" |
||||
nzShowSizeChanger |
||||
(nzPageSizeChange)="this.tablePageSize = $event;queryData()" |
||||
[nzPageSizeOptions]="[ 10, 20, 30, 50, 100 ]" |
||||
[nzTotal]="tableData.total" |
||||
[nzData]="tableData.list" > |
||||
<thead> |
||||
<tr> |
||||
<th nzWidth="70px">优惠券编码</th> |
||||
<th nzWidth="150px">优惠券名称</th> |
||||
<th nzWidth="70px">优惠类型</th> |
||||
<th nzWidth="70px">优惠券金额</th> |
||||
<th nzWidth="70px">优惠券条件</th> |
||||
<th nzWidth="100px">使用范围</th> |
||||
<th nzWidth="80px">领取有效期</th> |
||||
<th nzWidth="100px">结束时间</th> |
||||
<th nzWidth="80px">状态</th> |
||||
<th nzWidth="100px">创建时间</th> |
||||
<th nzRight nzWidth="105px">操作</th> |
||||
</tr> |
||||
</thead> |
||||
<tbody> |
||||
<tr *ngFor="let data of basicTable.data"> |
||||
<td>{{data.discountNo}}</td> |
||||
<td>{{data.discountName}}</td> |
||||
<td>{{data.discountType | dictionary: 'DISCOUNT_TYPE'}}</td> |
||||
<td>{{data.discountPrice}}</td> |
||||
<td>{{data.discountCondition}}</td> |
||||
<td>{{data.useScope}}</td> |
||||
<td>{{data.receiveExpirationDate}}天</td> |
||||
<td>{{data.endTime | date : 'yyyy-MM-dd HH:mm:ss'}}</td> |
||||
<td>{{data.status | dictionary : 'DISCOUNT_STATUS'}}</td> |
||||
<td>{{data.createTime | date : 'yyyy-MM-dd HH:mm'}}</td> |
||||
<td nzRight> |
||||
<button nz-button nzType="link" [routerLink]="['/admin/discount/edit']" [queryParams]="{ title: '修改优惠券', discountNo: data.discountNo}" [nzSize]="'small'" disabled="{{data.status!=1}}">修改</button> |
||||
<nz-divider nzType="vertical"></nz-divider> |
||||
<a nz-dropdown [nzDropdownMenu]="menu"> |
||||
操作列表 |
||||
<span nz-icon nzType="down"></span> |
||||
</a> |
||||
<nz-dropdown-menu #menu="nzDropdownMenu"> |
||||
<ul nz-menu nzSelectable> |
||||
<li nz-menu-item *ngIf="data.status == 2"><a (click)="showGiveUser(data)">赠送用户</a></li> |
||||
<li nz-menu-item *ngIf="data.status == 1"><a (click)="online(data.discountNo)">发布优惠券</a></li> |
||||
<li nz-menu-item *ngIf="data.createUserType == 1"><a (click)="showUsableMerModal(data.discountNo)">可用油站</a></li> |
||||
<li nz-menu-item *ngIf="data.status == 2"><a (click)="showStockModal(data.discountNo)">优惠券库存</a></li> |
||||
<li nz-menu-item *ngIf="data.status == 2"><a (click)="done(data.discountNo)">优惠券下线</a></li> |
||||
<li nz-menu-item *ngIf="data.status == 1"><a (click)="delData(data.discountNo)">删除优惠券</a></li> |
||||
</ul> |
||||
</nz-dropdown-menu> |
||||
</td> |
||||
</tr> |
||||
</tbody> |
||||
<ng-template #totalTemplate let-total>总计 {{ total }} 条</ng-template> |
||||
</nz-table> |
||||
|
||||
<nz-modal [(nzVisible)]="giveUserModal" [nzWidth]="500" nzTitle="赠送用户" [nzFooter]="null" (nzOnCancel)="closeGiveUser()"> |
||||
<ng-container *nzModalContent> |
||||
<form nz-form [formGroup]="giveUserForm"> |
||||
|
||||
<nz-form-item> |
||||
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>优惠券编码</nz-form-label> |
||||
<nz-form-control [nzSm]="14" [nzXs]="24"> |
||||
<input nz-input formControlName="discountNo" placeholder="请输入" /> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
|
||||
<nz-form-item> |
||||
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>优惠券名称</nz-form-label> |
||||
<nz-form-control [nzSm]="14" [nzXs]="24"> |
||||
<input nz-input formControlName="discountName" placeholder="请输入" /> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
|
||||
<nz-form-item> |
||||
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>用户手机号</nz-form-label> |
||||
<nz-form-control [nzSm]="14" [nzXs]="24"> |
||||
<input nz-input formControlName="userPhone" placeholder="请输入" /> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
|
||||
<nz-form-item> |
||||
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>赠送数量</nz-form-label> |
||||
<nz-form-control [nzSm]="14" [nzXs]="24"> |
||||
<nz-input-number formControlName="number" [nzMin]="1" [nzPrecision]="0" [nzPlaceHolder]="'请输入'"></nz-input-number> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
|
||||
<div nz-flex style="margin-top: 15px" [nzJustify]="'center'"> |
||||
<button nz-button nzType="primary" (click)="submitGiveUserConfirm()" class="submit-btn">确定</button> |
||||
</div> |
||||
</form> |
||||
</ng-container> |
||||
</nz-modal> |
||||
|
||||
<nz-modal [(nzVisible)]="usableMerModal" [nzWidth]="1000" nzTitle="优惠券可用油站" [nzFooter]="null" (nzOnCancel)="closeUsableMerModal()"> |
||||
<ng-container *nzModalContent> |
||||
<button nz-button style="margin-bottom: 8px" [nzType]="'primary'" (click)="showAssignMer()">配置油站</button> |
||||
<nz-table #basicTable |
||||
[nzScroll]="{ x: '900px' }" |
||||
[nzBordered]="true" |
||||
[nzFrontPagination]="true" |
||||
[nzShowQuickJumper]="true" |
||||
[nzShowTotal]="totalTemplate" |
||||
[(nzPageIndex)]="tablePageNum" |
||||
nzShowSizeChanger |
||||
[nzPageSizeOptions]="[ 10, 20, 30, 50, 100 ]" |
||||
[nzTotal]="assignMerData.length" |
||||
[nzData]="assignMerData" > |
||||
<thead> |
||||
<tr> |
||||
<th nzWidth="70px">油站编号</th> |
||||
<th nzWidth="70px">油站名称</th> |
||||
<th nzWidth="70px">油站地区</th> |
||||
<th nzWidth="70px">分配时间</th> |
||||
</tr> |
||||
</thead> |
||||
<tbody> |
||||
<tr *ngFor="let data of basicTable.data"> |
||||
<td>{{data.merNo}}</td> |
||||
<td>{{data.merName}}</td> |
||||
<td>{{data.provinceName +'/'+data.cityName+'/'+data.areaName}}</td> |
||||
<td>{{data.createTime | date : 'yyyy-MM-dd HH:mm'}}</td> |
||||
</tr> |
||||
</tbody> |
||||
<ng-template #totalTemplate let-total>总计 {{ total }} 条</ng-template> |
||||
</nz-table> |
||||
</ng-container> |
||||
</nz-modal> |
||||
|
||||
<nz-modal [(nzVisible)]="assignMerModal" [nzWidth]="1100" nzTitle="配置可用油站" [nzFooter]="null" (nzOnCancel)="closeAssignMer()"> |
||||
<ng-container *nzModalContent> |
||||
<form nz-form [formGroup]="assignSearchForm" class="search_form" [nzLayout]="'vertical'"> |
||||
<div nz-row [nzGutter]="24"> |
||||
<div nz-col [nzSpan]="6"> |
||||
<nz-form-item> |
||||
<nz-form-label>所在省级</nz-form-label> |
||||
<nz-form-control> |
||||
<nz-select formControlName="provinceCode" nzAllowClear [nzPlaceHolder]="'请选择'" nzShowSearch> |
||||
<nz-option *ngFor="let item of regionData" nzValue="{{item.regionId}}" nzLabel="{{item.regionName}}"></nz-option> |
||||
</nz-select> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
<div nz-col [nzSpan]="6"> |
||||
<nz-form-item> |
||||
<nz-form-label>来源渠道</nz-form-label> |
||||
<nz-form-control> |
||||
<nz-select formControlName="sourceType" nzAllowClear [nzPlaceHolder]="'请选择'"> |
||||
<nz-option *ngFor="let item of merSourceTypeArray" nzValue="{{item.codeValue}}" nzLabel="{{item.codeName}}"></nz-option> |
||||
</nz-select> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
<div nz-col [nzSpan]="6"> |
||||
<nz-form-item> |
||||
<nz-form-label>油站编号</nz-form-label> |
||||
<nz-form-control> |
||||
<input nz-input formControlName="merNo" placeholder="请输入" /> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
<div nz-col [nzSpan]="6"> |
||||
<nz-form-item> |
||||
<nz-form-label>油站名称</nz-form-label> |
||||
<nz-form-control> |
||||
<input nz-input formControlName="merName" placeholder="请输入" /> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
<div nz-col [nzSpan]="24" class="search-area"> |
||||
<button nz-button [nzType]="'primary'" (click)="queryMer()">查询</button> |
||||
<span nz-typography>已选择 {{setOfCheckedId.size}} 家油站</span> |
||||
<button nz-button [nzType]="'primary'" (click)="submitAssignMer()">分配油站</button> |
||||
</div> |
||||
</div> |
||||
</form> |
||||
|
||||
<nz-table #assignTable |
||||
[nzScroll]="{ x: '1200px' }" |
||||
[nzBordered]="true" |
||||
[nzFrontPagination]="false" |
||||
[nzShowQuickJumper]="true" |
||||
[nzShowTotal]="totalTemplate" |
||||
[(nzPageIndex)]="assignTablePageNum" |
||||
(nzPageIndexChange)="queryMer()" |
||||
nzShowSizeChanger |
||||
(nzPageSizeChange)="this.assignTablePageSize = $event;queryMer()" |
||||
[nzPageSizeOptions]="[ 10, 20, 30, 50, 100 ]" |
||||
[nzTotal]="assignTableData.total" |
||||
[nzData]="assignTableData.list" > |
||||
<thead> |
||||
<tr> |
||||
<th nzWidth="50px" [nzChecked]="checked" (nzCheckedChange)="onAllChecked($event)"></th> |
||||
<th nzWidth="120px">来源渠道</th> |
||||
<th nzWidth="100px">连锁名称</th> |
||||
<th nzWidth="110px">油站编号</th> |
||||
<th nzWidth="230px">油站名称</th> |
||||
<th nzWidth="180px">油站地区</th> |
||||
</tr> |
||||
</thead> |
||||
<tbody> |
||||
<tr *ngFor="let data of assignTable.data"> |
||||
<td [nzChecked]="setOfCheckedId.has(data.merNo)" (nzCheckedChange)="onItemChecked(data.merNo, $event)" ></td> |
||||
<td>{{data.sourceType | dictionary: "MER_SOURCE_TYPE"}}</td> |
||||
<td>{{data.chainBrandName?data.chainBrandName:'无'}}</td> |
||||
<td>{{data.merNo}}</td> |
||||
<td>{{data.merName}}</td> |
||||
<td>{{data.provinceName+"/"+data.cityName+"/"+data.areaName}}</td> |
||||
</tr> |
||||
</tbody> |
||||
<ng-template #totalTemplate let-total>总计 {{ total }} 条</ng-template> |
||||
</nz-table> |
||||
</ng-container> |
||||
</nz-modal> |
||||
|
||||
<nz-modal [(nzVisible)]="stockModal" [nzWidth]="1100" nzTitle="优惠券库存" [nzFooter]="null" (nzOnCancel)="closeStockModal()"> |
||||
<ng-container *nzModalContent> |
||||
<app-discount-stock [discountNo]="discountNo"></app-discount-stock> |
||||
</ng-container> |
||||
</nz-modal> |
@ -0,0 +1,21 @@ |
||||
nz-input-number { |
||||
width: 100%; |
||||
} |
||||
.submit-btn { |
||||
width: 150px; |
||||
} |
||||
.search-area { |
||||
margin-bottom: 10px; |
||||
} |
||||
.search-area button { |
||||
margin-right: 8px; |
||||
} |
||||
nz-input-number { |
||||
width: 100%; |
||||
} |
||||
.submit-btn { |
||||
width: 150px; |
||||
} |
||||
.send-request { |
||||
margin-bottom: 16px; |
||||
} |
@ -0,0 +1,446 @@ |
||||
import { Component } from '@angular/core'; |
||||
import {FormGroup, FormsModule, NonNullableFormBuilder, ReactiveFormsModule, Validators} from "@angular/forms"; |
||||
import {DictionaryPipe} from "../../../pipes/common/dictionary.pipe"; |
||||
import {NzMessageService} from "ng-zorro-antd/message"; |
||||
import {BrowserStorageService} from "../../../utils/localStorage.service"; |
||||
import {NzModalModule, NzModalService} from "ng-zorro-antd/modal"; |
||||
import {DATA} from "../../../data/login/localStorage.namespace"; |
||||
import {DatePipe, NgForOf, NgIf} from "@angular/common"; |
||||
import {NzButtonComponent} from "ng-zorro-antd/button"; |
||||
import { |
||||
NzCellFixedDirective, |
||||
NzTableCellDirective, |
||||
NzTableComponent, NzTableModule, |
||||
NzTbodyComponent, NzTheadComponent, |
||||
NzThMeasureDirective, NzTrDirective |
||||
} from "ng-zorro-antd/table"; |
||||
import {NzColDirective, NzRowDirective} from "ng-zorro-antd/grid"; |
||||
import {NzDividerComponent} from "ng-zorro-antd/divider"; |
||||
import {NzDropDownADirective, NzDropDownDirective, NzDropdownMenuComponent} from "ng-zorro-antd/dropdown"; |
||||
import {NzFormControlComponent, NzFormDirective, NzFormItemComponent, NzFormLabelComponent} from "ng-zorro-antd/form"; |
||||
import {NzIconDirective} from "ng-zorro-antd/icon"; |
||||
import {NzInputDirective} from "ng-zorro-antd/input"; |
||||
import {NzMenuDirective, NzMenuItemComponent} from "ng-zorro-antd/menu"; |
||||
import {NzOptionComponent, NzSelectComponent} from "ng-zorro-antd/select"; |
||||
import {NzFlexDirective} from "ng-zorro-antd/flex"; |
||||
import {NzDescriptionsModule} from "ng-zorro-antd/descriptions"; |
||||
import {NzUploadComponent} from "ng-zorro-antd/upload"; |
||||
import {NzAvatarModule} from "ng-zorro-antd/avatar"; |
||||
import {NzImageModule} from "ng-zorro-antd/image"; |
||||
import {NzSwitchComponent} from "ng-zorro-antd/switch"; |
||||
import {NzDatePickerComponent} from "ng-zorro-antd/date-picker"; |
||||
import {NzInputNumberModule} from "ng-zorro-antd/input-number"; |
||||
import {DiscountService} from "../../../services/discount/discount.service"; |
||||
import {RouterLink} from "@angular/router"; |
||||
import {NzTypographyComponent} from "ng-zorro-antd/typography"; |
||||
import {MerService} from "../../../services/merchant/mer.service"; |
||||
import {CommonService} from "../../../services/common/common.service"; |
||||
import {DiscountStockComponent} from "../discount-stock/discount-stock.component"; |
||||
|
||||
@Component({ |
||||
selector: 'app-discount-list', |
||||
standalone: true, |
||||
imports: [ |
||||
DatePipe, |
||||
DictionaryPipe, |
||||
FormsModule, |
||||
NgForOf, |
||||
NgIf, |
||||
NzButtonComponent, |
||||
NzCellFixedDirective, |
||||
NzColDirective, |
||||
NzDividerComponent, |
||||
NzDropDownADirective, |
||||
NzDropDownDirective, |
||||
NzDropdownMenuComponent, |
||||
NzFormControlComponent, |
||||
NzFormDirective, |
||||
NzFormItemComponent, |
||||
NzFormLabelComponent, |
||||
NzIconDirective, |
||||
NzInputDirective, |
||||
NzMenuDirective, |
||||
NzMenuItemComponent, |
||||
NzOptionComponent, |
||||
NzRowDirective, |
||||
NzSelectComponent, |
||||
NzTableCellDirective, |
||||
NzTableComponent, |
||||
NzTbodyComponent, |
||||
NzThMeasureDirective, |
||||
NzTheadComponent, |
||||
NzTrDirective, |
||||
ReactiveFormsModule, |
||||
NzTableModule, |
||||
NzModalModule, |
||||
NzFlexDirective, |
||||
NzDescriptionsModule, |
||||
NzUploadComponent, |
||||
NzAvatarModule, |
||||
NzImageModule, |
||||
NzSwitchComponent, |
||||
NzDatePickerComponent, |
||||
NzInputNumberModule, |
||||
RouterLink, |
||||
NzTypographyComponent, |
||||
DiscountStockComponent |
||||
], |
||||
templateUrl: './discount-list.component.html', |
||||
styleUrl: './discount-list.component.less' |
||||
}) |
||||
export class DiscountListComponent { |
||||
// 表单页数
|
||||
tablePageNum = 1; |
||||
// 每页数量
|
||||
tablePageSize = 10; |
||||
// 表单数据
|
||||
tableData: any = { |
||||
total: 0, |
||||
list: [], |
||||
}; |
||||
accountType = null; |
||||
// 搜索表单
|
||||
searchForm: FormGroup; |
||||
// 优惠券类型
|
||||
discountTypeArray = new DictionaryPipe().getDictionaryList('DISCOUNT_TYPE'); |
||||
// 优惠券状态
|
||||
discountStatusArray = new DictionaryPipe().getDictionaryList('DISCOUNT_STATUS'); |
||||
// 油站来源
|
||||
merSourceTypeArray = new DictionaryPipe().getDictionaryList('MER_SOURCE_TYPE'); |
||||
// 赠送用户模态框
|
||||
giveUserModal = false; |
||||
giveUserForm: FormGroup; |
||||
|
||||
regionData: any = [] |
||||
// 可用油站
|
||||
usableMerModal = false; |
||||
discountNo: any = null; |
||||
// 分配油站模态框
|
||||
assignMerModal = false; |
||||
assignMerData: any = []; |
||||
assignSearchForm: FormGroup; |
||||
// 表单页数
|
||||
assignTablePageNum = 1; |
||||
// 每页数量
|
||||
assignTablePageSize = 10; |
||||
// 表单数据
|
||||
assignTableData: any = { |
||||
total: 0, |
||||
list: [], |
||||
}; |
||||
// 列表中全选状态
|
||||
checked = false; |
||||
// 已选择的数据
|
||||
setOfCheckedId = new Set<string>(); |
||||
|
||||
// 库存模态框
|
||||
stockModal = false; |
||||
constructor(private fb: NonNullableFormBuilder, |
||||
private message: NzMessageService, |
||||
private storage: BrowserStorageService, |
||||
private discountService: DiscountService, |
||||
private commonService: CommonService, |
||||
private merService: MerService, |
||||
private modal: NzModalService) { |
||||
this.accountType = this.storage.get(DATA)['account']['objectType']; |
||||
// 获取地区
|
||||
this.commonService.getRegion("", (data: any) => { |
||||
this.regionData = data['return_data']; |
||||
}); |
||||
|
||||
// 初始化搜索框
|
||||
this.searchForm = this.fb.group({ |
||||
discountNo: [''], |
||||
discountName: [''], |
||||
discountType: [''], |
||||
status: [''], |
||||
}); |
||||
// 初始化搜索框
|
||||
this.assignSearchForm = this.fb.group({ |
||||
sourceType: [''], |
||||
provinceCode: [''], |
||||
merNo: [''], |
||||
merName: [''], |
||||
status: [''], |
||||
}); |
||||
|
||||
this.giveUserForm = this.fb.group({ |
||||
discountNo: [''], |
||||
discountName: [''], |
||||
userPhone: [null, [Validators.required]], |
||||
number: [1, [Validators.required]] |
||||
}); |
||||
// 查询数据
|
||||
this.queryData(); |
||||
} |
||||
|
||||
/** |
||||
* 获取数据 |
||||
*/ |
||||
queryData() { |
||||
this.searchForm.value.pageNum = this.tablePageNum; |
||||
this.searchForm.value.pageSize = this.tablePageSize; |
||||
this.searchForm.value.time = new Date().getTime(); |
||||
this.discountService.queryList(this.searchForm.value, (data: any) => { |
||||
if (data['return_code'] == '000000') { |
||||
this.tableData = data['return_data']; |
||||
} |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 搜索表单提交 |
||||
*/ |
||||
searchFormSubmit(): void { |
||||
this.tablePageNum = 1; |
||||
this.queryData(); |
||||
} |
||||
|
||||
/** |
||||
* 搜索表单重置 |
||||
*/ |
||||
searchFormReset(): void { |
||||
this.searchForm.reset(); |
||||
} |
||||
|
||||
/** |
||||
* 上线 |
||||
* @param deviceId |
||||
*/ |
||||
online(discountNo: number) { |
||||
this.modal.confirm({ |
||||
nzTitle: '提示', |
||||
nzContent: '确定发布优惠券吗?', |
||||
nzOnOk: () => |
||||
this.discountService.online({discountNo: discountNo}, (data: any) => { |
||||
if (data['return_code'] == '000000') { |
||||
// 刷新数据
|
||||
this.queryData(); |
||||
this.message.create('success', '操作成功'); |
||||
} else { |
||||
this.message.create('error', data['return_msg']); |
||||
} |
||||
}) |
||||
}); |
||||
} |
||||
/** |
||||
* 下线优惠券 |
||||
* @param deviceId |
||||
*/ |
||||
done(discountNo: number) { |
||||
this.modal.confirm({ |
||||
nzTitle: '提示', |
||||
nzContent: '确定优惠券下线吗?', |
||||
nzOnOk: () => |
||||
this.discountService.done({discountNo: discountNo}, (data: any) => { |
||||
if (data['return_code'] == '000000') { |
||||
// 刷新数据
|
||||
this.queryData(); |
||||
this.message.create('success', '操作成功'); |
||||
} else { |
||||
this.message.create('error', data['return_msg']); |
||||
} |
||||
}) |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 删除 |
||||
* @param deviceId |
||||
*/ |
||||
delData(discountNo: number) { |
||||
this.modal.confirm({ |
||||
nzTitle: '提示', |
||||
nzContent: '确定删除吗?', |
||||
nzOnOk: () => |
||||
this.discountService.delete({discountNo: discountNo}, (data: any) => { |
||||
if (data['return_code'] == '000000') { |
||||
// 刷新数据
|
||||
this.queryData(); |
||||
this.message.create('success', '操作成功'); |
||||
} else { |
||||
this.message.create('error', data['return_msg']); |
||||
} |
||||
}) |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 打开赠送用户模态框 |
||||
* @param data |
||||
*/ |
||||
showGiveUser(data: any) { |
||||
this.giveUserForm.patchValue({discountNo: data.discountNo, discountName: data.discountName}); |
||||
this.giveUserForm.controls['discountNo'].disable(); |
||||
this.giveUserForm.controls['discountName'].disable(); |
||||
this.giveUserModal = true; |
||||
} |
||||
/** |
||||
* 赠送确认框 |
||||
*/ |
||||
submitGiveUserConfirm() { |
||||
this.modal.confirm({ |
||||
nzTitle: '提示', |
||||
nzContent: '确定赠送吗?', |
||||
nzOnOk: () => this.submitGiveUser() |
||||
}); |
||||
} |
||||
/** |
||||
* 提交赠送用户 |
||||
*/ |
||||
submitGiveUser() { |
||||
if (this.giveUserForm.valid) { |
||||
const param = this.giveUserForm.value; |
||||
param['discountNo'] = this.giveUserForm.controls['discountNo'].value; |
||||
this.discountService.giveUser(param, (data: any) => { |
||||
if (data['return_code'] == '000000') { |
||||
this.message.create('success', '操作成功'); |
||||
} else { |
||||
this.message.create('error', data['return_msg']); |
||||
} |
||||
}); |
||||
} else { |
||||
Object.values(this.giveUserForm.controls).forEach(control => { |
||||
if (control.invalid) { |
||||
control.markAsDirty(); |
||||
control.updateValueAndValidity({ onlySelf: true }); |
||||
} |
||||
}); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 关闭赠送用户模态框 |
||||
*/ |
||||
closeGiveUser() { |
||||
this.giveUserForm.reset(); |
||||
this.giveUserForm.controls['discountNo'].enable(); |
||||
this.giveUserForm.controls['discountName'].enable(); |
||||
this.giveUserModal = false; |
||||
} |
||||
|
||||
/** |
||||
* 打开可用油站 |
||||
*/ |
||||
showUsableMerModal(discountNo: any) { |
||||
// 清除已勾选数据
|
||||
this.setOfCheckedId.clear(); |
||||
|
||||
this.discountNo = discountNo; |
||||
this.discountService.getUseMerList({discountNo: discountNo}, (data: any) => { |
||||
if (data['return_code'] == '000000') { |
||||
// 刷新数据
|
||||
this.assignMerData = data['return_data']; |
||||
} else { |
||||
this.message.create('error', data['return_msg']); |
||||
} |
||||
}) |
||||
this.usableMerModal = true; |
||||
} |
||||
|
||||
/** |
||||
* 关闭可用油站 |
||||
*/ |
||||
closeUsableMerModal() { |
||||
this.usableMerModal = false; |
||||
} |
||||
|
||||
/** |
||||
* 打开分配油站 |
||||
* @param discountNo |
||||
*/ |
||||
showAssignMer() { |
||||
this.queryMer(); |
||||
this.assignMerModal = true; |
||||
} |
||||
|
||||
submitAssignMer() { |
||||
let param = { |
||||
discountNo: this.discountNo, |
||||
merNoList: Array.from(this.setOfCheckedId) |
||||
} |
||||
this.discountService.editUseMer(param, (data: any) => { |
||||
if (data['return_code'] == '000000') { |
||||
this.showUsableMerModal(this.discountNo); |
||||
this.closeAssignMer(); |
||||
} else { |
||||
this.message.create('error', data['return_msg']); |
||||
} |
||||
}) |
||||
} |
||||
/** |
||||
* 查询油站列表 |
||||
*/ |
||||
queryMer() { |
||||
this.assignSearchForm.value.pageNum = this.assignTablePageNum; |
||||
this.assignSearchForm.value.pageSize = this.assignTablePageSize; |
||||
this.merService.queryMerList(this.assignSearchForm.value, (data: any) => { |
||||
if (data['return_code'] == '000000') { |
||||
this.assignTableData = data['return_data']; |
||||
for (let item of this.assignMerData) { |
||||
this.updateCheckedSet(item.merNo, true); |
||||
} |
||||
this.refreshCheckedStatus(); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 关闭分配油站 |
||||
*/ |
||||
closeAssignMer() { |
||||
this.assignMerModal = false; |
||||
} |
||||
|
||||
updateCheckedSet(merNo: string, checked: boolean): void { |
||||
if (checked) { |
||||
this.setOfCheckedId.add(merNo); |
||||
} else { |
||||
this.setOfCheckedId.delete(merNo); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 单选 |
||||
* @param merNo |
||||
* @param checked |
||||
*/ |
||||
onItemChecked(merNo: string, checked: boolean): void { |
||||
this.updateCheckedSet(merNo, checked); |
||||
this.refreshCheckedStatus(); |
||||
} |
||||
|
||||
/** |
||||
* 全选 |
||||
* @param checked |
||||
*/ |
||||
onAllChecked(checked: boolean): void { |
||||
// @ts-ignore
|
||||
this.assignTableData.list.forEach(({ merNo }) => this.updateCheckedSet(merNo, checked)); |
||||
this.refreshCheckedStatus(); |
||||
} |
||||
|
||||
/** |
||||
* 刷新数据 |
||||
*/ |
||||
refreshCheckedStatus(): void { |
||||
// @ts-ignore
|
||||
this.checked = this.assignTableData.list.every(({ merNo }) => this.setOfCheckedId.has(merNo)); |
||||
} |
||||
|
||||
/** |
||||
* 打开库存模态框 |
||||
* @param discountNo |
||||
*/ |
||||
showStockModal(discountNo: any) { |
||||
this.discountNo = discountNo; |
||||
this.stockModal = true; |
||||
} |
||||
|
||||
/** |
||||
* 关闭库存模态框 |
||||
*/ |
||||
closeStockModal() { |
||||
this.stockModal = false; |
||||
} |
||||
} |
@ -0,0 +1,86 @@ |
||||
<form nz-form [formGroup]="searchForm" class="search_form" [nzLayout]="'vertical'"> |
||||
<div nz-row [nzGutter]="24"> |
||||
<div nz-col [nzSpan]="6"> |
||||
<nz-form-item> |
||||
<nz-form-label>codeId</nz-form-label> |
||||
<nz-form-control> |
||||
<input nz-input formControlName="codeId" placeholder="请输入" /> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
|
||||
<div nz-col [nzSpan]="6"> |
||||
<nz-form-item> |
||||
<nz-form-label>用户手机号</nz-form-label> |
||||
<nz-form-control> |
||||
<input nz-input formControlName="userPhone" placeholder="请输入" /> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
|
||||
<div nz-col [nzSpan]="6"> |
||||
<nz-form-item> |
||||
<nz-form-label>状态</nz-form-label> |
||||
<nz-form-control> |
||||
<nz-select formControlName="status" nzAllowClear [nzPlaceHolder]="'请选择'"> |
||||
<nz-option *ngFor="let item of discountStockCodeStatusArray" nzValue="{{item.codeValue}}" nzLabel="{{item.codeName}}"></nz-option> |
||||
</nz-select> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
|
||||
<div nz-col [nzSpan]="6"> |
||||
<nz-form-item> |
||||
<nz-form-label></nz-form-label> |
||||
<nz-form-control> |
||||
<button nz-button style="margin-right: 8px" [nzType]="'primary'" (click)="searchFormSubmit()">查询</button> |
||||
<button nz-button style="margin-right: 8px" (click)="searchFormReset()">重置</button> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
</div> |
||||
</form> |
||||
|
||||
<nz-table #basicTable |
||||
[nzScroll]="{ x: '800px' }" |
||||
[nzSize]="'small'" |
||||
[nzBordered]="true" |
||||
[nzFrontPagination]="false" |
||||
[nzShowQuickJumper]="true" |
||||
[nzShowTotal]="totalTemplate" |
||||
[(nzPageIndex)]="tablePageNum" |
||||
(nzPageIndexChange)="queryData()" |
||||
nzShowSizeChanger |
||||
(nzPageSizeChange)="this.tablePageSize = $event;queryData()" |
||||
[nzPageSizeOptions]="[ 10, 20, 30, 50, 100 ]" |
||||
[nzTotal]="tableData.total" |
||||
[nzData]="tableData.list" > |
||||
<thead> |
||||
<tr> |
||||
<th nzWidth="40px">codeId</th> |
||||
<th nzWidth="50px">领取手机号</th> |
||||
<th nzWidth="40px">领取方式</th> |
||||
<th nzWidth="40px">领取时间</th> |
||||
<th nzWidth="40px">状态</th> |
||||
<th nzWidth="40px">创建时间</th> |
||||
</tr> |
||||
</thead> |
||||
<tbody> |
||||
<tr *ngFor="let data of basicTable.data"> |
||||
<td>{{data.id}}</td> |
||||
<td>{{data.receiveMerUserPhone}}</td> |
||||
<td> |
||||
<span *ngIf="data.obtainType == 1">加油</span> |
||||
<span *ngIf="data.obtainType == 2">商城</span> |
||||
<span *ngIf="data.obtainType == 3">赠送</span> |
||||
<span *ngIf="data.obtainType == 4">API</span> |
||||
</td> |
||||
<td> |
||||
<span *ngIf="data.obtainTime != null">{{data.obtainTime | date : 'yyyy-MM-dd HH:mm'}}</span> |
||||
</td> |
||||
<td>{{data.status | dictionary: 'DISCOUNT_STOCK_CODE_STATUS'}}</td> |
||||
<td>{{data.createTime | date : 'yyyy-MM-dd HH:mm'}}</td> |
||||
</tr> |
||||
</tbody> |
||||
<ng-template #totalTemplate let-total>总计 {{ total }} 条</ng-template> |
||||
</nz-table> |
@ -0,0 +1,154 @@ |
||||
import {Component, Input, OnInit} from '@angular/core'; |
||||
import {DatePipe, NgForOf, NgIf} from "@angular/common"; |
||||
import {NzButtonComponent} from "ng-zorro-antd/button"; |
||||
import { |
||||
NzCellFixedDirective, |
||||
NzTableCellDirective, |
||||
NzTableComponent, NzTableModule, |
||||
NzTbodyComponent, NzTheadComponent, |
||||
NzThMeasureDirective, NzTrDirective |
||||
} from "ng-zorro-antd/table"; |
||||
import {NzColDirective, NzRowDirective} from "ng-zorro-antd/grid"; |
||||
import {NzFlexDirective} from "ng-zorro-antd/flex"; |
||||
import {NzFormControlComponent, NzFormDirective, NzFormItemComponent, NzFormLabelComponent} from "ng-zorro-antd/form"; |
||||
import {NzInputDirective} from "ng-zorro-antd/input"; |
||||
import {NzInputNumberComponent, NzInputNumberModule} from "ng-zorro-antd/input-number"; |
||||
import {NzModalComponent, NzModalModule, NzModalService} from "ng-zorro-antd/modal"; |
||||
import {FormGroup, FormsModule, NonNullableFormBuilder, ReactiveFormsModule, Validators} from "@angular/forms"; |
||||
import {NzMessageService} from "ng-zorro-antd/message"; |
||||
import {BrowserStorageService} from "../../../utils/localStorage.service"; |
||||
import {DiscountStockService} from "../../../services/discount/discount-stock.service"; |
||||
import {CommonService} from "../../../services/common/common.service"; |
||||
import {MerService} from "../../../services/merchant/mer.service"; |
||||
import {DATA} from "../../../data/login/localStorage.namespace"; |
||||
import {DictionaryPipe} from "../../../pipes/common/dictionary.pipe"; |
||||
import {NzDividerComponent} from "ng-zorro-antd/divider"; |
||||
import {NzDropDownADirective, NzDropDownDirective, NzDropdownMenuComponent} from "ng-zorro-antd/dropdown"; |
||||
import {NzIconDirective} from "ng-zorro-antd/icon"; |
||||
import {NzMenuDirective, NzMenuItemComponent} from "ng-zorro-antd/menu"; |
||||
import {NzOptionComponent, NzSelectComponent} from "ng-zorro-antd/select"; |
||||
import {NzDescriptionsModule} from "ng-zorro-antd/descriptions"; |
||||
import {NzUploadComponent} from "ng-zorro-antd/upload"; |
||||
import {NzAvatarModule} from "ng-zorro-antd/avatar"; |
||||
import {NzImageModule} from "ng-zorro-antd/image"; |
||||
import {NzSwitchComponent} from "ng-zorro-antd/switch"; |
||||
import {NzDatePickerComponent} from "ng-zorro-antd/date-picker"; |
||||
import {RouterLink} from "@angular/router"; |
||||
import {NzTypographyComponent} from "ng-zorro-antd/typography"; |
||||
|
||||
@Component({ |
||||
selector: 'app-discount-stock-code', |
||||
standalone: true, |
||||
imports: [ |
||||
DatePipe, |
||||
DictionaryPipe, |
||||
FormsModule, |
||||
NgForOf, |
||||
NgIf, |
||||
NzButtonComponent, |
||||
NzCellFixedDirective, |
||||
NzColDirective, |
||||
NzDividerComponent, |
||||
NzDropDownADirective, |
||||
NzDropDownDirective, |
||||
NzDropdownMenuComponent, |
||||
NzFormControlComponent, |
||||
NzFormDirective, |
||||
NzFormItemComponent, |
||||
NzFormLabelComponent, |
||||
NzIconDirective, |
||||
NzInputDirective, |
||||
NzMenuDirective, |
||||
NzMenuItemComponent, |
||||
NzOptionComponent, |
||||
NzRowDirective, |
||||
NzSelectComponent, |
||||
NzTableCellDirective, |
||||
NzTableComponent, |
||||
NzTbodyComponent, |
||||
NzThMeasureDirective, |
||||
NzTheadComponent, |
||||
NzTrDirective, |
||||
ReactiveFormsModule, |
||||
NzTableModule, |
||||
NzModalModule, |
||||
NzFlexDirective, |
||||
NzDescriptionsModule, |
||||
NzUploadComponent, |
||||
NzAvatarModule, |
||||
NzImageModule, |
||||
NzSwitchComponent, |
||||
NzDatePickerComponent, |
||||
NzInputNumberModule, |
||||
RouterLink, |
||||
NzTypographyComponent |
||||
], |
||||
templateUrl: './discount-stock-code.component.html', |
||||
styleUrl: './discount-stock-code.component.less' |
||||
}) |
||||
export class DiscountStockCodeComponent implements OnInit { |
||||
@Input() batchNo: any; |
||||
// 表单页数
|
||||
tablePageNum = 1; |
||||
// 每页数量
|
||||
tablePageSize = 10; |
||||
// 表单数据
|
||||
tableData: any = { |
||||
total: 0, |
||||
list: [], |
||||
}; |
||||
accountType = null; |
||||
// 搜索表单
|
||||
searchForm: FormGroup; |
||||
// 优惠券库存code
|
||||
discountStockCodeStatusArray = new DictionaryPipe().getDictionaryList('DISCOUNT_STOCK_CODE_STATUS'); |
||||
constructor(private fb: NonNullableFormBuilder, |
||||
private message: NzMessageService, |
||||
private storage: BrowserStorageService, |
||||
private discountStockService: DiscountStockService, |
||||
private commonService: CommonService, |
||||
private merService: MerService, |
||||
private modal: NzModalService) { |
||||
this.accountType = this.storage.get(DATA)['account']['objectType']; |
||||
// 初始化搜索框
|
||||
this.searchForm = this.fb.group({ |
||||
codeId: [''], |
||||
userPhone: [''], |
||||
status: [''], |
||||
}); |
||||
} |
||||
|
||||
ngOnInit(): void { |
||||
// 查询数据
|
||||
this.queryData(); |
||||
} |
||||
|
||||
/** |
||||
* 获取数据 |
||||
*/ |
||||
queryData() { |
||||
this.searchForm.value.batchNo = this.batchNo; |
||||
this.searchForm.value.pageNum = this.tablePageNum; |
||||
this.searchForm.value.pageSize = this.tablePageSize; |
||||
this.discountStockService.queryStockBatchCodeList(this.searchForm.value, (data: any) => { |
||||
if (data['return_code'] == '000000') { |
||||
this.tableData = data['return_data']; |
||||
} |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 搜索表单提交 |
||||
*/ |
||||
searchFormSubmit(): void { |
||||
this.tablePageNum = 1; |
||||
this.queryData(); |
||||
} |
||||
|
||||
/** |
||||
* 搜索表单重置 |
||||
*/ |
||||
searchFormReset(): void { |
||||
this.searchForm.reset(); |
||||
} |
||||
} |
@ -0,0 +1,92 @@ |
||||
<form nz-form [formGroup]="searchForm" class="search_form" [nzLayout]="'vertical'"> |
||||
<div nz-row [nzGutter]="24"> |
||||
<div nz-col [nzSpan]="6"> |
||||
<nz-form-item> |
||||
<nz-form-label>批次编号</nz-form-label> |
||||
<nz-form-control> |
||||
<input nz-input formControlName="batchNo" placeholder="请输入" /> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
<div nz-col [nzSpan]="6"> |
||||
<nz-form-item> |
||||
<nz-form-label></nz-form-label> |
||||
<nz-form-control> |
||||
<button nz-button style="margin-right: 8px" [nzType]="'primary'" (click)="searchFormSubmit()">查询</button> |
||||
<button nz-button style="margin-right: 8px" (click)="searchFormReset()">重置</button> |
||||
<button nz-button style="margin-right: 8px" [nzType]="'primary'" (click)="showAddStock()">增加库存</button> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
</div> |
||||
</form> |
||||
<nz-table #basicTable |
||||
[nzScroll]="{ x: '800px' }" |
||||
[nzSize]="'small'" |
||||
[nzBordered]="true" |
||||
[nzFrontPagination]="false" |
||||
[nzShowQuickJumper]="true" |
||||
[nzShowTotal]="totalTemplate" |
||||
[(nzPageIndex)]="tablePageNum" |
||||
(nzPageIndexChange)="queryData()" |
||||
nzShowSizeChanger |
||||
(nzPageSizeChange)="this.tablePageSize = $event;queryData()" |
||||
[nzPageSizeOptions]="[ 10, 20, 30, 50, 100 ]" |
||||
[nzTotal]="tableData.total" |
||||
[nzData]="tableData.list" > |
||||
<thead> |
||||
<tr> |
||||
<th nzWidth="40px">批次编号</th> |
||||
<th nzWidth="50px">优惠券名称</th> |
||||
<th nzWidth="40px">批次数量</th> |
||||
<th nzWidth="40px">开始id</th> |
||||
<th nzWidth="40px">结束id</th> |
||||
<th nzWidth="40px">创建时间</th> |
||||
<th nzRight nzWidth="30px">code列表</th> |
||||
</tr> |
||||
</thead> |
||||
<tbody> |
||||
<tr *ngFor="let data of basicTable.data"> |
||||
<td>{{data.batchNo}}</td> |
||||
<td>{{data.discountName}}</td> |
||||
<td>{{data.batchStockNum}}</td> |
||||
<td>{{data.startId}}</td> |
||||
<td>{{data.endId}}</td> |
||||
<td>{{data.createTime | date : 'yyyy-MM-dd HH:mm'}}</td> |
||||
<td nzRight> |
||||
<button nz-button nzType="link" [nzSize]="'small'" (click)="showStockCode(data.batchNo)">查看</button> |
||||
</tr> |
||||
</tbody> |
||||
<ng-template #totalTemplate let-total>总计 {{ total }} 条</ng-template> |
||||
</nz-table> |
||||
|
||||
<nz-modal [(nzVisible)]="addStockModal" [nzWidth]="500" nzTitle="增加库存" [nzFooter]="null" (nzOnCancel)="closeAddStock()"> |
||||
<ng-container *nzModalContent> |
||||
<form nz-form [formGroup]="addStockForm"> |
||||
|
||||
<nz-form-item> |
||||
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>优惠券编码</nz-form-label> |
||||
<nz-form-control [nzSm]="14" [nzXs]="24"> |
||||
<input nz-input formControlName="discountNo" placeholder="请输入" /> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
|
||||
<nz-form-item> |
||||
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>库存数量</nz-form-label> |
||||
<nz-form-control [nzSm]="14" [nzXs]="24"> |
||||
<nz-input-number formControlName="stockCount" [nzMin]="1" [nzPrecision]="0" [nzPlaceHolder]="'请输入'"></nz-input-number> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
|
||||
<div nz-flex style="margin-top: 15px" [nzJustify]="'center'"> |
||||
<button nz-button nzType="primary" (click)="submitStock()" class="submit-btn">确定</button> |
||||
</div> |
||||
</form> |
||||
</ng-container> |
||||
</nz-modal> |
||||
|
||||
<nz-modal [(nzVisible)]="showCodeModal" [nzWidth]="1000" nzTitle="批次:{{batchNo}},code列表" [nzFooter]="null" (nzOnCancel)="closeStockCode()"> |
||||
<ng-container *nzModalContent> |
||||
<app-discount-stock-code [batchNo]="batchNo"></app-discount-stock-code> |
||||
</ng-container> |
||||
</nz-modal> |
@ -0,0 +1,21 @@ |
||||
nz-input-number { |
||||
width: 100%; |
||||
} |
||||
.submit-btn { |
||||
width: 150px; |
||||
} |
||||
.search-area { |
||||
margin-bottom: 10px; |
||||
} |
||||
.search-area button { |
||||
margin-right: 8px; |
||||
} |
||||
nz-input-number { |
||||
width: 100%; |
||||
} |
||||
.submit-btn { |
||||
width: 150px; |
||||
} |
||||
.send-request { |
||||
margin-bottom: 16px; |
||||
} |
@ -0,0 +1,227 @@ |
||||
import {Component, Input, OnInit, Output} from '@angular/core'; |
||||
import {FormGroup, FormsModule, NonNullableFormBuilder, ReactiveFormsModule, Validators} from "@angular/forms"; |
||||
import {DictionaryPipe} from "../../../pipes/common/dictionary.pipe"; |
||||
import {NzMessageService} from "ng-zorro-antd/message"; |
||||
import {BrowserStorageService} from "../../../utils/localStorage.service"; |
||||
import {DiscountService} from "../../../services/discount/discount.service"; |
||||
import {CommonService} from "../../../services/common/common.service"; |
||||
import {MerService} from "../../../services/merchant/mer.service"; |
||||
import {NzModalModule, NzModalService} from "ng-zorro-antd/modal"; |
||||
import {DATA} from "../../../data/login/localStorage.namespace"; |
||||
import {DatePipe, NgForOf, NgIf} from "@angular/common"; |
||||
import {NzButtonComponent} from "ng-zorro-antd/button"; |
||||
import { |
||||
NzCellFixedDirective, |
||||
NzTableCellDirective, |
||||
NzTableComponent, NzTableModule, |
||||
NzTbodyComponent, NzTheadComponent, |
||||
NzThMeasureDirective, NzTrDirective |
||||
} from "ng-zorro-antd/table"; |
||||
import {NzColDirective, NzRowDirective} from "ng-zorro-antd/grid"; |
||||
import {NzDividerComponent} from "ng-zorro-antd/divider"; |
||||
import {NzDropDownADirective, NzDropDownDirective, NzDropdownMenuComponent} from "ng-zorro-antd/dropdown"; |
||||
import {NzFormControlComponent, NzFormDirective, NzFormItemComponent, NzFormLabelComponent} from "ng-zorro-antd/form"; |
||||
import {NzIconDirective} from "ng-zorro-antd/icon"; |
||||
import {NzInputDirective} from "ng-zorro-antd/input"; |
||||
import {NzMenuDirective, NzMenuItemComponent} from "ng-zorro-antd/menu"; |
||||
import {NzOptionComponent, NzSelectComponent} from "ng-zorro-antd/select"; |
||||
import {NzFlexDirective} from "ng-zorro-antd/flex"; |
||||
import {NzDescriptionsModule} from "ng-zorro-antd/descriptions"; |
||||
import {NzUploadComponent} from "ng-zorro-antd/upload"; |
||||
import {NzAvatarModule} from "ng-zorro-antd/avatar"; |
||||
import {NzImageModule} from "ng-zorro-antd/image"; |
||||
import {NzSwitchComponent} from "ng-zorro-antd/switch"; |
||||
import {NzDatePickerComponent} from "ng-zorro-antd/date-picker"; |
||||
import {NzInputNumberModule} from "ng-zorro-antd/input-number"; |
||||
import {RouterLink} from "@angular/router"; |
||||
import {NzTypographyComponent} from "ng-zorro-antd/typography"; |
||||
import {DiscountStockService} from "../../../services/discount/discount-stock.service"; |
||||
import {DiscountStockCodeComponent} from "../discount-stock-code/discount-stock-code.component"; |
||||
|
||||
@Component({ |
||||
selector: 'app-discount-stock', |
||||
standalone: true, |
||||
imports: [ |
||||
DatePipe, |
||||
DictionaryPipe, |
||||
FormsModule, |
||||
NgForOf, |
||||
NgIf, |
||||
NzButtonComponent, |
||||
NzCellFixedDirective, |
||||
NzColDirective, |
||||
NzDividerComponent, |
||||
NzDropDownADirective, |
||||
NzDropDownDirective, |
||||
NzDropdownMenuComponent, |
||||
NzFormControlComponent, |
||||
NzFormDirective, |
||||
NzFormItemComponent, |
||||
NzFormLabelComponent, |
||||
NzIconDirective, |
||||
NzInputDirective, |
||||
NzMenuDirective, |
||||
NzMenuItemComponent, |
||||
NzOptionComponent, |
||||
NzRowDirective, |
||||
NzSelectComponent, |
||||
NzTableCellDirective, |
||||
NzTableComponent, |
||||
NzTbodyComponent, |
||||
NzThMeasureDirective, |
||||
NzTheadComponent, |
||||
NzTrDirective, |
||||
ReactiveFormsModule, |
||||
NzTableModule, |
||||
NzModalModule, |
||||
NzFlexDirective, |
||||
NzDescriptionsModule, |
||||
NzUploadComponent, |
||||
NzAvatarModule, |
||||
NzImageModule, |
||||
NzSwitchComponent, |
||||
NzDatePickerComponent, |
||||
NzInputNumberModule, |
||||
RouterLink, |
||||
NzTypographyComponent, |
||||
DiscountStockCodeComponent |
||||
], |
||||
templateUrl: './discount-stock.component.html', |
||||
styleUrl: './discount-stock.component.less' |
||||
}) |
||||
export class DiscountStockComponent implements OnInit{ |
||||
|
||||
@Input() discountNo: any; |
||||
// 表单页数
|
||||
tablePageNum = 1; |
||||
// 每页数量
|
||||
tablePageSize = 10; |
||||
// 表单数据
|
||||
tableData: any = { |
||||
total: 0, |
||||
list: [], |
||||
}; |
||||
accountType = null; |
||||
// 搜索表单
|
||||
searchForm: FormGroup; |
||||
// 库存
|
||||
addStockModal = false; |
||||
addStockForm: FormGroup; |
||||
|
||||
showCodeModal = false; |
||||
batchNo = null; |
||||
constructor(private fb: NonNullableFormBuilder, |
||||
private message: NzMessageService, |
||||
private storage: BrowserStorageService, |
||||
private discountStockService: DiscountStockService, |
||||
private commonService: CommonService, |
||||
private merService: MerService, |
||||
private modal: NzModalService) { |
||||
this.accountType = this.storage.get(DATA)['account']['objectType']; |
||||
// 初始化搜索框
|
||||
this.searchForm = this.fb.group({ |
||||
batchNo: [''], |
||||
}); |
||||
|
||||
// 初始化搜索框
|
||||
this.addStockForm = this.fb.group({ |
||||
discountNo: [''], |
||||
stockCount: ['', [Validators.required]], |
||||
}); |
||||
} |
||||
|
||||
ngOnInit(): void { |
||||
// 查询数据
|
||||
this.queryData(); |
||||
} |
||||
|
||||
/** |
||||
* 获取数据 |
||||
*/ |
||||
queryData() { |
||||
this.searchForm.value.discountNo = this.discountNo; |
||||
this.searchForm.value.pageNum = this.tablePageNum; |
||||
this.searchForm.value.pageSize = this.tablePageSize; |
||||
this.discountStockService.queryStockBatchList(this.searchForm.value, (data: any) => { |
||||
if (data['return_code'] == '000000') { |
||||
this.tableData = data['return_data']; |
||||
} |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 搜索表单提交 |
||||
*/ |
||||
searchFormSubmit(): void { |
||||
this.tablePageNum = 1; |
||||
this.queryData(); |
||||
} |
||||
|
||||
/** |
||||
* 搜索表单重置 |
||||
*/ |
||||
searchFormReset(): void { |
||||
this.searchForm.reset(); |
||||
} |
||||
|
||||
/** |
||||
* 打开增加库存 |
||||
*/ |
||||
showAddStock() { |
||||
this.addStockForm.patchValue({discountNo: this.discountNo}); |
||||
this.addStockForm.controls['discountNo'].disable(); |
||||
this.addStockModal = true; |
||||
} |
||||
|
||||
/** |
||||
* 提交库存 |
||||
*/ |
||||
submitStock() { |
||||
if (this.addStockForm.valid) { |
||||
const param = this.addStockForm.value; |
||||
param['discountNo'] = this.discountNo; |
||||
this.discountStockService.addStock(param, (data: any) => { |
||||
if (data['return_code'] == '000000') { |
||||
this.message.create('success', '操作成功'); |
||||
this.queryData(); |
||||
this.closeAddStock(); |
||||
} else { |
||||
this.message.create('error', data['return_msg']); |
||||
} |
||||
}); |
||||
} else { |
||||
Object.values(this.addStockForm.controls).forEach(control => { |
||||
if (control.invalid) { |
||||
control.markAsDirty(); |
||||
control.updateValueAndValidity({ onlySelf: true }); |
||||
} |
||||
}); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 关闭增加库存 |
||||
*/ |
||||
closeAddStock() { |
||||
this.addStockForm.reset(); |
||||
this.addStockModal = false; |
||||
} |
||||
|
||||
/** |
||||
* 打开增加库存code |
||||
*/ |
||||
showStockCode(batchNo: any) { |
||||
this.batchNo = batchNo; |
||||
this.showCodeModal = true; |
||||
} |
||||
|
||||
/** |
||||
* 关闭增加库存code |
||||
*/ |
||||
closeStockCode() { |
||||
this.showCodeModal = false; |
||||
} |
||||
|
||||
} |
||||
|
||||
|
@ -0,0 +1,12 @@ |
||||
import { NgModule } from '@angular/core'; |
||||
import { CommonModule } from '@angular/common'; |
||||
|
||||
|
||||
|
||||
@NgModule({ |
||||
declarations: [], |
||||
imports: [ |
||||
CommonModule |
||||
] |
||||
}) |
||||
export class DiscountModule { } |
@ -0,0 +1,12 @@ |
||||
import { Routes } from '@angular/router'; |
||||
import {DiscountListComponent} from "./discount-list/discount-list.component"; |
||||
import {DiscountEditComponent} from "./discount-edit/discount-edit.component"; |
||||
import {DiscountPkEditComponent} from "../discount-pk/discount-pk-edit/discount-pk-edit.component"; |
||||
import {DiscountPkListComponent} from "../discount-pk/discount-pk-list/discount-pk-list.component"; |
||||
|
||||
export const DISCOUNT_ROUTES: Routes = [ |
||||
{ path: 'edit', component: DiscountEditComponent }, |
||||
{ path: 'list', component: DiscountListComponent }, |
||||
{ path: 'pk-edit', component: DiscountPkEditComponent }, |
||||
{ path: 'pk-list', component: DiscountPkListComponent }, |
||||
]; |
@ -0,0 +1,96 @@ |
||||
<form nz-form [formGroup]="searchForm" class="search_form" [nzLayout]="'vertical'"> |
||||
<div nz-row [nzGutter]="24"> |
||||
<div nz-col [nzSpan]="6"> |
||||
<nz-form-item> |
||||
<nz-form-label>交易类型</nz-form-label> |
||||
<nz-form-control> |
||||
<nz-select formControlName="type" nzAllowClear [nzPlaceHolder]="'请选择'"> |
||||
<nz-option nzValue="1" nzLabel="入账"></nz-option> |
||||
<nz-option nzValue="2" nzLabel="出账"></nz-option> |
||||
</nz-select> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
|
||||
<div nz-col [nzSpan]="6"> |
||||
<nz-form-item> |
||||
<nz-form-label>交易来源</nz-form-label> |
||||
<nz-form-control> |
||||
<nz-select formControlName="sourceType" nzAllowClear [nzPlaceHolder]="'请选择'"> |
||||
<nz-option *ngFor="let item of merAccountRecordSourceTypeArray" nzValue="{{item.codeValue}}" nzLabel="{{item.codeName}}"></nz-option> |
||||
</nz-select> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
|
||||
<div nz-col [nzSpan]="6"> |
||||
<nz-form-item> |
||||
<nz-form-label>来源单号</nz-form-label> |
||||
<nz-form-control> |
||||
<input nz-input formControlName="sourceOrderNo" placeholder="请输入" /> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
|
||||
<div nz-col [nzSpan]="6"> |
||||
<nz-form-item> |
||||
<nz-form-label></nz-form-label> |
||||
<nz-form-control> |
||||
<button nz-button style="margin-right: 8px" [nzType]="'primary'" (click)="searchFormSubmit()">查询</button> |
||||
<button nz-button style="margin-right: 8px" (click)="searchFormReset()">重置</button> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
</div> |
||||
</form> |
||||
|
||||
<div class="csp-statistic"> |
||||
<div class="csp-statistic-title"> |
||||
<span>油站编号:</span> |
||||
<span class="csp-text-primary" style="margin-right: 50px;">{{account.merNo}}</span> |
||||
<span>油站余额:</span> |
||||
<span class="csp-text-primary" style="margin-right: 50px;">¥{{account.amount}}</span> |
||||
</div> |
||||
</div> |
||||
|
||||
<nz-table #basicTable |
||||
[nzScroll]="{ x: '1200px' }" |
||||
[nzBordered]="true" |
||||
[nzFrontPagination]="false" |
||||
[nzShowQuickJumper]="true" |
||||
[nzShowTotal]="totalTemplate" |
||||
[(nzPageIndex)]="tablePageNum" |
||||
(nzPageIndexChange)="queryData()" |
||||
nzShowSizeChanger |
||||
(nzPageSizeChange)="this.tablePageSize = $event;queryData()" |
||||
[nzPageSizeOptions]="[ 10, 20, 30, 50, 100 ]" |
||||
[nzTotal]="tableData.total" |
||||
[nzData]="tableData.list" > |
||||
<thead> |
||||
<tr> |
||||
<th nzWidth="90px">交易前金额</th> |
||||
<th nzWidth="80px">交易金额</th> |
||||
<th nzWidth="90px">交易后金额</th> |
||||
<th nzWidth="50px">交易类型</th> |
||||
<th nzWidth="100px">交易时间</th> |
||||
<th nzWidth="120px">交易来源</th> |
||||
<th nzWidth="120px">来源单号</th> |
||||
<!-- <th nzRight nzWidth="50px">操作</th>--> |
||||
</tr> |
||||
</thead> |
||||
<tbody> |
||||
<tr *ngFor="let data of basicTable.data"> |
||||
<td>{{data.beforeAmount}}</td> |
||||
<td>{{data.transactionAmount}}</td> |
||||
<td>{{data.afterAmount}}</td> |
||||
<td>{{data.type==1?'入账':'出账'}}</td> |
||||
<td>{{data.createTime | date: 'yyyy-MM-dd HH:mm:ss'}}</td> |
||||
<td>{{data.sourceType | dictionary: 'MER_ACCOUNT_RECORD_SOURCE_TYPE'}}</td> |
||||
<td>{{data.sourceOrderNo}}</td> |
||||
<!-- <td nzRight> |
||||
<a (click)="showRecord(data)">详情</a> |
||||
</td>--> |
||||
</tr> |
||||
</tbody> |
||||
<ng-template #totalTemplate let-total>总计 {{ total }} 条</ng-template> |
||||
</nz-table> |
@ -0,0 +1,27 @@ |
||||
nz-input-number { |
||||
width: 100%; |
||||
} |
||||
nz-date-picker { |
||||
width: 100%; |
||||
} |
||||
.submit-btn { |
||||
width: 150px; |
||||
} |
||||
.csp-statistic { |
||||
font-feature-settings: "tnum"; |
||||
border: 1px solid #d9d9d9; |
||||
border-radius: 4px; |
||||
} |
||||
.csp-statistic-title { |
||||
padding: 0 16px; |
||||
height: 64px; |
||||
display: -ms-flexbox; |
||||
display: flex; |
||||
-ms-flex-align: center; |
||||
align-items: center; |
||||
background-color: #fafafa; |
||||
} |
||||
.csp-text-primary{ |
||||
font-size: 20px; |
||||
color: #1890ff; |
||||
} |
@ -0,0 +1,184 @@ |
||||
import { Component } from '@angular/core'; |
||||
import {DatePipe, NgForOf, NgIf} from "@angular/common"; |
||||
import {DictionaryPipe} from "../../../pipes/common/dictionary.pipe"; |
||||
import { |
||||
NzCellFixedDirective, |
||||
NzTableCellDirective, |
||||
NzTableComponent, NzTableModule, |
||||
NzTbodyComponent, |
||||
NzTheadComponent, |
||||
NzThMeasureDirective, NzTrDirective |
||||
} from "ng-zorro-antd/table"; |
||||
import {FormGroup, FormsModule, NonNullableFormBuilder, ReactiveFormsModule, Validators} from "@angular/forms"; |
||||
import {NzMessageService} from "ng-zorro-antd/message"; |
||||
import {MerchantAccountService} from "../../../services/merchant/merchant-account.service"; |
||||
import {NzModalModule, NzModalService} from "ng-zorro-antd/modal"; |
||||
import {NzButtonComponent} from "ng-zorro-antd/button"; |
||||
import {NzColDirective, NzRowDirective} from "ng-zorro-antd/grid"; |
||||
import {NzDividerComponent} from "ng-zorro-antd/divider"; |
||||
import {NzDropDownADirective, NzDropDownDirective, NzDropdownMenuComponent} from "ng-zorro-antd/dropdown"; |
||||
import {NzFormControlComponent, NzFormDirective, NzFormItemComponent, NzFormLabelComponent} from "ng-zorro-antd/form"; |
||||
import {NzIconDirective} from "ng-zorro-antd/icon"; |
||||
import {NzInputDirective} from "ng-zorro-antd/input"; |
||||
import {NzMenuDirective, NzMenuItemComponent} from "ng-zorro-antd/menu"; |
||||
import {NzOptionComponent, NzSelectComponent} from "ng-zorro-antd/select"; |
||||
import {NzFlexDirective} from "ng-zorro-antd/flex"; |
||||
import {NzDescriptionsModule} from "ng-zorro-antd/descriptions"; |
||||
import {NzUploadComponent} from "ng-zorro-antd/upload"; |
||||
import {NzAvatarModule} from "ng-zorro-antd/avatar"; |
||||
import {NzImageModule} from "ng-zorro-antd/image"; |
||||
import {NzSwitchComponent} from "ng-zorro-antd/switch"; |
||||
import {NzDatePickerComponent} from "ng-zorro-antd/date-picker"; |
||||
import {NzInputNumberModule} from "ng-zorro-antd/input-number"; |
||||
import {DATA} from "../../../data/login/localStorage.namespace"; |
||||
import {BrowserStorageService} from "../../../utils/localStorage.service"; |
||||
import {NzStatisticModule} from "ng-zorro-antd/statistic"; |
||||
import {NzCardComponent} from "ng-zorro-antd/card"; |
||||
import {NzQRCodeComponent} from "ng-zorro-antd/qr-code"; |
||||
import {NzTabComponent, NzTabSetComponent} from "ng-zorro-antd/tabs"; |
||||
|
||||
@Component({ |
||||
selector: 'app-merchant-amount', |
||||
standalone: true, |
||||
imports: [ |
||||
DatePipe, |
||||
DictionaryPipe, |
||||
FormsModule, |
||||
NgForOf, |
||||
NgIf, |
||||
NzButtonComponent, |
||||
NzCellFixedDirective, |
||||
NzColDirective, |
||||
NzDividerComponent, |
||||
NzDropDownADirective, |
||||
NzDropDownDirective, |
||||
NzDropdownMenuComponent, |
||||
NzFormControlComponent, |
||||
NzFormDirective, |
||||
NzFormItemComponent, |
||||
NzFormLabelComponent, |
||||
NzIconDirective, |
||||
NzInputDirective, |
||||
NzMenuDirective, |
||||
NzMenuItemComponent, |
||||
NzOptionComponent, |
||||
NzRowDirective, |
||||
NzSelectComponent, |
||||
NzTableCellDirective, |
||||
NzTableComponent, |
||||
NzTbodyComponent, |
||||
NzThMeasureDirective, |
||||
NzTheadComponent, |
||||
NzTrDirective, |
||||
ReactiveFormsModule, |
||||
NzTableModule, |
||||
NzModalModule, |
||||
NzFlexDirective, |
||||
NzDescriptionsModule, |
||||
NzUploadComponent, |
||||
NzAvatarModule, |
||||
NzImageModule, |
||||
NzSwitchComponent, |
||||
NzDatePickerComponent, |
||||
NzInputNumberModule, |
||||
NzStatisticModule, |
||||
NzCardComponent, |
||||
NzQRCodeComponent, |
||||
NzTabComponent, |
||||
NzTabSetComponent |
||||
], |
||||
templateUrl: './merchant-amount.component.html', |
||||
styleUrl: './merchant-amount.component.less' |
||||
}) |
||||
export class MerchantAmountComponent { |
||||
userInfoObject: any; |
||||
// 表单页数
|
||||
tablePageNum = 1; |
||||
// 每页数量
|
||||
tablePageSize = 10; |
||||
// 表单数据
|
||||
tableData: any = { |
||||
total: 0, |
||||
list: [], |
||||
}; |
||||
// 账户余额
|
||||
account: any = { |
||||
amount: 0 |
||||
}; |
||||
// 搜索表单
|
||||
searchForm: FormGroup; |
||||
|
||||
// 记录模态框
|
||||
recordModal = false; |
||||
recordData: any = {}; |
||||
// 交易来源类型
|
||||
merAccountRecordSourceTypeArray = new DictionaryPipe().getDictionaryList('MER_ACCOUNT_RECORD_SOURCE_TYPE'); |
||||
constructor(private fb: NonNullableFormBuilder, |
||||
private message: NzMessageService, |
||||
private storage: BrowserStorageService, |
||||
private merchantAccountService: MerchantAccountService, |
||||
private modalService: NzModalService) { |
||||
this.userInfoObject = this.storage.get(DATA); |
||||
// 初始化搜索框
|
||||
this.searchForm = this.fb.group({ |
||||
type: [''], |
||||
sourceType: [''], |
||||
sourceOrderNo: [''], |
||||
}); |
||||
this.queryAccount(); |
||||
this.queryData(); |
||||
} |
||||
|
||||
/** |
||||
* 查询账户 |
||||
*/ |
||||
queryAccount() { |
||||
const param = { |
||||
merNo: this.userInfoObject['merchant']['merNo'] |
||||
} |
||||
this.merchantAccountService.getAccount(param, (data: any) => { |
||||
if (data['return_code'] == '000000') { |
||||
this.account = data['return_data']; |
||||
} |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 获取数据 |
||||
*/ |
||||
queryData() { |
||||
this.searchForm.value.merNo = this.userInfoObject['merchant']['merNo']; |
||||
this.searchForm.value.pageNum = this.tablePageNum; |
||||
this.searchForm.value.pageSize = this.tablePageSize; |
||||
this.searchForm.value.time = new Date().getTime(); |
||||
this.merchantAccountService.getRecordList(this.searchForm.value, (data: any) => { |
||||
if (data['return_code'] == '000000') { |
||||
this.tableData = data['return_data']; |
||||
} |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 搜索表单提交 |
||||
*/ |
||||
searchFormSubmit(): void { |
||||
this.tablePageNum = 1; |
||||
this.queryData(); |
||||
} |
||||
|
||||
/** |
||||
* 搜索表单重置 |
||||
*/ |
||||
searchFormReset(): void { |
||||
this.searchForm.reset(); |
||||
} |
||||
|
||||
/** |
||||
* 打开记录 |
||||
*/ |
||||
showRecord(data: any) { |
||||
this.recordData = data; |
||||
this.recordModal = true; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,75 @@ |
||||
import { Injectable } from '@angular/core'; |
||||
import {HttpClient} from "@angular/common/http"; |
||||
import {environment} from "../../../environments/environment"; |
||||
import {ObjectData} from "../../utils/objectData.service"; |
||||
|
||||
@Injectable({ |
||||
providedIn: 'root' |
||||
}) |
||||
export class AgentApiService { |
||||
|
||||
constructor(private http: HttpClient) { } |
||||
|
||||
/** |
||||
* 分配代理商 |
||||
* @param param |
||||
* @param callBack |
||||
*/ |
||||
public getAccount(param: any, callBack:any) { |
||||
param.tm = new Date().getTime(); |
||||
this.http.get(environment.baseUrl + 'agentApiAccount/getAccount?'+ObjectData.objectByString(param)).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 充值 |
||||
* @param param |
||||
* @param callBack |
||||
*/ |
||||
public recharge(param: any, callBack:any) { |
||||
param.tm = new Date().getTime(); |
||||
this.http.post(environment.baseUrl + 'agentApiAccount/recharge', param).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 查询记录列表 |
||||
* @param param |
||||
* @param callBack |
||||
*/ |
||||
public getRecordList(param: any, callBack:any) { |
||||
param.tm = new Date().getTime(); |
||||
this.http.get(environment.baseUrl + 'agentApiAccount/getRecordList?'+ObjectData.objectByString(param)).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 查询API参数 |
||||
* @param param |
||||
* @param callBack |
||||
*/ |
||||
public getApiParam(param: any, callBack:any) { |
||||
param.tm = new Date().getTime(); |
||||
this.http.get(environment.baseUrl + 'agentApiParam/getApiParam?'+ObjectData.objectByString(param)).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 修改API参数 |
||||
* @param param |
||||
* @param callBack |
||||
*/ |
||||
public updateApiParam(param: any, callBack:any) { |
||||
param.tm = new Date().getTime(); |
||||
this.http.post(environment.baseUrl + 'agentApiParam/update',param).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
|
||||
|
||||
} |
@ -0,0 +1,62 @@ |
||||
import { Injectable } from '@angular/core'; |
||||
import {HttpClient} from "@angular/common/http"; |
||||
import {environment} from "../../../environments/environment"; |
||||
import {ObjectData} from "../../utils/objectData.service"; |
||||
|
||||
@Injectable({ |
||||
providedIn: 'root' |
||||
}) |
||||
export class AgentMerAccountService { |
||||
|
||||
constructor(private http: HttpClient) { } |
||||
|
||||
/** |
||||
* 查询账户 |
||||
* @param param |
||||
* @param callBack |
||||
*/ |
||||
public getAccount(param: any, callBack:any) { |
||||
param.tm = new Date().getTime(); |
||||
this.http.get(environment.baseUrl + 'agentMerAccount/getAccount?'+ObjectData.objectByString(param)).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 充值 |
||||
* @param param |
||||
* @param callBack |
||||
*/ |
||||
public recharge(param: any, callBack:any) { |
||||
param.tm = new Date().getTime(); |
||||
this.http.post(environment.baseUrl + 'agentMerAccount/recharge', param).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 查询账户列表 |
||||
* @param param |
||||
* @param callBack |
||||
*/ |
||||
public getMerList(param: any, callBack:any) { |
||||
param.tm = new Date().getTime(); |
||||
this.http.get(environment.baseUrl + 'agentMerAccount/getMerList?'+ObjectData.objectByString(param)).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 查询账户记录列表 |
||||
* @param param |
||||
* @param callBack |
||||
*/ |
||||
public getRecordList(param: any, callBack:any) { |
||||
param.tm = new Date().getTime(); |
||||
this.http.get(environment.baseUrl + 'agentMerAccount/getRecordList?'+ObjectData.objectByString(param)).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
} |
@ -0,0 +1,74 @@ |
||||
import { Injectable } from '@angular/core'; |
||||
import {HttpClient} from "@angular/common/http"; |
||||
import {environment} from "../../../environments/environment"; |
||||
import {ObjectData} from "../../utils/objectData.service"; |
||||
|
||||
@Injectable({ |
||||
providedIn: 'root' |
||||
}) |
||||
export class AgentMerService { |
||||
|
||||
constructor(private http: HttpClient) { } |
||||
|
||||
/** |
||||
* 分配代理商 |
||||
* @param param |
||||
* @param callBack |
||||
*/ |
||||
public assignAgent(param: any, callBack:any) { |
||||
param.tm = new Date().getTime(); |
||||
this.http.post(environment.baseUrl + 'agentMer/assignAgent', param).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 解绑代理商 |
||||
* @param param |
||||
* @param callBack |
||||
*/ |
||||
public unbindAgent(param: any, callBack:any) { |
||||
param.tm = new Date().getTime(); |
||||
this.http.post(environment.baseUrl + 'agentMer/unbindAgent', param).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 分配工作人员 |
||||
* @param param |
||||
* @param callBack |
||||
*/ |
||||
public assignStaff(param: any, callBack:any) { |
||||
param.tm = new Date().getTime(); |
||||
this.http.post(environment.baseUrl + 'agentMer/assignStaff', param).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 解绑业务员 |
||||
* @param param |
||||
* @param callBack |
||||
*/ |
||||
public unbindStaff(param: any, callBack:any) { |
||||
param.tm = new Date().getTime(); |
||||
this.http.post(environment.baseUrl + 'agentMer/unbindStaff', param).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 查询分配列表 |
||||
* @param param |
||||
* @param callBack |
||||
*/ |
||||
public getAllotList(param: any, callBack:any) { |
||||
param.tm = new Date().getTime(); |
||||
this.http.get(environment.baseUrl + 'agentMer/getAllotList?'+ObjectData.objectByString(param)).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,47 @@ |
||||
import { Injectable } from '@angular/core'; |
||||
import {HttpClient} from "@angular/common/http"; |
||||
import {environment} from "../../../environments/environment"; |
||||
|
||||
@Injectable({ |
||||
providedIn: 'root' |
||||
}) |
||||
export class DiscountPkStockService { |
||||
|
||||
constructor(private http: HttpClient) { } |
||||
|
||||
/** |
||||
* 增加库存 |
||||
* @param params |
||||
* @param callBack |
||||
*/ |
||||
public edit(params: any, callBack:any) { |
||||
params.time = new Date().getTime(); |
||||
this.http.post(environment.baseUrl + 'discountPk/edit', params).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 查询库存批次 |
||||
* @param params |
||||
* @param callBack |
||||
*/ |
||||
public queryStockBatchList(params: any, callBack:any) { |
||||
params.time = new Date().getTime(); |
||||
this.http.post(environment.baseUrl + 'discountPk/queryStockBatchList', params).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 查询库存批次优惠券code |
||||
* @param params |
||||
* @param callBack |
||||
*/ |
||||
public queryStockBatchCodeList(params: any, callBack:any) { |
||||
params.time = new Date().getTime(); |
||||
this.http.post(environment.baseUrl + 'discountPk/queryStockBatchCodeList', params).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
} |
@ -0,0 +1,98 @@ |
||||
import { Injectable } from '@angular/core'; |
||||
import {HttpClient} from "@angular/common/http"; |
||||
import {environment} from "../../../environments/environment"; |
||||
import {ObjectData} from "../../utils/objectData.service"; |
||||
|
||||
@Injectable({ |
||||
providedIn: 'root' |
||||
}) |
||||
export class DiscountPkService { |
||||
|
||||
constructor(private http: HttpClient) { } |
||||
|
||||
/** |
||||
* 编辑优惠 |
||||
* @param params |
||||
* @param callBack |
||||
*/ |
||||
public edit(params: any, callBack:any) { |
||||
params.time = new Date().getTime(); |
||||
this.http.post(environment.baseUrl + 'discountPk/edit', params).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 上线优惠券包 |
||||
* @param params |
||||
* @param callBack |
||||
*/ |
||||
public online(params: any, callBack:any) { |
||||
params.time = new Date().getTime(); |
||||
this.http.post(environment.baseUrl + 'discountPk/online', params).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 结束优惠券包 |
||||
* @param params |
||||
* @param callBack |
||||
*/ |
||||
public done(params: any, callBack:any) { |
||||
params.time = new Date().getTime(); |
||||
this.http.post(environment.baseUrl + 'discountPk/done', params).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 删除 |
||||
* @param params |
||||
* @param callBack |
||||
*/ |
||||
public delete(params: any, callBack:any) { |
||||
params.time = new Date().getTime(); |
||||
this.http.post(environment.baseUrl + 'discountPk/delete', params).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 赠送用户 |
||||
* @param params |
||||
* @param callBack |
||||
*/ |
||||
public giveUser(params: any, callBack:any) { |
||||
params.time = new Date().getTime(); |
||||
this.http.post(environment.baseUrl + 'discountPk/giveUser', params).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 查询详情 |
||||
* @param params |
||||
* @param callBack |
||||
*/ |
||||
public getDetail(params: any, callBack:any) { |
||||
params.time = new Date().getTime(); |
||||
this.http.get(environment.baseUrl + 'discountPk/getDetail?'+ObjectData.objectByString(params)).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 查询列表 |
||||
* @param params |
||||
* @param callBack |
||||
*/ |
||||
public getList(params: any, callBack:any) { |
||||
params.time = new Date().getTime(); |
||||
this.http.get(environment.baseUrl + 'discountPk/getList?'+ObjectData.objectByString(params)).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,62 @@ |
||||
import { Injectable } from '@angular/core'; |
||||
import {HttpClient} from "@angular/common/http"; |
||||
import {environment} from "../../../environments/environment"; |
||||
import {ObjectData} from "../../utils/objectData.service"; |
||||
|
||||
@Injectable({ |
||||
providedIn: 'root' |
||||
}) |
||||
export class DiscountStockService { |
||||
|
||||
constructor(private http: HttpClient) { } |
||||
|
||||
/** |
||||
* 增加优惠券库存 |
||||
* @param params |
||||
* @param callBack |
||||
*/ |
||||
public addStock(params: any, callBack:any) { |
||||
params.time = new Date().getTime(); |
||||
this.http.post(environment.baseUrl + 'discountStock/addStock', params).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 查询库存批次 |
||||
* @param params |
||||
* @param callBack |
||||
*/ |
||||
public queryStockBatchList(params: any, callBack:any) { |
||||
params.time = new Date().getTime(); |
||||
this.http.get(environment.baseUrl + 'discountStock/queryStockBatchList?'+ObjectData.objectByString(params)).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 查询库存批次详情 |
||||
* @param params |
||||
* @param callBack |
||||
*/ |
||||
public queryStockBatchDetail(params: any, callBack:any) { |
||||
params.time = new Date().getTime(); |
||||
this.http.get(environment.baseUrl + 'discountStock/queryStockBatchDetail?'+ObjectData.objectByString(params)).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 查询库存批次优惠券code |
||||
* @param params |
||||
* @param callBack |
||||
*/ |
||||
public queryStockBatchCodeList(params: any, callBack:any) { |
||||
params.time = new Date().getTime(); |
||||
this.http.get(environment.baseUrl + 'discountStock/queryStockBatchCodeList?'+ObjectData.objectByString(params)).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,135 @@ |
||||
import { Injectable } from '@angular/core'; |
||||
import {HttpClient} from "@angular/common/http"; |
||||
import {environment} from "../../../environments/environment"; |
||||
import {ObjectData} from "../../utils/objectData.service"; |
||||
|
||||
@Injectable({ |
||||
providedIn: 'root' |
||||
}) |
||||
export class DiscountService { |
||||
|
||||
constructor(private http: HttpClient) { } |
||||
|
||||
/** |
||||
* 编辑优惠 |
||||
* @param params |
||||
* @param callBack |
||||
*/ |
||||
public editDiscount(params: any, callBack:any) { |
||||
params.time = new Date().getTime(); |
||||
this.http.post(environment.baseUrl + 'discount/editDiscount', params).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 修改结束时间 |
||||
* @param params |
||||
* @param callBack |
||||
*/ |
||||
public updateEndTime(params: any, callBack:any) { |
||||
params.time = new Date().getTime(); |
||||
this.http.post(environment.baseUrl + 'discount/updateEndTime', params).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 赠送用户 |
||||
* @param params |
||||
* @param callBack |
||||
*/ |
||||
public giveUser(params: any, callBack:any) { |
||||
params.time = new Date().getTime(); |
||||
this.http.post(environment.baseUrl + 'discount/giveUser', params).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 上线 |
||||
* @param params |
||||
* @param callBack |
||||
*/ |
||||
public online(params: any, callBack:any) { |
||||
params.time = new Date().getTime(); |
||||
this.http.post(environment.baseUrl + 'discount/online', params).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 下线 |
||||
* @param params |
||||
* @param callBack |
||||
*/ |
||||
public done(params: any, callBack:any) { |
||||
params.time = new Date().getTime(); |
||||
this.http.post(environment.baseUrl + 'discount/done', params).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 删除 |
||||
* @param params |
||||
* @param callBack |
||||
*/ |
||||
public delete(params: any, callBack:any) { |
||||
params.time = new Date().getTime(); |
||||
this.http.post(environment.baseUrl + 'discount/delete', params).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 查询详情 |
||||
* @param params |
||||
* @param callBack |
||||
*/ |
||||
public queryDetail(params: any, callBack:any) { |
||||
params.time = new Date().getTime(); |
||||
this.http.get(environment.baseUrl + 'discount/queryDetail?'+ObjectData.objectByString(params)).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 查询列表 |
||||
* @param params |
||||
* @param callBack |
||||
*/ |
||||
public queryList(params: any, callBack:any) { |
||||
params.time = new Date().getTime(); |
||||
this.http.get(environment.baseUrl + 'discount/queryList?'+ObjectData.objectByString(params)).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 编辑可使用油站 |
||||
* @param params |
||||
* @param callBack |
||||
*/ |
||||
public editUseMer(params: any, callBack:any) { |
||||
params.time = new Date().getTime(); |
||||
this.http.post(environment.baseUrl + 'discountUseMer/edit', params).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 查询列表 |
||||
* @param params |
||||
* @param callBack |
||||
*/ |
||||
public getUseMerList(params: any, callBack:any) { |
||||
params.time = new Date().getTime(); |
||||
this.http.get(environment.baseUrl + 'discountUseMer/getUseMerList?'+ObjectData.objectByString(params)).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
|
||||
|
||||
} |
Loading…
Reference in new issue