parent
33b64fdeec
commit
c213e97d64
@ -1 +1,143 @@ |
||||
<p>order-st works!</p> |
||||
<!-- start 面包屑 --> |
||||
<nz-breadcrumb> |
||||
<nz-breadcrumb-item> |
||||
团油订单统计 |
||||
</nz-breadcrumb-item> |
||||
</nz-breadcrumb> |
||||
<!-- end 面包屑 --> |
||||
|
||||
<!--条件搜索--> |
||||
<!--条件搜索--> |
||||
<div class="inner-content"> |
||||
<form nz-form [formGroup]="searchForm" (ngSubmit)="getRequest(true , searchForm.value)"> |
||||
<div nz-row> |
||||
<div nz-col nzSpan="8"> |
||||
<nz-form-item> |
||||
<nz-form-label [nzSpan]="6">时间区间</nz-form-label> |
||||
<nz-form-control [nzSpan]="16"> |
||||
<nz-range-picker [nzShowTime]="{ nzFormat: 'HH:mm' }" formControlName="createTime"></nz-range-picker> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
<div nz-col nzSpan="8" *ngIf="roleType == 5 && adminFlag == 1"> |
||||
<nz-form-item> |
||||
<nz-form-label [nzSpan]="6">部门</nz-form-label> |
||||
<nz-form-control [nzSpan]="16"> |
||||
<nz-select nzShowSearch nzAllowClear nzPlaceHolder="请选择选择部门" formControlName="organizationId" (ngModelChange)="getAgentList($event)"> |
||||
<nz-option *ngFor="let item of companyData" nzValue="{{item.id}}" nzLabel="{{item.name}}"></nz-option> |
||||
</nz-select> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
<div nz-col nzSpan="8" *ngIf="roleType == 5"> |
||||
<nz-form-item> |
||||
<nz-form-label [nzSpan]="6">代理商</nz-form-label> |
||||
<nz-form-control [nzSpan]="16"> |
||||
<nz-select nzShowSearch nzAllowClear nzPlaceHolder="请选择代理商" formControlName="agentId" (ngModelChange)="getSalesmanList($event)"> |
||||
<nz-option *ngFor="let item of agentData" nzValue="{{item.id}}" nzLabel="{{item.agentName}}"></nz-option> |
||||
</nz-select> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
<div nz-col nzSpan="8" *ngIf="roleType == 5 || roleType == 8"> |
||||
<nz-form-item> |
||||
<nz-form-label [nzSpan]="6">业务员</nz-form-label> |
||||
<nz-form-control [nzSpan]="16"> |
||||
<nz-select nzShowSearch nzAllowClear nzPlaceHolder="请选择业务员" formControlName="gasSalesmanId" (ngModelChange)="getSalesmanList($event)"> |
||||
<nz-option *ngFor="let item of salesmanData" nzValue="{{item.id}}" nzLabel="{{item.salesmanName}}"></nz-option> |
||||
</nz-select> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
<div nz-col nzSpan="8"> |
||||
<nz-form-item> |
||||
<nz-form-label [nzSpan]="6">支付类型</nz-form-label> |
||||
<nz-form-control [nzSpan]="16"> |
||||
<nz-select nzShowSearch nzAllowClear nzPlaceHolder="请选择支付类型" formControlName="payType" > |
||||
<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="8"> |
||||
<nz-form-item> |
||||
<nz-form-label [nzSpan]="6">油号</nz-form-label> |
||||
<nz-form-control [nzSpan]="16"> |
||||
<nz-select nzShowSearch nzAllowClear nzPlaceHolder="请选择油号" formControlName="gasOilNo" > |
||||
<nz-option nzValue="0" nzLabel="0"></nz-option> |
||||
<nz-option nzValue="92" nzLabel="92"></nz-option> |
||||
<nz-option nzValue="95" nzLabel="95"></nz-option> |
||||
<nz-option nzValue="98" nzLabel="98"></nz-option> |
||||
</nz-select> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
<div nz-col nzSpan="8"> |
||||
<nz-form-item> |
||||
<nz-form-label [nzSpan]="6">油品类型</nz-form-label> |
||||
<nz-form-control [nzSpan]="16"> |
||||
<nz-select nzShowSearch nzAllowClear nzPlaceHolder="请选择油品类型" formControlName="gasOilType" > |
||||
<nz-option nzValue="1" nzLabel="汽油"></nz-option> |
||||
<nz-option nzValue="2" nzLabel="柴油"></nz-option> |
||||
<nz-option nzValue="3" nzLabel="天然气"></nz-option> |
||||
</nz-select> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
</div> |
||||
|
||||
<div nz-row> |
||||
<div nz-col nzSpan="24" class="search-button"> |
||||
<button nz-button nzType="primary"><i nz-icon nzType="search" nzTheme="outline"></i>搜索</button> |
||||
<button nz-button nzType="default" (click)="resetForm()"><i nz-icon nzType="reload" nzTheme="outline"></i>重置</button> |
||||
</div> |
||||
</div> |
||||
</form> |
||||
</div> |
||||
|
||||
|
||||
<!--渠道公司--> |
||||
<div class="inner-content" > |
||||
|
||||
<div nz-row style="margin-top: 20px;" [nzGutter]="16"> |
||||
<div nz-col nzSpan="6"> |
||||
<nz-card nzHoverable [nzLoading]="loading"> |
||||
<p>团油订单金额(元)</p> |
||||
<h2>¥{{requestData['orderPrice'] == null ? 0 :requestData['orderPrice']}}</h2> |
||||
</nz-card> |
||||
</div> |
||||
<div nz-col nzSpan="6"> |
||||
<nz-card nzHoverable [nzLoading]="loading"> |
||||
<p>团油交易金额(元)</p> |
||||
<h2>¥{{requestData['tradePrice'] == null ? 0 :requestData['tradePrice']}}</h2> |
||||
</nz-card> |
||||
</div> |
||||
<div nz-col nzSpan="6"> |
||||
<nz-card nzHoverable [nzLoading]="loading"> |
||||
<p>团油优惠金额(元)</p> |
||||
<h2>¥{{requestData['discountedPrice'] == null ? 0 :requestData['discountedPrice']}}</h2> |
||||
</nz-card> |
||||
</div> |
||||
<div nz-col nzSpan="6"> |
||||
<nz-card nzHoverable [nzLoading]="loading"> |
||||
<p>团油订单数量(笔)</p> |
||||
<h2>{{requestData['orderNum'] == null ? 0 :requestData['orderNum']}}</h2> |
||||
</nz-card> |
||||
</div> |
||||
|
||||
</div> |
||||
<div nz-row style="margin-top: 20px;" [nzGutter]="16"> |
||||
<div nz-col nzSpan="8"> |
||||
<div style="margin-top: 20px" echarts [options]="priceData"></div> |
||||
</div> |
||||
<div nz-col nzSpan="8"> |
||||
<div style="margin-top: 20px" echarts [options]="payTypeData"></div> |
||||
</div> |
||||
<div nz-col nzSpan="8"> |
||||
<div style="margin-top: 20px" echarts [options]="gasOilNoData"></div> |
||||
</div> |
||||
|
||||
</div> |
||||
</div> |
||||
|
||||
|
@ -1,25 +0,0 @@ |
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; |
||||
|
||||
import { OrderStComponent } from './order-st.component'; |
||||
|
||||
describe('OrderStComponent', () => { |
||||
let component: OrderStComponent; |
||||
let fixture: ComponentFixture<OrderStComponent>; |
||||
|
||||
beforeEach(async(() => { |
||||
TestBed.configureTestingModule({ |
||||
declarations: [ OrderStComponent ] |
||||
}) |
||||
.compileComponents(); |
||||
})); |
||||
|
||||
beforeEach(() => { |
||||
fixture = TestBed.createComponent(OrderStComponent); |
||||
component = fixture.componentInstance; |
||||
fixture.detectChanges(); |
||||
}); |
||||
|
||||
it('should create', () => { |
||||
expect(component).toBeTruthy(); |
||||
}); |
||||
}); |
@ -1,15 +1,230 @@ |
||||
import { Component, OnInit } from '@angular/core'; |
||||
import {Component, OnInit} from '@angular/core'; |
||||
import {FormBuilder, FormGroup} from '_@angular_forms@9.0.7@@angular/forms'; |
||||
import {AuditService} from '../../../services/audit.service'; |
||||
import {IconService} from '../../../services/icon.service'; |
||||
import {NzMessageService} from '_ng-zorro-antd@9.3.0@ng-zorro-antd'; |
||||
import {CommonsService} from '../../../services/commons.service'; |
||||
import {ADMIN_INFO_OBJECT} from '../../../services/local-storage.namespace'; |
||||
import {LocalStorageService} from '../../../services/local-storage.service'; |
||||
import {TyAgentService} from '../../../services/ty-agent.service'; |
||||
import {TySalesmanService} from '../../../services/ty-salesman.service'; |
||||
import {OrderService} from '../../../services/order.service'; |
||||
|
||||
@Component({ |
||||
selector: 'app-order-st', |
||||
templateUrl: './order-st.component.html', |
||||
styleUrls: ['./order-st.component.scss'] |
||||
selector: 'app-order-st', |
||||
templateUrl: './order-st.component.html', |
||||
styleUrls: ['./order-st.component.scss'] |
||||
}) |
||||
export class OrderStComponent implements OnInit { |
||||
searchForm: FormGroup; // 搜索框
|
||||
loading = true; |
||||
requestData = {}; // 列表数据
|
||||
roleType: number; // 角色类型
|
||||
adminFlag: number; // 是否主角色 1 是 0 不是
|
||||
companyData = []; |
||||
agentData = []; |
||||
salesmanData = []; |
||||
priceData: any = {}; |
||||
payTypeData: any = {}; |
||||
gasOilNoData: any = {}; |
||||
|
||||
constructor() { } |
||||
constructor( |
||||
private form: FormBuilder, |
||||
private audit: AuditService, |
||||
private iconService: IconService, |
||||
private message: NzMessageService, |
||||
private store: LocalStorageService, // 数据缓存
|
||||
private order: OrderService, |
||||
private tyAgentService: TyAgentService, |
||||
private tySalesmanService: TySalesmanService, |
||||
private common: CommonsService, |
||||
) { |
||||
} |
||||
|
||||
ngOnInit(): void { |
||||
} |
||||
ngOnInit(): void { |
||||
this.roleType = this.store.get(ADMIN_INFO_OBJECT)['secRole']['roleType']; |
||||
this.adminFlag = this.store.get(ADMIN_INFO_OBJECT)['secUser']['adminFlag']; |
||||
this.searchForm = this.form.group({ |
||||
createTime: [null], |
||||
organizationId: [null], |
||||
agentId: [null], |
||||
gasSalesmanId: [null], |
||||
payType: [null], |
||||
gasOilNo: [null], |
||||
gasOilType: [null], |
||||
}); |
||||
this.getRequest(true, this.searchForm.value); |
||||
|
||||
if (this.adminFlag == 1 && this.roleType == 5) { |
||||
const object = { |
||||
companyId: this.store.get(ADMIN_INFO_OBJECT)['bsCompany'].id, |
||||
}; |
||||
this.common.getOrganizationList(object, data => { |
||||
if (data['return_code'] === '000000') { |
||||
this.companyData = data['return_data']; |
||||
} else { |
||||
this.message.error('查询公司失败'); |
||||
} |
||||
}); |
||||
} else if (this.adminFlag == 0 && this.roleType == 5) { |
||||
this.getAgentList(this.store.get(ADMIN_INFO_OBJECT)['bsOrganization']['id']); |
||||
} else if (this.roleType == 8) { |
||||
this.getSalesmanList(this.store.get(ADMIN_INFO_OBJECT)['highTyAgent']['id']); |
||||
} |
||||
|
||||
} |
||||
|
||||
// 查询列表
|
||||
public getRequest(reset: boolean = false, whereObject: object) { |
||||
this.loading = true; |
||||
if (whereObject['createTime'] != null && whereObject['createTime'].length !== 0) { |
||||
whereObject['createTimeS'] = whereObject['createTime'][0].getTime(); |
||||
whereObject['createTimeE'] = whereObject['createTime'][1].getTime(); |
||||
} |
||||
|
||||
if (this.roleType == 5 && this.adminFlag == 0) { |
||||
console.log(this.store.get(ADMIN_INFO_OBJECT)); |
||||
whereObject['organizationId'] = this.store.get(ADMIN_INFO_OBJECT)['bsOrganization']['id']; |
||||
} |
||||
if (this.roleType == 8) { |
||||
whereObject['agentId'] = this.store.get(ADMIN_INFO_OBJECT)['highTyAgent']['id']; |
||||
} |
||||
if (this.roleType == 9) { |
||||
whereObject['gasSalesmanId'] = this.store.get(ADMIN_INFO_OBJECT)['highTySalesman']['id']; |
||||
} |
||||
|
||||
this.order.TyOrderStatistics(whereObject, data => { |
||||
this.loading = false; |
||||
if (data['return_code'] === '000000') { |
||||
this.requestData = data['return_data']; |
||||
this.getPieChart(this.requestData); |
||||
} else { |
||||
this.message.error(data['return_msg']); |
||||
} |
||||
}); |
||||
|
||||
} |
||||
|
||||
// 重置
|
||||
public resetForm(): void { |
||||
this.searchForm.reset(); |
||||
} |
||||
|
||||
// 查询代理商
|
||||
public getAgentList(e): void { |
||||
if (e != null) { |
||||
const object = { |
||||
orgId: e, |
||||
pageNum: 1, |
||||
pageSize: 10000 |
||||
}; |
||||
this.tyAgentService.getAgentList(object, data => { |
||||
if (data['return_code'] === '000000') { |
||||
this.agentData = data['return_data'].list; |
||||
} else { |
||||
this.message.error('查询代理商失败'); |
||||
} |
||||
}); |
||||
} |
||||
} |
||||
|
||||
// 查询业务员
|
||||
public getSalesmanList(e): void { |
||||
if (e != null) { |
||||
const object = { |
||||
tyAgentId: e, |
||||
pageNum: 1, |
||||
pageSize: 10000 |
||||
}; |
||||
this.tySalesmanService.getSalesmanList(object, data => { |
||||
if (data['return_code'] === '000000') { |
||||
this.salesmanData = data['return_data'].list; |
||||
} else { |
||||
this.message.error('查询代理商失败'); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
} |
||||
|
||||
|
||||
// 饼状图
|
||||
public getPieChart(data) { |
||||
// 交易金额分布图
|
||||
this.priceData = { |
||||
title: { |
||||
text: '交易金额分布图', |
||||
left: 'center' |
||||
}, |
||||
tooltip: { |
||||
trigger: 'item' |
||||
}, |
||||
series: [ |
||||
{ |
||||
name: '金额分布', |
||||
type: 'pie', |
||||
radius: '50%', |
||||
data: data['priceGorp'], |
||||
emphasis: { |
||||
itemStyle: { |
||||
shadowBlur: 10, |
||||
shadowOffsetX: 0, |
||||
shadowColor: 'rgba(0, 0, 0, 0.5)' |
||||
} |
||||
} |
||||
} |
||||
] |
||||
}; |
||||
// 交易金额分布图
|
||||
this.payTypeData = { |
||||
title: { |
||||
text: '交易方式分布图', |
||||
left: 'center' |
||||
}, |
||||
tooltip: { |
||||
trigger: 'item' |
||||
}, |
||||
series: [ |
||||
{ |
||||
name: '交易方式分布', |
||||
type: 'pie', |
||||
radius: '50%', |
||||
data: data['payTypeGorp'], |
||||
emphasis: { |
||||
itemStyle: { |
||||
shadowBlur: 10, |
||||
shadowOffsetX: 0, |
||||
shadowColor: 'rgba(0, 0, 0, 0.5)' |
||||
} |
||||
} |
||||
} |
||||
] |
||||
}; |
||||
// 交易金额分布图
|
||||
this.gasOilNoData = { |
||||
title: { |
||||
text: '交易类型分布图', |
||||
left: 'center' |
||||
}, |
||||
tooltip: { |
||||
trigger: 'item' |
||||
}, |
||||
series: [ |
||||
{ |
||||
name: '交易类型分布', |
||||
type: 'pie', |
||||
radius: '50%', |
||||
data: data['gasOilNoGorp'], |
||||
emphasis: { |
||||
itemStyle: { |
||||
shadowBlur: 10, |
||||
shadowOffsetX: 0, |
||||
shadowColor: 'rgba(0, 0, 0, 0.5)' |
||||
} |
||||
} |
||||
} |
||||
] |
||||
}; |
||||
} |
||||
|
||||
} |
||||
|
Loading…
Reference in new issue