From aff577603f48a2f4803c66ae794cd96f9a52395e Mon Sep 17 00:00:00 2001 From: hu177768073 <177768073@qq.com> Date: Thu, 31 Oct 2024 15:38:31 +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 --- .../cms/cms-list/cms-list.component.html | 152 +++++++ .../cms/cms-list/cms-list.component.less | 9 + .../pages/cms/cms-list/cms-list.component.ts | 321 ++++++++++++++ .../device-print/device-print.component.html | 16 + .../device-print/device-print.component.less | 0 .../device-print/device-print.component.ts | 120 +++++ .../mer-class-group-list.component.html | 110 +++++ .../mer-class-group-list.component.less | 9 + .../mer-class-group-list.component.ts | 245 +++++++++++ .../mer-class-group-task.component.html | 186 ++++++++ .../mer-class-group-task.component.less | 8 + .../mer-class-group-task.component.ts | 415 ++++++++++++++++++ .../oil-discount/oil-discount.component.html | 241 +++++++++- .../oil-discount/oil-discount.component.less | 15 + .../oil-discount/oil-discount.component.ts | 341 +++++++++++++- .../mer-chain-brand-list.component.ts | 10 +- src/app/pages/merchant/merchant.routes.ts | 10 + .../oil-config/oil-config.component.html | 120 +++++ .../oil-config/oil-config.component.less | 3 + .../oil-config/oil-config.component.ts | 199 +++++++++ .../qr-code-list/qr-code-list.component.html | 24 + .../qr-code-list/qr-code-list.component.less | 0 .../qr-code-list/qr-code-list.component.ts | 132 ++++++ src/app/pages/system/system.routes.ts | 4 +- src/app/pipes/common/week.pipe.ts | 28 ++ .../mer-class-group-task-status.pipe.ts | 18 + src/app/services/agent/agent-price.service.ts | 48 ++ src/app/services/cms/cms.service.ts | 72 +++ src/app/services/device/device.service.ts | 2 +- .../gas-oil-price-week.service.ts | 36 ++ .../merchant/mer-class-group-task.service.ts | 98 +++++ .../merchant/mer-class-group.service.ts | 62 +++ .../services/merchant/mer-qr-code.service.ts | 24 + 33 files changed, 3064 insertions(+), 14 deletions(-) create mode 100644 src/app/pages/cms/cms-list/cms-list.component.html create mode 100644 src/app/pages/cms/cms-list/cms-list.component.less create mode 100644 src/app/pages/cms/cms-list/cms-list.component.ts create mode 100644 src/app/pages/device/device-print/device-print.component.html create mode 100644 src/app/pages/device/device-print/device-print.component.less create mode 100644 src/app/pages/device/device-print/device-print.component.ts create mode 100644 src/app/pages/mer-class-group/mer-class-group-list/mer-class-group-list.component.html create mode 100644 src/app/pages/mer-class-group/mer-class-group-list/mer-class-group-list.component.less create mode 100644 src/app/pages/mer-class-group/mer-class-group-list/mer-class-group-list.component.ts create mode 100644 src/app/pages/mer-class-group/mer-class-group-task/mer-class-group-task.component.html create mode 100644 src/app/pages/mer-class-group/mer-class-group-task/mer-class-group-task.component.less create mode 100644 src/app/pages/mer-class-group/mer-class-group-task/mer-class-group-task.component.ts create mode 100644 src/app/pages/merchant/oil-config/oil-config.component.html create mode 100644 src/app/pages/merchant/oil-config/oil-config.component.less create mode 100644 src/app/pages/merchant/oil-config/oil-config.component.ts create mode 100644 src/app/pages/merchant/qr-code-list/qr-code-list.component.html create mode 100644 src/app/pages/merchant/qr-code-list/qr-code-list.component.less create mode 100644 src/app/pages/merchant/qr-code-list/qr-code-list.component.ts create mode 100644 src/app/pipes/common/week.pipe.ts create mode 100644 src/app/pipes/mer-class-group-task/mer-class-group-task-status.pipe.ts create mode 100644 src/app/services/agent/agent-price.service.ts create mode 100644 src/app/services/cms/cms.service.ts create mode 100644 src/app/services/mer-oil-price/gas-oil-price-week.service.ts create mode 100644 src/app/services/merchant/mer-class-group-task.service.ts create mode 100644 src/app/services/merchant/mer-class-group.service.ts create mode 100644 src/app/services/merchant/mer-qr-code.service.ts diff --git a/src/app/pages/cms/cms-list/cms-list.component.html b/src/app/pages/cms/cms-list/cms-list.component.html new file mode 100644 index 0000000..cdc506b --- /dev/null +++ b/src/app/pages/cms/cms-list/cms-list.component.html @@ -0,0 +1,152 @@ +
+
+ +
+ + 轮播图类型 + + + + + + +
+ +
+ + 状态 + + + + + + +
+ +
+ + + + + + + + +
+
+
+ + + + + 轮播类型 + 跳转类型 + 跳转地址 + 图片 + 状态 + 创建时间 + 操作 + + + + + {{data.type | dictionary : 'CMS_TYPE'}} + + 内链 + 外链 + + {{data.jumpUrl}} + + {{data.status | dictionary : 'CMS_STATUS'}} + {{data.createTime | date : 'yyyy-MM-dd HH:mm:ss'}} + + + 操作列表 + + + + + + + + 总计 {{ total }} 条x + + + + +
+ + + 轮播图类型 + + + + + + + + + 轮播图图片 + + + + +
上传
+
+ +
+
+
+ + + 跳转类型 + + + + + + + + + + 跳转地址 + + + + + +
+ +
+
+
+
diff --git a/src/app/pages/cms/cms-list/cms-list.component.less b/src/app/pages/cms/cms-list/cms-list.component.less new file mode 100644 index 0000000..8654bcc --- /dev/null +++ b/src/app/pages/cms/cms-list/cms-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/cms/cms-list/cms-list.component.ts b/src/app/pages/cms/cms-list/cms-list.component.ts new file mode 100644 index 0000000..555c640 --- /dev/null +++ b/src/app/pages/cms/cms-list/cms-list.component.ts @@ -0,0 +1,321 @@ +import { Component } from '@angular/core'; +import {DatePipe, NgForOf, NgIf} from "@angular/common"; +import {DictionaryPipe} from "../../../pipes/common/dictionary.pipe"; +import {FormGroup, FormsModule, NonNullableFormBuilder, ReactiveFormsModule, Validators} from "@angular/forms"; +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 {NzDatePickerComponent} from "ng-zorro-antd/date-picker"; +import {NzFlexDirective} from "ng-zorro-antd/flex"; +import {NzFormControlComponent, NzFormDirective, NzFormItemComponent, NzFormLabelComponent} from "ng-zorro-antd/form"; +import {NzInputNumberComponent, NzInputNumberModule} from "ng-zorro-antd/input-number"; +import {NzModalComponent, NzModalModule, NzModalService} from "ng-zorro-antd/modal"; +import {NzOptionComponent, NzSelectComponent} from "ng-zorro-antd/select"; +import {NzMessageService} from "ng-zorro-antd/message"; +import {BrowserStorageService} from "../../../utils/localStorage.service"; +import {OilTaskService} from "../../../services/mer-oil-price/oil-task.service"; +import {CommonService} from "../../../services/common/common.service"; +import {DATA} from "../../../data/login/localStorage.namespace"; +import {NzDividerComponent} from "ng-zorro-antd/divider"; +import {NzDropDownADirective, NzDropDownDirective, NzDropdownMenuComponent} from "ng-zorro-antd/dropdown"; +import {NzIconDirective} from "ng-zorro-antd/icon"; +import {NzInputDirective} from "ng-zorro-antd/input"; +import {NzMenuDirective, NzMenuItemComponent} from "ng-zorro-antd/menu"; +import {NzDescriptionsModule} from "ng-zorro-antd/descriptions"; +import {NzUploadComponent, NzUploadFile} 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 {environment} from "../../../../environments/environment"; +import {CmsService} from "../../../services/cms/cms.service"; +import {Observable, Observer} from "rxjs"; + +@Component({ + selector: 'app-cms-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 + ], + templateUrl: './cms-list.component.html', + styleUrl: './cms-list.component.less' +}) +export class CmsListComponent { + BASE_URL = environment.baseUrl; + IMAGE_URL = environment.imageUrl; + loading = false; + logoUrl?: string; + // 表单页数 + tablePageNum = 1; + // 每页数量 + tablePageSize = 10; + // 表单数据 + tableData: any = { + total: 0, + list: [], + }; + accountType = null; + // 搜索表单 + searchForm: FormGroup; + // 编辑表单 + editCmsForm: FormGroup; + editCmsModal = false; + + // 轮播图类型 + cmsTypeArray = new DictionaryPipe().getDictionaryList('CMS_TYPE'); + // 轮播图状态 + cmsStatusArray = new DictionaryPipe().getDictionaryList('CMS_STATUS'); + constructor(private fb: NonNullableFormBuilder, + private message: NzMessageService, + private storage: BrowserStorageService, + private cmsService: CmsService, + private commonService: CommonService, + private modal: NzModalService) { + this.accountType = this.storage.get(DATA)['account']['objectType']; + + // 初始化搜索框 + this.searchForm = this.fb.group({ + type: [null], + status: [null], + }); + + this.editCmsForm = this.fb.group({ + id: [''], + type: ['', [Validators.required]], + imgUrl: ['', [Validators.required]], + jumpType: [''], + jumpUrl: [''], + }); + // 查询数据 + this.queryData(); + } + + /** + * 获取数据 + */ + queryData() { + this.searchForm.value.pageNum = this.tablePageNum; + this.searchForm.value.pageSize = this.tablePageSize; + this.searchForm.value.time = new Date().getTime(); + this.cmsService.queryList(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(); + } + + /** + * 删除 + */ + delCms(id: number) { + this.modal.confirm({ + nzTitle: '提示', + nzContent: '确定删除吗?', + nzOnOk: () => + this.cmsService.delete({id: id}, (data: any) => { + if (data['return_code'] == '000000') { + // 刷新数据 + this.queryData(); + this.message.create('success', '操作成功'); + } else { + this.message.create('error', data['return_msg']); + } + }) + }); + } + + /** + * 下线 + */ + offline(id: number) { + this.modal.confirm({ + nzTitle: '提示', + nzContent: '确定轮播图下线吗?', + nzOnOk: () => + this.cmsService.offline({id: id}, (data: any) => { + if (data['return_code'] == '000000') { + // 刷新数据 + this.queryData(); + this.message.create('success', '操作成功'); + } else { + this.message.create('error', data['return_msg']); + } + }) + }); + } + + /** + * 上线 + */ + online(id: number) { + this.modal.confirm({ + nzTitle: '提示', + nzContent: '确定轮播图上线吗?', + nzOnOk: () => + this.cmsService.online({id: id}, (data: any) => { + if (data['return_code'] == '000000') { + // 刷新数据 + this.queryData(); + this.message.create('success', '操作成功'); + } else { + this.message.create('error', data['return_msg']); + } + }) + }); + } + + /** + * 打开编辑模态框 + */ + showEditCmsModal(data: any) { + if (data != null) { + this.logoUrl = this.IMAGE_URL + data['imgUrl']; + data['type'] = ''+data['type']; + data['jumpType'] = ''+data['jumpType']; + } + this.editCmsForm.patchValue(data); + this.editCmsModal = true; + } + + /** + * 提交数据 + */ + submitData() { + if (this.editCmsForm.valid) { + this.cmsService.edit(this.editCmsForm.value, (data: any) => { + if (data['return_code'] == '000000') { + this.message.create('success', '操作成功'); + // 刷新数据 + this.queryData(); + // 关闭弹窗 + this.closeEditModal(); + // 表单重置 + this.editCmsForm.reset(); + } else { + this.message.create('error', data['return_msg']); + } + }); + } else { + Object.values(this.editCmsForm.controls).forEach(control => { + if (control.invalid) { + control.markAsDirty(); + control.updateValueAndValidity({ onlySelf: true }); + } + }); + } + } + + /** + * 关闭编辑任务模态框 + */ + closeEditModal() { + this.editCmsForm.reset(); + this.logoUrl = ''; + this.editCmsModal = false; + } + + private getBase64(img: File, callback: (img: string) => void): void { + const reader = new FileReader(); + reader.addEventListener('load', () => callback(reader.result!.toString())); + reader.readAsDataURL(img); + } + + handleChange(info: { file: NzUploadFile }): void { + switch (info.file.status) { + case 'uploading': + this.loading = true; + break; + case 'done': + // Get this url from response in real world. + this.getBase64(info.file!.originFileObj!, (img: string) => { + this.loading = false; + this.logoUrl = img; + }); + // 不是自建站,拼接绝对路径访问链接 + this.editCmsForm.patchValue({ imgUrl: info.file.response['return_data'][0]}); + break; + case 'error': + this.message.error('网络错误!'); + this.loading = false; + break; + } + } + + beforeUpload = (file: NzUploadFile, _fileList: NzUploadFile[]) => { + return new Observable((observer: Observer) => { + const isJpgOrPng = file.type === 'image/jpeg' || file.type === 'image/png'; + if (!isJpgOrPng) { + this.message.error('只能上传JPG文件!'); + observer.complete(); + return; + } + const isLt2M = file.size! / 1024 / 1024 < 2; + if (!isLt2M) { + this.message.error('图片必须小于2MB!'); + observer.complete(); + return; + } + observer.next(isJpgOrPng && isLt2M); + observer.complete(); + }); + }; +} diff --git a/src/app/pages/device/device-print/device-print.component.html b/src/app/pages/device/device-print/device-print.component.html new file mode 100644 index 0000000..7bee06b --- /dev/null +++ b/src/app/pages/device/device-print/device-print.component.html @@ -0,0 +1,16 @@ +
+
+ + 打印机打印内容 + + + + + + + +
+
+ +
+
diff --git a/src/app/pages/device/device-print/device-print.component.less b/src/app/pages/device/device-print/device-print.component.less new file mode 100644 index 0000000..e69de29 diff --git a/src/app/pages/device/device-print/device-print.component.ts b/src/app/pages/device/device-print/device-print.component.ts new file mode 100644 index 0000000..73d968f --- /dev/null +++ b/src/app/pages/device/device-print/device-print.component.ts @@ -0,0 +1,120 @@ +import { Component } from '@angular/core'; +import {FormGroup, FormsModule, NonNullableFormBuilder, ReactiveFormsModule, Validators} from "@angular/forms"; +import {NgForOf, NgIf} from "@angular/common"; +import {NzCascaderComponent, NzCascaderModule} from "ng-zorro-antd/cascader"; +import {NzColDirective, NzRowDirective} from "ng-zorro-antd/grid"; +import { + NzFormControlComponent, + NzFormDirective, + NzFormItemComponent, + NzFormLabelComponent, + NzFormModule +} from "ng-zorro-antd/form"; +import {NzIconDirective} from "ng-zorro-antd/icon"; +import {NzUploadComponent, NzUploadModule} from "ng-zorro-antd/upload"; +import {NzButtonComponent} from "ng-zorro-antd/button"; +import {NzFlexDirective} from "ng-zorro-antd/flex"; +import {NzInputDirective, NzInputGroupComponent} from "ng-zorro-antd/input"; +import {NzOptionComponent, NzSelectComponent} from "ng-zorro-antd/select"; +import {MerService} from "../../../services/merchant/mer.service"; +import {MerChainBrandService} from "../../../services/merchant/mer-chain-brand.service"; +import {RoleService} from "../../../services/role/role.service"; +import {NzMessageService} from "ng-zorro-antd/message"; +import {ActivatedRoute} from "@angular/router"; +import {HttpClient} from "@angular/common/http"; +import {NzModalModule, NzModalService} from "ng-zorro-antd/modal"; +import {NzInputNumberComponent} from "ng-zorro-antd/input-number"; +import {DeviceService} from "../../../services/device/device.service"; +import {DATA} from "../../../data/login/localStorage.namespace"; +import {BrowserStorageService} from "../../../utils/localStorage.service"; +import {NzRadioComponent, NzRadioGroupComponent} from "ng-zorro-antd/radio"; + +@Component({ + selector: 'app-device-print', + standalone: true, + imports: [ + FormsModule, + NgForOf, + NzButtonComponent, + NzColDirective, + NzFlexDirective, + NzFormControlComponent, + NzFormDirective, + ReactiveFormsModule, + NzFormItemComponent, + NzFormLabelComponent, + NzInputDirective, + NzSelectComponent, + NzOptionComponent, + NzModalModule, + NzFormModule, + NzUploadModule, + NzIconDirective, + NgIf, + NzInputGroupComponent, + NzInputNumberComponent, + NzCascaderModule, + NzRadioGroupComponent, + NzRadioComponent + ], + templateUrl: './device-print.component.html', + styleUrl: './device-print.component.less' +}) +export class DevicePrintComponent { + form: FormGroup; + + constructor(private fb: NonNullableFormBuilder, + private deviceService: DeviceService, + private storage: BrowserStorageService, + private message: NzMessageService, + private activatedRoute: ActivatedRoute, + private modal: NzModalService, + private http: HttpClient) { + + // 初始化表单 + this.form = this.fb.group({ + merNo: [''], + receiptOutContent: [''], + }); + + let merNo = this.storage.get(DATA)['merchant']['merNo']; + console.log(merNo); + if (merNo == null) { + this.modal.error({ + nzTitle: '提示', + nzContent: '此功能由油站角色设置', + }); + return; + } + + this.deviceService.getSettingReceipt({merNo: merNo}, (data: any) => { + if (data['return_code'] == '000000') { + this.form.controls['merNo'].setValue(merNo); + this.form.controls['receiptOutContent'].setValue(''+data['return_data']); + } + }); + + } + + /** + * 提交表单 + */ + submitForm() { + if (this.form.valid) { + this.deviceService.settingReceipt(this.form.value, (data: any) => { + if (data['return_code'] == '000000') { + this.message.create('success', '操作成功'); + } else { + this.message.create('error', data['return_msg']); + } + }); + } else { + Object.values(this.form.controls).forEach(control => { + if (control.invalid) { + control.markAsDirty(); + control.updateValueAndValidity({ onlySelf: true }); + } + }); + } + } +} 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 new file mode 100644 index 0000000..75dda3c --- /dev/null +++ b/src/app/pages/mer-class-group/mer-class-group-list/mer-class-group-list.component.html @@ -0,0 +1,110 @@ +
+
+
+ + 班组名称 + + + + +
+
+ + 负责人名称 + + + + +
+
+ + 负责人电话 + + + + +
+
+ + + + + + + + +
+
+
+ +
+ + + + + 序号 + 班组名称 + 负责人名称 + 负责人电话 + 创建时间 + 操作 + + + + + {{i + 1}} + {{data.name}} + {{data.principalName}} + {{data.principalPhone}} + {{data.createTime | date : 'yyyy-MM-dd HH:mm:ss'}} + + 操作列表 + + + + + + + 总计 {{ total }} 条x + +
+ + + +
+ + 班组名称 + + + + + + 负责人名称 + + + + + + 负责人电话 + + + + +
+ +
+
+
+
diff --git a/src/app/pages/mer-class-group/mer-class-group-list/mer-class-group-list.component.less b/src/app/pages/mer-class-group/mer-class-group-list/mer-class-group-list.component.less new file mode 100644 index 0000000..8654bcc --- /dev/null +++ b/src/app/pages/mer-class-group/mer-class-group-list/mer-class-group-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/mer-class-group/mer-class-group-list/mer-class-group-list.component.ts b/src/app/pages/mer-class-group/mer-class-group-list/mer-class-group-list.component.ts new file mode 100644 index 0000000..f9fc283 --- /dev/null +++ b/src/app/pages/mer-class-group/mer-class-group-list/mer-class-group-list.component.ts @@ -0,0 +1,245 @@ +import { Component } from '@angular/core'; +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 {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 {NzInputDirective} from "ng-zorro-antd/input"; +import {NzMenuDirective, NzMenuItemComponent} from "ng-zorro-antd/menu"; +import {NzModalComponent, NzModalModule, NzModalService} from "ng-zorro-antd/modal"; +import {NzWaveDirective} from "ng-zorro-antd/core/wave"; +import {FormBuilder, FormGroup, FormsModule, ReactiveFormsModule, Validators} from "@angular/forms"; +import {NzMessageService} from "ng-zorro-antd/message"; +import {MerClassGroupService} from "../../../services/merchant/mer-class-group.service"; +import {DictionaryPipe} from "../../../pipes/common/dictionary.pipe"; +import {NzDividerComponent} from "ng-zorro-antd/divider"; +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"; + +@Component({ + selector: 'app-mer-class-group-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 + ], + templateUrl: './mer-class-group-list.component.html', + styleUrl: './mer-class-group-list.component.less' +}) +export class MerClassGroupListComponent { + + dataObject: any = {}; + tableLoading = true; + searchForm: FormGroup; + pageNum: number = 1; + whereObject: any = {}; + + classGroupModal = false; + classGroupForm: FormGroup; + + constructor(private modal: NzModalService, + private message: NzMessageService, + private gasClassGroupService: MerClassGroupService, + private form: FormBuilder) { + this.searchForm = this.form.group({ + name: [null], + principalName: [null], + principalPhone: [null], + }); + + this.classGroupForm = this.form.group({ + id: [null], + name: [null, [Validators.required]], + principalName: [null, [Validators.required]], + principalPhone: [null, [Validators.required]], + }); + this.requestData(1); + + } + + /** + * 请求数据 + */ + requestData(pageNum: number) { + this.tableLoading = true; + this.whereObject['pageNum'] = pageNum; + this.whereObject['pageSize'] = 10; + this.whereObject['time'] = new Date().getTime(); + this.gasClassGroupService.getClassGroupList(this.whereObject, (data: any) => { + if (data['return_code'] === '000000') { + this.dataObject = data['return_data']; + } else { + this.modal.error(data['return_msg']); + } + this.tableLoading = false; + }); + } + + /** + * 搜索 + * @param whereObject 条件 + */ + search(whereObject: object) { + this.whereObject = whereObject; + this.requestData(1); + } + + /** + * 重置 + */ + resetForm(): void { + this.searchForm.reset(); + } + + /** + * 弹出删除对话框 + */ + showDeleteConfirm(groupId: number): void { + this.modal.confirm({ + nzTitle: '警告', + nzContent: '是否删除班组', + nzOkText: '是', + nzCancelText: '否', + nzOnOk: () => this.deleteData(groupId) + }); + } + + /** + * 删除数据 + * + */ + deleteData(groupId: number) { + this.gasClassGroupService.delClassGroup(groupId, (data: any) => { + if (data['return_code'] === '000000') { + this.requestData(this.whereObject['pageNum']); + } else { + this.modal.error({ + nzTitle: '提示', + nzContent: data['return_msg'] + }); + } + }); + } + + /** + * 打开编辑班组模态框 + */ + showEditClassGroup(data: any) { + if (data != null) { + this.classGroupForm.patchValue(data); + } + this.classGroupModal = true; + } + + /** + * 关闭编辑班组模态框 + */ + closeEditClassGroup() { + this.classGroupForm.reset(); + this.classGroupModal = false; + } + + /** + * 提交编辑班组 + */ + submitEditClassGroup(){ + for (const i in this.classGroupForm.controls) { + this.classGroupForm.controls[i].markAsDirty(); + this.classGroupForm.controls[i].updateValueAndValidity(); + } + if (this.classGroupForm.status == null || this.classGroupForm.status !== 'VALID') { + this.modal.warning({ + nzTitle: '提示', + nzContent: '请填写所有必填项', + }); + return; + } + + // 提交数据 + this.gasClassGroupService.editClassGroup(this.classGroupForm.value, (data: any) => { + if (data['return_code'] === '000000') { + this.modal.success({ + nzTitle: '提示', + nzContent: '保存成功', + }); + this.closeEditClassGroup(); + this.requestData(this.whereObject['pageNum']); + } else { + this.modal.warning({ + nzTitle: '提示', + nzContent: data['return_msg'], + }); + } + }); + } +} diff --git a/src/app/pages/mer-class-group/mer-class-group-task/mer-class-group-task.component.html b/src/app/pages/mer-class-group/mer-class-group-task/mer-class-group-task.component.html new file mode 100644 index 0000000..b91b256 --- /dev/null +++ b/src/app/pages/mer-class-group/mer-class-group-task/mer-class-group-task.component.html @@ -0,0 +1,186 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + 历史班次,共计 {{dataObject.total?dataObject.total:0}} 条数据 +
+ +
+ + + + + + 班次 + 班组名称 + 开始时间 + 结束时间 + 状态 + 操作 + + + + + {{data.classNum + ' 班'}} + {{data.gasClassGroupName}} + {{data.startTime | date : 'yyyy-MM-dd HH:mm:ss'}} + + {{data.endTime | date : 'yyyy-MM-dd HH:mm:ss'}} + 未结束 + + {{data.status | merClassGroupTaskStatus}} + + 操作列表 + + + + + + + +
+ + + + + {{classGroupCountData['startTime'] | date: 'yyyy-MM-dd HH:mm:ss'}} + {{classGroupCountData['endTime'] | date: 'yyyy-MM-dd HH:mm:ss'}} + {{classGroupCountData['refuelPrice']}} 元 + {{classGroupCountData['refuelNum']}} 笔 + {{classGroupCountData['refuelLiters']}} 升 + {{classGroupCountData['refundPrice']}} 元 + {{classGroupCountData['refundNum']}} 笔 + {{classGroupCountData['refundLiters']}} 升 + + + + + + 油号 + 金额 + 升数 + 笔数 + + + + + {{ item.oilNo }}# + {{ item.refuelPrice }}元 + {{ item.refuelLiters }}升 + {{ item.refuelNum }}笔 + + + +
+ + +
+
+
+ + + + + +
+ + 班组 + + + + + + +
+ +
+
+
+
+ + + +
+ + 班组 + + + + + + +
+ +
+
+
+
diff --git a/src/app/pages/mer-class-group/mer-class-group-task/mer-class-group-task.component.less b/src/app/pages/mer-class-group/mer-class-group-task/mer-class-group-task.component.less new file mode 100644 index 0000000..2755744 --- /dev/null +++ b/src/app/pages/mer-class-group/mer-class-group-task/mer-class-group-task.component.less @@ -0,0 +1,8 @@ +.gas-count-btn { + text-align: center; + margin-top: 15px; +} +.gas-count-btn button { + margin-bottom: 15px; + margin-left: 10px; +} diff --git a/src/app/pages/mer-class-group/mer-class-group-task/mer-class-group-task.component.ts b/src/app/pages/mer-class-group/mer-class-group-task/mer-class-group-task.component.ts new file mode 100644 index 0000000..31b03ce --- /dev/null +++ b/src/app/pages/mer-class-group/mer-class-group-task/mer-class-group-task.component.ts @@ -0,0 +1,415 @@ +import { Component } from '@angular/core'; +import {DatePipe, NgForOf, NgIf} from "@angular/common"; +import {FormBuilder, FormGroup, FormsModule, ReactiveFormsModule, Validators} from "@angular/forms"; +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 {NzDescriptionsComponent, NzDescriptionsItemComponent, NzDescriptionsModule} from "ng-zorro-antd/descriptions"; +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 {NzModalComponent, NzModalModule, NzModalService} from "ng-zorro-antd/modal"; +import {NzOptionComponent, NzSelectComponent} from "ng-zorro-antd/select"; +import {NzStatisticComponent, NzStatisticModule} from "ng-zorro-antd/statistic"; +import {NzWaveDirective} from "ng-zorro-antd/core/wave"; +import {NzMessageService} from "ng-zorro-antd/message"; +import {MerClassGroupService} from "../../../services/merchant/mer-class-group.service"; +import {MerClassGroupTaskService} from "../../../services/merchant/mer-class-group-task.service"; +import {DATA} from "../../../data/login/localStorage.namespace"; +import {BrowserStorageService} from "../../../utils/localStorage.service"; +import {MerClassGroupTaskStatusPipe} from "../../../pipes/mer-class-group-task/mer-class-group-task-status.pipe"; +import {DictionaryPipe} from "../../../pipes/common/dictionary.pipe"; +import {NzInputDirective} from "ng-zorro-antd/input"; +import {NzFlexDirective} from "ng-zorro-antd/flex"; +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"; + +@Component({ + selector: 'app-mer-class-group-task', + 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, + NzStatisticModule, + MerClassGroupTaskStatusPipe + ], + templateUrl: './mer-class-group-task.component.html', + styleUrl: './mer-class-group-task.component.less' +}) +export class MerClassGroupTaskComponent { + userInfoObject: any; + + dataObject: any = {}; + tableLoading = true; + searchForm: FormGroup; + pageNum: number = 1; + whereObject: any = {}; + + classGroupArray: any = []; + + startClassGroupModal = false; + startClassGroupModalForm: FormGroup; + + swapClassGroupModal = false; + swapClassGroupModalForm: FormGroup; + + currentClassGroupCountData: any = { + classNum: '无', + refuelPrice: '0', + refuelNum: '0', + refuelLiters: '0', + refundPrice: '0', + refundNum: '0', + status: null, + }; + + classGroupCountDataModal = false; + classGroupCountData: any = {}; + + printModal = false; + printData = {}; + printTaskId: number = 0; + + constructor(private modal: NzModalService, + private storage: BrowserStorageService, + private message: NzMessageService, + private gasClassGroupService: MerClassGroupService, + private gasClassGroupTaskService: MerClassGroupTaskService, + private form: FormBuilder) { + this.userInfoObject = this.storage.get(DATA); + + this.searchForm = this.form.group({ + name: [null], + principalName: [null], + principalPhone: [null], + }); + + this.startClassGroupModalForm = this.form.group({ + gasId: [null], + gasClassGroupId: [null, [Validators.required]], + }); + + this.swapClassGroupModalForm = this.form.group({ + gasId: [null], + gasClassGroupId: [null, [Validators.required]], + }); + + this.gasClassGroupService.getClassGroupList({pageNum: 1, pageSize: 9999}, (data: any) => { + if (data['return_code'] === '000000') { + this.classGroupArray = data['return_data']['list']; + } + }); + this.getCurrentClassGroupCountData(); + this.requestData(1); + + } + /** + * 请求数据 + */ + requestData(pageNum: number) { + if (pageNum != null) { + this.tableLoading = true; + this.whereObject['pageNum'] = pageNum; + this.whereObject['pageSize'] = 10; + this.whereObject['time'] = new Date().getTime(); + this.gasClassGroupTaskService.getClassGroupTaskList(this.whereObject, (data: any) => { + if (data['return_code'] === '000000') { + this.dataObject = data['return_data']; + } else { + this.modal.error(data['return_msg']); + } + this.tableLoading = false; + }); + } + } + + /** + * 搜索 + * @param whereObject 条件 + */ + search(whereObject: object) { + this.whereObject = whereObject; + this.requestData(1); + } + + /** + * 重置 + */ + resetForm(): void { + this.searchForm.reset(); + } + + /** + * 查询当前班组数据 + */ + getCurrentClassGroupCountData() { + this.gasClassGroupTaskService.getCurrentClassGroupTask(this.userInfoObject['account']['objectId'], (data: any) => { + if (data['return_code'] === '000000') { + this.currentClassGroupCountData = data['return_data']; + } else { + this.modal.warning({ + nzTitle: '提示', + nzContent: data['return_msg'], + }); + } + }); + + this.requestData(this.whereObject['pageNum']); + } + + /** + * 打开 开始班组模态框 + */ + showStartClassGroupModal() { + this.startClassGroupModal = true; + } + + /** + * + * 关闭 开始班组模态框 + */ + closeStartClassGroupModal() { + this.startClassGroupModalForm.reset(); + this.startClassGroupModal = false; + } + + /** + * 提交 开始班组数据 + */ + submitStartClassGroup(){ + for (const i in this.startClassGroupModalForm.controls) { + this.startClassGroupModalForm.controls[i].markAsDirty(); + this.startClassGroupModalForm.controls[i].updateValueAndValidity(); + } + if (this.startClassGroupModalForm.status == null || this.startClassGroupModalForm.status !== 'VALID') { + this.modal.warning({ + nzTitle: '提示', + nzContent: '请填写所有必填项', + }); + return; + } + this.startClassGroupModalForm.value.gasId = this.userInfoObject['account']['objectId']; + + // 提交数据 + this.gasClassGroupTaskService.startGroupTask(this.startClassGroupModalForm.value, (data:any) => { + if (data['return_code'] === '000000') { + this.modal.success({ + nzTitle: '提示', + nzContent: '操作成功', + }); + this.getCurrentClassGroupCountData(); + this.requestData(this.whereObject['pageNum']); + this.closeStartClassGroupModal(); + } else { + this.modal.warning({ + nzTitle: '提示', + nzContent: data['return_msg'], + }); + } + }); + } + + + /** + * 打开 交换班组模态框 + */ + showSwapClassGroupModal() { + this.swapClassGroupModal = true; + } + + /** + * 关闭 交换班组模态框 + */ + closeSwapClassGroupModal() { + this.swapClassGroupModalForm.reset(); + this.swapClassGroupModal = false; + } + + /** + * 提交 交换班组提醒框 + */ + submitSwapClassGroupConfirm() { + this.modal.confirm({ + nzTitle: '警告', + nzContent: '确定交换班次吗?', + nzOkText: '是', + nzCancelText: '否', + nzOnOk: () => this.submitSwapClassGroup() + }); + } + + /** + * 提交 交换班组数据 + */ + submitSwapClassGroup() { + for (const i in this.swapClassGroupModalForm.controls) { + this.swapClassGroupModalForm.controls[i].markAsDirty(); + this.swapClassGroupModalForm.controls[i].updateValueAndValidity(); + } + if (this.swapClassGroupModalForm.status == null || this.swapClassGroupModalForm.status !== 'VALID') { + this.modal.warning({ + nzTitle: '提示', + nzContent: '请填写所有必填项', + }); + return; + } + this.swapClassGroupModalForm.value.gasId = this.userInfoObject['account']['objectId']; + + // 提交数据 + this.gasClassGroupTaskService.swapGroupTask(this.swapClassGroupModalForm.value, (data:any) => { + if (data['return_code'] === '000000') { + this.modal.success({ + nzTitle: '提示', + nzContent: '操作成功', + }); + this.getCurrentClassGroupCountData(); + this.requestData(this.whereObject['pageNum']); + this.closeSwapClassGroupModal(); + } else { + this.modal.warning({ + nzTitle: '提示', + nzContent: data['return_msg'], + }); + } + }); + } + + + /** + * 弹出结束对话框 + */ + showEndClassGroupConfirm(): void { + this.modal.confirm({ + nzTitle: '警告', + nzContent: '确定结束本次班次吗?', + nzOkText: '是', + nzCancelText: '否', + nzOnOk: () => this.endClassGroupData() + }); + } + + /** + * 提交结束班次数据 + * + */ + endClassGroupData() { + this.gasClassGroupTaskService.endGroupTask( { gasId: this.userInfoObject['account']['objectId'], }, (data:any) => { + if (data['return_code'] === '000000') { + this.requestData(this.whereObject['pageNum']); + this.getCurrentClassGroupCountData(); + } else { + this.modal.error({ + nzTitle: '提示', + nzContent: data['return_msg'] + }); + } + }); + } + + /** + * 展示班次数据统计 + */ + showClassGroupTaskDataModal(data: any) { + this.classGroupCountData = JSON.parse(data['dataCount']); + this.printTaskId = data['id']; + this.classGroupCountDataModal = true; + } + + /** + * 关闭班次数据统计 + */ + closeClassGroupTaskDataModal() { + this.classGroupCountDataModal = false; + } + + /** + * 展示打印模态框 + * @param data + */ + showPrintModal(data: object) { + this.printData = data; + this.printModal = true; + } + + /** + * 云打印 + */ + cloudPrint() { + this.gasClassGroupTaskService.print(this.printTaskId, (data: any) => { + if (data['return_code'] === '000000') { + this.modal.success({ + nzTitle: '提示', + nzContent: '操作成功', + }); + this.printModal = false; + } + }); + } +} 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 be21f8d..09b7def 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 @@ -1 +1,240 @@ -

oil-discount works!

+
+
+
+ + 所在省级 + + + + + + +
+
+ + 来源渠道 + + + + + + +
+
+ + 油站编号 + + + + +
+
+ + 油站名称 + + + + +
+
+ + + + +
+
+
+
+ 已选择{{setOfCheckedId.size}}家油站 +
+ + + + + 来源渠道 + 连锁名称 + 油站编号 + 油站名称 + 油站地区 + 油站状态 + 操作 + + + + + + {{data.sourceType | dictionary: "MER_SOURCE_TYPE"}} + {{data.chainBrandName?data.chainBrandName:'无'}} + {{data.merNo}} + {{data.merName}} + {{data.provinceName+"/"+data.cityName+"/"+data.areaName}} + {{data.status | dictionary: "MERCHANT_STATUS"}} + + 调整优惠 + + + + 总计 {{ total }} 条 + + + + + + + + 油站 + 油号 + 折扣 + 服务费 + 操作 + + + + + {{data.merName}} + {{data.oilNoName}} + {{data.priceRate}}% + {{data.serviceFeeRate}}% + + 调整 + + + + + + + + + +
+ + 油号 + + + + + + + + + 折扣 + + + + + + + 服务费 + + + + + +
+ +
+
+
+
+ + + + + + + 油站 + 油号 + 折扣 + 服务费 + 操作 + + + + + {{data.merName}} + {{data.oilNoName}} + {{data.priceRate}}% + {{data.serviceFeeRate}}% + + 调整 + + + + + + + + + +
+ + + 油号 + + + + + + + + + 折扣 + + + + + + + 服务费 + + + + + +
+ +
+
+
+
diff --git a/src/app/pages/mer-oil-price/oil-discount/oil-discount.component.less b/src/app/pages/mer-oil-price/oil-discount/oil-discount.component.less index e69de29..b44e8a4 100644 --- a/src/app/pages/mer-oil-price/oil-discount/oil-discount.component.less +++ b/src/app/pages/mer-oil-price/oil-discount/oil-discount.component.less @@ -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; +} diff --git a/src/app/pages/mer-oil-price/oil-discount/oil-discount.component.ts b/src/app/pages/mer-oil-price/oil-discount/oil-discount.component.ts index 759454d..a819428 100644 --- a/src/app/pages/mer-oil-price/oil-discount/oil-discount.component.ts +++ b/src/app/pages/mer-oil-price/oil-discount/oil-discount.component.ts @@ -1,12 +1,349 @@ -import { Component } from '@angular/core'; +import {Component} from '@angular/core'; +import {FormGroup, FormsModule, NonNullableFormBuilder, ReactiveFormsModule, Validators} from "@angular/forms"; +import {DictionaryPipe} from "../../../pipes/common/dictionary.pipe"; +import {MerService} from "../../../services/merchant/mer.service"; +import {NzMessageService} from "ng-zorro-antd/message"; +import {CommonService} from "../../../services/common/common.service"; +import {NzModalModule, NzModalService} from "ng-zorro-antd/modal"; +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 {NzInputDirective} from "ng-zorro-antd/input"; +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 {AgentPriceService} from "../../../services/agent/agent-price.service"; +import {NzTypographyComponent} from "ng-zorro-antd/typography"; @Component({ selector: 'app-oil-discount', standalone: true, - imports: [], + 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: './oil-discount.component.html', styleUrl: './oil-discount.component.less' }) export class OilDiscountComponent { + // 表单页数 + 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 = []; + // 优惠详情模态框 + discountDetailModal = false; + // 优惠详情数据 + discountDetailObj: any = []; + // 修改优惠模态框 + updateDiscountModal = false; + updateDiscountForm: FormGroup; + // 批量修改优惠模态框 + batchUpdateDiscountModal = false; + // 列表中全选状态 + checked = false; + // 已选择的数据 + setOfCheckedId = new Set(); + constructor(private fb: NonNullableFormBuilder, + private merService: MerService, + private message: NzMessageService, + private agentPriceService: AgentPriceService, + private commonService: CommonService, + private modal: NzModalService) { + // 初始化搜索框 + this.searchForm = this.fb.group({ + sourceType: [''], + provinceCode: [''], + merNo: [''], + merName: [''], + status: [''], + }); + + this.updateDiscountForm = this.fb.group({ + merNo: [''], + oilNo: ['', [Validators.required]], + priceRate: ['', [Validators.required]], + serviceFeeRate: ['', [Validators.required]], + }); + // 获取地区 + this.commonService.getRegion("", (data: any) => { + this.regionData = data['return_data']; + }); + + this.queryData(); + } + + /** + * 获取数据 + */ + queryData() { + this.searchForm.value.pageNum = this.tablePageNum; + this.searchForm.value.pageSize = this.tablePageSize; + this.searchForm.value.time = new Date().getTime(); + this.merService.queryMerList(this.searchForm.value, (data: any) => { + if (data['return_code'] == '000000') { + this.tableData = data['return_data']; + this.refreshCheckedStatus(); + } + }); + } + + updateCheckedSet(merNo: string, checked: boolean): void { + if (checked) { + this.setOfCheckedId.add(merNo); + } else { + this.setOfCheckedId.delete(merNo); + } + } + + /** + * 单选 + * @param merNo + * @param checked + */ + onItemChecked(merNo: string, checked: boolean): void { + this.updateCheckedSet(merNo, checked); + this.refreshCheckedStatus(); + } + + /** + * 全选 + * @param checked + */ + onAllChecked(checked: boolean): void { + // @ts-ignore + this.tableData.list.forEach(({ merNo }) => this.updateCheckedSet(merNo, checked)); + this.refreshCheckedStatus(); + } + + /** + * 刷新数据 + */ + refreshCheckedStatus(): void { + // @ts-ignore + this.checked = this.tableData.list.every(({ merNo }) => this.setOfCheckedId.has(merNo)); + console.log(this.setOfCheckedId); + } + + /** + * 搜索表单提交 + */ + searchFormSubmit(): void { + this.tablePageNum = 1; + this.queryData(); + } + + /** + * 搜索表单重置 + */ + searchFormReset(): void { + this.searchForm.reset(); + } + + /** + * 打开批量调整弹出框 + */ + showBatchUpdateDiscount() { + this.batchUpdateDiscountModal = true; + } + + /** + * 提交批量修改 + */ + submitBatchUpdateDiscount() { + if (this.setOfCheckedId.size == 0) { + this.modal.warning({ + nzTitle: '提示', + nzContent: '请再列中勾选需要调整油站' + }); + return; + } + if (this.updateDiscountForm.valid) { + let param = this.updateDiscountForm.value; + let merNoList = []; + for (let merNo of this.setOfCheckedId) { + merNoList.push({merNo: merNo}); + } + param['merNoList'] = merNoList; + param['oilNo'] = this.updateDiscountForm.controls['oilNo'].value; + this.agentPriceService.batchConfigPrice(param, (data: any) => { + if (data['return_code'] == '000000') { + this.message.create('success', '操作成功'); + // 关闭弹窗 + this.closeBatchUpdateDiscount(); + } else { + this.message.create('error', data['return_msg']); + } + }); + } else { + Object.values(this.updateDiscountForm.controls).forEach(control => { + if (control.invalid) { + control.markAsDirty(); + control.updateValueAndValidity({ onlySelf: true }); + } + }); + } + } + + /** + * 关闭批量调整弹出框 + */ + closeBatchUpdateDiscount() { + this.batchUpdateDiscountModal = false; + } + /** + * 打开优惠详情 + */ + showDiscountDetail(merNo: string) { + this.agentPriceService.getOilNoPrice({merNo: merNo}, (data: any) => { + if (data['return_code'] == '000000') { + this.discountDetailObj = data['return_data']; + } + }); + this.discountDetailModal = true; + } + + /** + * 关闭优惠详情 + */ + closeDiscountDetail() { + this.discountDetailModal = false; + } + + /** + * 打开修改优惠模态框 + * @param data + */ + showUpdateDiscount(data: any) { + this.updateDiscountForm.patchValue(data); + this.updateDiscountForm.controls['oilNo'].disable(); + this.updateDiscountModal = true; + } + + /** + * 提交修改优惠 + */ + submitUpdateDiscount() { + if (this.updateDiscountForm.valid) { + this.updateDiscountForm.value; + let paramArr = []; + let param = this.updateDiscountForm.value; + param['oilNo'] = this.updateDiscountForm.controls['oilNo'].value; + paramArr.push(param); + this.agentPriceService.editPrice(paramArr, (data: any) => { + if (data['return_code'] == '000000') { + this.message.create('success', '操作成功'); + // 关闭弹窗 + this.closeUpdateDiscount(); + // 刷新数据 + this.showDiscountDetail(param['merNo']); + // 表单重置 + this.updateDiscountForm.reset(); + } else { + this.message.create('error', data['return_msg']); + } + }); + } else { + Object.values(this.updateDiscountForm.controls).forEach(control => { + if (control.invalid) { + control.markAsDirty(); + control.updateValueAndValidity({ onlySelf: true }); + } + }); + } + } + /** + * 关闭修改优惠模态框 + */ + closeUpdateDiscount() { + this.updateDiscountForm.reset(); + this.updateDiscountModal = false; + } } diff --git a/src/app/pages/merchant/mer-chain-brand-list/mer-chain-brand-list.component.ts b/src/app/pages/merchant/mer-chain-brand-list/mer-chain-brand-list.component.ts index 0512696..6bef362 100644 --- a/src/app/pages/merchant/mer-chain-brand-list/mer-chain-brand-list.component.ts +++ b/src/app/pages/merchant/mer-chain-brand-list/mer-chain-brand-list.component.ts @@ -26,15 +26,7 @@ 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 {NzDatePickerComponent} from "ng-zorro-antd/date-picker"; import {NzMessageService} from "ng-zorro-antd/message"; @Component({ diff --git a/src/app/pages/merchant/merchant.routes.ts b/src/app/pages/merchant/merchant.routes.ts index 96faf30..a99a5eb 100644 --- a/src/app/pages/merchant/merchant.routes.ts +++ b/src/app/pages/merchant/merchant.routes.ts @@ -9,6 +9,11 @@ import {MerChainBrandAmountComponent} from "./mer-chain-brand-amount/mer-chain-b import {DeviceListComponent} from "../device/device-list/device-list.component"; import {OilTaskComponent} from "../mer-oil-price/oil-task/oil-task.component"; import {OilDiscountComponent} from "../mer-oil-price/oil-discount/oil-discount.component"; +import {DevicePrintComponent} from "../device/device-print/device-print.component"; +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"; export const MERCHANT_ROUTES: Routes = [ { path: 'mer-list', component: MerListComponent }, @@ -17,6 +22,11 @@ export const MERCHANT_ROUTES: Routes = [ { path: 'mer-chain-brand-account', component: MerChainBrandAmountComponent }, { path: 'mer-account', component: MerchantAmountListComponent }, { path: 'device-list', component: DeviceListComponent }, + { path: 'device-print', component: DevicePrintComponent }, { path: 'oil-task-list', component: OilTaskComponent }, { path: 'oil-discount-list', component: OilDiscountComponent }, + { path: 'oil-config', component: OilConfigComponent }, + { path: 'qr-code-list', component: QrCodeListComponent }, + { path: 'class-group-list', component: MerClassGroupListComponent }, + { path: 'class-group-task-list', component: MerClassGroupTaskComponent }, ]; diff --git a/src/app/pages/merchant/oil-config/oil-config.component.html b/src/app/pages/merchant/oil-config/oil-config.component.html new file mode 100644 index 0000000..4932336 --- /dev/null +++ b/src/app/pages/merchant/oil-config/oil-config.component.html @@ -0,0 +1,120 @@ +
+
+
+ + 油号 + + + + + + +
+
+ + + + + + +
+
+
+ + + + + 日期 + 油号 + 国标价 + 油枪价 + 优惠价 + 更新时间 + 操作 + + + + + + {{data.weeks | week}} {{today == data.weeks?'(今日)':''}} + + {{data.oilNoName}} + {{data.priceOfficial}} + {{data.priceGun}} + {{data.priceVip}} + {{data.updateTime | date : 'yyyy-MM-dd HH:mm:ss'}} + + + + + + 总计 {{ total }} 条 + + + + +
+ + + 日期 + + + + + + + + + + + + + + + 油品 + + + + + + + + + 国标价 + + + + + + + 油枪价 + + + + + + + 优惠价 + + + + + +
+ +
+
+
+
diff --git a/src/app/pages/merchant/oil-config/oil-config.component.less b/src/app/pages/merchant/oil-config/oil-config.component.less new file mode 100644 index 0000000..90447c4 --- /dev/null +++ b/src/app/pages/merchant/oil-config/oil-config.component.less @@ -0,0 +1,3 @@ +nz-input-number { + width: 100%; +} diff --git a/src/app/pages/merchant/oil-config/oil-config.component.ts b/src/app/pages/merchant/oil-config/oil-config.component.ts new file mode 100644 index 0000000..95b85f2 --- /dev/null +++ b/src/app/pages/merchant/oil-config/oil-config.component.ts @@ -0,0 +1,199 @@ +import { Component } from '@angular/core'; +import {DatePipe, NgForOf, NgIf} from "@angular/common"; +import {DictionaryPipe} from "../../../pipes/common/dictionary.pipe"; +import {FormGroup, FormsModule, NonNullableFormBuilder, ReactiveFormsModule, Validators} from "@angular/forms"; +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 {NzDatePickerComponent} from "ng-zorro-antd/date-picker"; +import {NzFlexDirective} from "ng-zorro-antd/flex"; +import {NzFormControlComponent, NzFormDirective, NzFormItemComponent, NzFormLabelComponent} from "ng-zorro-antd/form"; +import {NzInputNumberComponent, NzInputNumberModule} from "ng-zorro-antd/input-number"; +import {NzModalComponent, NzModalModule, NzModalService} from "ng-zorro-antd/modal"; +import {NzOptionComponent, NzSelectComponent} from "ng-zorro-antd/select"; +import {NzDividerComponent} from "ng-zorro-antd/divider"; +import {NzDropDownADirective, NzDropDownDirective, NzDropdownMenuComponent} from "ng-zorro-antd/dropdown"; +import {NzIconDirective} from "ng-zorro-antd/icon"; +import {NzInputDirective} from "ng-zorro-antd/input"; +import {NzMenuDirective, NzMenuItemComponent} from "ng-zorro-antd/menu"; +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 {NzMessageService} from "ng-zorro-antd/message"; +import {BrowserStorageService} from "../../../utils/localStorage.service"; +import {OilTaskService} from "../../../services/mer-oil-price/oil-task.service"; +import {CommonService} from "../../../services/common/common.service"; +import {DATA} from "../../../data/login/localStorage.namespace"; +import {GasOilPriceWeekService} from "../../../services/mer-oil-price/gas-oil-price-week.service"; +import {WeekPipe} from "../../../pipes/common/week.pipe"; + +@Component({ + selector: 'app-oil-config', + 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, + WeekPipe + ], + templateUrl: './oil-config.component.html', + styleUrl: './oil-config.component.less' +}) +export class OilConfigComponent { + // 表单数据 + tableData: any = []; + // 搜索表单 + searchForm: FormGroup; + // 油号 + oilNoArray = new DictionaryPipe().getDictionaryList('OIL_NO'); + // 商户号 + merNo = null; + // 编辑数据表单 + editDataForm: FormGroup; + editDataModal = false; + + // 当前日期 + today:number = new Date().getDay(); + constructor(private fb: NonNullableFormBuilder, + private message: NzMessageService, + private storage: BrowserStorageService, + private gasOilPriceWeekService: GasOilPriceWeekService, + private commonService: CommonService, + private modal: NzModalService) { + this.merNo = this.storage.get(DATA)['merchant']['merNo']; + + // 初始化搜索框 + this.searchForm = this.fb.group({ + merNo: [this.merNo], + oilNo: [this.oilNoArray[0].codeValue], + }); + + this.editDataForm = this.fb.group({ + id: [null, [Validators.required]], + week: [null], + oilNo: [null], + priceOfficial: [null, [Validators.required]], + priceGun: [null, [Validators.required]], + priceVip: [null, [Validators.required]], + }); + // 查询数据 + this.queryData(); + } + + /** + * 获取数据 + */ + queryData() { + this.searchForm.value.time = new Date().getTime(); + this.gasOilPriceWeekService.getPriceList(this.searchForm.value, (data: any) => { + if (data['return_code'] == '000000') { + this.tableData = data['return_data']; + } + }); + } + + /** + * 搜索表单提交 + */ + searchFormSubmit(): void { + this.queryData(); + } + + /** + * 搜索表单重置 + */ + searchFormReset(): void { + this.searchForm.reset(); + } + + /** + * 打开编辑模态框 + */ + showEditModal(data: any) { + data['week'] = String(data['weeks']); + this.editDataForm.patchValue(data); + this.editDataForm.controls['week'].disable(); + this.editDataForm.controls['oilNo'].disable(); + this.editDataModal = true; + } + + /** + * 提交数据 + */ + submitData() { + if (this.editDataForm.valid) { + this.gasOilPriceWeekService.updatePrice(this.editDataForm.value, (data: any) => { + if (data['return_code'] == '000000') { + this.message.create('success', '操作成功'); + // 刷新数据 + this.queryData(); + // 关闭弹窗 + this.closeEditModal(); + } else { + this.message.create('error', data['return_msg']); + } + }); + } else { + Object.values(this.editDataForm.controls).forEach(control => { + if (control.invalid) { + control.markAsDirty(); + control.updateValueAndValidity({ onlySelf: true }); + } + }); + } + } + + /** + * 关闭编辑任务模态框 + */ + closeEditModal() { + this.editDataForm.reset(); + this.editDataModal = false; + } + +} diff --git a/src/app/pages/merchant/qr-code-list/qr-code-list.component.html b/src/app/pages/merchant/qr-code-list/qr-code-list.component.html new file mode 100644 index 0000000..02e8414 --- /dev/null +++ b/src/app/pages/merchant/qr-code-list/qr-code-list.component.html @@ -0,0 +1,24 @@ + + +
+
+ + + + + + 点击下载 + +
+
+ + + + + + 点击下载 + +
+
+
+
diff --git a/src/app/pages/merchant/qr-code-list/qr-code-list.component.less b/src/app/pages/merchant/qr-code-list/qr-code-list.component.less new file mode 100644 index 0000000..e69de29 diff --git a/src/app/pages/merchant/qr-code-list/qr-code-list.component.ts b/src/app/pages/merchant/qr-code-list/qr-code-list.component.ts new file mode 100644 index 0000000..45cd4e0 --- /dev/null +++ b/src/app/pages/merchant/qr-code-list/qr-code-list.component.ts @@ -0,0 +1,132 @@ +import {Component, ElementRef, ViewChild} from '@angular/core'; +import {DatePipe, NgForOf, NgIf} from "@angular/common"; +import {DictionaryPipe} from "../../../pipes/common/dictionary.pipe"; +import {FormsModule, NonNullableFormBuilder, ReactiveFormsModule} from "@angular/forms"; +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 {NzInputDirective} from "ng-zorro-antd/input"; +import {NzMenuDirective, NzMenuItemComponent} from "ng-zorro-antd/menu"; +import {NzOptionComponent, NzSelectComponent} from "ng-zorro-antd/select"; +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 {WeekPipe} from "../../../pipes/common/week.pipe"; +import {NzMessageService} from "ng-zorro-antd/message"; +import {BrowserStorageService} from "../../../utils/localStorage.service"; +import {CommonService} from "../../../services/common/common.service"; +import {DATA} from "../../../data/login/localStorage.namespace"; +import {MerService} from "../../../services/merchant/mer.service"; +import {NzTabComponent, NzTabSetComponent} from "ng-zorro-antd/tabs"; +import {NzCardComponent} from "ng-zorro-antd/card"; +import {NzQRCodeComponent} from "ng-zorro-antd/qr-code"; + +@Component({ + selector: 'app-qr-code-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, + WeekPipe, + NzTabSetComponent, + NzTabComponent, + NzCardComponent, + NzQRCodeComponent + ], + templateUrl: './qr-code-list.component.html', + styleUrl: './qr-code-list.component.less' +}) +export class QrCodeListComponent { +// 表单数据 + tableData: any = []; + // 商户号 + merNo = null; + + merQrCodeData: any = []; + constructor(private fb: NonNullableFormBuilder, + private message: NzMessageService, + private storage: BrowserStorageService, + private merService: MerService, + private commonService: CommonService, + private modal: NzModalService) { + this.merNo = this.storage.get(DATA)['merchant']['merNo']; + this.merService.queryQrCodeList(this.merNo, (data: any) => { + if (data['return_code'] == '000000') { + this.merQrCodeData = data['return_data']; + } else { + this.message.error(data['return_msg']); + } + }); + } + + + /** + * 下载二维码 + * @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/system/system.routes.ts b/src/app/pages/system/system.routes.ts index 814413d..8fc3182 100644 --- a/src/app/pages/system/system.routes.ts +++ b/src/app/pages/system/system.routes.ts @@ -1,6 +1,8 @@ import { Routes } from '@angular/router'; import {MenuComponent} from "./menu/menu.component"; +import {CmsListComponent} from "../cms/cms-list/cms-list.component"; export const SYSTEM_ROUTES: Routes = [ - { path: 'menu', component: MenuComponent} + { path: 'menu', component: MenuComponent}, + { path: 'cms-list', component: CmsListComponent} ]; diff --git a/src/app/pipes/common/week.pipe.ts b/src/app/pipes/common/week.pipe.ts new file mode 100644 index 0000000..6bd0f05 --- /dev/null +++ b/src/app/pipes/common/week.pipe.ts @@ -0,0 +1,28 @@ +import { Pipe, PipeTransform } from '@angular/core'; + +@Pipe({ + name: 'week', + standalone: true +}) +export class WeekPipe implements PipeTransform { + + transform(weekNum: number): string { + if (weekNum === 1) { + return '星期一'; + } else if (weekNum === 2) { + return '星期二'; + } else if (weekNum === 3) { + return '星期三'; + } else if (weekNum === 4) { + return '星期四'; + } else if (weekNum === 5) { + return '星期五'; + } else if (weekNum === 6) { + return '星期六'; + } else if (weekNum === 7) { + return '星期日'; + } + return '未知' + } + +} diff --git a/src/app/pipes/mer-class-group-task/mer-class-group-task-status.pipe.ts b/src/app/pipes/mer-class-group-task/mer-class-group-task-status.pipe.ts new file mode 100644 index 0000000..08dbfff --- /dev/null +++ b/src/app/pipes/mer-class-group-task/mer-class-group-task-status.pipe.ts @@ -0,0 +1,18 @@ +import { Pipe, PipeTransform } from '@angular/core'; + +@Pipe({ + name: 'merClassGroupTaskStatus', + standalone: true +}) +export class MerClassGroupTaskStatusPipe implements PipeTransform { + + transform(value: number): any { + switch (value) { + case 1: + return '进行中'; + case 2: + return '已结束'; + } + } + +} diff --git a/src/app/services/agent/agent-price.service.ts b/src/app/services/agent/agent-price.service.ts new file mode 100644 index 0000000..d3c9c60 --- /dev/null +++ b/src/app/services/agent/agent-price.service.ts @@ -0,0 +1,48 @@ +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 AgentPriceService { + + constructor(private http: HttpClient) { } + + /** + * 编辑价格 + * @param param + * @param callBack + */ + public editPrice(param: any, callBack:any) { + param.tm = new Date().getTime(); + this.http.post(environment.baseUrl + 'agentPrice/editPrice', param).subscribe(data => { + callBack(data); + }); + } + + /** + * 批量配置价格 + * @param param + * @param callBack + */ + public batchConfigPrice(param: any, callBack:any) { + param.tm = new Date().getTime(); + this.http.post(environment.baseUrl + 'agentPrice/batchConfigPrice', param).subscribe(data => { + callBack(data); + }); + } + + /** + * 油站价格 + * @param param + * @param callBack + */ + public getOilNoPrice(param: any, callBack:any) { + param.tm = new Date().getTime(); + this.http.get(environment.baseUrl + 'agentPrice/getOilNoPrice?'+ObjectData.objectByString(param)).subscribe(data => { + callBack(data); + }); + } +} diff --git a/src/app/services/cms/cms.service.ts b/src/app/services/cms/cms.service.ts new file mode 100644 index 0000000..8b04309 --- /dev/null +++ b/src/app/services/cms/cms.service.ts @@ -0,0 +1,72 @@ +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 CmsService { + + constructor(private http: HttpClient) { } + + /** + * 编辑 + * @param params + * @param callBack + */ + public edit(params: any, callBack:any) { + params.time = new Date().getTime(); + this.http.post(environment.baseUrl + 'cms/edit',params).subscribe(data => { + callBack(data); + }); + } + + /** + * 上线 + * @param params + * @param callBack + */ + public online(params: any, callBack:any) { + params.time = new Date().getTime(); + this.http.post(environment.baseUrl + 'cms/online',params).subscribe(data => { + callBack(data); + }); + } + + /** + * 下线 + * @param params + * @param callBack + */ + public offline(params: any, callBack:any) { + params.time = new Date().getTime(); + this.http.post(environment.baseUrl + 'cms/offline',params).subscribe(data => { + callBack(data); + }); + } + + /** + * 删除 + * @param params + * @param callBack + */ + public delete(params: any, callBack:any) { + params.time = new Date().getTime(); + this.http.post(environment.baseUrl + 'cms/delete',params).subscribe(data => { + callBack(data); + }); + } + + /** + * 查询列表 + * @param params + * @param callBack + */ + public queryList(params: any, callBack:any) { + params.time = new Date().getTime(); + this.http.get(environment.baseUrl + 'cms/queryList?'+ObjectData.objectByString(params)).subscribe(data => { + callBack(data); + }); + } +} diff --git a/src/app/services/device/device.service.ts b/src/app/services/device/device.service.ts index 44b61a8..e3efd93 100644 --- a/src/app/services/device/device.service.ts +++ b/src/app/services/device/device.service.ts @@ -65,7 +65,7 @@ export class DeviceService { */ public settingReceipt(params: any, callBack:any) { params.time = new Date().getTime(); - this.http.get(environment.baseUrl + 'device/settingReceipt', params).subscribe(data => { + this.http.post(environment.baseUrl + 'device/settingReceipt', params).subscribe(data => { callBack(data); }); } diff --git a/src/app/services/mer-oil-price/gas-oil-price-week.service.ts b/src/app/services/mer-oil-price/gas-oil-price-week.service.ts new file mode 100644 index 0000000..aa0c2c5 --- /dev/null +++ b/src/app/services/mer-oil-price/gas-oil-price-week.service.ts @@ -0,0 +1,36 @@ +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 GasOilPriceWeekService { + + constructor(private http: HttpClient) { } + + /** + * 修改价格 + * @param params + * @param callBack + */ + public updatePrice(params: any, callBack:any) { + params.time = new Date().getTime(); + this.http.post(environment.baseUrl + 'gasOilPriceWeek/updatePrice', params).subscribe(data => { + callBack(data); + }); + } + + /** + * 查询价格 + * @param params + * @param callBack + */ + public getPriceList(params: any, callBack:any) { + params.time = new Date().getTime(); + this.http.get(environment.baseUrl + 'gasOilPriceWeek/getPriceList?'+ObjectData.objectByString(params)).subscribe(data => { + callBack(data); + }); + } +} diff --git a/src/app/services/merchant/mer-class-group-task.service.ts b/src/app/services/merchant/mer-class-group-task.service.ts new file mode 100644 index 0000000..5145bcc --- /dev/null +++ b/src/app/services/merchant/mer-class-group-task.service.ts @@ -0,0 +1,98 @@ +import { Injectable } from '@angular/core'; +import {HttpClient} from '@angular/common/http'; +import {ObjectData} from "../../utils/objectData.service"; +import {environment} from "../../../environments/environment"; +@Injectable({ + providedIn: 'root' +}) +export class MerClassGroupTaskService { + + constructor( + private http: HttpClient + ) { } + + /** + * 开启班组任务 + * + * @param param 参数对象 + * @param callBack 回调 + */ + public startGroupTask(param: object, callBack: any) { + this.http.post(environment.baseUrl + 'gasClassGroupTask/startGroupTask', param).subscribe(data => { + callBack(data); + }); + } + + /** + * 结束班组任务 + * + * @param param 参数对象 + * @param callBack 回调 + */ + public endGroupTask(param: object, callBack: any) { + this.http.post(environment.baseUrl + 'gasClassGroupTask/endGroupTask', param).subscribe(data => { + callBack(data); + }); + } + + /** + * 交换班组任务 + * + * @param param 参数对象 + * @param callBack 回调 + */ + public swapGroupTask(param: object, callBack: any) { + this.http.post(environment.baseUrl + 'gasClassGroupTask/swapGroupTask', param).subscribe(data => { + callBack(data); + }); + } + + /** + * 交换班组任务 + * + * @param param 参数对象 + * @param callBack 回调 + */ + public getClassGroupTaskById(id: number, callBack: any) { + this.http.get(environment.baseUrl + 'gasClassGroupTask/getClassGroupTaskById?gasClassGroupTaskId=' + id).subscribe(data => { + callBack(data); + }); + } + + /** + * 交换班组任务 + * + * @param param 参数对象 + * @param callBack 回调 + */ + public getCurrentClassGroupTask(gasId: number, callBack: any) { + this.http.get(environment.baseUrl + 'gasClassGroupTask/getCurrentClassGroupTask?time='+new Date().getTime()+'&gasId=' + gasId).subscribe(data => { + callBack(data); + }); + } + + /** + * 交换班组任务 + * + * @param param 参数对象 + * @param callBack 回调 + */ + public getClassGroupTaskList(param: object, callBack: any) { + this.http.get(environment.baseUrl + 'gasClassGroupTask/getClassGroupTaskList?' + ObjectData.objectByString(param)).subscribe(data => { + callBack(data); + }); + } + + /** + * 打印小票 + * + * @param param 参数对象 + * @param callBack 回调 + */ + public print(gasClassGroupTaskId: number, callBack: any) { + this.http.get(environment.baseUrl + 'gasClassGroupTask/print?time='+new Date().getTime()+'&gasClassGroupTaskId=' + gasClassGroupTaskId).subscribe(data => { + callBack(data); + }); + } + +} diff --git a/src/app/services/merchant/mer-class-group.service.ts b/src/app/services/merchant/mer-class-group.service.ts new file mode 100644 index 0000000..7b9448d --- /dev/null +++ b/src/app/services/merchant/mer-class-group.service.ts @@ -0,0 +1,62 @@ +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 MerClassGroupService { + + constructor( + private http: HttpClient + ) { } + + /** + * 编辑班组 + * + * @param param 参数对象 + * @param callBack 回调 + */ + public editClassGroup(param: object, callBack: any) { + this.http.post(environment.baseUrl + 'gasClassGroup/editClassGroup', param).subscribe(data => { + callBack(data); + }); + } + + /** + * 删除班组 + * + * @param param 参数对象 + * @param callBack 回调 + */ + public delClassGroup(groupId: number, callBack: any) { + this.http.post(environment.baseUrl + 'gasClassGroup/delClassGroup', { id: groupId}).subscribe(data => { + callBack(data); + }); + } + + /** + * 根据id查询详情 + * + * @param groupId 班组id + * @param callBack 回调 + */ + public getClassGroupById(groupId: number, callBack: any) { + this.http.get(environment.baseUrl + 'gasClassGroup/getClassGroupById?groupId=' + groupId).subscribe(data => { + callBack(data); + }); + } + + /** + * 查询班组列表 + * + * @param param 参数对象 + * @param callBack 回调 + */ + public getClassGroupList(param: Object, callBack: any) { + this.http.get(environment.baseUrl + 'gasClassGroup/getClassGroupList?'+ObjectData.objectByString(param)).subscribe(data => { + callBack(data); + }); + } +} diff --git a/src/app/services/merchant/mer-qr-code.service.ts b/src/app/services/merchant/mer-qr-code.service.ts new file mode 100644 index 0000000..5039a0e --- /dev/null +++ b/src/app/services/merchant/mer-qr-code.service.ts @@ -0,0 +1,24 @@ +import { Injectable } from '@angular/core'; +import {environment} from "../../../environments/environment"; +import {ObjectData} from "../../utils/objectData.service"; +import {HttpClient} from "@angular/common/http"; + +@Injectable({ + providedIn: 'root' +}) +export class MerQrCodeService { + + constructor(private http: HttpClient) { } + + /** + * 查询商户列表 + * @param params + * @param callBack + */ + public queryQrCodeList(params: any, callBack:any) { + params.time = new Date().getTime(); + this.http.get(environment.baseUrl + 'merchantQrCode/queryQrCodeList?'+ObjectData.objectByString(params)).subscribe(data => { + callBack(data); + }); + } +}