全部
常见问题
产品动态
精选推荐

CRMEB 多门店v3.0会员等级经验问题

管理 管理 编辑 删除

1、前端需要修改:

路径:/pages/users/user_vip/index.vue

方便复制:

v-if="item.lack_exp_num==0"
item.lack_exp_num
progressValue(item, index) { 
let width = 100;
 let num = item.exp_num - parseFloat(item.lack_exp_num) 
width = (num / item.exp_num)*100
 return { 
'width': `${width}%`,
 'background-color': item.color, 
};
 },

8852b20240620113655918.png

d65db202406201137117241.png

2、后端需要修改:

方便复制:

public function getUserLevelInfo(int $uid)
    {
        $data = ['user' => [], 'level_info' => [], 'level_list' => [], 'task' => []];
        //商城会员是否开启
        if (!sys_config('member_func_status')) {
            return $data;
        }
        /** @var UserServices $userServices */
        $userServices = app()->make(UserServices::class);
        $user = $userServices->getUserInfo($uid);
        if (!$user) {
            throw new ValidateException('没有此会员');
        }
        /** @var StoreCouponUserServices $storeCoupon */
        $storeCoupon = app()->make(StoreCouponUserServices::class);
        $user['couponCount'] = $storeCoupon->getUserValidCouponCount((int)$uid);
        $data['user'] = $user;
        /** @var SystemUserLevelServices $systemUserLevel */
        $systemUserLevel = app()->make(SystemUserLevelServices::class);
        $levelList = $systemUserLevel->getList(['is_del' => 0, 'is_show' => 1]);
        $i = 0;
        foreach ($levelList as &$level) {
            $level['next_exp_num'] = $levelList[$i + 1]['exp_num'] ?? $level['exp_num'];
            $level['image'] = set_file_url($level['image']);
            $level['icon'] = set_file_url($level['icon']);
            $i++;
        }
        $data['level_list'] = $levelList;
        $levelInfo = $this->getUerLevelInfoByUid($uid);
        if (!$levelInfo) {//不存在等级 展示最低等级
            /** @var SystemUserLevelServices $systemUserLevel */
            $systemUserLevel = app()->make(SystemUserLevelServices::class);
            $alllevelInfo = $systemUserLevel->getList([['is_del', '=', 0], ['is_show', '=', 1]], 'id,name,icon,grade', 1, 1);
            $levelInfo = $alllevelInfo[0] ?? [];
            if ($levelInfo) {
                $levelInfo['id'] = 0;
            }
        }
        if ($levelInfo) {
            $levelInfo['vip'] = true;
            $levelInfo['vip_id'] = $levelInfo['id'];
            $levelInfo['vip_icon'] = $levelInfo['icon'];
            $levelInfo['vip_name'] = $levelInfo['name'];
        }
        $data['level_info'] = $levelInfo;
        $i = 0;
        foreach ($levelList as &$level) {
            if ($level['grade'] < $levelInfo['grade']) {
                $level['next_exp_num'] = $levelList[$i + 1]['exp_num'] ?? $level['exp_num'];
                $level['lack_exp_num'] = 0;
            } else {
                $level['next_exp_num'] = $level['exp_num'];
                if ($user['exp'] > $level['exp_num']) {
                    $level['lack_exp_num'] = 0;
                } else {
                    $level['lack_exp_num'] = bcsub((string)$level['exp_num'], (string)$user['exp'], 0);
                }
            }


            $level['image'] = set_file_url($level['image']);
            $level['icon'] = set_file_url($level['icon']);
            $i++;
        }
        $data['level_list'] = $levelList;


        $data['level_info']['exp'] = $user['exp'] ?? 0;


        /** @var UserBillServices $userBillservices */
        $userBillservices = app()->make(UserBillServices::class);
        $data['level_info']['today_exp'] = $userBillservices->getExpSum($uid, 'today');
        $task = [];
        /** @var UserSignServices $userSignServices */
        $userSignServices = app()->make(UserSignServices::class);
        $task['sign_count'] = $userSignServices->getSignSumDay($uid);
        $config = SystemConfigService::more(['sign_give_exp', 'order_give_exp', 'invite_user_exp']);
        $task['sign'] = $config['sign_give_exp'] ?? 0;
        $task['order'] = $config['order_give_exp'] ?? 0;
        $task['invite'] = $config['invite_user_exp'] ?? 0;
        $data['task'] = $task;


        //检测升级
        UserLevelJob::dispatch([$uid]);
        return $data;
    }

d484f202406201532302948.png

eaad0202406201138055361.png

3、改完前端需要重新打包小程序、h5,后端要重启swoole

请登录后查看

小小 最后编辑于2024-06-20 15:32:57

快捷回复
回复
回复
回复({{post_count}}) {{!is_user ? '我的回复' :'全部回复'}}
排序 默认正序 回复倒序 点赞倒序

{{item.user_info.nickname ? item.user_info.nickname : item.user_name}} LV.{{ item.user_info.bbs_level }}

作者 管理员 企业

{{item.floor}}# 同步到gitee 已同步到gitee {{item.is_suggest == 1? '取消推荐': '推荐'}}
{{item.is_suggest == 1? '取消推荐': '推荐'}}
沙发 板凳 地板 {{item.floor}}#
{{item.user_info.title || '暂无简介'}}
附件

{{itemf.name}}

{{item.created_at}}  {{item.ip_address}}
{{item.like_count}}
{{item.showReply ? '取消回复' : '回复'}}
删除
回复
回复

{{itemc.user_info.nickname}}

{{itemc.user_name}}

回复 {{itemc.comment_user_info.nickname}}

附件

{{itemf.name}}

{{itemc.created_at}}
{{itemc.like_count}}
{{itemc.showReply ? '取消回复' : '回复'}}
删除
回复
回复
查看更多
1370
{{like_count}}
{{collect_count}}
添加回复 ({{post_count}})

相关推荐

快速安全登录

使用微信扫码登录
{{item.label}} 加精
{{item.label}} {{item.label}} 板块推荐 常见问题 产品动态 精选推荐 首页头条 首页动态 首页推荐
取 消 确 定
回复
回复
问题:
问题自动获取的帖子内容,不准确时需要手动修改. [获取答案]
答案:
提交
bug 需求 取 消 确 定

微信登录/注册

切换手机号登录

{{ bind_phone ? '绑定手机' : '手机登录'}}

{{codeText}}
切换微信登录/注册
暂不绑定
CRMEB客服

CRMEB咨询热线 咨询热线

400-8888-794

微信扫码咨询

CRMEB开源商城下载 源码下载 CRMEB帮助文档 帮助文档
返回顶部 返回顶部
CRMEB客服