detailsPageEdit.vue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790
  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 type="primary" @click="openFlow" size="small"
  16. >审 核
  17. </el-button>
  18. <el-button
  19. type="primary"
  20. :disabled="disabled"
  21. @click="editCustomer"
  22. size="small"
  23. >{{ form.id ? "确认修改" : "确认新增" }}
  24. </el-button>
  25. </div>
  26. </div>
  27. <div class="customer-main">
  28. <el-form
  29. :model="form"
  30. ref="form"
  31. label-width="100px"
  32. class="demo-ruleForm"
  33. >
  34. <containerTitle title="基础资料"></containerTitle>
  35. <basic-container>
  36. <el-row>
  37. <el-col
  38. v-for="(item, index) in basicData.column"
  39. :key="index"
  40. :span="item.span ? item.span : 8"
  41. >
  42. <el-form-item
  43. :label="item.label"
  44. :prop="item.prop"
  45. :rules="item.rules"
  46. >
  47. <avue-input-tree
  48. v-if="item.prop === 'corpsTypeId'"
  49. leaf-only
  50. multiple
  51. style="width: 100%;"
  52. size="small"
  53. :props="{ label: 'title' }"
  54. v-model="form[item.prop]"
  55. placeholder=" "
  56. type="tree"
  57. :dic="dic"
  58. ></avue-input-tree>
  59. <el-cascader
  60. v-else-if="item.prop === 'belongtoarea'"
  61. v-model="form[item.prop]"
  62. collapse-tags
  63. :options="dicArea"
  64. :props="props"
  65. size="small"
  66. style="width: 100%;"
  67. :show-all-levels="false"
  68. ></el-cascader>
  69. <el-select
  70. v-else-if="item.prop === 'adminProfiles'"
  71. size="small"
  72. style="width: 100%;"
  73. v-model="form[item.prop]"
  74. multiple
  75. placeholder=""
  76. >
  77. <el-option
  78. v-for="item in userList"
  79. :key="item.id"
  80. :label="item.name"
  81. :value="item.id"
  82. >
  83. </el-option>
  84. </el-select>
  85. <el-input
  86. type="age"
  87. v-else
  88. v-model="form[item.prop]"
  89. size="small"
  90. autocomplete="off"
  91. ></el-input>
  92. </el-form-item>
  93. </el-col>
  94. </el-row>
  95. </basic-container>
  96. <containerTitle title="联系方式"></containerTitle>
  97. <basic-container>
  98. <el-row>
  99. <el-col
  100. v-for="(item, index) in contactInformation.column"
  101. :key="index"
  102. :span="item.span ? item.span : 8"
  103. >
  104. <el-form-item
  105. :label="item.label"
  106. :prop="item.prop"
  107. :rules="item.rules"
  108. >
  109. <el-input
  110. type="age"
  111. v-model="form[item.prop]"
  112. size="small"
  113. autocomplete="off"
  114. ></el-input>
  115. </el-form-item>
  116. </el-col>
  117. </el-row>
  118. </basic-container>
  119. <containerTitle title="财务资料"></containerTitle>
  120. <basic-container>
  121. <el-row>
  122. <el-col
  123. v-for="(item, index) in financialInformation.column"
  124. :key="index"
  125. :span="item.span ? item.span : 8"
  126. >
  127. <el-form-item
  128. :label="item.label"
  129. :prop="item.prop"
  130. :rules="item.rules"
  131. >
  132. <el-switch
  133. v-if="item.prop === 'creditstatus'"
  134. v-model="form[item.prop]"
  135. active-value="0"
  136. inactive-value="1"
  137. active-text="开启"
  138. inactive-text="关闭"
  139. >
  140. </el-switch>
  141. <el-select
  142. v-else-if="item.prop === 'paymentType'"
  143. v-model="form[item.prop]"
  144. clearable
  145. filterable
  146. size="small"
  147. style="width: 100%;"
  148. >
  149. <el-option
  150. v-for="(item, index) in paymentOption"
  151. :key="index"
  152. :label="item.dictValue"
  153. :value="item.dictValue"
  154. ></el-option>
  155. </el-select>
  156. <el-input
  157. v-else
  158. type="age"
  159. v-model="form[item.prop]"
  160. size="small"
  161. autocomplete="off"
  162. ></el-input>
  163. </el-form-item>
  164. </el-col>
  165. </el-row>
  166. </basic-container>
  167. <containerTitle title="客户联系人"></containerTitle>
  168. <basic-container>
  169. <avue-crud
  170. :option="customerContact"
  171. v-model="contactsForm"
  172. :data="contactsData"
  173. @row-save="rowSave"
  174. @row-update="rowUpdate"
  175. @row-del="rowDel"
  176. ></avue-crud>
  177. </basic-container>
  178. <!-- <containerTitle title="客户优势项目"></containerTitle>
  179. <basic-container style="margin-bottom: 10px">
  180. <avue-crud
  181. :option="advantageProject"
  182. v-model="advantageProjectForm"
  183. :data="advantageProjectData"
  184. @row-save="rowSaveProject"
  185. @row-update="rowUpdateProject"
  186. @row-del="rowDelProject"
  187. ></avue-crud>
  188. </basic-container> -->
  189. <containerTitle title="客户开户行"></containerTitle>
  190. <basic-container>
  191. <avue-crud
  192. :option="bankOfDeposit"
  193. v-model="bankOfDepositForm"
  194. :data="bankOfDepositData"
  195. @row-save="rowSaveBankOfDeposit"
  196. @row-update="rowUpdateBankOfDeposit"
  197. @row-del="rowDelBankOfDeposit"
  198. ></avue-crud>
  199. </basic-container>
  200. <containerTitle title="收发货地址"></containerTitle>
  201. <basic-container>
  202. <avue-crud
  203. :option="addressOption"
  204. v-model="addressForm"
  205. :data="addressData"
  206. @row-save="rowSaveAddress"
  207. @row-update="rowUpdateAddress"
  208. @row-del="rowDelAddress"
  209. ></avue-crud>
  210. </basic-container>
  211. </el-form>
  212. </div>
  213. <flow-dialog :switchDialog="switchDialog" @onClose="onClose()">
  214. <template slot="content"> </template>
  215. </flow-dialog>
  216. </div>
  217. </template>
  218. <script>
  219. import {
  220. customerList,
  221. typeSave,
  222. detail,
  223. deleteDetails,
  224. corpstypeTree,
  225. corpsattn,
  226. corpsbank,
  227. corpsfiles,
  228. corpsitem,
  229. areaTypeTree,
  230. corpsAddrDelete
  231. } from "@/api/basicData/customerInformation";
  232. import customerContact from "./configuration/customerContact.json";
  233. import advantageProject from "./configuration/advantageProject.json";
  234. import bankOfDeposit from "./configuration/bankOfDeposit.json";
  235. import flowDialog from "@/components/flow-dialog/main";
  236. import { companyParameter } from "@/enums/management-type";
  237. import { gainUser } from "@/api/basicData/customerInquiry";
  238. import addressOption from "./configuration/addressOption.json";
  239. export default {
  240. name: "detailsPage",
  241. data() {
  242. return {
  243. switchDialog: false,
  244. form: {},
  245. disabled: false,
  246. contactsForm: {},
  247. advantageProjectForm: {},
  248. bankOfDepositForm: {},
  249. contactsData: [],
  250. advantageProjectData: [],
  251. bankOfDepositData: [],
  252. dic: [],
  253. dicArea: [],
  254. props: {
  255. value: 'name',
  256. label: 'name',
  257. multiple: true,
  258. },
  259. customerContact: customerContact,
  260. advantageProject: advantageProject,
  261. bankOfDeposit: bankOfDeposit,
  262. contactInformation: {
  263. column: [
  264. {
  265. label: "联系人",
  266. prop: "attn",
  267. rules: [
  268. {
  269. required: false,
  270. message: "请输入联系人",
  271. trigger: "blur"
  272. }
  273. ]
  274. },
  275. {
  276. label: "联系电话",
  277. prop: "tel",
  278. rules: [
  279. {
  280. required: false,
  281. message: "请输入联系电话",
  282. trigger: "blur"
  283. }
  284. ]
  285. },
  286. {
  287. label: "职位",
  288. prop: "position",
  289. rules: [
  290. {
  291. required: false,
  292. message: "请输入联系电话",
  293. trigger: "blur"
  294. }
  295. ]
  296. },
  297. {
  298. label: "单位地址",
  299. prop: "addr",
  300. rules: [
  301. {
  302. required: false,
  303. message: "请输入单位地址",
  304. trigger: "blur"
  305. }
  306. ]
  307. },
  308. {
  309. label: "仓库地址",
  310. prop: "storageAddr",
  311. rules: [
  312. {
  313. required: false,
  314. message: "请输入仓库地址",
  315. trigger: "blur"
  316. }
  317. ]
  318. },
  319. {
  320. label: "分仓地址",
  321. prop: "subStorageAddr",
  322. rules: [
  323. {
  324. required: false,
  325. message: "请输入分仓地址",
  326. trigger: "blur"
  327. }
  328. ]
  329. }
  330. ]
  331. },
  332. financialInformation: {
  333. column: [
  334. {
  335. label: "账户名称",
  336. prop: "accountName",
  337. rules: [
  338. {
  339. required: false,
  340. message: " ",
  341. trigger: "blur"
  342. }
  343. ]
  344. },
  345. {
  346. label: "开户银行",
  347. prop: "accountBank",
  348. rules: [
  349. {
  350. required: false,
  351. message: " ",
  352. trigger: "blur"
  353. }
  354. ]
  355. },
  356. {
  357. label: "银行帐号",
  358. prop: "accountNo",
  359. rules: [
  360. {
  361. required: false,
  362. message: " ",
  363. trigger: "blur"
  364. }
  365. ]
  366. },
  367. {
  368. label: "外币账户名称",
  369. prop: "accountNameFcy",
  370. rules: [
  371. {
  372. required: false,
  373. message: " ",
  374. trigger: "blur"
  375. }
  376. ]
  377. },
  378. {
  379. label: "外币开户银行",
  380. prop: "accountBankFcy",
  381. rules: [
  382. {
  383. required: false,
  384. message: " ",
  385. trigger: "blur"
  386. }
  387. ]
  388. },
  389. {
  390. label: "外币银行账号",
  391. prop: "accountNoFcy",
  392. rules: [
  393. {
  394. required: false,
  395. message: " ",
  396. trigger: "blur"
  397. }
  398. ]
  399. },
  400. {
  401. label: "授信状态",
  402. prop: "creditstatus",
  403. rules: [
  404. {
  405. required: false,
  406. message: " ",
  407. trigger: "blur"
  408. }
  409. ]
  410. },
  411. {
  412. label: "授信等级",
  413. prop: "creditLevel",
  414. rules: [
  415. {
  416. required: false,
  417. message: " ",
  418. trigger: "blur"
  419. }
  420. ]
  421. },
  422. {
  423. label: "授信额度",
  424. prop: "creditGrant",
  425. rules: [
  426. {
  427. required: false,
  428. message: " ",
  429. trigger: "blur"
  430. }
  431. ]
  432. },
  433. {
  434. label: "授信天数",
  435. prop: "creditDay",
  436. rules: [
  437. {
  438. required: false,
  439. message: " ",
  440. trigger: "blur"
  441. }
  442. ]
  443. },
  444. {
  445. label: "授信利率",
  446. prop: "creditRate",
  447. rules: [
  448. {
  449. required: false,
  450. message: " ",
  451. trigger: "blur"
  452. }
  453. ]
  454. },
  455. {
  456. label: "FOB系数",
  457. prop: "coefficient"
  458. },
  459. {
  460. label: "付款方式",
  461. prop: "paymentType"
  462. }
  463. ]
  464. },
  465. basicData: {
  466. column: [
  467. {
  468. label: "编码",
  469. prop: "code",
  470. rules: [
  471. {
  472. required: true,
  473. message: " ",
  474. trigger: "blur"
  475. }
  476. ]
  477. },
  478. {
  479. label: "名称",
  480. prop: "cname",
  481. rules: [
  482. {
  483. required: true,
  484. message: " ",
  485. trigger: "blur"
  486. }
  487. ]
  488. },
  489. {
  490. label: "类别",
  491. prop: "corpsTypeId",
  492. rules: [
  493. {
  494. required: true,
  495. message: " ",
  496. trigger: "blur"
  497. }
  498. ]
  499. },
  500. {
  501. label: "企业类型",
  502. prop: "companytype",
  503. rules: [
  504. {
  505. required: false,
  506. message: " ",
  507. trigger: "blur"
  508. }
  509. ]
  510. },
  511. {
  512. label: "代理品牌",
  513. prop: "goodtypes",
  514. rules: [
  515. {
  516. required: false,
  517. message: " ",
  518. trigger: "blur"
  519. }
  520. ]
  521. },
  522. {
  523. label: "分管员",
  524. prop: "adminProfiles",
  525. span: 8
  526. },
  527. {
  528. label: "代理区域",
  529. prop: "belongtoarea",
  530. span: 16,
  531. mock: {
  532. type: "county"
  533. }
  534. },
  535. {
  536. label: "备注",
  537. prop: "remarks",
  538. span: 24,
  539. mock: {
  540. type: "county"
  541. }
  542. }
  543. ]
  544. },
  545. paymentOption: [],
  546. addressOption: addressOption,
  547. addressForm: {},
  548. addressData: []
  549. };
  550. },
  551. props: {
  552. detailData: {
  553. type: Object
  554. }
  555. },
  556. components: {
  557. flowDialog
  558. },
  559. created() {
  560. corpstypeTree({ corpType: companyParameter.code }).then(res => {
  561. this.dic = res.data.data;
  562. });
  563. areaTypeTree().then(res => {
  564. this.dicArea = res.data.data;
  565. });
  566. this.getWorkDicts("payment_term").then(res => {
  567. this.paymentOption = res.data.data;
  568. });
  569. if (this.detailData.id) {
  570. detail(this.detailData.id).then(res => {
  571. if (res.data.data.adminProfiles) {
  572. res.data.data.adminProfiles = res.data.data.adminProfiles.split(",");
  573. }
  574. this.form = res.data.data;
  575. this.contactsData = this.form.corpsAttnList;
  576. this.bankOfDepositData = this.form.corpsBankList;
  577. this.advantageProjectData = this.form.corpsItems;
  578. if (this.form.belongtoarea) {
  579. this.form.belongtoarea = this.form.belongtoarea.split(',').map(item => item.split('/'));
  580. }
  581. delete this.form.corpsAttnList;
  582. delete this.form.corpsBankList;
  583. delete this.form.corpsItems;
  584. });
  585. } else if (this.detailData.treeDeptId) {
  586. this.$set(this.form, 'corpsTypeId', this.detailData.treeDeptId)
  587. }
  588. gainUser().then(res => {
  589. this.userList = res.data.data;
  590. });
  591. },
  592. methods: {
  593. //新增客户联系人保存触发
  594. rowSave(row, done, loading) {
  595. console.log(row, done, loading);
  596. this.contactsData.push(row);
  597. done();
  598. },
  599. //修改客户联系人触发
  600. rowUpdate(row, index, done, loading) {
  601. done(row);
  602. },
  603. //删除客户联系人触发
  604. rowDel(row, index, donerowDel) {
  605. this.$confirm("确定将选择数据删除?", {
  606. confirmButtonText: "确定",
  607. cancelButtonText: "取消",
  608. type: "warning"
  609. }).then(() => {
  610. // 数据回调进行刷新
  611. if (row.id) {
  612. corpsattn(row.id).then(res => {
  613. this.$message({
  614. type: "success",
  615. message: "操作成功!"
  616. });
  617. this.contactsData.splice(index, 1);
  618. });
  619. } else {
  620. this.$message({
  621. type: "success",
  622. message: "操作成功!"
  623. });
  624. this.contactsData.splice(index, 1);
  625. }
  626. });
  627. },
  628. //新增客户优势项目保存触发
  629. rowSaveProject(row, done, loading) {
  630. console.log(row, done, loading);
  631. this.advantageProjectData.push(row);
  632. done();
  633. },
  634. //修改客户优势项目触发
  635. rowUpdateProject(row, index, done, loading) {
  636. done(row);
  637. },
  638. //删除客户优势项目触发
  639. rowDelProject(row, index, donerowDel) {
  640. this.$confirm("确定将选择数据删除?", {
  641. confirmButtonText: "确定",
  642. cancelButtonText: "取消",
  643. type: "warning"
  644. }).then(() => {
  645. if (row.id) {
  646. corpsitem(row.id).then(res => {
  647. this.$message({
  648. type: "success",
  649. message: "操作成功!"
  650. });
  651. this.advantageProjectData.splice(index, 1);
  652. });
  653. } else {
  654. this.$message({
  655. type: "success",
  656. message: "操作成功!"
  657. });
  658. this.advantageProjectData.splice(index, 1);
  659. }
  660. });
  661. },
  662. //新增客户优势项目保存触发
  663. rowSaveBankOfDeposit(row, done, loading) {
  664. console.log(row, done, loading);
  665. this.bankOfDepositData.push(row);
  666. done();
  667. },
  668. //修改客户优势项目触发
  669. rowUpdateBankOfDeposit(row, index, done, loading) {
  670. done(row);
  671. },
  672. //删除客户优势项目触发
  673. rowDelBankOfDeposit(row, index, donerowDel) {
  674. this.$confirm("确定将选择数据删除?", {
  675. confirmButtonText: "确定",
  676. cancelButtonText: "取消",
  677. type: "warning"
  678. }).then(() => {
  679. if (row.id) {
  680. corpsbank(row.id).then(res => {
  681. this.$message({
  682. type: "success",
  683. message: "操作成功!"
  684. });
  685. this.bankOfDepositData.splice(index, 1);
  686. });
  687. } else {
  688. this.$message({
  689. type: "success",
  690. message: "操作成功!"
  691. });
  692. this.bankOfDepositData.splice(index, 1);
  693. }
  694. });
  695. },
  696. //修改提交触发
  697. editCustomer() {
  698. this.$refs["form"].validate(valid => {
  699. if (valid) {
  700. this.form.corpsAttnList = this.contactsData;
  701. this.form.corpsBankList = this.bankOfDepositData;
  702. this.form.corpsItems = this.advantageProjectData;
  703. if (typeof this.form.corpsTypeId == "object") {
  704. this.form.corpsTypeId = this.form.corpsTypeId.join(",");
  705. }
  706. this.disabled = true;
  707. if (this.form.belongtoarea) {
  708. this.form.belongtoarea = this.form.belongtoarea.map(e => e.join('/')).join(',')
  709. }
  710. if (this.form.adminProfiles) {
  711. this.form.adminProfiles = this.form.adminProfiles.join(",");
  712. }
  713. this.form.corpType = companyParameter.code;
  714. typeSave(this.form).then(res => {
  715. if (res.data.data === "error") {
  716. this.disabled = false;
  717. this.$message({
  718. showClose: true,
  719. message: res.data.msg,
  720. type: "error"
  721. });
  722. } else {
  723. this.$message({
  724. type: "success",
  725. message: this.form.id ? "修改成功!" : "新增成功!"
  726. });
  727. this.form = res.data.data
  728. if (this.form.belongtoarea) {
  729. this.form.belongtoarea = this.form.belongtoarea.split(',').map(item => item.split('/'));
  730. }
  731. this.disabled = false;
  732. }
  733. });
  734. } else {
  735. return false;
  736. }
  737. });
  738. },
  739. backToList() {
  740. this.$emit("goBack");
  741. },
  742. openFlow() {
  743. this.switchDialog = !this.switchDialog;
  744. },
  745. onClose(val) {
  746. this.switchDialog = val;
  747. },
  748. //新增收发货地址保存触发
  749. rowSaveAddress(row, done, loading) {
  750. this.addressData.push(row);
  751. done();
  752. },
  753. //修改收发货地址优势项目触发
  754. rowUpdateAddress(row, index, done, loading) {
  755. done(row);
  756. },
  757. //删除收发货地址优势项目触发
  758. rowDelAddress(row, index, donerowDel) {
  759. this.$confirm("确定将选择数据删除?", {
  760. confirmButtonText: "确定",
  761. cancelButtonText: "取消",
  762. type: "warning"
  763. }).then(() => {
  764. if (row.id) {
  765. corpsAddrDelete(row.id).then(res => {
  766. this.$message({
  767. type: "success",
  768. message: "操作成功!"
  769. });
  770. this.addressData.splice(index, 1);
  771. });
  772. } else {
  773. this.$message({
  774. type: "success",
  775. message: "操作成功!"
  776. });
  777. this.addressData.splice(index, 1);
  778. }
  779. });
  780. }
  781. }
  782. };
  783. </script>
  784. <style lang="scss" scoped>
  785. ::v-deep .el-form-item {
  786. margin-bottom: 0;
  787. }
  788. </style>