companyIdentityThree.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593
  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: 50 * 1024 * 1024, //限制文件大小 50M
  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. uni.showModal({
  342. content: "粮商身份信息审核通过后不可修改,是否确定提交?",
  343. showCancel: true,
  344. confirmText: '确定',
  345. success: function(res) {
  346. if (res.confirm) {
  347. uni.showLoading({
  348. title:"正在提交",
  349. mask:true
  350. })
  351. that.$api.doRequest('get', '/commonUser/loginVerifyCode', {
  352. phone: that.identityAuthenticationInfo.customerPhone,
  353. verifyCode: that.verifyCode
  354. }).then(res => {
  355. if (res.data.code == 200) {
  356. if (that.userInfo) {
  357. that.identityAuthenticationInfo.commonId = that.userInfo.id
  358. } else {
  359. that.identityAuthenticationInfo.commonId = res.data.data.id
  360. }
  361. that.identityAuthenticationInfo.payeeAddressUrl = that.bankid.toString()
  362. that.identityAuthenticationInfo.compId = "2710b21efc1e4393930c5dc800010dc4"
  363. that.identityAuthenticationInfos.customerPhone = that
  364. .identityAuthenticationInfo.customerPhone
  365. that.$api.doRequest('get',
  366. '/identityAuthenticationInfo/selectPhone', that
  367. .identityAuthenticationInfos)
  368. .then(res => {
  369. if (res.data.code == '11018') {
  370. uni.showModal({
  371. title: '提示',
  372. content: '该手机号已认证过个人粮商,再次认证将覆盖之前的认证信息,是否确定认证?',
  373. success: function(res) {
  374. if (res.confirm) {
  375. that.$api.doRequest('post',
  376. '/identityAuthenticationInfo/api/addIdentityAuthenticationInfo',
  377. that
  378. .identityAuthenticationInfo
  379. )
  380. .then(res => {
  381. if (res.data.code ==200) {
  382. uni.showToast({
  383. title: '提交成功',
  384. icon: 'none',
  385. duration: 2000
  386. })
  387. setTimeout(()=>{uni.navigateBack({
  388. delta: 3
  389. })},2000);
  390. }
  391. })
  392. }
  393. }
  394. });
  395. } else if (res.data.code == 200) {
  396. that.$api.doRequest('post',
  397. '/identityAuthenticationInfo/api/addIdentityAuthenticationInfo',
  398. that.identityAuthenticationInfo)
  399. .then(res => {
  400. if (res.data.code == 200) {
  401. uni.showToast({
  402. title: '提交成功',
  403. icon: 'none',
  404. duration: 2000
  405. })
  406. setTimeout(()=>{uni.navigateBack({
  407. delta: 3
  408. })},2000);
  409. }
  410. else{
  411. console.log("异常1:",res)
  412. uni.showToast({
  413. title: "系统异常,请联系管理员",
  414. icon: 'none',
  415. duration: 2000
  416. })
  417. }
  418. })
  419. }
  420. uni.hideLoading()
  421. }).catch(res => {
  422. console.log("异常:",res)
  423. uni.showToast({
  424. title: "系统异常,请联系管理员",
  425. icon: 'none',
  426. duration: 2000
  427. })
  428. uni.hideLoading()
  429. })
  430. } else {
  431. that.verification = false
  432. uni.showToast({
  433. title: res.data.message,
  434. icon: 'none',
  435. duration: 2000
  436. })
  437. uni.hideLoading()
  438. return false
  439. }
  440. })
  441. .catch(res => {
  442. that.verification = false
  443. uni.showToast({
  444. title: res.data.message,
  445. icon: 'none',
  446. duration: 2000
  447. })
  448. uni.hideLoading()
  449. return false
  450. });
  451. } else if (res.cancel) {
  452. // console.log('用户点击取消');
  453. }
  454. }
  455. })
  456. },
  457. getcode() {
  458. var that = this
  459. if (/^0?1[3|4|5|6|7|8][0-9]\d{8}$/.test(this.identityAuthenticationInfo.customerPhone)) {
  460. this.$api.doRequest('get', '/commonUser/sendVerifyCode', {
  461. phone: this.identityAuthenticationInfo.customerPhone
  462. }).then(res => {
  463. if (res.data.code == 200) {
  464. that.sendDisabled = true
  465. let sec = 60
  466. let interval = setInterval(() => {
  467. sec--;
  468. that.sendText = sec + 's后重发'
  469. if (sec <= 0) {
  470. that.sendDisabled = false
  471. that.sendText = "获取验证码"
  472. clearInterval(interval)
  473. }
  474. }, 1000)
  475. } else {
  476. uni.showToast({
  477. title: res.data.message,
  478. icon: 'none',
  479. duration: 2000
  480. })
  481. return
  482. }
  483. })
  484. .catch(res => {
  485. uni.showToast({
  486. title: res.data.message,
  487. icon: 'none',
  488. duration: 2000
  489. })
  490. return
  491. });
  492. } else {
  493. uni.showToast({
  494. title: '请输入正确的手机号',
  495. icon: 'none',
  496. duration: 2000
  497. })
  498. }
  499. },
  500. }
  501. }
  502. </script>
  503. <style>
  504. .center {
  505. padding: 10px 20px;
  506. background-color: #F5F6FA;
  507. }
  508. .c-row {
  509. display: -webkit-box;
  510. display: -webkit-flex;
  511. display: flex;
  512. -webkit-box-align: center;
  513. -webkit-align-items: center;
  514. align-items: center;
  515. padding: 20rpx 30rpx;
  516. position: relative;
  517. font-size: 14px;
  518. }
  519. .con-list {
  520. -webkit-box-flex: 1;
  521. -webkit-flex: 1;
  522. flex: 1;
  523. display: -webkit-box;
  524. display: -webkit-flex;
  525. display: flex;
  526. -webkit-box-orient: vertical;
  527. -webkit-box-direction: normal;
  528. -webkit-flex-direction: column;
  529. flex-direction: column;
  530. color: #303133;
  531. line-height: 40rpx;
  532. text-align: right;
  533. padding-right: 20rpx;
  534. font-size: 12px;
  535. }
  536. .btn {
  537. margin-top: 10px;
  538. background-color: #FFFFFF;
  539. border-radius: 25px;
  540. border: none;
  541. }
  542. .btns {
  543. background-color: #22C572;
  544. color: white;
  545. }
  546. .picture {
  547. width: 100%;
  548. height: 220px;
  549. text-align: center;
  550. margin-top: 10px;
  551. }
  552. .getcode {
  553. font-size: 14px;
  554. color: #AFB3BF;
  555. background: #F5F6F9;
  556. height: 30px;
  557. line-height: 30px;
  558. }
  559. .getcode.active {
  560. background: #22C572;
  561. color: #fff;
  562. }
  563. .words {
  564. font-size: 18px;
  565. font-weight: 600;
  566. color: #617E8B;
  567. }
  568. .floats {
  569. position: relative;
  570. top: -150px;
  571. text-align: center;
  572. }
  573. .upload {
  574. margin: 20rpx 0;
  575. }
  576. </style>