parent
49b499cf58
commit
cebac7ba7a
@ -0,0 +1,225 @@ |
||||
<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]="'请选择'"> |
||||
<nz-option *ngFor="let item of agentData" nzValue="{{item.id}}" nzLabel="【{{item.type | dictionary:'AGENT_TYPE'}}】{{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> |
||||
<button nz-button style="margin-right: 8px" [nzType]="'primary'" (click)="showBatchUpdateDiscount()">批量调整</button> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
</div> |
||||
</form> |
||||
|
||||
<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="100px">来源渠道</th> |
||||
<th nzWidth="100px">油站地区</th> |
||||
<th nzWidth="100px">油站编号</th> |
||||
<th nzWidth="150px">油站名称</th> |
||||
<th nzWidth="50px">油号</th> |
||||
<th nzWidth="60px">国标价</th> |
||||
<th nzWidth="60px">油枪价</th> |
||||
<th nzWidth="60px">优惠价</th> |
||||
<th nzWidth="60px">优惠折扣</th> |
||||
<th nzRight nzWidth="70px">操作</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.terminalPrice}}</td> |
||||
<td>{{data.priceRate}} %</td> |
||||
<td nzRight> |
||||
<a (click)="showUpdateDiscount(data)">调整优惠</a> |
||||
</td> |
||||
</tr> |
||||
</tbody> |
||||
<ng-template #totalTemplate let-total>总计 {{ total }} 条</ng-template> |
||||
</nz-table> |
||||
|
||||
|
||||
<nz-modal [(nzVisible)]="batchUpdateDiscountModal" |
||||
[nzWidth]="500" |
||||
nzTitle="批量调整优惠" |
||||
[nzFooter]="null" |
||||
(nzOnCancel)="closeBatchUpdateDiscount()"> |
||||
<ng-container *nzModalContent> |
||||
<nz-spin [nzSpinning]="loadingObject.status" nzTip="{{loadingObject.title}}"> |
||||
<form nz-form [formGroup]="batchUpdateDiscountForm"> |
||||
<nz-form-item> |
||||
<nz-form-label [nzSm]="6" [nzXs]="24"><span style="color: red">【当前代理】</span></nz-form-label> |
||||
<nz-form-control [nzSm]="14" [nzXs]="24"> |
||||
<nz-select formControlName="agentId" [nzPlaceHolder]="'请选择'"> |
||||
<nz-option *ngFor="let item of agentData" nzValue="{{item.id}}" nzLabel="【{{item.type | dictionary:'AGENT_TYPE'}}】{{item.name}}"></nz-option> |
||||
</nz-select> |
||||
</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-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> |
||||
|
||||
<nz-form-item> |
||||
<nz-form-label [nzSm]="6" [nzXs]="24">地区(省/直辖市)</nz-form-label> |
||||
<nz-form-control [nzSm]="14" [nzXs]="24"> |
||||
<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> |
||||
|
||||
<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> |
||||
</nz-spin> |
||||
</ng-container> |
||||
</nz-modal> |
||||
|
||||
<nz-modal [(nzVisible)]="updateDiscountModal" |
||||
[nzWidth]="500" |
||||
nzTitle="调整优惠" |
||||
[nzFooter]="null" |
||||
(nzOnCancel)="closeUpdateDiscount()"> |
||||
<ng-container *nzModalContent> |
||||
<nz-spin [nzSpinning]="loadingObject.status" nzTip="{{loadingObject.title}}"> |
||||
<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> |
||||
</nz-spin> |
||||
</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,310 @@ |
||||
import { Component } from '@angular/core'; |
||||
import {DictionaryPipe} from "../../../pipes/common/dictionary.pipe"; |
||||
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, NzRowDirective} from "ng-zorro-antd/grid"; |
||||
import {NzFormControlComponent, NzFormDirective, NzFormItemComponent, NzFormLabelComponent} from "ng-zorro-antd/form"; |
||||
import {NzInputDirective} from "ng-zorro-antd/input"; |
||||
import {NzOptionComponent, NzSelectComponent} from "ng-zorro-antd/select"; |
||||
import { |
||||
NzCellFixedDirective, |
||||
NzTableCellDirective, |
||||
NzTableComponent, NzTableModule, |
||||
NzTbodyComponent, |
||||
NzTheadComponent, |
||||
NzThMeasureDirective, NzTrDirective |
||||
} from "ng-zorro-antd/table"; |
||||
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 {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 {MerService} from "../../../services/merchant/mer.service"; |
||||
import {NzMessageService} from "ng-zorro-antd/message"; |
||||
import {AgentService} from "../../../services/agent/agent.service"; |
||||
import {AgentStaffService} from "../../../services/agent/agent-staff.service"; |
||||
import {AgentPriceService} from "../../../services/agent/agent-price.service"; |
||||
import {AgentMerService} from "../../../services/agent/agent-mer.service"; |
||||
import {CommonService} from "../../../services/common/common.service"; |
||||
import {NzSpinComponent} from "ng-zorro-antd/spin"; |
||||
|
||||
@Component({ |
||||
selector: 'app-agent-mer-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, |
||||
NzTypographyComponent, |
||||
NzSpinComponent |
||||
], |
||||
templateUrl: './agent-mer-discount-list.component.html', |
||||
styleUrl: './agent-mer-discount-list.component.less' |
||||
}) |
||||
export class AgentMerDiscountListComponent { |
||||
loadingObject = { |
||||
title: "处理中...", |
||||
status: false, |
||||
}; |
||||
// 表单页数
|
||||
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 = []; |
||||
|
||||
updateDiscountModal = false; |
||||
updateDiscountForm: FormGroup; |
||||
|
||||
batchUpdateDiscountModal = false; |
||||
batchUpdateDiscountForm: FormGroup; |
||||
constructor(private fb: NonNullableFormBuilder, |
||||
private agentService: AgentService, |
||||
private agentPriceService: AgentPriceService, |
||||
private commonService: CommonService, |
||||
private message: NzMessageService, |
||||
private modal: NzModalService) { |
||||
// 初始化搜索框
|
||||
this.searchForm = this.fb.group({ |
||||
agentId: [''], |
||||
sourceType: [''], |
||||
provinceCode: [''], |
||||
oilNo: [''], |
||||
merNo: [''], |
||||
merName: [''], |
||||
}); |
||||
|
||||
this.updateDiscountForm = this.fb.group({ |
||||
agentId: [''], |
||||
merNo: [''], |
||||
oilNo: ['', [Validators.required]], |
||||
priceRate: ['', [Validators.required]], |
||||
serviceFeeRate: ['0', [Validators.required]], |
||||
}); |
||||
|
||||
this.batchUpdateDiscountForm = this.fb.group({ |
||||
agentId: [{value: null, disabled: true}], |
||||
provinceCode: [''], |
||||
sourceType: [''], |
||||
oilNo: ['', [Validators.required]], |
||||
priceRate: ['', [Validators.required]], |
||||
serviceFeeRate: ['0', [Validators.required]], |
||||
}); |
||||
|
||||
// 获取地区
|
||||
this.commonService.getRegion("", (data: any) => { |
||||
this.regionData = data['return_data']; |
||||
}); |
||||
|
||||
// 获取代理商
|
||||
this.agentService.queryAgentList({type:'2',pageNum:1,pageSize:999}, (data: any) => { |
||||
this.agentData = data['return_data']['list']; |
||||
this.searchForm.controls['agentId'].setValue(String(this.agentData[0]['id'])); |
||||
|
||||
this.queryData(); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 获取数据 |
||||
*/ |
||||
queryData() { |
||||
this.searchForm.value.pageNum = this.tablePageNum; |
||||
this.searchForm.value.pageSize = this.tablePageSize; |
||||
this.agentPriceService.getApiDiscountList(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.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); |
||||
} |
||||
|
||||
/** |
||||
* 打开修改优惠模态框 |
||||
*/ |
||||
showBatchUpdateDiscount() { |
||||
this.batchUpdateDiscountForm.controls['agentId'].setValue(this.searchForm.controls['agentId'].value); |
||||
this.batchUpdateDiscountModal = true; |
||||
} |
||||
|
||||
/** |
||||
* 提交修改优惠 |
||||
*/ |
||||
submitBatchUpdateDiscount() { |
||||
this.loadingObject.title = '处理中...'; |
||||
this.loadingObject.status = true; |
||||
if (this.batchUpdateDiscountForm.valid) { |
||||
const reqParam = this.batchUpdateDiscountForm.value; |
||||
reqParam['agentId'] = this.batchUpdateDiscountForm.controls['agentId'].value; |
||||
|
||||
this.agentPriceService.batchConfigApiPrice(reqParam, (data: any) => { |
||||
if (data['return_code'] == '000000') { |
||||
this.message.create('success', '操作成功'); |
||||
// 关闭弹窗
|
||||
this.closeBatchUpdateDiscount(); |
||||
|
||||
this.loadingObject.status = false; |
||||
|
||||
// 刷新数据
|
||||
this.queryData(); |
||||
// 表单重置
|
||||
this.batchUpdateDiscountForm.reset(); |
||||
} else { |
||||
this.message.create('error', data['return_msg']); |
||||
} |
||||
}); |
||||
} else { |
||||
this.loadingObject.status = false; |
||||
Object.values(this.batchUpdateDiscountForm.controls).forEach(control => { |
||||
if (control.invalid) { |
||||
control.markAsDirty(); |
||||
control.updateValueAndValidity({ onlySelf: true }); |
||||
} |
||||
}); |
||||
} |
||||
} |
||||
/** |
||||
* 关闭修改优惠模态框 |
||||
*/ |
||||
closeBatchUpdateDiscount() { |
||||
this.batchUpdateDiscountForm.reset(); |
||||
this.batchUpdateDiscountModal = false; |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 打开修改优惠模态框 |
||||
* @param data |
||||
*/ |
||||
showUpdateDiscount(data: any) { |
||||
this.updateDiscountForm.patchValue(data); |
||||
this.updateDiscountForm.controls['oilNo'].disable(); |
||||
this.updateDiscountModal = true; |
||||
} |
||||
|
||||
/** |
||||
* 提交修改优惠 |
||||
*/ |
||||
submitUpdateDiscount() { |
||||
this.loadingObject.title = '处理中...'; |
||||
this.loadingObject.status = true; |
||||
if (this.updateDiscountForm.valid) { |
||||
this.updateDiscountForm.value; |
||||
let paramArr = []; |
||||
this.updateDiscountForm.controls['agentId'].setValue(this.searchForm.controls['agentId'].value); |
||||
let param = this.updateDiscountForm.value; |
||||
param['oilNo'] = this.updateDiscountForm.controls['oilNo'].value; |
||||
paramArr.push(param); |
||||
this.agentPriceService.editApiPrice(paramArr, (data: any) => { |
||||
if (data['return_code'] == '000000') { |
||||
this.message.create('success', '操作成功'); |
||||
// 关闭弹窗
|
||||
this.closeUpdateDiscount(); |
||||
|
||||
this.loadingObject.status = false; |
||||
|
||||
// 刷新数据
|
||||
this.queryData(); |
||||
// 表单重置
|
||||
this.updateDiscountForm.reset(); |
||||
} else { |
||||
this.message.create('error', data['return_msg']); |
||||
} |
||||
}); |
||||
} else { |
||||
this.loadingObject.status = false; |
||||
|
||||
Object.values(this.updateDiscountForm.controls).forEach(control => { |
||||
if (control.invalid) { |
||||
control.markAsDirty(); |
||||
control.updateValueAndValidity({ onlySelf: true }); |
||||
} |
||||
}); |
||||
} |
||||
} |
||||
/** |
||||
* 关闭修改优惠模态框 |
||||
*/ |
||||
closeUpdateDiscount() { |
||||
this.updateDiscountForm.reset(); |
||||
this.updateDiscountModal = false; |
||||
} |
||||
} |
||||
Loading…
Reference in new issue