This commit is contained in:
xiaoyu
2023-07-31 17:13:00 +08:00
parent e0817bf577
commit 7448041e95
5 changed files with 104 additions and 36 deletions
@@ -174,6 +174,7 @@ class Admin extends Common{
const WX_SESSION = "market_wx_info";
public function __construct(){
parent::__construct();
//print_r($this->session);
}
public function _remap($method){
@@ -54,14 +54,17 @@ class Stic extends Admin
$info['group_name'] = implode(' ', array_column($group_lists, 'groupsName'));
$groups = $this->groups_model->get(['groupsId' => $groupsId]);
$info['biz_id'] = $groups['ifBiz'] ? $groups['groupsId'] : 0;
$info['organizationId'] = $groups['originalBizId'];
}
$info['groupsId'] = $groupsId ? $groupsId : $group_user['groupsId'];
$info['tab'] = 1;
if (time() >= strtotime($row['timeStart']) && $this->a_id != 11) {
$info['tab'] = 2;
}
$info['aId'] = $this->a_id;
$this->data['info'] = $info;
//微信分享
$wx_info = $this->share_info($row);
$this->data['sign_package'] = $wx_info['sign_package'];
+71 -32
View File
@@ -16,12 +16,15 @@ class User extends Admin
public function index()
{
!$this->biz_id && $this->biz_id = intval($this->input->get('organizationId'));
$row = $this->market_sylive_organization_model->get(['organizationId' => $this->user['topOrgId']]);
$biz_row = $this->market_sylive_organization_model->get(['organizationId' => $this->biz_id]);
$headimg = $row['logo'] ? build_qiniu_image_url($row['logo']) : Sylive_entity::HD_IMG;
$this->data['headimg'] = $headimg;
$this->data['biz_name'] = $biz_row['organizationName'];
$this->data['biz_id'] = $this->biz_id;
$this->data['is_manager'] = (!$this->user['bizId'] && $this->user['topOrgId']) ? 1 : 0;
//微信分享
$wx_info = $this->share_info();
$this->data['sign_package'] = $wx_info['sign_package'];
@@ -31,19 +34,21 @@ class User extends Admin
public function lists()
{
$keyWord = $this->input->get('keyWord');
$biz_id = intval($this->input->get('biz_id'));
$page = intval($this->input->get('page'));
$size = intval($this->input->get('size'));
!$page && $page = 1;
!$size && $size = 10;
$where = [
'status<>' => -1,
"organizationId in (select organizationId from lc_market_sylive_organization where parentId={$this->biz_id})" => null
'bizId' => $biz_id
];
$keyWord && $where["uname like '%{$keyWord}%'"] = null;
$total = $this->user_model->count($where);
$lists = [];
if ($total) {
$res = $this->user_model->select($where, 'userId desc', $page, $size, 'userId,mobile,uname,nickname,headimg,status');
$res = $this->user_model->select($where, 'userId desc', $page, $size, 'userId,mobile,uname,nickname,headimg,organizationId,bizId,status');
foreach ($res as $val) {
$temp = [
'userId' => $val['userId'],
@@ -51,7 +56,8 @@ class User extends Admin
'uname' => $val['uname'],
'mobile' => $val['mobile'],
'wxuname' => $val['nickname'],
'wxheadimg' => $val['headimg']
'wxheadimg' => $val['headimg'],
'shop_manager' => $val['organizationId'] == $val['bizId'] ? 1 : 0
];
$lists[] = $temp;
}
@@ -63,59 +69,63 @@ class User extends Admin
public function add()
{
$biz_id = $this->input->post('biz_id');
$uname = $this->input->post('uname');
$mobile = $this->input->post('mobile');
$type = $this->input->post('type');
if (!$uname) {
$this->show_json('', 400, '请输入顾问姓名');
}
if (!mobile_valid($mobile)) {
$this->show_json('', 400, '请输入正确手机号');
}
$re_org = $this->market_sylive_organization_model->get(['parentId' => $this->biz_id, 'organizationType' => 4
, 'status' => 0]);
if (!$re_org) {
$this->show_json('', 400, '门店未添加顾问类型,请联系管理员');
if($type == 1) {
$re_org = $this->market_sylive_organization_model->get(['parentId' => $biz_id, 'organizationType' => 3, 'status' => 0]);
if (!$re_org) {
$this->show_json('', 400, '门店未添加店长类型,请联系管理员');
}
}
else{
$type = 0;
$re_org = $this->market_sylive_organization_model->get(['parentId' => $biz_id, 'organizationType' => 4, 'status' => 0]);
if (!$re_org) {
$this->show_json('', 400, '门店未添加顾问类型,请联系管理员');
}
}
$organizationId = $re_org['organizationId'];
$topOrgId = $this->user['topOrgId'];
$re = $this->user_model->get(['mobile' => $mobile, 'topOrgId' => $topOrgId]);
if ($re && $re['status'] != -1) {
$this->show_json('', 400, '手机号已存在');
}
$addDate = ['topOrgId' => $topOrgId, 'organizationId' => $organizationId, 'bizId' => $this->biz_id,
'uname' => $uname, 'status' => 0, 'teamId' => 0];
$addDate['mobile'] = $mobile;
$addDate['createTime'] = date('Y-m-d H:i:s');
$id = $this->user_model->add($addDate);
$addData = ['topOrgId' => $topOrgId, 'organizationId' => $organizationId, 'bizId' => $biz_id, 'uname' => $uname, 'status' => 0, 'teamId' => 0];
$addData['mobile'] = $mobile;
$addData['createTime'] = date('Y-m-d H:i:s');
$id = $this->user_model->add($addData);
if (!$id) {
$this->show_json('', 400, '添加用户失败');
}
//所有分组添加顾问
$filed = 'activityId,groupsId,bizId,levelId1,levelId2,levelId3,userFrom';
$day = date('Y-m-d H:i:s');
$where = [
'userId' => $this->uid,
'status > -1' => null,
'type' => 1,
'originalBizId' => $biz_id,
'status >' => -1,
"activityId in (select activityId from lc_market_sylive_activity where timeEnd>'{$day}' and status > -1)" => null
];
$admin_lists = $this->groups_user_model->select($where,'groupsUserId desc',0,0,$filed);
if($admin_lists){
foreach ($admin_lists as $key => $val) {
$add_data[] = [
'activityId' => $val['activityId'],
'groupsId' => $val['groupsId'],
'bizId' => $val['bizId'],
'levelId1' => $val['levelId1'],
'levelId2' => $val['levelId2'],
'levelId3' => $val['levelId3'],
'userFrom' => $val['userFrom'],
'userId' => $id,
'createTime' => date('Y-m-d H:i:s')
];
}
$this->groups_user_model->add_batch($add_data);
$group = $this->groups_model->get($where);
if($group)
{
$levelAry = $this->getLevelAry($group['groupsId']);
$value = ['userId' => $id, 'activityId' => $group['activityId'], 'groupsId' => $group['groupsId'], 'type' => $type, 'createTime' => date('Y-m-d H:i:s')];
$data = array_merge($value, $levelAry);
$this->groups_user_model->add($data);
}
$this->show_json('', 200, '操作成功');
}
@@ -175,4 +185,33 @@ class User extends Admin
}
$this->show_json('', 200, '操作成功');
}
/**
* Notes:获取分组等级ID
* Created on: 2022/11/30 14:30
* Created by: dengbw
* @param $groupsId
* @param array $data
* @return array
*/
private function getLevelAry($groupsId, $data = [])
{
$re = $this->groups_model->get(['groupsId' => $groupsId], 'groupsId,parentId,groupsLevel,ifBiz');
if (!$re) {
return $data;
} else {
if ($re['groupsLevel']) {//分类id
$levelId = "levelId" . $re['groupsLevel'];
$data[$levelId] = $re['groupsId'];
}
if ($re['ifBiz']) {//门店id
$data['bizId'] = $re['groupsId'];
}
if ($re['parentId']) {
return $this->getLevelAry($re['parentId'], $data);
} else {
return $data;
}
}
}
}
@@ -6,6 +6,16 @@
<div class="bg-eee-fff">
<div class="inner20">
<div class="relative pl50 pr200 bg-333 ulib-r750">
<?if(!$is_biz && $info['biz_id'] == $info['groupsId']){?>
<a class="bottom-opt bg-1a1a1a ulib-r750 text-center color-fff" href="/h5/market/sylive2/user?organizationId=<?=$info['organizationId']?>">
<div class="absolute box-center-middle line-height-13 font-22">
<div>顾问</div>
<div>管理</div>
</div>
</a>
<?}?>
<img class='block absolute left-0 box-middle ml10 imgsize-32X32 ulib-r750' :src='info.headimg' />
<div class="pt15 pb15 text-nowrap font-22 color-ddd">
<span class="color-fff">{{info.nickname}}·</span>
+19 -4
View File
@@ -20,7 +20,11 @@
<!--顾问列表-->
<div class="relative mb30 bg-f9 pt20 pb20 pl30 pr200 ulib-r20" v-for="(item,index) in list">
<div>
<div class="font-28">{{item.uname}}·{{item.mobile}}</div>
<div class="font-28">{{item.uname}}·{{item.mobile}}
<span class="mt10 font-22 color-999" v-if="item.shop_manager">
<span style="vertical-align:0.3vw"> 管理员</span>
</span>
</div>
<div class="mt10 font-22 color-999" v-if="item.wxuname">
<img class="text-middle imgsize-30X30 ulib-r750" :src="item.wxheadimg" alt="#"/>
<span class="text-middle">{{item.wxuname}}</span>
@@ -29,13 +33,15 @@
</div>
<div class="absolute box-middle right-0 mr30 space-nowrap font-26">
<a class="text-middle" href="javascript:void(0);" v-if="!item.wxuname" @click="showForm(index)">修改</a>
<? if($is_manager){ ?>
<span class="text-middle font-22 pl5 pr5" v-if="!item.wxuname">|</span>
<a class="text-middle" href="javascript:void(0);" @click="showDel(index)">删除</a>
<a class="text-middle" href="javascript:void(0);" @click="showDel(index)" >删除</a>
<span class="text-middle font-22 pl5 pr5">|</span>
<a class="text-middle color-ffa85a" href="javascript:void(0);" v-if="item.status==1"
@click=showAble(index)>启用</a>
<a class="text-middle color-ffa85a" href="javascript:void(0);" v-else-if="item.status==0"
@click=showAble(index)>禁用</a>
<? }?>
</div>
</div>
<!--end活动列表-->
@@ -76,6 +82,12 @@
<input class="wp100 inner30 font-30 bg-f6 border-none ulib-r10" type="tel" v-model="mobile"
placeholder="请输入手机号"/>
</div>
<!-- <div class="mt30 relative bg-f6 ulib-r10">-->
<!-- <select class="wp100 inner30 font-30 bg-f6 border-none ulib-r10" v-model="type">-->
<!-- <option :value="0">销售顾问</option>-->
<!-- <option :value="1">管理员</option>-->
<!-- </select>-->
<!-- </div>-->
</div>
<div class="mt30">
<a class="block pt25 pb25 bg-1a1a1a text-center font-32 color-fff ulib-r10" @click="submit()">{{formIndex>-1?'修改':'新增'}}</a>
@@ -88,7 +100,7 @@
<div class="msgBg" @click="closeOpt"></div>
<div class="msgMain">
<div class="content" style="padding:0;">
<div class="pt60 pb60 pl40 pr40 text-center font-32">确认删除{{list[delIndex].uname}}"吗?"</div>
<div class="pt60 pb60 pl40 pr40 text-center font-32">确认删除【{{list[delIndex].uname}}】吗?</div>
<div class="fn-flex bts-1-eee text-center font-28">
<a class="fn-flex-item pt30 pb30" href="javascript:void(0);" @click="delOpt()">确定</a>
<a class="fn-flex-item pt30 pb30 bls-1-eee color-999" href="javascript:void(0);" @click="closeOpt">取消</a>
@@ -102,7 +114,7 @@
<div class="msgMain">
<div class="content" style="padding:0;">
<div class="pt60 pb60 pl40 pr40 text-center font-32">
{{list[ableIndex].status==1?'确认启用':'确认禁用'}}{{list[ableIndex].uname}}"吗?"
{{list[ableIndex].status==1?'确认启用':'确认禁用'}}{{list[ableIndex].uname}}】吗?
</div>
<div class="fn-flex bts-1-eee text-center font-28">
<a class="fn-flex-item pt30 pb30" href="javascript:void(0);" @click="ableOpt()">确定</a>
@@ -143,6 +155,7 @@
list: [],
uname: '',
mobile: '',
type: 0,
isSubmiting: false,
isRefresh: false,//是否是刷新列表,用于操作后刷新列表
isShowForm: false,
@@ -248,6 +261,7 @@
let params = {};
params['uname'] = that.uname;
params['mobile'] = that.mobile;
params['type'] = that.type;
params['biz_id'] = <?=$biz_id?>;
if (that.formIndex > -1) {
url = '/h5/market/sylive2/user/edit';
@@ -260,6 +274,7 @@
that.isShowForm = false;
that.uname = '';
that.mobile = '';
that.type = '';
that.loading = false;
that.isDataEnd = false;
that.isNoData = false;