index.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437
  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. <a-form-item label="客户类型"
  106. name="userinfotype">
  107. <a-select class="typeSelect"
  108. style="width: 200px"
  109. v-model:value="formState.userinfotype"
  110. placeholder="请选择客户类型">
  111. <a-select-option value="1"> 个人 </a-select-option>
  112. <a-select-option value="2"> 企业 </a-select-option>
  113. </a-select>
  114. </a-form-item>
  115. </a-col>
  116. <template v-if="!isPersonal()">
  117. <a-col :span="12">
  118. <a-form-item label="企业名称"
  119. name="customername">
  120. <a-input class="dialogInput"
  121. v-model:value="formState.customername"
  122. style="width: 200px"
  123. placeholder="请输入企业名称" />
  124. </a-form-item>
  125. </a-col>
  126. <a-col :span="12">
  127. <a-form-item label="企业简称"
  128. name="nickname">
  129. <a-input class="dialogInput"
  130. style="width: 200px"
  131. v-model:value="formState.nickname"
  132. placeholder="请输入企业简称" />
  133. </a-form-item>
  134. </a-col>
  135. <a-col :span="12">
  136. <a-form-item label="证件类型"
  137. name="cardtype">
  138. <a-select class="inlineFormSelect"
  139. v-model:value="formState.cardtype"
  140. style="width: 200px"
  141. placeholder="请选择证件类型">
  142. <a-select-option :value="item.enumitemname"
  143. v-for="item in cardTypeList"
  144. :key="item.autoid">
  145. {{ item.enumdicname }}
  146. </a-select-option>
  147. </a-select>
  148. </a-form-item>
  149. </a-col>
  150. <a-col :span="12">
  151. <a-form-item label="法定代表人"
  152. name="legalpersonname">
  153. <a-input class="dialogInput"
  154. style="width: 200px"
  155. v-model:value="formState.legalpersonname"
  156. placeholder="请输入法定代表人" />
  157. </a-form-item>
  158. </a-col>
  159. <a-col :span="12">
  160. <a-form-item label="证件号码"
  161. name="cardnum">
  162. <a-input class="dialogInput"
  163. style="width: 200px"
  164. v-model:value="formState.cardnum"
  165. placeholder="请输入证件号码" />
  166. </a-form-item>
  167. </a-col>
  168. <a-col :span="12">
  169. <a-form-item label="纳税人识别号"
  170. name="taxpayernum">
  171. <a-input class="dialogInput"
  172. style="width: 200px"
  173. v-model:value="formState.taxpayernum"
  174. placeholder="请输入纳税人识别号" />
  175. </a-form-item>
  176. </a-col>
  177. <a-col :span="12">
  178. <a-form-item label="营业执照">
  179. <UploadImg :visible="visible"
  180. @upload="attachmentUpLoad" />
  181. </a-form-item>
  182. </a-col>
  183. <a-col :span="12">
  184. <a-form-item label="联系人"
  185. name="contactname">
  186. <a-input class="dialogInput"
  187. style="width: 200px"
  188. v-model:value="formState.contactname"
  189. placeholder="请输入联系人" />
  190. </a-form-item>
  191. </a-col>
  192. <a-col :span="12">
  193. <a-form-item label="联系人手机号"
  194. name="mobilephone">
  195. <a-input class="dialogInput"
  196. style="width: 200px"
  197. v-model:value="formState.mobilephone"
  198. placeholder="请输入联系人手机号" />
  199. </a-form-item>
  200. </a-col>
  201. <a-col :span="12">
  202. <a-form-item label="联系电话"
  203. name="telphone">
  204. <a-input class="dialogInput"
  205. style="width: 200px"
  206. v-model:value="formState.telphone"
  207. placeholder="请输入联系电话" />
  208. </a-form-item>
  209. </a-col>
  210. </template>
  211. <template v-else>
  212. <a-col :span="12">
  213. <a-form-item label="姓名"
  214. name="username">
  215. <a-input class="dialogInput"
  216. style="width: 200px"
  217. v-model:value="formState.username"
  218. placeholder="请输入姓名" />
  219. </a-form-item>
  220. </a-col>
  221. <a-col :span="12">
  222. <a-form-item label="身份证号码"
  223. name="cardnum">
  224. <a-input class="dialogInput"
  225. style="width: 200px"
  226. v-model:value="formState.cardnum"
  227. placeholder="请输入身份证号码" />
  228. </a-form-item>
  229. </a-col>
  230. <a-col :span="12">
  231. <a-form-item label="手机号码"
  232. name="mobilephone">
  233. <a-input class="dialogInput"
  234. style="width: 200px"
  235. v-model:value="formState.mobilephone"
  236. placeholder="请输入手机号码" />
  237. </a-form-item>
  238. </a-col>
  239. <a-col :span="12">
  240. <a-form-item label="身份证正面照"
  241. name="cardbackphotourl">
  242. <UploadImg :visible="visible"
  243. @upload="cardfrontphotourlUpLoad" />
  244. </a-form-item>
  245. </a-col>
  246. <a-col :span="12">
  247. <a-form-item label="邮箱"
  248. name="email">
  249. <a-input class="dialogInput"
  250. style="width: 200px"
  251. v-model:value="formState.email"
  252. placeholder="请输入邮箱" />
  253. </a-form-item>
  254. </a-col>
  255. <a-col :span="24">
  256. <a-form-item label="身份证反面照"
  257. name="cardfrontphotourl">
  258. <UploadImg :visible="visible"
  259. @upload="cardbackphotourlUpLoad" />
  260. </a-form-item>
  261. </a-col>
  262. <a-col :span="12">
  263. <a-form-item label="联系电话"
  264. name="telphone">
  265. <a-input class="dialogInput"
  266. style="width: 200px"
  267. v-model:value="formState.telphone"
  268. placeholder="请输入联系电话" />
  269. </a-form-item>
  270. </a-col>
  271. <a-col :span="12">
  272. <a-form-item> &nbsp; </a-form-item>
  273. </a-col>
  274. </template>
  275. <a-col :span="24">
  276. <a-form-item label="通讯地址">
  277. <a-select class="inlineFormSelect"
  278. style="width: 205px"
  279. v-model:value="formState.provinceid"
  280. @change="getCityList"
  281. placeholder="请选择省">
  282. <a-select-option v-for="item in provinceList"
  283. :key="item.autoid"
  284. :value="item.autoid">
  285. {{ item.divisionname }}
  286. </a-select-option>
  287. </a-select>
  288. <a-select class="inlineFormSelect ml9"
  289. style="width: 205px"
  290. v-model:value="formState.cityid"
  291. @change="getDistrictList"
  292. placeholder="请选择市">
  293. <a-select-option v-for="item in cityList"
  294. :key="item.autoid"
  295. :value="item.autoid">
  296. {{ item.divisionname }}
  297. </a-select-option>
  298. </a-select>
  299. <a-select class="inlineFormSelect ml9"
  300. v-model:value="formState.districtid"
  301. style="width: 205px"
  302. placeholder="请选择县(区)">
  303. <a-select-option v-for="item in districtList"
  304. :key="item.autoid"
  305. :value="item.autoid">
  306. {{ item.divisionname }}
  307. </a-select-option>
  308. </a-select>
  309. </a-form-item>
  310. </a-col>
  311. <a-col :span="24">
  312. <a-form-item label="&nbsp;"
  313. name="cardaddress">
  314. <a-input class="dialogInput"
  315. style="width: 635px"
  316. v-model:value="formState.cardaddress"
  317. placeholder="请输入详细地址" />
  318. </a-form-item>
  319. </a-col>
  320. <a-col :span="24">
  321. <a-form-item label="备注"
  322. name="remark">
  323. <a-input class="dialogInput"
  324. style="width: 635px"
  325. v-model:value="formState.remark"
  326. placeholder="请输入备注" />
  327. </a-form-item>
  328. </a-col>
  329. </a-row>
  330. </a-form>
  331. </a-modal>
  332. </template>
  333. <script lang="ts">
  334. import UploadImg from '@/common/components/uploadImg/index.vue';
  335. import { isPingAnOem } from '@/common/config/projectName';
  336. import { requestResultLoadingAndInfo } from '@/common/methods/request/resultInfo';
  337. import { validateAction } from '@/common/setup/form';
  338. import { _closeModal } from '@/common/setup/modal/modal';
  339. import { getUploadImg } from '@/common/setup/upload';
  340. import { getUserId } from '@/services/bus/account';
  341. import { getAddress } from '@/services/go/adress';
  342. import { AllEnums } from '@/services/go/commonService/interface';
  343. import { addCustomerInfoOperate } from '@/services/proto/accountinfo';
  344. import { CustomerInfoOperateReq } from '@/services/proto/accountinfo/interface';
  345. import { defineComponent, ref } from 'vue';
  346. import { FormState } from './interface';
  347. import { getCardType, handleForm } from './setup';
  348. export default defineComponent({
  349. name: 'add-custom',
  350. emits: ['cancel', 'update'],
  351. components: { UploadImg },
  352. setup(props, context) {
  353. // 控制关闭弹窗
  354. const { visible, cancel } = _closeModal(context);
  355. const loading = ref<boolean>(false);
  356. // 证件类型
  357. const cardTypeList = ref<AllEnums[]>(getCardType());
  358. // 表单
  359. const { formRef, formState, rules } = handleForm();
  360. // 地址
  361. const { cityList, districtList, provinceList, getCityList, getDistrictList } = getAddress();
  362. // 营业执照
  363. const { getFirstImg: getAttachmentImg, uploadImgAction: attachmentUpLoad } = getUploadImg();
  364. // 背面证件照地址
  365. const { getFirstImg: getBackImg, uploadImgAction: cardbackphotourlUpLoad } = getUploadImg();
  366. // 正面证件照地址
  367. const { getFirstImg: getFrontImg, uploadImgAction: cardfrontphotourlUpLoad } = getUploadImg();
  368. function isPersonal(): boolean {
  369. return formState.userinfotype === '1';
  370. }
  371. function submit(OperateType: 1 | 2) {
  372. validateAction<FormState>(formRef, formState).then((param) => {
  373. const reqParam: CustomerInfoOperateReq = {
  374. operatetype: 1, // 1: 新增
  375. // userid: 1, // 写死 必填
  376. userid: getUserId(), // 写死 必填
  377. areaid: getUserId(),
  378. userinfotype: Number(param.userinfotype),
  379. username: Number(param.userinfotype) === 1 ? param.username : param.customername,
  380. userstate: OperateType, // 1: 保存草稿 2: 新增
  381. // 以上必填
  382. cardtype: (param.cardtype as number) !== undefined ? (param.cardtype as number) : 0, // 证件类型
  383. cardnum: param.cardnum, // 证件号码
  384. nickname: param.nickname, // 昵称
  385. remark: param.remark, // 备注
  386. mobilephone: param.mobilephone, // 手机号码
  387. telphone: param.telphone, // 电话
  388. cardfrontphotourl: isPersonal() ? getFrontImg() : getAttachmentImg(), // 正面照片
  389. cardbackphotourl: isPersonal() ? getBackImg() : '', // 背面证件照地址
  390. ipaddress: param.cardaddress, // 证件地址
  391. cityid: (param.cityid as number) !== undefined ? (param.cityid as number) : 0, //城市
  392. districtid: (param.districtid as number) !== undefined ? (param.districtid as number) : 0, // 地区
  393. // countryid: param.,9
  394. provinceid: (param.provinceid as number) !== undefined ? (param.provinceid as number) : 0, //省
  395. contactname: param.contactname, // 联系人
  396. legalpersonname: param.legalpersonname, // 法人姓名(企业)
  397. taxpayernum: param.taxpayernum, // 纳税人识别号
  398. email: param.email, // email
  399. proxystatementurl: '',
  400. };
  401. requestResultLoadingAndInfo(addCustomerInfoOperate, reqParam, loading, OperateType === 1 ? ['保存草稿成功', '保存草稿失败:'] : ['新增客户资料成功', '新增客户资料失败:']).then(() => {
  402. cancel(true);
  403. });
  404. });
  405. }
  406. return {
  407. formState,
  408. rules,
  409. formRef,
  410. cardTypeList,
  411. isPersonal,
  412. visible,
  413. cancel,
  414. submit,
  415. loading,
  416. cityList,
  417. districtList,
  418. provinceList,
  419. getCityList,
  420. getDistrictList,
  421. attachmentUpLoad,
  422. cardbackphotourlUpLoad,
  423. cardfrontphotourlUpLoad,
  424. isPingAnOem,
  425. };
  426. },
  427. });
  428. </script>
  429. <style lang="less">
  430. .add-custom {
  431. }
  432. </style
  433. >;