diff --git a/src/app/pages/mer-class-group/mer-class-group-list/mer-class-group-list.component.html b/src/app/pages/mer-class-group/mer-class-group-list/mer-class-group-list.component.html index 75dda3c..2db9c5b 100644 --- a/src/app/pages/mer-class-group/mer-class-group-list/mer-class-group-list.component.html +++ b/src/app/pages/mer-class-group/mer-class-group-list/mer-class-group-list.component.html @@ -77,7 +77,7 @@ - 总计 {{ total }} 条x + 总计 {{ total }} 条 diff --git a/src/app/pages/mer-oil-price/oil-discount/oil-discount.component.html b/src/app/pages/mer-oil-price/oil-discount/oil-discount.component.html index 09b7def..81166b2 100644 --- a/src/app/pages/mer-oil-price/oil-discount/oil-discount.component.html +++ b/src/app/pages/mer-oil-price/oil-discount/oil-discount.component.html @@ -92,42 +92,6 @@ 总计 {{ total }} 条 - - - - - - 油站 - 油号 - 折扣 - 服务费 - 操作 - - - - - {{data.merName}} - {{data.oilNoName}} - {{data.priceRate}}% - {{data.serviceFeeRate}}% - - 调整 - - - - - - - +
+
+ + 类型 + + + + + + +
+ +
+ + 名称 + + + + +
+ +
+ + 联系方式 + + + + +
+ +
+ + + + + + + + +
+
+ + + + + + 类型 + 名称 + 电话 + 状态 + 创建时间 + 操作 + + + + + {{data.positionType | dictionary : 'GAS_STAFF_POSITION_TYPE'}} + {{data.name}} + {{data.telephone}} + + 正常 + 禁用 + + {{data.createTime | date : 'yyyy-MM-dd HH:mm:ss'}} + + + 操作列表 + + + + + + + + 总计 {{ total }} 条 + + + + +
+ + + 类型 + + + + + + + + + 名称 + + + + + + + 联系方式 + + + + + +
+ +
+
+
+
+ + + + + +
+
+ + + + + + 点击下载 + +
+
+ + + + + + 点击下载 + +
+
+
+
+
+
diff --git a/src/app/pages/merchant/mer-staff-list/mer-staff-list.component.less b/src/app/pages/merchant/mer-staff-list/mer-staff-list.component.less new file mode 100644 index 0000000..8654bcc --- /dev/null +++ b/src/app/pages/merchant/mer-staff-list/mer-staff-list.component.less @@ -0,0 +1,9 @@ +nz-input-number { + width: 100%; +} +nz-date-picker { + width: 100%; +} +.submit-btn { + width: 150px; +} diff --git a/src/app/pages/merchant/mer-staff-list/mer-staff-list.component.ts b/src/app/pages/merchant/mer-staff-list/mer-staff-list.component.ts new file mode 100644 index 0000000..eea6447 --- /dev/null +++ b/src/app/pages/merchant/mer-staff-list/mer-staff-list.component.ts @@ -0,0 +1,334 @@ +import {Component, ElementRef, ViewChild} from '@angular/core'; +import {MerStaffService} from "../../../services/merchant/mer-staff.service"; +import {FormGroup, FormsModule, NonNullableFormBuilder, ReactiveFormsModule, Validators} from "@angular/forms"; +import {NzMessageService} from "ng-zorro-antd/message"; +import {BrowserStorageService} from "../../../utils/localStorage.service"; +import {NzModalModule, NzModalService} from "ng-zorro-antd/modal"; +import {CommonService} from "../../../services/common/common.service"; +import {DATA} from "../../../data/login/localStorage.namespace"; +import {NzInputDirective} from "ng-zorro-antd/input"; +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, 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 {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, NzRangePickerComponent} from "ng-zorro-antd/date-picker"; +import {NzRadioButtonDirective, NzRadioComponent, NzRadioGroupComponent} from "ng-zorro-antd/radio"; +import {NzToolTipModule} from "ng-zorro-antd/tooltip"; +import {NzTabsModule} from "ng-zorro-antd/tabs"; +import {NzTagModule} from "ng-zorro-antd/tag"; +import {NzCardModule} from "ng-zorro-antd/card"; +import {NzInputNumberModule} from "ng-zorro-antd/input-number"; +import {NzQRCodeModule} from "ng-zorro-antd/qr-code"; +import {RouterLink} from "@angular/router"; +import {NzTypographyComponent} from "ng-zorro-antd/typography"; + +@Component({ + selector: 'app-mer-staff-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, + NzRadioButtonDirective, + NzRadioComponent, + NzRadioGroupComponent, + NzRangePickerComponent, + NzToolTipModule, + NzTabsModule, + NzTagModule, + NzCardModule, + NzInputNumberModule, + NzQRCodeModule, + RouterLink, + NzTypographyComponent + ], + templateUrl: './mer-staff-list.component.html', + styleUrl: './mer-staff-list.component.less' +}) +export class MerStaffListComponent { +// 表单页数 + tablePageNum = 1; + // 每页数量 + tablePageSize = 10; + // 表单数据 + tableData: any = { + total: 0, + list: [], + }; + merNo = null; + // 搜索表单 + searchForm: FormGroup; + // 地区 + regionArray: any = []; + // 编辑任务表单 + editStaffForm: FormGroup; + editStaffModal = false; + // 加油员类型 + staffPositionTypeArray = new DictionaryPipe().getDictionaryList('GAS_STAFF_POSITION_TYPE'); + qrCodeVisible = false; + staffData: any = {}; + constructor(private fb: NonNullableFormBuilder, + private message: NzMessageService, + private storage: BrowserStorageService, + private merStaffService: MerStaffService, + private commonService: CommonService, + private modal: NzModalService) { + this.merNo = this.storage.get(DATA)['merchant']['merNo']; + + // 获取地区 + this.commonService.getRegion('',(data: any) => { + if (data['return_code'] == '000000') { + this.regionArray = data['return_data']; + } + }); + // 初始化搜索框 + this.searchForm = this.fb.group({ + positionType: [null], + name: [null], + telephone: [null], + }); + + this.editStaffForm = this.fb.group({ + id: [''], + positionType: ['1', [Validators.required]], + name: ['', [Validators.required]], + telephone: ['', [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.merStaffService.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(); + } + + /** + * 删除 + */ + delStaff(id: number) { + this.modal.confirm({ + nzTitle: '提示', + nzContent: '确定删除吗?', + nzOnOk: () => + this.merStaffService.delStaff({staffId: id}, (data: any) => { + if (data['return_code'] == '000000') { + // 刷新数据 + this.queryData(); + this.message.create('success', '操作成功'); + } else { + this.message.create('error', data['return_msg']); + } + }) + }); + } + + /** + * 恢复 + */ + recover(id: number) { + this.modal.confirm({ + nzTitle: '提示', + nzContent: '确定恢复账户状态吗?', + nzOnOk: () => + this.merStaffService.recover({staffId: id}, (data: any) => { + if (data['return_code'] == '000000') { + // 刷新数据 + this.queryData(); + this.message.create('success', '操作成功'); + } else { + this.message.create('error', data['return_msg']); + } + }) + }); + } + + /** + * 禁用 + */ + disabled(id: number) { + this.modal.confirm({ + nzTitle: '提示', + nzContent: '确定禁用账户吗?', + nzOnOk: () => + this.merStaffService.disabled({staffId: id}, (data: any) => { + if (data['return_code'] == '000000') { + // 刷新数据 + this.queryData(); + this.message.create('success', '操作成功'); + } else { + this.message.create('error', data['return_msg']); + } + }) + }); + } + + /** + * 打开编辑任务模态框 + */ + showEditStaffModal(data:any) { + if (data != null) { + data['positionType'] = String(data['positionType']); + this.editStaffForm.patchValue(data); + } + this.editStaffModal = true; + } + + /** + * 提交数据 + */ + submitData() { + if (this.editStaffForm.valid) { + if (this.editStaffForm.controls['id'].value == null) { + this.merStaffService.addGasStaff(this.editStaffForm.value, (data: any) => { + if (data['return_code'] == '000000') { + this.message.create('success', '操作成功'); + // 刷新数据 + this.queryData(); + // 关闭弹窗 + this.closeEditStaffModal(); + } else { + this.message.create('error', data['return_msg']); + } + }); + } else { + this.merStaffService.updateGasStaff(this.editStaffForm.value, (data: any) => { + if (data['return_code'] == '000000') { + this.message.create('success', '操作成功'); + // 刷新数据 + this.queryData(); + // 关闭弹窗 + this.closeEditStaffModal(); + } else { + this.message.create('error', data['return_msg']); + } + }); + } + } else { + Object.values(this.editStaffForm.controls).forEach(control => { + if (control.invalid) { + control.markAsDirty(); + control.updateValueAndValidity({ onlySelf: true }); + } + }); + } + } + + /** + * 关闭编辑任务模态框 + */ + closeEditStaffModal() { + this.editStaffForm.reset(); + this.editStaffModal = false; + } + + /** + * 展示二维码 + * @param merNo + */ + showQrCode(data: any) { + this.staffData = data; + this.qrCodeVisible = true; + } + + /** + * 关闭二维码展示 + */ + closeQrCode() { + this.qrCodeVisible = false; + } + + /** + * 下载二维码 + * @param type + */ + @ViewChild('download', { static: false }) download!: ElementRef; + downloadMerQrCode(type: number) { + const canvas = document.getElementById('download'+(type==1?'H5':'Wx'))?.querySelector('canvas'); + if (canvas) { + this.download.nativeElement.href = canvas.toDataURL('image/png'); + this.download.nativeElement.download = new Date().getTime(); + const event = new MouseEvent('click'); + this.download.nativeElement.dispatchEvent(event); + } + } +} diff --git a/src/app/pages/merchant/merchant.routes.ts b/src/app/pages/merchant/merchant.routes.ts index a99a5eb..681fe72 100644 --- a/src/app/pages/merchant/merchant.routes.ts +++ b/src/app/pages/merchant/merchant.routes.ts @@ -14,6 +14,8 @@ import {OilConfigComponent} from "./oil-config/oil-config.component"; import {QrCodeListComponent} from "./qr-code-list/qr-code-list.component"; import {MerClassGroupTaskComponent} from "../mer-class-group/mer-class-group-task/mer-class-group-task.component"; import {MerClassGroupListComponent} from "../mer-class-group/mer-class-group-list/mer-class-group-list.component"; +import {MerStaffService} from "../../services/merchant/mer-staff.service"; +import {MerStaffListComponent} from "./mer-staff-list/mer-staff-list.component"; export const MERCHANT_ROUTES: Routes = [ { path: 'mer-list', component: MerListComponent }, @@ -29,4 +31,5 @@ export const MERCHANT_ROUTES: Routes = [ { path: 'qr-code-list', component: QrCodeListComponent }, { path: 'class-group-list', component: MerClassGroupListComponent }, { path: 'class-group-task-list', component: MerClassGroupTaskComponent }, + { path: 'staff-list', component: MerStaffListComponent }, ]; diff --git a/src/app/services/merchant/mer-staff.service.ts b/src/app/services/merchant/mer-staff.service.ts new file mode 100644 index 0000000..1fcb0fe --- /dev/null +++ b/src/app/services/merchant/mer-staff.service.ts @@ -0,0 +1,110 @@ +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 MerStaffService { + + constructor(private http: HttpClient) { } + + /** + * 增加 + * @param params + * @param callBack + */ + public addGasStaff(params: any, callBack:any) { + params.time = new Date().getTime(); + this.http.post(environment.baseUrl + 'gasStaff/addGasStaff',params).subscribe(data => { + callBack(data); + }); + } + + /** + * 增加 + * @param params + * @param callBack + */ + public updateGasStaff(params: any, callBack:any) { + params.time = new Date().getTime(); + this.http.post(environment.baseUrl + 'gasStaff/updateGasStaff',params).subscribe(data => { + callBack(data); + }); + } + + /** + * 查询二维码 + * @param params + * @param callBack + */ + public queryQrCode(params: any, callBack:any) { + params.time = new Date().getTime(); + this.http.get(environment.baseUrl + 'gasStaff/queryQrCode?'+ObjectData.objectByString(params)).subscribe(data => { + callBack(data); + }); + } + + + /** + * 禁用 + * @param params + * @param callBack + */ + public disabled(params: any, callBack:any) { + params.time = new Date().getTime(); + this.http.post(environment.baseUrl + 'gasStaff/disabled', params).subscribe(data => { + callBack(data); + }); + } + + /** + * 恢复 + * @param params + * @param callBack + */ + public recover(params: any, callBack:any) { + params.time = new Date().getTime(); + this.http.post(environment.baseUrl + 'gasStaff/recover', params).subscribe(data => { + callBack(data); + }); + } + + /** + * 删除 + * @param params + * @param callBack + */ + public delStaff(params: any, callBack:any) { + params.time = new Date().getTime(); + this.http.post(environment.baseUrl + 'gasStaff/delStaff', params).subscribe(data => { + callBack(data); + }); + } + + /** + * 查询员工详情 + * @param params + * @param callBack + */ + public getStaffDetail(params: any, callBack:any) { + params.time = new Date().getTime(); + this.http.get(environment.baseUrl + 'gasStaff/getStaffDetail?'+ObjectData.objectByString(params)).subscribe(data => { + callBack(data); + }); + } + + /** + * 查询员工列表 + * @param params + * @param callBack + */ + public getStaffList(params: any, callBack:any) { + params.time = new Date().getTime(); + this.http.get(environment.baseUrl + 'gasStaff/getStaffList?'+ObjectData.objectByString(params)).subscribe(data => { + callBack(data); + }); + } + +}