mybank.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692
  1. <template>
  2. <view style="position: relative;">
  3. <!-- 胶囊 -->
  4. <mvBar :mysNavConfig="mysNavConfig"></mvBar>
  5. <view style="margin-top: 160rpx;"></view>
  6. <view>
  7. <!-- 银行卡信息绑定 -->
  8. <view style="margin: 0 20rpx;">
  9. <font style="margin: 30rpx 20rpx 20rpx;color: #878994;">银行卡信息绑定</font>
  10. <uni-forms :modelValue="formData" err-show-type="undertext">
  11. <uni-forms-item name="name" required label="户主姓名">
  12. <uni-easyinput type="text" :inputBorder="false" v-model="formData.name" placeholder="姓名">
  13. </uni-easyinput>
  14. </uni-forms-item>
  15. <uni-forms-item name="cardid" required label="身份证号">
  16. <uni-easyinput type="text" :inputBorder="false" v-model="formData.bank_card_id"
  17. placeholder="18位身份证号">
  18. </uni-easyinput>
  19. </uni-forms-item>
  20. <uni-forms-item name="bankcard" required label="银行卡号">
  21. <uni-easyinput type="number" maxlength="19" :inputBorder="false"
  22. v-model="formData.bank_card_number" placeholder="请填写卡号">
  23. </uni-easyinput>
  24. </uni-forms-item>
  25. <uni-forms-item name="bank" required label="银行">
  26. <picker @change="bindPickerChange1" :value="index1" :range="array1" range-key="name">
  27. <view>{{ array1[index1].name }}</view>
  28. </picker>
  29. </uni-forms-item>
  30. <uni-forms-item name="vregion" required label="开户地">
  31. <picker class="picker" mode="multiSelector" :range="region" range-key="name"
  32. :value="regionIndex" @change="pickerChange" @columnchange="pickerColumnchange">
  33. <view class="pbox" :class="{'pbox_hover':regionStr != '请选择省市区'}">
  34. <view>{{regionStr}}</view>
  35. <text class="iconfont icon-you"></text>
  36. </view>
  37. </picker>
  38. </uni-forms-item>
  39. <uni-forms-item name="phone" required label="手机号">
  40. <uni-easyinput type="number" maxlength="11" :inputBorder="false" v-model="formData.phone"
  41. placeholder="请填写手机号">
  42. </uni-easyinput>
  43. </uni-forms-item>
  44. </uni-group>
  45. </uni-forms>
  46. </view>
  47. <view>
  48. <button class="btn1" @click="submitForm()">保存</button>
  49. </view>
  50. </view>
  51. </view>
  52. </template>
  53. <script>
  54. import region from '@/components/pca-code.json';
  55. import mvBar from "@/components/mys_navBar/mysNavBar";
  56. export default {
  57. components: {
  58. mvBar,
  59. },
  60. data() {
  61. return {
  62. index1: 0,
  63. formData: {
  64. name: '',
  65. phone: '',
  66. bank_id: '',
  67. bank_card_number: '',
  68. bank_open_address: '',
  69. bank_card_id: '',
  70. alipay_number: '',
  71. alipay_real_name: '',
  72. alipay_card_id: '',
  73. },
  74. oldRegion: region,
  75. region: [
  76. [],
  77. [],
  78. []
  79. ],
  80. // 选择省市区的下标Index 传则默认选中传递的
  81. regionIndex: [0, 0, 0],
  82. // 省市区字符串
  83. regionStr: '请选择省市区',
  84. array1: [{
  85. name: '请选择',
  86. id: 0
  87. }, {
  88. name: '中国农业银行',
  89. id: 1
  90. }, {
  91. name: '中国工商银行',
  92. id: 2
  93. }],
  94. mysNavConfig: {
  95. /* 开启单页显示首页图标 */
  96. isHome: true,
  97. /* 固定导航 */
  98. navFixed: true,
  99. /* 标题 (屏幕中心居中 两边图标中心居中使用slot center1) */
  100. navTitle: {
  101. text: "银行卡信息绑定",
  102. color: "",
  103. fontSize: "32rpx", // px upx rpx
  104. fontWeight: "normal", // 100 - 700
  105. },
  106. btnType: "type2",
  107. onLeftClick: '',
  108. /* type2 按钮 */
  109. type2Config: {
  110. // 左图标
  111. leftPath: "/static/img/png2.png",
  112. // 右图标
  113. rightPath: "/static/img/png4.png",
  114. // 圆角
  115. radius: "40rpx",
  116. },
  117. },
  118. }
  119. },
  120. onShow() {
  121. this.getInfo();
  122. this.initRegion();
  123. },
  124. methods: {
  125. initRegion() {
  126. // 声明城市数组
  127. let cityArr = [];
  128. let countyArr = [];
  129. // 设置下标
  130. this.regionIndex = [0, 0, 0];
  131. // 改变城市列表
  132. this.region[1] = this.oldRegion[0].children.map(item => {
  133. cityArr.push({
  134. name: item.name,
  135. code: item.code
  136. });
  137. })
  138. this.$set(this.region, 1, cityArr);
  139. // 改变县区列表
  140. this.oldRegion[0].children[0].children.map(item => {
  141. countyArr.push({
  142. name: item.name,
  143. code: item.code
  144. });
  145. })
  146. this.$set(this.region, 2, countyArr);
  147. },
  148. // 默认信息表,获取平台logo
  149. getInfo() {
  150. this.$https.get('/youngee/c/g/get-info-tables')
  151. .then(res => {
  152. this.array1 = res.data.data.Bank
  153. })
  154. this.getBankInfo()
  155. },
  156. getBankInfo() {
  157. this.$https.get('/youngee/c/t/g/get-talent-bank-info')
  158. .then(res => {
  159. console.log(res)
  160. if (res.data.data != null) {
  161. this.formData = res.data.data
  162. if (this.formData.bank_id != '') {
  163. this.index1 = this.formData.bank_id
  164. }
  165. if (this.formData.bank_open_address == 0) {
  166. this.formData.bank_open_address = ''
  167. } else {
  168. let a = this.formData.bank_open_address.toString().slice(0, 2)
  169. let b = this.formData.bank_open_address.toString().slice(0, 4)
  170. let c = 0
  171. for (var i = 0; i < region.length; i++) {
  172. if (region[i].code == a) {
  173. a = region[i].name
  174. for (var j = 0; j < region[i].children.length; j++) {
  175. if (region[i].children[j].code == b) {
  176. b = region[i].children[j].name
  177. for (var o = 0; o < region[i].children[j].children.length; o++) {
  178. if (region[i].children[j].children[o].code == this.formData
  179. .bank_open_address) {
  180. c = region[i].children[j].children[o].name
  181. }
  182. }
  183. }
  184. }
  185. }
  186. }
  187. this.regionStr = a + ' ' + b + ' ' + c
  188. }
  189. }
  190. })
  191. },
  192. submitForm() {
  193. let f1 = true
  194. let message1 = ""
  195. // 检查是否填写银行卡信息
  196. if (this.formData.name == "") {
  197. f1 = false;
  198. message1 = "请输入正确的户主姓名"
  199. } else if (this.formData.bank_card_id.length != 18) {
  200. f1 = false;
  201. message1 = "请输入正确的身份证号"
  202. } else if (this.formData.bank_card_number == "" || (this.formData.bank_card_number.length != 16 && this
  203. .formData.bank_card_number.length != 17 && this.formData.bank_card_number.length != 19)) {
  204. f1 = false;
  205. message1 = "请输入正确的银行卡号"
  206. } else if (this.formData.bank_id == 0) {
  207. f1 = false;
  208. message1 = "请选择银行"
  209. } else if (this.formData.bank_open_address == "") {
  210. f1 = false;
  211. message1 = "请选择开户地"
  212. } else if (this.formData.phone == "" || this.formData.phone.length != 11) {
  213. f1 = false;
  214. message1 = "请输入正确的手机号"
  215. };
  216. if (f1) {
  217. console.log(this.formData)
  218. console.log(message1)
  219. this.$https.post('/youngee/c/t/p/add-talent-bank', this.formData)
  220. .then(res => {
  221. console.log(res)
  222. uni.showToast({
  223. title: "提现信息绑定成功",
  224. icon: 'none'
  225. })
  226. let pages = getCurrentPages(); // 当前页面
  227. let beforePage = pages[pages.length - 2]; // 上一页
  228. uni.navigateBack({
  229. success: function() {
  230. beforePage
  231. .onLoad(); // 执行上一页的onLoad方法
  232. }
  233. })
  234. })
  235. } else {
  236. uni.showToast({
  237. title: message1,
  238. icon: 'none'
  239. })
  240. }
  241. },
  242. bindPickerChange1: function(e) {
  243. console.log(e)
  244. this.index1 = e.detail.value;
  245. this.formData.bank_id = this.array1[this.index1].id
  246. console.log(this.formData.bank_id)
  247. },
  248. //城市选择
  249. pickerChange(e) {
  250. // console.log(e, '1');
  251. this.regionIndex = e.detail.value;
  252. this.regionStr = this.region[0][this.regionIndex[0]].name + ' ' + this.region[1][this.regionIndex[
  253. 1]]
  254. .name + ' ' +
  255. this.region[2][this.regionIndex[2]].name;
  256. // 组件传值
  257. this.$emit('region', [this.region[0][this.regionIndex[0]].code, this.region[1][this.regionIndex[1]]
  258. .code,
  259. this.region[
  260. 2][this.regionIndex[2]].code
  261. ]);
  262. this.formData.bank_open_address = this.region[2][this.regionIndex[2]].code;
  263. },
  264. pickerColumnchange(e) {
  265. // console.log(e);
  266. // 第几列滑动
  267. // console.log(e.detail.column);
  268. // 第几列滑动的下标
  269. // console.log(e.detail.value)
  270. if (e.detail.column === 0) {
  271. // 声明城市数组
  272. let cityArr = [];
  273. let countyArr = [];
  274. // 设置下标
  275. this.regionIndex = [e.detail.value, 0, 0];
  276. // 改变城市列表
  277. this.region[1] = this.oldRegion[e.detail.value].children.map(item => {
  278. cityArr.push({
  279. name: item.name,
  280. code: item.code
  281. });
  282. })
  283. this.$set(this.region, 1, cityArr);
  284. // 改变县区列表
  285. this.oldRegion[e.detail.value].children[0].children.map(item => {
  286. countyArr.push({
  287. name: item.name,
  288. code: item.code
  289. });
  290. })
  291. this.$set(this.region, 2, countyArr);
  292. }
  293. if (e.detail.column === 1) {
  294. this.regionIndex[1] = e.detail.value;
  295. this.regionIndex[2] = 0;
  296. let countyArr = [];
  297. this.oldRegion[this.regionIndex[0]].children[this.regionIndex[1]].children.map(item => {
  298. countyArr.push({
  299. name: item.name,
  300. code: item.code
  301. });
  302. })
  303. this.$set(this.region, 2, countyArr);
  304. }
  305. if (e.detail.column === 2) {
  306. this.regionIndex[2] = e.detail.value;
  307. }
  308. }
  309. },
  310. created() {
  311. let provinceArr = [];
  312. let cityArr = [];
  313. this.oldRegion.map((item, index) => {
  314. this.region[0].push({
  315. name: item.name,
  316. code: item.code
  317. });
  318. if (this.previnceId == item.code) {
  319. provinceArr = item.children;
  320. this.regionIndex[0] = index;
  321. }
  322. })
  323. // console.log(provinceArr);
  324. provinceArr.map((item, index) => {
  325. this.region[1].push({
  326. name: item.name,
  327. code: item.code
  328. });
  329. if (this.cityId == item.code) {
  330. cityArr = item.children;
  331. this.regionIndex[1] = index;
  332. }
  333. })
  334. cityArr.map((item, index) => {
  335. this.region[2].push({
  336. name: item.name,
  337. code: item.code
  338. });
  339. if (this.countyId == item.code)
  340. this.regionIndex[2] = index;
  341. })
  342. if (this.isRevise)
  343. this.regionStr = this.region[0][this.regionIndex[0]].name + ' ' + this.region[1][this.regionIndex[1]]
  344. .name + ' ' + this.region[2][this.regionIndex[2]].name;
  345. else
  346. this.regionStr = '请选择省市区';
  347. }
  348. }
  349. </script>
  350. <style>
  351. picker {
  352. position: relative;
  353. display: block;
  354. cursor: pointer;
  355. padding-left: 20rpx !important;
  356. padding-top: 14rpx !important;
  357. color: grey !important;
  358. }
  359. /deep/.uni-forms-item__inner {
  360. border-bottom: none !important;
  361. margin-bottom: 0 !important;
  362. }
  363. </style>
  364. <style lang="scss" scoped>
  365. view {
  366. font-size: 14px;
  367. line-height: inherit;
  368. }
  369. .menu {
  370. position: fixed;
  371. top: 180rpx;
  372. border-bottom: #FCCF41;
  373. background-color: #FFFFFF;
  374. justify-content: space-around;
  375. height: 5%;
  376. width: 100%;
  377. display: flex;
  378. z-index: 10;
  379. }
  380. .menu-item p {
  381. font-weight: 600;
  382. &.lor {
  383. border-bottom: 5rpx solid #F0D232;
  384. color: #F0D232;
  385. padding-bottom: 15rpx;
  386. }
  387. }
  388. .btn1 {
  389. margin: 30rpx;
  390. font-size: 35rpx;
  391. color: #000;
  392. background-color: #F0D232;
  393. border: none;
  394. border-radius: 0;
  395. }
  396. .uni-input-border,
  397. .uni-textarea-border {
  398. flex: 1;
  399. font-size: 14px;
  400. color: #666;
  401. border: 1px #FFFFFF solid;
  402. border-radius: 5px;
  403. /* #ifndef APP-NVUE */
  404. box-sizing: border-box;
  405. /* #endif */
  406. }
  407. .uni-input-border {
  408. padding: 0 10px;
  409. height: 35px;
  410. }
  411. .uni-textarea-border {
  412. padding: 10px;
  413. height: 80px;
  414. }
  415. .label-box {
  416. margin-right: 10px;
  417. }
  418. .transform-scale {
  419. transform: scale(0.7);
  420. }
  421. .butto {
  422. text-align: center;
  423. }
  424. .option {
  425. padding: 20rpx;
  426. }
  427. .uni-margin-wrap {
  428. width: 690rpx;
  429. width: 100%;
  430. ;
  431. }
  432. .swiper {
  433. height: 300rpx;
  434. }
  435. .swiper-item {
  436. display: block;
  437. height: 300rpx;
  438. line-height: 300rpx;
  439. text-align: center;
  440. }
  441. .swiper-list {
  442. margin-top: 40rpx;
  443. margin-bottom: 0;
  444. }
  445. .uni-common-mt {
  446. margin-top: 60rpx;
  447. position: relative;
  448. }
  449. .info {
  450. position: absolute;
  451. right: 20rpx;
  452. }
  453. .uni-padding-wrap {
  454. width: 550rpx;
  455. padding: 0 100rpx;
  456. }
  457. .signup {
  458. box-shadow: 0rpx 5rpx 40rpx #ccc;
  459. width: 100%;
  460. position: fixed;
  461. bottom: 0rpx;
  462. display: flex;
  463. height: 90rpx;
  464. padding-top: 2%;
  465. background-color: #FFFFFF;
  466. justify-content: space-around;
  467. }
  468. .signuptext {
  469. text-align: center;
  470. margin-top: 2%;
  471. }
  472. .signuptext p {
  473. font-size: 60%;
  474. color: #333333;
  475. }
  476. .signupbut {
  477. text-align: center;
  478. margin-top: 2%;
  479. }
  480. .but1 {
  481. width: 120%;
  482. text-align: center;
  483. background-color: #FCCF41;
  484. border-radius: 10rpx;
  485. color: #464100;
  486. font-size: 28rpx;
  487. line-height: 156%;
  488. font-weight: 500;
  489. height: 65%;
  490. }
  491. /deep/.uni-searchbar__box {
  492. border-color: #267CFF !important;
  493. border-width: 2rpx !important;
  494. }
  495. /deep/.uni-searchbar__box {
  496. background-color: #FFFFFF !important;
  497. }
  498. /deep/.uni-searchbar__text-placeholder {
  499. font-size: 30rpx !important;
  500. }
  501. /deep/.segmented-control__text {
  502. font-size: 34rpx !important;
  503. }
  504. /deep/.uni-data-checklist {
  505. padding-left: 20upx;
  506. }
  507. uni-picker {
  508. position: relative;
  509. display: block;
  510. cursor: pointer;
  511. padding-left: 20rpx !important;
  512. padding-top: 14rpx !important;
  513. color: grey !important;
  514. }
  515. /deep/.uni-date-x--border {
  516. border: 0px solid #dcdfe6 !important;
  517. }
  518. /deep/.is-input-border {
  519. border: 0px solid #c8c7cc !important;
  520. }
  521. /deep/.uni-progress-info {
  522. font-size: 25rpx !important;
  523. }
  524. /deep/.uni-error-message {
  525. position: absolute;
  526. bottom: -20rpx !important;
  527. left: 20rpx !important;
  528. text-align: left;
  529. }
  530. /deep/.uni-forms-item__inner {
  531. padding-bottom: 0rpx !important;
  532. margin-bottom: 30rpx !important;
  533. border-bottom: 0.5rpx solid #CCCCCC;
  534. }
  535. /deep/.uni-group__title {
  536. background-color: #FFFFFF !important;
  537. }
  538. /deep/.uni-list-item__content-title {
  539. font-size: 30rpx !important;
  540. color: #111111 !important;
  541. }
  542. /deep/.uni-progress-bar {
  543. border-radius: 10rpx !important;
  544. }
  545. /deep/.uni-progress-inner-bar {
  546. border-radius: 10rpx !important;
  547. }
  548. /deep/.is-input-border {
  549. border-radius: 20px !important;
  550. background-color: #fff;
  551. }
  552. .uni-easyinput__content-input {
  553. font-size: 30upx !important;
  554. }
  555. .content-clear-icon {
  556. font-size: 40upx !important;
  557. }
  558. /deep/.input-box {
  559. padding: 50upx;
  560. font-size: 30upx;
  561. .input-item {
  562. display: flex;
  563. border: 1upx solid #F8F8F8;
  564. line-height: 90upx;
  565. height: 90upx;
  566. margin-top: 20upx;
  567. background: #F8F8F8;
  568. border-radius: 48upx;
  569. .input-label {
  570. width: 150upx;
  571. text-align: center;
  572. }
  573. .input-body {
  574. position: relative;
  575. height: 100upx;
  576. width: calc(100% - 150upx);
  577. .input {
  578. line-height: 90upx;
  579. height: 90upx;
  580. position: relative;
  581. font-size: 28upx;
  582. }
  583. .eye {
  584. position: absolute;
  585. height: 50upx;
  586. width: 50upx;
  587. right: 20upx;
  588. top: 50%;
  589. transform: translateY(-50%);
  590. }
  591. .btn-code {
  592. position: absolute;
  593. right: 0upx;
  594. top: 50%;
  595. transform: translateY(-50%);
  596. background: none;
  597. color: #205592;
  598. width: 160upx;
  599. font-size: 24upx;
  600. box-sizing: border-box;
  601. text-align: center;
  602. padding: 0;
  603. height: 100upx;
  604. line-height: 100upx;
  605. }
  606. }
  607. }
  608. .select {
  609. // padding-top: 40upx;
  610. display: flex;
  611. justify-content: space-between;
  612. color: #003B67;
  613. }
  614. }
  615. /deep/.title-left {
  616. width: 3px;
  617. height: 16px;
  618. background: #267CFF;
  619. display: inline-block;
  620. border-radius: 3px;
  621. margin-top: 3px;
  622. vertical-align: top;
  623. margin-right: 10px;
  624. }
  625. </style>