diff --git a/src/app/pages/agent/agent-mer-discount-list/agent-mer-discount-list.component.html b/src/app/pages/agent/agent-mer-discount-list/agent-mer-discount-list.component.html new file mode 100644 index 0000000..1904afd --- /dev/null +++ b/src/app/pages/agent/agent-mer-discount-list/agent-mer-discount-list.component.html @@ -0,0 +1,225 @@ +
+
+
+ + 代理商【当前代理】 + + + + + + +
+
+ + 地区 + + + + + + +
+
+ + 来源渠道 + + + + + + +
+
+ + 油号 + + + + + + +
+
+ + 油站编号 + + + + +
+
+ + 油站名称 + + + + +
+
+ + + + + + + + +
+
+
+ + + + + 来源渠道 + 油站地区 + 油站编号 + 油站名称 + 油号 + 国标价 + 油枪价 + 优惠价 + 优惠折扣 + 操作 + + + + + {{data.sourceType | dictionary: "MER_SOURCE_TYPE"}} + {{data.provinceName}} + {{data.merNo}} + {{data.merName}} + {{data.oilNo}} + ¥ {{data.priceOfficial}} + ¥ {{data.priceGun}} + ¥ {{data.terminalPrice}} + {{data.priceRate}} % + + 调整优惠 + + + + 总计 {{ total }} 条 + + + + + + +
+ + 【当前代理】 + + + + + + + + + 渠道 + + + + + + + + + 地区(省/直辖市) + + + + + + + + + 油号 + + + + + + + + + 折扣 + + + + + + + +
+ +
+
+
+
+
+ + + + +
+ + + 油号 + + + + + + + + + 折扣 + + + + + + + +
+ +
+
+
+
+
diff --git a/src/app/pages/agent/agent-mer-discount-list/agent-mer-discount-list.component.less b/src/app/pages/agent/agent-mer-discount-list/agent-mer-discount-list.component.less new file mode 100644 index 0000000..b44e8a4 --- /dev/null +++ b/src/app/pages/agent/agent-mer-discount-list/agent-mer-discount-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-discount-list/agent-mer-discount-list.component.ts b/src/app/pages/agent/agent-mer-discount-list/agent-mer-discount-list.component.ts new file mode 100644 index 0000000..614bb88 --- /dev/null +++ b/src/app/pages/agent/agent-mer-discount-list/agent-mer-discount-list.component.ts @@ -0,0 +1,310 @@ +import { Component } from '@angular/core'; +import {DictionaryPipe} from "../../../pipes/common/dictionary.pipe"; +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, NzRowDirective} from "ng-zorro-antd/grid"; +import {NzFormControlComponent, NzFormDirective, NzFormItemComponent, NzFormLabelComponent} from "ng-zorro-antd/form"; +import {NzInputDirective} from "ng-zorro-antd/input"; +import {NzOptionComponent, NzSelectComponent} from "ng-zorro-antd/select"; +import { + NzCellFixedDirective, + NzTableCellDirective, + NzTableComponent, NzTableModule, + NzTbodyComponent, + NzTheadComponent, + NzThMeasureDirective, NzTrDirective +} from "ng-zorro-antd/table"; +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 {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 {MerService} from "../../../services/merchant/mer.service"; +import {NzMessageService} from "ng-zorro-antd/message"; +import {AgentService} from "../../../services/agent/agent.service"; +import {AgentStaffService} from "../../../services/agent/agent-staff.service"; +import {AgentPriceService} from "../../../services/agent/agent-price.service"; +import {AgentMerService} from "../../../services/agent/agent-mer.service"; +import {CommonService} from "../../../services/common/common.service"; +import {NzSpinComponent} from "ng-zorro-antd/spin"; + +@Component({ + selector: 'app-agent-mer-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, + NzTypographyComponent, + NzSpinComponent + ], + templateUrl: './agent-mer-discount-list.component.html', + styleUrl: './agent-mer-discount-list.component.less' +}) +export class AgentMerDiscountListComponent { + loadingObject = { + title: "处理中...", + status: false, + }; + // 表单页数 + 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 = []; + + updateDiscountModal = false; + updateDiscountForm: FormGroup; + + batchUpdateDiscountModal = false; + batchUpdateDiscountForm: FormGroup; + constructor(private fb: NonNullableFormBuilder, + private agentService: AgentService, + private agentPriceService: AgentPriceService, + private commonService: CommonService, + private message: NzMessageService, + private modal: NzModalService) { + // 初始化搜索框 + this.searchForm = this.fb.group({ + agentId: [''], + sourceType: [''], + provinceCode: [''], + oilNo: [''], + merNo: [''], + merName: [''], + }); + + this.updateDiscountForm = this.fb.group({ + agentId: [''], + merNo: [''], + oilNo: ['', [Validators.required]], + priceRate: ['', [Validators.required]], + serviceFeeRate: ['0', [Validators.required]], + }); + + this.batchUpdateDiscountForm = this.fb.group({ + agentId: [{value: null, disabled: true}], + provinceCode: [''], + sourceType: [''], + oilNo: ['', [Validators.required]], + priceRate: ['', [Validators.required]], + serviceFeeRate: ['0', [Validators.required]], + }); + + // 获取地区 + this.commonService.getRegion("", (data: any) => { + this.regionData = data['return_data']; + }); + + // 获取代理商 + this.agentService.queryAgentList({type:'2',pageNum:1,pageSize:999}, (data: any) => { + this.agentData = data['return_data']['list']; + this.searchForm.controls['agentId'].setValue(String(this.agentData[0]['id'])); + + this.queryData(); + }); + } + + /** + * 获取数据 + */ + queryData() { + this.searchForm.value.pageNum = this.tablePageNum; + this.searchForm.value.pageSize = this.tablePageSize; + this.agentPriceService.getApiDiscountList(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.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); + } + + /** + * 打开修改优惠模态框 + */ + showBatchUpdateDiscount() { + this.batchUpdateDiscountForm.controls['agentId'].setValue(this.searchForm.controls['agentId'].value); + this.batchUpdateDiscountModal = true; + } + + /** + * 提交修改优惠 + */ + submitBatchUpdateDiscount() { + this.loadingObject.title = '处理中...'; + this.loadingObject.status = true; + if (this.batchUpdateDiscountForm.valid) { + const reqParam = this.batchUpdateDiscountForm.value; + reqParam['agentId'] = this.batchUpdateDiscountForm.controls['agentId'].value; + + this.agentPriceService.batchConfigApiPrice(reqParam, (data: any) => { + if (data['return_code'] == '000000') { + this.message.create('success', '操作成功'); + // 关闭弹窗 + this.closeBatchUpdateDiscount(); + + this.loadingObject.status = false; + + // 刷新数据 + this.queryData(); + // 表单重置 + this.batchUpdateDiscountForm.reset(); + } else { + this.message.create('error', data['return_msg']); + } + }); + } else { + this.loadingObject.status = false; + Object.values(this.batchUpdateDiscountForm.controls).forEach(control => { + if (control.invalid) { + control.markAsDirty(); + control.updateValueAndValidity({ onlySelf: true }); + } + }); + } + } + /** + * 关闭修改优惠模态框 + */ + closeBatchUpdateDiscount() { + this.batchUpdateDiscountForm.reset(); + this.batchUpdateDiscountModal = false; + } + + + /** + * 打开修改优惠模态框 + * @param data + */ + showUpdateDiscount(data: any) { + this.updateDiscountForm.patchValue(data); + this.updateDiscountForm.controls['oilNo'].disable(); + this.updateDiscountModal = true; + } + + /** + * 提交修改优惠 + */ + submitUpdateDiscount() { + this.loadingObject.title = '处理中...'; + this.loadingObject.status = true; + if (this.updateDiscountForm.valid) { + this.updateDiscountForm.value; + let paramArr = []; + this.updateDiscountForm.controls['agentId'].setValue(this.searchForm.controls['agentId'].value); + let param = this.updateDiscountForm.value; + param['oilNo'] = this.updateDiscountForm.controls['oilNo'].value; + paramArr.push(param); + this.agentPriceService.editApiPrice(paramArr, (data: any) => { + if (data['return_code'] == '000000') { + this.message.create('success', '操作成功'); + // 关闭弹窗 + this.closeUpdateDiscount(); + + this.loadingObject.status = false; + + // 刷新数据 + this.queryData(); + // 表单重置 + this.updateDiscountForm.reset(); + } else { + this.message.create('error', data['return_msg']); + } + }); + } else { + this.loadingObject.status = false; + + 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-mer-list/agent-mer-list.component.html b/src/app/pages/agent/agent-mer-list/agent-mer-list.component.html index 451bdde..c2e5f89 100644 --- 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 @@ -49,10 +49,10 @@
- 地区 + 油站来源 - - + + @@ -60,15 +60,17 @@
- 油站来源 + 地区 - - + +
+ +
油站编号 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 index 07c8518..dd87554 100644 --- 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 @@ -131,7 +131,7 @@ export class AgentMerListComponent { isAgentAllot: ['true'], isAgentStaffAllot: ['true'], provinceCode: [null], - merSourceType: [null], + merSourceType: ['3'], merNo: [null], merName: [null], status: [null], diff --git a/src/app/pages/agent/agent.routes.ts b/src/app/pages/agent/agent.routes.ts index dfd4d09..789564f 100644 --- a/src/app/pages/agent/agent.routes.ts +++ b/src/app/pages/agent/agent.routes.ts @@ -6,6 +6,7 @@ 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"; +import {AgentMerDiscountListComponent} from "./agent-mer-discount-list/agent-mer-discount-list.component"; export const AGENT_ROUTES: Routes = [ { path: 'agent-list', component: AgentListComponent }, @@ -15,4 +16,5 @@ export const AGENT_ROUTES: Routes = [ { path: 'agent-price-list', component: AgentPriceListComponent }, { path: 'agent-refer-price-list', component: AgentReferPriceListComponent }, { path: 'agent-api-account', component: AgentApiAccountComponent }, + { path: 'agent-mer-discount-list', component: AgentMerDiscountListComponent }, ]; 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 f89b49c..2cc6d39 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 @@ -225,7 +225,7 @@ {{data.gasOilNo}}# {{data.gasGunNo}}号枪 {{data.gasDiscount != 1?(data.gasDiscount*100).toFixed(2) + '折':'无'}} - {{data.createType==1?data.gasPricePlatform+'元':'无'}} + {{data.gasPricePlatform+'元'}} {{data.gasPriceVip+'元'}} {{data.gasPriceGun}}元 {{data.gasPriceOfficial}}元 diff --git a/src/app/services/agent/agent-price.service.ts b/src/app/services/agent/agent-price.service.ts index d8153b2..2938151 100644 --- a/src/app/services/agent/agent-price.service.ts +++ b/src/app/services/agent/agent-price.service.ts @@ -22,6 +22,30 @@ export class AgentPriceService { }); } + /** + * 编辑价格 + * @param param + * @param callBack + */ + public editApiPrice(param: any, callBack:any) { + param.tm = new Date().getTime(); + this.http.post(environment.baseUrl + 'agentPrice/editApiPrice', param).subscribe(data => { + callBack(data); + }); + } + + /** + * 批量配置API价格 + * @param param + * @param callBack + */ + public batchConfigApiPrice(param: any, callBack:any) { + param.tm = new Date().getTime(); + this.http.post(environment.baseUrl + 'agentPrice/batchConfigApiPrice', param).subscribe(data => { + callBack(data); + }); + } + /** * 批量配置价格 * @param param @@ -57,4 +81,16 @@ export class AgentPriceService { callBack(data); }); } + + /** + * 获取APi代理优惠价格列表 + * @param param + * @param callBack + */ + public getApiDiscountList(param: any, callBack:any) { + param.tm = new Date().getTime(); + this.http.get(environment.baseUrl + 'agentPrice/getApiDiscountList?'+ObjectData.objectByString(param)).subscribe(data => { + callBack(data); + }); + } } diff --git a/src/environments/environment.ts b/src/environments/environment.ts index 1942a40..debd267 100644 --- a/src/environments/environment.ts +++ b/src/environments/environment.ts @@ -4,7 +4,7 @@ export const environment = { production: false, - baseUrl: 'http://localhost:9802/brest/', // 测试环境服务器地址(请求数据地址) + baseUrl: 'https://test-oil.dctpay.com/brest/', // 测试环境服务器地址(请求数据地址) imageUrl: 'https://test-oil.dctpay.com/filesystem/', };