companyIdentityThree.vue 17 KB

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