bank.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. <style lang="scss">
  2. .bank-list{
  3. background: #fff;
  4. border-radius: 10px;
  5. margin: 10px;
  6. .item {
  7. border-bottom: 1px solid #f1f1f1;
  8. padding: 32rpx 28rpx;
  9. .icon{width: 40rpx;height: 40rpx;margin-right: 25rpx;}
  10. .name{font-weight: 500;font-size: 26rpx;color: #333333;}
  11. .bank_name{font-weight: 500;font-size: 26rpx;color: #999999;}
  12. .pev{width: 40rpx;height: 40rpx;}
  13. }
  14. }
  15. </style>
  16. <template>
  17. <view class="app-body">
  18. <view class="bank-list">
  19. <view class="item fx-r" @tap="tapOpen" data-url="save/bank">
  20. <image class="icon" src="/static/img/bank_bank.png"></image>
  21. <view class="name">银行卡</view>
  22. <view class="fx-g1"></view>
  23. <view class="bank_name">{{ getBank(3) || '未添加' }}</view>
  24. <image class="pev" src="/static/img/ic_next.png"></image>
  25. </view>
  26. <view class="item fx-r" @tap="tapOpen" data-url="save/alipay">
  27. <image class="icon" src="/static/img/bank_alipay.png"></image>
  28. <view class="name">支付宝</view>
  29. <view class="fx-g1"></view>
  30. <view class="bank_name">{{ getBank(2) || '未添加' }}</view>
  31. <image class="pev" src="/static/img/ic_next.png"></image>
  32. </view>
  33. <view class="item fx-r" @tap="tapOpen" data-url="save/weixin">
  34. <image class="icon" src="/static/img/bank_weixin.png"></image>
  35. <view class="name">微信</view>
  36. <view class="fx-g1"></view>
  37. <view class="bank_name">{{ getBank(1) || '未添加' }}</view>
  38. <image class="pev" src="/static/img/ic_next.png"></image>
  39. </view>
  40. </view>
  41. </view>
  42. </template>
  43. <script>
  44. import {mapState,mapMutations} from 'vuex';
  45. export default {
  46. computed: mapState(['user']),
  47. data() {
  48. return {
  49. data : [],
  50. isFirst : false
  51. }
  52. },
  53. onShow() {
  54. this.getData();
  55. },
  56. methods: {
  57. //获取事件传递
  58. onEvent:function(type,data){
  59. this.getData();
  60. },
  61. getData:function(){
  62. this
  63. .request
  64. .post("getBank")
  65. .then(res=>{
  66. if(res.code == 200) {
  67. this.data = res.data
  68. this.isFirst = true;
  69. } else {
  70. this.utils.Tip(res.msg);
  71. }
  72. })
  73. .catch(err=>{
  74. this.utils.Tip(res.msg);
  75. });
  76. },
  77. tapBack: function() {
  78. uni.navigateBack();
  79. },
  80. getBank:function(type) {
  81. for(let i in this.data) {
  82. if(this.data[i].type == type) {
  83. return this.data[i].name;
  84. }
  85. }
  86. return null;
  87. },
  88. /**
  89. * 打开
  90. * @param {Object} ev
  91. */
  92. tapOpen: function(ev) {
  93. let url = ev.currentTarget.dataset.url
  94. uni.navigateTo({
  95. url: url
  96. });
  97. }
  98. }
  99. }
  100. </script>