companyIdentityThree.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559
  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;padding:10px;' class="flex">
  72. <button :class='codestatus&&!sendDisabled?"active":""' @click='obtain' class='getcode'>{{sendText}}</button>
  73. <view class="con-list" style='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. console.log(1111)
  135. if (this.sendText == "获取验证码"){
  136. this.getcode()
  137. }
  138. },
  139. bankUp() {
  140. var that = this
  141. wx.chooseImage({
  142. success: function(res) {
  143. wx.uploadFile({
  144. url: 'https://www.zthymaoyi.com/upload/admin',
  145. filePath: res.tempFilePaths[0],
  146. name: 'file',
  147. success(res) {
  148. var data = res.data
  149. var strToObj = JSON.parse(data)
  150. that.bankid[0] = strToObj.url
  151. that.bank1 = strToObj.url
  152. that.certificates = false
  153. that.bankImgs1.bankImg = strToObj.url
  154. that.$api.doRequest('get', '/driverViewInfo/bankShibie', that
  155. .bankImgs1).then(res => {
  156. if (res.data.data.bankNo != null) {
  157. if (res.data.data.bankNo != "") {
  158. that.$set(that.identityAuthenticationInfo,
  159. 'bankCard', res.data.data.bankNo)
  160. }
  161. }
  162. if (res.data.data.bankName != null) {
  163. if (res.data.data.bankName != "") {
  164. that.$set(that.identityAuthenticationInfo,
  165. 'bankDeposit', res.data.data.bankName)
  166. }
  167. }
  168. if (res.data.data.bankNameZhihang.length != 0) {
  169. that.bankType = res.data.data.bankNameZhihang
  170. }
  171. }).catch(res => {
  172. uni.showToast({
  173. title: res.data.message,
  174. icon: 'none',
  175. duration: 2000
  176. })
  177. })
  178. }
  179. })
  180. }
  181. })
  182. },
  183. bankLow() {
  184. var that = this
  185. wx.chooseImage({
  186. success: function(res) {
  187. wx.uploadFile({
  188. url: 'https://www.zthymaoyi.com/upload/admin',
  189. filePath: res.tempFilePaths[0],
  190. name: 'file',
  191. success(res) {
  192. var data = res.data
  193. var strToObj = JSON.parse(data)
  194. that.bankid[1] = strToObj.url
  195. that.bank2 = strToObj.url
  196. that.certificatesTwo = false
  197. that.bankImgs1.bankImg = strToObj.url
  198. that.$api.doRequest('get', '/driverViewInfo/bankShibie', that
  199. .bankImgs1).then(res => {
  200. if (res.data.data.bankNo != null) {
  201. if (res.data.data.bankNo != "") {
  202. that.$set(that.identityAuthenticationInfo,
  203. 'bankCard', res.data.data.bankNo)
  204. }
  205. }
  206. if (res.data.data.bankName != null) {
  207. if (res.data.data.bankName != "") {
  208. that.$set(that.identityAuthenticationInfo,
  209. 'bankDeposit', res.data.data.bankName)
  210. }
  211. }
  212. if (res.data.data.bankNameZhihang != null) {
  213. that.bankType = res.data.data.bankNameZhihang
  214. }
  215. }).catch(res => {
  216. uni.showToast({
  217. title: res.data.message,
  218. icon: 'none',
  219. duration: 2000
  220. })
  221. })
  222. }
  223. })
  224. }
  225. })
  226. },
  227. bankChange(e) {
  228. this.bankIndex = e.detail.value
  229. this.Model = this.bankType[this.bankIndex];
  230. this.identityAuthenticationInfo.bankDepositBranch = this.bankType[this.bankIndex];
  231. },
  232. changeZhihang() {
  233. this.zhihangStatus = !this.zhihangStatus
  234. },
  235. commit() {
  236. var that = this
  237. if (this.bankid[0] == '' || this.bankid[0] == null) {
  238. this.$api.msg('请上传银行卡正面')
  239. return
  240. }
  241. if (this.bankid[1] == '' || this.bankid[1] == null) {
  242. this.$api.msg('请上传银行卡反面')
  243. return
  244. }
  245. if (!this.identityAuthenticationInfo.bankCard) {
  246. this.$api.msg('银行卡号不能为空')
  247. return
  248. }
  249. if (this.identityAuthenticationInfo.bankCard.length < 16 || this.identityAuthenticationInfo.bankCard
  250. .length > 19) {
  251. this.$api.msg('银行卡号输入错误')
  252. return
  253. }
  254. if (!this.identityAuthenticationInfo.bankDeposit) {
  255. this.$api.msg('开户行不能为空')
  256. return
  257. }
  258. if (this.identityAuthenticationInfo.bankDeposit.length < 4 || this.identityAuthenticationInfo.bankDeposit
  259. .length > 15) {
  260. this.$api.msg('开户行输入错误')
  261. return
  262. }
  263. if (!this.identityAuthenticationInfo.bankDepositBranch) {
  264. this.$api.msg('开户支行不能为空')
  265. return
  266. }
  267. if (this.identityAuthenticationInfo.bankDepositBranch.length < 4 || this.identityAuthenticationInfo
  268. .bankDepositBranch.length > 30) {
  269. this.$api.msg('开户支行输入错误')
  270. return
  271. }
  272. if (!this.identityAuthenticationInfo.customerPhone) {
  273. this.$api.msg('手机号不能为空')
  274. return
  275. }
  276. if (this.identityAuthenticationInfo.customerPhone.length != 11) {
  277. this.$api.msg('手机号填写不正确')
  278. return
  279. }
  280. if (!this.verifyCode) {
  281. this.$api.msg('请填写验证码')
  282. return
  283. }
  284. if (this.identityAuthenticationInfo.customerTypeFlag == 1) {
  285. if (!this.identityAuthenticationInfo.payeeName) {
  286. this.$api.msg('收款人姓名不能为空')
  287. return
  288. }
  289. if (this.identityAuthenticationInfo.payeeName < 2 || this.identityAuthenticationInfo.payeeName > 10) {
  290. this.$api.msg('收款人姓名输入错误')
  291. return
  292. }
  293. if (!this.identityAuthenticationInfo.payeeNumberCard) {
  294. this.$api.msg('收款人身份证号不能为空')
  295. return
  296. }
  297. if (this.identityAuthenticationInfo.payeeNumberCard.length != 18) {
  298. this.$api.msg('收款人身份证号输入错误')
  299. return
  300. }
  301. if (!this.identityAuthenticationInfo.compAddress) {
  302. this.$api.msg('联系地址不能为空')
  303. return
  304. }
  305. if (this.identityAuthenticationInfo.compAddress.length < 2 || this.identityAuthenticationInfo
  306. .compAddress.length > 20) {
  307. this.$api.msg('联系地址输入错误')
  308. return
  309. }
  310. } else if (this.identityAuthenticationInfo.customerTypeFlag == 2) {
  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. }
  321. this.amendprice()
  322. },
  323. phoneinput(e) {
  324. console.log(e.detail.value.length)
  325. if (e.detail.value.length == 11) {
  326. this.codestatus = true
  327. }
  328. },
  329. amendprice() {
  330. var that = this
  331. this.$api.doRequest('get', '/commonUser/loginVerifyCode', {
  332. phone: this.identityAuthenticationInfo.customerPhone,
  333. verifyCode: this.verifyCode
  334. }).then(res => {
  335. if (res.data.code == 200) {
  336. that.identityAuthenticationInfo.commonId = that.userInfo.id
  337. that.identityAuthenticationInfo.payeeAddressUrl = that.bankid.toString()
  338. that.identityAuthenticationInfo.compId = "2710b21efc1e4393930c5dc800010dc4"
  339. uni.showModal({
  340. content: "粮商身份信息审核通过后不可修改,是否确定提交?",
  341. showCancel: true,
  342. confirmText: '确定',
  343. success: function(res) {
  344. if (res.confirm) {
  345. that.identityAuthenticationInfos.customerPhone = that.identityAuthenticationInfo.customerPhone
  346. that.$api.doRequest('get',
  347. '/identityAuthenticationInfo/selectPhone', that
  348. .identityAuthenticationInfos)
  349. .then(res => {
  350. if (res.data.code == '11018') {
  351. uni.showModal({
  352. title: '提示',
  353. content: '该手机号已认证过个人粮商,再次认证将覆盖之前的认证信息,是否确定认证?',
  354. success: function(res) {
  355. if (res.confirm) {
  356. that.$api.doRequest('post',
  357. '/identityAuthenticationInfo/api/addIdentityAuthenticationInfo',that.identityAuthenticationInfo)
  358. .then(res => {
  359. if (res.data.code == 200) {
  360. uni.showToast({
  361. title: '提交成功',
  362. icon: 'none',
  363. duration: 2000
  364. })
  365. uni.navigateTo({
  366. url: `/pages/attestation/indexTwo`,
  367. })
  368. }
  369. })
  370. } else if (res.cancel) {
  371. uni.showToast({
  372. title: '提交失败',
  373. icon: 'none',
  374. duration: 2000
  375. })
  376. }
  377. }
  378. });
  379. } else if (res.data.code == 200) {
  380. that.$api.doRequest('post',
  381. '/identityAuthenticationInfo/api/addIdentityAuthenticationInfo',
  382. that.identityAuthenticationInfo)
  383. .then(res => {
  384. if (res.data.code == 200) {
  385. uni.showToast({
  386. title: '提交成功',
  387. icon: 'none',
  388. duration: 2000
  389. })
  390. uni.navigateTo({
  391. url: `/pages/attestation/indexTwo`,
  392. })
  393. }
  394. })
  395. }
  396. }).catch(res => {
  397. uni.showToast({
  398. title: res.data.message,
  399. icon: 'none',
  400. duration: 2000
  401. })
  402. })
  403. } else if (res.cancel) {
  404. // console.log('用户点击取消');
  405. }
  406. }
  407. })
  408. } else {
  409. that.verification = false
  410. uni.showToast({
  411. title: res.data.message,
  412. icon: 'none',
  413. duration: 2000
  414. })
  415. return false
  416. }
  417. })
  418. .catch(res => {
  419. that.verification = false
  420. uni.showToast({
  421. title: res.data.message,
  422. icon: 'none',
  423. duration: 2000
  424. })
  425. return false
  426. });
  427. },
  428. getcode() {
  429. var that = this
  430. if (/^0?1[3|4|5|6|7|8][0-9]\d{8}$/.test(this.identityAuthenticationInfo.customerPhone)) {
  431. this.$api.doRequest('get', '/commonUser/sendVerifyCode', {
  432. phone: this.identityAuthenticationInfo.customerPhone
  433. }).then(res => {
  434. if (res.data.code == 200) {
  435. that.sendDisabled = true
  436. let sec = 60
  437. let interval = setInterval(() => {
  438. sec--;
  439. that.sendText = sec + 's后重发'
  440. if (sec <= 0) {
  441. that.sendDisabled = false
  442. that.sendText = "获取验证码"
  443. clearInterval(interval)
  444. }
  445. }, 1000)
  446. } else {
  447. uni.showToast({
  448. title: res.data.message,
  449. icon: 'none',
  450. duration: 2000
  451. })
  452. return
  453. }
  454. })
  455. .catch(res => {
  456. uni.showToast({
  457. title: res.data.message,
  458. icon: 'none',
  459. duration: 2000
  460. })
  461. return
  462. });
  463. } else {
  464. uni.showToast({
  465. title: '请输入正确的手机号',
  466. icon: 'none',
  467. duration: 2000
  468. })
  469. }
  470. },
  471. }
  472. }
  473. </script>
  474. <style>
  475. .center {
  476. padding: 10px 20px;
  477. background-color: #F5F6FA;
  478. }
  479. .c-row {
  480. display: -webkit-box;
  481. display: -webkit-flex;
  482. display: flex;
  483. -webkit-box-align: center;
  484. -webkit-align-items: center;
  485. align-items: center;
  486. padding: 20rpx 30rpx;
  487. position: relative;
  488. font-size:14px;
  489. }
  490. .con-list {
  491. -webkit-box-flex: 1;
  492. -webkit-flex: 1;
  493. flex: 1;
  494. display: -webkit-box;
  495. display: -webkit-flex;
  496. display: flex;
  497. -webkit-box-orient: vertical;
  498. -webkit-box-direction: normal;
  499. -webkit-flex-direction: column;
  500. flex-direction: column;
  501. color: #303133;
  502. line-height: 40rpx;
  503. text-align: right;
  504. padding-right: 20rpx;
  505. font-size: 12px;
  506. }
  507. .btn {
  508. margin-top: 10px;
  509. background-color: #FFFFFF;
  510. border-radius: 25px;
  511. border: none;
  512. }
  513. .btns {
  514. background-color: #22C572;
  515. }
  516. .picture {
  517. width: 100%;
  518. height: 220px;
  519. text-align: center;
  520. margin-top: 10px;
  521. }
  522. .getcode {
  523. font-size: 14px;
  524. color: #AFB3BF;
  525. background: #F5F6F9;
  526. height: 30px;
  527. line-height: 30px;
  528. }
  529. .getcode.active {
  530. background:#22C572;
  531. color:#fff;
  532. }
  533. .words {
  534. font-size: 18px;
  535. font-weight: 600;
  536. color: #617E8B;
  537. }
  538. .floats {
  539. position: relative;
  540. top: -150px;
  541. text-align: center;
  542. }
  543. </style>