bankCard.vue 5.7 KB

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