bankCard.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. <template>
  2. <view class="page">
  3. <view class="bankClass dis a-start f-c j-s" v-for="(item,index) in cardPackList" :key="index"
  4. :style="{background:item.stylelist.background}">
  5. <image class="Backgroundimage" src="/static/image/bindBank/img1.png" mode="" style=""></image>
  6. <view class="dis j-s">
  7. <view class="dis">
  8. <view class="logo">
  9. <image :src="item.stylelist.logo" mode=""></image>
  10. </view>
  11. <view class="banktitle dis f-c j-s">
  12. <text>{{item.bankAccount}}</text>
  13. <text>储蓄卡</text>
  14. </view>
  15. </view>
  16. <image class="tool" src="/static/image/bindBank/tool.png" mode="" @click="delbankCard(item.id)"></image>
  17. </view>
  18. <view class="bank dis j-s a-c">
  19. <view>****</view>
  20. <view>****</view>
  21. <view>****</view>
  22. <text>{{item.bankNumber.slice(-4)}}</text>
  23. </view>
  24. </view>
  25. <view class="fixed">
  26. <u-button type="primary" style="background-color:#0052FF ;font-weight: bold;" @tap="getbankCard">+
  27. 添加银行卡</u-button>
  28. </view>
  29. </view>
  30. </template>
  31. <script>
  32. export default {
  33. data() {
  34. return {
  35. bankNumber: "",
  36. cardPackList: [],
  37. bankList: [{
  38. bankName: "中国邮政储蓄银行",
  39. logo: "/static/image/bankLogo/youzheng.png",
  40. background: "linear-gradient(90deg, rgba(79, 136, 69, 0.7) 0%, #4f8845 100%)"
  41. },
  42. {
  43. bankName: "中国工商银行",
  44. logo: "/static/image/bankLogo/youzheng.png",
  45. background: "linear-gradient(90deg, rgba(177, 0, 13, 0.7) 0%, #b1000d 100%)"
  46. },
  47. {
  48. bankName: "中国农业银行",
  49. logo: "/static/image/bankLogo/youzheng.png",
  50. background: "linear-gradient(90deg, rgba(86,152, 130, 0.7) 0%, #569882 100%)"
  51. },
  52. {
  53. bankName: "中国银行",
  54. logo: "/static/image/bankLogo/youzheng.png",
  55. background: "linear-gradient(90deg, rgba(157, 32, 40, 0.7) 0%, #9d2028 100%)"
  56. },
  57. {
  58. bankName: "中国建设银行",
  59. logo: "/static/image/bankLogo/jianshe.png",
  60. background: "linear-gradient(90deg, rgba(6, 89, 159, 0.7) 0%, #06569F 100%)"
  61. },
  62. {
  63. bankName: "招商银行",
  64. logo: "/static/image/bankLogo/youzheng.png",
  65. background: "linear-gradient(90deg, rgba(197, 0, 25, 0.7) 0%, #c50019 100%)"
  66. },
  67. {
  68. bankName: "中国民生银行",
  69. logo: "/static/image/bankLogo/youzheng.png",
  70. background: "linear-gradient(90deg, rgba(84,149, 92, 0.7) 0%, #54955c 100%)"
  71. },
  72. {
  73. bankName: "中国光大银行",
  74. logo: "/static/image/bankLogo/youzheng.png",
  75. background: "linear-gradient(90deg, rgba(93, 30, 131, 0.7) 0%, #5d1e83 100%)"
  76. },
  77. {
  78. bankName: "中信银行",
  79. logo: "/static/image/bankLogo/youzheng.png",
  80. background: "linear-gradient(90deg, rgba(184, 0,22, 0.7) 0%, #b80016 100%)"
  81. },
  82. {
  83. bankName: "华夏银行",
  84. logo: "/static/image/bankLogo/youzheng.png",
  85. background: "linear-gradient(90deg, rgba(216, 12, 24, 0.7) 0%, #d80c18 100%)"
  86. },
  87. {
  88. bankName: "中国交通银行",
  89. logo: "/static/image/bankLogo/youzheng.png",
  90. background: "linear-gradient(90deg, rgba(33, 58, 120, 0.7) 0%, #213a78 100%)"
  91. },
  92. ],
  93. }
  94. },
  95. onShow() {
  96. this.getcardPack(); //获取卡包
  97. },
  98. onLoad() {
  99. this.getcardPack(); //获取卡包
  100. },
  101. methods: {
  102. async getcardPack() {
  103. let res = await this.$http.get('/userBank/getUserBankList');
  104. if (res.code == '200' && res.data) {
  105. this.bankList.map(val => {
  106. res.data.map(ele => {
  107. if (val.bankName == ele.bankAccount) {
  108. ele.stylelist = val;
  109. return ele;
  110. }
  111. })
  112. })
  113. this.cardPackList = res.data;
  114. }
  115. },
  116. getbankCard() {
  117. this.navigate({
  118. url: '/pages/wallet/bindBank',
  119. }, "navigateTo", true)
  120. },
  121. async delbankCard(id) {
  122. let res = await this.$http.delete('/userBank/' + id);
  123. if (res.code == '200') {
  124. this.getcardPack();
  125. uni.showToast({
  126. title: res.msg,
  127. duration: 2000,
  128. icon: "success"
  129. });
  130. }
  131. },
  132. //银行style数据匹配
  133. // bankMatching(Name) {
  134. // let obj = this.bankList.find(item => item.bankName === Name);
  135. // return obj;
  136. // }
  137. },
  138. }
  139. </script>
  140. <style lang="scss" scoped>
  141. page {
  142. background-color: #f2f2f2;
  143. }
  144. .page {
  145. padding: 10px 16px;
  146. }
  147. .fixed {
  148. position: fixed;
  149. bottom: 0;
  150. left: 0;
  151. width: 100%;
  152. height: 62px;
  153. background: #FFFFFF;
  154. box-shadow: 0px -4px 10px 0px rgba(0, 0, 0, 0.1);
  155. padding: 12px 16px;
  156. }
  157. .bankClass {
  158. width: 100%;
  159. height: 110px;
  160. border-radius: 6px;
  161. padding: 14px;
  162. position: relative;
  163. .Backgroundimage {
  164. width: 94px;
  165. height: 86px;
  166. position: absolute;
  167. right: 0;
  168. bottom: 0;
  169. }
  170. >view {
  171. width: 100%;
  172. }
  173. .bank {
  174. font-size: 18px;
  175. color: #fff;
  176. line-height: 1;
  177. view {
  178. font-size: 18px;
  179. line-height: 1;
  180. margin-top: 6px;
  181. }
  182. }
  183. .logo {
  184. width: 39px;
  185. height: 39px;
  186. background: #FFFFFF;
  187. border-radius: 6px;
  188. image {
  189. width: 100%;
  190. height: 100%;
  191. }
  192. }
  193. .tool {
  194. width: 28px;
  195. height: 20px;
  196. }
  197. .banktitle {
  198. margin-left: 12px;
  199. text:first-child {
  200. color: #fff;
  201. font-weight: bold;
  202. font-size: 16px;
  203. line-height: 1;
  204. }
  205. text:last-child {
  206. color: #fff;
  207. font-size: 12px;
  208. line-height: 1;
  209. }
  210. }
  211. }
  212. </style>