score.vue 11 KB

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