pointsDetails.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  1. <!-- 积分明细 -->
  2. <template>
  3. <view class="pointsDetails">
  4. <view class="top-text-box">
  5. <view class="img-box">
  6. <img class="img-view" :src="imagesUrl('commonality/icon_wd_jlf@1x.png')">
  7. <view class="img-text">{{maxNum}}</view>
  8. </view>
  9. <view class="text-box">积分可以在兑换机扫码兑换丰富礼品</view>
  10. </view>
  11. <view class="top-button-box">
  12. <view :class="checkIndex == 4?'check-button':''" @click="checkButton(4)">全部收支</view>
  13. <view :class="checkIndex == 1?'check-button':''" @click="checkButton(1)">已获取</view>
  14. <view :class="checkIndex == 2?'check-button':''" @click="checkButton(2)">已消耗</view>
  15. </view>
  16. <scroll-view scroll-y @scrolltolower="scrollGet" class="for-max-box">
  17. <view class="for-big-box" v-for="(item,index) in dataList" :key="index">
  18. <img class="left-img" :src="imagesUrl('commonality/icon_wd_jlf@1x.png')"/>
  19. <!-- <view class="center-box" v-if="item.data1 == 1">
  20. <view>{{item.changeInfo}}</view>
  21. <view>{{item.data3}}</view>
  22. </view> -->
  23. <view class="center-box-1">
  24. <view>{{item.changeInfo}}</view>
  25. </view>
  26. <view class="right-box">
  27. <view :class="item.scoreChange>0?'up-color':''">{{item.scoreChange>0?'+'+item.scoreChange:item.scoreChange}}</view>
  28. <view>{{item.createTime}}</view>
  29. </view>
  30. </view>
  31. <view class="get-data-null-p" v-if="getDataType">- 没有更多数据 -</view>
  32. <view class="get-data-null-p" v-if="!getDataType && textShowType">- 上划加载更多 -</view>
  33. </scroll-view>
  34. </view>
  35. </template>
  36. <script>
  37. import { creditMainGetUserReward } from '@/pages_basics/api/index.js'
  38. export default {
  39. data() {
  40. return {
  41. total: 0,
  42. dataList: [
  43. {
  44. data1:'1',
  45. data2:'礼品兑换消耗积分',
  46. data3:'(矿泉水)',
  47. data4:'-10',
  48. data5:'2026-03-06 15:29',
  49. },
  50. {
  51. data1:'2',
  52. data2:'完成课程学习获取积分',
  53. data3:'',
  54. data4:'+10',
  55. data5:'2026-03-06 15:29',
  56. },
  57. ],
  58. getDataType: false,
  59. // 查询参数
  60. checkIndex:4,
  61. queryParams: {
  62. page: 1,
  63. pageSize: 10,
  64. },
  65. maxNum:0,
  66. textShowType:false,
  67. }
  68. },
  69. onLoad(option){
  70. console.log('option',option)
  71. this.$set(this,'maxNum',option.q?option.q:0);
  72. this.getList()
  73. },
  74. onShow(){
  75. },
  76. methods:{
  77. checkButton(type){
  78. if(this.checkIndex!=type){
  79. this.$set(this,'checkIndex',type);
  80. this.$set(this,'total',0);
  81. this.$set(this,'dataList',[]);
  82. this.$set(this,'getDataType',false);
  83. this.$set(this.queryParams,'page',1);
  84. this.getList();
  85. }
  86. },
  87. //滚动加载事件
  88. scrollGet() {
  89. let self = this;
  90. if (self.total / self.queryParams.pageSize <= self.queryParams.page) {
  91. this.$set(this, 'getDataType', true);
  92. } else {
  93. this.queryParams.page += 1;
  94. this.$nextTick(() => {
  95. this.getList();
  96. })
  97. }
  98. },
  99. //获取实验室列表
  100. async getList() {
  101. let self = this;
  102. let obj = JSON.parse(JSON.stringify(this.queryParams));
  103. if(this.checkIndex == 4){
  104. obj.bonusType = '';
  105. }else{
  106. obj.bonusType = this.checkIndex
  107. }
  108. const {
  109. data
  110. } = await creditMainGetUserReward(obj);
  111. if (data.code == 200) {
  112. if(self.queryParams.page == 1){
  113. this.dataList = data.data.records;
  114. this.total = data.data.total;
  115. if (data.data.total / self.queryParams.pageSize <= self.queryParams.page) {
  116. this.$set(this, 'getDataType', true);
  117. }
  118. }else{
  119. this.dataList = [...this.dataList, ...data.data.records]
  120. this.total = data.data.total;
  121. if (data.data.total / self.queryParams.pageSize <= self.queryParams.page) {
  122. this.$set(this, 'getDataType', true);
  123. }
  124. }
  125. this.$set(this,'textShowType',true);
  126. }
  127. },
  128. }
  129. }
  130. </script>
  131. <style lang="stylus" scoped>
  132. .pointsDetails{
  133. height:100%;
  134. width:100%
  135. overflow: hidden;
  136. display: flex;
  137. flex-direction: column;
  138. .top-text-box{
  139. background-color: #fff;
  140. height:230rpx;
  141. .img-box{
  142. display: flex;
  143. margin: 40rpx 0 0 300rpx;
  144. .img-view{
  145. width:60rpx;
  146. height:56rpx;
  147. }
  148. .img-text{
  149. line-height:56rpx;
  150. height:56rpx;
  151. flex:1;
  152. font-size:46rpx;
  153. margin-left:20rpx;
  154. }
  155. }
  156. .text-box{
  157. background-color: #FDECD5;
  158. color:#333;
  159. text-align: center;
  160. font-size:28rpx;
  161. width:540rpx;
  162. height:60rpx;
  163. line-height:60rpx;
  164. border-radius:30rpx;
  165. margin: 30rpx auto 0
  166. }
  167. }
  168. .top-button-box{
  169. height:100rpx;
  170. display: flex;
  171. view{
  172. width: 180rpx;
  173. background-color: #D7D7D7;
  174. color:#333;
  175. text-align: center;
  176. height:60rpx;
  177. line-height:60rpx;
  178. margin:20rpx 0 0 20rpx;
  179. border-radius:10rpx;
  180. }
  181. .check-button{
  182. background-color:#06D0D0;
  183. color:#fff;
  184. }
  185. }
  186. .for-max-box {
  187. flex: 1;
  188. overflow-y scroll;
  189. .null-img {
  190. display block;
  191. width: 276rpx;
  192. height: 321rpx;
  193. position absolute;
  194. top: 200rpx;
  195. left: 274rpx;
  196. }
  197. .for-big-box:nth-child(1) {
  198. border-top: none;
  199. }
  200. .for-big-box{
  201. background: #fff;
  202. border-top:1rpx solid #dedede;
  203. display: flex;
  204. .left-img{
  205. width:30rpx;
  206. height:28rpx;
  207. margin:61rpx 30rpx 61rpx 40rpx;
  208. }
  209. .center-box{
  210. flex:1;
  211. padding: 40rpx 0;
  212. view{
  213. height:35rpx;
  214. line-height:35rpx;
  215. font-size:28rpx;
  216. font-weight:700;
  217. }
  218. view:nth-child(1){
  219. }
  220. view:nth-child(2){
  221. color:#A1988D;
  222. }
  223. }
  224. .center-box-1{
  225. flex:1;
  226. padding: 40rpx 0;
  227. view{
  228. height:70rpx;
  229. line-height:70rpx;
  230. font-size:28rpx;
  231. font-weight:700;
  232. }
  233. }
  234. .right-box{
  235. // width:250rpx;
  236. width:288rpx;
  237. view:nth-child(1){
  238. padding-right:30rpx;
  239. text-align: right;
  240. color:#666;
  241. line-height:60rpx;
  242. height:60rpx;
  243. margin-top:20rpx;
  244. font-weight:700;
  245. }
  246. view:nth-child(2){
  247. font-size:26rpx;
  248. color:#A1988D;
  249. line-height:60rpx;
  250. height:60rpx;
  251. }
  252. .up-color{
  253. color: #d9001d !important;;
  254. }
  255. }
  256. }
  257. }
  258. .get-data-null-p{
  259. text-align: center;
  260. height:80rpx;
  261. line-height:80rpx;
  262. color:#999;
  263. }
  264. }
  265. </style>