card-list.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355
  1. <template>
  2. <view class="container card clearfix">
  3. <view class="card-title">我的银行卡 <text>3张</text></view>
  4. <view class="card-content">
  5. <view class="list" v-for="(card, index) in list" :key="index" :style="{ background: handleStyle(card.B2B) }">
  6. <view class="list-logo">
  7. <view class="logo"><image :src="handleLogo(card.B2B)"></image></view>
  8. </view>
  9. <view class="list-main">
  10. <view class="list-main-name">{{ card.name }}</view>
  11. <view class="list-main-tag"> <text class="tag"> {{ card.flag === 1 ? '借记卡' : '贷记卡' }} </text> </view>
  12. <view class="list-main-code">
  13. {{ card.code }}
  14. </view>
  15. </view>
  16. <view class="list-btn" @click="handleUnbind">解绑</view>
  17. </view>
  18. </view>
  19. <!-- 取消收藏操作 -->
  20. <tui-bottom-popup :radius="false" :mask="false" :show="popupShow">
  21. <view class="tui-popup-box clearfix">
  22. <view class="tui-right-flex tui-popup-btn" :style="{ paddingBottom: isIphoneX ? '68rpx' : '34rpx' }">
  23. <view class="tui-flex-1">
  24. <view class="tui-button" @click="handleAddCard">添加银行卡</view>
  25. </view>
  26. </view>
  27. </view>
  28. </tui-bottom-popup>
  29. <!-- 弹窗提示 -->
  30. <tui-modal
  31. :show="modal"
  32. @click="handleClick"
  33. @cancel="hideMobel"
  34. :content="contentModalText"
  35. :button="modalButton"
  36. color="#333"
  37. :size="32"
  38. shape="circle"
  39. :maskClosable="false"
  40. >
  41. </tui-modal>
  42. </view>
  43. </template>
  44. <script>
  45. export default {
  46. data() {
  47. return {
  48. StaticUrl: this.$Static,
  49. isIphoneX:this.$store.state.isIphoneX,
  50. listQuery: {
  51. userId: '', // 用户ID
  52. pageNum: 1, // 页数
  53. pageSize: 10, // 加载条数
  54. type: 0 // 查询余额类型
  55. },
  56. isEmpty: false,
  57. loadding: false,
  58. pullUpOn: true,
  59. hasNextPage: false,
  60. pullFlag: true,
  61. nomoreText: '上拉显示更多',
  62. popupShow:true,
  63. contentModalText: '', //操作文字提示语句
  64. modal: false,
  65. modalButton: [
  66. {
  67. text: '保持绑定',
  68. type: 'gray',
  69. plain: true //是否空心
  70. },
  71. {
  72. text: '继续解绑',
  73. customStyle: {
  74. color: '#fff',
  75. bgColor: 'linear-gradient(90deg, #F28F31 0%, #FF5B00 100%)'
  76. },
  77. plain: false
  78. }
  79. ],
  80. list: [
  81. {
  82. type: 1,
  83. flag: 0,
  84. B2B: 'CCB',
  85. name: '建设银行',
  86. code:'45454545454521212'
  87. },
  88. {
  89. type: 1,
  90. flag: 0,
  91. B2B: 'ICBC',
  92. name: '工商银行',
  93. code:'45454545454521212'
  94. },
  95. {
  96. type: 0,
  97. flag: 0,
  98. B2B: 'ABC',
  99. name: '农业银行',
  100. code:'45454545454521212'
  101. }
  102. ]
  103. }
  104. },
  105. onLoad() {
  106. // this.GetAccountInitData()
  107. },
  108. filters: {},
  109. methods: {
  110. async GetAccountInitData(index) {
  111. //获取余额明细数据列表
  112. const user = await this.$api.getStorage()
  113. this.listQuery.userId = user.userId ? user.userId : 0
  114. this.UserService.GetUserClubBeansList(this.listQuery)
  115. .then(response => {
  116. let data = response.data
  117. let list = data.pageInfo.list
  118. this.userBeans = data.userBeans
  119. this.hasNextPage = data.pageInfo.hasNextPage
  120. if (list && list.length > 0) {
  121. this.isEmpty = false
  122. this.beansList = [...list]
  123. } else {
  124. this.isEmpty = true
  125. }
  126. if (this.hasNextPage) {
  127. this.pullUpOn = false
  128. this.nomoreText = '上拉显示更多'
  129. } else {
  130. if (this.beansList.length < 10) {
  131. this.pullUpOn = true
  132. } else {
  133. this.pullUpOn = false
  134. this.nomoreText = '已至底部'
  135. }
  136. }
  137. })
  138. .catch(error => {
  139. this.$util.msg(error.msg, 2000)
  140. })
  141. },
  142. GetOnReachBottomData(index) {
  143. //上拉加载
  144. this.listQuery.pageNum += 1
  145. this.UserService.GetUserClubBeansList(this.listQuery)
  146. .then(response => {
  147. let data = response.data
  148. let list = data.pageInfo.list
  149. this.userBeans = data.userBeans
  150. this.hasNextPage = data.pageInfo.hasNextPage
  151. this.beansList = this.beansList.concat(list)
  152. this.pullFlag = false // 防上拉暴滑
  153. setTimeout(() => {
  154. this.pullFlag = true
  155. }, 500)
  156. if (this.hasNextPage) {
  157. this.pullUpOn = false
  158. this.nomoreText = '上拉显示更多'
  159. } else {
  160. this.loadding = false
  161. this.pullUpOn = false
  162. this.nomoreText = '已至底部'
  163. }
  164. })
  165. .catch(error => {
  166. this.$util.msg(error.msg, 2000)
  167. })
  168. },
  169. handleAddCard(){
  170. // 跳转添加银行卡页面
  171. this.$api.navigateTo(`/pages/user/pay/card-add`)
  172. },
  173. handleUnbind(){
  174. //解绑
  175. this.modal = true
  176. this.contentModalText = '解绑后此卡需要重新绑定才能继续使用'
  177. },
  178. async handleClick(e) {
  179. //确认删除
  180. if (e.index == 1) {
  181. this.handleDeleteUserLike()
  182. }
  183. this.modal = false
  184. },
  185. hideMobel(){
  186. // 取消解绑
  187. this.modal = false
  188. },
  189. handleLogo(type) {
  190. const LogoMap = {
  191. 'CCB':'https://img2.baidu.com/it/u=4262210206,1883697020&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=501',
  192. 'ICBC':'https://www.weixinyunduan.com/ups/2016/01/309212/edf5a48e69afa569eb31a52fc36de450.jpg',
  193. 'ABC':'https://userfile.yksup.com/userdata/18039/img/brand-20170315232223_e0p18k.jpg'
  194. }
  195. return LogoMap[type]
  196. },
  197. handleStyle(type) {
  198. const styleMap = {
  199. 'CCB':'linear-gradient(90deg, #4D8CD8 0%, #3C66C9 100%);',
  200. 'ICBC':'linear-gradient(90deg, #ED796B 0%, #EF585E 100%);',
  201. 'ABC':'linear-gradient(90deg, #19B8B2 0%, #009C96 100%);'
  202. }
  203. return styleMap[type]
  204. },
  205. },
  206. onReachBottom() {
  207. if (this.hasNextPage) {
  208. this.loadding = true
  209. this.pullUpOn = true
  210. this.GetOnReachBottomData()
  211. }
  212. },
  213. onPullDownRefresh() {
  214. //下拉刷新
  215. this.listQuery.pageNum = 1
  216. this.GetAccountInitData()
  217. uni.stopPullDownRefresh()
  218. },
  219. onShow() {
  220. // this.beansList = []
  221. }
  222. }
  223. </script>
  224. <style lang="scss">
  225. page,
  226. .container {
  227. background: #ffffff;
  228. height: 100%;
  229. }
  230. .card-title {
  231. width: 100%;
  232. height: 100rpx;
  233. line-height: 100rpx;
  234. font-size: $font-size-32;
  235. color: #333;
  236. font-weight: bold;
  237. box-sizing: border-box;
  238. padding: 0 24rpx;
  239. text {
  240. font-size: $font-size-28;
  241. color: #999;
  242. font-weight: normal;
  243. margin-left: 10rpx;
  244. }
  245. }
  246. .card-content {
  247. width: 100%;
  248. height: auto;
  249. box-sizing: border-box;
  250. padding: 0 40rpx;
  251. .list {
  252. width: 100%;
  253. height: 240rpx;
  254. border-radius: 16rpx;
  255. box-sizing: border-box;
  256. padding: 32rpx;
  257. position: relative;
  258. margin-bottom: 32rpx;
  259. &:last-child{
  260. margin-bottom: 0;
  261. }
  262. .list-logo{
  263. width: 80rpx;
  264. height: 100%;
  265. float: left;
  266. .logo{
  267. width: 80rpx;
  268. height: 80rpx;
  269. border-radius: 50%;
  270. padding: 10rpx;
  271. box-sizing: border-box;
  272. background-color: #ffffff;
  273. float: left;
  274. image{
  275. width: 60rpx;
  276. height: 60rpx;
  277. border-radius: 50%;
  278. display: block;
  279. }
  280. }
  281. }
  282. .list-main{
  283. width: 452rpx;
  284. float: left;
  285. margin-left: 32rpx;
  286. .list-main-name{
  287. width: 100%;
  288. height: 50rpx;
  289. line-height: 50rpx;
  290. font-size: $font-size-34;
  291. color: #ffffff;
  292. }
  293. .list-main-tag{
  294. width: 100%;
  295. height: 37rpx;
  296. margin: 8rpx 0 36rpx 0;
  297. .tag{
  298. display: inline-block;
  299. line-height: 37rpx;
  300. padding: 0 12rpx;
  301. border-radius: 19rpx;
  302. font-size: $font-size-24;
  303. color: #ffffff;
  304. background: rgba(255, 255, 255, 0.2);
  305. float: left;
  306. }
  307. }
  308. .list-main-code{
  309. width: 100%;
  310. height: 50rpx;
  311. line-height: 50rpx;
  312. font-size: $font-size-34;
  313. color: #ffffff;
  314. }
  315. }
  316. .list-btn{
  317. font-size: $font-size-24;
  318. color: #ffffff;
  319. height: 30rpx;
  320. line-height: 30rpx;
  321. position: absolute;
  322. right: 32rpx;
  323. top: 32rpx;
  324. }
  325. }
  326. }
  327. .tui-popup-box {
  328. position: relative;
  329. box-sizing: border-box;
  330. min-height: 100rpx;
  331. padding: 6rpx 24rpx;
  332. .tui-popup-content {
  333. padding-top: 30rpx;
  334. }
  335. }
  336. .tui-popup-btn {
  337. width: 100%;
  338. height: auto;
  339. float: left;
  340. box-sizing: border-box;
  341. margin-top: 30rpx;
  342. .tui-button {
  343. width: 600rpx;
  344. height: 88rpx;
  345. background: $btn-confirm;
  346. line-height: 88rpx;
  347. text-align: center;
  348. color: #ffffff;
  349. font-size: $font-size-28;
  350. border-radius: 44rpx;
  351. margin: 0 auto;
  352. }
  353. }
  354. </style>