points.vue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339
  1. <template>
  2. <view>
  3. <u-navbar title="积分">
  4. <view class="slot-wrap" v-if="false" >
  5. 积分规则
  6. </view>
  7. </u-navbar>
  8. <view class="background">
  9. <view class="points">
  10. <view class="number">
  11. {{plusInfo.userPoints}}
  12. </view>
  13. <view class="unit">
  14. 积分
  15. </view>
  16. </view>
  17. <view class="rank" v-if="this.current==0" @click="gotoUrl('pages/mine/points/rankingList')">
  18. <view class="img"><img src="../../../assets/img/riFill-bar-chart-2-fill@1x.png" alt=""></view>
  19. <view class="text">积分排名{{top&&top.userSortNo?'第'+top.rank+'名':''}}</view>
  20. <view><u-icon name="arrow-right" color="#fff" size="28"></u-icon></view>
  21. </view>
  22. <view class="rank" v-if="this.current==1">
  23. <view class="img"><img src="../../../assets/img/riLine-gift-2-line@1x.png" alt=""></view>
  24. <view class="text">积分兑换</view>
  25. <view><u-icon name="arrow-right" color="#fff" size="28"></u-icon></view>
  26. </view>
  27. </view>
  28. <view class="record">
  29. <view class="tabs" v-if="false">
  30. <u-tabs bar-width="100" inactive-color="#bbbbbb" active-color="#101010" :list="tablist" :is-scroll="false" :current="current" @change="change" ></u-tabs>
  31. </view>
  32. <view class="get" v-if="this.current==0" >
  33. <!-- <view class="total">
  34. 6月获取278
  35. </view> -->
  36. <view class="each" v-for="(item,i) in list" :key="i">
  37. <view class="way-date">
  38. <view class="way">
  39. {{item.source}}
  40. </view>
  41. <view class="date">
  42. {{item.createTime}}
  43. </view>
  44. </view>
  45. <view class="number">
  46. {{item.score?"+"+item.score:item.score}}
  47. </view>
  48. </view>
  49. </view>
  50. <view class="exchange" v-if="this.current==1">
  51. <view class="item">
  52. <view class="month">
  53. 6月
  54. </view>
  55. <view class="details" v-for="(item,i) in 2" :key="i">
  56. <view class="picture">
  57. <img src="../../../assets/img/riLine-gift-2-line@1x.png" alt="">
  58. </view>
  59. <view class="infos">
  60. <view class="name">
  61. 兑换礼品名称
  62. </view>
  63. <view class="price">
  64. <text>价格:</text>
  65. <text>30积分</text>
  66. </view>
  67. <view class="date">
  68. <text>时间:</text>
  69. <text>2022-06-23 14:27:22兑换</text>
  70. </view>
  71. </view>
  72. </view>
  73. </view>
  74. <view class="item">
  75. <view class="month">
  76. 5月
  77. </view>
  78. <view class="details" v-for="(item,i) in 2" :key="i">
  79. <view class="picture">
  80. <img src="../../../assets/img/riLine-gift-2-line@1x.png" alt="">
  81. </view>
  82. <view class="infos">
  83. <view class="name">
  84. 兑换礼品名称
  85. </view>
  86. <view class="price">
  87. <text>价格:</text>
  88. <text>30积分</text>
  89. </view>
  90. <view class="date">
  91. <text>时间:</text>
  92. <text>2022-05-23 14:27:22兑换</text>
  93. </view>
  94. </view>
  95. </view>
  96. </view>
  97. </view>
  98. </view>
  99. <u-divider :isnone="list.length==0" nonetext="你还没有获取到积分" bg-color="#F2F4F4" border-color="#CFD2D5">已经到底了</u-divider>
  100. </view>
  101. </template>
  102. <script>
  103. import * as API from '@/apis/pagejs/user.js'
  104. export default {
  105. data() {
  106. return {
  107. plusInfo:{},
  108. userInfo:{},
  109. tablist: [{
  110. name: '积分获取'
  111. }, {
  112. name: '积分兑换'
  113. }],
  114. listForm:{
  115. pageIndex:1,
  116. pageSize:20,
  117. },
  118. recordsTotal:0,
  119. list:[],
  120. current: 0,
  121. top:null,
  122. }
  123. },
  124. onLoad() {
  125. this.plusInfo=this.carhelp.getPersonInfoPlus();
  126. this.userInfo=this.carhelp.getPersonInfo();
  127. this.getList()
  128. this.pointsNotes()
  129. },
  130. onReachBottom() {
  131. if (this.list.length < this.recordsTotal) {
  132. this.myLoadmore();
  133. }
  134. },
  135. methods: {
  136. pointsNotes(){
  137. API.pointsNotes({
  138. pageIndex:1,
  139. pageSize:0,
  140. }).then((res) => {
  141. if(res.data.myPoint){
  142. this.top=res.data.myPoint
  143. this.top.rank=parseInt(res.data.myPoint.userSortNo)
  144. }
  145. uni.hideLoading();
  146. }).catch(error => {
  147. })
  148. },
  149. myLoadmore(){
  150. this.listForm.pageIndex += 1;
  151. this.getList();
  152. },
  153. change(index) {
  154. this.current = index;
  155. },
  156. getList(){
  157. uni.showLoading({
  158. title: "加载中",
  159. mask: true,
  160. })
  161. API.myPointsNotes(this.listForm).then((res) => {
  162. uni.hideLoading();
  163. this.list = [
  164. ...this.list,
  165. ...res.data.data
  166. ];
  167. this.recordsTotal = res.data.recordsTotal;
  168. }).catch(error => {
  169. uni.showToast({
  170. title: error,
  171. icon: "none"
  172. })
  173. })
  174. }
  175. }
  176. }
  177. </script>
  178. <style lang="scss" scoped>
  179. /deep/.u-slot-content {
  180. display: block;
  181. text-align: right !important;
  182. margin-right: 16px;
  183. color: rgba(31, 74, 153, 1);
  184. font-size: 16px;
  185. }
  186. .background{
  187. background: linear-gradient(180deg, rgba(18,114,238,1) 0%,rgba(244,244,246,1) 100%);
  188. padding: 32rpx;
  189. color: #fff;
  190. display: flex;
  191. justify-content: space-between;
  192. align-items: baseline;
  193. height: 231px;
  194. .points{
  195. display: flex;
  196. align-items: baseline;
  197. .number{
  198. font-size: 36px;
  199. font-family: 'Medium';
  200. }
  201. .unit{
  202. font-size: 16px;
  203. margin-left: 16rpx;
  204. font-family: 'Regular';
  205. }
  206. }
  207. .rank{
  208. display: flex;
  209. align-items: center;
  210. font-size: 32rpx;
  211. .img{
  212. width: 32rpx;
  213. height: 32rpx;
  214. img{
  215. width: 100%;
  216. height: 100%;
  217. }
  218. }
  219. .text{
  220. margin-left: 8rpx;
  221. margin-right: 4rpx;
  222. font-family: 'Regular';
  223. }
  224. }
  225. }
  226. .record{
  227. margin: -320rpx 32rpx 24rpx;
  228. background-color: #fff;
  229. border-radius: 8px 8px 0px 0px;
  230. min-height: 800rpx;
  231. .tabs{
  232. padding: 0 160rpx;
  233. height: 40px;
  234. border-bottom: 1px solid #E6E6E6;
  235. /deep/.u-tab-bar{
  236. background-color: #0076FF !important ;
  237. }
  238. }
  239. .get{
  240. .total{
  241. height: 44px;
  242. line-height: 44px;
  243. color: rgba(51, 51, 51, 1);
  244. font-size: 16px;
  245. border-bottom: 1px solid #E6E6E6;
  246. text-indent:32rpx;
  247. }
  248. .each{
  249. font-family: 'Regular';
  250. display: flex;
  251. justify-content: space-between;
  252. align-items: center;
  253. padding: 28rpx 0;
  254. margin: 0 32rpx;
  255. border-bottom: 1px solid #E6E6E6;
  256. .way-date{
  257. .way{
  258. color: rgba(51, 51, 51, 1);
  259. font-size: 16px;
  260. }
  261. .date{
  262. color: rgba(119, 119, 119, 1);
  263. margin-top: 16rpx;
  264. }
  265. }
  266. .number{
  267. color: rgba(31, 74, 153, 1);
  268. font-size: 24px;
  269. }
  270. }
  271. }
  272. .exchange{
  273. padding:0 32rpx 32rpx;
  274. .item{
  275. .month{
  276. height: 88rpx;
  277. line-height: 88rpx;
  278. color: #101010;
  279. }
  280. .details{
  281. display: flex;
  282. border-radius: 4px;
  283. background-color: rgba(242, 242, 242, 1);
  284. padding: 16rpx ;
  285. margin-bottom: 16rpx;
  286. .picture{
  287. width: 128rpx;
  288. height:128rpx;
  289. border-radius: 4px;
  290. background-color: rgba(255, 70, 41, 1);
  291. display: flex;
  292. align-items: center;
  293. justify-content: center;
  294. img{
  295. width: 88rpx;
  296. height: 88rpx;
  297. }
  298. }
  299. .infos{
  300. margin-left: 16rpx;
  301. .name{
  302. color: rgba(16, 16, 16, 1);
  303. font-size: 32rpx;
  304. }
  305. .price,.date{
  306. color: rgba(102, 102, 102, 1);
  307. line-height: 28rpx;
  308. margin-top: 14rpx;
  309. font-size: 28rpx
  310. }
  311. }
  312. }
  313. }
  314. }
  315. }
  316. </style>