detailsPageEdit.vue 22 KB

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