progressiveIntegral.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. <!-- 进步积分 -->
  2. <template>
  3. <view class="integral">
  4. <z-paging ref="paging" v-model="integralList" @query="queryList">
  5. <!-- 导航栏 -->
  6. <u-navbar class="evaluate-intention-bar" back-text="" title="进步积分" :background="background"
  7. title-color="#fff" back-icon-color="#fff" slot="top">
  8. </u-navbar>
  9. <!-- 背景 -->
  10. <view class="integral-bg" slot="top"></view>
  11. <!-- 内容 -->
  12. <view class="integral-content" style="margin-top: -472rpx;" slot="top">
  13. <view class="integral-content-header">
  14. <view class="integral-content-header-grade">{{ totalCount }}</view>
  15. <view class="integral-content-header-point">
  16. <view class="point">
  17. <view></view>
  18. </view>
  19. <view>累计获得积分</view>
  20. <view class="point">
  21. <view></view>
  22. </view>
  23. </view>
  24. <view class="integral-content-header-rules" @click="jumpPage('/pages/integralRule/integralRule')">
  25. 积分规则
  26. <u-icon name="arrow-right" />
  27. </view>
  28. <view class="integral-content-header-behavior">
  29. <view class="item" v-for="(item, index) in behaviorList" :key="index">
  30. {{ item.count }}<text>个{{ item.type == 1 ? '加' : '减' }}分行为</text></view>
  31. <!-- <view class="item">0<text>个减分行为</text></view> -->
  32. </view>
  33. </view>
  34. </view>
  35. <view class="integral-content" slot="top">
  36. <view class="integral-content-first">
  37. <view class="integral-content-first-header">获得进步积分可以</view>
  38. <view class="integral-content-first-box">
  39. <view class="integral-content-first-item">
  40. <image src="../../static/img/priority-recommendation-icon.png" mode=""></image>
  41. <view>优先推荐</view>
  42. </view>
  43. <view class="integral-content-first-item">
  44. <image src="../../static/img/priority-shift-icon.png" mode=""></image>
  45. <view>优先分班</view>
  46. </view>
  47. <view class="integral-content-first-item">
  48. <image src="../../static/img/priority-feedback-icon.png" mode=""></image>
  49. <view>优先反馈</view>
  50. </view>
  51. </view>
  52. </view>
  53. </view>
  54. <view class="integral-content" v-if="integralList.length">
  55. <view class="integral-content-list">
  56. <view class="integral-content-list-item" v-for="(item, index) in integralList" :key="index">
  57. <view class="left">
  58. <view>{{ item.remark }}</view>
  59. <view>{{ item.createTime }}</view>
  60. </view>
  61. <view class="right">
  62. <view v-if="item.type === 1">+{{ item.integral }}</view>
  63. <view v-else class="reduce">{{ item.integral }}</view>
  64. </view>
  65. </view>
  66. </view>
  67. <!-- <view class="integral-content-list" v-else>
  68. <u-empty mode="list"></u-empty>
  69. </view> -->
  70. </view>
  71. </z-paging>
  72. <u-toast ref="uToast" />
  73. </view>
  74. </template>
  75. <script>
  76. export default {
  77. data() {
  78. return {
  79. background: {
  80. backgroundColor: '#FE7C0F'
  81. },
  82. // 积分列表
  83. integralList: [],
  84. // 积分行为
  85. behaviorList: [],
  86. // 总分
  87. totalCount: 0
  88. }
  89. },
  90. onLoad() {
  91. this.getIntegralTotal();
  92. },
  93. methods: {
  94. /**
  95. * @param { Number } pageNum
  96. * @param { Number } pageSize
  97. */
  98. queryList(pageNum, pageSize) {
  99. this.getintegralList(pageNum, pageSize);
  100. },
  101. /**
  102. * 获取积分统计情况
  103. */
  104. getIntegralTotal() {
  105. this.$u.api.mine.totalCount().then(res => {
  106. if (res.code === 200) {
  107. let list = []
  108. res.data.forEach(item => {
  109. if (item.type == 0) {
  110. const obj = {
  111. type: 1, count: 0, total: 0
  112. }
  113. if (res.data.length == 1) {
  114. list.push(obj)
  115. }
  116. } else if (item.type == 1) {
  117. const obj = {
  118. type: 0, count: 0, total: 0
  119. }
  120. if (res.data.length == 1) {
  121. list.push(obj)
  122. }
  123. }
  124. });
  125. if (list.length == 1) {
  126. list = list.concat(res.data)
  127. }
  128. this.behaviorList = list
  129. // 计算总分
  130. let total = 0
  131. this.totalCount = res.data.reduce((total, item) => total + item.total, 0)
  132. } else {
  133. this.$refs.uToast.show({
  134. title: res.msg,
  135. type: 'error'
  136. })
  137. }
  138. }).catch(() => {
  139. this.$refs.uToast.show({
  140. title: '系统错误!',
  141. type: 'error'
  142. })
  143. })
  144. },
  145. /**
  146. * 积分列表
  147. */
  148. getintegralList(pageNum, pageSize) {
  149. this.$u.api.mine.integralList({
  150. pageNum,
  151. pageSize
  152. }).then(res => {
  153. if (res.code === 200) {
  154. this.$refs.paging.complete(res.rows);
  155. } else {
  156. this.$refs.paging.complete([]);
  157. this.$refs.uToast.show({
  158. title: res.msg,
  159. type: 'error'
  160. })
  161. }
  162. }).catch(() => {
  163. this.$refs.uToast.show({
  164. title: '系统错误!',
  165. type: 'error'
  166. })
  167. })
  168. },
  169. /**
  170. * @param { String } url
  171. */
  172. jumpPage(url) {
  173. this.$u.route(url)
  174. }
  175. }
  176. }
  177. </script>
  178. <style lang="scss" scoped>
  179. @import './progressiveIntegral.scss';
  180. </style>