bankCard.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. <template>
  2. <view class="page">
  3. <view class="bankClass dis a-start" v-for="(item,index) in cardPackList" :key="item.id">
  4. <view class="top ">
  5. <view class="bankLogo">
  6. <image src="../../static/icon/bjdcar.png" mode=""></image>
  7. </view>
  8. </view>
  9. <view class="botn dis f-c a-s j-s">
  10. <view class="bankName dis f-c ">
  11. <text>{{item.bankAccount}}</text>
  12. <text>储蓄卡</text>
  13. </view>
  14. <text>···· ···· ···· {{item.bankNumber.slice(-4)}}</text>
  15. </view>
  16. <view style="margin-left: auto;" @click="delbankCard(item.id)">
  17. <u-icon name="trash-fill" color="#fff" size="50"></u-icon>
  18. </view>
  19. </view>
  20. <view class="bankClassadd dis a-c" @click="getbankCard">
  21. <u-icon name="plus" color="#000" size="40"></u-icon>
  22. <text style="margin-left: 10px;">添加银行卡</text>
  23. </view>
  24. </view>
  25. </template>
  26. <script>
  27. export default {
  28. data() {
  29. return {
  30. cardPackList: [],
  31. }
  32. },
  33. onShow() {
  34. this.getcardPack(); //获取卡包
  35. },
  36. onLoad() {
  37. this.getcardPack(); //获取卡包
  38. },
  39. methods: {
  40. async getcardPack() {
  41. let res = await this.$http.get('/userBank/getUserBankList');
  42. if (res.code == '200' && res.data) {
  43. this.cardPackList = res.data;
  44. }
  45. },
  46. getbankCard() {
  47. this.navigate({
  48. url: '/pages/wallet/bindBank',
  49. }, "navigateTo", true)
  50. },
  51. async delbankCard(id) {
  52. let res = await this.$http.delete('/userBank/' + id);
  53. if (res.code == '200') {
  54. this.getcardPack();
  55. uni.showToast({
  56. title: res.msg,
  57. duration: 2000,
  58. icon: "success"
  59. });
  60. }
  61. },
  62. },
  63. }
  64. </script>
  65. <style>
  66. page {
  67. background-color: #f2f2f2;
  68. }
  69. .page {
  70. padding: 10px 10px 50px;
  71. }
  72. .bankClass,
  73. .bankClassadd {
  74. width: 100%;
  75. height: 120px;
  76. background-color: #c65255;
  77. border-radius: 6px;
  78. padding: 14px;
  79. margin-top: 16px;
  80. .top {
  81. margin-top: 4px;
  82. }
  83. .bankLogo {
  84. width: 30px;
  85. height: 30px;
  86. background-color: #f0cdcb;
  87. border-radius: 50%;
  88. padding: 4px;
  89. box-sizing: border-box;
  90. margin-right: 10px;
  91. image {
  92. width: 100%;
  93. height: 100%;
  94. }
  95. }
  96. .botn {
  97. .bankName {
  98. text {
  99. font-size: 16px;
  100. color: #fff;
  101. }
  102. text:last-child {
  103. font-size: 12px;
  104. color: #ffffffb5;
  105. }
  106. }
  107. text {
  108. font-size: 24px;
  109. font-weight: bold;
  110. color: #fff;
  111. }
  112. }
  113. }
  114. .bankClassadd {
  115. background-color: #fff;
  116. height: 70px;
  117. }
  118. </style>