companyIdentityThree.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556
  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' type="number" maxlength="11" 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" maxlength="6">
  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. },
  138. bankUp() {
  139. var that = this
  140. uni.chooseImage({
  141. success: function(res) {
  142. uni.uploadFile({
  143. url: 'https://www.zthymaoyi.com/upload/admin',
  144. filePath: res.tempFilePaths[0],
  145. name: 'file',
  146. success(res) {
  147. var data = res.data
  148. var strToObj = JSON.parse(data)
  149. that.bankid[0] = strToObj.url
  150. that.bank1 = strToObj.url
  151. that.certificates = false
  152. that.bankImgs1.bankImg = strToObj.url
  153. that.$api.doRequest('get', '/driverViewInfo/bankShibie', that
  154. .bankImgs1).then(res => {
  155. if (res.data.data.bankNo != null) {
  156. if (res.data.data.bankNo != "") {
  157. that.$set(that.identityAuthenticationInfo,
  158. 'bankCard', res.data.data.bankNo)
  159. }
  160. }
  161. if (res.data.data.bankName != null) {
  162. if (res.data.data.bankName != "") {
  163. that.$set(that.identityAuthenticationInfo,
  164. 'bankDeposit', res.data.data.bankName)
  165. }
  166. }
  167. if (res.data.data.bankNameZhihang.length != 0) {
  168. that.bankType = res.data.data.bankNameZhihang
  169. }
  170. }).catch(res => {
  171. uni.showToast({
  172. title: res.data.message,
  173. icon: 'none',
  174. duration: 2000
  175. })
  176. })
  177. }
  178. })
  179. }
  180. })
  181. },
  182. bankLow() {
  183. var that = this
  184. uni.chooseImage({
  185. success: function(res) {
  186. uni.uploadFile({
  187. url: 'https://www.zthymaoyi.com/upload/admin',
  188. filePath: res.tempFilePaths[0],
  189. name: 'file',
  190. success(res) {
  191. var data = res.data
  192. var strToObj = JSON.parse(data)
  193. that.bankid[1] = strToObj.url
  194. that.bank2 = strToObj.url
  195. that.certificatesTwo = false
  196. that.bankImgs1.bankImg = strToObj.url
  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. })
  223. }
  224. })
  225. },
  226. bankChange(e) {
  227. this.bankIndex = e.detail.value
  228. this.Model = this.bankType[this.bankIndex];
  229. this.identityAuthenticationInfo.bankDepositBranch = this.bankType[this.bankIndex];
  230. },
  231. changeZhihang() {
  232. this.zhihangStatus = !this.zhihangStatus
  233. },
  234. commit() {
  235. var that = this
  236. if (this.bankid[0] == '' || this.bankid[0] == null) {
  237. this.$api.msg('请上传银行卡正面')
  238. return
  239. }
  240. if (this.bankid[1] == '' || this.bankid[1] == null) {
  241. this.$api.msg('请上传银行卡反面')
  242. return
  243. }
  244. if (!this.identityAuthenticationInfo.bankCard) {
  245. this.$api.msg('银行卡号不能为空')
  246. return
  247. }
  248. if (this.identityAuthenticationInfo.bankCard.length < 16 || this.identityAuthenticationInfo.bankCard
  249. .length > 19) {
  250. this.$api.msg('银行卡号输入错误')
  251. return
  252. }
  253. if (!this.identityAuthenticationInfo.bankDeposit) {
  254. this.$api.msg('开户行不能为空')
  255. return
  256. }
  257. if (this.identityAuthenticationInfo.bankDeposit.length < 4 || this.identityAuthenticationInfo.bankDeposit
  258. .length > 15) {
  259. this.$api.msg('开户行输入错误')
  260. return
  261. }
  262. if (!this.identityAuthenticationInfo.bankDepositBranch) {
  263. this.$api.msg('开户支行不能为空')
  264. return
  265. }
  266. if (this.identityAuthenticationInfo.bankDepositBranch.length < 4 || this.identityAuthenticationInfo
  267. .bankDepositBranch.length > 30) {
  268. this.$api.msg('开户支行输入错误')
  269. return
  270. }
  271. if (!this.identityAuthenticationInfo.customerPhone) {
  272. this.$api.msg('手机号不能为空')
  273. return
  274. }
  275. if (this.identityAuthenticationInfo.customerPhone.length != 11) {
  276. this.$api.msg('手机号填写不正确')
  277. return
  278. }
  279. if (!this.verifyCode) {
  280. this.$api.msg('请填写验证码')
  281. return
  282. }
  283. if (this.identityAuthenticationInfo.customerTypeFlag == 1) {
  284. if (!this.identityAuthenticationInfo.payeeName) {
  285. this.$api.msg('收款人姓名不能为空')
  286. return
  287. }
  288. if (this.identityAuthenticationInfo.payeeName < 2 || this.identityAuthenticationInfo.payeeName > 10) {
  289. this.$api.msg('收款人姓名输入错误')
  290. return
  291. }
  292. if (!this.identityAuthenticationInfo.payeeNumberCard) {
  293. this.$api.msg('收款人身份证号不能为空')
  294. return
  295. }
  296. if (this.identityAuthenticationInfo.payeeNumberCard.length != 18) {
  297. this.$api.msg('收款人身份证号输入错误')
  298. return
  299. }
  300. if (!this.identityAuthenticationInfo.compAddress) {
  301. this.$api.msg('联系地址不能为空')
  302. return
  303. }
  304. if (this.identityAuthenticationInfo.compAddress.length < 2 || this.identityAuthenticationInfo
  305. .compAddress.length > 20) {
  306. this.$api.msg('联系地址输入错误')
  307. return
  308. }
  309. } else if (this.identityAuthenticationInfo.customerTypeFlag == 2) {
  310. if (!this.identityAuthenticationInfo.compAddress) {
  311. this.$api.msg('公司地址不能为空')
  312. return
  313. }
  314. if (this.identityAuthenticationInfo.compAddress.length < 2 || this.identityAuthenticationInfo
  315. .compAddress.length > 20) {
  316. this.$api.msg('公司地址输入错误')
  317. return
  318. }
  319. }
  320. this.amendprice()
  321. },
  322. phoneinput(e) {
  323. console.log(e.detail.value.length)
  324. if (e.detail.value.length == 11) {
  325. this.codestatus = true
  326. }
  327. },
  328. amendprice() {
  329. var that = this
  330. this.$api.doRequest('get', '/commonUser/loginVerifyCode', {
  331. phone: this.identityAuthenticationInfo.customerPhone,
  332. verifyCode: this.verifyCode
  333. }).then(res => {
  334. if (res.data.code == 200) {
  335. if(that.userInfo){
  336. that.identityAuthenticationInfo.commonId = that.userInfo.id
  337. }
  338. else{
  339. that.identityAuthenticationInfo.commonId = res.data.data.id
  340. }
  341. that.identityAuthenticationInfo.payeeAddressUrl = that.bankid.toString()
  342. that.identityAuthenticationInfo.compId = "2710b21efc1e4393930c5dc800010dc4"
  343. uni.showModal({
  344. content: "粮商身份信息审核通过后不可修改,是否确定提交?",
  345. showCancel: true,
  346. confirmText: '确定',
  347. success: function(res) {
  348. if (res.confirm) {
  349. that.identityAuthenticationInfos.customerPhone = that.identityAuthenticationInfo.customerPhone
  350. that.$api.doRequest('get',
  351. '/identityAuthenticationInfo/selectPhone', that
  352. .identityAuthenticationInfos)
  353. .then(res => {
  354. if (res.data.code == '11018') {
  355. uni.showModal({
  356. title: '提示',
  357. content: '该手机号已认证过个人粮商,再次认证将覆盖之前的认证信息,是否确定认证?',
  358. success: function(res) {
  359. if (res.confirm) {
  360. that.$api.doRequest('post',
  361. '/identityAuthenticationInfo/api/addIdentityAuthenticationInfo',that.identityAuthenticationInfo)
  362. .then(res => {
  363. if (res.data.code == 200) {
  364. uni.showToast({
  365. title: '提交成功',
  366. icon: 'none',
  367. duration: 2000
  368. })
  369. uni.navigateBack({
  370. delta:3
  371. })
  372. }
  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.navigateBack({
  389. delta:3
  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. color: #AFB3BF;
  523. background: #F5F6F9;
  524. height: 30px;
  525. line-height: 30px;
  526. }
  527. .getcode.active {
  528. background:#22C572;
  529. color:#fff;
  530. }
  531. .words {
  532. font-size: 18px;
  533. font-weight: 600;
  534. color: #617E8B;
  535. }
  536. .floats {
  537. position: relative;
  538. top: -150px;
  539. text-align: center;
  540. }
  541. </style>