bankCard.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598
  1. <template>
  2. <view class="">
  3. <u-tabs :list="list" :is-scroll="false" :current="current" @change="change"></u-tabs>
  4. <view class="page" v-if="cardPackList1.length>0 || cardPackList2.length>0 || cardPackList3.length>0">
  5. <view v-if="current==0" class="bankClass dis a-start f-c j-s" v-for="(item,index) in cardPackList1"
  6. :key="index" :style="{background:item.stylelist.background}">
  7. <image class="Backgroundimage" src="/static/image/bindBank/img1.png" mode="" style=""></image>
  8. <view class="dis j-s">
  9. <view class="dis">
  10. <view class="logo">
  11. <image :src="item.stylelist.logo" mode=""></image>
  12. </view>
  13. <view class="banktitle dis f-c j-s">
  14. <text>{{item.bankName}}</text>
  15. <text>储蓄卡</text>
  16. </view>
  17. </view>
  18. </view>
  19. <view class="bank dis j-s a-c">
  20. <view v-for="(item,index) in item.bankArray" :key="index">{{item}}</view>
  21. </view>
  22. </view>
  23. <view v-if="current==1 " class="bankClass dis a-start f-c j-s" v-for="(item,index) in cardPackList2"
  24. :key="index" :style="{background:item.stylelist.background}">
  25. <image class="Backgroundimage" src="/static/image/bindBank/img1.png" mode="" style=""></image>
  26. <view class="dis j-s">
  27. <view class="dis">
  28. <view class="logo">
  29. <image :src="item.stylelist.logo" mode=""></image>
  30. </view>
  31. <view class="banktitle dis f-c j-s">
  32. <text>{{item.bankAccount}}</text>
  33. <text>储蓄卡</text>
  34. </view>
  35. </view>
  36. <view class="dis ">
  37. <image class="tool" src="/static/image/bindBank/del.png" mode="" @click="del(item.id)">
  38. </image>
  39. </view>
  40. </view>
  41. <view class="bank dis j-s a-c">
  42. <view v-for="(item,index) in item.bankArray" :key="index">{{item}}</view>
  43. </view>
  44. </view>
  45. <view class="" v-if="current==2" v-for="(item,index) in cardPackList3" :key="index">
  46. <view class="rejectionReason dis a-start j-start">
  47. <view style="width: 5%;margin-top: 2px;">
  48. <image src="/static/image/bindBank/bohui.png" mode="" style="width: 14px;height: 14px;">
  49. </image>
  50. </view>
  51. <view style="width: 95%;">
  52. 驳回原因:{{item.remark?item.remark:'无'}}</view>
  53. </view>
  54. <view class="bankClass dis a-start f-c j-s" :style="{background:item.stylelist.background}">
  55. <image class="Backgroundimage" src="/static/image/bindBank/img1.png" mode="" style=""></image>
  56. <view class="dis j-s">
  57. <view class="dis">
  58. <view class="logo">
  59. <image :src="item.stylelist.logo" mode=""></image>
  60. </view>
  61. <view class="banktitle dis f-c j-s">
  62. <text>{{item.bankAccount}}</text>
  63. <text>储蓄卡</text>
  64. </view>
  65. </view>
  66. </view>
  67. <view class="bank dis j-s a-c">
  68. <view v-for="(item,index) in item.bankArray" :key="index">{{item}}</view>
  69. </view>
  70. </view>
  71. </view>
  72. </view>
  73. <u-empty text="暂无数据" mode="order" class="flexd" v-else></u-empty>
  74. <view class="fixed">
  75. <view class="withdrawal-fun" @click="getbankCard">+添加银行卡</view>
  76. <!-- <u-button type="primary" style="background-color:#0052FF ;font-weight: bold;" @tap="getbankCard">+
  77. 添加银行卡</u-button> -->
  78. </view>
  79. <u-modal v-model="deleteshow" :show-cancel-button='true' @confirm="delbankCard">
  80. <view class="slot-content dis a-c j-c" style="padding: 10px;">
  81. <span style="font-weight: bold;">点击确定解绑银行卡</span>
  82. </view>
  83. </u-modal>
  84. <u-popup mode="bottom" v-model="promptShow" width="100%" height="50%" border-radius="14" :closeable="true">
  85. <view style="padding: 16px;">
  86. <view class="binding dis f-c a-c ">
  87. <view class="title dis f-c a-c ">
  88. <text>修改银行卡信息</text>
  89. <text>请填写本人的银行卡信息</text>
  90. </view>
  91. <view class="formInfo">
  92. <u-field v-model="form.realUserName" :field-style="{textAlign:'right'}" label="本人姓名"
  93. placeholder="输入真实姓名">
  94. </u-field>
  95. <u-field v-model="form.bankNumber" @blur="validateBankCard" :field-style="{textAlign:'right'}"
  96. label="银行卡号" placeholder="请输入银行卡卡号">
  97. </u-field>
  98. <u-field @click="showAction" v-model="form.bankAccount" :field-style="{textAlign:'right'}"
  99. label="选择银行" placeholder="点击选择银行">
  100. </u-field>
  101. <u-field v-model="form.bankAddress" :field-style="{textAlign:'right'}" label="开户行"
  102. placeholder="输入开户行">
  103. </u-field>
  104. </view>
  105. <u-button class="mt-5" type="primary"
  106. style="background-color:#0052FF ;font-weight: bold;width: 100%;" @tap="updateSubmit">
  107. 点击修改</u-button>
  108. </view>
  109. </view>
  110. </u-popup>
  111. <u-select v-model="show" :list="bnklist" @confirm="confirm"></u-select>
  112. </view>
  113. </template>
  114. <script>
  115. import {
  116. mapState,
  117. mapMutations
  118. } from "vuex"
  119. export default {
  120. data() {
  121. return {
  122. show: false,
  123. bnklist: [{
  124. value: '1',
  125. label: '中国工商银行'
  126. },
  127. {
  128. value: '2',
  129. label: '中国农业银行'
  130. },
  131. {
  132. value: '3',
  133. label: '中国银行'
  134. },
  135. {
  136. value: '4',
  137. label: '中国建设银行'
  138. },
  139. {
  140. value: '5',
  141. label: '交通银行'
  142. },
  143. {
  144. value: '6',
  145. label: '中国邮政储蓄银行'
  146. },
  147. {
  148. value: '7',
  149. label: '招商银行'
  150. },
  151. {
  152. value: '8',
  153. label: '中信银行'
  154. },
  155. {
  156. value: '9',
  157. label: '中国光大银行'
  158. },
  159. {
  160. value: '10',
  161. label: '华夏银行'
  162. },
  163. {
  164. value: '11',
  165. label: '中国民生银行'
  166. },
  167. {
  168. value: '12',
  169. label: '广发银行'
  170. },
  171. {
  172. value: '13',
  173. label: '平安银行'
  174. },
  175. {
  176. value: '14',
  177. label: '上海浦东发展银行'
  178. },
  179. {
  180. value: '15',
  181. label: '兴业银行'
  182. },
  183. {
  184. value: '16',
  185. label: '浙商银行'
  186. },
  187. {
  188. value: '17',
  189. label: '渤海银行'
  190. },
  191. {
  192. value: '18',
  193. label: '恒丰银行'
  194. },
  195. {
  196. value: '19',
  197. label: '北京银行'
  198. },
  199. {
  200. value: '20',
  201. label: '上海银行'
  202. },
  203. {
  204. value: '21',
  205. label: '晋商银行'
  206. },
  207. {
  208. value: '22',
  209. label: '山西银行'
  210. },
  211. {
  212. value: '23',
  213. label: '农村商业银行'
  214. },
  215. ],
  216. form: {
  217. bankNumber: "",
  218. realUserName: "",
  219. bankAccount: "",
  220. bankAddress: "",
  221. },
  222. promptShow: false,
  223. id: "",
  224. deleteshow: false,
  225. list: [{
  226. name: '未审核'
  227. }, {
  228. name: '已审核'
  229. }, {
  230. name: '驳回',
  231. }],
  232. current: 1,
  233. validateBankCardStatus: false, //银行卡验证状态
  234. bankNumber: "",
  235. cardPackList1: [],
  236. cardPackList2: [],
  237. cardPackList3: [],
  238. bankList: [{
  239. bankName: "中国邮政储蓄银行",
  240. logo: "/static/image/bankLogo/youzheng.png",
  241. background: "linear-gradient(90deg, rgba(79, 136, 69, 0.7) 0%, #4f8845 100%)"
  242. },
  243. {
  244. bankName: "中国工商银行",
  245. logo: "/static/image/bankLogo/gongshang.png",
  246. background: "linear-gradient(90deg, rgba(177, 0, 13, 0.7) 0%, #b1000d 100%)"
  247. },
  248. {
  249. bankName: "中国农业银行",
  250. logo: "/static/image/bankLogo/nongye.png",
  251. background: "linear-gradient(90deg, rgba(86,152, 130, 0.7) 0%, #569882 100%)"
  252. },
  253. {
  254. bankName: "中国银行",
  255. logo: "/static/image/bankLogo/zhongguo.png",
  256. background: "linear-gradient(90deg, rgba(157, 32, 40, 0.7) 0%, #9d2028 100%)"
  257. },
  258. {
  259. bankName: "中国建设银行",
  260. logo: "/static/image/bankLogo/jianshe.png",
  261. background: "linear-gradient(90deg, rgba(6, 89, 159, 0.7) 0%, #06569F 100%)"
  262. },
  263. {
  264. bankName: "招商银行",
  265. logo: "/static/image/bankLogo/zhaoshang.png",
  266. background: "linear-gradient(90deg, rgba(197, 0, 25, 0.7) 0%, #c50019 100%)"
  267. },
  268. {
  269. bankName: "中国民生银行",
  270. logo: "/static/image/bankLogo/minsheng.png",
  271. background: "linear-gradient(90deg, rgba(84,149, 92, 0.7) 0%, #54955c 100%)"
  272. },
  273. {
  274. bankName: "中国光大银行",
  275. logo: "/static/image/bankLogo/guangda.png",
  276. background: "linear-gradient(90deg, rgba(93, 30, 131, 0.7) 0%, #5d1e83 100%)"
  277. },
  278. {
  279. bankName: "中信银行",
  280. logo: "/static/image/bankLogo/zhongxin.png",
  281. background: "linear-gradient(90deg, rgba(184, 0,22, 0.7) 0%, #b80016 100%)"
  282. },
  283. {
  284. bankName: "华夏银行",
  285. logo: "/static/image/bankLogo/huaxia.png",
  286. background: "linear-gradient(90deg, rgba(216, 12, 24, 0.7) 0%, #d80c18 100%)"
  287. },
  288. {
  289. bankName: "中国交通银行",
  290. logo: "/static/image/bankLogo/jiaotong.png",
  291. background: "linear-gradient(90deg, rgba(33, 58, 120, 0.7) 0%, #213a78 100%)"
  292. },
  293. {
  294. bankName: "晋商银行",
  295. logo: "/static/image/bankLogo/jinshang.png",
  296. background: "linear-gradient(90deg, rgba(224, 150, 165, 0.7) 0%, #e096a5 100%)"
  297. },
  298. {
  299. bankName: "山西银行",
  300. logo: "/static/image/bankLogo/shanxi.png",
  301. background: "linear-gradient(90deg, rgba(192, 19, 73, 0.7) 0%, #c01349 100%)"
  302. },
  303. {
  304. bankName: "农村商业银行",
  305. logo: "/static/image/bankLogo/nongcun.png",
  306. background: "linear-gradient(90deg, rgba(0, 155, 77, 0.7) 0%, #009b4d 100%)"
  307. },
  308. ],
  309. }
  310. },
  311. onShow() {
  312. this.getcardPack(); //获取卡包
  313. },
  314. watch: {
  315. "form.bankNumber": {
  316. handler(val) {
  317. if (val) {
  318. this.form.bankNumber = val.replace(/\s/g, "");
  319. }
  320. },
  321. },
  322. },
  323. computed: {
  324. ...mapState(['userInfo'])
  325. },
  326. onLoad() {},
  327. methods: {
  328. async updateSubmit() {
  329. if (!this.form.bankNumber || !this.form.realUserName || !this.form.bankAccount || !this.form
  330. .bankAddress) {
  331. return uni.showToast({
  332. title: '信息不完整',
  333. duration: 2000,
  334. icon: "none"
  335. });
  336. }
  337. let res = await this.$http.put('/userBank/update', this.form);
  338. if (res.code == '200') {
  339. uni.showToast({
  340. title: res.msg,
  341. icon: "none"
  342. });
  343. this.promptShow = false;
  344. this.getcardPack();
  345. } else {
  346. uni.showToast({
  347. title: res.msg,
  348. icon: "none"
  349. });
  350. }
  351. },
  352. confirm(e) {
  353. this.form.bankAccount = e[0].label;
  354. },
  355. showAction() {
  356. this.show = true;
  357. },
  358. // 验证银行卡
  359. async validateBankCard() {
  360. var that = this;
  361. that.form.bankAccount = "";
  362. await bankBin.getBankBin(this.accountno)
  363. .then((data) => {
  364. that.form.bankAccount = data.bankName;
  365. that.validateBankCardStatus = true;
  366. return true;
  367. })
  368. .catch((err) => {
  369. that.validateBankCardStatus = false;
  370. return uni.showToast({
  371. title: err.split(":")[1],
  372. icon: "none"
  373. });
  374. })
  375. },
  376. change(index) {
  377. this.current = index;
  378. },
  379. async getcardPack() {
  380. let res = await this.$http.post('/userBankCard/queryUserBankCardList', {
  381. userId: this.userInfo.sysUser.userInfoId,
  382. });
  383. let list1 = [];
  384. let list2 = [];
  385. let list3 = [];
  386. console.log(res);
  387. if (res.code == '200' && res.data.records) {
  388. res.data.records.map(val => {
  389. let name = this.bankList.find(ele => ele.bankName === val.bankName)
  390. if (name) {
  391. val.stylelist = {
  392. ...name
  393. };
  394. } else {
  395. val.stylelist = {
  396. logo: "/static/image/bindBank/img1.png",
  397. background: 'linear-gradient(90deg, rgba(229, 166,0,0.7) 0%, #e5a600 100%)',
  398. }
  399. }
  400. const resultArray = [];
  401. for (let i = 0; i < val.bankCardNumber.length; i += 4) {
  402. resultArray.push(val.bankCardNumber.substring(i, i + 4));
  403. }
  404. val.bankArray = resultArray;
  405. switch (val.auditStatus) {
  406. case "0":
  407. list1.push(val);
  408. break;
  409. case "1":
  410. list2.push(val);
  411. break;
  412. case "2":
  413. list3.push(val);
  414. break;
  415. }
  416. })
  417. this.cardPackList1 = list1;
  418. this.cardPackList2 = list2;
  419. this.cardPackList3 = list3;
  420. console.log(this.cardPackList1);
  421. }
  422. },
  423. getbankCard() {
  424. this.navigate({
  425. url: '/pages/wallet/bindBank',
  426. }, "navigateTo", true)
  427. },
  428. del(id) {
  429. this.id = id;
  430. this.deleteshow = true;
  431. },
  432. async delbankCard() {
  433. let res = await this.$http.post('/userBank/unbind', {
  434. id: this.id,
  435. delFlag: '1',
  436. });
  437. if (res.code == '200') {
  438. this.getcardPack();
  439. uni.showToast({
  440. title: res.msg,
  441. duration: 2000,
  442. icon: "success"
  443. });
  444. }
  445. }
  446. },
  447. }
  448. </script>
  449. <style lang="scss" scoped>
  450. .binding {
  451. padding: 16px;
  452. .title {
  453. font-size: 14px;
  454. color: #333333;
  455. text:first-child {
  456. font-size: 20px;
  457. font-weight: bold;
  458. }
  459. }
  460. .formInfo {
  461. margin-top: 18px;
  462. width: 100%;
  463. background: #FFFFFF;
  464. box-shadow: 0px 4px 10px 0px #DAE3F4;
  465. border-radius: 6px;
  466. }
  467. }
  468. .rejectionReason {
  469. width: 100%;
  470. height: auto;
  471. padding: 5px;
  472. background: rgba(255, 15, 0, 0.1);
  473. border-radius: 8px 8px 8px 8px;
  474. margin-bottom: 5px;
  475. >view {
  476. color: #DC0D00;
  477. font-size: 12px;
  478. }
  479. }
  480. page {
  481. background-color: #fff;
  482. }
  483. .page {
  484. padding: 10px 16px;
  485. }
  486. .fixed {
  487. position: fixed;
  488. bottom: 0;
  489. left: 0;
  490. width: 100%;
  491. height: 62px;
  492. background: #FFFFFF;
  493. box-shadow: 0px -4px 10px 0px rgba(0, 0, 0, 0.1);
  494. padding: 12px 16px;
  495. }
  496. .bankClass {
  497. width: 100%;
  498. height: 110px;
  499. border-radius: 6px;
  500. padding: 14px;
  501. position: relative;
  502. margin-bottom: 15px;
  503. .Backgroundimage {
  504. width: 94px;
  505. height: 86px;
  506. position: absolute;
  507. right: 0;
  508. bottom: 0;
  509. }
  510. >view {
  511. width: 100%;
  512. }
  513. .bank {
  514. font-size: 18px;
  515. color: #fff;
  516. line-height: 1;
  517. view {
  518. font-size: 18px;
  519. line-height: 1;
  520. }
  521. }
  522. .logo {
  523. width: 39px;
  524. height: 39px;
  525. background: #FFFFFF;
  526. border-radius: 6px;
  527. image {
  528. width: 100%;
  529. height: 100%;
  530. }
  531. }
  532. .tool {
  533. width: 20px;
  534. height: 20px;
  535. }
  536. .banktitle {
  537. margin-left: 12px;
  538. text:first-child {
  539. color: #fff;
  540. font-weight: bold;
  541. font-size: 16px;
  542. line-height: 1;
  543. }
  544. text:last-child {
  545. color: #fff;
  546. font-size: 12px;
  547. line-height: 1;
  548. }
  549. }
  550. }
  551. .flexd {
  552. position: fixed;
  553. top: 0;
  554. bottom: 0;
  555. left: 0;
  556. right: 0;
  557. z-index: -1;
  558. }
  559. .withdrawal-fun {
  560. background: linear-gradient(132deg, #2DD9FF 0%, #2D6DFF 100%);
  561. border-radius: 5px 5px 5px 5px;
  562. color: #fff;
  563. font-size: 16px;
  564. text-align: center;
  565. line-height: 42px;
  566. }
  567. </style>