detailsPageEdit.vue 39 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393
  1. <template>
  2. <div class="borderless">
  3. <div class="customer-head">
  4. <div class="customer-back">
  5. <!-- <i class="back-icon el-icon-arrow-left"></i><i style="font-style:normal">返回管理列表</i>-->
  6. <el-button
  7. type="danger"
  8. style="border: none;background: none;color: red"
  9. icon="el-icon-arrow-left"
  10. @click="backToList"
  11. >返回列表
  12. </el-button>
  13. </div>
  14. <div class="add-customer-btn">
  15. <el-button
  16. type="primary"
  17. @click="synchronization"
  18. size="small"
  19. :disabled="!form.id"
  20. >同 步
  21. </el-button>
  22. <el-button
  23. type="primary"
  24. @click="openFlow"
  25. size="small"
  26. :disabled="!form.id"
  27. >审 核
  28. </el-button>
  29. <el-button
  30. type="primary"
  31. :disabled="disabled"
  32. @click="editCustomer"
  33. size="small"
  34. >{{ form.id ? "确认修改" : "确认新增" }}
  35. </el-button>
  36. </div>
  37. </div>
  38. <div class="customer-main">
  39. <el-form
  40. :model="form"
  41. ref="form"
  42. label-width="100px"
  43. class="demo-ruleForm"
  44. >
  45. <containerTitle title="基础资料"></containerTitle>
  46. <basic-container>
  47. <el-row>
  48. <el-col
  49. v-for="(item, index) in basicData.column"
  50. :key="index"
  51. :span="item.span ? item.span : 8"
  52. >
  53. <el-form-item
  54. :label="item.label"
  55. :prop="item.prop"
  56. :rules="item.rules"
  57. >
  58. <avue-input-tree
  59. v-if="item.prop === 'corpsTypeId'"
  60. leaf-only
  61. multiple
  62. style="width: 100%;"
  63. size="small"
  64. :props="{ label: 'title' }"
  65. v-model="form[item.prop]"
  66. placeholder=" "
  67. type="tree"
  68. :dic="dic"
  69. ></avue-input-tree>
  70. <el-cascader
  71. v-else-if="item.prop === 'belongtoarea'"
  72. v-model="form[item.prop]"
  73. collapse-tags
  74. :options="dicArea"
  75. :props="props"
  76. size="small"
  77. style="width: 100%;"
  78. :show-all-levels="false"
  79. @change="addressChange"
  80. ></el-cascader>
  81. <!-- <avue-input-tree-->
  82. <!-- v-else-if="item.prop === 'belongtoarea'"-->
  83. <!-- leaf-only-->
  84. <!-- multiple-->
  85. <!-- tags-->
  86. <!-- style="width: 100%;"-->
  87. <!-- size="small"-->
  88. <!-- :props="{ label: 'name', value: 'name' }"-->
  89. <!-- v-model="form[item.prop]"-->
  90. <!-- placeholder=" "-->
  91. <!-- type="tree"-->
  92. <!-- :dic="dicArea"-->
  93. <!-- ></avue-input-tree>-->
  94. <el-select
  95. v-else-if="item.prop === 'adminProfiles'"
  96. size="small"
  97. style="width: 100%;"
  98. v-model="form[item.prop]"
  99. multiple
  100. placeholder=""
  101. >
  102. <el-option
  103. v-for="item in userList"
  104. :key="item.id"
  105. :label="item.name"
  106. :value="item.id"
  107. >
  108. </el-option>
  109. </el-select>
  110. <el-select
  111. v-else-if="item.prop === 'creditRating'"
  112. size="small"
  113. style="width: 100%;"
  114. v-model="form[item.prop]"
  115. placeholder=""
  116. >
  117. <el-option
  118. v-for="item in creditRatingList"
  119. :key="item.id"
  120. :label="item.dictValue"
  121. :value="item.dictValue"
  122. >
  123. </el-option>
  124. </el-select>
  125. <crop-select
  126. v-else-if="item.prop === 'belongtocompany'"
  127. v-model="form[item.prop]"
  128. @getCorpData="getCorpName"
  129. corpType="GS"
  130. ></crop-select>
  131. <el-input
  132. type="age"
  133. v-else
  134. v-model="form[item.prop]"
  135. size="small"
  136. autocomplete="off"
  137. :disabled="item.disabled"
  138. ></el-input>
  139. </el-form-item>
  140. </el-col>
  141. </el-row>
  142. </basic-container>
  143. <containerTitle title="联系方式"></containerTitle>
  144. <basic-container>
  145. <el-row>
  146. <el-col
  147. v-for="(item, index) in contactInformation.column"
  148. :key="index"
  149. :span="item.span ? item.span : 8"
  150. >
  151. <el-form-item
  152. :label="item.label"
  153. :prop="item.prop"
  154. :rules="item.rules"
  155. >
  156. <el-input
  157. type="age"
  158. v-model="form[item.prop]"
  159. size="small"
  160. autocomplete="off"
  161. ></el-input>
  162. </el-form-item>
  163. </el-col>
  164. </el-row>
  165. </basic-container>
  166. <containerTitle title="财务资料"></containerTitle>
  167. <basic-container>
  168. <el-row>
  169. <el-col
  170. v-for="(item, index) in financialInformation.column"
  171. :key="index"
  172. :span="item.span ? item.span : 8"
  173. >
  174. <el-form-item
  175. :label="item.label"
  176. :prop="item.prop"
  177. :rules="item.rules"
  178. >
  179. <el-switch
  180. v-if="item.prop === 'creditstatus'"
  181. v-model="form[item.prop]"
  182. active-value="0"
  183. inactive-value="1"
  184. active-text="开启"
  185. inactive-text="关闭"
  186. >
  187. </el-switch>
  188. <el-select
  189. v-else-if="item.prop === 'paymentType'"
  190. v-model="form[item.prop]"
  191. clearable
  192. filterable
  193. size="small"
  194. style="width: 100%;"
  195. >
  196. <el-option
  197. v-for="(item, index) in paymentOption"
  198. :key="index"
  199. :label="item.dictValue"
  200. :value="item.dictValue"
  201. ></el-option>
  202. </el-select>
  203. <el-select
  204. v-else-if="item.prop === 'packageRemarks'"
  205. v-model="form[item.prop]"
  206. clearable
  207. filterable
  208. size="small"
  209. style="width: 100%;"
  210. >
  211. <el-option
  212. v-for="(item, index) in packageOptions"
  213. :key="index"
  214. :label="item.dictValue"
  215. :value="item.dictValue"
  216. ></el-option>
  217. </el-select>
  218. <el-input
  219. v-else
  220. type="age"
  221. v-model="form[item.prop]"
  222. size="small"
  223. autocomplete="off"
  224. ></el-input>
  225. </el-form-item>
  226. </el-col>
  227. </el-row>
  228. </basic-container>
  229. <containerTitle title="客户联系人"></containerTitle>
  230. <basic-container>
  231. <avue-crud
  232. ref="crud"
  233. :option="customerContact"
  234. v-model="contactsForm"
  235. :data="contactsData"
  236. @saveColumn="saveColumn"
  237. @resetColumn="resetColumn"
  238. @row-save="rowSave"
  239. @row-update="rowUpdate"
  240. @row-del="rowDel"
  241. >
  242. <template slot-scope="{ type, size, row }" slot="menu">
  243. <el-button
  244. icon="el-icon-check"
  245. :size="size"
  246. :type="type"
  247. @click="creatingUsers(row)"
  248. >创建用户</el-button
  249. >
  250. </template>
  251. </avue-crud>
  252. </basic-container>
  253. <!-- <containerTitle title="客户优势项目"></containerTitle>
  254. <basic-container style="margin-bottom: 10px">
  255. <avue-crud
  256. :option="advantageProject"
  257. v-model="advantageProjectForm"
  258. :data="advantageProjectData"
  259. @row-save="rowSaveProject"
  260. @row-update="rowUpdateProject"
  261. @row-del="rowDelProject"
  262. ></avue-crud>
  263. </basic-container> -->
  264. <containerTitle title="客户开户行"></containerTitle>
  265. <basic-container>
  266. <avue-crud
  267. ref="crud2"
  268. :option="bankOfDeposit"
  269. v-model="bankOfDepositForm"
  270. :data="bankOfDepositData"
  271. @saveColumn="saveColumn2"
  272. @resetColumn="resetColumn2"
  273. @row-save="rowSaveBankOfDeposit"
  274. @row-update="rowUpdateBankOfDeposit"
  275. @row-del="rowDelBankOfDeposit"
  276. ></avue-crud>
  277. </basic-container>
  278. <containerTitle title="收发货地址"></containerTitle>
  279. <basic-container>
  280. <avue-crud
  281. ref="crud3"
  282. :option="addressOption"
  283. v-model="addressForm"
  284. :data="addressData"
  285. @saveColumn="saveColumn3"
  286. @resetColumn="resetColumn3"
  287. @row-save="rowSaveAddress"
  288. @row-update="rowUpdateAddress"
  289. @row-del="rowDelAddress"
  290. ></avue-crud>
  291. </basic-container>
  292. </el-form>
  293. </div>
  294. <flow-dialog :switchDialog="switchDialog" @onClose="onClose()">
  295. <template slot="content"> </template>
  296. </flow-dialog>
  297. <el-dialog
  298. title="同 步"
  299. :visible.sync="dialogVisible"
  300. append-to-body
  301. width="60%"
  302. >
  303. <avue-form ref="formData" v-model="formData" :option="option">
  304. </avue-form>
  305. <span slot="footer" class="dialog-footer">
  306. <el-button @click="dialogVisible = false">取 消</el-button>
  307. <el-button type="primary" @click="confirmSynchronization"
  308. >确 定</el-button
  309. >
  310. </span>
  311. </el-dialog>
  312. <el-dialog
  313. title="创建用户"
  314. :visible.sync="dialogVisibleBt"
  315. append-to-body
  316. width="60%"
  317. >
  318. <avue-form ref="formDataTwo" v-model="formDataTwo" :option="optionData">
  319. </avue-form>
  320. <span slot="footer" class="dialog-footer">
  321. <el-button @click="dialogVisibleBt = false">取 消</el-button>
  322. <el-button type="primary" @click="confirmSynchronizationTwo"
  323. >确 定</el-button
  324. >
  325. </span>
  326. </el-dialog>
  327. </div>
  328. </template>
  329. <script>
  330. import {
  331. customerList,
  332. typeSave,
  333. detail,
  334. deleteDetails,
  335. corpstypeTree,
  336. corpsattn,
  337. corpsbank,
  338. corpsfiles,
  339. corpsitem,
  340. areaTypeTree,
  341. corpsAddrDelete,
  342. synchronizationCopy,
  343. creatingUsers
  344. } from "@/api/basicData/customerInformation";
  345. import customerContact from "./configuration/customerContact.json";
  346. import advantageProject from "./configuration/advantageProject.json";
  347. import bankOfDeposit from "./configuration/bankOfDeposit.json";
  348. import flowDialog from "@/components/flow-dialog/main";
  349. import { customerParameter } from "@/enums/management-type";
  350. import { gainUser } from "@/api/basicData/customerInquiry";
  351. import addressOption from "./configuration/addressOption.json";
  352. import website from "@/config/website";
  353. import { getRoleTree } from "@/api/system/role";
  354. import { getDeptTree } from "@/api/system/dept";
  355. import { getPostList } from "@/api/system/post";
  356. export default {
  357. name: "detailsPage",
  358. data() {
  359. return {
  360. userList: [],
  361. formData: {},
  362. formDataTwo: {},
  363. creditRatingList: [],
  364. optionData: {
  365. span: 8,
  366. menuBtn: false,
  367. column: [
  368. {
  369. label: "所属角色",
  370. prop: "roleId",
  371. multiple: true,
  372. type: "tree",
  373. dicData: [],
  374. props: {
  375. label: "title"
  376. },
  377. checkStrictly: true,
  378. slot: true,
  379. rules: [
  380. {
  381. required: true,
  382. message: "请选择所属角色",
  383. trigger: "click"
  384. }
  385. ]
  386. },
  387. {
  388. label: "所属部门",
  389. prop: "deptId",
  390. type: "tree",
  391. multiple: true,
  392. dicData: [],
  393. props: {
  394. label: "title"
  395. },
  396. checkStrictly: true,
  397. slot: true,
  398. rules: [
  399. {
  400. required: true,
  401. message: "请选择所属部门",
  402. trigger: "click"
  403. }
  404. ]
  405. },
  406. {
  407. label: "所属岗位",
  408. prop: "postId",
  409. type: "tree",
  410. multiple: true,
  411. dicData: [],
  412. props: {
  413. label: "postName",
  414. value: "id"
  415. },
  416. rules: [
  417. {
  418. required: true,
  419. message: "请选择所属岗位",
  420. trigger: "click"
  421. }
  422. ]
  423. }
  424. ]
  425. },
  426. dialogVisibleBt: false,
  427. dialogVisible: false,
  428. option: {
  429. span: 12,
  430. menuBtn: false,
  431. column: [
  432. {
  433. label: "客户类型",
  434. prop: "corpType",
  435. type: "select",
  436. cascader: ["corpsTypeId"],
  437. dicUrl: "/api/blade-system/dict-biz/dictionary?code=corp_type",
  438. props: {
  439. label: "dictValue",
  440. value: "dictKey"
  441. },
  442. rules: [
  443. {
  444. required: true,
  445. message: "请选择客户类型",
  446. trigger: "blur"
  447. }
  448. ]
  449. },
  450. {
  451. label: "类别",
  452. prop: "corpsTypeId",
  453. type: "tree",
  454. dicUrl: "/api/blade-client/corpstype/tree?&corpType={{key}}",
  455. props: {
  456. label: "title",
  457. value: "value"
  458. },
  459. rules: [
  460. {
  461. required: true,
  462. message: "请选择类型",
  463. trigger: "blur"
  464. }
  465. ]
  466. }
  467. ]
  468. },
  469. switchDialog: false,
  470. form: {},
  471. disabled: false,
  472. contactsForm: {},
  473. advantageProjectForm: {},
  474. bankOfDepositForm: {},
  475. contactsData: [],
  476. advantageProjectData: [],
  477. bankOfDepositData: [],
  478. dic: [],
  479. dicArea: [],
  480. customerContact: {},
  481. advantageProject: advantageProject,
  482. bankOfDeposit: {},
  483. contactInformation: {
  484. column: [
  485. {
  486. label: "联系人",
  487. prop: "attn",
  488. rules: [
  489. {
  490. required: false,
  491. message: "请输入联系人",
  492. trigger: "blur"
  493. }
  494. ]
  495. },
  496. {
  497. label: "联系电话",
  498. prop: "tel",
  499. rules: [
  500. {
  501. required: false,
  502. message: "请输入联系电话",
  503. trigger: "blur"
  504. }
  505. ]
  506. },
  507. {
  508. label: "职位",
  509. prop: "position",
  510. rules: [
  511. {
  512. required: false,
  513. message: "请输入联系电话",
  514. trigger: "blur"
  515. }
  516. ]
  517. },
  518. {
  519. label: "单位地址",
  520. prop: "addr",
  521. rules: [
  522. {
  523. required: false,
  524. message: "请输入单位地址",
  525. trigger: "blur"
  526. }
  527. ]
  528. },
  529. {
  530. label: "仓库地址",
  531. prop: "storageAddr",
  532. rules: [
  533. {
  534. required: false,
  535. message: "请输入仓库地址",
  536. trigger: "blur"
  537. }
  538. ]
  539. },
  540. {
  541. label: "分仓地址",
  542. prop: "subStorageAddr",
  543. rules: [
  544. {
  545. required: false,
  546. message: "请输入分仓地址",
  547. trigger: "blur"
  548. }
  549. ]
  550. }
  551. ]
  552. },
  553. financialInformation: {
  554. column: [
  555. {
  556. label: "账户名称",
  557. prop: "accountName",
  558. rules: [
  559. {
  560. required: false,
  561. message: " ",
  562. trigger: "blur"
  563. }
  564. ]
  565. },
  566. {
  567. label: "开户银行",
  568. prop: "accountBank",
  569. rules: [
  570. {
  571. required: false,
  572. message: " ",
  573. trigger: "blur"
  574. }
  575. ]
  576. },
  577. {
  578. label: "银行帐号",
  579. prop: "accountNo",
  580. rules: [
  581. {
  582. required: false,
  583. message: " ",
  584. trigger: "blur"
  585. }
  586. ]
  587. },
  588. {
  589. label: "CNAPS",
  590. prop: "cnaps",
  591. rules: [
  592. {
  593. required: false,
  594. message: " ",
  595. trigger: "blur"
  596. }
  597. ]
  598. },
  599. {
  600. label: "银行地址",
  601. prop: "localBankAddress",
  602. rules: [
  603. {
  604. required: false,
  605. message: " ",
  606. trigger: "blur"
  607. }
  608. ]
  609. },
  610. {
  611. label: "外币账户名称",
  612. prop: "accountNameFcy",
  613. rules: [
  614. {
  615. required: false,
  616. message: " ",
  617. trigger: "blur"
  618. }
  619. ]
  620. },
  621. {
  622. label: "外币开户银行",
  623. prop: "accountBankFcy",
  624. rules: [
  625. {
  626. required: false,
  627. message: " ",
  628. trigger: "blur"
  629. }
  630. ]
  631. },
  632. {
  633. label: "外币银行账号",
  634. prop: "accountNoFcy",
  635. rules: [
  636. {
  637. required: false,
  638. message: " ",
  639. trigger: "blur"
  640. }
  641. ]
  642. },
  643. {
  644. label: "Swift Code",
  645. prop: "swiftCode",
  646. rules: [
  647. {
  648. required: false,
  649. message: " ",
  650. trigger: "blur"
  651. }
  652. ]
  653. },
  654. {
  655. label: "外币银行地址",
  656. prop: "foreignBankAddress",
  657. rules: [
  658. {
  659. required: false,
  660. message: " ",
  661. trigger: "blur"
  662. }
  663. ]
  664. },
  665. {
  666. label: "授信状态",
  667. prop: "creditstatus",
  668. rules: [
  669. {
  670. required: false,
  671. message: " ",
  672. trigger: "blur"
  673. }
  674. ]
  675. },
  676. {
  677. label: "授信等级",
  678. prop: "creditLevel",
  679. rules: [
  680. {
  681. required: false,
  682. message: " ",
  683. trigger: "blur"
  684. }
  685. ]
  686. },
  687. {
  688. label: "授信额度",
  689. prop: "creditGrant",
  690. rules: [
  691. {
  692. required: false,
  693. message: " ",
  694. trigger: "blur"
  695. }
  696. ]
  697. },
  698. {
  699. label: "授信天数",
  700. prop: "creditDay",
  701. rules: [
  702. {
  703. required: false,
  704. message: " ",
  705. trigger: "blur"
  706. }
  707. ]
  708. },
  709. {
  710. label: "授信利率",
  711. prop: "creditRate",
  712. rules: [
  713. {
  714. required: false,
  715. message: " ",
  716. trigger: "blur"
  717. }
  718. ]
  719. },
  720. {
  721. label: "FOB系数",
  722. prop: "coefficient"
  723. },
  724. {
  725. label: "付款方式",
  726. prop: "paymentType"
  727. },
  728. {
  729. label: "包装要求",
  730. prop: "packageRemarks"
  731. }
  732. ]
  733. },
  734. basicData: {
  735. column: [
  736. {
  737. label: "编码",
  738. prop: "code",
  739. rules: [
  740. {
  741. required: true,
  742. message: " ",
  743. trigger: "blur"
  744. }
  745. ]
  746. },
  747. {
  748. label: "名称",
  749. prop: "cname",
  750. rules: [
  751. {
  752. required: true,
  753. message: " ",
  754. trigger: "blur"
  755. }
  756. ]
  757. },
  758. {
  759. label: "简称",
  760. prop: "shortName"
  761. },
  762. {
  763. label: "类别",
  764. prop: "corpsTypeId",
  765. rules: [
  766. {
  767. required: true,
  768. message: " ",
  769. trigger: "blur"
  770. }
  771. ]
  772. },
  773. {
  774. label: "企业类型",
  775. prop: "companytype",
  776. rules: [
  777. {
  778. required: false,
  779. message: " ",
  780. trigger: "blur"
  781. }
  782. ]
  783. },
  784. {
  785. label: "代理品牌",
  786. prop: "goodtypes",
  787. rules: [
  788. {
  789. required: false,
  790. message: " ",
  791. trigger: "blur"
  792. }
  793. ]
  794. },
  795. {
  796. label: "所属公司",
  797. prop: "belongtocompany",
  798. rules: [
  799. {
  800. required: false,
  801. message: " ",
  802. trigger: "blur"
  803. }
  804. ]
  805. },
  806. {
  807. label: "分管员",
  808. prop: "adminProfiles",
  809. span: 8
  810. },
  811. {
  812. label: "代理区域",
  813. prop: "belongtoarea",
  814. span: 8,
  815. mock: {
  816. type: "county"
  817. }
  818. },
  819. {
  820. label: "信用等级",
  821. prop: "creditRating",
  822. span: 8
  823. },
  824. {
  825. label: "代理商编码",
  826. prop: "agentCode",
  827. span: 8
  828. },
  829. // {
  830. // label: "总返利",
  831. // prop: "profitReturn",
  832. // disabled: true,
  833. // span: 8
  834. // },
  835. // {
  836. // label: "已用返利",
  837. // prop: "usedProfit",
  838. // disabled: true,
  839. // span: 8
  840. // },
  841. // {
  842. // label: "可用返利",
  843. // prop: "surplusProfit",
  844. // disabled: false,
  845. // span: 8
  846. // },
  847. // {
  848. // label: "可用返利",
  849. // prop: "monthProfit",
  850. // disabled: true,
  851. // span: 8
  852. // },
  853. {
  854. label: "备注",
  855. prop: "remarks",
  856. span: 24,
  857. mock: {
  858. type: "county"
  859. }
  860. }
  861. ]
  862. },
  863. paymentOption: [],
  864. addressOption: {},
  865. addressForm: {},
  866. addressData: [],
  867. formRow: {},
  868. // 包装要求
  869. packageOptions: [],
  870. props: {
  871. value: "name",
  872. label: "name",
  873. multiple: true
  874. },
  875. addressLatLng: []
  876. };
  877. },
  878. props: {
  879. detailData: {
  880. type: Object
  881. }
  882. },
  883. components: {
  884. flowDialog
  885. },
  886. async created() {
  887. this.customerContact = await this.getColumnData(
  888. this.getColumnName(143),
  889. customerContact
  890. );
  891. this.bankOfDeposit = await this.getColumnData(
  892. this.getColumnName(144),
  893. bankOfDeposit
  894. );
  895. this.addressOption = await this.getColumnData(
  896. this.getColumnName(145),
  897. addressOption
  898. );
  899. if (!website.tenantMode) {
  900. this.initData(website.tenantId);
  901. } else {
  902. this.initData();
  903. }
  904. if (this.$store.getters.userInfo.tenant_id === "096359") {
  905. let list = ["profitReturn", "usedProfit", "surplusProfit", "monthProfit"];
  906. for (let item in list) {
  907. for (let i in this.basicData.column) {
  908. if (list[item] == this.basicData.column[i].prop) {
  909. this.basicData.column.splice(i, 1);
  910. }
  911. }
  912. }
  913. }
  914. corpstypeTree({ corpType: customerParameter.code }).then(res => {
  915. this.dic = res.data.data;
  916. });
  917. areaTypeTree().then(res => {
  918. this.dicArea = res.data.data;
  919. });
  920. this.getWorkDicts("packageRemarks").then(res => {
  921. this.packageOptions = res.data.data;
  922. });
  923. this.getWorkDicts("payment_term").then(res => {
  924. this.paymentOption = res.data.data;
  925. });
  926. this.getWorkDicts("credit_rating").then(res => {
  927. this.creditRatingList = res.data.data;
  928. });
  929. if (this.detailData.id) {
  930. detail(this.detailData.id).then(res => {
  931. if (res.data.data.adminProfiles) {
  932. res.data.data.adminProfiles = res.data.data.adminProfiles.split(",");
  933. }
  934. this.form = res.data.data;
  935. this.contactsData = this.form.corpsAttnList;
  936. this.bankOfDepositData = this.form.corpsBankList;
  937. this.advantageProjectData = this.form.corpsItems;
  938. this.addressLatLng = JSON.parse(this.form.addressLatLng);
  939. this.addressData = this.form.corpsAddrList;
  940. if (this.form.belongtoarea) {
  941. this.form.belongtoarea = this.form.belongtoarea
  942. .split(",")
  943. .map(item => item.split("/"));
  944. }
  945. delete this.form.corpsAttnList;
  946. delete this.form.corpsBankList;
  947. delete this.form.corpsItems;
  948. delete this.form.corpsAddrList;
  949. });
  950. } else if (this.detailData.treeDeptId) {
  951. this.$set(this.form, "corpsTypeId", this.detailData.treeDeptId);
  952. }
  953. gainUser().then(res => {
  954. this.userList = res.data.data;
  955. });
  956. this.getWorkDicts("currency").then(res => {
  957. this.findObject(this.bankOfDeposit.column, "fcyno").dicData =
  958. res.data.data;
  959. });
  960. },
  961. methods: {
  962. initData(tenantId) {
  963. getRoleTree(tenantId).then(res => {
  964. const column = this.findObject(this.optionData.column, "roleId");
  965. column.dicData = res.data.data;
  966. });
  967. getDeptTree(tenantId).then(res => {
  968. const column = this.findObject(this.optionData.column, "deptId");
  969. column.dicData = res.data.data;
  970. });
  971. getPostList(tenantId).then(res => {
  972. const column = this.findObject(this.optionData.column, "postId");
  973. column.dicData = res.data.data;
  974. });
  975. },
  976. addressChange() {
  977. this.addressLatLng = [];
  978. this.form.belongtoarea.forEach(e => {
  979. if (e.length == 1) {
  980. this.dicArea.forEach(item1 => {
  981. if (item1.provinceName == e[0]) {
  982. this.addressLatLng.push({
  983. name: item1.provinceName,
  984. value: this.addressLatLng.length + 1,
  985. lng: item1.lng,
  986. lat: item1.lat,
  987. zoom: 1
  988. });
  989. }
  990. });
  991. } else if (e.length == 3) {
  992. this.dicArea.forEach(item1 => {
  993. if (item1.provinceName == e[0]) {
  994. if (item1.children.length > 0) {
  995. item1.children.forEach(item2 => {
  996. if (item2.cityName == e[1]) {
  997. if (e[0] == e[1]) {
  998. if (item2.children.length > 0) {
  999. item2.children.forEach(item3 => {
  1000. if (item3.districtName == e[2]) {
  1001. this.addressLatLng.push({
  1002. name: item3.districtName,
  1003. value: this.addressLatLng.length + 1,
  1004. lng: item3.lng,
  1005. lat: item3.lat,
  1006. zoom: 1
  1007. });
  1008. }
  1009. });
  1010. }
  1011. } else if (e[0] != e[1]) {
  1012. this.addressLatLng.push({
  1013. name: item2.cityName,
  1014. value: this.addressLatLng.length + 1,
  1015. lng: item2.lng,
  1016. lat: item2.lat,
  1017. zoom: 1
  1018. });
  1019. }
  1020. }
  1021. });
  1022. }
  1023. }
  1024. });
  1025. }
  1026. });
  1027. this.addressLatLng = this.addressLatLng.filter(
  1028. (currentValue, currentIndex, selfArr) => {
  1029. return (
  1030. selfArr.findIndex(x => x.name === currentValue.name) ===
  1031. currentIndex
  1032. );
  1033. }
  1034. );
  1035. },
  1036. //确认创建用户
  1037. confirmSynchronizationTwo() {
  1038. this.$refs["formDataTwo"].validate((valid, done) => {
  1039. done();
  1040. if (valid) {
  1041. let data = JSON.parse(JSON.stringify(this.formDataTwo));
  1042. data.deptId = data.deptId.join(",");
  1043. data.roleId = data.roleId.join(",");
  1044. data.postId = data.postId.join(",");
  1045. creatingUsers({
  1046. ...data,
  1047. id: this.formRow.id
  1048. }).then(res => {
  1049. this.dialogVisibleBt = false;
  1050. this.$message.success(
  1051. "创建用户成功,默认帐号:手机号。默认密码:123456"
  1052. );
  1053. });
  1054. } else {
  1055. return false;
  1056. }
  1057. });
  1058. },
  1059. creatingUsers(row) {
  1060. if (row.id) {
  1061. if (row.tel) {
  1062. this.dialogVisibleBt = true;
  1063. this.formDataTwo = {};
  1064. this.formRow = row;
  1065. } else {
  1066. this.$message.error("请输入手机号");
  1067. }
  1068. } else {
  1069. this.$message.error("请保存数据后再点击");
  1070. }
  1071. },
  1072. //新增客户联系人保存触发
  1073. rowSave(row, done, loading) {
  1074. console.log(row, done, loading);
  1075. this.contactsData.push(row);
  1076. done();
  1077. },
  1078. //修改客户联系人触发
  1079. rowUpdate(row, index, done, loading) {
  1080. done(row);
  1081. },
  1082. //删除客户联系人触发
  1083. rowDel(row, index, donerowDel) {
  1084. this.$confirm("确定将选择数据删除?", {
  1085. confirmButtonText: "确定",
  1086. cancelButtonText: "取消",
  1087. type: "warning"
  1088. }).then(() => {
  1089. // 数据回调进行刷新
  1090. if (row.id) {
  1091. corpsattn(row.id).then(res => {
  1092. this.$message({
  1093. type: "success",
  1094. message: "操作成功!"
  1095. });
  1096. this.contactsData.splice(index, 1);
  1097. });
  1098. } else {
  1099. this.$message({
  1100. type: "success",
  1101. message: "操作成功!"
  1102. });
  1103. this.contactsData.splice(index, 1);
  1104. }
  1105. });
  1106. },
  1107. //新增客户优势项目保存触发
  1108. rowSaveProject(row, done, loading) {
  1109. console.log(row, done, loading);
  1110. this.advantageProjectData.push(row);
  1111. done();
  1112. },
  1113. //修改客户优势项目触发
  1114. rowUpdateProject(row, index, done, loading) {
  1115. done(row);
  1116. },
  1117. //删除客户优势项目触发
  1118. rowDelProject(row, index, donerowDel) {
  1119. this.$confirm("确定将选择数据删除?", {
  1120. confirmButtonText: "确定",
  1121. cancelButtonText: "取消",
  1122. type: "warning"
  1123. }).then(() => {
  1124. if (row.id) {
  1125. corpsitem(row.id).then(res => {
  1126. this.$message({
  1127. type: "success",
  1128. message: "操作成功!"
  1129. });
  1130. this.advantageProjectData.splice(index, 1);
  1131. });
  1132. } else {
  1133. this.$message({
  1134. type: "success",
  1135. message: "操作成功!"
  1136. });
  1137. this.advantageProjectData.splice(index, 1);
  1138. }
  1139. });
  1140. },
  1141. //新增客户优势项目保存触发
  1142. rowSaveBankOfDeposit(row, done, loading) {
  1143. console.log(row, done, loading);
  1144. this.bankOfDepositData.push(row);
  1145. done();
  1146. },
  1147. //修改客户优势项目触发
  1148. rowUpdateBankOfDeposit(row, index, done, loading) {
  1149. done(row);
  1150. },
  1151. //删除客户优势项目触发
  1152. rowDelBankOfDeposit(row, index, donerowDel) {
  1153. this.$confirm("确定将选择数据删除?", {
  1154. confirmButtonText: "确定",
  1155. cancelButtonText: "取消",
  1156. type: "warning"
  1157. }).then(() => {
  1158. if (row.id) {
  1159. corpsbank(row.id).then(res => {
  1160. this.$message({
  1161. type: "success",
  1162. message: "操作成功!"
  1163. });
  1164. this.bankOfDepositData.splice(index, 1);
  1165. });
  1166. } else {
  1167. this.$message({
  1168. type: "success",
  1169. message: "操作成功!"
  1170. });
  1171. this.bankOfDepositData.splice(index, 1);
  1172. }
  1173. });
  1174. },
  1175. //新增收发货地址保存触发
  1176. rowSaveAddress(row, done, loading) {
  1177. this.addressData.push(row);
  1178. done();
  1179. },
  1180. //修改收发货地址优势项目触发
  1181. rowUpdateAddress(row, index, done, loading) {
  1182. done(row);
  1183. },
  1184. //删除收发货地址优势项目触发
  1185. rowDelAddress(row, index, donerowDel) {
  1186. this.$confirm("确定将选择数据删除?", {
  1187. confirmButtonText: "确定",
  1188. cancelButtonText: "取消",
  1189. type: "warning"
  1190. }).then(() => {
  1191. if (row.id) {
  1192. corpsAddrDelete(row.id).then(res => {
  1193. this.$message({
  1194. type: "success",
  1195. message: "操作成功!"
  1196. });
  1197. this.addressData.splice(index, 1);
  1198. });
  1199. } else {
  1200. this.$message({
  1201. type: "success",
  1202. message: "操作成功!"
  1203. });
  1204. this.addressData.splice(index, 1);
  1205. }
  1206. });
  1207. },
  1208. //修改提交触发
  1209. editCustomer() {
  1210. this.$refs["form"].validate(valid => {
  1211. if (valid) {
  1212. this.form.corpsAttnList = this.contactsData;
  1213. this.form.corpsBankList = this.bankOfDepositData;
  1214. this.form.corpsItems = this.advantageProjectData;
  1215. this.form.corpsAddrList = this.addressData;
  1216. this.form.addressLatLng = JSON.stringify(this.addressLatLng);
  1217. if (typeof this.form.corpsTypeId == "object") {
  1218. this.form.corpsTypeId = this.form.corpsTypeId.join(",");
  1219. }
  1220. this.disabled = true;
  1221. if (this.form.belongtoarea) {
  1222. // this.form.belongtoarea = this.form.belongtoarea.toString();
  1223. this.form.belongtoarea = this.form.belongtoarea
  1224. .map(e => e.join("/"))
  1225. .join(",");
  1226. }
  1227. if (this.form.adminProfiles) {
  1228. this.form.adminProfiles = this.form.adminProfiles.join(",");
  1229. }
  1230. this.form.corpType = customerParameter.code;
  1231. typeSave(this.form).then(res => {
  1232. if (res.data.data === "error") {
  1233. this.disabled = false;
  1234. this.$message({
  1235. showClose: true,
  1236. message: res.data.msg,
  1237. type: "error"
  1238. });
  1239. } else {
  1240. this.$message({
  1241. type: "success",
  1242. message: this.form.id ? "修改成功!" : "新增成功!"
  1243. });
  1244. if (res.data.data.adminProfiles) {
  1245. res.data.data.adminProfiles = res.data.data.adminProfiles.split(
  1246. ","
  1247. );
  1248. }
  1249. this.form = res.data.data;
  1250. this.contactsData = res.data.data.corpsAttnList;
  1251. if (this.form.belongtoarea) {
  1252. this.form.belongtoarea = this.form.belongtoarea
  1253. .split(",")
  1254. .map(item => item.split("/"));
  1255. }
  1256. this.disabled = false;
  1257. }
  1258. });
  1259. } else {
  1260. return false;
  1261. }
  1262. });
  1263. },
  1264. synchronization() {
  1265. this.dialogVisible = true;
  1266. },
  1267. async saveColumn() {
  1268. const inSave = await this.saveColumnData(
  1269. this.getColumnName(143),
  1270. this.customerContact
  1271. );
  1272. if (inSave) {
  1273. this.$nextTick(() => {
  1274. this.$refs.crud.doLayout();
  1275. });
  1276. this.$message.success("保存成功");
  1277. //关闭窗口
  1278. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  1279. }
  1280. },
  1281. async resetColumn() {
  1282. this.customerContact = customerContact;
  1283. const inSave = await this.delColumnData(
  1284. this.getColumnName(143),
  1285. customerContact
  1286. );
  1287. if (inSave) {
  1288. this.$nextTick(() => {
  1289. this.$refs.crud.doLayout();
  1290. });
  1291. this.$message.success("重置成功");
  1292. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  1293. }
  1294. },
  1295. async saveColumn2() {
  1296. const inSave = await this.saveColumnData(
  1297. this.getColumnName(144),
  1298. this.bankOfDeposit
  1299. );
  1300. if (inSave) {
  1301. this.$nextTick(() => {
  1302. this.$refs.crud2.doLayout();
  1303. });
  1304. this.$message.success("保存成功");
  1305. //关闭窗口
  1306. this.$refs.crud2.$refs.dialogColumn.columnBox = false;
  1307. }
  1308. },
  1309. async resetColumn2() {
  1310. this.bankOfDeposit = bankOfDeposit;
  1311. const inSave = await this.delColumnData(
  1312. this.getColumnName(144),
  1313. bankOfDeposit
  1314. );
  1315. if (inSave) {
  1316. this.$nextTick(() => {
  1317. this.$refs.crud2.doLayout();
  1318. });
  1319. this.$message.success("重置成功");
  1320. this.$refs.crud2.$refs.dialogColumn.columnBox = false;
  1321. }
  1322. },
  1323. async saveColumn3() {
  1324. const inSave = await this.saveColumnData(
  1325. this.getColumnName(145),
  1326. this.addressOption
  1327. );
  1328. if (inSave) {
  1329. this.$nextTick(() => {
  1330. this.$refs.crud3.doLayout();
  1331. });
  1332. this.$message.success("保存成功");
  1333. //关闭窗口
  1334. this.$refs.crud3.$refs.dialogColumn.columnBox = false;
  1335. }
  1336. },
  1337. async resetColumn3() {
  1338. this.addressOption = addressOption;
  1339. const inSave = await this.delColumnData(
  1340. this.getColumnName(145),
  1341. addressOption
  1342. );
  1343. if (inSave) {
  1344. this.$nextTick(() => {
  1345. this.$refs.crud3.doLayout();
  1346. });
  1347. this.$message.success("重置成功");
  1348. this.$refs.crud3.$refs.dialogColumn.columnBox = false;
  1349. }
  1350. },
  1351. //确认同步
  1352. confirmSynchronization() {
  1353. this.$refs["formData"].validate((valid, done) => {
  1354. if (valid) {
  1355. synchronizationCopy({
  1356. ...this.formData,
  1357. id: this.form.id
  1358. }).then(res => {
  1359. done();
  1360. this.$message.success("同步成功");
  1361. this.dialogVisible = false;
  1362. });
  1363. } else {
  1364. return done();
  1365. }
  1366. });
  1367. },
  1368. backToList() {
  1369. this.$emit("goBack");
  1370. },
  1371. openFlow() {
  1372. this.switchDialog = !this.switchDialog;
  1373. },
  1374. onClose(val) {
  1375. this.switchDialog = val;
  1376. },
  1377. getCorpName(row) {}
  1378. }
  1379. };
  1380. </script>
  1381. <style lang="scss" scoped>
  1382. ::v-deep .el-form-item {
  1383. margin-bottom: 0;
  1384. }
  1385. ::v-deep .el-form-item__content {
  1386. line-height: 32px;
  1387. }
  1388. </style>