userBank.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. <template>
  2. <view>
  3. <view @click="add(item.id)" style="position: relative;" hover-class="none" v-for="(item,index) in bankList"
  4. :key="index" class="card card_bg">
  5. <view @click.stop="del(item.id)" style="position: absolute;right: 10rpx;top: 10rpx;">
  6. <u-icon name="close-circle" color="#fff" size="40"></u-icon>
  7. </view>
  8. <view class="top center" style="justify-content: flex-start;">
  9. <view class="center margin-top-10">
  10. <image @error="error" :src="bankImg(item.bankCode)"></image>
  11. </view>
  12. <view class="">
  13. <text class="bankType">{{item.bankName}}</text>
  14. <text class="bankAccountType">{{dealBankCodeType(item.bankCardType)}}</text>
  15. </view>
  16. </view>
  17. <view class="number">
  18. <text>{{dealAccountNo(item.accountNo)}}</text>
  19. </view>
  20. </view>
  21. <navigator url="./add" class="card_add" hover-class="none">
  22. <view class="margin-bottom-10">
  23. <u-icon name="plus-circle-fill" color="#F5A85B" size="80"></u-icon>
  24. </view>
  25. <view class="" style="color: #666666;">
  26. 添加新的银行卡
  27. </view>
  28. </navigator>
  29. </view>
  30. </template>
  31. <script>
  32. export default {
  33. data() {
  34. return {
  35. imgError:false,
  36. bankList: []
  37. }
  38. },
  39. onShow() {
  40. this.fetchCardList()
  41. },
  42. computed: {
  43. dealAccountNo() {
  44. return data => {
  45. return this.$util.dealAccountNo(data)
  46. }
  47. },
  48. dealBankCodeType() {
  49. return data => {
  50. return this.$getBankCodeType(data)
  51. }
  52. },
  53. bankImg(){
  54. return (data)=>{
  55. if (this.imgError) {
  56. return '/static/icon/card1.png'
  57. }
  58. return '/static/bank/'+data+'.png'
  59. }
  60. }
  61. },
  62. methods: {
  63. error(){
  64. this.imgError=true
  65. },
  66. fetchCardList() {
  67. let params = {
  68. merchantNo: this.vuex_merchantNo
  69. }
  70. this.$api.yeepay.withdrawCardQuery(params).then(res => {
  71. let result = JSON.parse(res.data.result)
  72. this.bankList = result.bankCardAccountList
  73. })
  74. },
  75. del(id) {
  76. this.$dialog.showModal('确定要解绑?').then(() => {
  77. this.$api.userBank.remove(id).then(res => {
  78. if (res.success) {
  79. this.$u.toast('解绑成功!')
  80. this.fetchCardList()
  81. }
  82. })
  83. })
  84. },
  85. add(id) {
  86. return
  87. uni.navigateTo({
  88. url: `./add?id=${id}`
  89. })
  90. }
  91. }
  92. }
  93. </script>
  94. <style lang="scss" scoped>
  95. .card_add {
  96. margin: 30rpx;
  97. border-radius: 20rpx;
  98. padding: 40rpx 30rpx;
  99. background-color: #FFFFFF;
  100. display: flex;
  101. justify-content: center;
  102. align-items: center;
  103. flex-direction: column;
  104. }
  105. .card {
  106. margin: 30rpx;
  107. border-radius: 20rpx;
  108. padding: 40rpx 30rpx;
  109. background-image: linear-gradient(#F5A85B, #EF9944);
  110. display: flex;
  111. flex-direction: column;
  112. .top {
  113. display: flex;
  114. margin-bottom: 20rpx;
  115. image {
  116. border-radius: 50%;
  117. background-color: #FFFFFF;
  118. width: 70rpx;
  119. height: 70rpx;
  120. }
  121. .bankType {
  122. font-size: 36rpx;
  123. color: #FFFFFF;
  124. font-weight: 800;
  125. margin-left: 30rpx;
  126. }
  127. .bankAccountType {
  128. color: #F8E0C6;
  129. font-size: 26rpx;
  130. margin-left: 20rpx;
  131. }
  132. }
  133. .number {
  134. margin-left: 110rpx;
  135. color: #FFFFFF;
  136. font-weight: 800;
  137. font-size: 34rpx;
  138. }
  139. }
  140. </style>