|
|
|
@ -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'], |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|