unBank.vue 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. <template>
  2. <view style="padding-top: 50rpx;">
  3. <view class="bank">
  4. <view class="bank_name">
  5. {{ bankInfo.bank_name}}
  6. </view>
  7. <view class="bank_time">
  8. 绑定时间:{{ bankInfo.time}}
  9. </view>
  10. <view class="bank_btn" @click="UnBank">
  11. 解除绑定
  12. </view>
  13. </view>
  14. </view>
  15. </template>
  16. <script>
  17. import { _API_BankInfo, _API_UnbindBank } from '../../apis/zbs.js';
  18. export default {
  19. data() {
  20. return {
  21. type: '',
  22. bankInfo: {},
  23. }
  24. },
  25. onLoad(e) {
  26. this.type == e.type
  27. },
  28. onShow() {
  29. this.getBankInfo()
  30. },
  31. methods: {
  32. getBankInfo() {
  33. _API_BankInfo().then(res => {
  34. if (res.code == 200) {
  35. this.showBank = true
  36. this.bankInfo = res.data
  37. } else {
  38. uni.showModal({
  39. content: res.message || '获取失败',
  40. showCancel: false
  41. });
  42. return false;
  43. }
  44. })
  45. },
  46. // 解除绑定
  47. UnBank() {
  48. uni.showModal({
  49. title: '提示',
  50. content: '确定要解绑该银行卡吗?',
  51. success: (res) => {
  52. if (res.confirm) {
  53. uni.showLoading()
  54. _API_UnbindBank({ id: this.bankInfo.id }).then(res => {
  55. uni.hideLoading()
  56. if (res.code == 200) {
  57. if (this.type == 1) {
  58. uni.reLaunch({
  59. url: './detail'
  60. })
  61. } else {
  62. uni.navigateBack({
  63. delta: 2
  64. })
  65. }
  66. } else {
  67. uni.showModal({
  68. title: '失败',
  69. content: res.message || '操作失败',
  70. showCancel: false
  71. })
  72. return false;
  73. }
  74. })
  75. .catch(err => {
  76. uni.hideLoading()
  77. })
  78. }
  79. }
  80. })
  81. },
  82. },
  83. }
  84. </script>
  85. <style lang="scss" scoped>
  86. .bank {
  87. border-radius: 16rpx;
  88. margin: 0 30rpx 0 30rpx;
  89. background-color: #fff;
  90. // border: 2rpx dashed #FF232C;
  91. padding: 24rpx;
  92. font-size: 28rpx;
  93. &_name {
  94. // text-align: center;
  95. font-weight: bold;
  96. font-size: 32rpx;
  97. margin-bottom: 20rpx;
  98. }
  99. &_btn {
  100. margin: 50rpx auto 0;
  101. width: 600rpx;
  102. line-height: 88rpx;
  103. border-radius: 44rpx;
  104. text-align: center;
  105. color: #FF232C;
  106. font-size: 32rpx;
  107. border: 2rpx solid #FF232C;
  108. }
  109. }
  110. </style>