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.5KB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  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. params:{}, //传过来的参数
  52. })
  53. onLoad((option : any) => {
  54. console.log("option",JSON.parse(decodeURIComponent(option.value)))
  55. state.name=option.name;
  56. state.choiceCard=option.choiceCard;
  57. state.params=JSON.parse(decodeURIComponent(option.value))
  58. getBankList();
  59. })
  60. const getBankList=()=>{
  61. const options = {
  62. type: 2,
  63. data: {
  64. 'accountId': state.name
  65. },
  66. method: "POST",
  67. showLoading: true,
  68. };
  69. request(queryBankCard, options).then((res) => {
  70. const data = stringToJson(res.bizContent)
  71. console.log("获取银行卡",data)
  72. })
  73. }
  74. const delCard=(cardId)=>{
  75. const options = {
  76. type: 2,
  77. data: {
  78. 'accountId': state.name,
  79. 'bankCardId':cardId
  80. },
  81. method: "POST",
  82. showLoading: true,
  83. };
  84. request(delBankCard, options).then((res) => {
  85. const data = stringToJson(res.bizContent)
  86. console.log("删除银行卡",data);
  87. getBankList();
  88. })
  89. }
  90. const choice=(cardNumber)=>{
  91. if(!state.choiceCard){
  92. navTo('/subpackage/personal-center/setting/bank-card/bank-card-add')
  93. }else{
  94. uni.redirectTo({
  95. //关闭当前页面,跳转到应用内的某个页面。
  96. url:`/subpackage/after-sale/account-recharge/recharge?cardNumber=${cardNumber}&value=${encodeURIComponent(JSON.stringify(state.params))}`
  97. });
  98. // navTo(`/subpackage/after-sale/account-recharge/recharge?cardNumber=${cardNumber}`)
  99. }
  100. }
  101. </script>
  102. <style lang="scss" scoped>
  103. .container {
  104. padding: 30rpx 30rpx 0 30rpx;
  105. position:relative;
  106. .flex {
  107. display: flex;
  108. align-items: center;
  109. }
  110. .value {
  111. position: absolute;
  112. top: 160rpx;
  113. left: 30rpx;
  114. right: 30rpx;
  115. font-size: 36rpx;
  116. font-family: Microsoft YaHei;
  117. font-weight: 400;
  118. color: #FFFFFF;
  119. text-align: center;
  120. line-height: 36rpx;
  121. }
  122. .default{
  123. position: absolute;
  124. top: 235rpx;
  125. left: 60rpx;
  126. font-size: 29rpx;
  127. font-family: Microsoft YaHei;
  128. font-weight: 400;
  129. color: #FFFFFF;
  130. line-height: 36rpx;
  131. }
  132. .content {
  133. padding: 30rpx;
  134. position: absolute;
  135. top: 30rpx;
  136. left: 30rpx;
  137. right: 30rpx;
  138. display: flex;
  139. justify-content: space-between;
  140. .bank {
  141. font-size: 28rpx;
  142. font-family: Microsoft YaHei;
  143. font-weight: 400;
  144. color: #FFFFFF;
  145. line-height: 28rpx;
  146. }
  147. .card {
  148. font-size: 24rpx;
  149. font-family: Microsoft YaHei;
  150. font-weight: 400;
  151. color: #FFFFFF;
  152. line-height: 24rpx;
  153. margin-top: 5rpx;
  154. }
  155. .button {
  156. height: 48rpx;
  157. line-height: 48rpx;
  158. border: 1px solid #FFFFFF;
  159. border-radius: 20rpx;
  160. color: #ffffff;
  161. font-size: 24rpx;
  162. text-align: center;
  163. padding: 0 20rpx;
  164. }
  165. }
  166. }
  167. </style>