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);
+ });
+ }
+
+}