|
|
@@ -1,7 +1,7 @@
|
|
|
<template>
|
|
|
<!-- 平安客户资料 -->
|
|
|
<a-modal class="add-custom"
|
|
|
- title="新增客户资料"
|
|
|
+ :title="isAdd() ? '新增客户资料' : '修改客户资料'"
|
|
|
v-model:visible="visible"
|
|
|
@cancel="cancel"
|
|
|
centered
|
|
|
@@ -79,7 +79,7 @@
|
|
|
<!-- 其他项目客户资料 -->
|
|
|
<a-modal class="add-custom"
|
|
|
v-else
|
|
|
- title="新增客户资料"
|
|
|
+ :title="isAdd() ? '新增客户资料' : '修改客户资料'"
|
|
|
v-model:visible="visible"
|
|
|
@cancel="cancel"
|
|
|
centered
|
|
|
@@ -103,7 +103,7 @@
|
|
|
:rules="rules">
|
|
|
<a-row :gutter="24">
|
|
|
<template v-if="isQianHaiJin()">
|
|
|
- <a-col :span="24">
|
|
|
+ <a-col :span="12">
|
|
|
<a-form-item label="所属机构"
|
|
|
name="areaid">
|
|
|
<a-select class="typeSelect"
|
|
|
@@ -118,6 +118,21 @@
|
|
|
</a-form-item>
|
|
|
</a-col>
|
|
|
<a-col :span="12">
|
|
|
+ <a-form-item label="所属客户经理"
|
|
|
+ name="teammanageruserid">
|
|
|
+ <a-select class="typeSelect"
|
|
|
+ style="width: 200px"
|
|
|
+ v-model:value="formState.teammanageruserid"
|
|
|
+ placeholder="请选择所属客户经理">
|
|
|
+ <a-select-option v-for="item in brokerList"
|
|
|
+ :key="item.userid">
|
|
|
+ {{ item.customername }}
|
|
|
+ </a-select-option>
|
|
|
+ </a-select>
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :span="12"
|
|
|
+ v-if="!isAdd()">
|
|
|
<a-form-item label="登录账号"
|
|
|
name="logincode">
|
|
|
<a-input class="dialogInput"
|
|
|
@@ -126,7 +141,8 @@
|
|
|
placeholder="请选择登录账号" />
|
|
|
</a-form-item>
|
|
|
</a-col>
|
|
|
- <a-col :span="12">
|
|
|
+ <a-col :span="12"
|
|
|
+ v-if="!isAdd()">
|
|
|
<a-form-item label="登录密码"
|
|
|
name="loginpwd">
|
|
|
<a-input class="dialogInput"
|
|
|
@@ -137,7 +153,6 @@
|
|
|
</a-col>
|
|
|
</template>
|
|
|
<a-col :span="12">
|
|
|
-
|
|
|
<a-form-item label="客户类型"
|
|
|
name="userinfotype">
|
|
|
<a-select class="typeSelect"
|
|
|
@@ -213,6 +228,7 @@
|
|
|
<a-col :span="12">
|
|
|
<a-form-item label="营业执照">
|
|
|
<UploadImg :visible="visible"
|
|
|
+ :imgList="attachmentImgList"
|
|
|
@upload="attachmentUpLoad" />
|
|
|
</a-form-item>
|
|
|
</a-col>
|
|
|
@@ -243,6 +259,7 @@
|
|
|
placeholder="请输入联系电话" />
|
|
|
</a-form-item>
|
|
|
</a-col>
|
|
|
+
|
|
|
</template>
|
|
|
<template v-else>
|
|
|
<a-col :span="12">
|
|
|
@@ -276,6 +293,7 @@
|
|
|
<a-form-item label="身份证正面照"
|
|
|
name="cardbackphotourl">
|
|
|
<UploadImg :visible="visible"
|
|
|
+ :imgList="cardfrontImgList"
|
|
|
@upload="cardfrontphotourlUpLoad" />
|
|
|
</a-form-item>
|
|
|
</a-col>
|
|
|
@@ -288,10 +306,11 @@
|
|
|
placeholder="请输入邮箱" />
|
|
|
</a-form-item>
|
|
|
</a-col>
|
|
|
- <a-col :span="24">
|
|
|
+ <a-col :span="12">
|
|
|
<a-form-item label="身份证反面照"
|
|
|
name="cardfrontphotourl">
|
|
|
<UploadImg :visible="visible"
|
|
|
+ :imgList="cardbackImgList"
|
|
|
@upload="cardbackphotourlUpLoad" />
|
|
|
</a-form-item>
|
|
|
</a-col>
|
|
|
@@ -304,6 +323,42 @@
|
|
|
placeholder="请输入联系电话" />
|
|
|
</a-form-item>
|
|
|
</a-col>
|
|
|
+ <a-col :span="12"
|
|
|
+ v-if="isQianHaiJin()">
|
|
|
+ <a-form-item label="性别"
|
|
|
+ name="sex">
|
|
|
+ <a-select class="inlineFormSelect"
|
|
|
+ v-model:value="formState.sex"
|
|
|
+ style="width: 200px"
|
|
|
+ placeholder="请选择性别">
|
|
|
+ <a-select-option :value="item.id"
|
|
|
+ v-for="item in sexList"
|
|
|
+ :key="item.id">
|
|
|
+ {{ item.value }}
|
|
|
+ </a-select-option>
|
|
|
+ </a-select>
|
|
|
+ <!-- <a-input class="dialogInput"
|
|
|
+ style="width: 200px"
|
|
|
+ v-model:value="formState.sex"
|
|
|
+ placeholder="请选择性别" /> -->
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :span="12"
|
|
|
+ v-if="isQianHaiJin()">
|
|
|
+
|
|
|
+ <a-form-item label="生日"
|
|
|
+ name="birthday">
|
|
|
+ <a-date-picker v-model:value="formState.birthday"
|
|
|
+ :allowClear="false"
|
|
|
+ style="width: 200px"
|
|
|
+ placeholder="请选择生日"
|
|
|
+ class="commonDatePicker" />
|
|
|
+ <!-- <a-input class="dialogInput"
|
|
|
+ style="width: 200px"
|
|
|
+ v-model:value="formState.birthday"
|
|
|
+ placeholder="请选择性别" /> -->
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
<a-col :span="12">
|
|
|
<a-form-item> </a-form-item>
|
|
|
</a-col>
|
|
|
@@ -377,17 +432,26 @@ import { getUploadImg } from '@/common/setup/upload';
|
|
|
import { getUserId } from '@/services/bus/user';
|
|
|
import { getAddress } from '@/services/go/adress';
|
|
|
import { AllEnums } from '@/services/go/commonService/interface';
|
|
|
+import { QhjCustomer } from '@/services/go/ermcp/qhj/interface';
|
|
|
import { addCustomerInfoOperate } from '@/services/proto/accountinfo';
|
|
|
import { CustomerInfoOperateReq } from '@/services/proto/accountinfo/interface';
|
|
|
+import { mergeTwoObj } from '@/utils/objHandle';
|
|
|
import { toBase64String } from '@/utils/storage/base64';
|
|
|
-import { defineComponent, ref } from 'vue';
|
|
|
+import { defineComponent, PropType, ref } from 'vue';
|
|
|
import { FormState } from './interface';
|
|
|
-import { getCardType, handleForm, handleAreaList } from './setup';
|
|
|
+import { getCardType, handleAreaList, handleBrokerApplyt, handleForm } from './setup';
|
|
|
+import moment, { Moment } from 'moment';
|
|
|
|
|
|
export default defineComponent({
|
|
|
name: 'add-custom',
|
|
|
emits: ['cancel', 'update'],
|
|
|
components: { UploadImg },
|
|
|
+ props: {
|
|
|
+ selectedRow: {
|
|
|
+ default: {},
|
|
|
+ type: Object as PropType<QhjCustomer>,
|
|
|
+ },
|
|
|
+ },
|
|
|
setup(props, context) {
|
|
|
// 控制关闭弹窗
|
|
|
const { visible, cancel } = _closeModal(context);
|
|
|
@@ -399,24 +463,67 @@ export default defineComponent({
|
|
|
// 地址
|
|
|
const { cityList, districtList, provinceList, getCityList, getDistrictList } = getAddress();
|
|
|
// 营业执照
|
|
|
- const { getFirstImg: getAttachmentImg, uploadImgAction: attachmentUpLoad } = getUploadImg();
|
|
|
+ const { getFirstImg: getAttachmentImg, uploadImgAction: attachmentUpLoad, uploadImgList: attachmentImgList, handleImg: attachmentHandle } = getUploadImg();
|
|
|
// 背面证件照地址
|
|
|
- const { getFirstImg: getBackImg, uploadImgAction: cardbackphotourlUpLoad } = getUploadImg();
|
|
|
+ const { getFirstImg: getBackImg, uploadImgAction: cardbackphotourlUpLoad, uploadImgList: cardbackImgList, handleImg: cardbackHandle } = getUploadImg();
|
|
|
// 正面证件照地址
|
|
|
- const { getFirstImg: getFrontImg, uploadImgAction: cardfrontphotourlUpLoad } = getUploadImg();
|
|
|
+ const { getFirstImg: getFrontImg, uploadImgAction: cardfrontphotourlUpLoad, uploadImgList: cardfrontImgList, handleImg: cardfrontHandle } = getUploadImg();
|
|
|
//查询所属机构列表
|
|
|
const { areaList, getAreaList } = handleAreaList();
|
|
|
+ // 查询客户经理
|
|
|
+ const { brokerList, getBrokerApply } = handleBrokerApplyt();
|
|
|
if (isQianHaiJin()) {
|
|
|
- getAreaList(loading);
|
|
|
+ Promise.all([getAreaList(loading), getBrokerApply(loading)]);
|
|
|
}
|
|
|
+
|
|
|
+ // 性别
|
|
|
+ const sexList = [
|
|
|
+ { id: 0, value: '女' },
|
|
|
+ { id: 1, value: '男' },
|
|
|
+ ];
|
|
|
function isPersonal(): boolean {
|
|
|
return formState.userinfotype === '1';
|
|
|
}
|
|
|
+ const isAdd = () => !props.selectedRow.userinfotype;
|
|
|
+ const isN = (value: string) => value === '--';
|
|
|
+ // 修改 客户资料的逻辑
|
|
|
+ if (!isAdd()) {
|
|
|
+ console.log('修改::::::::::::::::::::::::::');
|
|
|
+
|
|
|
+ mergeTwoObj(formState, props.selectedRow);
|
|
|
+ formState.userinfotype = formState.userinfotype.toString();
|
|
|
+ if (isPersonal()) {
|
|
|
+ formState.username = props.selectedRow.customername;
|
|
|
+ } else {
|
|
|
+ formState.username = props.selectedRow.username;
|
|
|
+ }
|
|
|
+ const { provinceid, cityid, address, mobile, memberuserid, brokerid, cardfrontphotourl, cardbackphotourl } = props.selectedRow;
|
|
|
+ formState.cardaddress = isN(address) ? '' : address;
|
|
|
+ formState.mobilephone = mobile;
|
|
|
+ formState.areaid = memberuserid;
|
|
|
+ formState.teammanageruserid = brokerid;
|
|
|
+ provinceid ? getCityList(provinceid) : (formState.provinceid = undefined);
|
|
|
+ cityid ? getDistrictList(cityid) : ((formState.cityid = undefined), (formState.districtid = undefined));
|
|
|
+
|
|
|
+ if (cardfrontphotourl && !isN(cardfrontphotourl)) {
|
|
|
+ // 营业执照
|
|
|
+ attachmentImgList.value = attachmentHandle(cardfrontphotourl);
|
|
|
+ }
|
|
|
+ if (cardbackphotourl && !isN(cardbackphotourl)) {
|
|
|
+ // 背面证件照地址
|
|
|
+ cardbackImgList.value = cardbackHandle(cardbackphotourl);
|
|
|
+ }
|
|
|
+ if (cardbackphotourl && !isN(cardbackphotourl)) {
|
|
|
+ // 正面证件照地址
|
|
|
+ cardfrontImgList.value = cardfrontHandle(cardbackphotourl);
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
function submit(OperateType: 1 | 2) {
|
|
|
validateAction<FormState>(formRef, formState).then((param) => {
|
|
|
+ console.log(props.selectedRow);
|
|
|
const reqParam: CustomerInfoOperateReq = {
|
|
|
- operatetype: 1, // 1: 新增
|
|
|
+ operatetype: isAdd() ? 1 : 2, // 1: 新增 2:修改
|
|
|
userid: getUserId(), // 必填
|
|
|
areaid: getUserId(),
|
|
|
userinfotype: Number(param.userinfotype),
|
|
|
@@ -443,11 +550,20 @@ export default defineComponent({
|
|
|
proxystatementurl: '',
|
|
|
};
|
|
|
if (isQianHaiJin()) {
|
|
|
+ // 千海金
|
|
|
reqParam.areaid = param.areaid as number;
|
|
|
reqParam.logincode = param.logincode;
|
|
|
+ reqParam.teammanageruserid = param.teammanageruserid ? param.teammanageruserid : 0;
|
|
|
+ if (isPersonal()) {
|
|
|
+ reqParam.sex = param.sex;
|
|
|
+ if (param.birthday) {
|
|
|
+ reqParam.birthday = moment(param.birthday).format('YYYY-MM-DD');
|
|
|
+ }
|
|
|
+ }
|
|
|
reqParam.loginpwd = toBase64String(toBase64String(param.loginpwd));
|
|
|
reqParam.userstate = 2;
|
|
|
}
|
|
|
+ debugger;
|
|
|
requestResultLoadingAndInfo(addCustomerInfoOperate, reqParam, loading, OperateType === 1 ? ['保存草稿成功', '保存草稿失败:'] : ['新增客户资料成功', '新增客户资料失败:']).then(() => {
|
|
|
cancel(true);
|
|
|
});
|
|
|
@@ -467,6 +583,11 @@ export default defineComponent({
|
|
|
districtList,
|
|
|
provinceList,
|
|
|
areaList,
|
|
|
+ brokerList,
|
|
|
+ attachmentImgList,
|
|
|
+ cardbackImgList,
|
|
|
+ cardfrontImgList,
|
|
|
+ sexList,
|
|
|
getCityList,
|
|
|
getDistrictList,
|
|
|
attachmentUpLoad,
|
|
|
@@ -474,6 +595,7 @@ export default defineComponent({
|
|
|
cardfrontphotourlUpLoad,
|
|
|
isPingAnOem,
|
|
|
isQianHaiJin,
|
|
|
+ isAdd,
|
|
|
};
|
|
|
},
|
|
|
});
|