提交代码

pull/1/head
胡锐 3 years ago
parent 110a0c905b
commit d1fb8ea504
  1. 16
      src/app/admin/merchant-store/store-edit/store-edit.component.html
  2. 19
      src/app/admin/merchant-store/store-edit/store-edit.component.ts
  3. 54
      src/app/admin/merchant/merchant-list/merchant-list.component.html
  4. 3
      src/app/admin/merchant/merchant-list/merchant-list.component.scss
  5. 65
      src/app/admin/merchant/merchant-list/merchant-list.component.ts
  6. 39
      src/app/services/merchant-tripartite-platform.service.ts

@ -46,22 +46,6 @@
</nz-form-control> </nz-form-control>
</nz-form-item> </nz-form-item>
</div> </div>
<div nz-col [nzSpan]="8" *ngIf="validateForm.value.prestoreType == 0">
<nz-form-item>
<nz-form-label nzRequired>分账商户号</nz-form-label>
<nz-form-control >
<input nz-input placeholder="请输入分账商户号" [formControlName]="'splitAccountNo'" />
</nz-form-control>
</nz-form-item>
</div>
<div nz-col [nzSpan]="8" *ngIf="validateForm.value.prestoreType == 0">
<nz-form-item>
<nz-form-label nzRequired>分账比例(%)</nz-form-label>
<nz-form-control>
<nz-input-number [formControlName]="'splitRate'" nzPlaceHolder="请输入分账比例" nzMin="0" [nzMax]="30" [nzPrecision]="2"></nz-input-number>
</nz-form-control>
</nz-form-item>
</div>
<div nz-col [nzSpan]="8"> <div nz-col [nzSpan]="8">
<nz-form-item> <nz-form-item>
<nz-form-label [nzFor]="'type'" nzRequired>门店类型</nz-form-label> <nz-form-label [nzFor]="'type'" nzRequired>门店类型</nz-form-label>

@ -61,9 +61,6 @@ export class StoreEditComponent implements OnInit {
address: [null, [Validators.required]], address: [null, [Validators.required]],
contactName: [null, [Validators.required]], contactName: [null, [Validators.required]],
prestoreType: [null, [Validators.required]], prestoreType: [null, [Validators.required]],
splitType: [1],
splitAccountNo: [null],
splitRate: [null],
telephone: [null, [Validators.required]], telephone: [null, [Validators.required]],
latitude: [29.553134, [Validators.required]], latitude: [29.553134, [Validators.required]],
longitude: [106.565428, [Validators.required]], longitude: [106.565428, [Validators.required]],
@ -117,18 +114,7 @@ export class StoreEditComponent implements OnInit {
this.message.error('必填项不能为空'); this.message.error('必填项不能为空');
return; return;
} }
this.validateForm.value.splitAccounts = { type: this.validateForm.value.splitType,
accountNo: this.validateForm.value.splitAccountNo,
rate: this.validateForm.value.splitRate };
} }
if (this.logoFile.length !== 0) {
if (this.logoFile[0]['response'] != null) {
this.validateForm.value.storeLogo = this.logoFile[0]['response']['return_data'][0];
} else {
this.validateForm.value.storeLogo = this.logoFile[0].name;
}
}
if (this.editFlag) { if (this.editFlag) {
this.validateForm.value.id = this.id; this.validateForm.value.id = this.id;
this.merchantStore.updateMerchantStore(this.validateForm.value, data => { this.merchantStore.updateMerchantStore(this.validateForm.value, data => {
@ -171,11 +157,6 @@ export class StoreEditComponent implements OnInit {
}); });
this.logoFile = logoArray; this.logoFile = logoArray;
} }
if (data['return_data']['splitAccounts'] != null) {
data['return_data']['splitType'] = data['return_data']['splitAccounts']['type'];
data['return_data']['splitAccountNo'] = data['return_data']['splitAccounts']['accountNo'];
data['return_data']['splitRate'] = data['return_data']['splitAccounts']['rate'];
}
this.validateForm.patchValue(data['return_data']); this.validateForm.patchValue(data['return_data']);
this.getMap(); this.getMap();
} else { } else {

@ -80,7 +80,7 @@
<th nzWidth="100px">商户电话</th> <th nzWidth="100px">商户电话</th>
<th nzWidth="100px">创建时间</th> <th nzWidth="100px">创建时间</th>
<th nzWidth="50px">状态</th> <th nzWidth="50px">状态</th>
<th nzWidth="100px" nzRight="0px">操作</th> <th nzWidth="120px" nzRight="0px">操作</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -105,6 +105,8 @@
<a *ngIf="data.status !== 1" (click)='enableMerchant(data.id)'><i nz-icon nzType="check-circle" nzTheme="outline" nz-tooltip="启用"></i></a> <a *ngIf="data.status !== 1" (click)='enableMerchant(data.id)'><i nz-icon nzType="check-circle" nzTheme="outline" nz-tooltip="启用"></i></a>
<nz-divider nzType="vertical"></nz-divider> <nz-divider nzType="vertical"></nz-divider>
<a (click)='showRechargeModal(data.id)'><i nz-icon nzType="dollar" nzTheme="outline" nz-tooltip="余额充值"></i></a> <a (click)='showRechargeModal(data.id)'><i nz-icon nzType="dollar" nzTheme="outline" nz-tooltip="余额充值"></i></a>
<nz-divider nzType="vertical"></nz-divider>
<a (click)='showTripartitePlatformModal(data.id)'><i nz-icon nzType="shop" nzTheme="outline" nz-tooltip="商户平台配置"></i></a>
</td> </td>
</tbody> </tbody>
</nz-table> </nz-table>
@ -115,7 +117,7 @@
<nz-form-item> <nz-form-item>
<nz-form-label [nzSpan]="6" nzRequired >充值金额</nz-form-label> <nz-form-label [nzSpan]="6" nzRequired >充值金额</nz-form-label>
<nz-form-control [nzSpan]="14"> <nz-form-control [nzSpan]="14">
<nz-input-number style="width: 100%" formControlName="amount" [nzMin]="0.01" [nzMax]="1000" [nzStep]="1" [nzPrecision]="2"></nz-input-number> <nz-input-number style="width: 100%" formControlName="amount" [nzMin]="0.01" [nzMax]="9999999" [nzStep]="1" [nzPrecision]="2"></nz-input-number>
</nz-form-control> </nz-form-control>
</nz-form-item> </nz-form-item>
<div style="text-align: center;"> <div style="text-align: center;">
@ -124,6 +126,54 @@
</form> </form>
</nz-modal> </nz-modal>
<nz-modal [(nzVisible)]="tripartitePlatformModal" nzTitle="商户配置" (nzOnCancel)="closeTripartitePlatformModal()" nzWidth="500px" [nzFooter]="null">
<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="platformType">
<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="platformMerName" />
</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="platformMerNumber" />
</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"></nz-input-number>
</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>

@ -2,3 +2,6 @@
height: 60px; height: 60px;
width: 60px; width: 60px;
} }
nz-input-number {
width: 100%;
}

@ -6,7 +6,8 @@ import {CommonsService} from '../../../services/commons.service';
import {MerchantService} from '../../../services/merchant.service'; import {MerchantService} from '../../../services/merchant.service';
import {Router} from '@angular/router'; import {Router} from '@angular/router';
import {environment} from '../../../../environments/environment'; import {environment} from '../../../../environments/environment';
import {MerAmountService} from "../../../services/mer-amount.service"; import {MerAmountService} from '../../../services/mer-amount.service';
import {MerchantTripartitePlatformService} from '../../../services/merchant-tripartite-platform.service';
@Component({ @Component({
selector: 'app-merchant-list', selector: 'app-merchant-list',
@ -25,12 +26,16 @@ export class MerchantListComponent implements OnInit {
rechargeModal = false; rechargeModal = false;
rechargeForm: FormGroup; // 充值模态框 rechargeForm: FormGroup; // 充值模态框
tripartitePlatformModal = false;
tripartitePlatformForm: FormGroup; // 充值模态框
constructor( constructor(
private form: FormBuilder, private form: FormBuilder,
private merchant: MerchantService, private merchant: MerchantService,
private iconService: IconService, private iconService: IconService,
private message: NzMessageService, private message: NzMessageService,
private merAmountService: MerAmountService, private merAmountService: MerAmountService,
private tripartitePlatformService: MerchantTripartitePlatformService,
private router: Router, private router: Router,
private common: CommonsService, private common: CommonsService,
private modal: NzModalService, private modal: NzModalService,
@ -53,6 +58,15 @@ export class MerchantListComponent implements OnInit {
merId: [null], merId: [null],
amount: [null, [Validators.required]], amount: [null, [Validators.required]],
}); });
this.tripartitePlatformForm = this.form.group({
merId: [null],
platformType: ['1', [Validators.required]],
platformMerName: [null, [Validators.required]],
platformMerNumber: [null, [Validators.required]],
profitSharingStatus: ['false', [Validators.required]],
profitSharingRatio: [null],
});
this.getRequest(true, this.searchForm.value); this.getRequest(true, this.searchForm.value);
} }
@ -145,7 +159,7 @@ export class MerchantListComponent implements OnInit {
showRechargeModal(merId: number) { showRechargeModal(merId: number) {
this.rechargeForm.patchValue({ merId: merId}); this.rechargeForm.patchValue({ merId});
this.rechargeModal = true; this.rechargeModal = true;
} }
@ -182,5 +196,52 @@ export class MerchantListComponent implements OnInit {
}); });
} }
showTripartitePlatformModal(merId: number) {
this.tripartitePlatformService.getDetail(merId, 1, data => {
if (data['return_data'] != null) {
data['return_data']['platformType'] = String(data['return_data']['platformType']);
data['return_data']['profitSharingStatus'] = String(data['return_data']['profitSharingStatus']);
this.tripartitePlatformForm.patchValue(data['return_data']);
} else {
this.tripartitePlatformForm.patchValue( { merId: merId, platformType: '1', profitSharingStatus: 'false' });
}
});
this.tripartitePlatformModal = true;
}
closeTripartitePlatformModal() {
this.tripartitePlatformForm.reset();
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;
}
this.tripartitePlatformService.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'],
});
}
});
}
} }

@ -0,0 +1,39 @@
import { Injectable } from '@angular/core';
import {HttpClient} from '_@angular_common@9.0.7@@angular/common/http';
import {CommonsService} from './commons.service';
import {environment} from '../../environments/environment';
@Injectable({
providedIn: 'root'
})
export class MerchantTripartitePlatformService {
constructor(
private http: HttpClient,
private common: CommonsService
) { }
/**
*
*
* @param paramsObject
* @param callBack
*/
public editTripartitePlatform(paramsObject: object, callBack) {
this.http.post(environment.baseUrl + 'merchantTripartitePlatform/editTripartitePlatform', paramsObject).subscribe(data => {
callBack(data);
});
}
/**
*
*
* @param paramsObject
* @param callBack
*/
public getDetail(merId: number, platformType: number, callBack) {
this.http.get(environment.baseUrl + 'merchantTripartitePlatform/getDetail?merId=' + merId + '&platformType=' + platformType).subscribe(data => {
callBack(data);
});
}
}
Loading…
Cancel
Save