|
@@ -6,7 +6,7 @@
|
|
|
<span style="font-size: 14px; color: var(--color-666); line-height: 24px; cursor: pointer;" class="ml-2" @click="integralRulesClick">{{ $t('points.integralRules') }}</span>
|
|
|
</div>
|
|
|
<div class="d-flex justify-space-between align-end my-1">
|
|
|
- <span style="font-size: 42px; color: #10897bba; line-height: 50px;" class="ml-10 cursor-pointer" @click="integralDetails">{{ integral }}</span>
|
|
|
+ <span style="font-size: 42px; color: #10897bba; line-height: 50px;" class="ml-10 cursor-pointer" @click="integralDetails">{{ accountData?.point || 0 }}</span>
|
|
|
<span style="font-size: 16px; color: #787d82; line-height: 24px;" class="mr-8">
|
|
|
<!-- 积分商城 -->
|
|
|
<template v-if="props.showMall">
|
|
@@ -26,8 +26,8 @@
|
|
|
<script setup>
|
|
|
defineOptions({name: 'myRegistration-integralShow'})
|
|
|
import { ref } from 'vue'
|
|
|
+import { useUserStore } from '@/store/user'
|
|
|
import { useRouter } from 'vue-router'; const router = useRouter()
|
|
|
-import { getUserRewardPoint } from '@/api/integral'
|
|
|
|
|
|
const props = defineProps({
|
|
|
title: {
|
|
@@ -48,15 +48,14 @@ const props = defineProps({
|
|
|
default: false
|
|
|
}
|
|
|
})
|
|
|
-const integral = ref(0)
|
|
|
|
|
|
-// 积分数
|
|
|
-const getIntegral = async () => {
|
|
|
- const data = await getUserRewardPoint()
|
|
|
- if (!data) return
|
|
|
- integral.value = data
|
|
|
-}
|
|
|
-getIntegral()
|
|
|
+const userStore = useUserStore()
|
|
|
+const key = props.isEnterprise ? 'enterpriseUserAccount' : 'userAccount'
|
|
|
+let accountData = ref(JSON.parse(localStorage.getItem(key)) || {})
|
|
|
+
|
|
|
+userStore.$subscribe((mutation, state) => {
|
|
|
+ if (Object.keys(state[key]).length) accountData.value = state[key]
|
|
|
+})
|
|
|
|
|
|
// 积分规则
|
|
|
const integralRulesClick = () => {
|
|
@@ -71,10 +70,6 @@ const handleClickMall = () => {
|
|
|
const integralDetails = () => {
|
|
|
window.open(props.isEnterprise ? '/enterprise/memberCenter/myPoints' : '/integral/pointsManagement')
|
|
|
}
|
|
|
-
|
|
|
-defineExpose({
|
|
|
- getIntegral
|
|
|
-})
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|