companyIdentityThree.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575
  1. <template>
  2. <view class="center">
  3. <view>
  4. <!-- 上传银行卡正面 -->
  5. <upload class="upload" ref="upload" :action="action" :max-size="maxSize" :max-count="1"
  6. :size-type="['compressed']" @on-success="getImgUrl" @on-error="onError" @on-remove="onRemove"
  7. @on-uploaded="isAdd = true" :before-upload="filterFileType" :options="uploadOptions"
  8. :custom="uploadCustom" @on-progress="onProgress"></upload>
  9. <!-- 上传银行卡反面 -->
  10. <upload class="upload" ref="upload" :action="action" :max-size="maxSize" :max-count="1"
  11. :size-type="['compressed']" @on-success="getImgUrl1" @on-error="onError" @on-remove="onRemove"
  12. @on-uploaded="isAdd = true" :before-upload="filterFileType" :options="uploadOptions1"
  13. :custom="uploadCustom" @on-progress="onProgress"></upload>
  14. </view>
  15. <view class="c-row b-b">
  16. <text class="tit">银行卡号</text>
  17. <view class="con-list">
  18. <input placeholder="请填写银行卡号" name="input" v-model="identityAuthenticationInfo.bankCard"></input>
  19. </view>
  20. </view>
  21. <view class="c-row b-b">
  22. <text class="tit">开户行</text>
  23. <view class="con-list">
  24. <input placeholder="请填写开户行" name="input" v-model="identityAuthenticationInfo.bankDeposit"></input>
  25. </view>
  26. </view>
  27. <view class="c-row b-b">
  28. <text class="tit">开户支行</text>
  29. <view v-if="zhihangStatus" class="con-list">
  30. <picker @change="bankChange" :value="bankIndex" :range="bankType" class="con-list">
  31. <view class="con-list">
  32. {{bankIndex>-1?bankType[bankIndex]:'请选择开户支行'}}
  33. </view>
  34. </picker>
  35. </view>
  36. <view v-else class="con-list">
  37. <input placeholder="请填写" name="input" v-model="identityAuthenticationInfo.bankDepositBranch"></input>
  38. </view>
  39. <button v-if="zhihangStatus" class='cu-btn bg-green shadow' @click="changeZhihang">填写</button>
  40. <button v-else class='cu-btn bg-green shadow' @click="changeZhihang">识别</button>
  41. </view>
  42. <view class="c-row b-b" v-if="identityAuthenticationInfo.customerTypeFlag == 1">
  43. <text class="tit">收款人姓名</text>
  44. <view class="con-list">
  45. <input placeholder="请填写收款人姓名" name="input" v-model="identityAuthenticationInfo.payeeName"></input>
  46. </view>
  47. </view>
  48. <view class="c-row b-b" v-if="identityAuthenticationInfo.customerTypeFlag == 1">
  49. <text class="tit">收款人身份证号</text>
  50. <view class="con-list">
  51. <input placeholder="请填写收款人身份证号" name="input"
  52. v-model="identityAuthenticationInfo.payeeNumberCard"></input>
  53. </view>
  54. </view>
  55. <view class="c-row b-b">
  56. <text class="tit">手机号</text>
  57. <view class="con-list">
  58. <input placeholder="请填写手机号" @input='phoneinput' type="number" maxlength="11"
  59. v-model="identityAuthenticationInfo.customerPhone"></input>
  60. </view>
  61. </view>
  62. <view style='width:100%;border-bottom:1px solid #E8E9ED;padding:10px;' class="flex">
  63. <button :class='codestatus&&!sendDisabled?"active":""' @click='obtain' class='getcode'>{{sendText}}</button>
  64. <view class="con-list" style='position:relative;'>
  65. <input style='text-align:right;' v-model='verifyCode' placeholder="请输入验证码" type="number" maxlength="6">
  66. </view>
  67. </view>
  68. <view class="c-row b-b" v-if="identityAuthenticationInfo.customerTypeFlag == 2">
  69. <text class="tit">公司地址</text>
  70. <view class="con-list">
  71. <input placeholder="请填写公司地址" name="input" v-model="identityAuthenticationInfo.compAddress"></input>
  72. </view>
  73. </view>
  74. <view class="c-row b-b" v-if="identityAuthenticationInfo.customerTypeFlag == 1">
  75. <text class="tit">联系地址</text>
  76. <view class="con-list">
  77. <input placeholder="请填写联系地址" name="input" v-model="identityAuthenticationInfo.compAddress"></input>
  78. </view>
  79. </view>
  80. <button class="btns btn" @click="commit">提交</button>
  81. </view>
  82. </template>
  83. <script>
  84. import upload from '@/components/upload.vue';
  85. import {
  86. mapState
  87. } from 'vuex';
  88. export default {
  89. components: {
  90. upload
  91. },
  92. name: "buy",
  93. data() {
  94. return {
  95. action: this.$uploadUrl,
  96. maxSize: 5 * 1024 * 1024, //限制文件大小 2M
  97. btnLoading: false, //防止重复点击
  98. isAdd: true,
  99. imgUrls: [],
  100. uploadCustom: true,
  101. uploadCustom1: true,
  102. uploadOptions: {
  103. "text": "上传银行卡正面",
  104. "bgc": "https://taohaoliang.oss-cn-beijing.aliyuncs.com/app/tmp/bankup%282%29.png"
  105. },
  106. uploadOptions1: {
  107. "text": "上传银行卡反面",
  108. "bgc": "https://taohaoliang.oss-cn-beijing.aliyuncs.com/app/tmp/banklow%282%29.png"
  109. },
  110. // bank1: "../../static/img/authentication/bankup(3).png",
  111. // bank2: "../../static/img/authentication/banklow(3).png",
  112. bankid: [],
  113. consentStatus: true,
  114. consentStatus1: false,
  115. codestatus: false,
  116. verifyCode: null,
  117. inputStatus: 'none',
  118. sendText: '获取验证码',
  119. platform: '',
  120. sendDisabled: false,
  121. identityAuthenticationInfo: {},
  122. bankImgs1: {},
  123. bankIndex: -1,
  124. bankType: [],
  125. certificates: true,
  126. certificatesTwo: true,
  127. zhihangStatus: true,
  128. verification: true,
  129. identityAuthenticationInfos: {},
  130. }
  131. },
  132. computed: {
  133. ...mapState(['hasLogin', 'userInfo'])
  134. },
  135. onLoad(options) {
  136. this.identityAuthenticationInfo = JSON.parse(options.identityAuthenticationInfo)
  137. if (this.identityAuthenticationInfo.customerTypeFlag == 1) {
  138. this.identityAuthenticationInfo.payeeName = this.identityAuthenticationInfo.customerName
  139. this.identityAuthenticationInfo.payeeNumberCard = this.identityAuthenticationInfo.customerNumberCard
  140. }
  141. },
  142. methods: {
  143. filterFileType(index, lists) {
  144. if (lists[index].fileType != 'jpg' && lists[index].fileType != 'png' && lists[index].fileType != 'gif') {
  145. lists.splice(index, 1);
  146. // 当前文件不支持
  147. uni.showModal({
  148. title: '暂不支持当前图片类型',
  149. showCancel: false
  150. });
  151. } else {
  152. this.isAdd = false;
  153. }
  154. },
  155. getImgUrl(res) {
  156. console.log(res)
  157. console.log('------------res-----------')
  158. let that = this
  159. that.bankid[0] = res
  160. that.bank1 = res
  161. that.certificates = false
  162. that.bankImgs1.bankImg = res
  163. that.$api.doRequest('get', '/driverViewInfo/bankShibie', that
  164. .bankImgs1).then(res => {
  165. if (res.data.data.bankNo != null) {
  166. if (res.data.data.bankNo != "") {
  167. that.$set(that.identityAuthenticationInfo,
  168. 'bankCard', res.data.data.bankNo)
  169. }
  170. }
  171. if (res.data.data.bankName != null) {
  172. if (res.data.data.bankName != "") {
  173. that.$set(that.identityAuthenticationInfo,
  174. 'bankDeposit', res.data.data.bankName)
  175. }
  176. }
  177. if (res.data.data.bankNameZhihang.length != 0) {
  178. that.bankType = res.data.data.bankNameZhihang
  179. }
  180. }).catch(res => {
  181. uni.showToast({
  182. title: res.data.message,
  183. icon: 'none',
  184. duration: 2000
  185. })
  186. })
  187. },
  188. getImgUrl1(res) {
  189. console.log(res)
  190. console.log('------------res-----------')
  191. let that = this
  192. that.bankid[1] = res
  193. that.bank2 = res
  194. that.certificatesTwo = false
  195. that.bankImgs1.bankImg = res
  196. that.$api.doRequest('get', '/driverViewInfo/bankShibie', that
  197. .bankImgs1).then(res => {
  198. if (res.data.data.bankNo != null) {
  199. if (res.data.data.bankNo != "") {
  200. that.$set(that.identityAuthenticationInfo,
  201. 'bankCard', res.data.data.bankNo)
  202. }
  203. }
  204. if (res.data.data.bankName != null) {
  205. if (res.data.data.bankName != "") {
  206. that.$set(that.identityAuthenticationInfo,
  207. 'bankDeposit', res.data.data.bankName)
  208. }
  209. }
  210. if (res.data.data.bankNameZhihang != null) {
  211. that.bankType = res.data.data.bankNameZhihang
  212. }
  213. }).catch(res => {
  214. uni.showToast({
  215. title: res.data.message,
  216. icon: 'none',
  217. duration: 2000
  218. })
  219. })
  220. },
  221. onError(error) {
  222. alert(error)
  223. console.log('------------error-----------')
  224. console.log(error)
  225. },
  226. onProgress(e) {
  227. console.log(e)
  228. },
  229. onRemove(index) {
  230. this.imgUrls.splice(index, 1);
  231. },
  232. obtain() {
  233. if (this.sendText == "获取验证码") {
  234. this.getcode()
  235. }
  236. },
  237. bankChange(e) {
  238. this.bankIndex = e.detail.value
  239. this.Model = this.bankType[this.bankIndex];
  240. this.identityAuthenticationInfo.bankDepositBranch = this.bankType[this.bankIndex];
  241. },
  242. changeZhihang() {
  243. this.zhihangStatus = !this.zhihangStatus
  244. },
  245. commit() {
  246. var that = this
  247. if (this.bankid[0] == '' || this.bankid[0] == null) {
  248. this.$api.msg('请上传银行卡正面')
  249. return
  250. }
  251. if (this.bankid[1] == '' || this.bankid[1] == null) {
  252. this.$api.msg('请上传银行卡反面')
  253. return
  254. }
  255. if (!this.identityAuthenticationInfo.bankCard) {
  256. this.$api.msg('银行卡号不能为空')
  257. return
  258. }
  259. if (this.identityAuthenticationInfo.bankCard.length < 16 || this.identityAuthenticationInfo.bankCard
  260. .length > 19) {
  261. this.$api.msg('银行卡号输入错误')
  262. return
  263. }
  264. if (!this.identityAuthenticationInfo.bankDeposit) {
  265. this.$api.msg('开户行不能为空')
  266. return
  267. }
  268. if (this.identityAuthenticationInfo.bankDeposit.length < 4 || this.identityAuthenticationInfo.bankDeposit
  269. .length > 15) {
  270. this.$api.msg('开户行输入错误')
  271. return
  272. }
  273. if (!this.identityAuthenticationInfo.bankDepositBranch) {
  274. this.$api.msg('开户支行不能为空')
  275. return
  276. }
  277. if (this.identityAuthenticationInfo.bankDepositBranch.length < 4 || this.identityAuthenticationInfo
  278. .bankDepositBranch.length > 30) {
  279. this.$api.msg('开户支行输入错误')
  280. return
  281. }
  282. if (!this.identityAuthenticationInfo.customerPhone) {
  283. this.$api.msg('手机号不能为空')
  284. return
  285. }
  286. if (this.identityAuthenticationInfo.customerPhone.length != 11) {
  287. this.$api.msg('手机号填写不正确')
  288. return
  289. }
  290. if (!this.verifyCode) {
  291. this.$api.msg('请填写验证码')
  292. return
  293. }
  294. if (this.identityAuthenticationInfo.customerTypeFlag == 1) {
  295. if (!this.identityAuthenticationInfo.payeeName) {
  296. this.$api.msg('收款人姓名不能为空')
  297. return
  298. }
  299. if (this.identityAuthenticationInfo.payeeName < 2 || this.identityAuthenticationInfo.payeeName > 10) {
  300. this.$api.msg('收款人姓名输入错误')
  301. return
  302. }
  303. if (!this.identityAuthenticationInfo.payeeNumberCard) {
  304. this.$api.msg('收款人身份证号不能为空')
  305. return
  306. }
  307. if (this.identityAuthenticationInfo.payeeNumberCard.length != 18) {
  308. this.$api.msg('收款人身份证号输入错误')
  309. return
  310. }
  311. if (!this.identityAuthenticationInfo.compAddress) {
  312. this.$api.msg('联系地址不能为空')
  313. return
  314. }
  315. if (this.identityAuthenticationInfo.compAddress.length < 2 || this.identityAuthenticationInfo
  316. .compAddress.length > 20) {
  317. this.$api.msg('联系地址输入错误')
  318. return
  319. }
  320. } else if (this.identityAuthenticationInfo.customerTypeFlag == 2) {
  321. if (!this.identityAuthenticationInfo.compAddress) {
  322. this.$api.msg('公司地址不能为空')
  323. return
  324. }
  325. if (this.identityAuthenticationInfo.compAddress.length < 2 || this.identityAuthenticationInfo
  326. .compAddress.length > 20) {
  327. this.$api.msg('公司地址输入错误')
  328. return
  329. }
  330. }
  331. this.amendprice()
  332. },
  333. phoneinput(e) {
  334. console.log(e.detail.value.length)
  335. if (e.detail.value.length == 11) {
  336. this.codestatus = true
  337. }
  338. },
  339. amendprice() {
  340. var that = this
  341. this.$api.doRequest('get', '/commonUser/loginVerifyCode', {
  342. phone: this.identityAuthenticationInfo.customerPhone,
  343. verifyCode: this.verifyCode
  344. }).then(res => {
  345. if (res.data.code == 200) {
  346. if (that.userInfo) {
  347. that.identityAuthenticationInfo.commonId = that.userInfo.id
  348. } else {
  349. that.identityAuthenticationInfo.commonId = res.data.data.id
  350. }
  351. that.identityAuthenticationInfo.payeeAddressUrl = that.bankid.toString()
  352. that.identityAuthenticationInfo.compId = "2710b21efc1e4393930c5dc800010dc4"
  353. uni.showModal({
  354. content: "粮商身份信息审核通过后不可修改,是否确定提交?",
  355. showCancel: true,
  356. confirmText: '确定',
  357. success: function(res) {
  358. if (res.confirm) {
  359. that.identityAuthenticationInfos.customerPhone = that
  360. .identityAuthenticationInfo.customerPhone
  361. that.$api.doRequest('get',
  362. '/identityAuthenticationInfo/selectPhone', that
  363. .identityAuthenticationInfos)
  364. .then(res => {
  365. if (res.data.code == '11018') {
  366. uni.showModal({
  367. title: '提示',
  368. content: '该手机号已认证过个人粮商,再次认证将覆盖之前的认证信息,是否确定认证?',
  369. success: function(res) {
  370. if (res.confirm) {
  371. that.$api.doRequest('post',
  372. '/identityAuthenticationInfo/api/addIdentityAuthenticationInfo',
  373. that
  374. .identityAuthenticationInfo
  375. )
  376. .then(res => {
  377. if (res.data
  378. .code ==
  379. 200) {
  380. uni.showToast({
  381. title: '提交成功',
  382. icon: 'none',
  383. duration: 2000
  384. })
  385. uni.navigateBack({
  386. delta: 3
  387. })
  388. }
  389. })
  390. }
  391. }
  392. });
  393. } else if (res.data.code == 200) {
  394. that.$api.doRequest('post',
  395. '/identityAuthenticationInfo/api/addIdentityAuthenticationInfo',
  396. that.identityAuthenticationInfo)
  397. .then(res => {
  398. if (res.data.code == 200) {
  399. uni.showToast({
  400. title: '提交成功',
  401. icon: 'none',
  402. duration: 2000
  403. })
  404. uni.navigateBack({
  405. delta: 3
  406. })
  407. }
  408. })
  409. }
  410. }).catch(res => {
  411. uni.showToast({
  412. title: res.data.message,
  413. icon: 'none',
  414. duration: 2000
  415. })
  416. })
  417. } else if (res.cancel) {
  418. // console.log('用户点击取消');
  419. }
  420. }
  421. })
  422. } else {
  423. that.verification = false
  424. uni.showToast({
  425. title: res.data.message,
  426. icon: 'none',
  427. duration: 2000
  428. })
  429. return false
  430. }
  431. })
  432. .catch(res => {
  433. that.verification = false
  434. uni.showToast({
  435. title: res.data.message,
  436. icon: 'none',
  437. duration: 2000
  438. })
  439. return false
  440. });
  441. },
  442. getcode() {
  443. var that = this
  444. if (/^0?1[3|4|5|6|7|8][0-9]\d{8}$/.test(this.identityAuthenticationInfo.customerPhone)) {
  445. this.$api.doRequest('get', '/commonUser/sendVerifyCode', {
  446. phone: this.identityAuthenticationInfo.customerPhone
  447. }).then(res => {
  448. if (res.data.code == 200) {
  449. that.sendDisabled = true
  450. let sec = 60
  451. let interval = setInterval(() => {
  452. sec--;
  453. that.sendText = sec + 's后重发'
  454. if (sec <= 0) {
  455. that.sendDisabled = false
  456. that.sendText = "获取验证码"
  457. clearInterval(interval)
  458. }
  459. }, 1000)
  460. } else {
  461. uni.showToast({
  462. title: res.data.message,
  463. icon: 'none',
  464. duration: 2000
  465. })
  466. return
  467. }
  468. })
  469. .catch(res => {
  470. uni.showToast({
  471. title: res.data.message,
  472. icon: 'none',
  473. duration: 2000
  474. })
  475. return
  476. });
  477. } else {
  478. uni.showToast({
  479. title: '请输入正确的手机号',
  480. icon: 'none',
  481. duration: 2000
  482. })
  483. }
  484. },
  485. }
  486. }
  487. </script>
  488. <style>
  489. .center {
  490. padding: 10px 20px;
  491. background-color: #F5F6FA;
  492. }
  493. .c-row {
  494. display: -webkit-box;
  495. display: -webkit-flex;
  496. display: flex;
  497. -webkit-box-align: center;
  498. -webkit-align-items: center;
  499. align-items: center;
  500. padding: 20rpx 30rpx;
  501. position: relative;
  502. font-size: 14px;
  503. }
  504. .con-list {
  505. -webkit-box-flex: 1;
  506. -webkit-flex: 1;
  507. flex: 1;
  508. display: -webkit-box;
  509. display: -webkit-flex;
  510. display: flex;
  511. -webkit-box-orient: vertical;
  512. -webkit-box-direction: normal;
  513. -webkit-flex-direction: column;
  514. flex-direction: column;
  515. color: #303133;
  516. line-height: 40rpx;
  517. text-align: right;
  518. padding-right: 20rpx;
  519. font-size: 12px;
  520. }
  521. .btn {
  522. margin-top: 10px;
  523. background-color: #FFFFFF;
  524. border-radius: 25px;
  525. border: none;
  526. }
  527. .btns {
  528. background-color: #22C572;
  529. color: white;
  530. }
  531. .picture {
  532. width: 100%;
  533. height: 220px;
  534. text-align: center;
  535. margin-top: 10px;
  536. }
  537. .getcode {
  538. font-size: 14px;
  539. color: #AFB3BF;
  540. background: #F5F6F9;
  541. height: 30px;
  542. line-height: 30px;
  543. }
  544. .getcode.active {
  545. background: #22C572;
  546. color: #fff;
  547. }
  548. .words {
  549. font-size: 18px;
  550. font-weight: 600;
  551. color: #617E8B;
  552. }
  553. .floats {
  554. position: relative;
  555. top: -150px;
  556. text-align: center;
  557. }
  558. .upload {
  559. margin: 20rpx 0;
  560. }
  561. </style>