index.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295
  1. <template>
  2. <view class="main">
  3. <view class="pageTop">
  4. <navbar ref="navbar" :config="config"></navbar>
  5. <view class="dataCls">
  6. <view class="dataCls_l">
  7. <view class="dataCls_l_num">{{userData.integral_able}}</view>
  8. <view>公益积分</view>
  9. </view>
  10. <view class="dataCls_r" @click="goPublicWelfare()">
  11. <view>做公益</view>
  12. </view>
  13. </view>
  14. <view class="shadeBox"></view>
  15. </view>
  16. <view class="listBox">
  17. <view class="listBox_tab">
  18. <view :class="{active:activeTab===0}" @click="switchTab(0)">公益积分明细</view>
  19. <view :class="{active:activeTab===1}" @click="switchTab(1)">捐赠明细</view>
  20. </view>
  21. <view class="list_item" v-for="(v,i) in list" :key="i" v-if="activeTab===0">
  22. <view class="list_item_l">
  23. <view class="list_item_l_text">{{v.mode}}</view>
  24. <view class="list_item_l_time">{{v.create_time.substr(0,10)}}</view>
  25. </view>
  26. <!-- <view class="list_item_r">
  27. <view @click="goShare()">查看证书</view>
  28. </view> -->
  29. <view class="list_item_r c_green" :class="{c_red:!v.bill_type}">{{v.bill_type?'+':'-'}} {{v.value}}
  30. </view>
  31. </view>
  32. <view class="list_item" v-for="(v,i) in donateList" :key="i" v-if="activeTab===1">
  33. <view class="list_item_l">
  34. <view class="list_item_l_text">{{v.content}}</view>
  35. <view class="list_item_l_time">{{v.create_time.substr(0,10)}}</view>
  36. </view>
  37. <view class="list_item_r">
  38. <view @click="goShare(v)">查看证书</view>
  39. </view>
  40. </view>
  41. <view class="loadmoreBox">
  42. <u-loadmore :status="status" />
  43. </view>
  44. </view>
  45. </view>
  46. </template>
  47. <script>
  48. export default {
  49. data() {
  50. return {
  51. config: {
  52. back: true, //false是tolbar页面 是则不写
  53. title: '我的公益积分',
  54. color: '#ffffff',
  55. //背景颜色;参数一:透明度(0-1);参数二:背景颜色(array则为线性渐变,string为单色背景)
  56. backgroundColor: [0, 'transparent'],
  57. statusBarFontColor: '#ffffff',
  58. rightSlot: true,
  59. },
  60. activeTab:0,
  61. list:[],
  62. donateList:[],
  63. status: "nomore",
  64. totalPage: 0,
  65. param:{
  66. page:1,
  67. limit:10
  68. },
  69. userData:{}
  70. }
  71. },
  72. onLoad() {
  73. this.getLoveList();
  74. this.getData()
  75. },
  76. onPullDownRefresh() {
  77. this.activeTab=0
  78. this.param.page=1;
  79. this.list=[];
  80. this.getLoveList();
  81. this.getData()
  82. },
  83. onReachBottom() {
  84. if (this.status == "loadmore") {
  85. this.param.page++
  86. if(this.activeTab==0){
  87. this.getLoveList()
  88. }else{
  89. this.getDonateList()
  90. }
  91. }
  92. },
  93. methods:{
  94. switchTab(index){
  95. this.donateList=[];
  96. this.list=[];
  97. this.activeTab=index
  98. this.param.page=1;
  99. this.status = "loading"
  100. if(this.activeTab==0){
  101. this.getLoveList()
  102. }else{
  103. this.getDonateList()
  104. }
  105. },
  106. getData() {
  107. this.$http.get('/account/app-account-info').then(res => {
  108. if (res && res.code == 200) {
  109. this.userData=res.data
  110. }
  111. })
  112. },
  113. // 做公益
  114. goPublicWelfare(){
  115. uni.navigateTo({
  116. url:"/pages/publicWelfare/index"
  117. })
  118. },
  119. // 跳转 分享
  120. goShare(item){
  121. uni.navigateTo({
  122. url:"/pages/research/myPublicWelfare/share?title="+item.content+'&time='+item.create_time.substr(0,10)+'&code='+item.certificate_number
  123. })
  124. },
  125. // 爱心明细
  126. getLoveList() {
  127. this.status = "loading"
  128. this.$http.get('/integral/record/my-list',this.param).then(res => {
  129. if (res && res.code == 200) {
  130. this.list.push(...res.page.list);
  131. this.totalPage = res.page.totalCount;
  132. if (this.totalPage > this.list.length) {
  133. this.status = "loadmore"
  134. } else {
  135. this.status = "nomore"
  136. }
  137. uni.stopPullDownRefresh()
  138. }
  139. })
  140. },
  141. // 捐赠记录
  142. getDonateList(){
  143. this.$http.get('/donate/record/page',this.param).then(res => {
  144. if (res && res.code == 200) {
  145. this.donateList.push(...res.page.list);
  146. this.totalPage = res.page.totalCount;
  147. if (this.totalPage > this.donateList.length) {
  148. this.status = "loadmore"
  149. } else {
  150. this.status = "nomore"
  151. }
  152. uni.stopPullDownRefresh()
  153. }
  154. })
  155. }
  156. }
  157. }
  158. </script>
  159. <style lang="scss">
  160. .pageTop {
  161. width: 100%;
  162. height: 450rpx;
  163. background: url('/static/convenienceService/detailsBg.png')0 0 no-repeat;
  164. background-size: 752rpx 510rpx;
  165. position: relative;
  166. /deep/ .hx-navbar__fixed {
  167. background: url('/static/convenienceService/detailsBg.png')0 0 no-repeat;
  168. background-size: 752rpx 510rpx;
  169. }
  170. .dataCls {
  171. display: flex;
  172. justify-content: space-between;
  173. padding: 0 60rpx;
  174. margin-top: 80rpx;
  175. .dataCls_l {
  176. font-size: 28rpx;
  177. color: #F5F5F5;
  178. line-height: 40rpx;
  179. .dataCls_l_num {
  180. font-size: 38rpx;
  181. }
  182. }
  183. .dataCls_r {
  184. display: flex;
  185. align-items: center;
  186. view {
  187. font-size: 28rpx;
  188. color: #0B844A;
  189. padding: 20rpx 46rpx;
  190. border-radius: 40rpx;
  191. background: #ffffff;
  192. margin-bottom: 20rpx;
  193. }
  194. }
  195. }
  196. .shadeBox {
  197. width: 100%;
  198. height: 40rpx;
  199. background: #ffffff;
  200. border-radius: 40rpx 40rpx 0 0;
  201. position: absolute;
  202. bottom: 0;
  203. left: 0;
  204. }
  205. }
  206. .listBox {
  207. padding: 0 60rpx;
  208. .listBox_tab{
  209. display: flex;
  210. justify-content: space-around;
  211. view{
  212. font-size: 30rpx;
  213. color: #1A1A1A;
  214. padding-bottom: 22rpx;
  215. }
  216. .active{
  217. color: #22A834;
  218. position: relative;
  219. font-weight: 700;
  220. &::after{
  221. display: block;
  222. content: "";
  223. position: absolute;
  224. width: 100%;
  225. height: 4rpx;
  226. background: #22A834;
  227. left: 0;
  228. bottom: 0;
  229. }
  230. }
  231. }
  232. .list_item {
  233. display: flex;
  234. justify-content: space-between;
  235. align-items: center;
  236. border-bottom: 1rpx solid #E6E6E6;
  237. padding: 30rpx 0;
  238. .list_item_l {
  239. .list_item_l_text {
  240. font-size: 28rpx;
  241. color: #1A1A1A;
  242. }
  243. .list_item_l_time {
  244. font-size: 24rpx;
  245. color: #999999;
  246. margin-top: 10rpx;
  247. }
  248. }
  249. .list_item_r {
  250. flex-shrink: 0;
  251. view{
  252. width: 157rpx;
  253. height: 63rpx;
  254. background: #2eb82a;
  255. border-radius: 32rpx;
  256. line-height: 63rpx;
  257. text-align: center;
  258. color: #ffffff;
  259. }
  260. }
  261. }
  262. .loadmoreBox {
  263. display: flex;
  264. justify-content: center;
  265. padding: 30rpx;
  266. }
  267. }
  268. .c_red {
  269. color: #FF3B3B;
  270. }
  271. .c_green {
  272. color: #118D44;
  273. }
  274. </style>