bankCard.vue 14 KB

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