bankCard - 副本.vue 14 KB

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