提交代码

pull/1/head
胡锐 2 years ago
parent 0fba1e3e77
commit f6e093ebc1
  1. 79
      src/app/admin/system/oils-discount/oils-discount.component.html
  2. 3
      src/app/admin/system/oils-discount/oils-discount.component.scss
  3. 95
      src/app/admin/system/oils-discount/oils-discount.component.ts
  4. 40
      src/app/services/gas-channel-config.service.ts

@ -31,8 +31,8 @@
<div class="inner-content"> <div class="inner-content">
<span>共计 {{total}} 条数据</span> <span>共计 {{total}} 条数据</span>
<div class="operating-button"> <div class="operating-button">
<button nz-button nzType="primary" class="right-btn" (click)="showConfigOilMerNum()" ><i nz-icon nzType="plus" nzTheme="outline"></i>配置商户号</button> <button nz-button nzType="primary" class="right-btn" (click)="showTripartitePlatformModal()" >渠道支付配置</button>
<button nz-button nzType="primary" class="right-btn" (click)="getAdd()" ><i nz-icon nzType="plus" nzTheme="outline"></i>添加</button> <button nz-button nzType="primary" class="right-btn" (click)="getAdd()" >添加油品优惠</button>
</div> </div>
<nz-table <nz-table
class="table" class="table"
@ -102,6 +102,79 @@
</form> </form>
</nz-modal> </nz-modal>
<nz-modal [(nzVisible)]="tripartitePlatformModal" nzTitle="渠道支付配置" (nzOnCancel)="closeTripartitePlatformModal()" nzWidth="500px" [nzFooter]="null">
<nz-form-item>
<nz-form-label [nzSpan]="6" nzRequired >渠道</nz-form-label>
<nz-form-control [nzSpan]="14">
<nz-select [(ngModel)]="channelId" (ngModelChange)="selectChannel($event)">
<nz-option *ngFor="let item of gasChannelConfigChannelArray" nzValue="{{item.codeValue}}" nzLabel="{{item.codeName}}"></nz-option>
</nz-select>
</nz-form-control>
</nz-form-item>
<form nz-form [formGroup]="tripartitePlatformForm">
<nz-form-item>
<nz-form-label [nzSpan]="6" nzRequired >第三方平台</nz-form-label>
<nz-form-control [nzSpan]="14">
<nz-select formControlName="payPlatformType">
<nz-option nzValue="1" nzLabel="微信"></nz-option>
</nz-select>
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label [nzSpan]="6" nzRequired >商户全称</nz-form-label>
<nz-form-control [nzSpan]="14">
<input nz-input placeholder="请输入第三方平台商户全称" formControlName="payPlatformMerName" />
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label [nzSpan]="6" nzRequired >商户号</nz-form-label>
<nz-form-control [nzSpan]="14">
<input nz-input placeholder="请输入第三方平台商户号" formControlName="payPlatformMerNo" />
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label [nzSpan]="6" nzRequired >是否分账</nz-form-label>
<nz-form-control [nzSpan]="14">
<nz-radio-group formControlName="profitSharingStatus">
<label nz-radio nzValue="true"></label>
<label nz-radio nzValue="false"></label>
</nz-radio-group>
</nz-form-control>
</nz-form-item>
<nz-form-item *ngIf="tripartitePlatformForm.value.profitSharingStatus == 'true'">
<nz-form-label [nzSpan]="6" nzRequired >分账比例(%)</nz-form-label>
<nz-form-control [nzSpan]="14">
<nz-input-number formControlName="profitSharingRatio" [nzPrecision]="2" [nzMin]="0" [nzMax]="30" [nzPlaceHolder]="'分账比例(%)'"></nz-input-number>
</nz-form-control>
</nz-form-item>
<nz-form-item *ngIf="tripartitePlatformForm.value.profitSharingStatus == 'true'">
<nz-form-label [nzSpan]="6" nzRequired >接收方全称</nz-form-label>
<nz-form-control [nzSpan]="14">
<input nz-input placeholder="分账接收方全称" formControlName="profitSharingReceiversName" />
</nz-form-control>
</nz-form-item>
<nz-form-item *ngIf="tripartitePlatformForm.value.profitSharingStatus == 'true'">
<nz-form-label [nzSpan]="6" nzRequired >接收方商户号</nz-form-label>
<nz-form-control [nzSpan]="14">
<input nz-input placeholder="分账接收方商户号" formControlName="profitSharingReceiversNo" />
</nz-form-control>
</nz-form-item>
<div style="text-align: center;">
<button nz-button nzType="primary" style="width: 150px;" (click)="submitTripartitePlatform()">确定</button>
</div>
</form>
</nz-modal>
<!--
<nz-modal [(nzVisible)]="configOilMerNumModal" nzTitle="配置商户号" (nzOnCancel)="closeConfigOilMerNum()" (nzOnOk)="submitConfigOilMerNum()"> <nz-modal [(nzVisible)]="configOilMerNumModal" nzTitle="配置商户号" (nzOnCancel)="closeConfigOilMerNum()" (nzOnOk)="submitConfigOilMerNum()">
<form nz-form [formGroup]="configOilMerNumForm"> <form nz-form [formGroup]="configOilMerNumForm">
<div nz-row> <div nz-row>
@ -117,4 +190,4 @@
</div> </div>
</div> </div>
</form> </form>
</nz-modal> </nz-modal>-->

@ -6,6 +6,7 @@ import {CommonsService} from '../../../services/commons.service';
import {FormBuilder, FormGroup, Validators} from '@angular/forms'; import {FormBuilder, FormGroup, Validators} from '@angular/forms';
import {NzMessageService, NzModalService} from 'ng-zorro-antd'; import {NzMessageService, NzModalService} from 'ng-zorro-antd';
import {Router} from '@angular/router'; import {Router} from '@angular/router';
import {GasChannelConfigService} from '../../../services/gas-channel-config.service';
@Component({ @Component({
selector: 'app-oils-discount', selector: 'app-oils-discount',
@ -25,15 +26,21 @@ export class OilsDiscountComponent implements OnInit {
isVisible = false; isVisible = false;
roleTypeArray; roleTypeArray;
gasChannelConfigChannelArray = [];
configOilMerNumModal = false; configOilMerNumModal = false;
configOilMerNumForm: FormGroup; configOilMerNumForm: FormGroup;
channelId = '1';
tripartitePlatformModal = false;
tripartitePlatformForm: FormGroup;
constructor( constructor(
private form: FormBuilder, private form: FormBuilder,
private modal: NzModalService, private modal: NzModalService,
private company: CompanyService, private company: CompanyService,
private iconService: IconService, private iconService: IconService,
private message: NzMessageService, private message: NzMessageService,
private gasChannelConfigService: GasChannelConfigService,
private router: Router, private router: Router,
private common: CommonsService private common: CommonsService
) { ) {
@ -43,6 +50,10 @@ export class OilsDiscountComponent implements OnInit {
this.common.getDictionary('GAS_OIL_TYPE', data => { this.common.getDictionary('GAS_OIL_TYPE', data => {
this.roleTypeArray = data['return_data']; this.roleTypeArray = data['return_data'];
}); });
this.common.getDictionary('GAS_CHANNEL_CONFIG_CHANNEL', data => {
this.gasChannelConfigChannelArray = data['return_data'];
});
this.init(); this.init();
} }
@ -60,6 +71,15 @@ export class OilsDiscountComponent implements OnInit {
codeValue: [null, [Validators.required]], 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); 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);
}
});
}
} }

@ -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);
});
}
}
Loading…
Cancel
Save