From d1fb8ea5046ce10d00ac5e89b1cff8f76ffd1255 Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Wed, 1 Jun 2022 15:25:12 +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 --- .../store-edit/store-edit.component.html | 16 ----- .../store-edit/store-edit.component.ts | 19 ------ .../merchant-list.component.html | 54 ++++++++++++++- .../merchant-list.component.scss | 3 + .../merchant-list/merchant-list.component.ts | 65 ++++++++++++++++++- .../merchant-tripartite-platform.service.ts | 39 +++++++++++ 6 files changed, 157 insertions(+), 39 deletions(-) create mode 100644 src/app/services/merchant-tripartite-platform.service.ts diff --git a/src/app/admin/merchant-store/store-edit/store-edit.component.html b/src/app/admin/merchant-store/store-edit/store-edit.component.html index fcbdfde..5777f41 100644 --- a/src/app/admin/merchant-store/store-edit/store-edit.component.html +++ b/src/app/admin/merchant-store/store-edit/store-edit.component.html @@ -46,22 +46,6 @@ -
- - 分账商户号 - - - - -
-
- - 分账比例(%) - - - - -
门店类型 diff --git a/src/app/admin/merchant-store/store-edit/store-edit.component.ts b/src/app/admin/merchant-store/store-edit/store-edit.component.ts index 2797ce7..b1404f2 100644 --- a/src/app/admin/merchant-store/store-edit/store-edit.component.ts +++ b/src/app/admin/merchant-store/store-edit/store-edit.component.ts @@ -61,9 +61,6 @@ export class StoreEditComponent implements OnInit { address: [null, [Validators.required]], contactName: [null, [Validators.required]], prestoreType: [null, [Validators.required]], - splitType: [1], - splitAccountNo: [null], - splitRate: [null], telephone: [null, [Validators.required]], latitude: [29.553134, [Validators.required]], longitude: [106.565428, [Validators.required]], @@ -117,18 +114,7 @@ export class StoreEditComponent implements OnInit { this.message.error('必填项不能为空'); 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) { this.validateForm.value.id = this.id; this.merchantStore.updateMerchantStore(this.validateForm.value, data => { @@ -171,11 +157,6 @@ export class StoreEditComponent implements OnInit { }); 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.getMap(); } else { diff --git a/src/app/admin/merchant/merchant-list/merchant-list.component.html b/src/app/admin/merchant/merchant-list/merchant-list.component.html index 706d723..a49b999 100644 --- a/src/app/admin/merchant/merchant-list/merchant-list.component.html +++ b/src/app/admin/merchant/merchant-list/merchant-list.component.html @@ -80,7 +80,7 @@ 商户电话 创建时间 状态 - 操作 + 操作 @@ -105,6 +105,8 @@ + + @@ -115,7 +117,7 @@ 充值金额 - +
@@ -124,6 +126,54 @@ + +
+ + 第三方平台 + + + + + + + + + 商户名称 + + + + + + + 商户号 + + + + + + + 是否分账 + + + + + + + + + + 是否分账(%) + + + + + +
+ +
+
+
+ diff --git a/src/app/admin/merchant/merchant-list/merchant-list.component.scss b/src/app/admin/merchant/merchant-list/merchant-list.component.scss index 8bee3fb..0325db1 100644 --- a/src/app/admin/merchant/merchant-list/merchant-list.component.scss +++ b/src/app/admin/merchant/merchant-list/merchant-list.component.scss @@ -2,3 +2,6 @@ height: 60px; width: 60px; } +nz-input-number { + width: 100%; +} diff --git a/src/app/admin/merchant/merchant-list/merchant-list.component.ts b/src/app/admin/merchant/merchant-list/merchant-list.component.ts index 3737264..e7f8f2b 100644 --- a/src/app/admin/merchant/merchant-list/merchant-list.component.ts +++ b/src/app/admin/merchant/merchant-list/merchant-list.component.ts @@ -6,7 +6,8 @@ import {CommonsService} from '../../../services/commons.service'; import {MerchantService} from '../../../services/merchant.service'; import {Router} from '@angular/router'; 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({ selector: 'app-merchant-list', @@ -25,12 +26,16 @@ export class MerchantListComponent implements OnInit { rechargeModal = false; rechargeForm: FormGroup; // 充值模态框 + tripartitePlatformModal = false; + tripartitePlatformForm: FormGroup; // 充值模态框 + constructor( private form: FormBuilder, private merchant: MerchantService, private iconService: IconService, private message: NzMessageService, private merAmountService: MerAmountService, + private tripartitePlatformService: MerchantTripartitePlatformService, private router: Router, private common: CommonsService, private modal: NzModalService, @@ -53,6 +58,15 @@ export class MerchantListComponent implements OnInit { merId: [null], 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); } @@ -145,7 +159,7 @@ export class MerchantListComponent implements OnInit { showRechargeModal(merId: number) { - this.rechargeForm.patchValue({ merId: merId}); + this.rechargeForm.patchValue({ merId}); 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'], + }); + } + }); + } + } diff --git a/src/app/services/merchant-tripartite-platform.service.ts b/src/app/services/merchant-tripartite-platform.service.ts new file mode 100644 index 0000000..58cf088 --- /dev/null +++ b/src/app/services/merchant-tripartite-platform.service.ts @@ -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); + }); + } +}