withdrawalAccountManagement.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. <template>
  2. <view class="withdrawalAccountManagement">
  3. <view class="list">
  4. <view
  5. class="item"
  6. v-for="b in list"
  7. :key="b.id"
  8. :style="{ backgroundColor: b.bank_bg }"
  9. @click="handleSelect(b)"
  10. >
  11. <u--image
  12. v-if="b.bank_logo"
  13. width="102rpx"
  14. height="102rpx"
  15. radius="100%"
  16. shape="circle"
  17. bgColor="#d3c6b5"
  18. customStyle="border-radius:100%;"
  19. :src="b.bank_logo"
  20. :fade="true"
  21. duration="450"
  22. ></u--image>
  23. <view class="right">
  24. <view class="name">{{ b.bank_name }}</view>
  25. <view class="docs">{{ b.bank_bran || "储蓄卡" }}</view>
  26. <view class="code">
  27. <text class="code-ellipsis">... ... .... </text>
  28. <text class="code-number">{{ bankLastCode(b.bank_code) }}</text>
  29. </view>
  30. </view>
  31. </view>
  32. </view>
  33. <navigator url="/subPages/addWithdrawalAccount/addWithdrawalAccount">
  34. <view class="add-wrap">
  35. <u-icon name="plus" color="#2B313D"></u-icon>
  36. <text>添加结算账户</text>
  37. </view>
  38. </navigator>
  39. <u-action-sheet
  40. :show="actionShow"
  41. :actions="bankOperateList"
  42. :closeOnClickOverlay="true"
  43. :closeOnClickAction="true"
  44. :safeAreaInsetBottom="true"
  45. cancelText="取消"
  46. @select="handleSelectOperate"
  47. @close="handleClose"
  48. ></u-action-sheet>
  49. </view>
  50. </template>
  51. <script>
  52. import { getMyBanks, removeBanks } from "@/common/api/withdrawal";
  53. export default {
  54. data() {
  55. return {
  56. selectBank: null,
  57. list: [],
  58. actionShow: false,
  59. bankOperateList: [
  60. {
  61. type: "delete",
  62. name: "解绑",
  63. },
  64. ],
  65. };
  66. },
  67. onShow() {
  68. this._getMyBanks();
  69. },
  70. methods: {
  71. bankLastCode(code) {
  72. return code.slice(-4);
  73. },
  74. _getMyBanks() {
  75. getMyBanks().then(({ data = [] }) => {
  76. this.list = data;
  77. });
  78. },
  79. handleSelect(item) {
  80. this.actionShow = true;
  81. this.selectBank = item;
  82. },
  83. handleSelectOperate({ type }) {
  84. if (type === "delete" && this.selectBank) {
  85. removeBanks({ code: this.selectBank.code }).then((res) => {
  86. uni.$u.toast("解绑成功");
  87. this._getMyBanks();
  88. this.selectBank = null;
  89. });
  90. }
  91. },
  92. handleClose() {
  93. this.actionShow = false;
  94. },
  95. },
  96. };
  97. </script>
  98. <style lang="scss" scoped>
  99. .withdrawalAccountManagement {
  100. padding: 20rpx 20rpx 40rpx;
  101. background-color: #f5f6f8;
  102. .item {
  103. display: flex;
  104. height: 247rpx;
  105. background: #31649d;
  106. border-radius: 15rpx;
  107. margin-bottom: 15rpx;
  108. padding: 36rpx 0 0 43rpx;
  109. .right {
  110. margin-left: 23rpx;
  111. }
  112. .name {
  113. font-size: 32rpx;
  114. font-weight: bold;
  115. color: #ffffff;
  116. line-height: 45rpx;
  117. }
  118. .docs {
  119. font-size: 28rpx;
  120. font-weight: 500;
  121. color: rgba(255, 255, 255, 0.38);
  122. line-height: 39rpx;
  123. }
  124. .code {
  125. display: flex;
  126. align-items: center;
  127. height: 87rpx;
  128. font-size: 62rpx;
  129. font-weight: 500;
  130. color: #ffffff;
  131. line-height: 1;
  132. .code-ellipsis {
  133. margin-top: -32rpx;
  134. }
  135. .code-number {
  136. margin-left: 20rpx;
  137. }
  138. }
  139. }
  140. .add-wrap {
  141. display: flex;
  142. align-items: center;
  143. padding-left: 47rpx;
  144. height: 157rpx;
  145. background: #ffffff;
  146. border-radius: 15rpx;
  147. font-size: 30rpx;
  148. font-weight: 500;
  149. color: #1d161f;
  150. line-height: 1;
  151. text {
  152. margin-left: 8rpx;
  153. }
  154. }
  155. }
  156. </style>