card-sus-list.vue 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305
  1. <template>
  2. <view class="container card clearfix">
  3. <view class="card-title">
  4. <view class="card-tabs" @click="handleCurrent(0)">
  5. <view class="card-tabs-text" :class="{ current : current === 0 }">借记卡</view>
  6. </view>
  7. <view class="card-tabs" @click="handleCurrent(1)">
  8. <view class="card-tabs-text" :class="{ current : current === 1 }">贷记卡</view>
  9. </view>
  10. </view>
  11. <view class="card-content">
  12. <view class="list" v-for="(item, index) in list" :key="index">
  13. <view class="list-pin">{{ item.pin }}</view>
  14. <view class="list-card">
  15. <view class="list-card-item" v-for="(card, index) in item.data" :key="index">
  16. <view class="logo"><image :src="handleLogo(card.B2B)"></image></view>
  17. <view class="name">
  18. <text>{{ card.name }}</text>
  19. </view>
  20. </view>
  21. </view>
  22. </view>
  23. </view>
  24. </view>
  25. </template>
  26. <script>
  27. export default {
  28. data() {
  29. return {
  30. StaticUrl: this.$Static,
  31. isIphoneX:this.$store.state.isIphoneX,
  32. current:0,
  33. listQuery: {
  34. userId: '', // 用户ID
  35. pageNum: 1, // 页数
  36. pageSize: 10, // 加载条数
  37. type: 0 // 查询余额类型
  38. },
  39. isEmpty: false,
  40. loadding: false,
  41. pullUpOn: true,
  42. hasNextPage: false,
  43. pullFlag: true,
  44. nomoreText: '上拉显示更多',
  45. list: [
  46. {
  47. pin:'G',
  48. data:[
  49. {
  50. type: 1,
  51. flag: 0,
  52. B2B: 'ICBC',
  53. name: '工商银行',
  54. }
  55. ]
  56. },
  57. {
  58. pin:'J',
  59. data:[
  60. {
  61. type: 1,
  62. flag: 0,
  63. B2B: 'CCB',
  64. name: '建设银行',
  65. },
  66. {
  67. type: 1,
  68. flag: 0,
  69. B2B: 'CCB',
  70. name: '交通银行',
  71. },
  72. ]
  73. },
  74. {
  75. pin:'N',
  76. data:[
  77. {
  78. type: 1,
  79. flag: 0,
  80. B2B: 'ABC',
  81. name: '农业银行',
  82. }
  83. ]
  84. }
  85. ]
  86. }
  87. },
  88. onLoad() {
  89. // this.GetAccountInitData()
  90. },
  91. filters: {},
  92. methods: {
  93. async GetAccountInitData(index) {
  94. //获取余额明细数据列表
  95. const user = await this.$api.getStorage()
  96. this.listQuery.userId = user.userId ? user.userId : 0
  97. this.UserService.GetUserClubBeansList(this.listQuery)
  98. .then(response => {
  99. let data = response.data
  100. let list = data.pageInfo.list
  101. this.userBeans = data.userBeans
  102. this.hasNextPage = data.pageInfo.hasNextPage
  103. if (list && list.length > 0) {
  104. this.isEmpty = false
  105. this.beansList = [...list]
  106. } else {
  107. this.isEmpty = true
  108. }
  109. if (this.hasNextPage) {
  110. this.pullUpOn = false
  111. this.nomoreText = '上拉显示更多'
  112. } else {
  113. if (this.beansList.length < 10) {
  114. this.pullUpOn = true
  115. } else {
  116. this.pullUpOn = false
  117. this.nomoreText = '已至底部'
  118. }
  119. }
  120. })
  121. .catch(error => {
  122. this.$util.msg(error.msg, 2000)
  123. })
  124. },
  125. GetOnReachBottomData(index) {
  126. //上拉加载
  127. this.listQuery.pageNum += 1
  128. this.UserService.GetUserClubBeansList(this.listQuery)
  129. .then(response => {
  130. let data = response.data
  131. let list = data.pageInfo.list
  132. this.userBeans = data.userBeans
  133. this.hasNextPage = data.pageInfo.hasNextPage
  134. this.beansList = this.beansList.concat(list)
  135. this.pullFlag = false // 防上拉暴滑
  136. setTimeout(() => {
  137. this.pullFlag = true
  138. }, 500)
  139. if (this.hasNextPage) {
  140. this.pullUpOn = false
  141. this.nomoreText = '上拉显示更多'
  142. } else {
  143. this.loadding = false
  144. this.pullUpOn = false
  145. this.nomoreText = '已至底部'
  146. }
  147. })
  148. .catch(error => {
  149. this.$util.msg(error.msg, 2000)
  150. })
  151. },
  152. handleCurrent(index){
  153. // tabs 切换
  154. this.current = index
  155. },
  156. handleLogo(type) {
  157. const LogoMap = {
  158. 'CCB':'https://img2.baidu.com/it/u=4262210206,1883697020&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=501',
  159. 'ICBC':'https://www.weixinyunduan.com/ups/2016/01/309212/edf5a48e69afa569eb31a52fc36de450.jpg',
  160. 'ABC':'https://userfile.yksup.com/userdata/18039/img/brand-20170315232223_e0p18k.jpg'
  161. }
  162. return LogoMap[type]
  163. },
  164. handleStyle(type) {
  165. const styleMap = {
  166. 'CCB':'linear-gradient(90deg, #4D8CD8 0%, #3C66C9 100%);',
  167. 'ICBC':'linear-gradient(90deg, #ED796B 0%, #EF585E 100%);',
  168. 'ABC':'linear-gradient(90deg, #19B8B2 0%, #009C96 100%);'
  169. }
  170. return styleMap[type]
  171. },
  172. },
  173. onReachBottom() {
  174. if (this.hasNextPage) {
  175. this.loadding = true
  176. this.pullUpOn = true
  177. this.GetOnReachBottomData()
  178. }
  179. },
  180. onPullDownRefresh() {
  181. //下拉刷新
  182. this.listQuery.pageNum = 1
  183. this.GetAccountInitData()
  184. uni.stopPullDownRefresh()
  185. },
  186. onShow() {
  187. // this.beansList = []
  188. }
  189. }
  190. </script>
  191. <style lang="scss">
  192. page,
  193. .container {
  194. background: #ffffff;
  195. height: 100%;
  196. }
  197. .card-title {
  198. width: 100%;
  199. height: 100rpx;
  200. .card-tabs{
  201. width: 50%;
  202. height: 100%;
  203. float: left;
  204. .card-tabs-text{
  205. width: 100rpx;
  206. line-height: 96rpx;
  207. margin: 0 auto;
  208. font-size: $font-size-32;
  209. color: #333;
  210. font-weight: bold;
  211. box-sizing: border-box;
  212. border-bottom: 2px solid #ffffff;
  213. &.current{
  214. color: #FF5B00;
  215. border-color: #FF5B00;
  216. }
  217. }
  218. }
  219. }
  220. .card-content {
  221. width: 100%;
  222. height: auto;
  223. box-sizing: border-box;
  224. .list {
  225. width: 100%;
  226. height: auto;
  227. box-sizing: border-box;
  228. position: relative;
  229. .list-pin{
  230. width: 100%;
  231. line-height: 48rpx;
  232. box-sizing: border-box;
  233. padding-left: 47rpx;
  234. background-color: #F7F7F7;
  235. font-size: 28rpx;
  236. color: #333;
  237. float: left;
  238. }
  239. .list-card{
  240. width: 100%;
  241. height: auto;
  242. box-sizing: border-box;
  243. position: relative;
  244. padding: 0 32rpx;
  245. float: left;
  246. .list-card-item{
  247. width: 100%;
  248. height: 100rpx;
  249. box-sizing: border-box;
  250. padding: 26rpx 0;
  251. border-bottom: 1px solid #E1E1E1;
  252. &:last-child{
  253. border-bottom: none;
  254. }
  255. .logo{
  256. width: 48rpx;
  257. height: 48rpx;
  258. margin-right: 34rpx;
  259. float: left;
  260. border-radius: 50%;
  261. image{
  262. width: 48rpx;
  263. height: 48rpx;
  264. border-radius: 50%;
  265. display: block;
  266. }
  267. }
  268. .name{
  269. line-height: 48rpx;
  270. font-size: 28rpx;
  271. color: #333;
  272. }
  273. }
  274. }
  275. }
  276. }
  277. .tui-popup-box {
  278. position: relative;
  279. box-sizing: border-box;
  280. min-height: 100rpx;
  281. padding: 6rpx 24rpx;
  282. .tui-popup-content {
  283. padding-top: 30rpx;
  284. }
  285. }
  286. .tui-popup-btn {
  287. width: 100%;
  288. height: auto;
  289. float: left;
  290. box-sizing: border-box;
  291. margin-top: 30rpx;
  292. .tui-button {
  293. width: 600rpx;
  294. height: 88rpx;
  295. background: $btn-confirm;
  296. line-height: 88rpx;
  297. text-align: center;
  298. color: #ffffff;
  299. font-size: $font-size-28;
  300. border-radius: 44rpx;
  301. margin: 0 auto;
  302. }
  303. }
  304. </style>