bankcard.vue 5.1 KB

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