companyIdentityThree.vue 18 KB

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