index.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485
  1. <template>
  2. <!-- 平安客户资料 -->
  3. <a-modal class="add-custom"
  4. title="新增客户资料"
  5. v-model:visible="visible"
  6. @cancel="cancel"
  7. centered
  8. :maskClosable="false"
  9. v-if="isPingAnOem()"
  10. width="890px">
  11. <template #footer>
  12. <a-button key="submit"
  13. class="cancelBtn"
  14. :loading="loading"
  15. :disabled="loading"
  16. @click="submit(1)">完成 </a-button>
  17. </template>
  18. <a-form class="inlineForm"
  19. ref="formRef"
  20. :model="formState"
  21. :rules="rules">
  22. <a-row :gutter="24">
  23. <a-col :span="12">
  24. <a-form-item label="客户类型"
  25. name="userinfotype">
  26. <a-select class="typeSelect"
  27. style="width: 200px"
  28. v-model:value="formState.userinfotype"
  29. placeholder="请选择客户类型">
  30. <a-select-option value="1"> 个人 </a-select-option>
  31. <a-select-option value="2"> 企业 </a-select-option>
  32. </a-select>
  33. </a-form-item>
  34. </a-col>
  35. <template v-if="!isPersonal()">
  36. <a-col :span="12">
  37. <a-form-item label="企业名称"
  38. name="customername">
  39. <a-input class="dialogInput"
  40. v-model:value="formState.customername"
  41. style="width: 200px"
  42. placeholder="请输入企业名称" />
  43. </a-form-item>
  44. </a-col>
  45. </template>
  46. <template v-else>
  47. <a-col :span="12">
  48. <a-form-item label="姓名"
  49. name="username">
  50. <a-input class="dialogInput"
  51. style="width: 200px"
  52. v-model:value="formState.username"
  53. placeholder="请输入姓名" />
  54. </a-form-item>
  55. </a-col>
  56. </template>
  57. <a-col :span="12">
  58. <a-form-item label="点价联系人"
  59. name="contactname">
  60. <a-input class="dialogInput"
  61. style="width: 200px"
  62. v-model:value="formState.contactname"
  63. placeholder="请输入联系人" />
  64. </a-form-item>
  65. </a-col>
  66. <a-col :span="12">
  67. <a-form-item label="联系人手机号"
  68. name="mobilephone">
  69. <a-input class="dialogInput"
  70. style="width: 200px"
  71. v-model:value="formState.mobilephone"
  72. placeholder="请输入联系人手机号" />
  73. </a-form-item>
  74. </a-col>
  75. </a-row>
  76. </a-form>
  77. </a-modal>
  78. <!-- 其他项目客户资料 -->
  79. <a-modal class="add-custom"
  80. v-else
  81. title="新增客户资料"
  82. v-model:visible="visible"
  83. @cancel="cancel"
  84. centered
  85. :maskClosable="false"
  86. width="890px">
  87. <template #footer>
  88. <a-button key="submit"
  89. class="cancelBtn"
  90. :loading="loading"
  91. :disabled="loading"
  92. @click="submit(1)">保存草稿 </a-button>
  93. <a-button key="submit"
  94. type="primary"
  95. :loading="loading"
  96. :disabled="loading"
  97. @click="submit(2)">提交审核 </a-button>
  98. </template>
  99. <a-form class="inlineForm"
  100. ref="formRef"
  101. :model="formState"
  102. :rules="rules">
  103. <a-row :gutter="24">
  104. <a-col :span="12">
  105. <template v-if="isQianHaiJin()">
  106. <a-col :span="24">
  107. <a-form-item label="所属机构"
  108. name="areaid">
  109. <a-select class="typeSelect"
  110. style="width: 200px"
  111. v-model:value="formState.areaid"
  112. placeholder="请选择所属机构">
  113. <a-select-option v-for="item in areaList"
  114. :key="item.userid">
  115. {{ item.accountname }}
  116. </a-select-option>
  117. </a-select>
  118. </a-form-item>
  119. </a-col>
  120. <a-col :span="12">
  121. <a-form-item label="登录账号"
  122. name="logincode">
  123. <a-input class="dialogInput"
  124. v-model:value="formState.logincode"
  125. style="width: 200px"
  126. placeholder="请选择登录账号" />
  127. </a-form-item>
  128. </a-col>
  129. <a-col :span="12">
  130. <a-form-item label="登录密码"
  131. name="loginpwd">
  132. <a-input class="dialogInput"
  133. v-model:value="formState.loginpwd"
  134. style="width: 200px"
  135. placeholder="请选择登录密码" />
  136. </a-form-item>
  137. </a-col>
  138. </template>
  139. <a-form-item label="客户类型"
  140. name="userinfotype">
  141. <a-select class="typeSelect"
  142. style="width: 200px"
  143. v-model:value="formState.userinfotype"
  144. placeholder="请选择客户类型">
  145. <a-select-option value="1"> 个人 </a-select-option>
  146. <a-select-option value="2"> 企业 </a-select-option>
  147. </a-select>
  148. </a-form-item>
  149. </a-col>
  150. <template v-if="!isPersonal()">
  151. <a-col :span="12">
  152. <a-form-item label="企业名称"
  153. name="customername">
  154. <a-input class="dialogInput"
  155. v-model:value="formState.customername"
  156. style="width: 200px"
  157. placeholder="请输入企业名称" />
  158. </a-form-item>
  159. </a-col>
  160. <a-col :span="12">
  161. <a-form-item label="企业简称"
  162. name="nickname">
  163. <a-input class="dialogInput"
  164. style="width: 200px"
  165. v-model:value="formState.nickname"
  166. placeholder="请输入企业简称" />
  167. </a-form-item>
  168. </a-col>
  169. <a-col :span="12">
  170. <a-form-item label="证件类型"
  171. name="cardtype">
  172. <a-select class="inlineFormSelect"
  173. v-model:value="formState.cardtype"
  174. style="width: 200px"
  175. placeholder="请选择证件类型">
  176. <a-select-option :value="item.enumitemname"
  177. v-for="item in cardTypeList"
  178. :key="item.autoid">
  179. {{ item.enumdicname }}
  180. </a-select-option>
  181. </a-select>
  182. </a-form-item>
  183. </a-col>
  184. <a-col :span="12">
  185. <a-form-item label="法定代表人"
  186. name="legalpersonname">
  187. <a-input class="dialogInput"
  188. style="width: 200px"
  189. v-model:value="formState.legalpersonname"
  190. placeholder="请输入法定代表人" />
  191. </a-form-item>
  192. </a-col>
  193. <a-col :span="12">
  194. <a-form-item label="证件号码"
  195. name="cardnum">
  196. <a-input class="dialogInput"
  197. style="width: 200px"
  198. v-model:value="formState.cardnum"
  199. placeholder="请输入证件号码" />
  200. </a-form-item>
  201. </a-col>
  202. <a-col :span="12">
  203. <a-form-item label="纳税人识别号"
  204. name="taxpayernum">
  205. <a-input class="dialogInput"
  206. style="width: 200px"
  207. v-model:value="formState.taxpayernum"
  208. placeholder="请输入纳税人识别号" />
  209. </a-form-item>
  210. </a-col>
  211. <a-col :span="12">
  212. <a-form-item label="营业执照">
  213. <UploadImg :visible="visible"
  214. @upload="attachmentUpLoad" />
  215. </a-form-item>
  216. </a-col>
  217. <a-col :span="12">
  218. <a-form-item label="联系人"
  219. name="contactname">
  220. <a-input class="dialogInput"
  221. style="width: 200px"
  222. v-model:value="formState.contactname"
  223. placeholder="请输入联系人" />
  224. </a-form-item>
  225. </a-col>
  226. <a-col :span="12">
  227. <a-form-item label="联系人手机号"
  228. name="mobilephone">
  229. <a-input class="dialogInput"
  230. style="width: 200px"
  231. v-model:value="formState.mobilephone"
  232. placeholder="请输入联系人手机号" />
  233. </a-form-item>
  234. </a-col>
  235. <a-col :span="12">
  236. <a-form-item label="联系电话"
  237. name="telphone">
  238. <a-input class="dialogInput"
  239. style="width: 200px"
  240. v-model:value="formState.telphone"
  241. placeholder="请输入联系电话" />
  242. </a-form-item>
  243. </a-col>
  244. </template>
  245. <template v-else>
  246. <a-col :span="12">
  247. <a-form-item label="姓名"
  248. name="username">
  249. <a-input class="dialogInput"
  250. style="width: 200px"
  251. v-model:value="formState.username"
  252. placeholder="请输入姓名" />
  253. </a-form-item>
  254. </a-col>
  255. <a-col :span="12">
  256. <a-form-item label="身份证号码"
  257. name="cardnum">
  258. <a-input class="dialogInput"
  259. style="width: 200px"
  260. v-model:value="formState.cardnum"
  261. placeholder="请输入身份证号码" />
  262. </a-form-item>
  263. </a-col>
  264. <a-col :span="12">
  265. <a-form-item label="手机号码"
  266. name="mobilephone">
  267. <a-input class="dialogInput"
  268. style="width: 200px"
  269. v-model:value="formState.mobilephone"
  270. placeholder="请输入手机号码" />
  271. </a-form-item>
  272. </a-col>
  273. <a-col :span="12">
  274. <a-form-item label="身份证正面照"
  275. name="cardbackphotourl">
  276. <UploadImg :visible="visible"
  277. @upload="cardfrontphotourlUpLoad" />
  278. </a-form-item>
  279. </a-col>
  280. <a-col :span="12">
  281. <a-form-item label="邮箱"
  282. name="email">
  283. <a-input class="dialogInput"
  284. style="width: 200px"
  285. v-model:value="formState.email"
  286. placeholder="请输入邮箱" />
  287. </a-form-item>
  288. </a-col>
  289. <a-col :span="24">
  290. <a-form-item label="身份证反面照"
  291. name="cardfrontphotourl">
  292. <UploadImg :visible="visible"
  293. @upload="cardbackphotourlUpLoad" />
  294. </a-form-item>
  295. </a-col>
  296. <a-col :span="12">
  297. <a-form-item label="联系电话"
  298. name="telphone">
  299. <a-input class="dialogInput"
  300. style="width: 200px"
  301. v-model:value="formState.telphone"
  302. placeholder="请输入联系电话" />
  303. </a-form-item>
  304. </a-col>
  305. <a-col :span="12">
  306. <a-form-item> &nbsp; </a-form-item>
  307. </a-col>
  308. </template>
  309. <a-col :span="24">
  310. <a-form-item label="通讯地址">
  311. <a-select class="inlineFormSelect"
  312. style="width: 205px"
  313. v-model:value="formState.provinceid"
  314. @change="getCityList"
  315. placeholder="请选择省">
  316. <a-select-option v-for="item in provinceList"
  317. :key="item.autoid"
  318. :value="item.autoid">
  319. {{ item.divisionname }}
  320. </a-select-option>
  321. </a-select>
  322. <a-select class="inlineFormSelect ml9"
  323. style="width: 205px"
  324. v-model:value="formState.cityid"
  325. @change="getDistrictList"
  326. placeholder="请选择市">
  327. <a-select-option v-for="item in cityList"
  328. :key="item.autoid"
  329. :value="item.autoid">
  330. {{ item.divisionname }}
  331. </a-select-option>
  332. </a-select>
  333. <a-select class="inlineFormSelect ml9"
  334. v-model:value="formState.districtid"
  335. style="width: 205px"
  336. placeholder="请选择县(区)">
  337. <a-select-option v-for="item in districtList"
  338. :key="item.autoid"
  339. :value="item.autoid">
  340. {{ item.divisionname }}
  341. </a-select-option>
  342. </a-select>
  343. </a-form-item>
  344. </a-col>
  345. <a-col :span="24">
  346. <a-form-item label="&nbsp;"
  347. name="cardaddress">
  348. <a-input class="dialogInput"
  349. style="width: 635px"
  350. v-model:value="formState.cardaddress"
  351. placeholder="请输入详细地址" />
  352. </a-form-item>
  353. </a-col>
  354. <a-col :span="24">
  355. <a-form-item label="备注"
  356. name="remark">
  357. <a-input class="dialogInput"
  358. style="width: 635px"
  359. v-model:value="formState.remark"
  360. placeholder="请输入备注" />
  361. </a-form-item>
  362. </a-col>
  363. </a-row>
  364. </a-form>
  365. </a-modal>
  366. </template>
  367. <script lang="ts">
  368. import UploadImg from '@/common/components/uploadImg/index.vue';
  369. import { isPingAnOem, isQianHaiJin } from '@/common/config/projectName';
  370. import { requestResultLoadingAndInfo } from '@/common/methods/request/resultInfo';
  371. import { validateAction } from '@/common/setup/form';
  372. import { _closeModal } from '@/common/setup/modal/modal';
  373. import { getUploadImg } from '@/common/setup/upload';
  374. import { getUserId } from '@/services/bus/user';
  375. import { getAddress } from '@/services/go/adress';
  376. import { AllEnums } from '@/services/go/commonService/interface';
  377. import { addCustomerInfoOperate } from '@/services/proto/accountinfo';
  378. import { CustomerInfoOperateReq } from '@/services/proto/accountinfo/interface';
  379. import { toBase64String } from '@/utils/storage/base64';
  380. import { defineComponent, ref } from 'vue';
  381. import { FormState } from './interface';
  382. import { getCardType, handleForm, handleAreaList } from './setup';
  383. export default defineComponent({
  384. name: 'add-custom',
  385. emits: ['cancel', 'update'],
  386. components: { UploadImg },
  387. setup(props, context) {
  388. // 控制关闭弹窗
  389. const { visible, cancel } = _closeModal(context);
  390. const loading = ref<boolean>(false);
  391. // 证件类型
  392. const cardTypeList = ref<AllEnums[]>(getCardType());
  393. // 表单
  394. const { formRef, formState, rules } = handleForm();
  395. // 地址
  396. const { cityList, districtList, provinceList, getCityList, getDistrictList } = getAddress();
  397. // 营业执照
  398. const { getFirstImg: getAttachmentImg, uploadImgAction: attachmentUpLoad } = getUploadImg();
  399. // 背面证件照地址
  400. const { getFirstImg: getBackImg, uploadImgAction: cardbackphotourlUpLoad } = getUploadImg();
  401. // 正面证件照地址
  402. const { getFirstImg: getFrontImg, uploadImgAction: cardfrontphotourlUpLoad } = getUploadImg();
  403. //查询所属机构列表
  404. const { areaList, getAreaList } = handleAreaList();
  405. if (isQianHaiJin()) {
  406. getAreaList(loading);
  407. }
  408. function isPersonal(): boolean {
  409. return formState.userinfotype === '1';
  410. }
  411. function submit(OperateType: 1 | 2) {
  412. validateAction<FormState>(formRef, formState).then((param) => {
  413. const reqParam: CustomerInfoOperateReq = {
  414. operatetype: 1, // 1: 新增
  415. userid: getUserId(), // 必填
  416. areaid: getUserId(),
  417. userinfotype: Number(param.userinfotype),
  418. username: Number(param.userinfotype) === 1 ? param.username : param.customername,
  419. userstate: OperateType, // 1: 保存草稿 2: 新增
  420. // 以上必填
  421. cardtype: (param.cardtype as number) !== undefined ? (param.cardtype as number) : 0, // 证件类型
  422. cardnum: param.cardnum, // 证件号码
  423. nickname: param.nickname, // 昵称
  424. remark: param.remark, // 备注
  425. mobilephone: param.mobilephone, // 手机号码
  426. telphone: param.telphone, // 电话
  427. cardfrontphotourl: isPersonal() ? getFrontImg() : getAttachmentImg(), // 正面照片
  428. cardbackphotourl: isPersonal() ? getBackImg() : '', // 背面证件照地址
  429. ipaddress: param.cardaddress, // 证件地址
  430. cityid: (param.cityid as number) !== undefined ? (param.cityid as number) : 0, //城市
  431. districtid: (param.districtid as number) !== undefined ? (param.districtid as number) : 0, // 地区
  432. // countryid: param.,9
  433. provinceid: (param.provinceid as number) !== undefined ? (param.provinceid as number) : 0, //省
  434. contactname: param.contactname, // 联系人
  435. legalpersonname: param.legalpersonname, // 法人姓名(企业)
  436. taxpayernum: param.taxpayernum, // 纳税人识别号
  437. email: param.email, // email
  438. proxystatementurl: '',
  439. };
  440. if (isQianHaiJin()) {
  441. reqParam.areaid = param.areaid as number;
  442. reqParam.logincode = param.logincode;
  443. reqParam.loginpwd = toBase64String(toBase64String(param.loginpwd));
  444. reqParam.userstate = 2;
  445. }
  446. requestResultLoadingAndInfo(addCustomerInfoOperate, reqParam, loading, OperateType === 1 ? ['保存草稿成功', '保存草稿失败:'] : ['新增客户资料成功', '新增客户资料失败:']).then(() => {
  447. cancel(true);
  448. });
  449. });
  450. }
  451. return {
  452. formState,
  453. rules,
  454. formRef,
  455. cardTypeList,
  456. isPersonal,
  457. visible,
  458. cancel,
  459. submit,
  460. loading,
  461. cityList,
  462. districtList,
  463. provinceList,
  464. areaList,
  465. getCityList,
  466. getDistrictList,
  467. attachmentUpLoad,
  468. cardbackphotourlUpLoad,
  469. cardfrontphotourlUpLoad,
  470. isPingAnOem,
  471. isQianHaiJin,
  472. };
  473. },
  474. });
  475. </script>
  476. <style lang="less">
  477. .add-custom {
  478. }
  479. </style
  480. >;