bindBank.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. <template>
  2. <view class="container">
  3. <view class="listTpl flex" v-if="list.length > 0" v-for="item,index in list">
  4. <view class="infoTpl">
  5. <view class="tplName flex_item">
  6. <image :src="item.type == 'bank'?'/static/image/bank.png':
  7. item.type == 'wx'?'/static/image/wx.png':'/static/image/alipay.png'" style="width: 40rpx;height: 40rpx" mode="widthFix"></image>
  8. <view class="titleBox">
  9. <view class="name">{{item.type == 'bank'?item.bank:item.type == 'wx'?'微信账号':'支付宝账号'}}</view>
  10. <view class="tip" v-if="item.type == 'bank'">持卡人:{{item.bank_real_name}}</view>
  11. <view class="tip" v-else>真实姓名:{{item.name}}</view>
  12. </view>
  13. </view>
  14. <view class="cardNum flex_item" v-if="item.type == 'bank'">
  15. <view class="num" v-if="!item.show">{{item.bank_code1}}</view>
  16. <view class="num1" v-else>{{item.bank_code}}</view>
  17. <view @click="showChange(index,item.show)">
  18. <image :src="item.show?'/static/image/img35.png':'/static/image/img36.png'" style="width: 50rpx;height: 50rpx;" mode="widthFix"></image>
  19. </view>
  20. </view>
  21. <view class="cardNum flex_item" v-else>
  22. <view class="num">{{item.phone}}</view>
  23. </view>
  24. </view>
  25. <view class="tplTip flex_item" @click="edit(item.id,item.type,'edit')">
  26. <view class="edit">去修改</view>
  27. <uni-icons type="right" color="#fff"></uni-icons>
  28. </view>
  29. <view class="del" @click="del(item.id)">
  30. <image src="/static/image/img37.png" style="width: 32rpx;height: 32rpx;" mode="widthFix"></image>
  31. </view>
  32. </view>
  33. <view class="noData" v-if="list.length == 0">暂无银行卡数据~</view>
  34. <view class="submission">
  35. <button class="golden" type="golden" hover-class="none" @click="edit(0,0,'add')">添加收款方式</button>
  36. </view>
  37. </view>
  38. </template>
  39. <script>
  40. import { getBank,delBank } from '@/api/set.js';
  41. export default {
  42. data() {
  43. return{
  44. list:[],
  45. addCard:true,
  46. };
  47. },
  48. onLoad() {},
  49. onShow() {
  50. this.getList()
  51. },
  52. methods: {
  53. showChange(index,show){
  54. this.list[index].show = !show
  55. },
  56. getList(){
  57. let obj = this
  58. getBank({
  59. page:1,
  60. limit:100
  61. }).then(res => {
  62. let data = res.data.list
  63. let reg = /^(.{4})(?:\d+)(.{4})$/
  64. data.forEach(item => {
  65. item.show = false
  66. item.bank_code1 = item.bank_code.replace(reg, "**** **** **** $2");
  67. })
  68. if(res.data.sell_alipay_open=='0'&&res.data.sell_bank_open=='0'&&res.data.sell_weixin_open=='0'){
  69. obj.addCard =false
  70. }else{
  71. obj.addCard =true
  72. }
  73. obj.list = data
  74. });
  75. },
  76. del(id){
  77. let obj = this
  78. uni.showModal({
  79. title: '提示',
  80. content: '您确定要删除该收款码信息吗?',
  81. success: (res) => {
  82. if(res.confirm) {
  83. delBank({
  84. id:id
  85. }).then(res => {
  86. uni.showToast({
  87. title: res.msg,
  88. icon: 'none',
  89. duration: 1000
  90. })
  91. setTimeout(function () {
  92. obj.getList()
  93. }, 100);
  94. });
  95. } else {
  96. console.log('cancel') //点击取消之后执行的代码
  97. }
  98. }
  99. })
  100. },
  101. edit(id,type,item){
  102. if(item == 'add'){
  103. uni.navigateTo({
  104. url:'/pages/user/set/editBank'
  105. })
  106. }else{
  107. uni.navigateTo({
  108. url:'/pages/user/set/editBank?id='+id+'&type='+type
  109. })
  110. }
  111. }
  112. },
  113. };
  114. </script>
  115. <style lang="scss" scoped>
  116. .container{
  117. padding: 25rpx 25rpx;
  118. }
  119. .del{
  120. position: absolute;
  121. right: 35rpx;
  122. top: 35rpx;
  123. }
  124. .listTpl{
  125. color: #fff;
  126. background: #1F2A4A;
  127. padding: 36rpx 38rpx;
  128. border-radius: 20rpx;
  129. margin-bottom: 25rpx;
  130. position: relative;
  131. .infoTpl{
  132. .tplName{
  133. align-items: flex-start;
  134. .titleBox{
  135. padding-left: 25rpx;
  136. .name{
  137. font-weight: bold;
  138. font-size: 30rpx;
  139. color: #FFFFFF;
  140. }
  141. .tip{
  142. font-weight: 500;
  143. font-size: 25rpx;
  144. color: rgba(255, 255, 255, 0.64);
  145. padding-top: 12rpx;
  146. }
  147. }
  148. }
  149. .cardNum{
  150. font-weight: bold;
  151. color: #FFFFFF;
  152. padding-top: 50rpx;
  153. padding-bottom: 20rpx;
  154. .num{
  155. margin-right: 35rpx;
  156. font-size: 45rpx;
  157. }
  158. .num1{
  159. margin-right: 35rpx;
  160. font-size: 38rpx;
  161. }
  162. }
  163. }
  164. }
  165. .noData{
  166. color: rgba(255, 255, 255, 0.64);
  167. font-size: 25rpx;
  168. padding: 30rpx 0rpx;
  169. text-align: center;
  170. }
  171. .submission {
  172. padding: 80rpx 25rpx;
  173. .golden {
  174. background: #0C5AFA;
  175. color: #ffffff;
  176. }
  177. }
  178. .edit{
  179. font-size: 30rpx;
  180. }
  181. </style>