bankcard.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259
  1. <template>
  2. <view class="container">
  3. <global-loading />
  4. <view class="bankcardList">
  5. <view v-for="(item, index) in bankcardList" :key="index" class="addBankcard-content flex-row-plus">
  6. <view class="bankcard-detail" @click="itemTap(item.bankId)">
  7. <view class="banktype">
  8. <label></label>
  9. </view>
  10. <view class="cardnum">
  11. <label>{{ encodeCardNum(item.bankCard) }}</label>
  12. </view>
  13. <view class="bankname">
  14. <label>{{ item.bankName }}</label>
  15. </view>
  16. </view>
  17. </view>
  18. </view>
  19. <view v-if="ifEmpty" class="emptyBankcard-box">
  20. <image class="emptyBankcard" src="../../static/images/origin/bgnull.png"></image>
  21. <label>你还没有添加银行卡哦~</label>
  22. </view>
  23. <view class="addBankcard-box">
  24. <view class="addBankcard" @click="addBankcardClick">添加银行卡</view>
  25. </view>
  26. </view>
  27. </template>
  28. <script>
  29. const NET = require('../../utils/request')
  30. const API = require('../../config/api')
  31. export default {
  32. data() {
  33. return {
  34. bankcardList: [],
  35. headWord: '',
  36. editBankcard: [],
  37. type: 0,
  38. bankcardListlength: 0,
  39. page: 1, // 当前页
  40. pageSize: 20, // 每页记录数
  41. loadingType: 0,
  42. ifEmpty: false
  43. }
  44. },
  45. onLoad(options) {
  46. this.type = options.type
  47. this.getBankcardData()
  48. },
  49. onBackPress(options) {
  50. this.$switchTab('/pages/tabbar/user/index')
  51. return true
  52. },
  53. onReachBottom() {
  54. if (this.loadingType == 1) {
  55. uni.stopPullDownRefresh()
  56. } else {
  57. this.page = this.page + 1
  58. this.getBankcardData()
  59. }
  60. },
  61. methods: {
  62. addBankcardClick() {
  63. uni.navigateTo({
  64. url: 'addBankcard?type=1'
  65. })
  66. },
  67. getBankcardData() {
  68. // uni.showLoading({
  69. // mask: true,
  70. // title: '加载中...',
  71. // })
  72. NET.request(API.QueryBankcardList, {
  73. page: this.page,
  74. pageSize: this.pageSize
  75. }, 'GET').then((res) => {
  76. uni.hideLoading()
  77. if (res.data.list.length == 0) {
  78. this.loadingType = 1
  79. this.page = this.page
  80. }
  81. this.bankcardList = this.bankcardList.concat(res.data.list)
  82. this.bankcardListlength = res.data.total
  83. if (this.bankcardList.length === 0) {
  84. this.ifEmpty = true
  85. }
  86. })
  87. .catch((res) => {
  88. })
  89. },
  90. editAdress(id) {
  91. uni.setStorageSync('editBankcard', JSON.stringify(this.bankcardList[id]))
  92. uni.navigateTo({
  93. url: 'addBankcard?type=2'
  94. })
  95. },
  96. itemTap(id) {
  97. uni.setStorageSync('bankcardId', id)
  98. uni.navigateTo({
  99. url: '../userModule/addBankcard?type=2'
  100. })
  101. },
  102. encodeCardNum(cardNum) {
  103. const length = cardNum.length
  104. if (length > 4) {
  105. return '**** **** **** ' + cardNum.substring(length - 4, length)
  106. }
  107. }
  108. }
  109. }
  110. </script>
  111. <style lang="scss">
  112. .container {
  113. .bankcardList {
  114. background: url("../../static/images/origin/addBankBg.png") no-repeat left top;
  115. background-size: contain;
  116. display: block;
  117. padding-bottom: 85px;
  118. padding-top: 50rpx;
  119. min-height: 300rpx;
  120. }
  121. .emptyBankcard-box {
  122. display: flex;
  123. justify-content: center;
  124. flex-direction: column;
  125. align-items: center;
  126. margin-top: 55upx;
  127. .emptyBankcard {
  128. margin-top: 45%;
  129. width: 113upx;
  130. height: 98upx;
  131. margin-bottom: 20rpx;
  132. }
  133. }
  134. .addBankcard-box {
  135. position: fixed;
  136. bottom: 50upx;
  137. left: 30upx;
  138. .addBankcard {
  139. width: 690upx;
  140. height: 100upx;
  141. color: #FFEBC4;
  142. text-align: center;
  143. line-height: 100upx;
  144. background: #333333;
  145. }
  146. }
  147. .addBankcard-content {
  148. display: flex;
  149. align-items: center;
  150. justify-content: space-around;
  151. padding: 0 30upx;
  152. margin-bottom: 30rpx;
  153. .bankcard-detail {
  154. width: 100%;
  155. height: 334rpx;
  156. background: url("../../static/images/origin/accountBg.png") no-repeat left top;
  157. background-size: contain;
  158. border-radius: 18rpx;
  159. .bankname {
  160. color: #71521B;
  161. margin-left: 30rpx;
  162. margin-top: 7px;
  163. }
  164. .banktype {
  165. margin-left: 15px;
  166. margin-top: 2px;
  167. font-size: 8px;
  168. color: #9C9C9C;
  169. }
  170. .cardnum {
  171. color: #71521B;
  172. margin: 0 auto;
  173. margin-top: 120rpx;
  174. margin-left: 30rpx;
  175. font-size: 20px;
  176. }
  177. }
  178. .lable {
  179. padding: 3rpx 10rpx;
  180. background: rgba(153, 153, 153, 0.2);
  181. border-radius: 4rpx;
  182. font-size: 24rpx;
  183. font-weight: 500;
  184. color: rgba(102, 102, 102, 1);
  185. }
  186. .def {
  187. padding: 3rpx 10rpx;
  188. border-radius: 4rpx;
  189. font-size: 24rpx;
  190. font-weight: 500;
  191. color: rgba(102, 102, 102, 1);
  192. background: rgba(255, 121, 17, 0.2);
  193. color: #FF7911;
  194. }
  195. .user-bankcard {
  196. font-size: 28rpx;
  197. font-weight: 500;
  198. color: rgba(51, 51, 51, 1);
  199. margin-left: 10rpx;
  200. }
  201. .bankcard-hesd {
  202. height: 70upx;
  203. width: 70upx;
  204. background-color: #BBBBBB;
  205. color: #FFFFFF;
  206. border-radius: 50%;
  207. line-height: 70upx;
  208. text-align: center;
  209. }
  210. .defaultAD-box {
  211. width: 455upx;
  212. .default-textBox {
  213. padding-right: 20upx;
  214. width: 80upx;
  215. }
  216. .default-content {
  217. width: 435upx;
  218. }
  219. .default-text {
  220. color: #C5AA7B;
  221. background-color: #FFE4CC;
  222. height: 36upx;
  223. width: 60upx;
  224. font-size: 26upx;
  225. border-radius: 4upx;
  226. align-items: center;
  227. line-height: 36upx;
  228. }
  229. }
  230. .right-Line {
  231. border-right: 2upx solid #DDDDDD;
  232. height: 50upx;
  233. }
  234. }
  235. }
  236. </style>