diff --git a/src/app/admin/mer/mer-list/mer-list.component.html b/src/app/admin/mer/mer-list/mer-list.component.html index a8424f5..95337a1 100644 --- a/src/app/admin/mer/mer-list/mer-list.component.html +++ b/src/app/admin/mer/mer-list/mer-list.component.html @@ -69,6 +69,17 @@ + +
+ + 业务员 + + + + + + +
@@ -83,7 +94,7 @@
共计 {{dataObject.total?dataObject.total:0}} 条数据
- +
@@ -97,6 +108,7 @@ [nzScroll]="{ x: '1150px'}"> + 序号 商户类型 商户号 @@ -108,11 +120,18 @@ 状态 资料填写情况 创建时间 + 业务员 操作 + {{i + 1}} {{data.merType | merType}} {{data.merNo}} @@ -124,6 +143,7 @@ {{data.merStatus | merStatus}} {{data.completeStatus | completeStatus}} {{data.createTime | date : 'yyyy-MM-dd HH:mm:ss'}} + {{data.salesmanName}} 商户操作 @@ -214,3 +234,20 @@ + + + +
+ + 业务员 + + + + + + +
+ +
+
+
diff --git a/src/app/admin/mer/mer-list/mer-list.component.ts b/src/app/admin/mer/mer-list/mer-list.component.ts index 9f2cfd2..dd8d99b 100644 --- a/src/app/admin/mer/mer-list/mer-list.component.ts +++ b/src/app/admin/mer/mer-list/mer-list.component.ts @@ -6,6 +6,7 @@ import {environment} from '../../../../environments/environment'; import {NzMessageService, NzModalService, NzUploadFile} from "ng-zorro-antd"; import {LocalStorageService} from "../../../services/local-storage.service"; import {ADMIN_INFO_OBJECT} from "../../../services/local-storage.namespace"; +import {SalesmanService} from '../../../services/salesman.service'; @Component({ selector: 'app-mer-list', @@ -27,10 +28,19 @@ export class MerListComponent implements OnInit { ccbConfigForm: FormGroup; ccbFileArray: NzUploadFile[] = []; + salesmanArray = []; + + allChecked = false; + checkedData = []; + + merMigrateSalesmanModal = false; + merMigrateSalesmanForm: FormGroup; + constructor(private modal: NzModalService, private message: NzMessageService, private merService: MerService, private merPlatformService: MerPlatformService, + private salesmanService: SalesmanService, private store: LocalStorageService, private form: FormBuilder) { this.roleType = this.store.get(ADMIN_INFO_OBJECT)['secRole'].roleType; @@ -44,9 +54,14 @@ export class MerListComponent implements OnInit { merStatus: [null], regPhone: [null], regName: [null], + salesmanId: [null], }); this.requestData(1); + this.salesmanService.querySalesmanList({ pageNum: 1, pageSize: 999}, data => { + this.salesmanArray = data['return_data']['list']; + }); + this.ccbConfigForm = this.form.group({ merId: [null], platformType: [null], @@ -59,6 +74,10 @@ export class MerListComponent implements OnInit { refundCertUrl: [null], refundCertPwd: [null, [Validators.required]], }); + + this.merMigrateSalesmanForm = this.form.group({ + salesmanId: [null, [Validators.required]], + }); } /** @@ -220,6 +239,91 @@ export class MerListComponent implements OnInit { break; } } + + + + /** + * 选中 + * @param data + * @param checked + */ + checkedChange(data: object, checked: boolean) { + if (checked === true) { + if (this.checkedData.find(o => Number(o['id']) === Number(data['id'])) == null) { + data['checked'] = true; + this.checkedData.push(data); + } + } else { + data['checked'] = true; + const findIndex = this.checkedData.findIndex(o => Number(o['id']) === Number(data['id'])); + this.checkedData.splice(findIndex, 1); + } + } + + /** + * 全选 + * @param data + */ + onAllChecked(checked: boolean) { + if (checked === true) { + const filterArray = this.dataObject['list'].filter(({ disabled }) => !disabled); + for (const data of filterArray) { + if (this.checkedData.find(o => Number(o['id']) === Number(data['id'])) == null) { + data['checked'] = true; + this.checkedData.push(data); + } + } + } else { + const filterArray = this.dataObject['list'].filter(({ disabled }) => !disabled); + for (const data of filterArray) { + data['checked'] = false; + const findIndex = this.checkedData.findIndex(o => Number(o['id']) === Number(data['id'])); + this.checkedData.splice(findIndex, 1); + } + } + } + + submitMigrateSalesman() { + for (const i in this.merMigrateSalesmanForm.controls) { + this.merMigrateSalesmanForm.controls[i].markAsDirty(); + this.merMigrateSalesmanForm.controls[i].updateValueAndValidity(); + } + if (this.merMigrateSalesmanForm.status == null || this.merMigrateSalesmanForm.status !== 'VALID') { + this.modal.warning({ + nzTitle: '提示', + nzContent: '请选择业务员', + }); + return; + } + if (this.checkedData.length === 0) { + this.modal.warning({ + nzTitle: '提示', + nzContent: '请选择需要转移的商户', + }); + return; + } + const merList = []; + for (const mer of this.checkedData) { + merList.push(mer['id']); + } + this.merMigrateSalesmanForm.value['merList'] = merList; + this.merService.merMigrateSalesman(this.merMigrateSalesmanForm.value, data => { + if (data['return_code'] === '000000') { + this.modal.success({ + nzTitle: '提示', + nzContent: '操作成功', + }); + this.checkedData = []; + this.requestData(this.whereObject['pageNum']); + this.merMigrateSalesmanModal = false; + } else { + this.modal.error({ + nzTitle: '提示', + nzContent: data['return_msg'], + }); + } + }); + } } diff --git a/src/app/admin/trade-checking/trade-checking-detail/trade-checking-detail.component.ts b/src/app/admin/trade-checking/trade-checking-detail/trade-checking-detail.component.ts index b507c62..6665d1b 100644 --- a/src/app/admin/trade-checking/trade-checking-detail/trade-checking-detail.component.ts +++ b/src/app/admin/trade-checking/trade-checking-detail/trade-checking-detail.component.ts @@ -108,11 +108,15 @@ export class TradeCheckingDetailComponent implements OnInit { searchSettleTime(dateType: number, selectDate: Date) { - if (new Date().getDate() === selectDate.getDate()) { + const currentDate = new Date(); + if (currentDate.getFullYear() === selectDate.getFullYear() + && currentDate.getMonth() === selectDate.getMonth() + && currentDate.getDate() === selectDate.getDate()) { this.modal.error({ nzTitle: '提示', nzContent: '无法选择当日,当日还未清算' }); + return; // 起始时间 if (dateType === 1) { this.searchForm.controls['settleTimeS'].setValue(this.currentDate.getTime()); diff --git a/src/app/admin/trade-checking/trade-checking/trade-checking.component.ts b/src/app/admin/trade-checking/trade-checking/trade-checking.component.ts index 782041d..35b3fe7 100644 --- a/src/app/admin/trade-checking/trade-checking/trade-checking.component.ts +++ b/src/app/admin/trade-checking/trade-checking/trade-checking.component.ts @@ -93,11 +93,15 @@ export class TradeCheckingComponent implements OnInit { searchSettleTime(dateType: number, selectDate: Date) { - if (new Date().getDate() === selectDate.getDate()) { + const currentDate = new Date(); + if (currentDate.getFullYear() === selectDate.getFullYear() + && currentDate.getMonth() === selectDate.getMonth() + && currentDate.getDate() === selectDate.getDate()) { this.modal.error({ nzTitle: '提示', nzContent: '无法选择当日,当日还未清算' }); + return; // 起始时间 if (dateType === 1) { this.searchForm.controls['settleTimeS'].setValue(this.currentDate.getTime()); diff --git a/src/app/services/mer.service.ts b/src/app/services/mer.service.ts index c004348..4799a7b 100644 --- a/src/app/services/mer.service.ts +++ b/src/app/services/mer.service.ts @@ -35,5 +35,11 @@ export class MerService { }); } + merMigrateSalesman(paramObject: object, callBack) { + this.http.post(environment.baseUrl + 'mer/merMigrateSalesman', paramObject).subscribe(data => { + callBack(data); + }); + } + }