提交代码

pull/1/head
胡锐 3 years ago
parent 77cfe2a768
commit d90aa2dfec
  1. 102
      src/app/admin/tuanyou-agent/petrol-station-manage/petrol-station-manage.component.html
  2. 273
      src/app/admin/tuanyou-agent/petrol-station-manage/petrol-station-manage.ts
  3. 39
      src/app/services/gas.service.ts
  4. 27
      src/app/services/ty-agent-price.service.ts

@ -94,6 +94,8 @@
<div class="inner-content"> <div class="inner-content">
<span>共计 {{dataObject.total?dataObject.total:0}} 条数据</span> <span>共计 {{dataObject.total?dataObject.total:0}} 条数据</span>
<div class="operating-button"> <div class="operating-button">
<button nz-button nzType="primary" class="right-btn" *ngIf="(roleType == 5 && adminFlag == 1) || (roleType == 8) || (roleType == 9)" (click)="showBatchDiscountConfigModal()"><i nz-icon nzType="edit" nzTheme="outline"></i>批量设置优惠</button>
<button nz-button nzType="primary" class="right-btn" *ngIf="roleType == 5 && adminFlag == 1" (click)="showBatchConfigOilNoModal()"><i nz-icon nzType="edit" nzTheme="outline"></i>批量配置油品</button>
<button nz-button nzType="primary" class="right-btn" *ngIf="roleType == 5 && adminFlag == 1" (click)="showAssignOrgModal()"><i nz-icon nzType="plus" nzTheme="outline"></i>分配代理公司</button> <button nz-button nzType="primary" class="right-btn" *ngIf="roleType == 5 && adminFlag == 1" (click)="showAssignOrgModal()"><i nz-icon nzType="plus" nzTheme="outline"></i>分配代理公司</button>
<button nz-button nzType="primary" class="right-btn" *ngIf="roleType == 5 && adminFlag == 1" (click)="showUnbindOrgConfirm()"><i nz-icon nzType="minus" nzTheme="outline"></i>解绑代理公司</button> <button nz-button nzType="primary" class="right-btn" *ngIf="roleType == 5 && adminFlag == 1" (click)="showUnbindOrgConfirm()"><i nz-icon nzType="minus" nzTheme="outline"></i>解绑代理公司</button>
<button nz-button nzType="primary" class="right-btn" *ngIf="roleType == 5 && adminFlag == 0" (click)="showAssignAgentModal()"><i nz-icon nzType="plus" nzTheme="outline"></i>分配代理商</button> <button nz-button nzType="primary" class="right-btn" *ngIf="roleType == 5 && adminFlag == 0" (click)="showAssignAgentModal()"><i nz-icon nzType="plus" nzTheme="outline"></i>分配代理商</button>
@ -104,6 +106,8 @@
<!--数组表格 --> <!--数组表格 -->
<nz-table #basicTable <nz-table #basicTable
nzShowSizeChanger
[nzPageSizeOptions]="[10,20,50,100]"
[nzData]="dataObject.list" [nzData]="dataObject.list"
[nzTotal]="dataObject.total" [nzTotal]="dataObject.total"
[nzFrontPagination]="false" [nzFrontPagination]="false"
@ -143,8 +147,8 @@
<a nz-dropdown [nzDropdownMenu]="menu"> 操作列表 <i nz-icon nzType="down"></i> </a> <a nz-dropdown [nzDropdownMenu]="menu"> 操作列表 <i nz-icon nzType="down"></i> </a>
<nz-dropdown-menu #menu="nzDropdownMenu"> <nz-dropdown-menu #menu="nzDropdownMenu">
<ul nz-menu nzSelectable> <ul nz-menu nzSelectable>
<li *ngIf="roleType == 8 || roleType == 9" nz-menu-item (click)="showDiscountConfigModal(data.storeId)">优惠配置</li> <li *ngIf="(roleType == 5 && adminFlag == 1) || roleType == 8 || roleType == 9" nz-menu-item (click)="showDiscountConfigModal(data.storeId)">优惠配置</li>
<li *ngIf="roleType == 5" nz-menu-item nzDisabled>暂无操作</li> <li *ngIf="roleType == 5 && adminFlag == 1" (click)="showOilConfigModal(data.storeId)" nz-menu-item>油品配置</li>
</ul> </ul>
</nz-dropdown-menu> </nz-dropdown-menu>
</td> </td>
@ -209,9 +213,7 @@
<nz-modal [(nzVisible)]="discountConfigModal" nzTitle="优惠配置" (nzOnCancel)="closeDiscountConfigModal()" nzWidth="350px" [nzBodyStyle]="{ padding: '10px 24px 24px 24px' }" [nzFooter]="null"> <nz-modal [(nzVisible)]="discountConfigModal" nzTitle="优惠配置" (nzOnCancel)="closeDiscountConfigModal()" nzWidth="350px" [nzBodyStyle]="{ padding: '10px 24px 24px 24px' }" [nzFooter]="null">
<div nz-row *ngFor="let item of discountConfigData" style="margin-top: 10px;"> <div nz-row *ngFor="let item of discountConfigData" style="margin-top: 10px;">
<div nz-col [nzSpan]="3" style="margin-top: 5px;"> <div nz-col [nzSpan]="3" style="margin-top: 5px;">{{item.oilNoName}}</div>
{{item.oilNoName}}
</div>
<div nz-col [nzSpan]="10"> <div nz-col [nzSpan]="10">
<nz-input-number <nz-input-number
[(ngModel)]="item.priceRate" [(ngModel)]="item.priceRate"
@ -232,4 +234,94 @@
<button nz-button nzType="primary" style="margin-top: 15px;width: 150px;" (click)="submitDiscountConfig()">保存</button> <button nz-button nzType="primary" style="margin-top: 15px;width: 150px;" (click)="submitDiscountConfig()">保存</button>
</div> </div>
</nz-modal> </nz-modal>
<nz-modal [(nzVisible)]="oilConfigModal" nzTitle="油品配置" (nzOnCancel)="closeOilConfigModal()" nzWidth="550px" [nzBodyStyle]="{ padding: '10px 24px 24px 24px' }" [nzFooter]="null">
<div nz-row *ngFor="let item of discountConfigData" style="margin-top: 10px;">
<div nz-col [nzSpan]="3" style="margin-top: 5px;">
{{item.oilNoName}}
</div>
<div nz-col [nzSpan]="10">
<nz-input-number
[(ngModel)]="item.priceRate"
[nzMin]="item.lowPrice"
[nzMax]="100"
[nzStep]="1"
[nzFormatter]="formatterPercent"
[nzParser]="parserPercent"
[nzPrecision]="2"
[disabled]="true"
style="width: 100%;" >
</nz-input-number>
</div>
<div nz-col [nzSpan]="11" style="margin-top: 5px;left: 15px;">
<span nz-typography nzType="warning" *ngIf="item.status == 1">正常销售中<a (click)="showOilDisabledConfirm(item.oilStationId, item.oilNo)">【点击暂停销售】</a></span>
<span nz-typography nzType="danger" *ngIf="item.status == 2">已暂停销售<a (click)="showOilEnableConfirm(item.oilStationId, item.oilNo)">【点击恢复正常销售】</a></span>
</div>
</div>
</nz-modal>
<nz-modal [(nzVisible)]="batchDiscountConfigModal" nzTitle="批量配置优惠" (nzOnCancel)="closeBatchDiscountConfigModal()" nzWidth="350px" [nzFooter]="null">
<form nz-form [formGroup]="batchDiscountConfigForm">
<nz-form-item>
<nz-form-label [nzSpan]="6">
油品
</nz-form-label>
<nz-form-control [nzSpan]="14">
<nz-select nzShowSearch nzAllowClear nzPlaceHolder="请选择油品" formControlName="oilNo">
<nz-option *ngFor="let data of oilNoArray" nzLabel="{{data.codeName}}" nzValue="{{data.codeValue}}"></nz-option>
</nz-select>
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label [nzSpan]="6">
折扣
</nz-form-label>
<nz-form-control [nzSpan]="14">
<nz-input-number
[nzMin]="1"
[nzMax]="100"
[nzStep]="1"
[nzFormatter]="formatterPercent"
[nzParser]="parserPercent"
[nzPrecision]="2"
formControlName="priceRate"
style="width: 100%;" >
</nz-input-number>
</nz-form-control>
</nz-form-item>
<div style="text-align: center;">
<button nz-button nzType="primary" style="width: 150px;" (click)="submitBatchDiscountConfig()">确定</button>
</div>
</form>
</nz-modal>
<nz-modal [(nzVisible)]="batchConfigOilNoModal" nzTitle="批量配置油品" (nzOnCancel)="closeBatchConfigOilNoModal()" nzWidth="350px" [nzFooter]="null">
<form nz-form [formGroup]="batchConfigOilNoForm">
<nz-form-item>
<nz-form-label [nzSpan]="6">
油品
</nz-form-label>
<nz-form-control [nzSpan]="14">
<nz-select nzShowSearch nzAllowClear nzPlaceHolder="请选择油品" formControlName="oilNo">
<nz-option *ngFor="let data of oilNoArray" nzLabel="{{data.codeName}}" nzValue="{{data.codeValue}}"></nz-option>
</nz-select>
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label [nzSpan]="6">
销售状态
</nz-form-label>
<nz-form-control [nzSpan]="14">
<nz-select nzShowSearch nzAllowClear nzPlaceHolder="请选择销售状态" formControlName="status">
<nz-option nzLabel="正常销售" nzValue="1"></nz-option>
<nz-option nzLabel="暂停销售" nzValue="2"></nz-option>
</nz-select>
</nz-form-control>
</nz-form-item>
<div style="text-align: center;">
<button nz-button nzType="primary" style="width: 150px;" (click)="submitBatchConfigOilNo()">确定</button>
</div>
</form>
</nz-modal>
</nz-spin> </nz-spin>

@ -4,11 +4,13 @@ import {NzMessageService, NzModalService} from '_ng-zorro-antd@9.3.0@ng-zorro-an
import {TyAgentService} from '../../../services/ty-agent.service'; import {TyAgentService} from '../../../services/ty-agent.service';
import {TyAgentOilStationService} from '../../../services/ty-agent-oil-station.service'; import {TyAgentOilStationService} from '../../../services/ty-agent-oil-station.service';
import {Validators} from '@angular/forms'; import {Validators} from '@angular/forms';
import {OrganizationService} from "../../../services/organization.service"; import {OrganizationService} from '../../../services/organization.service';
import {LocalStorageService} from "../../../services/local-storage.service"; import {LocalStorageService} from '../../../services/local-storage.service';
import {ADMIN_INFO_OBJECT} from '../../../services/local-storage.namespace'; import {ADMIN_INFO_OBJECT} from '../../../services/local-storage.namespace';
import {TySalesmanService} from "../../../services/ty-salesman.service"; import {TySalesmanService} from '../../../services/ty-salesman.service';
import {TyAgentPriceService} from "../../../services/ty-agent-price.service"; import {TyAgentPriceService} from '../../../services/ty-agent-price.service';
import {GasService} from '../../../services/gas.service';
import {CommonsService} from "../../../services/commons.service";
@Component({ @Component({
selector: 'app-petrol-station-manage', selector: 'app-petrol-station-manage',
@ -45,15 +47,27 @@ export class PetrolStationManageComponent implements OnInit {
assignSalesmanModal = false; assignSalesmanModal = false;
assignSalesmanForm: FormGroup; assignSalesmanForm: FormGroup;
batchDiscountConfigModal = false;
batchDiscountConfigForm: FormGroup;
batchConfigOilNoModal = false;
batchConfigOilNoForm: FormGroup;
discountConfigModal = false; discountConfigModal = false;
discountConfigData: PetrolStationManage[] = []; discountConfigData: PetrolStationManage[] = [];
oilConfigModal = false;
oilNoArray = [];
formatterPercent = (value: number) => `${value}`; formatterPercent = (value: number) => `${value}`;
parserPercent = (value: string) => value.replace(' 折', ''); parserPercent = (value: string) => value.replace(' 折', '');
constructor(private modal: NzModalService, constructor(private modal: NzModalService,
private message: NzMessageService, private message: NzMessageService,
private tyAgentService: TyAgentService, private tyAgentService: TyAgentService,
private commonsService: CommonsService,
private gasService: GasService,
private tyAgentPriceService: TyAgentPriceService, private tyAgentPriceService: TyAgentPriceService,
private tySalesmanService: TySalesmanService, private tySalesmanService: TySalesmanService,
private organizationService: OrganizationService, private organizationService: OrganizationService,
@ -84,6 +98,21 @@ export class PetrolStationManageComponent implements OnInit {
this.assignSalesmanForm = this.form.group({ this.assignSalesmanForm = this.form.group({
salesmanId: [null, [Validators.required]], salesmanId: [null, [Validators.required]],
}); });
this.batchDiscountConfigForm = this.form.group({
belongType: [null],
oilNo: [null, [Validators.required]],
priceRate: [100, [Validators.required]],
});
this.batchConfigOilNoForm = this.form.group({
status: [null, [Validators.required]],
oilNo: [null, [Validators.required]],
});
this.commonsService.getDictionary('GAS_OIL_TYPE', data => {
if (data['return_code'] === '000000') {
this.oilNoArray = data['return_data'];
}
});
this.requestData(1); this.requestData(1);
} }
@ -548,12 +577,80 @@ export class PetrolStationManageComponent implements OnInit {
* *
*/ */
showDiscountConfigModal(oilStationId: number) { showDiscountConfigModal(oilStationId: number) {
this.tyAgentPriceService.getOilStationPrice(oilStationId, data => { this.getOilStationPrice(oilStationId);
if (data['return_code'] === '000000') {
this.discountConfigData = data['return_data'];
this.discountConfigModal = true; this.discountConfigModal = true;
} else { }
/**
*
*/
closeDiscountConfigModal() {
this.discountConfigModal = false;
}
/**
*
*/
showBatchDiscountConfigModal() {
this.batchDiscountConfigModal = true;
}
/**
*
*/
closeBatchDiscountConfigModal() {
this.batchDiscountConfigModal = false;
}
/**
*
*/
submitBatchDiscountConfig() {
for (const i in this.batchDiscountConfigForm.controls) {
this.batchDiscountConfigForm.controls[i].markAsDirty();
this.batchDiscountConfigForm.controls[i].updateValueAndValidity();
}
if (this.batchDiscountConfigForm.status == null || this.batchDiscountConfigForm.status !== 'VALID') {
this.modal.warning({
nzTitle: '提示',
nzContent: '有必填项未填写',
});
this.loadingObject.spinning = false;
return;
}
if (this.checkedData.length === 0) {
this.modal.warning({ this.modal.warning({
nzTitle: '提示',
nzContent: '请勾选油站',
});
return;
}
this.loadingObject.spinning = true;
this.loadingObject.msg = '处理中...';
this.batchDiscountConfigModal = false;
if (this.roleType === 5) {
this.batchDiscountConfigForm.value.belongType = 1;
} else {
this.batchDiscountConfigForm.value.belongType = 2;
}
const oilStationList = [];
for (const data of this.checkedData) {
oilStationList.push({ oilStationId: data['storeId'], oilStationName: data['storeName'], tyAgentOilStationId: data['tyAgentOilStationId'] });
}
this.batchDiscountConfigForm.value['oilStationList'] = oilStationList;
this.tyAgentPriceService.batchConfigPrice(this.batchDiscountConfigForm.value, data => {
this.loadingObject.spinning = false;
if (data['return_code'] === '000000') {
this.modal.success({
nzTitle: '提示',
nzContent: '处理成功',
});
this.checkedData = [];
this.requestData(this.whereObject['pageNum']);
this.closeBatchDiscountConfigModal();
} else {
this.modal.error({
nzTitle: '提示', nzTitle: '提示',
nzContent: data['return_msg'], nzContent: data['return_msg'],
}); });
@ -562,10 +659,67 @@ export class PetrolStationManageComponent implements OnInit {
} }
/** /**
* *
*/ */
closeDiscountConfigModal() { showBatchConfigOilNoModal() {
this.discountConfigModal = false; this.batchConfigOilNoModal = true;
}
/**
*
*/
closeBatchConfigOilNoModal() {
this.batchConfigOilNoModal = false;
}
/**
*
*/
submitBatchConfigOilNo() {
for (const i in this.batchConfigOilNoForm.controls) {
this.batchConfigOilNoForm.controls[i].markAsDirty();
this.batchConfigOilNoForm.controls[i].updateValueAndValidity();
}
if (this.batchConfigOilNoForm.status == null || this.batchConfigOilNoForm.status !== 'VALID') {
this.modal.warning({
nzTitle: '提示',
nzContent: '有必填项未填写',
});
return;
}
if (this.checkedData.length === 0) {
this.modal.warning({
nzTitle: '提示',
nzContent: '请勾选油站',
});
return;
}
this.loadingObject.spinning = true;
this.loadingObject.msg = '处理中...';
this.batchDiscountConfigModal = false;
const oilStationList = [];
for (const data of this.checkedData) {
oilStationList.push({ oilStationId: data['storeId'] });
}
this.batchConfigOilNoForm.value['oilStationList'] = oilStationList;
this.tyAgentPriceService.batchConfigOilNo(this.batchConfigOilNoForm.value, data => {
this.loadingObject.spinning = false;
if (data['return_code'] === '000000') {
this.modal.success({
nzTitle: '提示',
nzContent: '处理成功',
});
this.checkedData = [];
this.requestData(this.whereObject['pageNum']);
this.closeBatchConfigOilNoModal();
} else {
this.modal.error({
nzTitle: '提示',
nzContent: data['return_msg'],
});
}
});
} }
/** /**
@ -578,6 +732,15 @@ export class PetrolStationManageComponent implements OnInit {
nzContent: '没有配置优惠数据' nzContent: '没有配置优惠数据'
}); });
} }
if (this.roleType === 5) {
for (const data of this.discountConfigData) {
data['belongType'] = 1;
}
} else {
for (const data of this.discountConfigData) {
data['belongType'] = 2;
}
}
this.tyAgentPriceService.editPrice(this.discountConfigData, data => { this.tyAgentPriceService.editPrice(this.discountConfigData, data => {
if (data['return_code'] === '000000') { if (data['return_code'] === '000000') {
this.modal.success({ this.modal.success({
@ -595,6 +758,21 @@ export class PetrolStationManageComponent implements OnInit {
}); });
} }
/**
*
*/
showOilConfigModal(oilStationId: number) {
this.getOilStationPrice(oilStationId);
this.oilConfigModal = true;
}
/**
*
*/
closeOilConfigModal() {
this.oilConfigModal = false;
}
/** /**
* *
* @param data * @param data
@ -636,13 +814,86 @@ export class PetrolStationManageComponent implements OnInit {
} }
} }
/**
*
*/
showOilDisabledConfirm(oilStationId: number, oilNo: string): void {
this.modal.confirm({
nzTitle: '警告',
nzContent: '确定要暂停销售该油品吗',
nzOkText: '是',
nzCancelText: '否',
nzOkType: 'danger',
nzOnOk: () => this.submitOilDisabled(oilStationId, oilNo)
});
}
submitOilDisabled(oilStationId: number, oilNo: string) {
this.gasService.disabledOil({ storeId: oilStationId, oilNo: oilNo }, data => {
if (data['return_code'] === '000000') {
this.modal.success({
nzTitle: '提示',
nzContent: data['return_data'],
});
this.getOilStationPrice(oilStationId);
} else {
this.modal.warning({
nzTitle: '提示',
nzContent: data['return_msg'],
});
}
});
}
/**
*
*/
showOilEnableConfirm(oilStationId: number, oilNo: string): void {
this.gasService.enableOil({ storeId: oilStationId, oilNo: oilNo }, data => {
if (data['return_code'] === '000000') {
this.modal.success({
nzTitle: '提示',
nzContent: data['return_data'],
});
this.getOilStationPrice(oilStationId);
} else {
this.modal.warning({
nzTitle: '提示',
nzContent: data['return_msg'],
});
}
});
}
/**
*
* @param oilStationId
*/
getOilStationPrice(oilStationId: number) {
let belongType = 2;
if (this.roleType === 5) {
belongType = 1;
}
this.tyAgentPriceService.getOilStationPrice(belongType, oilStationId, data => {
if (data['return_code'] === '000000') {
this.discountConfigData = data['return_data'];
} else {
this.modal.warning({
nzTitle: '提示',
nzContent: data['return_msg'],
});
}
});
}
} }
export class PetrolStationManage { export class PetrolStationManage {
belongType: number;
oilStationId: number; oilStationId: number;
lowPrice: number; lowPrice: number;
oilNo: string; oilNo: string;
oilNoName: string; oilNoName: string;
priceRate: number; priceRate: number;
status: number;
} }

@ -0,0 +1,39 @@
import { Injectable } from '@angular/core';
import {HttpClient} from '_@angular_common@9.0.7@@angular/common/http';
import {CommonsService} from './commons.service';
import {environment} from "../../environments/environment";
@Injectable({
providedIn: 'root'
})
export class GasService {
constructor(
private http: HttpClient,
private common: CommonsService
) { }
/**
*
*
* @param param
* @param callBack
*/
public disabledOil(param: object, callBack) {
this.http.post(environment.baseUrl + 'highGas/disabledOil', param).subscribe(data => {
callBack(data);
});
}
/**
*
*
* @param param
* @param callBack
*/
public enableOil(param: object, callBack) {
this.http.post(environment.baseUrl + 'highGas/enableOil', param).subscribe(data => {
callBack(data);
});
}
}

@ -24,14 +24,37 @@ export class TyAgentPriceService {
}); });
} }
/**
*
* @param paramObject
* @param callBack
*/
batchConfigPrice(paramObject: object, callBack) {
this.http.post(environment.baseUrl + 'tyAgentPrice/batchConfigPrice', paramObject).subscribe(data => {
callBack(data);
});
}
/**
*
* @param paramObject
* @param callBack
*/
batchConfigOilNo(paramObject: object, callBack) {
this.http.post(environment.baseUrl + 'tyAgentPrice/batchConfigOilNo', paramObject).subscribe(data => {
callBack(data);
});
}
/** /**
* *
* @param paramObject * @param paramObject
* @param callBack * @param callBack
*/ */
getOilStationPrice(oilStationId: number, callBack) { getOilStationPrice(belongType: number, oilStationId: number, callBack) {
this.http.get(environment.baseUrl + 'tyAgentPrice/getOilStationPrice?oilStationId=' + oilStationId).subscribe(data => { this.http.get(environment.baseUrl + 'tyAgentPrice/getOilStationPrice?belongType=' + belongType + '&oilStationId=' + oilStationId).subscribe(data => {
callBack(data); callBack(data);
}); });
} }
} }

Loading…
Cancel
Save