From 3109fee9c18e8bfbc9129c0e2ce3ef0e854f9688 Mon Sep 17 00:00:00 2001 From: hu177768073 <177768073@qq.com> Date: Wed, 18 Dec 2024 14:46:47 +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 --- src/app/app.routes.ts | 10 + .../agent-api-account.component.html | 78 +++ .../agent-api-account.component.less | 18 + .../agent-api-account.component.ts | 169 +++++++ .../agent-list/agent-list.component.html | 255 ++++++++++ .../agent-list/agent-list.component.less | 9 + .../agent/agent-list/agent-list.component.ts | 391 +++++++++++++++ .../agent-mer-account.component.html | 177 +++++++ .../agent-mer-account.component.less | 9 + .../agent-mer-account.component.ts | 279 +++++++++++ .../agent-mer-list.component.html | 154 ++++++ .../agent-mer-list.component.less | 15 + .../agent-mer-list.component.ts | 362 ++++++++++++++ .../agent-price-list.component.html | 200 ++++++++ .../agent-price-list.component.less | 15 + .../agent-price-list.component.ts | 338 +++++++++++++ .../agent-refer-price-list.component.html | 124 +++++ .../agent-refer-price-list.component.less | 15 + .../agent-refer-price-list.component.ts | 193 ++++++++ .../agent-staff/agent-staff.component.html | 105 +++++ .../agent-staff/agent-staff.component.less | 9 + .../agent-staff/agent-staff.component.ts | 234 +++++++++ src/app/pages/agent/agent.module.ts | 12 + src/app/pages/agent/agent.routes.ts | 18 + .../cms/cms-list/cms-list.component.html | 2 +- .../discount-pk-edit.component.html | 123 +++++ .../discount-pk-edit.component.less | 19 + .../discount-pk-edit.component.ts | 299 ++++++++++++ .../discount-pk-list.component.html | 1 + .../discount-pk-list.component.less | 0 .../discount-pk-list.component.ts | 12 + .../discount-pk-stock-code.component.html | 1 + .../discount-pk-stock-code.component.less | 0 .../discount-pk-stock-code.component.ts | 12 + .../discount-pk-stock.component.html | 1 + .../discount-pk-stock.component.less | 0 .../discount-pk-stock.component.ts | 12 + .../discount-edit.component.html | 63 +++ .../discount-edit.component.less | 19 + .../discount-edit/discount-edit.component.ts | 141 ++++++ .../discount-list.component.html | 280 +++++++++++ .../discount-list.component.less | 21 + .../discount-list/discount-list.component.ts | 446 ++++++++++++++++++ .../discount-stock-code.component.html | 86 ++++ .../discount-stock-code.component.less | 0 .../discount-stock-code.component.ts | 154 ++++++ .../discount-stock.component.html | 92 ++++ .../discount-stock.component.less | 21 + .../discount-stock.component.ts | 227 +++++++++ src/app/pages/discount/discount.module.ts | 12 + src/app/pages/discount/discount.routes.ts | 12 + .../oil-discount/oil-discount.component.html | 2 +- .../oil-discount/oil-discount.component.ts | 2 + .../oil-task/oil-task.component.html | 4 +- .../mer-chain-brand-amount.component.html | 2 +- .../merchant-amount-list.component.html | 2 +- .../merchant-amount.component.html | 96 ++++ .../merchant-amount.component.less | 27 ++ .../merchant-amount.component.ts | 184 ++++++++ src/app/pages/merchant/merchant.routes.ts | 7 +- .../order-oil-list.component.html | 45 +- .../order-oil-list.component.ts | 3 + src/app/services/agent/agent-api.service.ts | 75 +++ .../agent/agent-mer-account.service.ts | 62 +++ src/app/services/agent/agent-mer.service.ts | 74 +++ src/app/services/agent/agent-price.service.ts | 12 + src/app/services/agent/agent-staff.service.ts | 60 +++ src/app/services/agent/agent.service.ts | 36 ++ .../discount/discount-pk-stock.service.ts | 47 ++ .../services/discount/discount-pk.service.ts | 98 ++++ .../discount/discount-stock.service.ts | 62 +++ src/app/services/discount/discount.service.ts | 135 ++++++ src/environments/environment.ts | 2 +- 73 files changed, 6252 insertions(+), 30 deletions(-) create mode 100644 src/app/pages/agent/agent-api-account/agent-api-account.component.html create mode 100644 src/app/pages/agent/agent-api-account/agent-api-account.component.less create mode 100644 src/app/pages/agent/agent-api-account/agent-api-account.component.ts create mode 100644 src/app/pages/agent/agent-list/agent-list.component.html create mode 100644 src/app/pages/agent/agent-list/agent-list.component.less create mode 100644 src/app/pages/agent/agent-list/agent-list.component.ts create mode 100644 src/app/pages/agent/agent-mer-account/agent-mer-account.component.html create mode 100644 src/app/pages/agent/agent-mer-account/agent-mer-account.component.less create mode 100644 src/app/pages/agent/agent-mer-account/agent-mer-account.component.ts create mode 100644 src/app/pages/agent/agent-mer-list/agent-mer-list.component.html create mode 100644 src/app/pages/agent/agent-mer-list/agent-mer-list.component.less create mode 100644 src/app/pages/agent/agent-mer-list/agent-mer-list.component.ts create mode 100644 src/app/pages/agent/agent-price-list/agent-price-list.component.html create mode 100644 src/app/pages/agent/agent-price-list/agent-price-list.component.less create mode 100644 src/app/pages/agent/agent-price-list/agent-price-list.component.ts create mode 100644 src/app/pages/agent/agent-refer-price-list/agent-refer-price-list.component.html create mode 100644 src/app/pages/agent/agent-refer-price-list/agent-refer-price-list.component.less create mode 100644 src/app/pages/agent/agent-refer-price-list/agent-refer-price-list.component.ts create mode 100644 src/app/pages/agent/agent-staff/agent-staff.component.html create mode 100644 src/app/pages/agent/agent-staff/agent-staff.component.less create mode 100644 src/app/pages/agent/agent-staff/agent-staff.component.ts create mode 100644 src/app/pages/agent/agent.module.ts create mode 100644 src/app/pages/agent/agent.routes.ts create mode 100644 src/app/pages/discount-pk/discount-pk-edit/discount-pk-edit.component.html create mode 100644 src/app/pages/discount-pk/discount-pk-edit/discount-pk-edit.component.less create mode 100644 src/app/pages/discount-pk/discount-pk-edit/discount-pk-edit.component.ts create mode 100644 src/app/pages/discount-pk/discount-pk-list/discount-pk-list.component.html create mode 100644 src/app/pages/discount-pk/discount-pk-list/discount-pk-list.component.less create mode 100644 src/app/pages/discount-pk/discount-pk-list/discount-pk-list.component.ts create mode 100644 src/app/pages/discount-pk/discount-pk-stock-code/discount-pk-stock-code.component.html create mode 100644 src/app/pages/discount-pk/discount-pk-stock-code/discount-pk-stock-code.component.less create mode 100644 src/app/pages/discount-pk/discount-pk-stock-code/discount-pk-stock-code.component.ts create mode 100644 src/app/pages/discount-pk/discount-pk-stock/discount-pk-stock.component.html create mode 100644 src/app/pages/discount-pk/discount-pk-stock/discount-pk-stock.component.less create mode 100644 src/app/pages/discount-pk/discount-pk-stock/discount-pk-stock.component.ts create mode 100644 src/app/pages/discount/discount-edit/discount-edit.component.html create mode 100644 src/app/pages/discount/discount-edit/discount-edit.component.less create mode 100644 src/app/pages/discount/discount-edit/discount-edit.component.ts create mode 100644 src/app/pages/discount/discount-list/discount-list.component.html create mode 100644 src/app/pages/discount/discount-list/discount-list.component.less create mode 100644 src/app/pages/discount/discount-list/discount-list.component.ts create mode 100644 src/app/pages/discount/discount-stock-code/discount-stock-code.component.html create mode 100644 src/app/pages/discount/discount-stock-code/discount-stock-code.component.less create mode 100644 src/app/pages/discount/discount-stock-code/discount-stock-code.component.ts create mode 100644 src/app/pages/discount/discount-stock/discount-stock.component.html create mode 100644 src/app/pages/discount/discount-stock/discount-stock.component.less create mode 100644 src/app/pages/discount/discount-stock/discount-stock.component.ts create mode 100644 src/app/pages/discount/discount.module.ts create mode 100644 src/app/pages/discount/discount.routes.ts create mode 100644 src/app/pages/merchant/merchant-amount/merchant-amount.component.html create mode 100644 src/app/pages/merchant/merchant-amount/merchant-amount.component.less create mode 100644 src/app/pages/merchant/merchant-amount/merchant-amount.component.ts create mode 100644 src/app/services/agent/agent-api.service.ts create mode 100644 src/app/services/agent/agent-mer-account.service.ts create mode 100644 src/app/services/agent/agent-mer.service.ts create mode 100644 src/app/services/discount/discount-pk-stock.service.ts create mode 100644 src/app/services/discount/discount-pk.service.ts create mode 100644 src/app/services/discount/discount-stock.service.ts create mode 100644 src/app/services/discount/discount.service.ts diff --git a/src/app/app.routes.ts b/src/app/app.routes.ts index d2a9070..7f85288 100644 --- a/src/app/app.routes.ts +++ b/src/app/app.routes.ts @@ -31,6 +31,16 @@ export const routes: Routes = [ loadChildren: () => import('./pages/merchant/merchant.routes').then(m => m.MERCHANT_ROUTES), canActivate: [InitGuardService] }, + { + path: 'discount', + loadChildren: () => import('./pages/discount/discount.routes').then(m => m.DISCOUNT_ROUTES), + canActivate: [InitGuardService] + }, + { + path: 'agent', + loadChildren: () => import('./pages/agent/agent.routes').then(m => m.AGENT_ROUTES), + canActivate: [InitGuardService] + }, { path: 'trade', loadChildren: () => import('./pages/trade/trade.routes').then(m => m.TRADE_ROUTES), diff --git a/src/app/pages/agent/agent-api-account/agent-api-account.component.html b/src/app/pages/agent/agent-api-account/agent-api-account.component.html new file mode 100644 index 0000000..cfa7ee6 --- /dev/null +++ b/src/app/pages/agent/agent-api-account/agent-api-account.component.html @@ -0,0 +1,78 @@ +
+
+
+ + 交易类型 + + + + + + + +
+ +
+ + 交易来源 + + + + + + +
+ +
+ + + + + + + +
+
+
+ +
+
+ 账户余额: + ¥ {{agentAccount.amount}} +
+
+ + + + 交易前金额 + 交易金额 + 交易后金额 + 交易类型 + 交易时间 + 交易来源 + + + + + + ¥{{data.beforeAmount}} + ¥{{data.transactionAmount}} + ¥{{data.afterAmount}} + {{data.type==1?'入账':'出账'}} + {{data.createTime | date: 'yyyy-MM-dd HH:mm:ss'}} + {{data.sourceType | dictionary: 'MER_ACCOUNT_RECORD_SOURCE_TYPE'}} + + 总计 {{ total }} 条 + diff --git a/src/app/pages/agent/agent-api-account/agent-api-account.component.less b/src/app/pages/agent/agent-api-account/agent-api-account.component.less new file mode 100644 index 0000000..4be53de --- /dev/null +++ b/src/app/pages/agent/agent-api-account/agent-api-account.component.less @@ -0,0 +1,18 @@ +.csp-statistic { + font-feature-settings: "tnum"; + border: 1px solid #d9d9d9; + border-radius: 4px; +} +.csp-statistic-title { + padding: 0 16px; + height: 64px; + display: -ms-flexbox; + display: flex; + -ms-flex-align: center; + align-items: center; + background-color: #fafafa; +} +.csp-text-primary{ + font-size: 20px; + color: #1890ff; +} diff --git a/src/app/pages/agent/agent-api-account/agent-api-account.component.ts b/src/app/pages/agent/agent-api-account/agent-api-account.component.ts new file mode 100644 index 0000000..192a79e --- /dev/null +++ b/src/app/pages/agent/agent-api-account/agent-api-account.component.ts @@ -0,0 +1,169 @@ +import {Component, Input, OnInit} 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 {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 {NzMessageService} from "ng-zorro-antd/message"; +import {AgentApiService} from "../../../services/agent/agent-api.service"; +import {CommonService} from "../../../services/common/common.service"; +import {AgentService} from "../../../services/agent/agent.service"; +import {BrowserStorageService} from "../../../utils/localStorage.service"; +import {NzStatisticComponent, NzStatisticModule} from "ng-zorro-antd/statistic"; +import {NzTypographyComponent} from "ng-zorro-antd/typography"; + +@Component({ + selector: 'app-agent-api-account', + 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, + NzStatisticModule, + NzTypographyComponent + ], + templateUrl: './agent-api-account.component.html', + styleUrl: './agent-api-account.component.less' +}) +export class AgentApiAccountComponent implements OnInit { + @Input() agentId: any; + // 表单页数 + tablePageNum = 1; + // 每页数量 + tablePageSize = 10; + // 表单数据 + tableData: any = { + total: 0, + list: [], + }; + // 代理账户 + agentAccount: any = { + amount: 0 + }; + // 搜索表单 + searchForm: FormGroup; + // 代理商类型 + sourceTypeArray = new DictionaryPipe().getDictionaryList('MER_ACCOUNT_RECORD_SOURCE_TYPE'); + constructor(private fb: NonNullableFormBuilder, + private message: NzMessageService, + private storage: BrowserStorageService, + private agentService: AgentService, + private agentApiService: AgentApiService, + private commonService: CommonService, + private modal: NzModalService) { + // 初始化搜索框 + this.searchForm = this.fb.group({ + type: [null], + sourceType: [null], + }); + } + + ngOnInit(): void { + // 查询数据 + this.queryData(); + this.queryAccount(); + } + + /** + * 获取数据 + */ + queryData() { + this.searchForm.value.agentId = this.agentId; + this.searchForm.value.pageNum = this.tablePageNum; + this.searchForm.value.pageSize = this.tablePageSize; + this.searchForm.value.time = new Date().getTime(); + this.agentApiService.getRecordList(this.searchForm.value, (data: any) => { + if (data['return_code'] == '000000') { + this.tableData = data['return_data']; + } + }); + } + + /** + * 查询账户 + */ + queryAccount() { + this.searchForm.value.agentId = this.agentId; + this.agentApiService.getAccount(this.searchForm.value, (data: any) => { + if (data['return_code'] == '000000') { + this.agentAccount = data['return_data']; + } + }); + } + + /** + * 搜索表单提交 + */ + searchFormSubmit(): void { + this.tablePageNum = 1; + this.queryData(); + } + + /** + * 搜索表单重置 + */ + searchFormReset(): void { + this.searchForm.reset(); + } + +} diff --git a/src/app/pages/agent/agent-list/agent-list.component.html b/src/app/pages/agent/agent-list/agent-list.component.html new file mode 100644 index 0000000..66a4491 --- /dev/null +++ b/src/app/pages/agent/agent-list/agent-list.component.html @@ -0,0 +1,255 @@ +
+
+ +
+ + 代理类型 + + + + + + +
+ +
+ + 代理编号 + + + + +
+ +
+ + 代理名称 + + + + +
+ +
+ + + + + + + + +
+
+
+ + + + + 代理类型 + 代理编号 + 代理名称 + 联系人 + 联系方式 + 创建时间 + 操作 + + + + + {{data.type | dictionary : 'AGENT_TYPE'}} + {{data.agentNo}} + {{data.name}} + {{data.contactsName}} + {{data.contactsTelephone}} + {{data.createTime | date : 'yyyy-MM-dd HH:mm:ss'}} + + + 操作列表 + + + + + + + + 总计 {{ total }} 条 + + + + +
+ + + 代理类型 + + + + + + + + + 登录账户 + + + + + + + 代理名称 + + + + + + + 联系人 + + + + + + + 联系方式 + + + + + + +
+ +
+
+
+
+ + + +
+ + 代理编号 + + + + + + + 代理名称 + + + + + + + 当前余额 + + + + + + + 充值金额 + + + + + +
+ +
+
+
+
+ + + +
+ + 代理编号 + + + + + + + 代理名称 + + + + + + + appId + + + + + + + appSecret + + + + + + + 油站信息变更通知 + + + + + + + 订单退款审核通知 + + + + + +
+ +
+
+
+
+ + + + + + diff --git a/src/app/pages/agent/agent-list/agent-list.component.less b/src/app/pages/agent/agent-list/agent-list.component.less new file mode 100644 index 0000000..8654bcc --- /dev/null +++ b/src/app/pages/agent/agent-list/agent-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/agent/agent-list/agent-list.component.ts b/src/app/pages/agent/agent-list/agent-list.component.ts new file mode 100644 index 0000000..5e00e6b --- /dev/null +++ b/src/app/pages/agent/agent-list/agent-list.component.ts @@ -0,0 +1,391 @@ +import {Component, OnInit} from '@angular/core'; +import {DatePipe, NgForOf, NgIf} from "@angular/common"; +import {DictionaryPipe} from "../../../pipes/common/dictionary.pipe"; +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 {NzFlexDirective} from "ng-zorro-antd/flex"; +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 {NzOptionComponent, NzSelectComponent} from "ng-zorro-antd/select"; +import {FormGroup, FormsModule, NonNullableFormBuilder, ReactiveFormsModule, Validators} from "@angular/forms"; +import {NzImageDirective, NzImageModule} from "ng-zorro-antd/image"; +import {NzUploadComponent, NzUploadFile} from "ng-zorro-antd/upload"; +import {NzDescriptionsModule} from "ng-zorro-antd/descriptions"; +import {NzAvatarModule} from "ng-zorro-antd/avatar"; +import {NzSwitchComponent} from "ng-zorro-antd/switch"; +import {NzDatePickerComponent} from "ng-zorro-antd/date-picker"; +import {NzInputNumberModule} from "ng-zorro-antd/input-number"; +import {NzMessageService} from "ng-zorro-antd/message"; +import {BrowserStorageService} from "../../../utils/localStorage.service"; +import {CommonService} from "../../../services/common/common.service"; +import {Observable, Observer} from "rxjs"; +import {AgentService} from "../../../services/agent/agent.service"; +import {DATA} from "../../../data/login/localStorage.namespace"; +import {AgentApiService} from "../../../services/agent/agent-api.service"; +import {AgentApiAccountComponent} from "../agent-api-account/agent-api-account.component"; +@Component({ + selector: 'app-agent-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, + AgentApiAccountComponent + ], + templateUrl: './agent-list.component.html', + styleUrl: './agent-list.component.less' +}) +export class AgentListComponent { + // 表单页数 + tablePageNum = 1; + // 每页数量 + tablePageSize = 10; + // 表单数据 + tableData: any = { + total: 0, + list: [], + }; + // 搜索表单 + searchForm: FormGroup; + // 编辑表单 + editAgentForm: FormGroup; + editAgentModal = false; + // 代理商类型 + agentTypeArray = new DictionaryPipe().getDictionaryList('AGENT_TYPE'); + // 代理商API额度充值模态框 + agentApiRechargeModal = false; + agentApiRechargeForm: FormGroup; + // 代理商API参数 + agentApiParamModal = false; + agentApiParamForm: FormGroup; + // 代理商API交易记录 + currentAgentId: any; + agentApiRecordModal = false; + + constructor(private fb: NonNullableFormBuilder, + private message: NzMessageService, + private storage: BrowserStorageService, + private agentService: AgentService, + private agentApiService: AgentApiService, + private commonService: CommonService, + private modal: NzModalService) { + // 初始化搜索框 + this.searchForm = this.fb.group({ + type: [null], + agentNo: [null], + agentName: [null], + }); + + this.editAgentForm = this.fb.group({ + agentNo: [null], + type: ['', [Validators.required]], + name: ['', [Validators.required]], + contactsName: ['', [Validators.required]], + contactsTelephone: ['', [Validators.required]], + loginName: [''], + }); + + this.agentApiRechargeForm = this.fb.group({ + agentId: [{value: null, disabled: true}], + agentNo: [{value: null, disabled: true}], + agentName: [{value: null, disabled: true}], + currentAmount: [{value: null, disabled: true}], + amount: [0, [Validators.required]], + }); + + this.agentApiParamForm = this.fb.group({ + agentId: [{value: null, disabled: true}], + agentNo: [{value: null, disabled: true}], + agentName: [{value: null, disabled: true}], + appId: [{value: null, disabled: true}], + appSecret: [{value: null, disabled: true}], + merInfoNotify: [null], + orderRefundNotify: [null], + }); + + // 查询数据 + this.queryData(); + } + + /** + * 获取数据 + */ + queryData() { + this.searchForm.value.pageNum = this.tablePageNum; + this.searchForm.value.pageSize = this.tablePageSize; + this.searchForm.value.time = new Date().getTime(); + this.agentService.queryAgentList(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(); + } + + /** + * 打开编辑模态框 + */ + showEditAgentModal(data: any) { + if (data != null) { + data['type'] = String(data['type']); + this.editAgentForm.patchValue(data); + this.editAgentForm.controls['type'].disable(); + } + this.editAgentModal = true; + } + + /** + * 提交数据 + */ + submitData() { + if (this.editAgentForm.valid) { + if (this.editAgentForm.controls['agentNo'].value == null) { + this.agentService.createAgent(this.editAgentForm.value, (data: any) => { + if (data['return_code'] == '000000') { + this.message.create('success', '操作成功'); + // 刷新数据 + this.queryData(); + // 关闭弹窗 + this.closeEditModal(); + // 表单重置 + this.editAgentForm.reset(); + } else { + this.message.create('error', data['return_msg']); + } + }); + } else { + this.agentService.updateAgent(this.editAgentForm.value, (data: any) => { + if (data['return_code'] == '000000') { + this.message.create('success', '操作成功'); + // 刷新数据 + this.queryData(); + // 关闭弹窗 + this.closeEditModal(); + // 表单重置 + this.editAgentForm.reset(); + } else { + this.message.create('error', data['return_msg']); + } + }); + } + + } else { + Object.values(this.editAgentForm.controls).forEach(control => { + if (control.invalid) { + control.markAsDirty(); + control.updateValueAndValidity({ onlySelf: true }); + } + }); + } + } + + /** + * 关闭编辑模态框 + */ + closeEditModal() { + this.editAgentForm.reset(); + this.editAgentForm.controls['agentNo'].setValue(null); + this.editAgentForm.controls['type'].enable(); + this.editAgentModal = false; + } + + /** + * 打开API充值框 + * @param agent + */ + showApiRecharge(agent: any) { + this.agentApiService.getAccount({agentId: agent['id']}, (data:any) => { + if (data['return_code'] == '000000') { + this.agentApiRechargeForm.patchValue({ + agentId: agent['id'], + agentNo: agent['agentNo'], + agentName: agent['name'], + currentAmount: data['return_data']['amount'], + }); + this.agentApiRechargeModal = true; + } else { + this.message.create('error', data['return_msg']); + } + }); + } + + /** + * api余额充值确认框 + */ + apiRechargeConfirm() { + if (this.agentApiRechargeForm.valid) { + this.modal.confirm({ + nzTitle: '充值提醒', + nzContent: '确认为【' + this.agentApiRechargeForm.controls['agentName'].value + '】代理API余额充值:¥' +this.agentApiRechargeForm.controls['amount'].value + '吗?', + nzOnOk: () => this.submitApiRecharge() + }); + + } else { + Object.values(this.agentApiRechargeForm.controls).forEach(control => { + if (control.invalid) { + control.markAsDirty(); + control.updateValueAndValidity({ onlySelf: true }); + } + }); + } + } + + /** + * 提交api充值 + */ + submitApiRecharge() { + const param = { + agentId: this.agentApiRechargeForm.controls['agentId'].value, + amount: this.agentApiRechargeForm.controls['amount'].value, + } + this.agentApiService.recharge(param, (data: any) => { + if (data['return_code'] == '000000') { + this.message.create('success', '操作成功'); + // 刷新数据 + this.queryData(); + // 关闭弹窗 + this.closeApiRecharge(); + } else { + this.message.create('error', data['return_msg']); + } + }); + } + + /** + * 关闭充值模态框 + */ + closeApiRecharge() { + this.agentApiRechargeForm.reset(); + this.agentApiRechargeModal = false; + } + + + /** + * 打开API充值框 + * @param agent + */ + showApiParam(agent: any) { + this.agentApiService.getApiParam({agentId: agent['id']}, (data:any) => { + if (data['return_code'] == '000000') { + this.agentApiParamForm.patchValue({ + agentId: agent['id'], + agentNo: agent['agentNo'], + agentName: agent['name'], + appId: data['return_data']['appId'], + appSecret: data['return_data']['appSecret'], + merInfoNotify: data['return_data']['merInfoNotify'], + orderRefundNotify: data['return_data']['orderRefundNotify'], + }); + this.agentApiParamModal = true; + } else { + this.message.create('error', data['return_msg']); + } + }); + } + + /** + * 提交api充值 + */ + submitApiParam() { + const param = { + agentId: this.agentApiParamForm.controls['agentId'].value, + merInfoNotify: this.agentApiParamForm.controls['merInfoNotify'].value, + orderRefundNotify: this.agentApiParamForm.controls['orderRefundNotify'].value, + } + this.agentApiService.updateApiParam(param, (data: any) => { + if (data['return_code'] == '000000') { + this.message.create('success', '操作成功'); + // 关闭弹窗 + this.closeApiParam(); + } else { + this.message.create('error', data['return_msg']); + } + }); + } + + /** + * 关闭API参数 + */ + closeApiParam() { + this.agentApiParamForm.reset(); + this.agentApiParamModal = false; + } + + /** + * 展示交易记录 + */ + showRecord(agentId: any) { + this.currentAgentId = agentId; + this.agentApiRecordModal = true; + } + + /** + * 关闭记录 + */ + closeRecord() { + this.agentApiRecordModal = false; + } +} diff --git a/src/app/pages/agent/agent-mer-account/agent-mer-account.component.html b/src/app/pages/agent/agent-mer-account/agent-mer-account.component.html new file mode 100644 index 0000000..2cee7e0 --- /dev/null +++ b/src/app/pages/agent/agent-mer-account/agent-mer-account.component.html @@ -0,0 +1,177 @@ +
+
+ +
+ + 代理商【当前代理】 + + + + + + +
+ +
+ + 地区 + + + + + + +
+ +
+ + 油站编号 + + + + +
+ +
+ + 油站名称 + + + + +
+ +
+ + + + + + + +
+
+
+ + + + + 地区 + 油站编号 + 油站名称 + 油站余额 + 代理商余额 + 操作 + + + + + {{data.provinceName}} + {{data.merNo}} + {{data.merName}} + ¥{{data.merAmount}} + ¥{{data.amount}} + + 余额充值 + + 动账记录 + + + 总计 {{ total }} 条 + + + + + +
+ + + 油站编号 + + + + + + + 油站名称 + + + + + + + 充值金额 + + + + + +
+ +
+ +
+
+
+ + + + + + + 交易前金额 + 交易金额 + 交易后金额 + 交易类型 + 交易时间 + 交易来源 + + + + + + {{data.beforeAmount}} + {{data.transactionAmount}} + {{data.afterAmount}} + {{data.type==1?'入账':'出账'}} + {{data.createTime | date: 'yyyy-MM-dd HH:mm:ss'}} + {{data.sourceType | dictionary: 'MER_ACCOUNT_RECORD_SOURCE_TYPE'}} + + + + 总计 {{ total }} 条 + + + diff --git a/src/app/pages/agent/agent-mer-account/agent-mer-account.component.less b/src/app/pages/agent/agent-mer-account/agent-mer-account.component.less new file mode 100644 index 0000000..8654bcc --- /dev/null +++ b/src/app/pages/agent/agent-mer-account/agent-mer-account.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/agent/agent-mer-account/agent-mer-account.component.ts b/src/app/pages/agent/agent-mer-account/agent-mer-account.component.ts new file mode 100644 index 0000000..dedc96b --- /dev/null +++ b/src/app/pages/agent/agent-mer-account/agent-mer-account.component.ts @@ -0,0 +1,279 @@ +import { Component } from '@angular/core'; +import {FormGroup, FormsModule, NonNullableFormBuilder, ReactiveFormsModule, Validators} from "@angular/forms"; +import {DictionaryPipe} from "../../../pipes/common/dictionary.pipe"; +import {NzMessageService} from "ng-zorro-antd/message"; +import {BrowserStorageService} from "../../../utils/localStorage.service"; +import {AgentService} from "../../../services/agent/agent.service"; +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} from "ng-zorro-antd/date-picker"; +import {NzInputNumberModule} from "ng-zorro-antd/input-number"; +import {AgentMerAccountService} from "../../../services/agent/agent-mer-account.service"; +import {DATA} from "../../../data/login/localStorage.namespace"; +import {AgentStaffService} from "../../../services/agent/agent-staff.service"; + +@Component({ + selector: 'app-agent-mer-account', + 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: './agent-mer-account.component.html', + styleUrl: './agent-mer-account.component.less' +}) +export class AgentMerAccountComponent { + // 表单页数 + tablePageNum = 1; + // 每页数量 + tablePageSize = 10; + // 表单数据 + tableData: any = { + total: 0, + list: [], + }; + // 搜索表单 + searchForm: FormGroup; + // 地区数据 + regionData: any = []; + // 代理数据 + agentData: any = []; + // 登录账户类型 + accountType = null; + // 充值表单 + rechargeForm: FormGroup; + rechargeModal = false; + // 记录模态框 + recordModal = false; + recordMerNo: any = null; + // 表单页数 + recordTablePageNum = 1; + // 每页数量 + recordTablePageSize = 10; + recordData: any = { + total: 0, + list: [], + }; + constructor(private fb: NonNullableFormBuilder, + private message: NzMessageService, + private storage: BrowserStorageService, + private agentService: AgentService, + private agentMerAccountService: AgentMerAccountService, + private commonService: CommonService, + private modalService: NzModalService) { + this.accountType = this.storage.get(DATA)['account']['objectType']; + + // 初始化搜索框 + this.searchForm = this.fb.group({ + agentId: [''], + provinceCode: [null], + merNo: [null], + merName: [null], + }); + + // 初始化搜索框 + this.rechargeForm = this.fb.group({ + agentId: [null], + merNo: [null], + merName: [null], + amount: [null, [Validators.required]], + }); + + if (this.accountType == 1) { + // 获取代理商 + this.agentService.queryAgentList({pageNum:1,pageSize:999}, (data: any) => { + this.agentData = data['return_data']['list']; + this.searchForm.controls['agentId'].setValue(String(this.agentData[0]['id'])); + // 查询数据 + this.queryData(); + }); + } else { + // 查询数据 + this.queryData(); + } + // 获取地区 + this.commonService.getRegion("", (data: any) => { + this.regionData = data['return_data']; + }); + } + + /** + * 获取数据 + */ + queryData() { + this.searchForm.value.pageNum = this.tablePageNum; + this.searchForm.value.pageSize = this.tablePageSize; + this.searchForm.value.time = new Date().getTime(); + this.agentMerAccountService.getMerList(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(); + } + + + /** + * 打卡充值模态框 + * @param data + */ + showRechargeModal(data: any) { + this.rechargeForm.patchValue(data); + this.rechargeForm.controls['amount'].setValue(0); + this.rechargeForm.controls['merNo'].disable(); + this.rechargeForm.controls['merName'].disable(); + this.rechargeModal = true; + } + + /** + * 充值确认框 + */ + rechargeConfirm() { + if (this.rechargeForm.valid) { + this.modalService.confirm({ + nzTitle: '充值提醒', + nzContent: '确认对【' + this.rechargeForm.controls['merName'].value + '】油站充值:¥' +this.rechargeForm.controls['amount'].value + '吗?', + nzOnOk: () => this.submitRecharge() + }); + } else { + Object.values(this.rechargeForm.controls).forEach(control => { + if (control.invalid) { + control.markAsDirty(); + control.updateValueAndValidity({ onlySelf: true }); + } + }); + } + } + + /** + * 提交表单数据 + */ + submitRecharge() { + let param = this.rechargeForm.value; + param['agentId'] = this.searchForm.controls['agentId'].value; + param['merNo'] = this.rechargeForm.controls['merNo'].value; + this.agentMerAccountService.recharge(param, (data: any) => { + if (data['return_code'] == '000000') { + this.message.create('success', '操作成功'); + this.queryData(); + // 关闭弹窗 + this.closeRechargeModal(); + } else { + this.message.create('error', data['return_msg']); + } + }); + } + + /** + * 关闭充值模态框 + */ + closeRechargeModal() { + this.rechargeForm.reset(); + this.rechargeModal = false; + } + + /** + * 打开动账记录模态框 + * @param merNo + */ + showRecordModal(merNo: number) { + if (this.recordMerNo != merNo) { + this.recordMerNo = merNo; + // 查询数据 + this.queryRecord(); + } + this.recordModal = true; + } + + /** + * 获取数据 + */ + queryRecord() { + const param = { + agentId: this.searchForm.controls['agentId'].value, + merNo: this.recordMerNo, + pageNum: this.recordTablePageNum, + pageSize: this.recordTablePageSize, + }; + this.agentMerAccountService.getRecordList(param, (data: any) => { + if (data['return_code'] == '000000') { + this.recordData = data['return_data']; + } + }); + } +} diff --git a/src/app/pages/agent/agent-mer-list/agent-mer-list.component.html b/src/app/pages/agent/agent-mer-list/agent-mer-list.component.html new file mode 100644 index 0000000..f5aff0f --- /dev/null +++ b/src/app/pages/agent/agent-mer-list/agent-mer-list.component.html @@ -0,0 +1,154 @@ +
+
+ +
+ + 代理商【当前代理】 + + + + + + +
+ +
+ + 分配状态 + + + + + + + +
+ +
+ + 业务员【当前业务员】 + + + + + + +
+ +
+ + 分配状态 + + + + + + + +
+ +
+ + 地区 + + + + + + +
+ +
+ + 油站来源 + + + + + + +
+ +
+ + 油站编号 + + + + +
+ +
+ + 油站名称 + + + + +
+ +
+ + 油站状态 + + + + + + +
+ +
+ + + + + + + + + +
+
+
+ +
+ 已选择 {{setOfCheckedId.size}} 家油站 +
+ + + + + 地区 + 油站来源 + 油站编号 + 油站名称 + 油站状态 + 分配时间 + + + + + + {{data.provinceName}} + {{data.merSourceType | dictionary : 'MER_SOURCE_TYPE'}} + {{data.merNo}} + {{data.merName}} + {{data.status | dictionary : 'MERCHANT_STATUS'}} + {{data.createTime==null?'未分配':''}}{{data.createTime | date : 'yyyy-MM-dd HH:mm'}} + + + 总计 {{ total }} 条 + diff --git a/src/app/pages/agent/agent-mer-list/agent-mer-list.component.less b/src/app/pages/agent/agent-mer-list/agent-mer-list.component.less new file mode 100644 index 0000000..b44e8a4 --- /dev/null +++ b/src/app/pages/agent/agent-mer-list/agent-mer-list.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/agent/agent-mer-list/agent-mer-list.component.ts b/src/app/pages/agent/agent-mer-list/agent-mer-list.component.ts new file mode 100644 index 0000000..9385c97 --- /dev/null +++ b/src/app/pages/agent/agent-mer-list/agent-mer-list.component.ts @@ -0,0 +1,362 @@ +import { Component } from '@angular/core'; +import {FormGroup, FormsModule, NonNullableFormBuilder, ReactiveFormsModule, Validators} from "@angular/forms"; +import {DictionaryPipe} from "../../../pipes/common/dictionary.pipe"; +import {NzMessageService} from "ng-zorro-antd/message"; +import {BrowserStorageService} from "../../../utils/localStorage.service"; +import {AgentService} from "../../../services/agent/agent.service"; +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} from "ng-zorro-antd/date-picker"; +import {NzInputNumberModule} from "ng-zorro-antd/input-number"; +import {AgentMerService} from "../../../services/agent/agent-mer.service"; +import {NzTypographyComponent} from "ng-zorro-antd/typography"; +import {DATA} from "../../../data/login/localStorage.namespace"; +import {AgentStaffService} from "../../../services/agent/agent-staff.service"; + +@Component({ + selector: 'app-agent-mer-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, + NzTypographyComponent + ], + templateUrl: './agent-mer-list.component.html', + styleUrl: './agent-mer-list.component.less' +}) +export class AgentMerListComponent { + // 表单页数 + tablePageNum = 1; + // 每页数量 + tablePageSize = 10; + // 表单数据 + tableData: any = { + total: 0, + list: [], + }; + // 搜索表单 + searchForm: FormGroup; + // 登录的账户类型 + accountType = null; + // 油站来源 + merSourceTypeArray = new DictionaryPipe().getDictionaryList('MER_SOURCE_TYPE'); + // 商户状态 + merStatusArray = new DictionaryPipe().getDictionaryList('MERCHANT_STATUS'); + // 地区数据 + regionData: any = []; + // 代理数据 + agentData: any = []; + // 代理工作人员 + agentStaffData: any = []; + // 列表中全选状态 + checked = false; + // 已选择的数据 + setOfCheckedId = new Set(); + constructor(private fb: NonNullableFormBuilder, + private message: NzMessageService, + private storage: BrowserStorageService, + private agentService: AgentService, + private agentStaffService: AgentStaffService, + private agentMerService: AgentMerService, + private commonService: CommonService, + private modal: NzModalService) { + + this.accountType = this.storage.get(DATA)['account']['objectType']; + + // 初始化搜索框 + this.searchForm = this.fb.group({ + agentId: [''], + agentStaffId: [''], + isAgentAllot: ['true'], + isAgentStaffAllot: ['true'], + provinceCode: [null], + merSourceType: [null], + merNo: [null], + merName: [null], + status: [null], + }); + if (this.accountType == 1) { + // 获取代理商 + this.agentService.queryAgentList({pageNum:1,pageSize:999}, (data: any) => { + this.agentData = data['return_data']['list']; + this.searchForm.controls['agentId'].setValue(String(this.agentData[0]['id'])); + // 查询数据 + this.queryData(); + }); + + } else if (this.accountType == 4) { + // 获取代理商工作人员 + this.agentStaffService.getStaffList({pageNum:1,pageSize:999}, (data: any) => { + this.agentStaffData = data['return_data']['list']; + if (this.agentStaffData.length > 0) { + this.searchForm.controls['agentStaffId'].setValue(String(this.agentStaffData[0]['id'])); + // 查询数据 + this.queryData(); + } + }); + } + + // 获取地区 + this.commonService.getRegion("", (data: any) => { + this.regionData = data['return_data']; + }); + + } + + /** + * 获取数据 + */ + queryData() { + if (this.accountType == 1) { + this.searchForm.value.isAgentStaffAllot = false; + } + this.searchForm.value.pageNum = this.tablePageNum; + this.searchForm.value.pageSize = this.tablePageSize; + this.searchForm.value.time = new Date().getTime(); + this.agentMerService.getAllotList(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(); + } + + /** + * 打开分配模态框 + */ + assign() { + if (this.setOfCheckedId.size == 0) { + this.modal.warning({ + nzTitle: '提示', + nzContent: '请在列表中勾选需要分配的油站' + }); + return; + } + this.modal.confirm({ + nzTitle: '提示', + nzContent: '确定将已勾选的'+this.setOfCheckedId.size+'个油站,分配给代理商吗?', + nzOnOk: () => this.submitAssign() + }); + } + + /** + * 提交数据 + */ + submitAssign() { + let merNoList = []; + for (let merNo of this.setOfCheckedId) { + merNoList.push({merNo: merNo}); + } + if (this.accountType == 1) { + const param = { + agentId: this.searchForm.controls['agentId'].value, + merNoList: merNoList + }; + this.agentMerService.assignAgent(param, (data: any) => { + if (data['return_code'] == '000000') { + this.message.create('success', '操作成功'); + // 清除已勾选的油站 + this.setOfCheckedId.clear(); + // 刷新数据 + this.queryData(); + } else { + this.message.create('error', data['return_msg']); + } + }); + } else if (this.accountType == 4) { + const param = { + staffId: this.searchForm.controls['agentStaffId'].value, + merNoList: merNoList + }; + this.agentMerService.assignStaff(param, (data: any) => { + if (data['return_code'] == '000000') { + this.message.create('success', '操作成功'); + // 刷新数据 + this.queryData(); + } else { + this.message.create('error', data['return_msg']); + } + }); + } + + } + + /** + * 打开解绑模态框 + */ + unbind() { + if (this.setOfCheckedId.size == 0) { + this.modal.warning({ + nzTitle: '提示', + nzContent: '请在列表中勾选需要解绑的油站' + }); + return; + } + this.modal.confirm({ + nzTitle: '提示', + nzContent: '确定将已勾选的'+this.setOfCheckedId.size+'个油站解绑吗?', + nzOnOk: () => this.submitUnbind() + }); + } + + /** + * 提交数据 + */ + submitUnbind() { + let merNoList = []; + for (let merNo of this.setOfCheckedId) { + merNoList.push({merNo: merNo}); + } + + if (this.accountType == 1) { + const param = { + agentId: this.searchForm.controls['agentId'].value, + merNoList: merNoList + }; + this.agentMerService.unbindAgent(param, (data: any) => { + if (data['return_code'] == '000000') { + this.message.create('success', '操作成功'); + // 清除已勾选的油站 + this.setOfCheckedId.clear(); + // 刷新数据 + this.queryData(); + } else { + this.message.create('error', data['return_msg']); + } + }); + } else if (this.accountType == 4) { + const param = { + staffId: this.searchForm.controls['agentStaffId'].value, + merNoList: merNoList + }; + this.agentMerService.unbindStaff(param, (data: any) => { + if (data['return_code'] == '000000') { + this.message.create('success', '操作成功'); + // 刷新数据 + this.queryData(); + } else { + this.message.create('error', data['return_msg']); + } + }); + } + } + + /** + * 修改选择状态 + * @param merNo + * @param checked + */ + 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); + } + + +} diff --git a/src/app/pages/agent/agent-price-list/agent-price-list.component.html b/src/app/pages/agent/agent-price-list/agent-price-list.component.html new file mode 100644 index 0000000..d8024e0 --- /dev/null +++ b/src/app/pages/agent/agent-price-list/agent-price-list.component.html @@ -0,0 +1,200 @@ +
+
+
+ + 地区 + + + + + + +
+
+ + 来源渠道 + + + + + + +
+
+ + 油站编号 + + + + +
+
+ + 油站名称 + + + + +
+
+ + + + +
+
+
+
+ 已选择 {{setOfCheckedId.size}} 家油站 +
+ + + + + 来源渠道 + 油站编号 + 油站名称 + 油站地区 + 操作 + + + + + + {{data.merSourceType | dictionary: "MER_SOURCE_TYPE"}} + {{data.merNo}} + {{data.merName}} + {{data.provinceName}} + + 调整优惠 + + + + 总计 {{ total }} 条 + + + + +
+ + 油号 + + + + + + + + + 折扣 + + + + + + + 服务费 + + + + + +
+ +
+
+
+
+ + + + + + + 油站 + 油号 + 折扣 + 服务费 + 操作 + + + + + {{data.merName}} + {{data.oilNoName}} + {{data.priceRate}}% + {{data.serviceFeeRate}}% + + 调整 + + + + + + + + + +
+ + + 油号 + + + + + + + + + 折扣 + + + + + + + 服务费 + + + + + +
+ +
+
+
+
diff --git a/src/app/pages/agent/agent-price-list/agent-price-list.component.less b/src/app/pages/agent/agent-price-list/agent-price-list.component.less new file mode 100644 index 0000000..b44e8a4 --- /dev/null +++ b/src/app/pages/agent/agent-price-list/agent-price-list.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/agent/agent-price-list/agent-price-list.component.ts b/src/app/pages/agent/agent-price-list/agent-price-list.component.ts new file mode 100644 index 0000000..61c46e6 --- /dev/null +++ b/src/app/pages/agent/agent-price-list/agent-price-list.component.ts @@ -0,0 +1,338 @@ +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 {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 {NzTypographyComponent} from "ng-zorro-antd/typography"; +import {NzMessageService} from "ng-zorro-antd/message"; +import {BrowserStorageService} from "../../../utils/localStorage.service"; +import {AgentService} from "../../../services/agent/agent.service"; +import {AgentStaffService} from "../../../services/agent/agent-staff.service"; +import {AgentMerService} from "../../../services/agent/agent-mer.service"; +import {CommonService} from "../../../services/common/common.service"; +import {DATA} from "../../../data/login/localStorage.namespace"; +import {MerService} from "../../../services/merchant/mer.service"; +import {AgentPriceService} from "../../../services/agent/agent-price.service"; + +@Component({ + selector: 'app-agent-price-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, + NzTypographyComponent + ], + templateUrl: './agent-price-list.component.html', + styleUrl: './agent-price-list.component.less' +}) +export class AgentPriceListComponent { + // 表单页数 + 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 agentMerService: AgentMerService, + 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.agentMerService.getAllotList(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; + this.searchForm.controls['oilNo'].enable(); + } + + /** + * 提交批量修改 + */ + 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/agent/agent-refer-price-list/agent-refer-price-list.component.html b/src/app/pages/agent/agent-refer-price-list/agent-refer-price-list.component.html new file mode 100644 index 0000000..7650bde --- /dev/null +++ b/src/app/pages/agent/agent-refer-price-list/agent-refer-price-list.component.html @@ -0,0 +1,124 @@ +
+
+
+ + 代理商【当前代理】 + + + + + + +
+
+ + 业务员【当前业务员】 + + + + + + +
+
+ + 地区 + + + + + + +
+
+ + 来源渠道 + + + + + + +
+
+ + 油号 + + + + + + +
+
+ + 油站编号 + + + + +
+
+ + 油站名称 + + + + +
+
+ + + + + + + +
+
+
+ + + + 来源渠道 + 油站地区 + 油站编号 + 油站名称 + 油号 + 国标价 + 油枪价 + 优惠价 + 代理折扣 + 代理加油价 + 服务费 + + + + + {{data.sourceType | dictionary: "MER_SOURCE_TYPE"}} + {{data.provinceName}} + {{data.merNo}} + {{data.merName}} + {{data.oilNo}} + ¥ {{data.priceOfficial}} + ¥ {{data.priceGun}} + ¥ {{data.priceVip}} + {{data.priceRate}} % + ¥ {{data.terminalPrice}} + {{data.serviceFeeRate}} % + + + 总计 {{ total }} 条 + diff --git a/src/app/pages/agent/agent-refer-price-list/agent-refer-price-list.component.less b/src/app/pages/agent/agent-refer-price-list/agent-refer-price-list.component.less new file mode 100644 index 0000000..b44e8a4 --- /dev/null +++ b/src/app/pages/agent/agent-refer-price-list/agent-refer-price-list.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/agent/agent-refer-price-list/agent-refer-price-list.component.ts b/src/app/pages/agent/agent-refer-price-list/agent-refer-price-list.component.ts new file mode 100644 index 0000000..439f11e --- /dev/null +++ b/src/app/pages/agent/agent-refer-price-list/agent-refer-price-list.component.ts @@ -0,0 +1,193 @@ +import { Component } from '@angular/core'; +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, + NzTdAddOnComponent, NzTheadComponent, NzThMeasureDirective, NzThSelectionComponent, NzTrDirective +} from "ng-zorro-antd/table"; +import {NzColDirective, NzRowDirective} from "ng-zorro-antd/grid"; +import {NzFlexDirective} from "ng-zorro-antd/flex"; +import {NzFormControlComponent, NzFormDirective, NzFormItemComponent, NzFormLabelComponent} from "ng-zorro-antd/form"; +import {NzInputDirective} from "ng-zorro-antd/input"; +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 {NzTypographyComponent} from "ng-zorro-antd/typography"; +import {FormGroup, FormsModule, NonNullableFormBuilder, ReactiveFormsModule, Validators} from "@angular/forms"; +import {MerService} from "../../../services/merchant/mer.service"; +import {NzMessageService} from "ng-zorro-antd/message"; +import {AgentPriceService} from "../../../services/agent/agent-price.service"; +import {AgentMerService} from "../../../services/agent/agent-mer.service"; +import {CommonService} from "../../../services/common/common.service"; +import {NzDividerComponent} from "ng-zorro-antd/divider"; +import {NzDropDownADirective, NzDropDownDirective, NzDropdownMenuComponent} from "ng-zorro-antd/dropdown"; +import {NzIconDirective} from "ng-zorro-antd/icon"; +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 {NzDatePickerComponent} from "ng-zorro-antd/date-picker"; +import {AgentService} from "../../../services/agent/agent.service"; +import {AgentStaffService} from "../../../services/agent/agent-staff.service"; + +@Component({ + selector: 'app-agent-refer-price-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, + NzTypographyComponent + ], + templateUrl: './agent-refer-price-list.component.html', + styleUrl: './agent-refer-price-list.component.less' +}) +export class AgentReferPriceListComponent { + // 表单页数 + 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 = []; + // 代理商 + agentData: any = []; + // 代理商业务员 + agentStaffData: any = []; + + constructor(private fb: NonNullableFormBuilder, + private merService: MerService, + private message: NzMessageService, + private agentService: AgentService, + private agentStaffService: AgentStaffService, + private agentPriceService: AgentPriceService, + private agentMerService: AgentMerService, + private commonService: CommonService, + private modal: NzModalService) { + // 初始化搜索框 + this.searchForm = this.fb.group({ + agentId: [''], + agentStaffId: [''], + sourceType: [''], + provinceCode: [''], + oilNo: [''], + merNo: [''], + merName: [''], + }); + + // 获取地区 + this.commonService.getRegion("", (data: any) => { + this.regionData = data['return_data']; + }); + + // 获取代理商 + this.agentService.queryAgentList({pageNum:1,pageSize:999}, (data: any) => { + this.agentData = data['return_data']['list']; + this.searchForm.controls['agentId'].setValue(String(this.agentData[0]['id'])); + // 查询业务员 + this.queryAgentStaff(String(this.agentData[0]['id'])); + }); + } + + /** + * 获取数据 + */ + queryData() { + this.searchForm.value.pageNum = this.tablePageNum; + this.searchForm.value.pageSize = this.tablePageSize; + this.agentPriceService.getPriceList(this.searchForm.value, (data: any) => { + if (data['return_code'] == '000000') { + this.tableData = data['return_data']; + } + }); + } + + /** + * 获取数据 + */ + queryAgentStaff(agentId: string) { + this.searchForm.controls['agentStaffId'].setValue(null); + this.agentStaffService.getStaffList({agentId: agentId, pageNum:1, pageSize:9999}, (data: any) => { + if (data['return_code'] == '000000') { + this.agentStaffData = data['return_data']['list']; + if (this.agentStaffData.length > 0) { + this.searchForm.controls['agentStaffId'].setValue(''+this.agentStaffData[0]['id']); + // 查询数据 + this.queryData(); + } + } + }); + } + + /** + * 搜索表单提交 + */ + searchFormSubmit(): void { + this.tablePageNum = 1; + this.queryData(); + } + + /** + * 搜索表单重置 + */ + searchFormReset(): void { + this.searchForm.controls['provinceCode'].setValue(null); + this.searchForm.controls['sourceType'].setValue(null); + this.searchForm.controls['merNo'].setValue(null); + this.searchForm.controls['merName'].setValue(null); + this.searchForm.controls['oilNo'].setValue(null); + } +} diff --git a/src/app/pages/agent/agent-staff/agent-staff.component.html b/src/app/pages/agent/agent-staff/agent-staff.component.html new file mode 100644 index 0000000..5e51194 --- /dev/null +++ b/src/app/pages/agent/agent-staff/agent-staff.component.html @@ -0,0 +1,105 @@ +
+
+ +
+ + 名称 + + + + +
+ +
+ + 手机号 + + + + +
+ +
+ + + + + + + + +
+
+
+ + + + + 名称 + 手机号 + 创建时间 + 操作 + + + + + {{data.name}} + {{data.telephone}} + {{data.createTime | date : 'yyyy-MM-dd HH:mm:ss'}} + + + 操作列表 + + + + + + + + 总计 {{ total }} 条 + + + + +
+ + + 名称 + + + + + + + 手机号 + + + + + + +
+ +
+
+
+
diff --git a/src/app/pages/agent/agent-staff/agent-staff.component.less b/src/app/pages/agent/agent-staff/agent-staff.component.less new file mode 100644 index 0000000..8654bcc --- /dev/null +++ b/src/app/pages/agent/agent-staff/agent-staff.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/agent/agent-staff/agent-staff.component.ts b/src/app/pages/agent/agent-staff/agent-staff.component.ts new file mode 100644 index 0000000..a6b8ea5 --- /dev/null +++ b/src/app/pages/agent/agent-staff/agent-staff.component.ts @@ -0,0 +1,234 @@ +import { Component } from '@angular/core'; +import {DatePipe, NgForOf, NgIf} from "@angular/common"; +import {DictionaryPipe} from "../../../pipes/common/dictionary.pipe"; +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 {NzFlexDirective} from "ng-zorro-antd/flex"; +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 {NzOptionComponent, NzSelectComponent} from "ng-zorro-antd/select"; +import {FormGroup, FormsModule, NonNullableFormBuilder, ReactiveFormsModule, Validators} from "@angular/forms"; +import {NzMessageService} from "ng-zorro-antd/message"; +import {BrowserStorageService} from "../../../utils/localStorage.service"; +import {AgentService} from "../../../services/agent/agent.service"; +import {AgentStaffService} from "../../../services/agent/agent-staff.service"; +import {CommonService} from "../../../services/common/common.service"; +import {NzDividerComponent} from "ng-zorro-antd/divider"; +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 {NzTypographyComponent} from "ng-zorro-antd/typography"; + +@Component({ + selector: 'app-agent-staff', + 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, + NzTypographyComponent + ], + templateUrl: './agent-staff.component.html', + styleUrl: './agent-staff.component.less' +}) +export class AgentStaffComponent { +// 表单页数 + tablePageNum = 1; + // 每页数量 + tablePageSize = 10; + // 表单数据 + tableData: any = { + total: 0, + list: [], + }; + // 搜索表单 + searchForm: FormGroup; + // 编辑表单 + editForm: FormGroup; + editModal = false; + constructor(private fb: NonNullableFormBuilder, + private message: NzMessageService, + private storage: BrowserStorageService, + private agentStaffService: AgentStaffService, + private commonService: CommonService, + private modal: NzModalService) { + + // 初始化搜索框 + this.searchForm = this.fb.group({ + name: [null], + telephone: [null], + }); + + this.editForm = this.fb.group({ + id: [null], + name: [null, [Validators.required]], + telephone: [null, [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.agentStaffService.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(); + } + + /** + * 打开编辑模态框 + */ + showEditModal(data: any) { + if (data != null) { + this.editForm.patchValue(data); + } + this.editModal = true; + } + + /** + * 提交数据 + */ + submitData() { + if (this.editForm.valid) { + if (this.editForm.controls['id'].value == null) { + this.agentStaffService.addStaff(this.editForm.value, (data: any) => { + if (data['return_code'] == '000000') { + this.message.create('success', '操作成功'); + // 刷新数据 + this.queryData(); + // 关闭弹窗 + this.closeEditModal(); + // 表单重置 + this.editForm.reset(); + } else { + this.message.create('error', data['return_msg']); + } + }); + } else { + this.agentStaffService.updateStaff(this.editForm.value, (data: any) => { + if (data['return_code'] == '000000') { + this.message.create('success', '操作成功'); + // 刷新数据 + this.queryData(); + // 关闭弹窗 + this.closeEditModal(); + // 表单重置 + this.editForm.reset(); + } else { + this.message.create('error', data['return_msg']); + } + }); + } + + } else { + Object.values(this.editForm.controls).forEach(control => { + if (control.invalid) { + control.markAsDirty(); + control.updateValueAndValidity({ onlySelf: true }); + } + }); + } + } + + /** + * 关闭编辑模态框 + */ + closeEditModal() { + this.editForm.reset(); + this.editModal = false; + } + + /** + * 删除 + */ + delStaff(id: number) { + this.modal.confirm({ + nzTitle: '提示', + nzContent: '确定删除账户吗?', + nzOnOk: () => + this.agentStaffService.delStaff({id: id}, (data: any) => { + if (data['return_code'] == '000000') { + // 刷新数据 + this.queryData(); + this.message.create('success', '操作成功'); + } else { + this.message.create('error', data['return_msg']); + } + }) + }); + } +} diff --git a/src/app/pages/agent/agent.module.ts b/src/app/pages/agent/agent.module.ts new file mode 100644 index 0000000..14156e7 --- /dev/null +++ b/src/app/pages/agent/agent.module.ts @@ -0,0 +1,12 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; + + + +@NgModule({ + declarations: [], + imports: [ + CommonModule + ] +}) +export class AgentModule { } diff --git a/src/app/pages/agent/agent.routes.ts b/src/app/pages/agent/agent.routes.ts new file mode 100644 index 0000000..dfd4d09 --- /dev/null +++ b/src/app/pages/agent/agent.routes.ts @@ -0,0 +1,18 @@ +import { Routes } from '@angular/router'; +import {AgentListComponent} from "./agent-list/agent-list.component"; +import {AgentMerAccountComponent} from "./agent-mer-account/agent-mer-account.component"; +import {AgentMerListComponent} from "./agent-mer-list/agent-mer-list.component"; +import {AgentStaffComponent} from "./agent-staff/agent-staff.component"; +import {AgentPriceListComponent} from "./agent-price-list/agent-price-list.component"; +import {AgentReferPriceListComponent} from "./agent-refer-price-list/agent-refer-price-list.component"; +import {AgentApiAccountComponent} from "./agent-api-account/agent-api-account.component"; + +export const AGENT_ROUTES: Routes = [ + { path: 'agent-list', component: AgentListComponent }, + { path: 'agent-mer-list', component: AgentMerListComponent }, + { path: 'agent-mer-account', component: AgentMerAccountComponent }, + { path: 'agent-staff', component: AgentStaffComponent }, + { path: 'agent-price-list', component: AgentPriceListComponent }, + { path: 'agent-refer-price-list', component: AgentReferPriceListComponent }, + { path: 'agent-api-account', component: AgentApiAccountComponent }, +]; diff --git a/src/app/pages/cms/cms-list/cms-list.component.html b/src/app/pages/cms/cms-list/cms-list.component.html index cdc506b..da0679e 100644 --- a/src/app/pages/cms/cms-list/cms-list.component.html +++ b/src/app/pages/cms/cms-list/cms-list.component.html @@ -86,7 +86,7 @@ - 总计 {{ total }} 条x + 总计 {{ total }} 条 + + 优惠券包名称 + + + + + + + 销售价格 + + + + + + + 描述 + + + + + + + 列表图片 + + + + +
上传
+
+ +
+
+
+ + + 内容图片 + + +
+ +
上传
+
+
+
+
+ + + + + + 优惠券编码 + 优惠券名称 + 数量 + + + + + {{data.discountNo}} + {{data.discountName}} + {{data.number}} + + + + +
+ +
+ + + + + + + + + + + 优惠券编码 + 优惠券名称 + 优惠类型 + 优惠券金额 + 优惠券条件 + 使用范围 + 领取有效期 + 结束时间 + + + + + + {{data.discountNo}} + {{data.discountName}} + {{data.discountType | dictionary: 'DISCOUNT_TYPE'}} + {{data.discountPrice}} + {{data.discountCondition}} + {{data.useScope}} + {{data.receiveExpirationDate}}天 + {{data.endTime | date : 'yyyy-MM-dd HH:mm:ss'}} + + + + + diff --git a/src/app/pages/discount-pk/discount-pk-edit/discount-pk-edit.component.less b/src/app/pages/discount-pk/discount-pk-edit/discount-pk-edit.component.less new file mode 100644 index 0000000..9cc89f8 --- /dev/null +++ b/src/app/pages/discount-pk/discount-pk-edit/discount-pk-edit.component.less @@ -0,0 +1,19 @@ + +.logo-uploader { + text-align: left; +} +.submit-btn { + width: 150px; +} +nz-input-number { + width: 100%; +} +nz-input-number-group { + width: 100%; +} +[nz-form] { + max-width: 800px; +} +nz-date-picker { + width: 100%; +} diff --git a/src/app/pages/discount-pk/discount-pk-edit/discount-pk-edit.component.ts b/src/app/pages/discount-pk/discount-pk-edit/discount-pk-edit.component.ts new file mode 100644 index 0000000..9873ab1 --- /dev/null +++ b/src/app/pages/discount-pk/discount-pk-edit/discount-pk-edit.component.ts @@ -0,0 +1,299 @@ +import { Component } from '@angular/core'; +import {FormGroup, FormsModule, NonNullableFormBuilder, ReactiveFormsModule, Validators} from "@angular/forms"; +import {DatePipe, NgForOf, NgIf} from "@angular/common"; +import {NzButtonComponent} from "ng-zorro-antd/button"; +import {NzColDirective} from "ng-zorro-antd/grid"; +import { NzDatePickerModule} from "ng-zorro-antd/date-picker"; +import {NzFlexDirective} from "ng-zorro-antd/flex"; +import { + NzFormControlComponent, + NzFormDirective, + NzFormItemComponent, + NzFormLabelComponent, + NzFormModule +} from "ng-zorro-antd/form"; +import {NzInputDirective, NzInputGroupComponent} from "ng-zorro-antd/input"; +import {NzInputNumberComponent, NzInputNumberGroupComponent} from "ng-zorro-antd/input-number"; +import {NzOptionComponent, NzSelectComponent} from "ng-zorro-antd/select"; +import {DictionaryPipe} from "../../../pipes/common/dictionary.pipe"; +import {MerService} from "../../../services/merchant/mer.service"; +import {DiscountService} from "../../../services/discount/discount.service"; +import {NzMessageService} from "ng-zorro-antd/message"; +import {ActivatedRoute} from "@angular/router"; +import {NzModalModule} from "ng-zorro-antd/modal"; +import {NzUploadFile, NzUploadModule} from "ng-zorro-antd/upload"; +import {NzIconDirective} from "ng-zorro-antd/icon"; +import {NzCascaderModule} from "ng-zorro-antd/cascader"; +import {NzTabsModule} from "ng-zorro-antd/tabs"; +import {NzCheckboxModule} from "ng-zorro-antd/checkbox"; +import {DiscountPkService} from "../../../services/discount/discount-pk.service"; +import {environment} from "../../../../environments/environment"; +import {Observable, Observer} from "rxjs"; +import {ka_GE} from "ng-zorro-antd/i18n"; +import { + NzCellFixedDirective, + NzTableCellDirective, + NzTableComponent, + NzTbodyComponent, NzTdAddOnComponent, + NzTheadComponent, + NzThMeasureDirective, NzThSelectionComponent, NzTrDirective +} from "ng-zorro-antd/table"; + +@Component({ + selector: 'app-discount-pk-edit', + standalone: true, + imports: [ + FormsModule, + NgForOf, + NzButtonComponent, + NzColDirective, + NzFlexDirective, + NzFormControlComponent, + NzFormDirective, + ReactiveFormsModule, + NzFormItemComponent, + NzFormLabelComponent, + NzInputDirective, + NzSelectComponent, + NzOptionComponent, + NzModalModule, + NzFormModule, + NzUploadModule, + NzIconDirective, + NgIf, + NzInputGroupComponent, + NzInputNumberComponent, + NzCascaderModule, + NzTabsModule, + NzCheckboxModule, + NzDatePickerModule, + NzInputNumberGroupComponent, + DatePipe, + DictionaryPipe, + NzTableCellDirective, + NzTableComponent, + NzTbodyComponent, + NzThMeasureDirective, + NzTheadComponent, + NzTrDirective, + NzCellFixedDirective, + NzTdAddOnComponent, + NzThSelectionComponent + ], + templateUrl: './discount-pk-edit.component.html', + styleUrl: './discount-pk-edit.component.less' +}) +export class DiscountPkEditComponent { + BASE_URL = environment.baseUrl; + FILE_URL = environment.imageUrl; + listImgLoading = false; + listImgUrl?: string; + + contentFileList: NzUploadFile[] = []; + form: FormGroup; + + discountData: any = []; + checkedDiscountModal = false; + // 列表中全选状态 + checked = false; + // 已选择的数据 + setOfCheckedId = new Set(); + // 选中的优惠券数据 + checkedDiscountData: any = []; + + constructor(private fb: NonNullableFormBuilder, + private merService: MerService, + private discountService: DiscountService, + private discountPkService: DiscountPkService, + private message: NzMessageService, + private activatedRoute: ActivatedRoute) { + // 初始化表单 + this.form = this.fb.group({ + discountPkNo: [null], + discountPkName: [null, [Validators.required]], + salePrice: [null, [Validators.required]], + describe: [null], + listImg: [null], + content: [null], + }); + // 查询优惠券数据 + this.queryDiscount(); + + this.activatedRoute.queryParams.subscribe(queryParams => { + // 接收到路由参数 + if (queryParams['discountPkNo'] != null) { + // 查询详情 + this.discountPkService.getDetail({discountPkNo: queryParams['discountPkNo']}, (data: any) => { + if (data['return_code'] == '000000') { + const discountData = data['return_data']; + discountData['discountType'] = String(discountData['discountType']); + discountData['useScope'] = String(discountData['useScope']).split(','); + this.form.patchValue(discountData); + } + }); + } + }); + } + + /** + * 查询优惠券列表 + */ + queryDiscount() { + this.discountService.queryList({pageNum:1, pageSize:9999, status: 2}, (data: any) => { + if (data['return_code'] == '000000') { + this.discountData = data['return_data']['list']; + } + }); + } + + showCheckedModal() { + this.checkedDiscountModal = true; + } + + + closeCheckedModal() { + this.checkedDiscountModal = false; + } + /** + * 提交选择的优惠券 + */ + submitCheckedDiscount() { + let array = []; + for (let discountNo of this.setOfCheckedId) { + let data = this.discountData.find((o: any) => o.discountNo == discountNo); + if (data != null) { + let checkedDiscount = this.checkedDiscountData.find((o: any) => o.discountNo == discountNo); + if (checkedDiscount == null) { + data['number'] = 1; + let s = { + discountNo: data.discountNo + } + array.push(data); + } + } + } + this.checkedDiscountData = array; + this.closeCheckedModal(); + } + /** + * 提交表单 + */ + submitForm() { + if (this.form.controls['useScope'].value == null || this.form.controls['useScope'].value.length == 0) { + this.message.create('warning', '请选择使用范围'); + return; + } + if (this.form.valid) { + const param = this.form.value; + param['useScope'] = this.form.controls['useScope'].value.join(','); + param['endTime'] = new Date(this.form.controls['endTime'].value).getTime(); + this.discountPkService.edit(param, (data: any) => { + if (data['return_code'] == '000000') { + this.message.create('success', '操作成功'); + if (param['discountNo'] == null) { + // 清空表单 + this.form.reset(); + } + } 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 }); + } + }); + } + } + + + 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.listImgLoading = true; + break; + case 'done': + // Get this url from response in real world. + this.getBase64(info.file!.originFileObj!, (img: string) => { + this.listImgLoading = false; + this.listImgUrl = img; + }); + this.form.patchValue({ merLogo: info.file.response['return_data'][0]}); + break; + case 'error': + this.message.error('网络错误!'); + this.listImgLoading = 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(); + }); + }; + + + updateCheckedSet(discountNo: string, checked: boolean): void { + if (checked) { + this.setOfCheckedId.add(discountNo); + } else { + this.setOfCheckedId.delete(discountNo); + } + } + + /** + * 单选 + * @param merNo + * @param checked + */ + onItemChecked(discountNo: string, checked: boolean): void { + this.updateCheckedSet(discountNo, checked); + this.refreshCheckedStatus(); + } + + /** + * 全选 + * @param checked + */ + onAllChecked(checked: boolean): void { + // @ts-ignore + this.discountData.forEach(({ discountNo }) => this.updateCheckedSet(discountNo, checked)); + this.refreshCheckedStatus(); + } + + /** + * 刷新数据 + */ + refreshCheckedStatus(): void { + // @ts-ignore + this.checked = this.discountData.every(({ discountNo }) => this.setOfCheckedId.has(discountNo)); + + console.log(this.setOfCheckedId); + } + + + + +} diff --git a/src/app/pages/discount-pk/discount-pk-list/discount-pk-list.component.html b/src/app/pages/discount-pk/discount-pk-list/discount-pk-list.component.html new file mode 100644 index 0000000..ed55622 --- /dev/null +++ b/src/app/pages/discount-pk/discount-pk-list/discount-pk-list.component.html @@ -0,0 +1 @@ +

discount-pk-list works!

diff --git a/src/app/pages/discount-pk/discount-pk-list/discount-pk-list.component.less b/src/app/pages/discount-pk/discount-pk-list/discount-pk-list.component.less new file mode 100644 index 0000000..e69de29 diff --git a/src/app/pages/discount-pk/discount-pk-list/discount-pk-list.component.ts b/src/app/pages/discount-pk/discount-pk-list/discount-pk-list.component.ts new file mode 100644 index 0000000..1f8c492 --- /dev/null +++ b/src/app/pages/discount-pk/discount-pk-list/discount-pk-list.component.ts @@ -0,0 +1,12 @@ +import { Component } from '@angular/core'; + +@Component({ + selector: 'app-discount-pk-list', + standalone: true, + imports: [], + templateUrl: './discount-pk-list.component.html', + styleUrl: './discount-pk-list.component.less' +}) +export class DiscountPkListComponent { + +} diff --git a/src/app/pages/discount-pk/discount-pk-stock-code/discount-pk-stock-code.component.html b/src/app/pages/discount-pk/discount-pk-stock-code/discount-pk-stock-code.component.html new file mode 100644 index 0000000..8497af6 --- /dev/null +++ b/src/app/pages/discount-pk/discount-pk-stock-code/discount-pk-stock-code.component.html @@ -0,0 +1 @@ +

discount-pk-stock-code works!

diff --git a/src/app/pages/discount-pk/discount-pk-stock-code/discount-pk-stock-code.component.less b/src/app/pages/discount-pk/discount-pk-stock-code/discount-pk-stock-code.component.less new file mode 100644 index 0000000..e69de29 diff --git a/src/app/pages/discount-pk/discount-pk-stock-code/discount-pk-stock-code.component.ts b/src/app/pages/discount-pk/discount-pk-stock-code/discount-pk-stock-code.component.ts new file mode 100644 index 0000000..4f99313 --- /dev/null +++ b/src/app/pages/discount-pk/discount-pk-stock-code/discount-pk-stock-code.component.ts @@ -0,0 +1,12 @@ +import { Component } from '@angular/core'; + +@Component({ + selector: 'app-discount-pk-stock-code', + standalone: true, + imports: [], + templateUrl: './discount-pk-stock-code.component.html', + styleUrl: './discount-pk-stock-code.component.less' +}) +export class DiscountPkStockCodeComponent { + +} diff --git a/src/app/pages/discount-pk/discount-pk-stock/discount-pk-stock.component.html b/src/app/pages/discount-pk/discount-pk-stock/discount-pk-stock.component.html new file mode 100644 index 0000000..6192ff8 --- /dev/null +++ b/src/app/pages/discount-pk/discount-pk-stock/discount-pk-stock.component.html @@ -0,0 +1 @@ +

discount-pk-stock works!

diff --git a/src/app/pages/discount-pk/discount-pk-stock/discount-pk-stock.component.less b/src/app/pages/discount-pk/discount-pk-stock/discount-pk-stock.component.less new file mode 100644 index 0000000..e69de29 diff --git a/src/app/pages/discount-pk/discount-pk-stock/discount-pk-stock.component.ts b/src/app/pages/discount-pk/discount-pk-stock/discount-pk-stock.component.ts new file mode 100644 index 0000000..9e3ee23 --- /dev/null +++ b/src/app/pages/discount-pk/discount-pk-stock/discount-pk-stock.component.ts @@ -0,0 +1,12 @@ +import { Component } from '@angular/core'; + +@Component({ + selector: 'app-discount-pk-stock', + standalone: true, + imports: [], + templateUrl: './discount-pk-stock.component.html', + styleUrl: './discount-pk-stock.component.less' +}) +export class DiscountPkStockComponent { + +} diff --git a/src/app/pages/discount/discount-edit/discount-edit.component.html b/src/app/pages/discount/discount-edit/discount-edit.component.html new file mode 100644 index 0000000..a973a54 --- /dev/null +++ b/src/app/pages/discount/discount-edit/discount-edit.component.html @@ -0,0 +1,63 @@ +
+ + 优惠券名称 + + + + + + + 优惠券类型 + + + + + + + + + 优惠条件 + + + + + + + + + 优惠金额 + + + + + + + + + 使用范围 + + + + + + + + + 领取有效天数 + + + + + + + 结束时间 + + + + + +
+ +
+ +
diff --git a/src/app/pages/discount/discount-edit/discount-edit.component.less b/src/app/pages/discount/discount-edit/discount-edit.component.less new file mode 100644 index 0000000..899cf27 --- /dev/null +++ b/src/app/pages/discount/discount-edit/discount-edit.component.less @@ -0,0 +1,19 @@ + +.logo-uploader { + text-align: left; +} +.submit-btn { + width: 150px; +} +nz-input-number { + width: 100%; +} +nz-input-number-group { + width: 100%; +} +[nz-form] { + max-width: 600px; +} +nz-date-picker { + width: 100%; +} diff --git a/src/app/pages/discount/discount-edit/discount-edit.component.ts b/src/app/pages/discount/discount-edit/discount-edit.component.ts new file mode 100644 index 0000000..9a883bd --- /dev/null +++ b/src/app/pages/discount/discount-edit/discount-edit.component.ts @@ -0,0 +1,141 @@ +import { Component } from '@angular/core'; +import {environment} from "../../../../environments/environment"; +import {FormGroup, FormsModule, NonNullableFormBuilder, ReactiveFormsModule, Validators} from "@angular/forms"; +import {DictionaryPipe} from "../../../pipes/common/dictionary.pipe"; +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 {NzUploadFile, NzUploadModule} from "ng-zorro-antd/upload"; +import {Observable, Observer} from "rxjs"; +import {NgForOf, NgIf} from "@angular/common"; +import {NzButtonComponent} from "ng-zorro-antd/button"; +import {NzColDirective} from "ng-zorro-antd/grid"; +import {NzFlexDirective} from "ng-zorro-antd/flex"; +import { + NzFormControlComponent, + NzFormDirective, + NzFormItemComponent, + NzFormLabelComponent, + NzFormModule +} from "ng-zorro-antd/form"; +import {NzInputDirective, NzInputGroupComponent} from "ng-zorro-antd/input"; +import {NzOptionComponent, NzSelectComponent} from "ng-zorro-antd/select"; +import {NzModalModule} from "ng-zorro-antd/modal"; +import {NzIconDirective} from "ng-zorro-antd/icon"; +import {NzInputNumberComponent, NzInputNumberGroupComponent} from "ng-zorro-antd/input-number"; +import {NzCascaderModule} from "ng-zorro-antd/cascader"; +import {NzTabsModule} from "ng-zorro-antd/tabs"; +import {DiscountService} from "../../../services/discount/discount.service"; +import {NzCheckboxModule} from "ng-zorro-antd/checkbox"; +import {NzDatePickerModule} from "ng-zorro-antd/date-picker"; + +@Component({ + selector: 'app-discount-edit', + standalone: true, + imports: [ + FormsModule, + NgForOf, + NzButtonComponent, + NzColDirective, + NzFlexDirective, + NzFormControlComponent, + NzFormDirective, + ReactiveFormsModule, + NzFormItemComponent, + NzFormLabelComponent, + NzInputDirective, + NzSelectComponent, + NzOptionComponent, + NzModalModule, + NzFormModule, + NzUploadModule, + NzIconDirective, + NgIf, + NzInputGroupComponent, + NzInputNumberComponent, + NzCascaderModule, + NzTabsModule, + NzCheckboxModule, + NzDatePickerModule, + NzInputNumberGroupComponent + ], + templateUrl: './discount-edit.component.html', + styleUrl: './discount-edit.component.less' +}) +export class DiscountEditComponent { + form: FormGroup; + // 优惠券类型 + discountTypeArray = new DictionaryPipe().getDictionaryList('DISCOUNT_TYPE'); + // 优惠券使用范围 + discountUseScopeArray = new DictionaryPipe().getDictionaryList('DISCOUNT_USE_SCOPE'); + + constructor(private fb: NonNullableFormBuilder, + private merService: MerService, + private discountService: DiscountService, + private message: NzMessageService, + private activatedRoute: ActivatedRoute) { + // 初始化表单 + this.form = this.fb.group({ + discountNo: [null], + discountName: [null, [Validators.required]], + discountType: [null, [Validators.required]], + discountPrice: [null, [Validators.required]], + discountCondition: [null], + useScope: [null], + receiveExpirationDate: [null, [Validators.required]], + endTime: [null, [Validators.required]], + }); + + this.activatedRoute.queryParams.subscribe(queryParams => { + // 接收到路由参数 + if (queryParams['discountNo'] != null) { + // 查询详情 + this.discountService.queryDetail({discountNo: queryParams['discountNo']}, (data: any) => { + if (data['return_code'] == '000000') { + const discountData = data['return_data']; + discountData['discountType'] = String(discountData['discountType']); + discountData['useScope'] = String(discountData['useScope']).split(','); + this.form.patchValue(discountData); + } + }); + } + }); + } + + /** + * 提交表单 + */ + submitForm() { + if (this.form.controls['useScope'].value == null || this.form.controls['useScope'].value.length == 0) { + this.message.create('warning', '请选择使用范围'); + return; + } + if (this.form.valid) { + const param = this.form.value; + param['useScope'] = this.form.controls['useScope'].value.join(','); + param['endTime'] = new Date(this.form.controls['endTime'].value).getTime(); + this.discountService.editDiscount(param, (data: any) => { + if (data['return_code'] == '000000') { + this.message.create('success', '操作成功'); + if (param['discountNo'] == null) { + // 清空表单 + this.form.reset(); + } + } 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/discount/discount-list/discount-list.component.html b/src/app/pages/discount/discount-list/discount-list.component.html new file mode 100644 index 0000000..5f84d77 --- /dev/null +++ b/src/app/pages/discount/discount-list/discount-list.component.html @@ -0,0 +1,280 @@ +
+
+
+ + 优惠券编码 + + + + +
+ +
+ + 优惠券名称 + + + + +
+ +
+ + 优惠券类型 + + + + + + +
+ +
+ + 优惠券状态 + + + + + + +
+ +
+ + + + + + +
+
+
+ + + + 优惠券编码 + 优惠券名称 + 优惠类型 + 优惠券金额 + 优惠券条件 + 使用范围 + 领取有效期 + 结束时间 + 状态 + 创建时间 + 操作 + + + + + {{data.discountNo}} + {{data.discountName}} + {{data.discountType | dictionary: 'DISCOUNT_TYPE'}} + {{data.discountPrice}} + {{data.discountCondition}} + {{data.useScope}} + {{data.receiveExpirationDate}}天 + {{data.endTime | date : 'yyyy-MM-dd HH:mm:ss'}} + {{data.status | dictionary : 'DISCOUNT_STATUS'}} + {{data.createTime | date : 'yyyy-MM-dd HH:mm'}} + + + + + 操作列表 + + + + + + + + + 总计 {{ total }} 条 + + + + +
+ + + 优惠券编码 + + + + + + + 优惠券名称 + + + + + + + 用户手机号 + + + + + + + 赠送数量 + + + + + +
+ +
+
+
+
+ + + + + + + + 油站编号 + 油站名称 + 油站地区 + 分配时间 + + + + + {{data.merNo}} + {{data.merName}} + {{data.provinceName +'/'+data.cityName+'/'+data.areaName}} + {{data.createTime | date : 'yyyy-MM-dd HH:mm'}} + + + 总计 {{ total }} 条 + + + + + + +
+
+
+ + 所在省级 + + + + + + +
+
+ + 来源渠道 + + + + + + +
+
+ + 油站编号 + + + + +
+
+ + 油站名称 + + + + +
+
+ + 已选择 {{setOfCheckedId.size}} 家油站 + +
+
+
+ + + + + + 来源渠道 + 连锁名称 + 油站编号 + 油站名称 + 油站地区 + + + + + + {{data.sourceType | dictionary: "MER_SOURCE_TYPE"}} + {{data.chainBrandName?data.chainBrandName:'无'}} + {{data.merNo}} + {{data.merName}} + {{data.provinceName+"/"+data.cityName+"/"+data.areaName}} + + + 总计 {{ total }} 条 + +
+
+ + + + + + diff --git a/src/app/pages/discount/discount-list/discount-list.component.less b/src/app/pages/discount/discount-list/discount-list.component.less new file mode 100644 index 0000000..1aa9d44 --- /dev/null +++ b/src/app/pages/discount/discount-list/discount-list.component.less @@ -0,0 +1,21 @@ +nz-input-number { + width: 100%; +} +.submit-btn { + width: 150px; +} +.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/discount/discount-list/discount-list.component.ts b/src/app/pages/discount/discount-list/discount-list.component.ts new file mode 100644 index 0000000..62ce6f2 --- /dev/null +++ b/src/app/pages/discount/discount-list/discount-list.component.ts @@ -0,0 +1,446 @@ +import { Component } from '@angular/core'; +import {FormGroup, FormsModule, NonNullableFormBuilder, ReactiveFormsModule, Validators} from "@angular/forms"; +import {DictionaryPipe} from "../../../pipes/common/dictionary.pipe"; +import {NzMessageService} from "ng-zorro-antd/message"; +import {BrowserStorageService} from "../../../utils/localStorage.service"; +import {NzModalModule, NzModalService} from "ng-zorro-antd/modal"; +import {DATA} from "../../../data/login/localStorage.namespace"; +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} from "ng-zorro-antd/date-picker"; +import {NzInputNumberModule} from "ng-zorro-antd/input-number"; +import {DiscountService} from "../../../services/discount/discount.service"; +import {RouterLink} from "@angular/router"; +import {NzTypographyComponent} from "ng-zorro-antd/typography"; +import {MerService} from "../../../services/merchant/mer.service"; +import {CommonService} from "../../../services/common/common.service"; +import {DiscountStockComponent} from "../discount-stock/discount-stock.component"; + +@Component({ + selector: 'app-discount-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, + RouterLink, + NzTypographyComponent, + DiscountStockComponent + ], + templateUrl: './discount-list.component.html', + styleUrl: './discount-list.component.less' +}) +export class DiscountListComponent { + // 表单页数 + tablePageNum = 1; + // 每页数量 + tablePageSize = 10; + // 表单数据 + tableData: any = { + total: 0, + list: [], + }; + accountType = null; + // 搜索表单 + searchForm: FormGroup; + // 优惠券类型 + discountTypeArray = new DictionaryPipe().getDictionaryList('DISCOUNT_TYPE'); + // 优惠券状态 + discountStatusArray = new DictionaryPipe().getDictionaryList('DISCOUNT_STATUS'); + // 油站来源 + merSourceTypeArray = new DictionaryPipe().getDictionaryList('MER_SOURCE_TYPE'); + // 赠送用户模态框 + giveUserModal = false; + giveUserForm: FormGroup; + + regionData: any = [] + // 可用油站 + usableMerModal = false; + discountNo: any = null; + // 分配油站模态框 + assignMerModal = false; + assignMerData: any = []; + assignSearchForm: FormGroup; + // 表单页数 + assignTablePageNum = 1; + // 每页数量 + assignTablePageSize = 10; + // 表单数据 + assignTableData: any = { + total: 0, + list: [], + }; + // 列表中全选状态 + checked = false; + // 已选择的数据 + setOfCheckedId = new Set(); + + // 库存模态框 + stockModal = false; + constructor(private fb: NonNullableFormBuilder, + private message: NzMessageService, + private storage: BrowserStorageService, + private discountService: DiscountService, + private commonService: CommonService, + private merService: MerService, + private modal: NzModalService) { + this.accountType = this.storage.get(DATA)['account']['objectType']; + // 获取地区 + this.commonService.getRegion("", (data: any) => { + this.regionData = data['return_data']; + }); + + // 初始化搜索框 + this.searchForm = this.fb.group({ + discountNo: [''], + discountName: [''], + discountType: [''], + status: [''], + }); + // 初始化搜索框 + this.assignSearchForm = this.fb.group({ + sourceType: [''], + provinceCode: [''], + merNo: [''], + merName: [''], + status: [''], + }); + + this.giveUserForm = this.fb.group({ + discountNo: [''], + discountName: [''], + userPhone: [null, [Validators.required]], + number: [1, [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.discountService.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(); + } + + /** + * 上线 + * @param deviceId + */ + online(discountNo: number) { + this.modal.confirm({ + nzTitle: '提示', + nzContent: '确定发布优惠券吗?', + nzOnOk: () => + this.discountService.online({discountNo: discountNo}, (data: any) => { + if (data['return_code'] == '000000') { + // 刷新数据 + this.queryData(); + this.message.create('success', '操作成功'); + } else { + this.message.create('error', data['return_msg']); + } + }) + }); + } + /** + * 下线优惠券 + * @param deviceId + */ + done(discountNo: number) { + this.modal.confirm({ + nzTitle: '提示', + nzContent: '确定优惠券下线吗?', + nzOnOk: () => + this.discountService.done({discountNo: discountNo}, (data: any) => { + if (data['return_code'] == '000000') { + // 刷新数据 + this.queryData(); + this.message.create('success', '操作成功'); + } else { + this.message.create('error', data['return_msg']); + } + }) + }); + } + + /** + * 删除 + * @param deviceId + */ + delData(discountNo: number) { + this.modal.confirm({ + nzTitle: '提示', + nzContent: '确定删除吗?', + nzOnOk: () => + this.discountService.delete({discountNo: discountNo}, (data: any) => { + if (data['return_code'] == '000000') { + // 刷新数据 + this.queryData(); + this.message.create('success', '操作成功'); + } else { + this.message.create('error', data['return_msg']); + } + }) + }); + } + + /** + * 打开赠送用户模态框 + * @param data + */ + showGiveUser(data: any) { + this.giveUserForm.patchValue({discountNo: data.discountNo, discountName: data.discountName}); + this.giveUserForm.controls['discountNo'].disable(); + this.giveUserForm.controls['discountName'].disable(); + this.giveUserModal = true; + } + /** + * 赠送确认框 + */ + submitGiveUserConfirm() { + this.modal.confirm({ + nzTitle: '提示', + nzContent: '确定赠送吗?', + nzOnOk: () => this.submitGiveUser() + }); + } + /** + * 提交赠送用户 + */ + submitGiveUser() { + if (this.giveUserForm.valid) { + const param = this.giveUserForm.value; + param['discountNo'] = this.giveUserForm.controls['discountNo'].value; + this.discountService.giveUser(param, (data: any) => { + if (data['return_code'] == '000000') { + this.message.create('success', '操作成功'); + } else { + this.message.create('error', data['return_msg']); + } + }); + } else { + Object.values(this.giveUserForm.controls).forEach(control => { + if (control.invalid) { + control.markAsDirty(); + control.updateValueAndValidity({ onlySelf: true }); + } + }); + } + } + + /** + * 关闭赠送用户模态框 + */ + closeGiveUser() { + this.giveUserForm.reset(); + this.giveUserForm.controls['discountNo'].enable(); + this.giveUserForm.controls['discountName'].enable(); + this.giveUserModal = false; + } + + /** + * 打开可用油站 + */ + showUsableMerModal(discountNo: any) { + // 清除已勾选数据 + this.setOfCheckedId.clear(); + + this.discountNo = discountNo; + this.discountService.getUseMerList({discountNo: discountNo}, (data: any) => { + if (data['return_code'] == '000000') { + // 刷新数据 + this.assignMerData = data['return_data']; + } else { + this.message.create('error', data['return_msg']); + } + }) + this.usableMerModal = true; + } + + /** + * 关闭可用油站 + */ + closeUsableMerModal() { + this.usableMerModal = false; + } + + /** + * 打开分配油站 + * @param discountNo + */ + showAssignMer() { + this.queryMer(); + this.assignMerModal = true; + } + + submitAssignMer() { + let param = { + discountNo: this.discountNo, + merNoList: Array.from(this.setOfCheckedId) + } + this.discountService.editUseMer(param, (data: any) => { + if (data['return_code'] == '000000') { + this.showUsableMerModal(this.discountNo); + this.closeAssignMer(); + } else { + this.message.create('error', data['return_msg']); + } + }) + } + /** + * 查询油站列表 + */ + queryMer() { + this.assignSearchForm.value.pageNum = this.assignTablePageNum; + this.assignSearchForm.value.pageSize = this.assignTablePageSize; + this.merService.queryMerList(this.assignSearchForm.value, (data: any) => { + if (data['return_code'] == '000000') { + this.assignTableData = data['return_data']; + for (let item of this.assignMerData) { + this.updateCheckedSet(item.merNo, true); + } + this.refreshCheckedStatus(); + } + }); + } + + /** + * 关闭分配油站 + */ + closeAssignMer() { + this.assignMerModal = false; + } + + 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.assignTableData.list.forEach(({ merNo }) => this.updateCheckedSet(merNo, checked)); + this.refreshCheckedStatus(); + } + + /** + * 刷新数据 + */ + refreshCheckedStatus(): void { + // @ts-ignore + this.checked = this.assignTableData.list.every(({ merNo }) => this.setOfCheckedId.has(merNo)); + } + + /** + * 打开库存模态框 + * @param discountNo + */ + showStockModal(discountNo: any) { + this.discountNo = discountNo; + this.stockModal = true; + } + + /** + * 关闭库存模态框 + */ + closeStockModal() { + this.stockModal = false; + } +} diff --git a/src/app/pages/discount/discount-stock-code/discount-stock-code.component.html b/src/app/pages/discount/discount-stock-code/discount-stock-code.component.html new file mode 100644 index 0000000..42cba4c --- /dev/null +++ b/src/app/pages/discount/discount-stock-code/discount-stock-code.component.html @@ -0,0 +1,86 @@ +
+
+
+ + codeId + + + + +
+ +
+ + 用户手机号 + + + + +
+ +
+ + 状态 + + + + + + +
+ +
+ + + + + + + +
+
+
+ + + + + codeId + 领取手机号 + 领取方式 + 领取时间 + 状态 + 创建时间 + + + + + {{data.id}} + {{data.receiveMerUserPhone}} + + 加油 + 商城 + 赠送 + API + + + {{data.obtainTime | date : 'yyyy-MM-dd HH:mm'}} + + {{data.status | dictionary: 'DISCOUNT_STOCK_CODE_STATUS'}} + {{data.createTime | date : 'yyyy-MM-dd HH:mm'}} + + + 总计 {{ total }} 条 + diff --git a/src/app/pages/discount/discount-stock-code/discount-stock-code.component.less b/src/app/pages/discount/discount-stock-code/discount-stock-code.component.less new file mode 100644 index 0000000..e69de29 diff --git a/src/app/pages/discount/discount-stock-code/discount-stock-code.component.ts b/src/app/pages/discount/discount-stock-code/discount-stock-code.component.ts new file mode 100644 index 0000000..8fdc0a2 --- /dev/null +++ b/src/app/pages/discount/discount-stock-code/discount-stock-code.component.ts @@ -0,0 +1,154 @@ +import {Component, Input, OnInit} 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 {NzFlexDirective} from "ng-zorro-antd/flex"; +import {NzFormControlComponent, NzFormDirective, NzFormItemComponent, NzFormLabelComponent} from "ng-zorro-antd/form"; +import {NzInputDirective} from "ng-zorro-antd/input"; +import {NzInputNumberComponent, NzInputNumberModule} from "ng-zorro-antd/input-number"; +import {NzModalComponent, NzModalModule, NzModalService} from "ng-zorro-antd/modal"; +import {FormGroup, FormsModule, NonNullableFormBuilder, ReactiveFormsModule, Validators} from "@angular/forms"; +import {NzMessageService} from "ng-zorro-antd/message"; +import {BrowserStorageService} from "../../../utils/localStorage.service"; +import {DiscountStockService} from "../../../services/discount/discount-stock.service"; +import {CommonService} from "../../../services/common/common.service"; +import {MerService} from "../../../services/merchant/mer.service"; +import {DATA} from "../../../data/login/localStorage.namespace"; +import {DictionaryPipe} from "../../../pipes/common/dictionary.pipe"; +import {NzDividerComponent} from "ng-zorro-antd/divider"; +import {NzDropDownADirective, NzDropDownDirective, NzDropdownMenuComponent} from "ng-zorro-antd/dropdown"; +import {NzIconDirective} from "ng-zorro-antd/icon"; +import {NzMenuDirective, NzMenuItemComponent} from "ng-zorro-antd/menu"; +import {NzOptionComponent, NzSelectComponent} from "ng-zorro-antd/select"; +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 {RouterLink} from "@angular/router"; +import {NzTypographyComponent} from "ng-zorro-antd/typography"; + +@Component({ + selector: 'app-discount-stock-code', + 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, + RouterLink, + NzTypographyComponent + ], + templateUrl: './discount-stock-code.component.html', + styleUrl: './discount-stock-code.component.less' +}) +export class DiscountStockCodeComponent implements OnInit { + @Input() batchNo: any; + // 表单页数 + tablePageNum = 1; + // 每页数量 + tablePageSize = 10; + // 表单数据 + tableData: any = { + total: 0, + list: [], + }; + accountType = null; + // 搜索表单 + searchForm: FormGroup; + // 优惠券库存code + discountStockCodeStatusArray = new DictionaryPipe().getDictionaryList('DISCOUNT_STOCK_CODE_STATUS'); + constructor(private fb: NonNullableFormBuilder, + private message: NzMessageService, + private storage: BrowserStorageService, + private discountStockService: DiscountStockService, + private commonService: CommonService, + private merService: MerService, + private modal: NzModalService) { + this.accountType = this.storage.get(DATA)['account']['objectType']; + // 初始化搜索框 + this.searchForm = this.fb.group({ + codeId: [''], + userPhone: [''], + status: [''], + }); + } + + ngOnInit(): void { + // 查询数据 + this.queryData(); + } + + /** + * 获取数据 + */ + queryData() { + this.searchForm.value.batchNo = this.batchNo; + this.searchForm.value.pageNum = this.tablePageNum; + this.searchForm.value.pageSize = this.tablePageSize; + this.discountStockService.queryStockBatchCodeList(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(); + } +} diff --git a/src/app/pages/discount/discount-stock/discount-stock.component.html b/src/app/pages/discount/discount-stock/discount-stock.component.html new file mode 100644 index 0000000..7fda903 --- /dev/null +++ b/src/app/pages/discount/discount-stock/discount-stock.component.html @@ -0,0 +1,92 @@ +
+
+
+ + 批次编号 + + + + +
+
+ + + + + + + + +
+
+
+ + + + 批次编号 + 优惠券名称 + 批次数量 + 开始id + 结束id + 创建时间 + code列表 + + + + + {{data.batchNo}} + {{data.discountName}} + {{data.batchStockNum}} + {{data.startId}} + {{data.endId}} + {{data.createTime | date : 'yyyy-MM-dd HH:mm'}} + + + + + 总计 {{ total }} 条 + + + + +
+ + + 优惠券编码 + + + + + + + 库存数量 + + + + + +
+ +
+
+
+
+ + + + + + diff --git a/src/app/pages/discount/discount-stock/discount-stock.component.less b/src/app/pages/discount/discount-stock/discount-stock.component.less new file mode 100644 index 0000000..1aa9d44 --- /dev/null +++ b/src/app/pages/discount/discount-stock/discount-stock.component.less @@ -0,0 +1,21 @@ +nz-input-number { + width: 100%; +} +.submit-btn { + width: 150px; +} +.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/discount/discount-stock/discount-stock.component.ts b/src/app/pages/discount/discount-stock/discount-stock.component.ts new file mode 100644 index 0000000..2dc1b6e --- /dev/null +++ b/src/app/pages/discount/discount-stock/discount-stock.component.ts @@ -0,0 +1,227 @@ +import {Component, Input, OnInit, Output} from '@angular/core'; +import {FormGroup, FormsModule, NonNullableFormBuilder, ReactiveFormsModule, Validators} from "@angular/forms"; +import {DictionaryPipe} from "../../../pipes/common/dictionary.pipe"; +import {NzMessageService} from "ng-zorro-antd/message"; +import {BrowserStorageService} from "../../../utils/localStorage.service"; +import {DiscountService} from "../../../services/discount/discount.service"; +import {CommonService} from "../../../services/common/common.service"; +import {MerService} from "../../../services/merchant/mer.service"; +import {NzModalModule, NzModalService} from "ng-zorro-antd/modal"; +import {DATA} from "../../../data/login/localStorage.namespace"; +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} from "ng-zorro-antd/date-picker"; +import {NzInputNumberModule} from "ng-zorro-antd/input-number"; +import {RouterLink} from "@angular/router"; +import {NzTypographyComponent} from "ng-zorro-antd/typography"; +import {DiscountStockService} from "../../../services/discount/discount-stock.service"; +import {DiscountStockCodeComponent} from "../discount-stock-code/discount-stock-code.component"; + +@Component({ + selector: 'app-discount-stock', + 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, + RouterLink, + NzTypographyComponent, + DiscountStockCodeComponent + ], + templateUrl: './discount-stock.component.html', + styleUrl: './discount-stock.component.less' +}) +export class DiscountStockComponent implements OnInit{ + + @Input() discountNo: any; + // 表单页数 + tablePageNum = 1; + // 每页数量 + tablePageSize = 10; + // 表单数据 + tableData: any = { + total: 0, + list: [], + }; + accountType = null; + // 搜索表单 + searchForm: FormGroup; + // 库存 + addStockModal = false; + addStockForm: FormGroup; + + showCodeModal = false; + batchNo = null; + constructor(private fb: NonNullableFormBuilder, + private message: NzMessageService, + private storage: BrowserStorageService, + private discountStockService: DiscountStockService, + private commonService: CommonService, + private merService: MerService, + private modal: NzModalService) { + this.accountType = this.storage.get(DATA)['account']['objectType']; + // 初始化搜索框 + this.searchForm = this.fb.group({ + batchNo: [''], + }); + + // 初始化搜索框 + this.addStockForm = this.fb.group({ + discountNo: [''], + stockCount: ['', [Validators.required]], + }); + } + + ngOnInit(): void { + // 查询数据 + this.queryData(); + } + + /** + * 获取数据 + */ + queryData() { + this.searchForm.value.discountNo = this.discountNo; + this.searchForm.value.pageNum = this.tablePageNum; + this.searchForm.value.pageSize = this.tablePageSize; + this.discountStockService.queryStockBatchList(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(); + } + + /** + * 打开增加库存 + */ + showAddStock() { + this.addStockForm.patchValue({discountNo: this.discountNo}); + this.addStockForm.controls['discountNo'].disable(); + this.addStockModal = true; + } + + /** + * 提交库存 + */ + submitStock() { + if (this.addStockForm.valid) { + const param = this.addStockForm.value; + param['discountNo'] = this.discountNo; + this.discountStockService.addStock(param, (data: any) => { + if (data['return_code'] == '000000') { + this.message.create('success', '操作成功'); + this.queryData(); + this.closeAddStock(); + } else { + this.message.create('error', data['return_msg']); + } + }); + } else { + Object.values(this.addStockForm.controls).forEach(control => { + if (control.invalid) { + control.markAsDirty(); + control.updateValueAndValidity({ onlySelf: true }); + } + }); + } + } + + /** + * 关闭增加库存 + */ + closeAddStock() { + this.addStockForm.reset(); + this.addStockModal = false; + } + + /** + * 打开增加库存code + */ + showStockCode(batchNo: any) { + this.batchNo = batchNo; + this.showCodeModal = true; + } + + /** + * 关闭增加库存code + */ + closeStockCode() { + this.showCodeModal = false; + } + +} + + diff --git a/src/app/pages/discount/discount.module.ts b/src/app/pages/discount/discount.module.ts new file mode 100644 index 0000000..91f022a --- /dev/null +++ b/src/app/pages/discount/discount.module.ts @@ -0,0 +1,12 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; + + + +@NgModule({ + declarations: [], + imports: [ + CommonModule + ] +}) +export class DiscountModule { } diff --git a/src/app/pages/discount/discount.routes.ts b/src/app/pages/discount/discount.routes.ts new file mode 100644 index 0000000..a0ef7ca --- /dev/null +++ b/src/app/pages/discount/discount.routes.ts @@ -0,0 +1,12 @@ +import { Routes } from '@angular/router'; +import {DiscountListComponent} from "./discount-list/discount-list.component"; +import {DiscountEditComponent} from "./discount-edit/discount-edit.component"; +import {DiscountPkEditComponent} from "../discount-pk/discount-pk-edit/discount-pk-edit.component"; +import {DiscountPkListComponent} from "../discount-pk/discount-pk-list/discount-pk-list.component"; + +export const DISCOUNT_ROUTES: Routes = [ + { path: 'edit', component: DiscountEditComponent }, + { path: 'list', component: DiscountListComponent }, + { path: 'pk-edit', component: DiscountPkEditComponent }, + { path: 'pk-list', component: DiscountPkListComponent }, +]; 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 81166b2..ffd16f8 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 @@ -48,7 +48,7 @@
- 已选择{{setOfCheckedId.size}}家油站 + 已选择 {{setOfCheckedId.size}} 家油站
- 总计 {{ total }} 条x + 总计 {{ total }} 条 执行价格 - + diff --git a/src/app/pages/merchant/mer-chain-brand-amount/mer-chain-brand-amount.component.html b/src/app/pages/merchant/mer-chain-brand-amount/mer-chain-brand-amount.component.html index 6ea1e59..b4d6dd9 100644 --- a/src/app/pages/merchant/mer-chain-brand-amount/mer-chain-brand-amount.component.html +++ b/src/app/pages/merchant/mer-chain-brand-amount/mer-chain-brand-amount.component.html @@ -89,7 +89,7 @@ 充值金额 - + diff --git a/src/app/pages/merchant/merchant-amount-list/merchant-amount-list.component.html b/src/app/pages/merchant/merchant-amount-list/merchant-amount-list.component.html index e564f6b..9c63762 100644 --- a/src/app/pages/merchant/merchant-amount-list/merchant-amount-list.component.html +++ b/src/app/pages/merchant/merchant-amount-list/merchant-amount-list.component.html @@ -98,7 +98,7 @@ 充值金额 - + diff --git a/src/app/pages/merchant/merchant-amount/merchant-amount.component.html b/src/app/pages/merchant/merchant-amount/merchant-amount.component.html new file mode 100644 index 0000000..477abe9 --- /dev/null +++ b/src/app/pages/merchant/merchant-amount/merchant-amount.component.html @@ -0,0 +1,96 @@ +
+
+
+ + 交易类型 + + + + + + + +
+ +
+ + 交易来源 + + + + + + +
+ +
+ + 来源单号 + + + + +
+ +
+ + + + + + + +
+
+
+ +
+
+ 油站编号: + {{account.merNo}} + 油站余额: + ¥{{account.amount}} +
+
+ + + + + 交易前金额 + 交易金额 + 交易后金额 + 交易类型 + 交易时间 + 交易来源 + 来源单号 + + + + + + {{data.beforeAmount}} + {{data.transactionAmount}} + {{data.afterAmount}} + {{data.type==1?'入账':'出账'}} + {{data.createTime | date: 'yyyy-MM-dd HH:mm:ss'}} + {{data.sourceType | dictionary: 'MER_ACCOUNT_RECORD_SOURCE_TYPE'}} + {{data.sourceOrderNo}} + + + + 总计 {{ total }} 条 + diff --git a/src/app/pages/merchant/merchant-amount/merchant-amount.component.less b/src/app/pages/merchant/merchant-amount/merchant-amount.component.less new file mode 100644 index 0000000..5fe762d --- /dev/null +++ b/src/app/pages/merchant/merchant-amount/merchant-amount.component.less @@ -0,0 +1,27 @@ +nz-input-number { + width: 100%; +} +nz-date-picker { + width: 100%; +} +.submit-btn { + width: 150px; +} +.csp-statistic { + font-feature-settings: "tnum"; + border: 1px solid #d9d9d9; + border-radius: 4px; +} +.csp-statistic-title { + padding: 0 16px; + height: 64px; + display: -ms-flexbox; + display: flex; + -ms-flex-align: center; + align-items: center; + background-color: #fafafa; +} +.csp-text-primary{ + font-size: 20px; + color: #1890ff; +} diff --git a/src/app/pages/merchant/merchant-amount/merchant-amount.component.ts b/src/app/pages/merchant/merchant-amount/merchant-amount.component.ts new file mode 100644 index 0000000..08d6f9b --- /dev/null +++ b/src/app/pages/merchant/merchant-amount/merchant-amount.component.ts @@ -0,0 +1,184 @@ +import { Component } from '@angular/core'; +import {DatePipe, NgForOf, NgIf} from "@angular/common"; +import {DictionaryPipe} from "../../../pipes/common/dictionary.pipe"; +import { + NzCellFixedDirective, + NzTableCellDirective, + NzTableComponent, NzTableModule, + NzTbodyComponent, + NzTheadComponent, + NzThMeasureDirective, NzTrDirective +} from "ng-zorro-antd/table"; +import {FormGroup, FormsModule, NonNullableFormBuilder, ReactiveFormsModule, Validators} from "@angular/forms"; +import {NzMessageService} from "ng-zorro-antd/message"; +import {MerchantAccountService} from "../../../services/merchant/merchant-account.service"; +import {NzModalModule, NzModalService} from "ng-zorro-antd/modal"; +import {NzButtonComponent} from "ng-zorro-antd/button"; +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} from "ng-zorro-antd/date-picker"; +import {NzInputNumberModule} from "ng-zorro-antd/input-number"; +import {DATA} from "../../../data/login/localStorage.namespace"; +import {BrowserStorageService} from "../../../utils/localStorage.service"; +import {NzStatisticModule} from "ng-zorro-antd/statistic"; +import {NzCardComponent} from "ng-zorro-antd/card"; +import {NzQRCodeComponent} from "ng-zorro-antd/qr-code"; +import {NzTabComponent, NzTabSetComponent} from "ng-zorro-antd/tabs"; + +@Component({ + selector: 'app-merchant-amount', + 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, + NzStatisticModule, + NzCardComponent, + NzQRCodeComponent, + NzTabComponent, + NzTabSetComponent + ], + templateUrl: './merchant-amount.component.html', + styleUrl: './merchant-amount.component.less' +}) +export class MerchantAmountComponent { + userInfoObject: any; + // 表单页数 + tablePageNum = 1; + // 每页数量 + tablePageSize = 10; + // 表单数据 + tableData: any = { + total: 0, + list: [], + }; + // 账户余额 + account: any = { + amount: 0 + }; + // 搜索表单 + searchForm: FormGroup; + + // 记录模态框 + recordModal = false; + recordData: any = {}; + // 交易来源类型 + merAccountRecordSourceTypeArray = new DictionaryPipe().getDictionaryList('MER_ACCOUNT_RECORD_SOURCE_TYPE'); + constructor(private fb: NonNullableFormBuilder, + private message: NzMessageService, + private storage: BrowserStorageService, + private merchantAccountService: MerchantAccountService, + private modalService: NzModalService) { + this.userInfoObject = this.storage.get(DATA); + // 初始化搜索框 + this.searchForm = this.fb.group({ + type: [''], + sourceType: [''], + sourceOrderNo: [''], + }); + this.queryAccount(); + this.queryData(); + } + + /** + * 查询账户 + */ + queryAccount() { + const param = { + merNo: this.userInfoObject['merchant']['merNo'] + } + this.merchantAccountService.getAccount(param, (data: any) => { + if (data['return_code'] == '000000') { + this.account = data['return_data']; + } + }); + } + + /** + * 获取数据 + */ + queryData() { + this.searchForm.value.merNo = this.userInfoObject['merchant']['merNo']; + this.searchForm.value.pageNum = this.tablePageNum; + this.searchForm.value.pageSize = this.tablePageSize; + this.searchForm.value.time = new Date().getTime(); + this.merchantAccountService.getRecordList(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(); + } + + /** + * 打开记录 + */ + showRecord(data: any) { + this.recordData = data; + this.recordModal = true; + } + +} diff --git a/src/app/pages/merchant/merchant.routes.ts b/src/app/pages/merchant/merchant.routes.ts index 681fe72..047b8a6 100644 --- a/src/app/pages/merchant/merchant.routes.ts +++ b/src/app/pages/merchant/merchant.routes.ts @@ -2,9 +2,7 @@ import { Routes } from '@angular/router'; import {MerAddComponent} from "./mer-add/mer-add.component"; import {MerListComponent} from "./mer-list/mer-list.component"; import {MerChainBrandListComponent} from "./mer-chain-brand-list/mer-chain-brand-list.component"; -import {MerchantAccountService} from "../../services/merchant/merchant-account.service"; import {MerchantAmountListComponent} from "./merchant-amount-list/merchant-amount-list.component"; -import {MerChainBrandAmountService} from "../../services/merchant/mer-chain-brand-amount.service"; import {MerChainBrandAmountComponent} from "./mer-chain-brand-amount/mer-chain-brand-amount.component"; import {DeviceListComponent} from "../device/device-list/device-list.component"; import {OilTaskComponent} from "../mer-oil-price/oil-task/oil-task.component"; @@ -14,15 +12,16 @@ 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"; +import {MerchantAmountComponent} from "./merchant-amount/merchant-amount.component"; export const MERCHANT_ROUTES: Routes = [ { path: 'mer-list', component: MerListComponent }, { path: 'mer-edit', component: MerAddComponent }, { path: 'mer-chain-brand-list', component: MerChainBrandListComponent }, { path: 'mer-chain-brand-account', component: MerChainBrandAmountComponent }, - { path: 'mer-account', component: MerchantAmountListComponent }, + { path: 'mer-account', component: MerchantAmountComponent }, + { path: 'mer-account-list', component: MerchantAmountListComponent }, { path: 'device-list', component: DeviceListComponent }, { path: 'device-print', component: DevicePrintComponent }, { path: 'oil-task-list', component: OilTaskComponent }, diff --git a/src/app/pages/trade/order-oil-list/order-oil-list.component.html b/src/app/pages/trade/order-oil-list/order-oil-list.component.html index b840fb9..12cf88b 100644 --- a/src/app/pages/trade/order-oil-list/order-oil-list.component.html +++ b/src/app/pages/trade/order-oil-list/order-oil-list.component.html @@ -109,7 +109,7 @@ -
+
业务员 @@ -167,7 +167,7 @@ 代理商 - 业务员 + 业务员 交易单号 渠道 渠道单号 @@ -209,7 +209,7 @@ {{data.agentName?data.agentName:'无'}} - {{data.agentStaffName?data.agentStaffName:'无'}} + {{data.agentStaffName?data.agentStaffName:'无'}} {{data.orderNo}} {{data.channelType | dictionary: 'MER_SOURCE_TYPE'}} {{data.channelOrderNo!=null?data.channelOrderNo:'无'}} @@ -221,8 +221,8 @@ {{data.gasOilNo}}# {{data.gasGunNo}}号枪 {{data.gasDiscount != 1?(data.gasDiscount*100).toFixed(2) + '折':'无'}} - {{data.gasPricePlatform}}元 - {{data.gasPriceVip}}元 + {{data.createType==1?data.gasPricePlatform+'元':'无'}} + {{data.gasPriceVip+'元'}} {{data.gasPriceGun}}元 {{data.gasPriceOfficial}}元 {{data.totalDeductionPrice}}元 @@ -245,7 +245,7 @@
  • 交易详情
  • -
  • 交易退款
  • +
  • 交易退款
  • 交易补单
  • 打印小票
@@ -267,11 +267,11 @@ {{orderDetailObject.gasOrder.merName}} {{orderDetailObject.gasOrder.channelType | dictionary: 'MER_SOURCE_TYPE'}} {{orderDetailObject.gasOrder.channelOrderNo?orderDetailObject.gasOrder.channelOrderNo:'无'}} - {{orderDetailObject.tradeOrder.orderNo}} + {{orderDetailObject.gasOrder.orderNo}} {{orderDetailObject.gasOrder.status | dictionary: 'GAS_ORDER_STATUS' }} - {{orderDetailObject.tradeOrder.payType | dictionary: 'ORDER_PAY_TYPE'}} - {{orderDetailObject.tradeOrder.paySerialNo!=null?orderDetailObject.tradeOrder.paySerialNo:'无'}} - {{orderDetailObject.tradeOrder.userPhone}} + {{orderDetailObject.gasOrder.payType | dictionary: 'ORDER_PAY_TYPE'}} + {{orderDetailObject.gasOrder.paySerialNo!=null?orderDetailObject.gasOrder.paySerialNo:'无'}} + {{orderDetailObject.gasOrder.userPhone}} {{orderDetailObject.gasOrder.gasStaffName!=null?orderDetailObject.gasOrder.gasStaffName:'未知'}} {{orderDetailObject.gasOrder.gasRefuelPrice}}元 {{orderDetailObject.gasOrder.gasOilLiters}}升 @@ -283,10 +283,18 @@ 加油优惠:{{orderDetailObject.gasOrder.deductionOilPrice}}元
-
-
-
- +
+ +
+
+ +
+
+ +
+
+ +
{{orderDetailObject.gasOrder.gasServiceFeePrice}}元 {{orderDetailObject.gasOrder.payIntegral / 100}}元 @@ -307,11 +315,10 @@ - 创建时间:{{orderDetailObject.tradeOrder.createTime | date : 'yyyy-MM-dd HH:mm:ss'}} - 取消时间:{{orderDetailObject.tradeOrder.cancelTime | date : 'yyyy-MM-dd HH:mm:ss'}} - 支付时间:{{orderDetailObject.tradeOrder.payTime | date : 'yyyy-MM-dd HH:mm:ss'}} - 完成时间:{{orderDetailObject.tradeOrder.finishTime | date : 'yyyy-MM-dd HH:mm:ss'}} - 退款时间:{{orderDetailObject.tradeOrder.refundTime | date : 'yyyy-MM-dd HH:mm:ss'}} + 创建时间:{{orderDetailObject.gasOrder.createTime | date : 'yyyy-MM-dd HH:mm:ss'}} + 取消时间:{{orderDetailObject.gasOrder.cancelTime | date : 'yyyy-MM-dd HH:mm:ss'}} + 支付时间:{{orderDetailObject.gasOrder.payTime | date : 'yyyy-MM-dd HH:mm:ss'}} + 退款时间:{{orderDetailObject.gasOrder.refundTime | date : 'yyyy-MM-dd HH:mm:ss'}} diff --git a/src/app/pages/trade/order-oil-list/order-oil-list.component.ts b/src/app/pages/trade/order-oil-list/order-oil-list.component.ts index 6bd8996..0cb9748 100644 --- a/src/app/pages/trade/order-oil-list/order-oil-list.component.ts +++ b/src/app/pages/trade/order-oil-list/order-oil-list.component.ts @@ -130,6 +130,8 @@ export class OrderOilListComponent { channelTypeArray = new DictionaryPipe().getDictionaryList('MER_SOURCE_TYPE'); // 账户类型 accountType: number; + // 代理商账户 + agentAccount: any; // 代理商 agentArray: any = []; // 业务员 @@ -158,6 +160,7 @@ export class OrderOilListComponent { private message: NzMessageService, private modal: NzModalService) { this.accountType = this.storage.get(DATA)['account']['objectType']; + this.agentAccount = this.storage.get(DATA)['agent']; // 退款提示模态框 this.refundForm = this.fb.group({ diff --git a/src/app/services/agent/agent-api.service.ts b/src/app/services/agent/agent-api.service.ts new file mode 100644 index 0000000..a63c8cc --- /dev/null +++ b/src/app/services/agent/agent-api.service.ts @@ -0,0 +1,75 @@ +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 AgentApiService { + + constructor(private http: HttpClient) { } + + /** + * 分配代理商 + * @param param + * @param callBack + */ + public getAccount(param: any, callBack:any) { + param.tm = new Date().getTime(); + this.http.get(environment.baseUrl + 'agentApiAccount/getAccount?'+ObjectData.objectByString(param)).subscribe(data => { + callBack(data); + }); + } + + + /** + * 充值 + * @param param + * @param callBack + */ + public recharge(param: any, callBack:any) { + param.tm = new Date().getTime(); + this.http.post(environment.baseUrl + 'agentApiAccount/recharge', param).subscribe(data => { + callBack(data); + }); + } + + /** + * 查询记录列表 + * @param param + * @param callBack + */ + public getRecordList(param: any, callBack:any) { + param.tm = new Date().getTime(); + this.http.get(environment.baseUrl + 'agentApiAccount/getRecordList?'+ObjectData.objectByString(param)).subscribe(data => { + callBack(data); + }); + } + + /** + * 查询API参数 + * @param param + * @param callBack + */ + public getApiParam(param: any, callBack:any) { + param.tm = new Date().getTime(); + this.http.get(environment.baseUrl + 'agentApiParam/getApiParam?'+ObjectData.objectByString(param)).subscribe(data => { + callBack(data); + }); + } + + /** + * 修改API参数 + * @param param + * @param callBack + */ + public updateApiParam(param: any, callBack:any) { + param.tm = new Date().getTime(); + this.http.post(environment.baseUrl + 'agentApiParam/update',param).subscribe(data => { + callBack(data); + }); + } + + +} diff --git a/src/app/services/agent/agent-mer-account.service.ts b/src/app/services/agent/agent-mer-account.service.ts new file mode 100644 index 0000000..44c37c0 --- /dev/null +++ b/src/app/services/agent/agent-mer-account.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 AgentMerAccountService { + + constructor(private http: HttpClient) { } + + /** + * 查询账户 + * @param param + * @param callBack + */ + public getAccount(param: any, callBack:any) { + param.tm = new Date().getTime(); + this.http.get(environment.baseUrl + 'agentMerAccount/getAccount?'+ObjectData.objectByString(param)).subscribe(data => { + callBack(data); + }); + } + + /** + * 充值 + * @param param + * @param callBack + */ + public recharge(param: any, callBack:any) { + param.tm = new Date().getTime(); + this.http.post(environment.baseUrl + 'agentMerAccount/recharge', param).subscribe(data => { + callBack(data); + }); + } + + + /** + * 查询账户列表 + * @param param + * @param callBack + */ + public getMerList(param: any, callBack:any) { + param.tm = new Date().getTime(); + this.http.get(environment.baseUrl + 'agentMerAccount/getMerList?'+ObjectData.objectByString(param)).subscribe(data => { + callBack(data); + }); + } + + + /** + * 查询账户记录列表 + * @param param + * @param callBack + */ + public getRecordList(param: any, callBack:any) { + param.tm = new Date().getTime(); + this.http.get(environment.baseUrl + 'agentMerAccount/getRecordList?'+ObjectData.objectByString(param)).subscribe(data => { + callBack(data); + }); + } +} diff --git a/src/app/services/agent/agent-mer.service.ts b/src/app/services/agent/agent-mer.service.ts new file mode 100644 index 0000000..f1e863e --- /dev/null +++ b/src/app/services/agent/agent-mer.service.ts @@ -0,0 +1,74 @@ +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 AgentMerService { + + constructor(private http: HttpClient) { } + + /** + * 分配代理商 + * @param param + * @param callBack + */ + public assignAgent(param: any, callBack:any) { + param.tm = new Date().getTime(); + this.http.post(environment.baseUrl + 'agentMer/assignAgent', param).subscribe(data => { + callBack(data); + }); + } + + /** + * 解绑代理商 + * @param param + * @param callBack + */ + public unbindAgent(param: any, callBack:any) { + param.tm = new Date().getTime(); + this.http.post(environment.baseUrl + 'agentMer/unbindAgent', param).subscribe(data => { + callBack(data); + }); + } + + /** + * 分配工作人员 + * @param param + * @param callBack + */ + public assignStaff(param: any, callBack:any) { + param.tm = new Date().getTime(); + this.http.post(environment.baseUrl + 'agentMer/assignStaff', param).subscribe(data => { + callBack(data); + }); + } + + /** + * 解绑业务员 + * @param param + * @param callBack + */ + public unbindStaff(param: any, callBack:any) { + param.tm = new Date().getTime(); + this.http.post(environment.baseUrl + 'agentMer/unbindStaff', param).subscribe(data => { + callBack(data); + }); + } + + + /** + * 查询分配列表 + * @param param + * @param callBack + */ + public getAllotList(param: any, callBack:any) { + param.tm = new Date().getTime(); + this.http.get(environment.baseUrl + 'agentMer/getAllotList?'+ObjectData.objectByString(param)).subscribe(data => { + callBack(data); + }); + } + +} diff --git a/src/app/services/agent/agent-price.service.ts b/src/app/services/agent/agent-price.service.ts index d3c9c60..d8153b2 100644 --- a/src/app/services/agent/agent-price.service.ts +++ b/src/app/services/agent/agent-price.service.ts @@ -45,4 +45,16 @@ export class AgentPriceService { callBack(data); }); } + + /** + * 查询代理价格 + * @param param + * @param callBack + */ + public getPriceList(param: any, callBack:any) { + param.tm = new Date().getTime(); + this.http.get(environment.baseUrl + 'agentPrice/getPriceList?'+ObjectData.objectByString(param)).subscribe(data => { + callBack(data); + }); + } } diff --git a/src/app/services/agent/agent-staff.service.ts b/src/app/services/agent/agent-staff.service.ts index 5fc5e59..75f5950 100644 --- a/src/app/services/agent/agent-staff.service.ts +++ b/src/app/services/agent/agent-staff.service.ts @@ -10,11 +10,71 @@ export class AgentStaffService { constructor(private http: HttpClient) { } + /** + * 增加业务员 + * @param param + * @param callBack + */ + public addStaff(param: any, callBack:any) { + param.tm = new Date().getTime(); + this.http.post(environment.baseUrl + 'agentStaff/addStaff', param).subscribe(data => { + callBack(data); + }); + } + + /** + * 修改业务员 + * @param param + * @param callBack + */ + public updateStaff(param: any, callBack:any) { + param.tm = new Date().getTime(); + this.http.post(environment.baseUrl + 'agentStaff/updateStaff', param).subscribe(data => { + callBack(data); + }); + } + + /** + * 删除业务员 + * @param param + * @param callBack + */ + public delStaff(param: any, callBack:any) { + param.tm = new Date().getTime(); + this.http.post(environment.baseUrl + 'agentStaff/delStaff', param).subscribe(data => { + callBack(data); + }); + } + + /** + * 业务员密码重置 + * @param param + * @param callBack + */ + public staffPwdReset(param: any, callBack:any) { + param.tm = new Date().getTime(); + this.http.post(environment.baseUrl + 'agentStaff/staffPwdReset', param).subscribe(data => { + callBack(data); + }); + } + /** * 查询业务员 * @param param * @param callBack */ + public getStaffDetail(param: any, callBack:any) { + param.tm = new Date().getTime(); + this.http.get(environment.baseUrl + 'agentStaff/getStaffDetail?'+ObjectData.objectByString(param)).subscribe(data => { + callBack(data); + }); + } + + /** + * 查询业务员列表 + * @param param + * @param callBack + */ public getStaffList(param: any, callBack:any) { param.tm = new Date().getTime(); this.http.get(environment.baseUrl + 'agentStaff/getStaffList?'+ObjectData.objectByString(param)).subscribe(data => { diff --git a/src/app/services/agent/agent.service.ts b/src/app/services/agent/agent.service.ts index 079a351..d6ed983 100644 --- a/src/app/services/agent/agent.service.ts +++ b/src/app/services/agent/agent.service.ts @@ -10,6 +10,42 @@ export class AgentService { constructor(private http: HttpClient) { } + /** + * 创建代理商 + * @param param + * @param callBack + */ + public createAgent(param: any, callBack:any) { + param.tm = new Date().getTime(); + this.http.post(environment.baseUrl + 'agent/createAgent', param).subscribe(data => { + callBack(data); + }); + } + + /** + * 修改代理商 + * @param param + * @param callBack + */ + public updateAgent(param: any, callBack:any) { + param.tm = new Date().getTime(); + this.http.post(environment.baseUrl + 'agent/updateAgent', param).subscribe(data => { + callBack(data); + }); + } + + /** + * 查询代理商详情 + * @param param + * @param callBack + */ + public queryAgentDetail(param: any, callBack:any) { + param.tm = new Date().getTime(); + this.http.get(environment.baseUrl + 'agent/queryAgentDetail?'+ObjectData.objectByString(param)).subscribe(data => { + callBack(data); + }); + } + /** * 查询代理商列表 * @param param diff --git a/src/app/services/discount/discount-pk-stock.service.ts b/src/app/services/discount/discount-pk-stock.service.ts new file mode 100644 index 0000000..d20441f --- /dev/null +++ b/src/app/services/discount/discount-pk-stock.service.ts @@ -0,0 +1,47 @@ +import { Injectable } from '@angular/core'; +import {HttpClient} from "@angular/common/http"; +import {environment} from "../../../environments/environment"; + +@Injectable({ + providedIn: 'root' +}) +export class DiscountPkStockService { + + constructor(private http: HttpClient) { } + + /** + * 增加库存 + * @param params + * @param callBack + */ + public edit(params: any, callBack:any) { + params.time = new Date().getTime(); + this.http.post(environment.baseUrl + 'discountPk/edit', params).subscribe(data => { + callBack(data); + }); + } + + /** + * 查询库存批次 + * @param params + * @param callBack + */ + public queryStockBatchList(params: any, callBack:any) { + params.time = new Date().getTime(); + this.http.post(environment.baseUrl + 'discountPk/queryStockBatchList', params).subscribe(data => { + callBack(data); + }); + } + + /** + * 查询库存批次优惠券code + * @param params + * @param callBack + */ + public queryStockBatchCodeList(params: any, callBack:any) { + params.time = new Date().getTime(); + this.http.post(environment.baseUrl + 'discountPk/queryStockBatchCodeList', params).subscribe(data => { + callBack(data); + }); + } +} diff --git a/src/app/services/discount/discount-pk.service.ts b/src/app/services/discount/discount-pk.service.ts new file mode 100644 index 0000000..8b35488 --- /dev/null +++ b/src/app/services/discount/discount-pk.service.ts @@ -0,0 +1,98 @@ +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 DiscountPkService { + + constructor(private http: HttpClient) { } + + /** + * 编辑优惠 + * @param params + * @param callBack + */ + public edit(params: any, callBack:any) { + params.time = new Date().getTime(); + this.http.post(environment.baseUrl + 'discountPk/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 + 'discountPk/online', params).subscribe(data => { + callBack(data); + }); + } + + /** + * 结束优惠券包 + * @param params + * @param callBack + */ + public done(params: any, callBack:any) { + params.time = new Date().getTime(); + this.http.post(environment.baseUrl + 'discountPk/done', 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 + 'discountPk/delete', params).subscribe(data => { + callBack(data); + }); + } + + /** + * 赠送用户 + * @param params + * @param callBack + */ + public giveUser(params: any, callBack:any) { + params.time = new Date().getTime(); + this.http.post(environment.baseUrl + 'discountPk/giveUser', params).subscribe(data => { + callBack(data); + }); + } + + /** + * 查询详情 + * @param params + * @param callBack + */ + public getDetail(params: any, callBack:any) { + params.time = new Date().getTime(); + this.http.get(environment.baseUrl + 'discountPk/getDetail?'+ObjectData.objectByString(params)).subscribe(data => { + callBack(data); + }); + } + + /** + * 查询列表 + * @param params + * @param callBack + */ + public getList(params: any, callBack:any) { + params.time = new Date().getTime(); + this.http.get(environment.baseUrl + 'discountPk/getList?'+ObjectData.objectByString(params)).subscribe(data => { + callBack(data); + }); + } + +} diff --git a/src/app/services/discount/discount-stock.service.ts b/src/app/services/discount/discount-stock.service.ts new file mode 100644 index 0000000..5ee3ee3 --- /dev/null +++ b/src/app/services/discount/discount-stock.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 DiscountStockService { + + constructor(private http: HttpClient) { } + + /** + * 增加优惠券库存 + * @param params + * @param callBack + */ + public addStock(params: any, callBack:any) { + params.time = new Date().getTime(); + this.http.post(environment.baseUrl + 'discountStock/addStock', params).subscribe(data => { + callBack(data); + }); + } + + /** + * 查询库存批次 + * @param params + * @param callBack + */ + public queryStockBatchList(params: any, callBack:any) { + params.time = new Date().getTime(); + this.http.get(environment.baseUrl + 'discountStock/queryStockBatchList?'+ObjectData.objectByString(params)).subscribe(data => { + callBack(data); + }); + } + + + /** + * 查询库存批次详情 + * @param params + * @param callBack + */ + public queryStockBatchDetail(params: any, callBack:any) { + params.time = new Date().getTime(); + this.http.get(environment.baseUrl + 'discountStock/queryStockBatchDetail?'+ObjectData.objectByString(params)).subscribe(data => { + callBack(data); + }); + } + + /** + * 查询库存批次优惠券code + * @param params + * @param callBack + */ + public queryStockBatchCodeList(params: any, callBack:any) { + params.time = new Date().getTime(); + this.http.get(environment.baseUrl + 'discountStock/queryStockBatchCodeList?'+ObjectData.objectByString(params)).subscribe(data => { + callBack(data); + }); + } + +} diff --git a/src/app/services/discount/discount.service.ts b/src/app/services/discount/discount.service.ts new file mode 100644 index 0000000..17f106c --- /dev/null +++ b/src/app/services/discount/discount.service.ts @@ -0,0 +1,135 @@ +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 DiscountService { + + constructor(private http: HttpClient) { } + + /** + * 编辑优惠 + * @param params + * @param callBack + */ + public editDiscount(params: any, callBack:any) { + params.time = new Date().getTime(); + this.http.post(environment.baseUrl + 'discount/editDiscount', params).subscribe(data => { + callBack(data); + }); + } + + /** + * 修改结束时间 + * @param params + * @param callBack + */ + public updateEndTime(params: any, callBack:any) { + params.time = new Date().getTime(); + this.http.post(environment.baseUrl + 'discount/updateEndTime', params).subscribe(data => { + callBack(data); + }); + } + + /** + * 赠送用户 + * @param params + * @param callBack + */ + public giveUser(params: any, callBack:any) { + params.time = new Date().getTime(); + this.http.post(environment.baseUrl + 'discount/giveUser', 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 + 'discount/online', params).subscribe(data => { + callBack(data); + }); + } + + /** + * 下线 + * @param params + * @param callBack + */ + public done(params: any, callBack:any) { + params.time = new Date().getTime(); + this.http.post(environment.baseUrl + 'discount/done', 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 + 'discount/delete', params).subscribe(data => { + callBack(data); + }); + } + + /** + * 查询详情 + * @param params + * @param callBack + */ + public queryDetail(params: any, callBack:any) { + params.time = new Date().getTime(); + this.http.get(environment.baseUrl + 'discount/queryDetail?'+ObjectData.objectByString(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 + 'discount/queryList?'+ObjectData.objectByString(params)).subscribe(data => { + callBack(data); + }); + } + + /** + * 编辑可使用油站 + * @param params + * @param callBack + */ + public editUseMer(params: any, callBack:any) { + params.time = new Date().getTime(); + this.http.post(environment.baseUrl + 'discountUseMer/edit', params).subscribe(data => { + callBack(data); + }); + } + + /** + * 查询列表 + * @param params + * @param callBack + */ + public getUseMerList(params: any, callBack:any) { + params.time = new Date().getTime(); + this.http.get(environment.baseUrl + 'discountUseMer/getUseMerList?'+ObjectData.objectByString(params)).subscribe(data => { + callBack(data); + }); + } + + +} diff --git a/src/environments/environment.ts b/src/environments/environment.ts index debd267..1942a40 100644 --- a/src/environments/environment.ts +++ b/src/environments/environment.ts @@ -4,7 +4,7 @@ export const environment = { production: false, - baseUrl: 'https://test-oil.dctpay.com/brest/', // 测试环境服务器地址(请求数据地址) + baseUrl: 'http://localhost:9802/brest/', // 测试环境服务器地址(请求数据地址) imageUrl: 'https://test-oil.dctpay.com/filesystem/', };