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