You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

bank-card.vue 4.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. <template>
  2. <view class="container" @click="choice('1111')">
  3. <view class="">
  4. <image class="bg" style="width:100%;height: 260rpx;" :src="`${$imgUrl}bank-bg.png`"></image>
  5. <view class="content">
  6. <view class="flex">
  7. <image style="width:68rpx;height:68rpx;" :src="`${$imgUrl}gongshang.png`">
  8. </image>
  9. <view style="margin-left: 15rpx;" class="">
  10. <view class="bank">工商银行</view>
  11. <view class="card">储蓄卡</view>
  12. </view>
  13. </view>
  14. <view class="button" @click.stop='delCard(11)'>解除绑定</view>
  15. </view>
  16. <view class="value">6216 **** **** 8721</view>
  17. <!-- <view class='default'>默认</view> -->
  18. </view>
  19. </view>
  20. <view class="container" @click="navTo('/subpackage/personal-center/setting/bank-card/bank-card-add')">
  21. <view class="">
  22. <image class="bg" style="width:100%;height: 260rpx;" :src="`${$imgUrl}bank-bg.png`"></image>
  23. <view class="content">
  24. <view class="flex">
  25. <image style="width:68rpx;height:68rpx;" :src="`${$imgUrl}gongshang.png`">
  26. </image>
  27. <view style="margin-left: 15rpx;" class="">
  28. <view class="bank">工商银行</view>
  29. <view class="card">储蓄卡</view>
  30. </view>
  31. </view>
  32. <view class="button" @click.stop='delCard()'>解除绑定</view>
  33. </view>
  34. <view class="value">6216 **** **** 8721</view>
  35. <view class='default'>默认</view>
  36. </view>
  37. </view>
  38. <view style='margin: 40rpx 30rpx;' @click="navTo('/subpackage/personal-center/setting/bank-card/bank-card-add')">
  39. <submit-button title="+ 添加银行卡"></submit-button>
  40. </view>
  41. </template>
  42. <script lang="ts" setup>
  43. import { reactive } from "vue";
  44. import {request} from "@/utils/network/request.js";
  45. import {queryBankCard,delBankCard} from "@/utils/network/api.js";
  46. import {stringToJson} from "@/utils/network/encryption.js";
  47. import {navTo} from '@/utils/utils';
  48. import { onLoad} from "@dcloudio/uni-app";
  49. const state = reactive({
  50. name:''
  51. })
  52. onLoad((option : any) => {
  53. console.log("option",option)
  54. state.name=option.name;
  55. state.choiceCard=option.choiceCard;
  56. // getBankList();
  57. })
  58. const getBankList=()=>{
  59. const options = {
  60. type: 2,
  61. data: {
  62. 'accountId': state.name
  63. },
  64. method: "POST",
  65. showLoading: true,
  66. };
  67. request(queryBankCard, options).then((res) => {
  68. const data = stringToJson(res.bizContent)
  69. console.log("获取银行卡",data)
  70. })
  71. }
  72. const delCard=(cardId)=>{
  73. const options = {
  74. type: 2,
  75. data: {
  76. 'accountId': state.name,
  77. 'bankCardId':cardId
  78. },
  79. method: "POST",
  80. showLoading: true,
  81. };
  82. request(delBankCard, options).then((res) => {
  83. const data = stringToJson(res.bizContent)
  84. console.log("删除银行卡",data);
  85. getBankList();
  86. })
  87. }
  88. const choice=(cardNumber)=>{
  89. if(!state.choiceCard){
  90. navTo('/subpackage/personal-center/setting/bank-card/bank-card-add')
  91. }else{
  92. uni.redirectTo({
  93. //关闭当前页面,跳转到应用内的某个页面。
  94. url:`/subpackage/after-sale/account-recharge/recharge?cardNumber=${cardNumber}`
  95. });
  96. // navTo(`/subpackage/after-sale/account-recharge/recharge?cardNumber=${cardNumber}`)
  97. }
  98. }
  99. </script>
  100. <style lang="scss" scoped>
  101. .container {
  102. padding: 30rpx 30rpx 0 30rpx;
  103. position:relative;
  104. .flex {
  105. display: flex;
  106. align-items: center;
  107. }
  108. .value {
  109. position: absolute;
  110. top: 160rpx;
  111. left: 30rpx;
  112. right: 30rpx;
  113. font-size: 36rpx;
  114. font-family: Microsoft YaHei;
  115. font-weight: 400;
  116. color: #FFFFFF;
  117. text-align: center;
  118. line-height: 36rpx;
  119. }
  120. .default{
  121. position: absolute;
  122. top: 235rpx;
  123. left: 60rpx;
  124. font-size: 29rpx;
  125. font-family: Microsoft YaHei;
  126. font-weight: 400;
  127. color: #FFFFFF;
  128. line-height: 36rpx;
  129. }
  130. .content {
  131. padding: 30rpx;
  132. position: absolute;
  133. top: 30rpx;
  134. left: 30rpx;
  135. right: 30rpx;
  136. display: flex;
  137. justify-content: space-between;
  138. .bank {
  139. font-size: 28rpx;
  140. font-family: Microsoft YaHei;
  141. font-weight: 400;
  142. color: #FFFFFF;
  143. line-height: 28rpx;
  144. }
  145. .card {
  146. font-size: 24rpx;
  147. font-family: Microsoft YaHei;
  148. font-weight: 400;
  149. color: #FFFFFF;
  150. line-height: 24rpx;
  151. margin-top: 5rpx;
  152. }
  153. .button {
  154. height: 48rpx;
  155. line-height: 48rpx;
  156. border: 1px solid #FFFFFF;
  157. border-radius: 20rpx;
  158. color: #ffffff;
  159. font-size: 24rpx;
  160. text-align: center;
  161. padding: 0 20rpx;
  162. }
  163. }
  164. }
  165. </style>