my-points.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290
  1. <template>
  2. <view>
  3. <u-picker v-model="showTime" mode="time" :params="params" :default-time="defaultTime" @confirm="confirmTime"></u-picker>
  4. <view class="top">
  5. <view class="value">
  6. <text>积分价值</text>
  7. <text>{{point}}</text>
  8. </view>
  9. <view class="flex justify-center align-center">
  10. <view class="cu-btn btn" hover-class="hoverClass1" @click="$jump('/pages/mine/my-points/accredit')">
  11. 积分授权
  12. </view>
  13. </view>
  14. </view>
  15. <view class="data">
  16. <view class="left">
  17. <view @click.stop="showTime = true">
  18. <text>{{defaultTime}}</text>
  19. <text class="cuIcon-unfold padding-left-10"></text>
  20. </view>
  21. <!-- <view>
  22. <text>支出 ¥ 165.00 收入 ¥ 463.00</text>
  23. </view> -->
  24. </view>
  25. <view class="right">
  26. <text>统计</text>
  27. <text class="cuIcon-right"></text>
  28. </view>
  29. </view>
  30. <view class="card">
  31. <view style="display: flex;" class="cardTitle">
  32. <view class="area1 area-padding " style="padding-left: 40rpx;">
  33. <text>积分来源</text>
  34. </view>
  35. <view class="area2 area-padding">
  36. <text>积分数量</text>
  37. </view>
  38. <view class="area3 area-padding">
  39. <text>价值</text>
  40. </view>
  41. </view>
  42. <mescroll-body :height="height" ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback" :down="downOption"
  43. :up="upOption">
  44. <view @click="jump(item)" class="item" hover-class="hoverClass"
  45. v-for="(item,index) in list" :key="index">
  46. <view class="area1">
  47. <view class="item-padding">
  48. <image :src="item.logo" mode="aspectFit"></image>
  49. <view class="">
  50. <text>{{item.name}}</text>
  51. <text>{{item.updateTime}}</text>
  52. </view>
  53. </view>
  54. </view>
  55. <view class="area2 text-area ">
  56. <view class="item-padding">
  57. <image style="width: 35rpx;height: 35rpx;margin-bottom: -5rpx;"
  58. src="@/static/icon/points-value.png"></image>
  59. <text v-if="item.type==1||item.type==2" style="font-size: 32rpx;margin-left: 10rpx;color: #F39248;">+{{item.point}}</text>
  60. <text v-if="item.type==3" style="font-size: 32rpx;margin-left: 10rpx;color: #000000;">-{{item.point}}</text>
  61. </view>
  62. </view>
  63. <view class="area3 text-area ">
  64. <view class="item-padding" style="font-size: 34rpx;color: #000;">¥{{item.pointValue}}</view>
  65. </view>
  66. </view>
  67. </mescroll-body>
  68. </view>
  69. </view>
  70. </template>
  71. <script>
  72. import MescrollMixin from "@/components/mescroll-body/mescroll-mixins.js";
  73. export default {
  74. mixins: [MescrollMixin],
  75. data() {
  76. return {
  77. list:[],
  78. downOption:{
  79. auto:false
  80. },
  81. showTime:false,
  82. params: {
  83. year: true,
  84. month: true,
  85. },
  86. defaultTime:'',
  87. point:'',
  88. height:''
  89. }
  90. },
  91. onReady(){
  92. this.defaultTime=this.$dateTime.format(new Date(),'YYYY-mm')
  93. this.getElInfo()
  94. },
  95. onLoad(options) {
  96. if(options.point){
  97. this.point = options.point
  98. }
  99. },
  100. methods: {
  101. async getElInfo() {
  102. let rectInfo = await this.$u.getRect('.cardTitle');
  103. this.height = this.$u.sys().windowHeight - rectInfo.top + 'px'
  104. },
  105. jump(item){
  106. console.log(item);
  107. uni.navigateTo({
  108. url:'/pages/mine/bill-detail?billDetail='+JSON.stringify(item)+'&type=point'
  109. })
  110. },
  111. confirmTime(e){
  112. this.defaultTime = e.year + '-' +e.month
  113. this.downCallback()
  114. },
  115. upCallback(mescroll) {
  116. let params = {
  117. current:mescroll.num,
  118. size:mescroll.size,
  119. userId:this.vuex_userId,
  120. monthTime:this.defaultTime
  121. }
  122. if (this.defaultTime) {
  123. params.monthTime=this.defaultTime
  124. }else{
  125. params.monthTime=this.$dateTime.format(new Date(),'YYYY-mm')
  126. }
  127. try {
  128. this.$api.account.pointList(params).then(res => {
  129. let data = res.data.records
  130. let total = res.data.total
  131. mescroll.endBySize(data.length, total);
  132. if (mescroll.num == 1) this.list = []; //如果是第一页需手动制空列表
  133. this.list = this.list.concat(data); //追加新数据
  134. })
  135. } catch (e) {
  136. this.mescroll.endErr()
  137. }
  138. },
  139. downCallback() {
  140. setTimeout(() => {
  141. this.mescroll.resetUpScroll();
  142. }, 10)
  143. },
  144. }
  145. }
  146. </script>
  147. <style lang="scss" scoped>
  148. .btn {
  149. background-color: #FC8D38;
  150. color: #FFFFFF;
  151. border-radius: 50rpx;
  152. border: 1rpx solid #FFFFFF;
  153. }
  154. .hoverClass1{
  155. box-shadow: 0rpx 0rpx 10rpx #DDDDDD;
  156. }
  157. .top {
  158. padding: 50rpx;
  159. background-color: #FC8D38;
  160. display: flex;
  161. justify-content: space-between;
  162. .value {
  163. display: flex;
  164. flex-direction: column;
  165. text-align: center;
  166. text:first-child {
  167. color: #FCE7D6;
  168. font-size: 32rpx;
  169. }
  170. text:last-child {
  171. padding-top: 10rpx;
  172. font-size: 70rpx;
  173. color: #FFFFFF;
  174. }
  175. }
  176. }
  177. .data {
  178. padding: 50rpx 0 25rpx 40rpx;
  179. display: flex;
  180. justify-content: space-between;
  181. .left {
  182. display: flex;
  183. flex-direction: column;
  184. view:first-child {
  185. font-size: 34rpx;
  186. color: #000;
  187. padding-bottom: 10rpx;
  188. }
  189. view:last-child {
  190. font-size: 26rpx;
  191. color: #666666;
  192. }
  193. }
  194. .right {
  195. padding-right: 20rpx;
  196. color: #666666;
  197. display: flex;
  198. justify-content: center;
  199. align-items: center;
  200. text-align: center;
  201. }
  202. }
  203. .card {
  204. background-color: #FFFFFF;
  205. .area-padding {
  206. padding: 40rpx 0 20rpx;
  207. }
  208. .text-area{
  209. display: flex;
  210. justify-content: flex-start;
  211. align-items: center;
  212. }
  213. .area1 {
  214. padding-left: 30rpx;
  215. width: 55%;
  216. view:first-child {
  217. display: flex;
  218. image {
  219. width: 80rpx;
  220. height: 80rpx
  221. }
  222. view {
  223. padding-left: 15rpx;
  224. padding-bottom: 5rpx;
  225. display: flex;
  226. flex-direction: column;
  227. text:first-child {
  228. font-size: 32rpx;
  229. padding-bottom: 10rpx;
  230. color: #000;
  231. }
  232. text:last-child {
  233. font-size: 22rpx;
  234. color: #888888;
  235. }
  236. }
  237. }
  238. }
  239. .area2 {
  240. width: 25%;
  241. }
  242. .area3 {
  243. width: 20%;
  244. }
  245. .item-padding {
  246. padding: 20rpx 0;
  247. }
  248. .item {
  249. padding: 5rpx;
  250. display: flex;
  251. border-bottom: 1rpx solid #DDDDDD;
  252. }
  253. .item:last-child{
  254. border: none;
  255. }
  256. }
  257. </style>