score.vue 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355
  1. <!-- 我的积分 -->
  2. <template>
  3. <s-layout class="wallet-wrap" :bgStyle="{'backgroundColor':'#ffffff'}" title="我的积分" navbar="normal">
  4. <view class="score-box bg-white ss-flex-col ss-row-center ss-col-center">
  5. <view class="ss-m-b-40 value-box " @tap="state.showModel = true">
  6. <view class="all-title ss-m-r-8">#</view>
  7. </view>
  8. <view class="ss-m-b-40 ss-font-40">
  9. <text class="all-title ss-m-r-8">#{{ points2point(userWallet.integralDO.currentQuota) }}</text>
  10. </view>
  11. <view class="ss-m-b-40 ss-font-32 text-center">
  12. <view class="all-title ss-m-r-8 ss-m-b-10 ">当前可兑换积分:#{{ points2point(userWallet.integralDO.currentQuota) }}</view>
  13. <view class="all-title ss-m-r-8" style="color: var(--ui-BG-Main)" @tap="state.showQueModel = true">
  14. 待确权积分:#{{points2point(userWallet.integralDO.freezeQuota)}}</view>
  15. </view>
  16. <view class="ss-m-b-80">
  17. <view class="all-title ss-m-r-8 ss-m-b-10">可兑换积分得计算规则</view>
  18. <view class="all-title ss-m-r-8 text-center">[点击查看说明]</view>
  19. </view>
  20. <view class="ss-m-b-40">
  21. <view class="all-title ss-m-r-8">
  22. <button class="btn ss-reset-button ui-Shadow-Main" @tap="sheep.$router.go('/pages/user/wallet/scoreToMoney')">
  23. 兑换
  24. </button>
  25. </view>
  26. </view>
  27. <!-- <view class="ss-m-b-40">
  28. <view class="all-title ss-m-r-8">
  29. <button class="btn ss-reset-button ui-Shadow-Main">
  30. 代购NFR
  31. </button>
  32. </view>
  33. </view> -->
  34. </view>
  35. <!-- tab 统计 -->
  36. <!-- <su-sticky :customNavHeight="sys_navBar">
  37. <view class="filter-box ss-p-x-30 ss-flex ss-col-center ss-row-between">
  38. <uni-datetime-picker v-model="state.date" type="daterange" @change="onChangeTime" :end="state.today">
  39. <button class="ss-reset-button date-btn">
  40. <text>{{ dateFilterText }}</text>
  41. <text class="cicon-drop-down ss-seldate-icon"></text>
  42. </button>
  43. </uni-datetime-picker>
  44. </view>
  45. <su-tabs :list="tabMaps" @change="onChange" :scrollable="false" :current="state.currentTab"></su-tabs>
  46. </su-sticky> -->
  47. <!-- 积分来源 -->
  48. <su-popup :show="state.showModel" type="center" round="10" :isMaskClick="false" showClose @close="close">
  49. <view class="model-box ss-flex-col">
  50. <scroll-view class="list-box" scroll-y="true" @touchmove.stop>
  51. <view v-if="state.pagination.total > 0">
  52. <view class="list-item ss-flex ss-col-center"
  53. v-for="item in state.pagination.list" :key="item.id">
  54. <view class="name">{{ item.title }} : #{{ item.point}}</view>
  55. </view>
  56. </view>
  57. <s-empty v-else text="暂无数据" paddingTop="120" icon="/static/data-empty.png" />
  58. </scroll-view>
  59. </view>
  60. </su-popup>
  61. <!-- 积分确权 -->
  62. <su-popup :show="state.showQueModel" type="center" round="10" :isMaskClick="false" showClose @close="close">
  63. <view class="model-box ss-flex-col">
  64. <view class="all-title ss-p-x-30 ss-p-t-30" >
  65. 待确权积分 <text style="float: right;">共#{{points2point(userWallet.integralDO.freezeQuota)}}</text>
  66. </view>
  67. <scroll-view class="list-box" style="width: 600rpx;" scroll-y="true" @touchmove.stop>
  68. <view v-if="state.pagination.total > 0">
  69. <view class="list-item ss-flex ss-col-center ss-row-between "
  70. v-for="(item,index) in state.pagination.list" :key="item.id" style="padding: 30rpx 0;">
  71. <view class="ss-flex ss-col-center" style="width: 100%;">
  72. <view>
  73. {{index+1}}
  74. </view>
  75. <!-- 头像 -->
  76. <view class="avatar-box ss-m-x-20">
  77. <image class="avatar-img" :src="
  78. sheep.$url.static('/static/img/shop/default_avatar.png')" mode="aspectFill"></image>
  79. </view>
  80. <view class="ss-flex ss-m-t-10" style="flex-direction: column;align-items: flex-start;width: calc(100% - 5.5rem);">
  81. <view class="name" style="width: 100%;"> {{ item.name || '空' }} <text style="float: right;">#{{item.point}}</text></view>
  82. <view class="time " style="width: 100%;">{{sheep.$helper.timeFormat(item.createTime, 'yyyy-mm-dd hh:MM')}}
  83. <text style="float: right;">消费额:¥234</text></view>
  84. </view>
  85. </view>
  86. </view>
  87. </view>
  88. <s-empty v-else text="暂无数据" paddingTop="80" icon="/static/data-empty.png" />
  89. </scroll-view>
  90. </view>
  91. </su-popup>
  92. </s-layout>
  93. </template>
  94. <script setup>
  95. import sheep from '@/sheep';
  96. import {
  97. onLoad,
  98. onReachBottom
  99. } from '@dcloudio/uni-app';
  100. import {
  101. computed,
  102. reactive
  103. } from 'vue';
  104. import {
  105. points2point
  106. } from '@/sheep/hooks/useGoods';
  107. import _ from 'lodash';
  108. import dayjs from 'dayjs';
  109. import PointApi from '@/sheep/api/member/point';
  110. import {
  111. resetPagination
  112. } from '@/sheep/util';
  113. const userWallet = computed(() => sheep.$store('user').userWallet);
  114. const statusBarHeight = sheep.$platform.device.statusBarHeight * 2;
  115. const userInfo = computed(() => sheep.$store('user').userInfo);
  116. const sys_navBar = sheep.$platform.navbar;
  117. const state = reactive({
  118. currentTab: 0,
  119. pagination: {
  120. list: 0,
  121. total: 0,
  122. pageSize: 6,
  123. pageNo: 1,
  124. },
  125. loadStatus: '',
  126. date: [],
  127. today: '',
  128. showModel: false,
  129. showQueModel: false
  130. });
  131. const close = () => {
  132. state.showModel = false
  133. state.showQueModel = false
  134. }
  135. const tabMaps = [{
  136. name: '全部',
  137. value: 'all',
  138. },
  139. {
  140. name: '收入',
  141. value: 'true',
  142. },
  143. {
  144. name: '支出',
  145. value: 'false',
  146. },
  147. ];
  148. const dateFilterText = computed(() => {
  149. if (state.date[0] === state.date[1]) {
  150. return state.date[0];
  151. } else {
  152. return state.date.join('~');
  153. }
  154. });
  155. async function getLogList() {
  156. state.loadStatus = 'loading';
  157. let {
  158. code,
  159. data
  160. } = await PointApi.getPointRecordPage({
  161. pageNo: state.pagination.pageNo,
  162. pageSize: state.pagination.pageSize,
  163. addStatus: state.currentTab > 0 ? tabMaps[state.currentTab].value : undefined,
  164. 'createTime[0]': state.date[0] + ' 00:00:00',
  165. 'createTime[1]': state.date[1] + ' 23:59:59',
  166. });
  167. if (code !== 0) {
  168. return;
  169. }
  170. state.pagination.list = data.list;
  171. state.pagination.total = data.total;
  172. state.loadStatus = state.pagination.list.length < state.pagination.total ? 'more' : 'noMore';
  173. }
  174. onLoad(() => {
  175. state.today = dayjs().format('YYYY-MM-DD');
  176. state.date = [state.today, state.today];
  177. getLogList();
  178. });
  179. function onChange(e) {
  180. state.currentTab = e.index;
  181. resetPagination(state.pagination);
  182. getLogList();
  183. }
  184. function onChangeTime(e) {
  185. state.date[0] = e[0];
  186. state.date[1] = e[e.length - 1];
  187. resetPagination(state.pagination);
  188. getLogList();
  189. }
  190. function onLoadMore() {
  191. if (state.loadStatus === 'noMore') {
  192. return;
  193. }
  194. state.pagination.pageNo++;
  195. getLogList();
  196. }
  197. onReachBottom(() => {
  198. onLoadMore();
  199. });
  200. </script>
  201. <style lang="scss" scoped>
  202. .score-box {
  203. margin: 20rpx;
  204. border-radius: 20rpx;
  205. padding-top: 100rpx;
  206. }
  207. .avatar-box {
  208. width: 100rpx;
  209. height: 100rpx;
  210. border-radius: 50%;
  211. overflow: hidden;
  212. .avatar-img {
  213. width: 100%;
  214. height: 100%;
  215. }
  216. }
  217. .value-box {
  218. width: 100rpx;
  219. height: 100rpx;
  220. line-height: 100rpx;
  221. text-align: center;
  222. border-radius: 50%;
  223. border: 2px solid #f6f6f6;
  224. }
  225. .btn {
  226. width: 300rpx;
  227. background: linear-gradient(90deg, var(--ui-BG-Main), var(--ui-BG-Main-gradient));
  228. border-radius: 20rpx;
  229. font-size: 30rpx;
  230. font-weight: 500;
  231. line-height: 80rpx;
  232. color: $white;
  233. position: relative;
  234. z-index: 1;
  235. }
  236. .header-box {
  237. width: 100%;
  238. background: linear-gradient(180deg, var(--ui-BG-Main) 0%, var(--ui-BG-Main-gradient) 100%) no-repeat;
  239. background-size: 750rpx 100%;
  240. padding: 0 0 120rpx 0;
  241. box-sizing: border-box;
  242. .score-box {
  243. height: 100%;
  244. .all-num {
  245. font-size: 50rpx;
  246. font-weight: bold;
  247. color: #fff;
  248. font-family: OPPOSANS;
  249. }
  250. .all-title {
  251. font-size: 26rpx;
  252. font-weight: 500;
  253. color: #fff;
  254. }
  255. .cicon-help-o {
  256. color: #fff;
  257. font-size: 28rpx;
  258. }
  259. }
  260. }
  261. // 筛选
  262. .filter-box {
  263. height: 114rpx;
  264. background-color: $bg-page;
  265. .total-box {
  266. font-size: 24rpx;
  267. font-weight: 500;
  268. color: $dark-9;
  269. }
  270. .date-btn {
  271. background-color: $white;
  272. line-height: 54rpx;
  273. border-radius: 27rpx;
  274. padding: 0 20rpx;
  275. font-size: 24rpx;
  276. font-weight: 500;
  277. color: $dark-6;
  278. .ss-seldate-icon {
  279. font-size: 50rpx;
  280. color: $dark-9;
  281. }
  282. }
  283. }
  284. .list-box {
  285. width: 500rpx;
  286. height: 600rpx;
  287. padding:0 20rpx;
  288. overflow-y: auto;
  289. .list-item {
  290. background: #fff;
  291. // border-bottom: 1rpx solid #dfdfdf;
  292. padding: 30rpx;
  293. .name {
  294. font-size: 28rpx;
  295. font-weight: 500;
  296. color: rgba(102, 102, 102, 1);
  297. line-height: 28rpx;
  298. // margin-bottom: 20rpx;
  299. }
  300. .time {
  301. font-size: 24rpx;
  302. font-weight: 500;
  303. color: rgba(196, 196, 196, 1);
  304. line-height: 24px;
  305. }
  306. .add {
  307. font-size: 30rpx;
  308. font-weight: 500;
  309. color: #e6b873;
  310. }
  311. .minus {
  312. font-size: 30rpx;
  313. font-weight: 500;
  314. color: $dark-3;
  315. }
  316. }
  317. }
  318. </style>