detailsPageEdit.vue 40 KB

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