detailsPage.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573
  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. <el-button
  11. class="el-button--small-yh add-customer-btn"
  12. type="primary"
  13. @click="editCustomer"
  14. >{{form.id?'确认修改':'确认新增'}}
  15. </el-button>
  16. </div>
  17. <div style="margin-top: 60px">
  18. <el-form :model="form" ref="form" label-width="100px" class="demo-ruleForm">
  19. <containerTitle title="基础资料"></containerTitle>
  20. <basic-container style="margin-bottom: 10px">
  21. <el-row>
  22. <el-col v-for="item in basicData.column" :span="item.span?item.span:8">
  23. <el-form-item :label="item.label" :prop="item.prop" :rules="item.rules">
  24. <avue-input-tree disabled v-if="item.prop === 'companytype'" leaf-only multiple :props="{label:'title'}" v-model="form[item.prop]" placeholder="请选择内容" type="tree" :dic="dic"></avue-input-tree>
  25. <el-input type="age" disabled v-else v-model="form[item.prop]" size="small" autocomplete="off"></el-input>
  26. </el-form-item>
  27. </el-col>
  28. </el-row>
  29. </basic-container>
  30. <containerTitle title="联系方式"></containerTitle>
  31. <basic-container style="margin-bottom: 10px">
  32. <el-row>
  33. <el-col v-for="item in contactInformation.column" :span="item.span?item.span:8">
  34. <el-form-item :label="item.label" :prop="item.prop" :rules="item.rules">
  35. <el-input type="age" disabled v-model="form[item.prop]" size="small" autocomplete="off"></el-input>
  36. </el-form-item>
  37. </el-col>
  38. </el-row>
  39. </basic-container>
  40. <containerTitle title="财务资料"></containerTitle>
  41. <basic-container style="margin-bottom: 10px">
  42. <el-row>
  43. <el-col v-for="item in financialInformation.column" :span="item.span?item.span:8">
  44. <el-form-item :label="item.label" :prop="item.prop" :rules="item.rules">
  45. <el-switch
  46. disabled
  47. v-if="item.prop === 'creditstatus'"
  48. v-model="form[item.prop]"
  49. active-text="开启"
  50. inactive-text="关闭">
  51. </el-switch>
  52. <el-input v-else type="age" disabled v-model="form[item.prop]" size="small" autocomplete="off"></el-input>
  53. </el-form-item>
  54. </el-col>
  55. </el-row>
  56. </basic-container>
  57. <containerTitle title="客户联系人"></containerTitle>
  58. <basic-container style="margin-bottom: 10px">
  59. <avue-crud
  60. :option="customerContact"
  61. v-model="contactsForm"
  62. :data="contactsData"
  63. @row-save="rowSave"
  64. @row-update="rowUpdate"
  65. @row-del="rowDel"
  66. ></avue-crud>
  67. </basic-container>
  68. <containerTitle title="客户优势项目"></containerTitle>
  69. <basic-container style="margin-bottom: 10px">
  70. <avue-crud
  71. :option="advantageProject"
  72. v-model="advantageProjectForm"
  73. :data="advantageProjectData"
  74. @row-save="rowSaveProject"
  75. @row-update="rowUpdateProject"
  76. @row-del="rowDelProject"
  77. ></avue-crud>
  78. </basic-container>
  79. <containerTitle title="客户开户行"></containerTitle>
  80. <basic-container style="margin-bottom: 40px">
  81. <avue-crud
  82. :option="bankOfDeposit"
  83. v-model="bankOfDepositForm"
  84. :data="bankOfDepositData"
  85. @row-save="rowSaveBankOfDeposit"
  86. @row-update="rowUpdateBankOfDeposit"
  87. @row-del="rowDelBankOfDeposit"
  88. ></avue-crud>
  89. </basic-container>
  90. </el-form>
  91. </div>
  92. </div>
  93. </template>
  94. <script>
  95. import {customerList, typeSave, detail, deleteDetails,
  96. corpstypeTree,
  97. corpsattn,
  98. corpsbank,
  99. corpsfiles,
  100. corpsitem} from "@/api/basicData/customerInformation"
  101. import customerContact from "./configuration/customerContact.json"
  102. import advantageProject from "./configuration/advantageProject.json"
  103. import bankOfDeposit from "./configuration/bankOfDeposit.json"
  104. export default {
  105. name: "detailsPage",
  106. data() {
  107. return {
  108. form: {},
  109. contactsForm: {},
  110. advantageProjectForm: {},
  111. bankOfDepositForm: {},
  112. contactsData: [],
  113. advantageProjectData: [],
  114. bankOfDepositData: [],
  115. dic:[],
  116. customerContact:customerContact,
  117. advantageProject:advantageProject,
  118. bankOfDeposit:bankOfDeposit,
  119. contactInformation: {
  120. column: [
  121. {
  122. label: '联系人',
  123. prop: 'attn',
  124. rules: [
  125. {
  126. required: false,
  127. message: '请输入联系人',
  128. trigger: 'blur'
  129. }
  130. ]
  131. }, {
  132. label: '联系电话',
  133. prop: 'tel',
  134. rules: [
  135. {
  136. required: false,
  137. message: '请输入联系电话',
  138. trigger: 'blur'
  139. }
  140. ]
  141. }, {
  142. label: '职位',
  143. prop: 'positoin',
  144. rules: [
  145. {
  146. required: false,
  147. message: '请输入联系电话',
  148. trigger: 'blur'
  149. }
  150. ]
  151. }, {
  152. label: '单位地址',
  153. prop: 'addr',
  154. rules: [
  155. {
  156. required: false,
  157. message: '请输入单位地址',
  158. trigger: 'blur'
  159. }
  160. ]
  161. }, {
  162. label: '仓库地址',
  163. prop: 'storageAddr',
  164. rules: [
  165. {
  166. required: false,
  167. message: '请输入仓库地址',
  168. trigger: 'blur'
  169. }
  170. ]
  171. }, {
  172. label: '分仓地址',
  173. prop: 'subStorageAddr',
  174. rules: [
  175. {
  176. required: false,
  177. message: '请输入分仓地址',
  178. trigger: 'blur'
  179. }
  180. ]
  181. }
  182. ]
  183. },
  184. financialInformation: {
  185. column: [
  186. {
  187. label: '账户名称',
  188. prop: 'accountName',
  189. rules: [
  190. {
  191. required: false,
  192. message: ' ',
  193. trigger: 'blur'
  194. }
  195. ]
  196. }, {
  197. label: '开户银行',
  198. prop: 'accountBank',
  199. rules: [
  200. {
  201. required: false,
  202. message: ' ',
  203. trigger: 'blur'
  204. }
  205. ]
  206. }, {
  207. label: '银行帐号',
  208. prop: 'accountNo',
  209. rules: [
  210. {
  211. required: false,
  212. message: ' ',
  213. trigger: 'blur'
  214. }
  215. ]
  216. }, {
  217. label: '外币账户名称',
  218. prop: 'accountNameFcy',
  219. rules: [
  220. {
  221. required: false,
  222. message: ' ',
  223. trigger: 'blur'
  224. }
  225. ]
  226. }, {
  227. label: '外币开户银行',
  228. prop: 'accountBankFcy',
  229. rules: [
  230. {
  231. required: false,
  232. message: ' ',
  233. trigger: 'blur'
  234. }
  235. ]
  236. }, {
  237. label: '外币银行账号',
  238. prop: 'accountNoFcy',
  239. rules: [
  240. {
  241. required: false,
  242. message: ' ',
  243. trigger: 'blur'
  244. }
  245. ]
  246. }, {
  247. label: '授信状态',
  248. prop: 'creditstatus',
  249. rules: [
  250. {
  251. required: false,
  252. message: ' ',
  253. trigger: 'blur'
  254. }
  255. ]
  256. }, {
  257. label: '授信等级',
  258. prop: 'creditLevel',
  259. rules: [
  260. {
  261. required: false,
  262. message: ' ',
  263. trigger: 'blur'
  264. }
  265. ]
  266. }, {
  267. label: '授信额度',
  268. prop: 'creditGrant',
  269. rules: [
  270. {
  271. required: false,
  272. message: ' ',
  273. trigger: 'blur'
  274. }
  275. ]
  276. }, {
  277. label: '授信天数',
  278. prop: 'creditDay',
  279. rules: [
  280. {
  281. required: false,
  282. message: ' ',
  283. trigger: 'blur'
  284. }
  285. ]
  286. }, {
  287. label: '授信利率',
  288. prop: 'creditRate',
  289. rules: [
  290. {
  291. required: false,
  292. message: ' ',
  293. trigger: 'blur'
  294. }
  295. ]
  296. }
  297. ]
  298. },
  299. basicData: {
  300. column: [
  301. {
  302. label: '客户编码',
  303. prop: 'code',
  304. rules: [
  305. {
  306. required: true,
  307. message: ' ',
  308. trigger: 'blur'
  309. }
  310. ]
  311. }, {
  312. label: '代理品牌',
  313. prop: 'goodtypes',
  314. rules: [
  315. {
  316. required: true,
  317. message: ' ',
  318. trigger: 'blur'
  319. }
  320. ]
  321. }, {
  322. label: '所属公司',
  323. prop: 'belongtocompany',
  324. rules: [
  325. {
  326. required: true,
  327. message: ' ',
  328. trigger: 'blur'
  329. }
  330. ]
  331. }, {
  332. label: '客户名称',
  333. prop: 'cname',
  334. }, {
  335. label: '企业类型',
  336. prop: 'companytype',
  337. rules: [
  338. {
  339. required: true,
  340. message: ' ',
  341. trigger: 'blur'
  342. }
  343. ]
  344. }, {
  345. label: "代理区域",
  346. span: 24,
  347. prop: "belongtoarea",
  348. mock: {
  349. type: 'county'
  350. }
  351. }
  352. ]
  353. }
  354. }
  355. },
  356. created() {
  357. this.customerContact.menu = false
  358. this.customerContact.addBtn = false
  359. this.advantageProject.menu = false
  360. this.advantageProject.addBtn = false
  361. this.bankOfDeposit.menu = false
  362. this.bankOfDeposit.addBtn = false
  363. this.bankOfDeposit.viewBtn = false
  364. this.bankOfDeposit.editBtn = false
  365. this.bankOfDeposit.delBtn = false
  366. corpstypeTree().then(res=>{
  367. console.log(res)
  368. this.dic = res.data.data
  369. })
  370. if (this.$route.query.id){
  371. detail(this.$route.query.id).then(res => {
  372. console.log(res.data.data)
  373. this.form = res.data.data;
  374. this.contactsData = this.form.corpsAttnList
  375. this.bankOfDepositData = this.form.corpsBankList
  376. this.advantageProjectData = this.form.corpsItems
  377. delete this.form.corpsAttnList
  378. delete this.form.corpsBankList
  379. delete this.form.corpsItems
  380. });
  381. }
  382. },
  383. watch:{
  384. '$route'(to,from) {
  385. console.log(to,from);
  386. if (this.$route.query.id){
  387. detail(this.$route.query.id).then(res => {
  388. console.log(res.data.data)
  389. this.form = res.data.data;
  390. });
  391. }else {
  392. this.form = {}
  393. }
  394. }
  395. },
  396. methods: {
  397. //新增客户联系人保存触发
  398. rowSave(row, done, loading){
  399. console.log(row,done,loading)
  400. this.contactsData.push(row)
  401. done()
  402. },
  403. //修改客户联系人触发
  404. rowUpdate(row, index, done, loading) {
  405. done(row);
  406. },
  407. //删除客户联系人触发
  408. rowDel(row, index, donerowDel) {
  409. this.$confirm("确定将选择数据删除?", {
  410. confirmButtonText: "确定",
  411. cancelButtonText: "取消",
  412. type: "warning"
  413. }).then(() => {
  414. // 数据回调进行刷新
  415. if (row.id){
  416. corpsattn(row.id).then(res=>{
  417. this.$message({
  418. type: "success",
  419. message: "操作成功!"
  420. });
  421. this.contactsData.splice(index, 1);
  422. })
  423. }else {
  424. this.$message({
  425. type: "success",
  426. message: "操作成功!"
  427. });
  428. this.contactsData.splice(index, 1);
  429. }
  430. })
  431. },
  432. //新增客户优势项目保存触发
  433. rowSaveProject(row, done, loading){
  434. console.log(row,done,loading)
  435. this.advantageProjectData.push(row)
  436. done()
  437. },
  438. //修改客户优势项目触发
  439. rowUpdateProject(row, index, done, loading) {
  440. done(row);
  441. },
  442. //删除客户优势项目触发
  443. rowDelProject(row, index, donerowDel) {
  444. this.$confirm("确定将选择数据删除?", {
  445. confirmButtonText: "确定",
  446. cancelButtonText: "取消",
  447. type: "warning"
  448. }).then(() => {
  449. if (row.id){
  450. corpsitem(row.id).then(res=>{
  451. this.$message({
  452. type: "success",
  453. message: "操作成功!"
  454. });
  455. this.advantageProjectData.splice(index, 1);
  456. })
  457. }else {
  458. this.$message({
  459. type: "success",
  460. message: "操作成功!"
  461. });
  462. this.advantageProjectData.splice(index, 1);
  463. }
  464. })
  465. },
  466. //新增客户优势项目保存触发
  467. rowSaveBankOfDeposit(row, done, loading){
  468. console.log(row,done,loading)
  469. this.bankOfDepositData.push(row)
  470. done()
  471. },
  472. //修改客户优势项目触发
  473. rowUpdateBankOfDeposit(row, index, done, loading) {
  474. done(row);
  475. },
  476. //删除客户优势项目触发
  477. rowDelBankOfDeposit(row, index, donerowDel) {
  478. this.$confirm("确定将选择数据删除?", {
  479. confirmButtonText: "确定",
  480. cancelButtonText: "取消",
  481. type: "warning"
  482. }).then(() => {
  483. if (row.id){
  484. corpsbank(row.id).then(res=>{
  485. this.$message({
  486. type: "success",
  487. message: "操作成功!"
  488. });
  489. this.bankOfDepositData.splice(index, 1);
  490. })
  491. }else {
  492. this.$message({
  493. type: "success",
  494. message: "操作成功!"
  495. });
  496. this.bankOfDepositData.splice(index, 1);
  497. }
  498. })
  499. },
  500. //修改提交触发
  501. editCustomer() {
  502. console.log(this.form)
  503. this.$refs["form"].validate((valid) => {
  504. console.log(valid)
  505. if (valid) {
  506. this.form.corpsAttnList = this.contactsData
  507. this.form.corpsBankList = this.bankOfDepositData
  508. this.form.corpsItems = this.advantageProjectData
  509. this.form.corpsTypeId = this.form.companytype.replace(/[\[\]]/g,"")
  510. typeSave(this.form).then(res => {
  511. console.log(res.data)
  512. this.$message({
  513. type: "success",
  514. message: this.form.id ? "修改成功!" : "新增成功!"
  515. });
  516. })
  517. } else {
  518. console.log('error submit!!');
  519. return false;
  520. }
  521. });
  522. },
  523. backToList() {
  524. // this.$router.$avueRouter.closeTag();
  525. console.log(this.$router.$avueRouter)
  526. this.$router.push({
  527. path: '/basicData/customerInformation/index',
  528. query: {}
  529. });
  530. }
  531. }
  532. }
  533. </script>
  534. <style lang="scss" scoped>
  535. .customer-head {
  536. position: fixed;
  537. top: 105px;
  538. width: 100%;
  539. margin-left: -10px;
  540. height: 62px;
  541. background: #ffffff;
  542. box-shadow: 0 4px 12px 0px rgba(232, 232, 235, 1);
  543. z-index: 999;
  544. /* display: flex;
  545. justify-content: left; */
  546. }
  547. .customer-back {
  548. cursor: pointer;
  549. line-height: 62px;
  550. font-size: 16px;
  551. color: #323233;
  552. font-weight: 400;
  553. }
  554. .back-icon {
  555. line-height: 64px;
  556. font-size: 20px;
  557. margin-right: 8px;
  558. }
  559. .add-customer-btn {
  560. position: fixed;
  561. right: 36px;
  562. top: 115px;
  563. }
  564. ::v-deep .el-form-item {
  565. margin-bottom: 0;
  566. }
  567. </style>