支付宝小程序 UI·历史记录-公积金缴存

2020-09-08 16:09 更新

本示例主要实现历史公积金缴存、提取记录的查询功能。

使用说明

  • 本示例为纯客户端代码,可直接在模拟器和在真机预览。
  • 更多详情请参见 代码市场

使用指南

安装

在 IDE 安装以下依赖

  1. npm i mashi-open-snippets --save

注册

在 JSON 中引入组件路径

  1. {
  2. "usingComponents": {
  3. "move-demo": "mashi-open-snippets/es/housing-fund-record/index"
  4. }}

调用

分别在 AXML、JS、ACSS 中输入以下代码

  1. <view class="housing-fund-record-page">
  2. <tabs
  3. tabs="{{tabs2}}"
  4. tabsName="activeTab2"
  5. onTabClick="handleTabClick"
  6. onChange="handleTabChange"
  7. activeTab="{{activeTab2}}"
  8. showPlus="{{false}}"
  9. capsule="{{false}}"
  10. hasSubTitle="{{false}}"
  11. >
  12. <block a:for="{{tabs2}}">
  13. <tab-content swipeable="{{true}}" key="{{index}}" tabId="{{index}}" activeTab="{{activeTab2}}" a:if="{{index === 0}}">
  14. <view class="housing-fund-record-page-content">
  15. <view a:for="{{filterList}}">
  16. <housing-fund-record data="{{item}}"/>
  17. </view>
  18. </view>
  19. </tab-content>
  20. <tab-content swipeable="{{true}}" key="{{index}}" tabId="{{index}}" activeTab="{{activeTab2}}" a:elif="{{index === 2}}">
  21. <view class="housing-fund-record-page-content">
  22. <view a:for="{{filterList}}">
  23. <housing-fund-record data="{{item}}"/>
  24. </view>
  25. </view>
  26. </tab-content>
  27. <tab-content swipeable="{{true}}" key="{{index}}" tabId="{{index}}" activeTab="{{activeTab2}}" a:else>
  28. <view class="housing-fund-record-page-content">
  29. <view a:for="{{filterList}}">
  30. <housing-fund-record data="{{item}}"/>
  31. </view>
  32. </view>
  33. </tab-content>
  34. </block>
  35. </tabs>
  36. </view>
  1. Page({
  2. data: {
  3. tabs2: [
  4. {
  5. title: '全部',
  6. subTitle: '全部',
  7. },
  8. {
  9. title: '缴存',
  10. subTitle: '缴存',
  11. },
  12. {
  13. title: '提取',
  14. subTitle: '提取',
  15. },
  16. ],
  17. activeTab2: 0,
  18. list: [
  19. {
  20. title: '租房提取',
  21. isIn: false,
  22. source: '杭州市西湖区住房公积金管理中心',
  23. value: '30000.00',
  24. dateTime: '2019-04-15 12:14',
  25. }, {
  26. title: '公司汇缴-6月',
  27. isIn: true,
  28. source: '蚂蚁金服(杭州)网络技术有限公司',
  29. total: '27568.00',
  30. value: '5442.16',
  31. dateTime: '2019-06-15 12:14',
  32. }, {
  33. title: '公司汇缴-5月',
  34. isIn: true,
  35. source: '蚂蚁金服(杭州)网络技术有限公司',
  36. total: '22126.00',
  37. value: '5442.16',
  38. dateTime: '2019-05-15 12:14',
  39. }, {
  40. title: '租房提取',
  41. isIn: false,
  42. source: '杭州市西湖区住房公积金管理中心',
  43. value: '30000.00',
  44. dateTime: '2019-04-15 12:14',
  45. }, {
  46. title: '公司汇缴-4月',
  47. isIn: true,
  48. source: '蚂蚁金服(杭州)网络技术有限公司',
  49. total: '46684.00',
  50. value: '5442.16',
  51. dateTime: '2019-04-15 12:14',
  52. }, {
  53. title: '公司汇缴-3月',
  54. isIn: true,
  55. source: '蚂蚁金服(杭州)网络技术有限公司',
  56. total: '41242.00',
  57. value: '5442.16',
  58. dateTime: '2019-04-15 12:14',
  59. }, {
  60. title: '公司汇缴-2月',
  61. isIn: true,
  62. source: '蚂蚁金服(杭州)网络技术有限公司',
  63. total: '35800.00',
  64. value: '5442.16',
  65. dateTime: '2019-02-15 12:14',
  66. },
  67. ],
  68. filterList: []
  69. },
  70. onLoad() {
  71. this.setData({
  72. filterList: this.data.list
  73. })
  74. },
  75. handleTabClick({ index, tabsName }) {
  76. const { activeTab2, list } = this.data;
  77. // tab 切换了
  78. if (activeTab2 !== index) {
  79. switch (index) {
  80. case 0:
  81. this.setData({
  82. filterList: list
  83. })
  84. break;
  85. case 1:
  86. this.setData({
  87. filterList: list.filter(item => item.isIn)
  88. })
  89. break;
  90. case 2:
  91. this.setData({
  92. filterList: list.filter(item => !item.isIn)
  93. })
  94. break;
  95. default:
  96. this.setData({
  97. filterList: list
  98. })
  99. break;
  100. }
  101. }
  102. this.setData({
  103. [tabsName]: index,
  104. });
  105. },
  106. handleTabChange({ index, tabsName }) {
  107. const { list } = this.data;
  108. switch (index) {
  109. case 0:
  110. this.setData({
  111. filterList: list
  112. })
  113. break;
  114. case 1:
  115. this.setData({
  116. filterList: list.filter(item => item.isIn)
  117. })
  118. break;
  119. case 2:
  120. this.setData({
  121. filterList: list.filter(item => !item.isIn)
  122. })
  123. break;
  124. default:
  125. this.setData({
  126. filterList: list
  127. })
  128. break;
  129. }
  130. this.setData({
  131. [tabsName]: index,
  132. });
  133. },
  134. });
  1. .housing-fund-record-page {
  2. //background-color:rgb(242, 242, 242);
  3. //padding:16px 12px;
  4. //height:100vh;
  5. //box-sizing:border-box;
  6. }
  7. .housing-fund-record-page-content {
  8. //position: absolute;
  9. //width: 100%;
  10. //top: 0;
  11. //bottom: 0;
  12. //left: 0;
  13. //background-color:red;
  14. height:calc(100vh - 44px);
  15. overflow-y: auto;
  16. background-color:rgb(242, 242, 242);
  17. padding:16px 12px;
  18. box-sizing:border-box;
  19. }
  20. .housing-fund-record-page-content >view{
  21. margin-bottom:24rpx;
  22. }

属性

属性 类型 必填 默认值 描述
data Object {} 接收一个对象,其中 isIn 属性通过 true 或者 false 来控制公积金是缴存还是提取,total 属性为总金额,可填可不填
containerClassName string " " 容器类名
以上内容是否对您有帮助:
在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号