bankCard.vue 14 KB

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