customerFundAdd.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577
  1. <!--客户管理添加-->
  2. <template>
  3. <div class="center">
  4. <el-row>
  5. <el-col :span="12">
  6. <h2 class="bg-left titleup">创建客户</h2>
  7. </el-col>
  8. <el-col :span="12" class="bg-right">
  9. <el-button class="bg-bottom" type="primary" size="small" @click="cancel"
  10. ><img
  11. width="6"
  12. height="10"
  13. style="vertical-align: bottom; margin-right: 3px"
  14. src="../../../public/img/lujing.png"
  15. alt=""
  16. />返回
  17. </el-button>
  18. </el-col>
  19. </el-row>
  20. <div class="unload">
  21. <ws-form ref="customerList" :model="customerList" label-width="120px">
  22. <ws-info-table>
  23. <!--合同类型-->
  24. <ws-form-item label="客户类型" span="1" class="readonly">
  25. <el-radio v-model="customerList.customerType" label="企业客户"
  26. >企业客户</el-radio
  27. >
  28. <el-radio v-model="customerList.customerType" label="个人客户"
  29. >个人客户</el-radio
  30. >
  31. </ws-form-item>
  32. <ws-form-item
  33. label="公司名称"
  34. span="1"
  35. prop="compName"
  36. label-width="80px"
  37. v-if="customerList.customerType == '企业客户'"
  38. >
  39. <ws-input
  40. v-model="customerList.compName"
  41. placeholder="请输入公司名称"
  42. maxlength="30"
  43. size="small"
  44. :disabled="disabled"
  45. />
  46. </ws-form-item>
  47. <ws-form-item
  48. label="客户姓名"
  49. span="1"
  50. prop="customerName"
  51. label-width="80px"
  52. v-if="customerList.customerType == '个人客户'"
  53. >
  54. <ws-input
  55. v-model="customerList.customerName"
  56. placeholder="请输入客户姓名"
  57. maxlength="15"
  58. size="small"
  59. :disabled="disabled"
  60. />
  61. </ws-form-item>
  62. <ws-form-item label="联系电话" span="1" prop="customerPhone">
  63. <ws-input
  64. type="number"
  65. @mousewheel.native.prevent
  66. v-model="customerList.customerPhone"
  67. placeholder="请输入联系电话"
  68. maxlength="11"
  69. size="small"
  70. :disabled="disabled"
  71. />
  72. </ws-form-item>
  73. <ws-form-item label="定金(元)" span="1" prop="totalDeposit">
  74. <ws-input
  75. type="number"
  76. @mousewheel.native.prevent
  77. v-model="customerList.totalDeposit"
  78. placeholder="请输入定金"
  79. maxlength="11"
  80. size="small"
  81. :disabled="disabled"
  82. />
  83. </ws-form-item>
  84. <ws-form-item label="预付金(元)" span="1" prop="advancePayment">
  85. <ws-input
  86. type="number"
  87. @mousewheel.native.prevent
  88. v-model="customerList.advancePayment"
  89. placeholder="请输入预付金"
  90. maxlength="11"
  91. size="small"
  92. :disabled="disabled"
  93. />
  94. </ws-form-item>
  95. <ws-form-item label="保证金(元)" span="1" prop="securityDeposit">
  96. <ws-input
  97. type="number"
  98. @mousewheel.native.prevent
  99. v-model="customerList.securityDeposit"
  100. placeholder="请输入保证金"
  101. maxlength="11"
  102. size="small"
  103. :disabled="disabled"
  104. />
  105. </ws-form-item>
  106. <div style="display: flex; width: 100%;justify-content: space-between;">
  107. <div style="width: 330px;margin: 0px 0 22px 218px;">
  108. <div class="unload-img">上传银行卡正面</div>
  109. <el-upload
  110. class="avatar-uploader avatar-uploader3"
  111. action="https://www.zthymaoyi.com/upload/admin"
  112. :show-file-list="false"
  113. :on-success="bankSuccess1"
  114. :disabled="disabled"
  115. >
  116. <img v-if="imageUrl3" :src="imageUrl3" class="avatar" />
  117. <i v-else class="el-icon-plus avatar-uploader-icon"></i>
  118. </el-upload>
  119. </div>
  120. <div style="width: 330px; margin: 0px 126px 22px 0px;">
  121. <div class="unload-img">上传银行卡反面</div>
  122. <el-upload
  123. class="avatar-uploader avatar-uploader4"
  124. action="https://www.zthymaoyi.com/upload/admin"
  125. :show-file-list="false"
  126. :on-success="bankSuccess2"
  127. :disabled="disabled"
  128. >
  129. <img v-if="imageUrl4" :src="imageUrl4" class="avatar" />
  130. <i v-else class="el-icon-plus avatar-uploader-icon"></i>
  131. </el-upload>
  132. </div>
  133. </div>
  134. <ws-form-item label="银行卡号" span="1" prop="bankCard">
  135. <ws-input
  136. type="number"
  137. @mousewheel.native.prevent
  138. v-model="customerList.bankCard"
  139. placeholder="请输入银行卡号"
  140. maxlength="19"
  141. size="small"
  142. :disabled="disabled"
  143. />
  144. </ws-form-item>
  145. <ws-form-item label="开户行" span="1" prop="bankDeposit">
  146. <ws-input
  147. v-model="customerList.bankDeposit"
  148. placeholder="请输入开户行"
  149. maxlength="100"
  150. size="small"
  151. :disabled="disabled"
  152. />
  153. </ws-form-item>
  154. <ws-form-item label="开户支行" span="1" prop="bankDepositBranch">
  155. <ws-input
  156. style='margin-right:10px;'
  157. v-if="bankInput"
  158. v-model="customerList.bankDepositBranch"
  159. placeholder="请输入开户支行"
  160. maxlength="100"
  161. size="small"
  162. :disabled="disabled"
  163. />
  164. <ws-select
  165. v-else
  166. style='margin-right:10px;'
  167. v-model="customerList.bankDepositBranch"
  168. placeholder="请输入开户支行"
  169. :disabled="disabled"
  170. >
  171. <ws-option
  172. v-for="item in bankList"
  173. :key="item"
  174. :label="item"
  175. :value="item"
  176. />
  177. </ws-select>
  178. <el-button
  179. type="primary"
  180. @click="bankInputChange"
  181. v-if="switchType != 2"
  182. >{{ bankText }}</el-button
  183. >
  184. </ws-form-item>
  185. <ws-form-item label="收款人姓名" span="1" prop="payeeName">
  186. <ws-input
  187. v-model="customerList.payeeName"
  188. placeholder="请输入收款人姓名"
  189. maxlength="30"
  190. size="small"
  191. :disabled="disabled"
  192. />
  193. </ws-form-item>
  194. </ws-info-table>
  195. <div class="but" style='text-align:right;padding-right:20px;'>
  196. <el-button type="primary" @click="commit">提交</el-button>
  197. </div>
  198. </ws-form>
  199. </div>
  200. </div>
  201. </template>
  202. <script>
  203. import {
  204. addCustomer,
  205. getBank,
  206. } from '@/model/customerFundManagement/index'
  207. export default {
  208. components: {},
  209. watch: {},
  210. data() {
  211. return {
  212. imageUrl1: '',
  213. imageUrl2: '',
  214. imageUrl3: '',
  215. imageUrl4: '',
  216. dialogImageUrl: '',
  217. dialogVisible: false,
  218. customerList: {
  219. customerName: '',
  220. customerNumberCard: '',
  221. bankCard: '',
  222. bankDeposit: '',
  223. },
  224. disabledFlag: true,
  225. disabled: false,
  226. identity: [],
  227. bank: [],
  228. trader: '新增',
  229. switchType: '',
  230. identityImgUp: [
  231. {
  232. url: '',
  233. },
  234. ],
  235. identityImgLow: [
  236. {
  237. url: '',
  238. },
  239. ],
  240. bankImgUp: [
  241. {
  242. url: '',
  243. },
  244. ],
  245. bankImgLow: [
  246. {
  247. url: '',
  248. },
  249. ],
  250. identityUp: 'up',
  251. identityLow: 'low',
  252. bankUps: 'bankUp',
  253. bankLows: 'bankLow',
  254. sendDisabled: false,
  255. bankList: [],
  256. bankInput: false,
  257. bankText: '手动填写',
  258. }
  259. },
  260. activated() {
  261. this.switchType = this.$route.query.types
  262. if (this.$route.query.types == null) {
  263. this.switchType = 1
  264. this.imageUrl1 = ''
  265. this.imageUrl2 = ''
  266. this.imageUrl3 = ''
  267. this.imageUrl4 = ''
  268. this.customerList = {}
  269. }
  270. },
  271. methods: {
  272. bankInputChange() {
  273. this.bankInput = !this.bankInput
  274. if (this.bankInput) {
  275. this.bankText = '自动识别'
  276. } else {
  277. this.bankText = '手动填写'
  278. }
  279. },
  280. cancel() {
  281. this.customerList = {}
  282. this.$router.push({
  283. path: 'customerFundList',
  284. })
  285. },
  286. bankSuccess1(e) {
  287. this.bankUps = 'bankUp'
  288. this.bank[0] = e.url
  289. this.imageUrl3 = e.url
  290. getBank({
  291. bankImg: e.url,
  292. })
  293. .toPromise()
  294. .then((response) => {
  295. if (response.bankNameZhihang.length > 0) {
  296. this.bankList = response.bankNameZhihang
  297. }
  298. if (response.bankNo) {
  299. this.$set(this.customerList, 'bankCard', response.bankNo)
  300. }
  301. if (response.bankName) {
  302. this.$set(this.customerList, 'bankDeposit', response.bankName)
  303. }
  304. })
  305. },
  306. bankSuccess2(e) {
  307. this.bankLows = 'bankLow'
  308. this.bank[1] = e.url
  309. // this.imageUrl4 = e.url
  310. // getBank({
  311. // bankImg: e.url,
  312. // })
  313. // .toPromise()
  314. // .then((response) => {
  315. // if (response.bankNameZhihang) {
  316. // this.bankList = response.bankNameZhihang
  317. // }
  318. // if (response.bankNo) {
  319. // this.$set(this.customerList, 'bankCard', response.bankNo)
  320. // }
  321. // if (response.bankName) {
  322. // this.$set(this.customerList, 'bankDeposit', response.bankName)
  323. // }
  324. // })
  325. },
  326. commit() {
  327. if (!this.imageUrl3) {
  328. this.$message({
  329. message: '请上传银行卡正面',
  330. type: 'warning',
  331. })
  332. return
  333. }
  334. if (
  335. !this.customerList.customerName &&
  336. this.customerList.customerType == '个人客户'
  337. ) {
  338. this.$message({
  339. message: '请输入客户姓名',
  340. type: 'warning',
  341. })
  342. return
  343. }
  344. if (
  345. !this.customerList.compName &&
  346. this.customerList.customerType == '企业客户'
  347. ) {
  348. this.$message({
  349. message: '请输入公司名称',
  350. type: 'warning',
  351. })
  352. return
  353. }
  354. if (!this.customerList.bankCard) {
  355. this.$message({
  356. message: '请输入输入银行卡号',
  357. type: 'warning',
  358. })
  359. return
  360. }
  361. if (!this.customerList.bankDeposit) {
  362. this.$message({
  363. message: '请输入开户行',
  364. type: 'warning',
  365. })
  366. return
  367. }
  368. if (!this.customerList.bankDepositBranch) {
  369. this.$message({
  370. message: '请输入开户支行',
  371. type: 'warning',
  372. })
  373. return
  374. }
  375. if (!this.customerList.customerPhone) {
  376. this.$message({
  377. message: '请输入手机号',
  378. type: 'warning',
  379. })
  380. return
  381. }
  382. if (this.customerList.customerPhone.length != 11) {
  383. this.$message({
  384. message: '输入的手机号有误,请重新输入',
  385. type: 'warning',
  386. })
  387. return
  388. }
  389. this.customerList.compId = localStorage.getItem('ws-pf_compId')
  390. this.$confirm('确定提交客户信息?', '提示', {
  391. confirmButtonText: '确定',
  392. cancelButtonText: '取消',
  393. type: 'warning',
  394. })
  395. .then(() => {
  396. this.customerList.cardAddressUrl = this.identity.toString()
  397. this.customerList.payeeAddressUrl = this.bank.toString()
  398. // this.customerList.customerTypeFlag = this.customerTypeFlag
  399. // this.customerList.customerType = this.customerType
  400. addCustomer(this.customerList)
  401. .toPromise()
  402. .then((response) => {
  403. this.$message.success('添加成功')
  404. this.customerList = {}
  405. this.$router.go(-1)
  406. })
  407. })
  408. .catch(() => {
  409. return false
  410. })
  411. },
  412. },
  413. }
  414. </script>
  415. <style lang="scss" scoped>
  416. .avatar-uploader1 {
  417. background: url('../../../public/img/identityup.png');
  418. }
  419. .avatar-uploader2 {
  420. background: url('../../../public/img/identitylow.png');
  421. }
  422. .avatar-uploader3 {
  423. background: url('../../../public/img/bankup.png');
  424. }
  425. .avatar-uploader4 {
  426. background: url('../../../public/img/banklow.png');
  427. }
  428. /deep/.el-upload {
  429. height: 200px;
  430. }
  431. .avatar-uploader {
  432. background-size: 100% 100%;
  433. }
  434. .avatar-uploader .el-upload {
  435. border: 1px dashed #d9d9d9;
  436. border-radius: 6px;
  437. cursor: pointer;
  438. position: relative;
  439. overflow: hidden;
  440. }
  441. .avatar-uploader .el-upload:hover {
  442. border-color: #409eff;
  443. }
  444. .avatar-uploader-icon {
  445. font-size: 28px;
  446. color: #8c939d;
  447. width: 178px;
  448. height: 178px;
  449. line-height: 178px;
  450. text-align: center;
  451. }
  452. .avatar {
  453. width: 330px;
  454. height: 103%;
  455. display: block;
  456. }
  457. .center {
  458. background: #f6f7fc;
  459. }
  460. .seach {
  461. display: flex;
  462. align-items: center;
  463. .find {
  464. width: 32px;
  465. }
  466. .search-left {
  467. display: flex;
  468. }
  469. }
  470. .ws-info-table {
  471. border: none;
  472. width: 80%;
  473. margin: 0 auto;
  474. }
  475. .ws-info-table .el-form-item {
  476. width: 50%;
  477. border: none;
  478. }
  479. /deep/.ws-info-table .el-form-item .el-form-item__label {
  480. width: 30%;
  481. text-align: center;
  482. background: #ffffff;
  483. font-size: 14px;
  484. color: #8890b1;
  485. }
  486. /deep/.ws-info-table .el-form-item .el-form-item__content {
  487. border: none;
  488. }
  489. .bg-left {
  490. padding-left: 30px;
  491. }
  492. .bg-right {
  493. padding-right: 10px;
  494. text-align: right;
  495. }
  496. .bg-bottom {
  497. margin: 15px 0px;
  498. }
  499. .titleup {
  500. position: relative;
  501. }
  502. .titleup::before {
  503. content: '';
  504. display: inline-block;
  505. width: 5px;
  506. height: 30px;
  507. background: #5473e8;
  508. position: absolute;
  509. left: 0;
  510. }
  511. .unload {
  512. background: #ffffff;
  513. padding-top: 20px;
  514. }
  515. .but {
  516. text-align: center;
  517. margin: 20px auto;
  518. }
  519. /deep/.up .el-upload--picture-card {
  520. display: none;
  521. }
  522. /deep/.low .el-upload--picture-card {
  523. display: none;
  524. }
  525. /deep/.bankUp .el-upload--picture-card {
  526. display: none;
  527. }
  528. /deep/.bankLow .el-upload--picture-card {
  529. display: none;
  530. }
  531. .unload-img {
  532. margin: 20px 0;
  533. }
  534. .veriCode {
  535. margin: 0 9px;
  536. }
  537. .jiaoYan {
  538. display: flex;
  539. width: 50%;
  540. padding: 0 9px;
  541. }
  542. /deep/.jiaoYan .el-input__inner {
  543. width: 100%;
  544. }
  545. </style>