import {getMyPoint} from '@/api/points'
const other = {
    state: {
       myPoint:{
           totalPoints:'',  //总数
           earnedPoints:'',  //本月新获取积分
           expirePoints:'',  //本月即将到期的积分
           completedTask:'',  //已完成的任务
           pendingTasks:''   //待完成的任务
       }
    },
    mutations: {
        SET_POINTINFO: (state, payload) => {
            state.myPoint = payload;
        },
    },
    actions: {
        // 获取积分信息
        async getPointsInfo({ commit }) {
            try {
                const res = await getMyPoint({
                    cityCode:uni.getStorageSync('selectCitycode'),
                });
                if (res && res.data) {
                    commit('SET_POINTINFO', res.data.data);
                }
            } catch (error) {
                console.error('获取积分信息失败:', error);
            }
        },
    }
}

export default other;
