From 650d39e5b66e6e062dd294304dcefcac848d72e2 Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Sun, 17 Apr 2022 20:11:36 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../company-amount-record.component.html | 2 +- .../navigation/navigation.component.html | 97 +++++ .../admin/navigation/navigation.component.ts | 129 +++++- .../oil-card-list.component.html | 252 +++++++++++ .../oil-card-list.component.scss | 3 + .../oil-card-list.component.spec.ts | 25 ++ .../oil-card-list/oil-card-list.component.ts | 390 ++++++++++++++++++ .../admin/oil-card/oil-card-routing.module.ts | 13 + src/app/admin/oil-card/oil-card.module.ts | 26 ++ src/app/app-common.module.ts | 5 +- src/app/app-routing.module.ts | 5 + src/app/pipes/index.ts | 2 + .../oil-card/oil-card-bind-status.pipe.ts | 16 + .../pipes/oil-card/oil-card-status.pipe.ts | 19 + src/app/services/company-two-pwd.service.ts | 51 +++ src/app/services/oil-card.service.ts | 87 ++++ 16 files changed, 1119 insertions(+), 3 deletions(-) create mode 100644 src/app/admin/oil-card/oil-card-list/oil-card-list.component.html create mode 100644 src/app/admin/oil-card/oil-card-list/oil-card-list.component.scss create mode 100644 src/app/admin/oil-card/oil-card-list/oil-card-list.component.spec.ts create mode 100644 src/app/admin/oil-card/oil-card-list/oil-card-list.component.ts create mode 100644 src/app/admin/oil-card/oil-card-routing.module.ts create mode 100644 src/app/admin/oil-card/oil-card.module.ts create mode 100644 src/app/pipes/oil-card/oil-card-bind-status.pipe.ts create mode 100644 src/app/pipes/oil-card/oil-card-status.pipe.ts create mode 100644 src/app/services/company-two-pwd.service.ts create mode 100644 src/app/services/oil-card.service.ts diff --git a/src/app/admin/company-amount/company-amount-record/company-amount-record.component.html b/src/app/admin/company-amount/company-amount-record/company-amount-record.component.html index f919059..e28e969 100644 --- a/src/app/admin/company-amount/company-amount-record/company-amount-record.component.html +++ b/src/app/admin/company-amount/company-amount-record/company-amount-record.component.html @@ -8,7 +8,7 @@
- 代理商编号 + 部门 diff --git a/src/app/admin/navigation/navigation.component.html b/src/app/admin/navigation/navigation.component.html index 79e73dd..5af70ef 100644 --- a/src/app/admin/navigation/navigation.component.html +++ b/src/app/admin/navigation/navigation.component.html @@ -38,6 +38,9 @@
  • 修改密码
  • +
  • + 二级密码 +
  • 退出
  • @@ -101,3 +104,97 @@ + + +
    + + + 密码 + + + + + + + + + + + + + 确认密码 + + + + + 您输入的两个密码不一致! + + + + + + + + + +
    + +
    + + +
    + + + 旧密码 + + + + + + + + 新密码 + + + + + + + + + + + + + 确认新密码 + + + + + 您输入的两个密码不一致! + + + + + + + + + +
    + +
    diff --git a/src/app/admin/navigation/navigation.component.ts b/src/app/admin/navigation/navigation.component.ts index 1ac22db..2b489ac 100644 --- a/src/app/admin/navigation/navigation.component.ts +++ b/src/app/admin/navigation/navigation.component.ts @@ -5,13 +5,13 @@ import {LoginService} from '../../services/login.service'; import {NzMessageService, NzModalService} from 'ng-zorro-antd'; import {Router} from '@angular/router'; import {IconService} from '../../services/icon.service'; -import {RechargeService} from '../../services/recharge.service'; import {CommonsService} from '../../services/commons.service'; import {FormBuilder, FormControl, FormGroup, Validators} from '@angular/forms'; import {ValidatorsService} from '../../services/validators.service'; import {Md5} from 'ts-md5'; import {environment} from '../../../environments/environment'; import {HttpClient} from '@angular/common/http'; +import {CompanyTwoPwdService} from '../../services/company-two-pwd.service'; @Component({ selector: 'app-navigation', @@ -24,6 +24,12 @@ export class NavigationComponent implements OnInit { validateForm: FormGroup; // 定义表单 passwordVisible = false; + setTwoPwdVisible = false; + setTwoPwdForm: FormGroup; // 定义表单 + + updateTwoPwdVisible = false; + updateTwoPwdForm: FormGroup; // 定义表单 + isCollapsed = false; userInfo: any; menuList: any; @@ -34,6 +40,7 @@ export class NavigationComponent implements OnInit { private loginService: LoginService, private message: NzMessageService, private commonsService: CommonsService, + private companyTwoPwdService: CompanyTwoPwdService, private http: HttpClient, // http请求 private iconService: IconService, private modal: NzModalService, @@ -48,6 +55,17 @@ export class NavigationComponent implements OnInit { checkNewPassword: [null, [Validators.required, this.checkPwd]], }); + this.setTwoPwdForm = this.fb.group({ + password: [null, [Validators.required, ValidatorsService.minLength(6), ValidatorsService.maxLength(16)]], + checkPassword: [null, [Validators.required, this.checkSetTowPwd]], + }); + + this.updateTwoPwdForm = this.fb.group({ + oldPassword: [null, [Validators.required, ValidatorsService.minLength(6), ValidatorsService.maxLength(16)]], + newPassword: [null, [Validators.required, ValidatorsService.minLength(6), ValidatorsService.maxLength(16)]], + checkNewPassword: [null, [Validators.required, this.checkUpdateTowPwd]], + }); + this.routeName = this.storage.get(ROUTENAME) == null ? 'index' : this.storage.get(ROUTENAME); this.userInfo = this.storage.getList(ADMIN_INFO_OBJECT); this.commonsService.mappingSysNameOl('RECHARGE', data => { @@ -169,5 +187,114 @@ export class NavigationComponent implements OnInit { return {}; } + // 设置密码 + setTowPwd() { + this.companyTwoPwdService.isSetTwoPwd(data => { + if (data['return_data'] === true) { + this.openUpdateTowPwd(); + } else { + this.openSetTowPwd(); + } + }); + } + + // 打开设置二级密码抽屉 + openSetTowPwd(): void { + this.setTwoPwdVisible = true; + } + + // 关闭设置二级密码抽屉 + closeSetTowPwd(): void { + this.setTwoPwdVisible = false; + this.setTwoPwdForm.reset(); + } + + // 提交二级密码 + submitSetTowPwd(): void { + for (const i in this.setTwoPwdForm.controls) { + this.setTwoPwdForm.controls[i].markAsDirty(); + this.setTwoPwdForm.controls[i].updateValueAndValidity(); + } + if (this.setTwoPwdForm.status == null || this.setTwoPwdForm.status !== 'VALID') { + this.modal.warning({ + nzTitle: '提示', + nzContent: '请规范填写所有的必填项信息', + }); + return; + } + this.companyTwoPwdService.setTwoPwd(this.setTwoPwdForm.value, data => { + if (data['return_code'] === '000000') { + this.modal.success({ + nzTitle: '提示', + nzContent: '设置成功', + }); + this.closeSetTowPwd(); + } else { + this.modal.error({ + nzTitle: '提示', + nzContent: data['return_msg'], + }); + } + }); + } + + checkSetTowPwd = (control: FormControl): { [s: string]: boolean } => { + if (!control.value) { + return { required: true }; + } else if (control.value !== this.setTwoPwdForm.controls.password.value) { + return { confirm: true, error: true }; + } + return {}; + } + + // 打开修改二级密码抽屉 + openUpdateTowPwd(): void { + this.updateTwoPwdVisible = true; + } + + // 关闭修改二级密码抽屉 + closeUpdateTowPwd(): void { + this.updateTwoPwdVisible = false; + this.updateTwoPwdForm.reset(); + } + + // 提交二级密码 + submitUpdateTowPwd(): void { + for (const i in this.updateTwoPwdForm.controls) { + this.updateTwoPwdForm.controls[i].markAsDirty(); + this.updateTwoPwdForm.controls[i].updateValueAndValidity(); + } + if (this.updateTwoPwdForm.status == null || this.updateTwoPwdForm.status !== 'VALID') { + this.modal.warning({ + nzTitle: '提示', + nzContent: '请规范填写所有的必填项信息', + }); + return; + } + this.companyTwoPwdService.updateTwoPwd(this.updateTwoPwdForm.value, data => { + if (data['return_code'] === '000000') { + this.modal.success({ + nzTitle: '提示', + nzContent: '修改成功', + }); + this.closeUpdateTowPwd(); + } else { + this.modal.error({ + nzTitle: '提示', + nzContent: data['return_msg'], + }); + } + }); + } + + checkUpdateTowPwd = (control: FormControl): { [s: string]: boolean } => { + if (!control.value) { + return { required: true }; + } else if (control.value !== this.updateTwoPwdForm.controls.newPassword.value) { + return { confirm: true, error: true }; + } + return {}; + } + } diff --git a/src/app/admin/oil-card/oil-card-list/oil-card-list.component.html b/src/app/admin/oil-card/oil-card-list/oil-card-list.component.html new file mode 100644 index 0000000..fdedf1c --- /dev/null +++ b/src/app/admin/oil-card/oil-card-list/oil-card-list.component.html @@ -0,0 +1,252 @@ + + + + + + +
    +
    +
    +
    + + 部门 + + + + + + +
    + +
    + + 卡号 + + + + +
    + +
    + + 联系人 + + + + +
    + +
    + + 联系电话 + + + + +
    + +
    + + 油卡状态 + + + + + + + +
    + +
    + + 联系人设置 + + + + + + + +
    + +
    + + 绑定状态 + + + + + + + +
    + +
    + + 绑定时间 + + + + +
    + +
    + + 生成时间 + + + + +
    + +
    + +
    +
    + + +
    +
    +
    +
    + +
    +
    + + + + + +
    + 共计 {{dataObject.total?dataObject.total:0}} 条数据 +
    + +
    + + + + + + 序号 + 部门 + 卡号 + 余额 + 联系人 + 联系电话 + 油卡状态 + 绑定状态 + 绑定时间 + 操作人 + 生成时间 + 操作 + + + + + {{i+1}} + {{data.orgName}} + {{data.cardNo}} + ¥{{data.amount}} + {{data.contactName?data.contactName:'未设置'}} + {{data.contactPhone?data.contactPhone:'未设置'}} + {{data.status | oilCardStatus}} + {{data.bindStatus | oilCardBindStatus}} + + {{data.bindTime | date : 'yyyy-MM-dd HH:mm:ss'}} + 未绑定 + {{data.opUserName}} + {{data.createTime | date : 'yyyy-MM-dd HH:mm:ss'}} + + 充值 + 操作列表 + + + + + + + +
    +
    + + +
    + + 生成数量 + + + + +
    + +
    +
    +
    + + +
    + + 联系人 + + + + + + 联系电话 + + + + +
    + +
    +
    +
    + + +
    + + 卡号 + + + + + + 充值金额 + + + + + + 二级密码 + + + + +
    + +
    +
    +
    diff --git a/src/app/admin/oil-card/oil-card-list/oil-card-list.component.scss b/src/app/admin/oil-card/oil-card-list/oil-card-list.component.scss new file mode 100644 index 0000000..690993b --- /dev/null +++ b/src/app/admin/oil-card/oil-card-list/oil-card-list.component.scss @@ -0,0 +1,3 @@ +.table-td-operation a { + padding: 0px 5px; +} diff --git a/src/app/admin/oil-card/oil-card-list/oil-card-list.component.spec.ts b/src/app/admin/oil-card/oil-card-list/oil-card-list.component.spec.ts new file mode 100644 index 0000000..96f7030 --- /dev/null +++ b/src/app/admin/oil-card/oil-card-list/oil-card-list.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { OilCardListComponent } from './oil-card-list.component'; + +describe('OilCardListComponent', () => { + let component: OilCardListComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ OilCardListComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(OilCardListComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/admin/oil-card/oil-card-list/oil-card-list.component.ts b/src/app/admin/oil-card/oil-card-list/oil-card-list.component.ts new file mode 100644 index 0000000..373a563 --- /dev/null +++ b/src/app/admin/oil-card/oil-card-list/oil-card-list.component.ts @@ -0,0 +1,390 @@ +import { Component, OnInit } from '@angular/core'; +import {FormBuilder, FormGroup, Validators} from '_@angular_forms@9.0.7@@angular/forms'; +import {NzMessageService, NzModalService} from '_ng-zorro-antd@9.3.0@ng-zorro-antd'; +import {LocalStorageService} from '../../../services/local-storage.service'; +import {ADMIN_INFO_OBJECT} from '../../../services/local-storage.namespace'; +import {OilCardService} from '../../../services/oil-card.service'; +import {CompanyAccountService} from '../../../services/company-account.service'; +import {OrganizationService} from "../../../services/organization.service"; +import {NavigationComponent} from "../../navigation/navigation.component"; + +@Component({ + selector: 'app-oil-card-list', + templateUrl: './oil-card-list.component.html', + styleUrls: ['./oil-card-list.component.scss'] +}) +export class OilCardListComponent implements OnInit { + roleType; + adminFlag; + loadingObject = { + spinning: false, + msg: '加载中' + }; + + dataObject: any = {}; + tableLoading = true; + searchForm: FormGroup; + pageNum: number; + whereObject: any = {}; + + generateCardModal = false; + generateCardForm: FormGroup; + + editContactModal = false; + editContactForm: FormGroup; + + rechargeModal = false; + rechargeForm: FormGroup; + + orgArray = []; + accountObject = { + amounts: 0 + }; + + constructor(private modal: NzModalService, + private message: NzMessageService, + private store: LocalStorageService, + private oilCardService: OilCardService, + private organizationService: OrganizationService, + private navigationComponent: NavigationComponent, + private companyAccountService: CompanyAccountService, + private form: FormBuilder) { + this.roleType = Number(this.store.get(ADMIN_INFO_OBJECT)['secRole'].roleType); + this.adminFlag = Number(this.store.get(ADMIN_INFO_OBJECT)['secUser'].adminFlag); + } + + ngOnInit(): void { + this.searchForm = this.form.group({ + orgId: [null], + cardNo: [null], + contactName: [null], + contactPhone: [null], + createTime: [null], + createTimeS: [null], + createTimeE: [null], + bindTime: [null], + bindTimeS: [null], + bindTimeE: [null], + isConfigContact: [null], + status: [null], + bindStatus: [null], + }); + + this.editContactForm = this.form.group({ + cardNo: [null, [Validators.required]], + contactName: [null, [Validators.required]], + contactPhone: [null, [Validators.required]], + }); + + this.generateCardForm = this.form.group({ + generateNum: [1, [Validators.required]], + }); + + this.rechargeForm = this.form.group({ + cardNo: [{ value: null, disabled: true }, [Validators.required]], + price: [100, [Validators.required]], + twoPwd: [null, [Validators.required]], + }); + + if (this.roleType === 5 && this.adminFlag === 1) { + this.organizationService.getOrganizationList(this.store.get(ADMIN_INFO_OBJECT)['bsCompany']['id'], data => { + this.orgArray = data['return_data']; + }); + } + + if (this.roleType === 5 && this.adminFlag === 0) { + this.getAccount(); + } + this.requestData(1); + } + + /** + * 请求数据 + */ + requestData(pageNum) { + this.tableLoading = true; + this.whereObject['pageNum'] = pageNum; + this.whereObject['pageSize'] = 10; + this.oilCardService.getCardList(this.whereObject, data => { + if (data['return_code'] === '000000') { + this.dataObject = data['return_data']; + } else { + this.modal.error(data['return_msg']); + } + this.tableLoading = false; + }); + } + + /** + * 查询账户 + */ + getAccount() { + this.companyAccountService.getAccount(data => { + this.accountObject = data['return_data']; + }); + } + + /** + * 搜索 + * @param whereObject 条件 + */ + search(whereObject: object) { + this.whereObject = whereObject; + if (this.searchForm.value.createTime != null) { + this.searchForm.value.createTimeS = new Date(this.searchForm.value.createTime[0]).getTime(); + this.searchForm.value.createTimeE = new Date(this.searchForm.value.createTime[1]).getTime(); + } else { + this.searchForm.value.createTimeS = null; + this.searchForm.value.createTimeE = null; + } + if (this.searchForm.value.bindTime != null) { + this.searchForm.value.bindTimeS = new Date(this.searchForm.value.bindTime[0]).getTime(); + this.searchForm.value.bindTimeE = new Date(this.searchForm.value.bindTime[1]).getTime(); + } else { + this.searchForm.value.bindTimeS = null; + this.searchForm.value.bindTimeE = null; + } + this.requestData(1); + } + + /** + * 重置 + */ + resetForm(): void { + this.searchForm.reset(); + } + + /** + * 展示生成油卡模态框 + */ + showGenerateCardModal() { + this.generateCardModal = true; + } + + /** + * 关闭生成油卡模态框 + */ + closeGenerateCardModal() { + this.generateCardModal = false; + } + + /** + * 提交生成数量 + */ + submitGenerateCard() { + for (const i in this.generateCardForm.controls) { + this.generateCardForm.controls[i].markAsDirty(); + this.generateCardForm.controls[i].updateValueAndValidity(); + } + if (this.generateCardForm.status == null || this.generateCardForm.status !== 'VALID') { + this.modal.warning({ + nzTitle: '提示', + nzContent: '请填写所有必填项', + }); + return; + } + + this.loadingObject.spinning = true; + this.loadingObject.msg = '生成油卡中...'; + this.closeGenerateCardModal(); + + this.oilCardService.generateCard(this.generateCardForm.value, data => { + if (data['return_code'] === '000000') { + this.modal.success({ + nzTitle: '提示', + nzContent: '生成成功', + }); + this.requestData(this.whereObject['pageNum']); + } else { + this.modal.error({ + nzTitle: '提示', + nzContent: data['return_msg'], + }); + } + this.loadingObject.spinning = false; + }); + } + + /** + * 展示编辑联系人模态框 + */ + showEditContactModal(data: object) { + this.editContactForm.patchValue(data); + this.editContactModal = true; + } + + /** + * 关闭编辑联系人模态框 + */ + closeEditContactModal() { + this.editContactForm.reset(); + this.editContactModal = false; + } + + /** + * 提交编辑联系人 + */ + submitEditContact() { + if (this.editContactForm.value['bindStatus'] === 1) { + this.modal.confirm({ + nzTitle: '警告', + nzContent: '油卡更换联系人后,油卡会自动与用户解绑!', + nzOkText: '是', + nzCancelText: '否', + nzOkType: 'danger', + nzOnOk: () => this.submitEditContactData() + }); + } else { + this.submitEditContactData(); + } + } + + /** + * 提交编辑联系人数据 + */ + submitEditContactData() { + for (const i in this.editContactForm.controls) { + this.editContactForm.controls[i].markAsDirty(); + this.editContactForm.controls[i].updateValueAndValidity(); + } + if (this.editContactForm.status == null || this.editContactForm.status !== 'VALID') { + this.modal.warning({ + nzTitle: '提示', + nzContent: '请填写所有必填项', + }); + return; + } + this.oilCardService.setContact(this.editContactForm.value, data => { + if (data['return_code'] === '000000') { + this.modal.success({ + nzTitle: '提示', + nzContent: '设置成功', + }); + this.closeEditContactModal(); + this.requestData(this.whereObject['pageNum']); + } else { + this.modal.error({ + nzTitle: '提示', + nzContent: data['return_msg'], + }); + } + }); + } + + /** + * 弹出禁用对话框 + */ + showDisabledConfirm(cardNo: string): void { + this.modal.confirm({ + nzTitle: '警告', + nzContent: '是否禁用油卡', + nzOkText: '是', + nzCancelText: '否', + nzOkType: 'danger', + nzOnOk: () => this.disabledData(cardNo) + }); + } + + /** + * 禁用数据 + */ + disabledData(cardNo: string) { + this.oilCardService.disabled({ cardNo: cardNo}, data => { + if (data['return_code'] === '000000') { + this.requestData(this.whereObject['pageNum']); + } else { + this.modal.error({ + nzTitle: '提示', + nzContent: data['return_msg'] + }); + } + }); + } + + /** + * 弹出启用对话框 + */ + showEnableConfirm(cardNo: string): void { + this.modal.confirm({ + nzTitle: '警告', + nzContent: '是否启用油卡', + nzOkText: '是', + nzCancelText: '否', + nzOkType: 'danger', + nzOnOk: () => this.enableData(cardNo) + }); + } + + /** + * 启用数据 + */ + enableData(cardNo: string) { + this.oilCardService.enable({ cardNo: cardNo}, data => { + if (data['return_code'] === '000000') { + this.requestData(this.whereObject['pageNum']); + } else { + this.modal.error({ + nzTitle: '提示', + nzContent: data['return_msg'] + }); + } + }); + } + + /** + * 展示充值模态框 + */ + showRechargeModal(cardNo: string) { + this.rechargeForm.patchValue({cardNo: cardNo}); + this.rechargeModal = true; + } + + /** + * 关闭充值模态框 + */ + closeRechargeModal() { + this.rechargeModal = false; + } + + /** + * 提交充值 + */ + submitRecharge() { + for (const i in this.rechargeForm.controls) { + this.rechargeForm.controls[i].markAsDirty(); + this.rechargeForm.controls[i].updateValueAndValidity(); + } + if (this.rechargeForm.status == null || this.rechargeForm.status !== 'VALID') { + this.modal.warning({ + nzTitle: '提示', + nzContent: '请填写所有必填项', + }); + return; + } + this.rechargeForm.value['cardNo'] = this.rechargeForm.controls['cardNo']['value']; + this.oilCardService.recharge(this.rechargeForm.value, data => { + if (data['return_code'] === '000000') { + this.modal.success({ + nzTitle: '提示', + nzContent: '充值成功', + }); + this.closeRechargeModal(); + this.getAccount(); + this.requestData(this.whereObject['pageNum']); + + } else if (data['return_code'] === '102136') { + this.modal.error({ + nzTitle: '提示', + nzContent: data['return_msg'], + }); + this.closeRechargeModal(); + this.navigationComponent.openSetTowPwd(); + } else { + this.modal.error({ + nzTitle: '提示', + nzContent: data['return_msg'], + }); + } + }); + } +} diff --git a/src/app/admin/oil-card/oil-card-routing.module.ts b/src/app/admin/oil-card/oil-card-routing.module.ts new file mode 100644 index 0000000..c6122e0 --- /dev/null +++ b/src/app/admin/oil-card/oil-card-routing.module.ts @@ -0,0 +1,13 @@ +import { NgModule } from '@angular/core'; +import { Routes, RouterModule } from '@angular/router'; +import {OilCardListComponent} from './oil-card-list/oil-card-list.component'; + +const routes: Routes = [ + { path: 'list', component: OilCardListComponent} +]; + +@NgModule({ + imports: [RouterModule.forChild(routes)], + exports: [RouterModule] +}) +export class OilCardRoutingModule { } diff --git a/src/app/admin/oil-card/oil-card.module.ts b/src/app/admin/oil-card/oil-card.module.ts new file mode 100644 index 0000000..18c129a --- /dev/null +++ b/src/app/admin/oil-card/oil-card.module.ts @@ -0,0 +1,26 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; + +import { OilCardRoutingModule } from './oil-card-routing.module'; +import { OilCardListComponent } from './oil-card-list/oil-card-list.component'; +import {NgZorroAntdModule} from '_ng-zorro-antd@9.3.0@ng-zorro-antd'; +import {FormsModule, ReactiveFormsModule} from '_@angular_forms@9.0.7@@angular/forms'; +import {BreadcrumbModule} from '../../common/breadcrumb/breadcrumb.module'; +import {AppCommonModule} from '../../app-common.module'; +import {NgxEchartsModule} from '_ngx-echarts@4.2.2@ngx-echarts'; + + +@NgModule({ + declarations: [OilCardListComponent], + imports: [ + CommonModule, + OilCardRoutingModule, + NgZorroAntdModule, + ReactiveFormsModule, + FormsModule, + BreadcrumbModule, + AppCommonModule, + NgxEchartsModule, + ] +}) +export class OilCardModule { } diff --git a/src/app/app-common.module.ts b/src/app/app-common.module.ts index c4f89b3..8adaaf0 100644 --- a/src/app/app-common.module.ts +++ b/src/app/app-common.module.ts @@ -37,8 +37,9 @@ import { DiscountPackageStatusPipe, PriceShowPipe, ShowTypePipe, - EnergyTypePipe, CompanyAmountRecordTypePipe, CompanyAmountRecordSourceTypePipe + EnergyTypePipe, CompanyAmountRecordTypePipe, CompanyAmountRecordSourceTypePipe, OilCardBindStatusPipe } from './pipes'; +import {OilCardStatusPipe} from "./pipes/oil-card/oil-card-status.pipe"; @@ -76,6 +77,8 @@ const PIPES = [ EnergyTypePipe, CompanyAmountRecordTypePipe, CompanyAmountRecordSourceTypePipe, + OilCardStatusPipe, + OilCardBindStatusPipe ]; diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 93a09e7..85c3b33 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -107,6 +107,11 @@ const routes: Routes = [ loadChildren: () => import('./admin/company-amount/company-amount.module').then(m => m.CompanyAmountModule), canActivate: [InitGuardService] }, + { + path: 'oil-card', + loadChildren: () => import('./admin/oil-card/oil-card.module').then(m => m.OilCardModule), + canActivate: [InitGuardService] + }, ], }, ]; diff --git a/src/app/pipes/index.ts b/src/app/pipes/index.ts index b0811b5..a2cdd28 100644 --- a/src/app/pipes/index.ts +++ b/src/app/pipes/index.ts @@ -28,3 +28,5 @@ export * from './price-show.pipe'; export * from './index/energy-type.pipe'; export * from './company-amount/company-amount-record-type.pipe'; export * from './company-amount/company-amount-record-source-type.pipe'; +export * from './oil-card/oil-card-status.pipe'; +export * from './oil-card/oil-card-bind-status.pipe'; diff --git a/src/app/pipes/oil-card/oil-card-bind-status.pipe.ts b/src/app/pipes/oil-card/oil-card-bind-status.pipe.ts new file mode 100644 index 0000000..6e1bb88 --- /dev/null +++ b/src/app/pipes/oil-card/oil-card-bind-status.pipe.ts @@ -0,0 +1,16 @@ +import { Pipe, PipeTransform } from '@angular/core'; + +@Pipe({ + name: 'oilCardBindStatus' +}) +export class OilCardBindStatusPipe implements PipeTransform { + + transform(value: number): string { + switch (value) { + case 0: + return '未绑定'; + case 1: + return '已绑定'; + } + } +} diff --git a/src/app/pipes/oil-card/oil-card-status.pipe.ts b/src/app/pipes/oil-card/oil-card-status.pipe.ts new file mode 100644 index 0000000..839b177 --- /dev/null +++ b/src/app/pipes/oil-card/oil-card-status.pipe.ts @@ -0,0 +1,19 @@ +import { Pipe, PipeTransform } from '@angular/core'; + +@Pipe({ + name: 'oilCardStatus' +}) +export class OilCardStatusPipe implements PipeTransform { + + transform(value: number): string { + switch (value) { + case 0: + return '删除'; + case 1: + return '正常'; + case 2: + return '禁用'; + } + } + +} diff --git a/src/app/services/company-two-pwd.service.ts b/src/app/services/company-two-pwd.service.ts new file mode 100644 index 0000000..7be2488 --- /dev/null +++ b/src/app/services/company-two-pwd.service.ts @@ -0,0 +1,51 @@ +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 CompanyTwoPwdService { + + constructor( + private http: HttpClient, + private common: CommonsService + ) { } + + /** + * 是否设置二级密码 + * + * @param paramsObject 参数对象 + * @param callBack 回调 + */ + public isSetTwoPwd(callBack) { + this.http.post(environment.baseUrl + 'companyTwoPwd/isSetTwoPwd', null).subscribe(data => { + callBack(data); + }); + } + + /** + * 设置二级密码 + * + * @param paramsObject 参数对象 + * @param callBack 回调 + */ + public setTwoPwd(paramsObject: object, callBack) { + this.http.post(environment.baseUrl + 'companyTwoPwd/setTwoPwd', paramsObject).subscribe(data => { + callBack(data); + }); + } + + /** + * 修改二级密码 + * + * @param paramsObject 参数对象 + * @param callBack 回调 + */ + public updateTwoPwd(paramsObject: object, callBack) { + this.http.post(environment.baseUrl + 'companyTwoPwd/updateTwoPwd', paramsObject).subscribe(data => { + callBack(data); + }); + } +} diff --git a/src/app/services/oil-card.service.ts b/src/app/services/oil-card.service.ts new file mode 100644 index 0000000..aa156aa --- /dev/null +++ b/src/app/services/oil-card.service.ts @@ -0,0 +1,87 @@ +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 OilCardService { + + constructor( + private http: HttpClient, + private common: CommonsService + ) { } + + /** + * 油卡充值 + * + * @param param 参数对象 + * @param callBack 回调 + */ + public recharge(param: object, callBack) { + this.http.post(environment.baseUrl + 'oilCard/recharge', param).subscribe(data => { + callBack(data); + }); + } + + /** + * 生成油卡 + * + * @param param 参数对象 + * @param callBack 回调 + */ + public generateCard(param: object, callBack) { + this.http.post(environment.baseUrl + 'oilCard/generateCard', param).subscribe(data => { + callBack(data); + }); + } + + /** + * 设置联系人 + * + * @param param 参数对象 + * @param callBack 回调 + */ + public setContact(param: object, callBack) { + this.http.post(environment.baseUrl + 'oilCard/setContact', param).subscribe(data => { + callBack(data); + }); + } + + /** + * 禁用 + * + * @param param 参数对象 + * @param callBack 回调 + */ + public disabled(param: object, callBack) { + this.http.post(environment.baseUrl + 'oilCard/disabled', param).subscribe(data => { + callBack(data); + }); + } + + /** + * 启用 + * + * @param param 参数对象 + * @param callBack 回调 + */ + public enable(param: object, callBack) { + this.http.post(environment.baseUrl + 'oilCard/enable', param).subscribe(data => { + callBack(data); + }); + } + + /** + * 油卡列表 + * + * @param param 参数对象 + * @param callBack 回调 + */ + public getCardList(param: object, callBack) { + this.http.get(environment.baseUrl + 'oilCard/getCardList?' + this.common.getWhereCondition(param)).subscribe(data => { + callBack(data); + }); + } +}