From f6e093ebc1600796109d4b1f70fb251262e5ceb1 Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Mon, 1 Aug 2022 17:12:34 +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 --- .../oils-discount.component.html | 79 ++++++++++++++- .../oils-discount.component.scss | 3 + .../oils-discount/oils-discount.component.ts | 95 +++++++++++++++++++ .../services/gas-channel-config.service.ts | 40 ++++++++ 4 files changed, 214 insertions(+), 3 deletions(-) create mode 100644 src/app/services/gas-channel-config.service.ts diff --git a/src/app/admin/system/oils-discount/oils-discount.component.html b/src/app/admin/system/oils-discount/oils-discount.component.html index aaa052a..7accdeb 100644 --- a/src/app/admin/system/oils-discount/oils-discount.component.html +++ b/src/app/admin/system/oils-discount/oils-discount.component.html @@ -31,8 +31,8 @@
共计 {{total}} 条数据
- - + +
+ + + + 渠道 + + + + + + + +
+ + 第三方平台 + + + + + + + + + 商户全称 + + + + + + + 商户号 + + + + + + + 是否分账 + + + + + + + + + + 分账比例(%) + + + + + + + 接收方全称 + + + + + + + 接收方商户号 + + + + + +
+ +
+
+
+ + diff --git a/src/app/admin/system/oils-discount/oils-discount.component.scss b/src/app/admin/system/oils-discount/oils-discount.component.scss index e69de29..90447c4 100644 --- a/src/app/admin/system/oils-discount/oils-discount.component.scss +++ b/src/app/admin/system/oils-discount/oils-discount.component.scss @@ -0,0 +1,3 @@ +nz-input-number { + width: 100%; +} diff --git a/src/app/admin/system/oils-discount/oils-discount.component.ts b/src/app/admin/system/oils-discount/oils-discount.component.ts index 063221e..1cce964 100644 --- a/src/app/admin/system/oils-discount/oils-discount.component.ts +++ b/src/app/admin/system/oils-discount/oils-discount.component.ts @@ -6,6 +6,7 @@ import {CommonsService} from '../../../services/commons.service'; import {FormBuilder, FormGroup, Validators} from '@angular/forms'; import {NzMessageService, NzModalService} from 'ng-zorro-antd'; import {Router} from '@angular/router'; +import {GasChannelConfigService} from '../../../services/gas-channel-config.service'; @Component({ selector: 'app-oils-discount', @@ -25,15 +26,21 @@ export class OilsDiscountComponent implements OnInit { isVisible = false; roleTypeArray; + gasChannelConfigChannelArray = []; configOilMerNumModal = false; configOilMerNumForm: FormGroup; + channelId = '1'; + tripartitePlatformModal = false; + tripartitePlatformForm: FormGroup; + constructor( private form: FormBuilder, private modal: NzModalService, private company: CompanyService, private iconService: IconService, private message: NzMessageService, + private gasChannelConfigService: GasChannelConfigService, private router: Router, private common: CommonsService ) { @@ -43,6 +50,10 @@ export class OilsDiscountComponent implements OnInit { this.common.getDictionary('GAS_OIL_TYPE', data => { this.roleTypeArray = data['return_data']; }); + + this.common.getDictionary('GAS_CHANNEL_CONFIG_CHANNEL', data => { + this.gasChannelConfigChannelArray = data['return_data']; + }); this.init(); } @@ -60,6 +71,15 @@ export class OilsDiscountComponent implements OnInit { codeValue: [null, [Validators.required]], }); + this.tripartitePlatformForm = this.form.group({ + payPlatformType: ['1', [Validators.required]], + payPlatformMerName: [null, [Validators.required]], + payPlatformMerNo: [null, [Validators.required]], + profitSharingStatus: ['false', [Validators.required]], + profitSharingRatio: [null], + profitSharingReceiversNo: [null], + profitSharingReceiversName: [null], + }); this.getRequest(true, this.searchForm.value); } @@ -167,5 +187,80 @@ export class OilsDiscountComponent implements OnInit { } }); } + + // 打开配置第三方模态框 + showTripartitePlatformModal () { + this.selectChannel(this.channelId); + this.tripartitePlatformModal = true; + } + + // 关闭配置第三方模态框 + closeTripartitePlatformModal () { + this.tripartitePlatformModal = false; + } + + // 提交第三方 + submitTripartitePlatform() { + for (const i in this.tripartitePlatformForm.controls) { + this.tripartitePlatformForm.controls[i].markAsDirty(); + this.tripartitePlatformForm.controls[i].updateValueAndValidity(); + } + if (this.tripartitePlatformForm.status == null || this.tripartitePlatformForm.status !== 'VALID') { + this.modal.warning({ + nzTitle: '提示', + nzContent: '请填写所有必填项', + }); + return; + } + + if (this.tripartitePlatformForm.value.profitSharingStatus === 'true' + && (this.tripartitePlatformForm.value.profitSharingRatio == null || + this.tripartitePlatformForm.value.profitSharingReceiversNo == null || + this.tripartitePlatformForm.value.profitSharingReceiversName == null)) { + this.modal.warning({ + nzTitle: '提示', + nzContent: '请填写所有必填项', + }); + return; + } + + this.tripartitePlatformForm.value['channelId'] = this.channelId; + this.gasChannelConfigService.editTripartitePlatform(this.tripartitePlatformForm.value, data => { + if (data['return_code'] === '000000') { + this.modal.success({ + nzTitle: '提示', + nzContent: '保存成功', + }); + this.closeTripartitePlatformModal(); + } else { + this.modal.error({ + nzTitle: '提示', + nzContent: data['return_msg'], + }); + } + }); + + } + + // 选择商户号 + selectChannel(channelId: string) { + this.channelId = channelId; + this.gasChannelConfigService.getDetail(Number(channelId), this.tripartitePlatformForm.value['payPlatformType'], data => { + if (data['return_data'] != null) { + data['return_data']['channelId'] = String(data['return_data']['channelId']); + data['return_data']['payPlatformType'] = String(data['return_data']['payPlatformType']); + data['return_data']['profitSharingStatus'] = String(data['return_data']['profitSharingStatus']); + this.tripartitePlatformForm.patchValue(data['return_data']) + } else { + const param = { + channelId: channelId, + payPlatformType: String(this.tripartitePlatformForm.value['payPlatformType']), + profitSharingStatus: 'false' + } + this.tripartitePlatformForm.reset(); + this.tripartitePlatformForm.patchValue(param); + } + }); + } } diff --git a/src/app/services/gas-channel-config.service.ts b/src/app/services/gas-channel-config.service.ts new file mode 100644 index 0000000..029e6ef --- /dev/null +++ b/src/app/services/gas-channel-config.service.ts @@ -0,0 +1,40 @@ +import { Injectable } from '@angular/core'; +import {HttpClient} from '@angular/common/http'; +import {CommonsService} from './commons.service'; +import {environment} from '../../environments/environment'; + +@Injectable({ + providedIn: 'root' +}) +export class GasChannelConfigService { + + constructor( + private http: HttpClient, + private common: CommonsService + ) { } + + /** + * 编辑第三方 + * + * @param param 参数对象 + * @param callBack 回调 + */ + public editTripartitePlatform(param: object, callBack) { + this.http.post(environment.baseUrl + 'gasChannelConfig/editTripartitePlatform', param).subscribe(data => { + callBack(data); + }); + } + + /** + * 查询详情 + * + * @param param 参数对象 + * @param callBack 回调 + */ + public getDetail(channelId: number, payPlatformType: number, callBack) { + this.http.get(environment.baseUrl + 'gasChannelConfig/getDetail?channelId=' + channelId + '&payPlatformType=' + payPlatformType).subscribe(data => { + callBack(data); + }); + } + +}