|
|
@ -1,11 +1,12 @@ |
|
|
|
import { Component, OnInit } from '@angular/core'; |
|
|
|
import { Component, OnInit } from '@angular/core'; |
|
|
|
import {FormBuilder, FormGroup} from '@angular/forms'; |
|
|
|
import {FormBuilder, FormGroup, Validators} from '@angular/forms'; |
|
|
|
import {IconService} from '../../../services/icon.service'; |
|
|
|
import {IconService} from '../../../services/icon.service'; |
|
|
|
import {NzMessageService} from 'ng-zorro-antd'; |
|
|
|
import {NzMessageService, NzModalService} from 'ng-zorro-antd'; |
|
|
|
import {CommonsService} from '../../../services/commons.service'; |
|
|
|
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"; |
|
|
|
|
|
|
|
|
|
|
|
@Component({ |
|
|
|
@Component({ |
|
|
|
selector: 'app-merchant-list', |
|
|
|
selector: 'app-merchant-list', |
|
|
@ -21,13 +22,18 @@ export class MerchantListComponent implements OnInit { |
|
|
|
pageSize = 10; // 条码
|
|
|
|
pageSize = 10; // 条码
|
|
|
|
loading = true; |
|
|
|
loading = true; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
rechargeModal = false; |
|
|
|
|
|
|
|
rechargeForm: 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 router: Router, |
|
|
|
private router: Router, |
|
|
|
private common: CommonsService |
|
|
|
private common: CommonsService, |
|
|
|
|
|
|
|
private modal: NzModalService, |
|
|
|
) { |
|
|
|
) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -42,6 +48,11 @@ export class MerchantListComponent implements OnInit { |
|
|
|
telephone: [null], |
|
|
|
telephone: [null], |
|
|
|
status: [null], |
|
|
|
status: [null], |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.rechargeForm = this.form.group({ |
|
|
|
|
|
|
|
merId: [null], |
|
|
|
|
|
|
|
amount: [null, [Validators.required]], |
|
|
|
|
|
|
|
}); |
|
|
|
this.getRequest(true, this.searchForm.value); |
|
|
|
this.getRequest(true, this.searchForm.value); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -131,5 +142,45 @@ export class MerchantListComponent implements OnInit { |
|
|
|
} |
|
|
|
} |
|
|
|
}).then(r => console.log(r)); |
|
|
|
}).then(r => console.log(r)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
showRechargeModal(merId: number) { |
|
|
|
|
|
|
|
this.rechargeForm.patchValue({ merId: merId}); |
|
|
|
|
|
|
|
this.rechargeModal = true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
closeRechargeModal() { |
|
|
|
|
|
|
|
this.rechargeModal = false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
submitRecharge() { |
|
|
|
|
|
|
|
for (const i in this.rechargeForm.controls) { |
|
|
|
|
|
|
|
this.rechargeForm.controls[i].markAsDirty(); |
|
|
|
|
|
|
|
this.rechargeForm.controls[i].updateValueAndValidity(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (this.rechargeForm.status == null || this.rechargeForm.status !== 'VALID') { |
|
|
|
|
|
|
|
this.modal.warning({ |
|
|
|
|
|
|
|
nzTitle: '提示', |
|
|
|
|
|
|
|
nzContent: '请填写所有必填项', |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.merAmountService.recharge(this.rechargeForm.value, data => { |
|
|
|
|
|
|
|
if (data['return_code'] === '000000') { |
|
|
|
|
|
|
|
this.modal.success({ |
|
|
|
|
|
|
|
nzTitle: '提示', |
|
|
|
|
|
|
|
nzContent: '充值成功', |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
this.closeRechargeModal(); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
this.modal.error({ |
|
|
|
|
|
|
|
nzTitle: '提示', |
|
|
|
|
|
|
|
nzContent: data['return_msg'], |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|