score.vue 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376
  1. <!-- 我的数字权益 -->
  2. <template>
  3. <s-layout class="wallet-wrap" :bgStyle="{'backgroundColor':'#ffffff'}" title="我的数字权益" navbar="normal">
  4. {{pointsPercentage}} {{percentageColor}}
  5. <view class="score-box bg-white ss-flex-col ss-row-center ss-col-center">
  6. <view class="ss-m-b-10 circle value-box ss-flex ss-row-center" >
  7. <view class="all-title">数字<br>权益</view>
  8. </view>
  9. <view class="ss-m-b-30 ss-font-40" style="color:#fe0000;">
  10. <text class="all-title ss-m-r-8">{{ points2point(userWallet.integralDO.currentQuota) }}</text>
  11. </view>
  12. <view class="ss-m-b-40">
  13. <view class="all-title ss-m-r-8">
  14. <!-- @tap="sheep.$router.go('/pages/user/wallet/scoreToMoney')" -->
  15. <button class="btn ss-reset-button ui-Shadow-Main" @tap="sheep.$helper.toast('功能待开放')">
  16. 兑换
  17. </button>
  18. </view>
  19. </view>
  20. <!-- 分割线 -->
  21. <view style="width: 100%;height: 20rpx;background-color: #ececec;"></view>
  22. <uni-list :border="false" class="ss-p-t-10 ss-w-100">
  23. <uni-list-item clickable @tap="sheep.$router.go('/pages/user/wallet/maxScoreLog', {isFreeze: true})"
  24. title="当前可获得峰值" showArrow :border="false">
  25. <template v-slot:body>
  26. <p style="width: 100%">
  27. 当前可获得峰值:{{ points2point(userWallet.integralDO.currentQuota) }}/{{ points2point(userWallet.integralDO.highQuota) }}
  28. </p>
  29. </template>
  30. </uni-list-item>
  31. <uni-list-item clickable @tap="sheep.$router.go('/pages/user/wallet/ScoreLog', {isFreeze: true})"
  32. title="待确权" showArrow :border="false">
  33. <template v-slot:body>
  34. <p style="width: 100%">待确权:{{points2point(userWallet.integralDO.freezeQuota)}}</p>
  35. </template>
  36. </uni-list-item>
  37. <uni-list-item clickable @tap="sheep.$router.go('/pages/user/wallet/ScoreLog',{isFreeze: false})"
  38. title="数字权益来源记录" showArrow :border="false">
  39. <template v-slot:body>
  40. <p style="width: 100%">数字权益来源记录</p>
  41. </template>
  42. </uni-list-item>
  43. <uni-list-item clickable @tap="state.showModel = true" title="数字权益计算规则" :border="false">
  44. <template v-slot:body>
  45. <p style="width: 100%">数字权益计算规则</p>
  46. </template>
  47. </uni-list-item>
  48. </uni-list>
  49. </view>
  50. <!-- 数字权益计算规则 -->
  51. <su-popup :show="state.showModel" type="center" round="10" :isMaskClick="false" showClose @close="close">
  52. <view class="head-nav">
  53. <view :class="state.navIndex==0?'activite':''" class="ss-m-l-20" @click="checkIndex(0)">
  54. 数字权益计算规则
  55. </view>
  56. </view>
  57. <scroll-view class="scroll-view_H" scroll-y="true">
  58. <richtext title="数字权益计算规则" type='tab' />
  59. </scroll-view>
  60. </su-popup>
  61. </s-layout>
  62. </template>
  63. <script setup>
  64. import sheep from '@/sheep';
  65. import {
  66. onLoad,
  67. onReachBottom
  68. } from '@dcloudio/uni-app';
  69. import {
  70. computed,
  71. reactive
  72. } from 'vue';
  73. import {
  74. points2point
  75. } from '@/sheep/hooks/useGoods';
  76. import _ from 'lodash';
  77. import dayjs from 'dayjs';
  78. import PointApi from '@/sheep/api/member/point';
  79. import {
  80. resetPagination
  81. } from '@/sheep/util';
  82. import ScoreApi from '@/sheep/api/distri/score';
  83. import ScoreLog from './ScoreLog'
  84. import richtext from '@/pages/public/richtext'
  85. const userWallet = computed(() => sheep.$store('user').userWallet);
  86. const statusBarHeight = sheep.$platform.device.statusBarHeight * 2;
  87. const userInfo = computed(() => sheep.$store('user').userInfo);
  88. const sys_navBar = sheep.$platform.navbar;
  89. const state = reactive({
  90. currentTab: 0,
  91. pagination: {
  92. list: [],
  93. total: 0,
  94. pageSize: 10,
  95. pageNo: 1,
  96. },
  97. loadStatus: '',
  98. showModel: false,
  99. });
  100. function close() {
  101. state.showModel = false;
  102. }
  103. const pointsPercentage = computed(() => {
  104. const currentQuota = points2point(userWallet.value.integralDO.currentQuota)
  105. const highQuota = points2point(userWallet.value.integralDO.highQuota)
  106. if (currentQuota > highQuota) {
  107. return 100;
  108. } else {
  109. return Math.floor((currentQuota / highQuota) * 100)
  110. }
  111. });
  112. const percentageColor = computed(() => {
  113. if (percentageColor>=90) {
  114. return '#fe0000';
  115. } else if(percentageColor>=75){
  116. return '#d8b800';
  117. } else {
  118. return '#0c912f';
  119. }
  120. });
  121. async function getLogList(isFreeze) {
  122. state.loadStatus = 'loading';
  123. // isFreeze为true是冻结数字权益 isFreeze为false是已拿到的数字权益
  124. let {
  125. code,
  126. data
  127. } = await ScoreApi.getScoreApi({
  128. pageNo: state.pagination.pageNo,
  129. pageSize: state.pagination.pageSize,
  130. isFreeze: isFreeze
  131. });
  132. if (code !== 0) {
  133. return;
  134. }
  135. let list = _.concat(state.pagination.list, data.list);
  136. state.pagination.list = list;
  137. state.pagination.total = data.total;
  138. state.loadStatus = state.pagination.list.length < state.pagination.total ? 'more' : 'noMore';
  139. }
  140. function onLoadMore(isFreeze) {
  141. if (state.loadStatus === 'noMore') {
  142. return;
  143. }
  144. state.pagination.pageNo++;
  145. getLogList(isFreeze);
  146. }
  147. onReachBottom(() => {
  148. onLoadMore();
  149. });
  150. </script>
  151. <style lang="scss" scoped>
  152. .circle {
  153. position: relative;
  154. width: 100px;
  155. height: 100px;
  156. border-radius: 50%;
  157. }
  158. .circle::before {
  159. content: '';
  160. position: absolute;
  161. top: 10px;
  162. left: 10px;
  163. right: 10px;
  164. bottom: 10px;
  165. border-radius: 50%;
  166. background-color: #fff;
  167. }
  168. .circle view {
  169. position: absolute;
  170. top: 50%;
  171. left: 50%;
  172. transform: translate(-50%, -50%);
  173. font-size: 14px;
  174. font-weight: bold;
  175. }
  176. .scroll-view_H {
  177. width: 600rpx;
  178. height: 700rpx;
  179. padding: 20rpx;
  180. }
  181. .head-nav {
  182. margin: 20rpx auto;
  183. display: flex;
  184. align-items: center;
  185. box-sizing: border-box;
  186. color: rgb(14, 147, 46);
  187. }
  188. .head-nav>view {
  189. padding-bottom: 10rpx;
  190. border-bottom: 4rpx solid rgb(14, 147, 46);
  191. }
  192. .uni-list-item {
  193. margin: 0 20rpx;
  194. padding: 10rpx 0;
  195. border-bottom: 1px solid #d8d8d9;
  196. }
  197. .color-red {
  198. color: red;
  199. }
  200. .color-green {
  201. color: green;
  202. }
  203. .score-box {
  204. // margin: 20rpx;
  205. border-radius: 20rpx;
  206. padding-top: 100rpx;
  207. }
  208. .avatar-box {
  209. width: 100rpx;
  210. height: 100rpx;
  211. border-radius: 50%;
  212. overflow: hidden;
  213. .avatar-img {
  214. width: 100%;
  215. height: 100%;
  216. }
  217. }
  218. .value-box {
  219. width: 120rpx;
  220. height: 120rpx;
  221. // line-height: 100rpx;
  222. text-align: center;
  223. border-radius: 50%;
  224. // border: 8px solid #fe0000;
  225. font-weight: bold;
  226. }
  227. .btn {
  228. width: 250rpx;
  229. background: linear-gradient(90deg, var(--ui-BG-Main), var(--ui-BG-Main-gradient));
  230. border-radius: 20rpx;
  231. font-size: 30rpx;
  232. font-weight: 500;
  233. line-height: 80rpx;
  234. color: $white;
  235. position: relative;
  236. z-index: 1;
  237. }
  238. .header-box {
  239. width: 100%;
  240. background: linear-gradient(180deg, var(--ui-BG-Main) 0%, var(--ui-BG-Main-gradient) 100%) no-repeat;
  241. background-size: 750rpx 100%;
  242. padding: 0 0 120rpx 0;
  243. box-sizing: border-box;
  244. .score-box {
  245. height: 100%;
  246. .all-num {
  247. font-size: 50rpx;
  248. font-weight: bold;
  249. color: #fff;
  250. font-family: OPPOSANS;
  251. }
  252. .all-title {
  253. font-size: 26rpx;
  254. font-weight: 500;
  255. color: #fff;
  256. }
  257. .cicon-help-o {
  258. color: #fff;
  259. font-size: 28rpx;
  260. }
  261. }
  262. }
  263. // 筛选
  264. .filter-box {
  265. height: 114rpx;
  266. background-color: $bg-page;
  267. .total-box {
  268. font-size: 24rpx;
  269. font-weight: 500;
  270. color: $dark-9;
  271. }
  272. .date-btn {
  273. background-color: $white;
  274. line-height: 54rpx;
  275. border-radius: 27rpx;
  276. padding: 0 20rpx;
  277. font-size: 24rpx;
  278. font-weight: 500;
  279. color: $dark-6;
  280. .ss-seldate-icon {
  281. font-size: 50rpx;
  282. color: $dark-9;
  283. }
  284. }
  285. }
  286. .model-box {
  287. height: 50vh;
  288. }
  289. .list-box {
  290. width: 500rpx;
  291. padding: 0 30rpx;
  292. overflow-y: auto;
  293. .list-item {
  294. background: #fff;
  295. // border-bottom: 1rpx solid #dfdfdf;
  296. padding: 30rpx;
  297. .name {
  298. font-size: 28rpx;
  299. font-weight: 500;
  300. color: rgba(102, 102, 102, 1);
  301. line-height: 28rpx;
  302. // margin-bottom: 20rpx;
  303. }
  304. .time {
  305. font-size: 24rpx;
  306. font-weight: 500;
  307. color: rgba(196, 196, 196, 1);
  308. line-height: 24px;
  309. }
  310. .add {
  311. font-size: 30rpx;
  312. font-weight: 500;
  313. color: #e6b873;
  314. }
  315. .minus {
  316. font-size: 30rpx;
  317. font-weight: 500;
  318. color: $dark-3;
  319. }
  320. }
  321. }
  322. </style>