form.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624
  1. <template>
  2. <view class="shop_auth">
  3. <view class="content">
  4. <!-- <view class="hint">上传并提交您的证件照片</view>
  5. <view class="flexB">
  6. <image :src="authCon.front" class="card" @click="getPhoto(0)"></image>
  7. <image :src="authCon.otherSide" class="card" @click="getPhoto(1)"></image>
  8. </view>
  9. <view class="hint">拍照要求</view>
  10. <view class="rule">
  11. <image src="/static/zbs/card_rule.png"></image>
  12. </view> -->
  13. <view style="padding-bottom: 10rpx;" class="hint">填写相关信息</view>
  14. <view class="auth_inp">
  15. <view class="inp_box">
  16. <view class="label">
  17. <text>开户姓名</text>
  18. </view>
  19. <input type="text" placeholder="请输入银行卡开户姓名" v-model="params.CardName" placeholder-class="place" />
  20. </view>
  21. <view class="inp_box">
  22. <view class="label">
  23. <text>身份证号</text>
  24. </view>
  25. <input type="text" placeholder="请输入身份证号" v-model="params.CertID" maxlength="18"
  26. placeholder-class="place" />
  27. </view>
  28. <view>
  29. <view class="label">
  30. <text>身份证有效期</text>
  31. </view>
  32. <view class="date_picker flexV">
  33. <picker mode="date" :value="params.startDate" @change="bindDateChange1">
  34. <view>
  35. <text :style="{ color: params.startDate ? '#333' : '#a7a7a7' }">
  36. {{ params.startDate ? params.startDate : '年-月-日' }}
  37. </text>
  38. </view>
  39. </picker>
  40. <text style="margin: 0 20rpx;">~</text>
  41. <picker mode="date" :value="params.endDate" @change="bindDateChange2">
  42. <view>
  43. <text :style="{ color: params.endDate ? '#333' : '#a7a7a7' }">
  44. {{ params.endDate ? params.endDate : '年-月-日' }}
  45. </text>
  46. </view>
  47. </picker>
  48. </view>
  49. </view>
  50. <view>
  51. <view class="label">
  52. <text>是否长期有效</text>
  53. </view>
  54. <picker @change="bindPickerChange" :value="params.type" :range="array" range-key="name">
  55. <view class="flexB picker">
  56. <view>{{ array[params.type].name }}</view>
  57. <text class="iconfont iconzhcc_xiangxiajiantou"></text>
  58. </view>
  59. </picker>
  60. </view>
  61. <view>
  62. <view>
  63. <view class="label">
  64. <text>卡号</text>
  65. </view>
  66. <input type="number" placeholder="请输入银行卡号" v-model="params.CardID" class="bank_box"
  67. placeholder-style="color:#999" />
  68. </view>
  69. <!-- <view class="label">
  70. <text>开户行</text>
  71. </view>
  72. <view @click="(showBank = true), getBankList()" class="flexB picker">
  73. <text :style="{ color: params.account_bank ? '#333' : '#999' }"
  74. style="font-size:32rpx;">{{ params.account_bank ? params.account_bank : '请选择开户银行' }}</text>
  75. <text class="iconfont iconzhcc_xiangxiajiantou"></text>
  76. </view>
  77. <u-popup v-model="showBank" mode="bottom" height="700rpx;">
  78. <view class="pop_box">
  79. <view class="box_inp flexC"><input type="text" placeholder="输入关键字查询开户银行" @input="bankInp"
  80. v-model="searchBank" class="search_inp" /></view>
  81. <view class="scroll">
  82. <scroll-view>
  83. <view class="scroll_con">
  84. <view v-for="(item, idx) in bankList" :key="idx" @click="checkBank(item)">
  85. {{ item.name }}
  86. </view>
  87. </view>
  88. </scroll-view>
  89. </view>
  90. </view>
  91. </u-popup> -->
  92. </view>
  93. <view>
  94. <view class="label">
  95. <text>银行卡绑定手机号</text>
  96. </view>
  97. <input type="number" placeholder="请输入银行卡绑定手机号" v-model="params.mobile" class="bank_box"
  98. placeholder-style="color:#999" />
  99. </view>
  100. <view>
  101. <view class="label">
  102. <text>短信验证码</text>
  103. </view>
  104. <view class="inp flexB">
  105. <input type="text" placeholder="请输入验证码" maxlength="6" placeholder-style="font-size:28rpx;color:#999"
  106. v-model="params.sms_code" />
  107. <view v-throttle="2000" class="inp_code" @click="getNew">{{ newDown ? `${newDown}s` : '获取验证码' }}</view>
  108. </view>
  109. </view>
  110. </view>
  111. </view>
  112. <view class="bottom flexC">
  113. <view v-throttle="2000" class="bottom_btn" @click="submitAuth">提交</view>
  114. </view>
  115. </view>
  116. </template>
  117. <script>
  118. import { _API_QuickBankApply, _API_QuickBankConfirm } from '../../apis/zbs.js';
  119. import WPicker from '@/components/w-picker/w-picker.vue';
  120. import cityPicker from '@/components/citypicker/city-picker.vue';
  121. export default {
  122. data() {
  123. return {
  124. type: 1,
  125. array: [
  126. {
  127. name: '非长期有效',
  128. id: 0
  129. },
  130. {
  131. name: '长期有效',
  132. id: 1
  133. }
  134. ],
  135. newDown: 0, //手机验证码倒计时,
  136. params: {
  137. CardName: '', //开户人姓名
  138. mobile: '', //开户人手机号
  139. CertID: '', //证件号码
  140. CardID: '', //银行卡号
  141. startDate: '', //证件开始时间
  142. endDate: '', //证件到期时间
  143. type: 0, // 证件是否长期,
  144. order_id: '', // 申请接口返回
  145. trans_id: '', // 申请接口返回
  146. sms_code: '', // 手机验证码
  147. },
  148. authCon: {
  149. front: '/static/zbs/card_front.png', //身份证正面照
  150. otherSide: '/static/zbs/card_reverse.png', //身份证反面照
  151. }
  152. };
  153. },
  154. onLoad(option) {
  155. this.type = option.type
  156. },
  157. onShow() {
  158. },
  159. methods: {
  160. // 身份证是否长期,选择框
  161. bindPickerChange(e) {
  162. this.params.type = e.detail.value
  163. },
  164. /*更换身份证到期时间*/
  165. bindDateChange1: function(e) {
  166. this.params.startDate = e.target.value;
  167. },
  168. bindDateChange2: function(e) {
  169. this.params.endDate = e.target.value;
  170. },
  171. //获取手机号验证码
  172. getNew() {
  173. let that = this;
  174. if (that.newDown) {
  175. uni.showModal({
  176. content: '验证码已发送,请稍后重试',
  177. showCancel: false
  178. });
  179. return false;
  180. }
  181. const { CardName, mobile, CertID, startDate, endDate, CardID, type } = this.params
  182. if (!CardName || !mobile || !CertID || !startDate || !CardID || (!type && !endDate)) {
  183. uni.showModal({
  184. content: '请补全信息',
  185. showCancel: false
  186. })
  187. return false
  188. }
  189. if (!mobile.match(/^[1][3-9]\d{9}$/)) {
  190. uni.showModal({
  191. content: '手机号格式不正确',
  192. showCancel: false
  193. })
  194. return
  195. }
  196. _API_QuickBankApply({
  197. CardName, mobile, CertID, startDate, endDate, CardID, type
  198. })
  199. .then(res => {
  200. if (res.code == 200) {
  201. uni.showModal({
  202. content: '验证码发送成功',
  203. showCancel: false
  204. });
  205. this.params.order_id = res.data.order_id
  206. this.params.trans_id = res.data.trans_id
  207. this.newDown = 180;
  208. this.timer = setInterval(() => {
  209. this.newDown--;
  210. if (!this.newDown) {
  211. this.newDown = 0;
  212. clearInterval(this.timer);
  213. }
  214. }, 1000);
  215. } else {
  216. uni.showModal({
  217. content: res.message || '获取验证码失败',
  218. showCancel: false
  219. });
  220. return false;
  221. }
  222. })
  223. },
  224. /*截取身份证到期时间信息*/
  225. getCaption(obj, type) {
  226. if (type === 0) {
  227. obj = obj.split('-')[0]
  228. } else {
  229. obj = obj.split('-')[1]
  230. }
  231. if (obj != '长期') {
  232. obj = obj.replace(/\./g, '-');
  233. }
  234. return obj;
  235. },
  236. /*提交*/
  237. submitAuth() {
  238. const { CardName, mobile, CertID, CardID, order_id, trans_id, sms_code } = this.params
  239. if (!CardName) {
  240. uni.showModal({
  241. content: '姓名格式不正确!',
  242. showCancel: false
  243. });
  244. return false;
  245. }
  246. if (!mobile.match(/^[1][3-9]\d{9}$/)) {
  247. uni.showModal({
  248. content: '手机号格式不正确',
  249. showCancel: false
  250. })
  251. return
  252. }
  253. if (!CertID) {
  254. uni.showModal({
  255. content: '请输入身份证号!',
  256. showCancel: false
  257. });
  258. return false;
  259. }
  260. if (!CardID) {
  261. uni.showModal({
  262. content: '请输入银行卡号!',
  263. showCancel: false
  264. });
  265. return false;
  266. }
  267. if (!sms_code) {
  268. uni.showModal({
  269. content: '请输入验证码!',
  270. showCancel: false
  271. });
  272. return false;
  273. }
  274. uni.showLoading({
  275. title: '提交中...'
  276. })
  277. _API_QuickBankConfirm({
  278. CardName, mobile, CertID, CardID, order_id, trans_id, sms_code
  279. })
  280. .then(res => {
  281. if (res.code == 200) {
  282. uni.showModal({
  283. title: '提示',
  284. content: '绑定成功',
  285. showCancel: false,
  286. success: (res) => {
  287. if (res.confirm) {
  288. if (this.type == 1) {
  289. uni.redirectTo({
  290. url: './detail'
  291. })
  292. } else {
  293. uni.navigateBack()
  294. }
  295. }
  296. },
  297. })
  298. } else {
  299. uni.showModal({
  300. content: res.message || '银行卡绑定失败',
  301. showCancel: false
  302. });
  303. return false;
  304. }
  305. })
  306. .catch(err => {
  307. uni.hideLoading()
  308. })
  309. }
  310. }
  311. };
  312. </script>
  313. <style lang="scss" scoped>
  314. .bottom {
  315. width: 100%;
  316. height: 102rpx;
  317. background: #FFFFFF;
  318. box-shadow: 0px -4rpx 24rpx 2rpx rgba(0,0,0,0.1);
  319. margin-top: 40rpx;
  320. &_btn {
  321. width: 702rpx;
  322. margin: 0 auto;
  323. height: 88rpx;
  324. background: $base-line-bg;
  325. opacity: 1;
  326. border-radius: 44rpx;
  327. color: #fff;
  328. text-align: center;
  329. line-height: 88rpx;
  330. font-size: 32rpx;
  331. }
  332. }
  333. .how_query {
  334. margin-top: 36rpx;
  335. text {
  336. color: $base-color;
  337. font-size: 32rpx;
  338. }
  339. .query_icon {
  340. width: 40rpx;
  341. height: 40rpx;
  342. margin-right: 10rpx;
  343. }
  344. }
  345. .pop {
  346. width: 100%;
  347. height: 100vh;
  348. position: fixed;
  349. top: 0;
  350. left: 0;
  351. background-color: rgba(0, 0, 0, 0.7);
  352. z-index: 9999999;
  353. .hint_icon {
  354. width: 183rpx;
  355. height: 135rpx;
  356. position: relative;
  357. margin-top: -85rpx;
  358. }
  359. .pop_con {
  360. width: 648rpx;
  361. height: 482rpx;
  362. background: #fff;
  363. border-radius: 26rpx;
  364. display: flex;
  365. flex-direction: column;
  366. align-items: center;
  367. padding: 0 30rpx;
  368. box-sizing: border-box;
  369. .title {
  370. font-size: 38rpx;
  371. font-weight: bold;
  372. margin-top: 24rpx;
  373. }
  374. .con {
  375. min-height: 150rpx;
  376. margin: 24rpx 0 40rpx;
  377. font-size: 34rpx;
  378. line-height: 1.5;
  379. }
  380. .btn_box {
  381. width: 100%;
  382. view {
  383. width: 270rpx;
  384. height: 88rpx;
  385. background: #F5F5F5;
  386. border-radius: 44rpx;
  387. color: #333;
  388. font-size: 32rpx;
  389. font-weight: bold;
  390. }
  391. view:last-child {
  392. background: $base-line-bg;
  393. color: #fff;
  394. }
  395. }
  396. }
  397. .iconfont {
  398. color: #fff;
  399. font-size: 60rpx;
  400. margin-top: 30rpx;
  401. }
  402. }
  403. .shop_auth {
  404. width: 100%;
  405. min-height: 100%;
  406. background: #fff;
  407. .step {
  408. margin-top: 30rpx;
  409. }
  410. .content {
  411. width: 690rpx;
  412. margin: 0 auto;
  413. input {
  414. font-size: 30rpx;
  415. }
  416. .label {
  417. font-size: 32rpx;
  418. padding: 15rpx 0;
  419. font-weight: bold;
  420. // .star {
  421. // color: #f00;
  422. // margin-left: 4rpx;
  423. // font-size: 45rpx;
  424. // }
  425. }
  426. .inp {
  427. height: 88rpx;
  428. background: #f8f8f8;
  429. padding-right: 30rpx;
  430. border-radius: 8rpx 8rpx 8rpx 8rpx;
  431. box-sizing: border-box;
  432. &_code {
  433. width: 188rpx;
  434. height: 64rpx;
  435. border-radius: 32rpx 32rpx 32rpx 32rpx;
  436. opacity: 1;
  437. border: 2rpx solid #FF0000;
  438. text-align: center;
  439. line-height: 64rpx;
  440. font-size: 28rpx;
  441. font-family: PingFang SC, PingFang SC;
  442. font-weight: 400;
  443. color: #FF0000;
  444. }
  445. }
  446. .auth_inp {
  447. input,
  448. .date_picker {
  449. min-height: 96rpx;
  450. background: #f8f8f8;
  451. border-radius: 8rpx;
  452. font-size: 32rpx;
  453. padding: 0 30rpx;
  454. }
  455. .iconfont {
  456. color: #a7a7a7;
  457. font-size: 35rpx;
  458. }
  459. .place {
  460. font-size: 32rpx;
  461. color: #a7a7a7;
  462. }
  463. .picker {
  464. min-height: 96rpx;
  465. background: #f8f8f8;
  466. padding: 0 30rpx;
  467. input {
  468. padding-left: 0;
  469. width: 92%;
  470. min-height: 96rpx;
  471. }
  472. text:first-child {
  473. font-size: 32rpx;
  474. }
  475. }
  476. }
  477. .main_btn {
  478. width: 300rpx;
  479. margin: 0 auto;
  480. height: 88rpx;
  481. background: $base-line-bg;
  482. border-radius: 44rpx;
  483. color: #fff;
  484. text-align: center;
  485. line-height: 88rpx;
  486. font-size: 32rpx;
  487. }
  488. .second_btn {
  489. width: 300rpx;
  490. margin: 0 auto;
  491. height: 88rpx;
  492. border: 2rpx solid $base-color;
  493. background: #fff4f3;
  494. border-radius: 44rpx;
  495. color: #fff;
  496. text-align: center;
  497. line-height: 88rpx;
  498. font-size: 32rpx;
  499. color: $base-color;
  500. }
  501. .next {
  502. margin: 50rpx auto 30rpx;
  503. }
  504. .sub {
  505. margin: 30rpx auto 20rpx;
  506. }
  507. .hint {
  508. font-size: 36rpx;
  509. font-weight: bold;
  510. padding: 24rpx 0;
  511. }
  512. .card {
  513. width: 340rpx;
  514. height: 220rpx;
  515. margin-bottom: 30rpx;
  516. border-radius: 24rpx;
  517. }
  518. .rule {
  519. image {
  520. width: 100%;
  521. height: 140rpx;
  522. }
  523. view {
  524. font-size: 24rpx;
  525. color: #999;
  526. text-align: center;
  527. margin: 30rpx 0 60rpx;
  528. }
  529. }
  530. .notice {
  531. font-size: 28rpx;
  532. color: #999;
  533. text-align: center;
  534. margin: 15rpx 0 50rpx;
  535. }
  536. }
  537. }
  538. .pop_box {
  539. .box_inp {
  540. width: 100%;
  541. padding: 20rpx 0;
  542. box-sizing: border-box;
  543. background: #fff;
  544. top: 0;
  545. left: 0;
  546. z-index: 99;
  547. text-align: center;
  548. input {
  549. height: 90rpx;
  550. width: 90%;
  551. border: 2rpx solid #cccccc;
  552. background: #fff !important;
  553. padding-left: 20rpx;
  554. border-radius: 44rpx;
  555. }
  556. }
  557. .scroll {
  558. height: 600rpx;
  559. .scroll_con {
  560. padding-bottom: 50rpx;
  561. view {
  562. font-size: 36rpx;
  563. padding: 15rpx;
  564. text-align: center;
  565. }
  566. }
  567. .no_branch {
  568. width: 100%;
  569. text-align: center;
  570. margin-top: 30rpx;
  571. color: #999;
  572. font-size: 30rpx;
  573. }
  574. }
  575. }
  576. </style>