licheb user add group1 about
This commit is contained in:
@@ -83,13 +83,15 @@ class Channel extends HD_Controller
|
||||
|
||||
private function dataSelect($params)
|
||||
{
|
||||
$channel_biz_table = $params['group_id1'] ? 'lc_app_licheb_channel_biz1' : 'lc_app_licheb_channel_biz';
|
||||
$lists = [];
|
||||
$where['lc_biz.status'] = 1;
|
||||
$_title = '门店列表';
|
||||
if ($params['uid']) {
|
||||
$where['lc_app_licheb_channel_biz.uid'] = $params['uid'];
|
||||
$where[$channel_biz_table.'.uid'] = $params['uid'];
|
||||
$re = $this->mdUsers->get(array('id' => $params['uid']));
|
||||
$re['uname'] && $_title = $re['uname'] . '_门店列表';
|
||||
$group = $params['group_id1'] ? ' (第二角色)' :'';
|
||||
$re['uname'] && $_title = $re['uname'] .$group. '_门店列表';
|
||||
}
|
||||
!$params['city_id'] && $params['city_id'] = '';
|
||||
!$params['county_id'] && $params['county_id'] = '';
|
||||
@@ -102,20 +104,20 @@ class Channel extends HD_Controller
|
||||
if ($params['county_id']) {
|
||||
$where['lc_biz.county_id'] = $params['county_id'];
|
||||
}
|
||||
$count = $this->db->select('lc_app_licheb_channel_biz.biz_id')
|
||||
->join('lc_biz', 'lc_biz.id = lc_app_licheb_channel_biz.biz_id', 'left')
|
||||
$count = $this->db->select($channel_biz_table.'.biz_id')
|
||||
->join('lc_biz', 'lc_biz.id = '.$channel_biz_table.'.biz_id', 'left')
|
||||
->where($where)
|
||||
->count_all_results('lc_app_licheb_channel_biz');
|
||||
->count_all_results($channel_biz_table);
|
||||
if ($count) {
|
||||
$offset = ($params['page'] - 1) * $params['size'];
|
||||
$limit = $params['size'];
|
||||
$this->db->from('lc_app_licheb_channel_biz');
|
||||
$this->db->join('lc_biz', "lc_biz.id = lc_app_licheb_channel_biz.biz_id", 'left');
|
||||
$this->db->from($channel_biz_table);
|
||||
$this->db->join('lc_biz', "lc_biz.id = ".$channel_biz_table.".biz_id", 'left');
|
||||
$this->db->select('lc_biz.id,lc_biz.biz_name,lc_biz.county_id,lc_biz.c_time');
|
||||
$this->db->where($where);
|
||||
$this->db->order_by('lc_app_licheb_channel_biz.id Desc');
|
||||
$this->db->order_by($channel_biz_table.'.id Desc');
|
||||
$this->db->limit($limit, $offset);
|
||||
!$params['uid'] && $this->db->group_by('lc_app_licheb_channel_biz.biz_id');
|
||||
!$params['uid'] && $this->db->group_by($channel_biz_table.'.biz_id');
|
||||
$res = $this->db->get()->result_array();
|
||||
$county_id_arr = array_unique(array_column($res, 'county_id'));
|
||||
$Areas = $this->mdArea->get_map_by_county_ids($county_id_arr, 'city_name,county_name,county_id', 'county_id');
|
||||
@@ -131,10 +133,10 @@ class Channel extends HD_Controller
|
||||
$setValue['orders'] = $this->mdOrders->count(['biz_id' => $value['id'], 'status>=' => 0, 'brand_id<>' => 3, 'biz_id<>' => 1]);
|
||||
$setValue['days'] = round((time() - $value['c_time']) / 3600 / 24) . '天';
|
||||
if (!$params['uid']) {
|
||||
$this->db->from('lc_app_licheb_channel_biz');
|
||||
$this->db->join('lc_app_licheb_users', "lc_app_licheb_users.id = lc_app_licheb_channel_biz.uid", 'left');
|
||||
$this->db->from($channel_biz_table);
|
||||
$this->db->join('lc_app_licheb_users', "lc_app_licheb_users.id = ".$channel_biz_table.".uid", 'left');
|
||||
$this->db->select('lc_app_licheb_users.uname');
|
||||
$this->db->where(['lc_app_licheb_channel_biz.biz_id' => $value['id']]);
|
||||
$this->db->where([$channel_biz_table.'.biz_id' => $value['id']]);
|
||||
$res_u = $this->db->get()->result_array();
|
||||
$unames = $res_u ? implode(',', array_column($res_u, 'uname')) : '';
|
||||
$setValue['uname'] = $unames;
|
||||
|
||||
@@ -12,6 +12,7 @@ class Member extends HD_Controller
|
||||
parent::__construct();
|
||||
$this->load->model('app/licheb/App_licheb_users_model', 'userM');
|
||||
$this->load->model('app/licheb/App_licheb_channel_biz_model', 'mdChannelBiz');
|
||||
$this->load->model('app/licheb/App_licheb_channel_biz1_model', 'mdChannelBiz1');
|
||||
$this->load->model("biz/biz_model");
|
||||
}
|
||||
|
||||
@@ -63,6 +64,17 @@ class Member extends HD_Controller
|
||||
}
|
||||
$lists[$key]['biz_name'] = $biz_name;
|
||||
$lists[$key]['group_name'] = $this->groups[$val['group_id']];
|
||||
|
||||
$biz_name = '';
|
||||
if ($val['group_id1'] == 4) {
|
||||
$biz_name = ' <a href="javascript:void(0)" data-open="/app/licheb/channel/lists_biz?group_id1=1&uid=' . $val['id'] . '">门店列表</a>';
|
||||
} else if ($val['biz_id1']) {
|
||||
$re_biz = $this->biz_model->get(['id' => $val['biz_id1']], 'biz_name');
|
||||
$re_biz && $biz_name = $re_biz['biz_name'];
|
||||
}
|
||||
$lists[$key]['biz_name1'] = $biz_name;
|
||||
$lists[$key]['group_name1'] = $this->groups[$val['group_id1']];
|
||||
|
||||
if (SUPER_ADMIN == $this->role) {//超级管理员才允许操作用户的披上超级马甲
|
||||
$majia = array();
|
||||
if ($val['jsondata']) {
|
||||
@@ -90,6 +102,7 @@ class Member extends HD_Controller
|
||||
$id = $this->input->get('id');
|
||||
$row = $this->userM->get(['id' => $id]);
|
||||
$selectedBrands = [];
|
||||
$selectedBrands1 = [];
|
||||
if ($id) {
|
||||
$info = array(
|
||||
'id' => $row['id'],
|
||||
@@ -98,6 +111,9 @@ class Member extends HD_Controller
|
||||
'group_id' => $row['group_id'],
|
||||
'biz_id' => $row['biz_id'],
|
||||
'city_id' => $row['city_id'],
|
||||
'group_id1' => $row['group_id1'],
|
||||
'biz_id1' => $row['biz_id1'],
|
||||
'city_id1' => $row['city_id1'],
|
||||
);
|
||||
if ($row['group_id'] == 4) {
|
||||
$this->load->model('app/licheb/App_licheb_channel_biz_model', 'mdChannelBiz');
|
||||
@@ -116,6 +132,24 @@ class Member extends HD_Controller
|
||||
$selectedBrands[] = ['biz_id' => $re_biz['id'], 'name' => $re_biz['biz_name']];
|
||||
}
|
||||
}
|
||||
# group_id1
|
||||
if ($row['group_id1'] == 4) {
|
||||
$this->load->model('app/licheb/App_licheb_channel_biz1_model', 'mdChannelBiz1');
|
||||
$res_biz = $this->mdChannelBiz1->select(['uid' => $id], 'id desc', 0, 0, 'biz_id');
|
||||
$res_biz && $biz_id_arr = array_unique(array_column($res_biz, 'biz_id'));
|
||||
if ($res_biz) {
|
||||
$biz_id_arr = array_unique(array_column($res_biz, 'biz_id'));
|
||||
$ids = implode(',', $biz_id_arr);
|
||||
$typeAry = $this->biz_model->type_ary();
|
||||
$type_ids = implode(',',array_keys($typeAry));
|
||||
$selectedBrands1 = $this->biz_model->select(["id in ($ids)" => null, "type in ($type_ids)" => null, 'status' => 1], '', 0, 0, 'id as biz_id,biz_name as name');
|
||||
}
|
||||
} else if ($row['biz_id1']) {
|
||||
$re_biz = $this->biz_model->get(["id" => $row['biz_id1'], 'status' => 1], 'id ,biz_name');
|
||||
if ($re_biz) {
|
||||
$selectedBrands1[] = ['biz_id' => $re_biz['id'], 'name' => $re_biz['biz_name']];
|
||||
}
|
||||
}
|
||||
$action = '/app/licheb/member/edit';
|
||||
$_title = '编辑用户';
|
||||
} else {
|
||||
@@ -135,6 +169,7 @@ class Member extends HD_Controller
|
||||
#$show_info['typeAry'] = $this->biz_model->type_ary();
|
||||
$show_info['cityList'] = $this->mdSysCity->select(['status' => 1], 'id desc', 0, 0, 'city_id,name');
|
||||
$this->data['selectedBrands'] = $selectedBrands;
|
||||
$this->data['selectedBrands1'] = $selectedBrands1;
|
||||
$this->data['show_info'] = $show_info;
|
||||
$this->data['info'] = $info;
|
||||
$this->data['groups'] = $this->groups;
|
||||
@@ -153,6 +188,10 @@ class Member extends HD_Controller
|
||||
$bizs = $info['bizs'];
|
||||
$city_id = $info['city_id'];
|
||||
$biz_id_arr = array_column($bizs, 'biz_id');
|
||||
$group_id1 = $info['group_id1'];
|
||||
$bizs1 = $info['bizs1'];
|
||||
$city_id1 = $info['city_id1'];
|
||||
$biz_id_arr1 = is_array($bizs1) ? array_column($bizs1, 'biz_id') : '';
|
||||
|
||||
if (!mobile_valid($mobile)) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '输入正确手机号');
|
||||
@@ -170,15 +209,22 @@ class Member extends HD_Controller
|
||||
'mobile' => $mobile,
|
||||
'uname' => $uname,
|
||||
'city_id' => $city_id,
|
||||
'city_id1' => $city_id1,
|
||||
'status' => 1,
|
||||
'c_time' => time(),
|
||||
);
|
||||
$group_id && $add['group_id'] = $group_id;
|
||||
$biz_id_arr && $add['biz_id'] = implode(',', $biz_id_arr);
|
||||
$group_id1 && $add['group_id1'] = $group_id1;
|
||||
$biz_id_arr1 && $add['biz_id1'] = implode(',', $biz_id_arr1);
|
||||
|
||||
$id = $this->userM->add($add);
|
||||
if ($id && $group_id == 4 && $biz_id_arr) {//加狸车宝渠道门店
|
||||
$this->channel_biz(["uid" => $id, 'biz_id_arr' => $biz_id_arr]);
|
||||
}
|
||||
if ($id && $group_id1 == 4 && $biz_id_arr1) {//加狸车宝渠道门店 group_id1
|
||||
$this->channel_biz(["uid" => $id, 'biz_id_arr' => $biz_id_arr1, 'edit' => 1, 'group_id1'=>true]);
|
||||
}
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '操作成功', '/app/licheb/member');
|
||||
}
|
||||
|
||||
@@ -194,10 +240,17 @@ class Member extends HD_Controller
|
||||
$bizs = $info['bizs'];
|
||||
$city_id = $info['city_id'];
|
||||
$biz_id_arr = is_array($bizs) ? array_column($bizs, 'biz_id') : '';
|
||||
$group_id1 = $info['group_id1'];
|
||||
$bizs1 = $info['bizs1'];
|
||||
$city_id1 = $info['city_id1'];
|
||||
$biz_id_arr1 = is_array($bizs1) ? array_column($bizs1, 'biz_id') : '';
|
||||
|
||||
if (!mobile_valid($mobile)) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '输入正确手机号');
|
||||
}
|
||||
if (!$uname) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '请输入姓名');
|
||||
}
|
||||
|
||||
$exist = $this->userM->get(array('mobile' => $mobile, 'status in (0, 1)' => null, 'id <>' => $id));
|
||||
if ($exist) {
|
||||
@@ -207,10 +260,13 @@ class Member extends HD_Controller
|
||||
$upd = array(
|
||||
'mobile' => $mobile,
|
||||
'city_id' => $city_id,
|
||||
'city_id1' => $city_id1,
|
||||
);
|
||||
|
||||
$upd['group_id'] = $group_id ? $group_id : 0;
|
||||
$upd['biz_id'] = $biz_id_arr ? implode(',', $biz_id_arr) : 0;
|
||||
$upd['group_id1'] = $group_id1 ? $group_id1 : 0;
|
||||
$upd['biz_id1'] = $biz_id_arr1 ? implode(',', $biz_id_arr1) : 0;
|
||||
|
||||
$nickname && $upd['nickname'] = $nickname;
|
||||
$uname && $upd['uname'] = $uname;
|
||||
@@ -219,6 +275,9 @@ class Member extends HD_Controller
|
||||
if ($id && $group_id == 4) {//加狸车宝渠道门店
|
||||
$this->channel_biz(["uid" => $id, 'biz_id_arr' => $biz_id_arr, 'edit' => 1]);
|
||||
}
|
||||
if ($id && $group_id1 == 4) {//加狸车宝渠道门店 group_id1
|
||||
$this->channel_biz(["uid" => $id, 'biz_id_arr' => $biz_id_arr1, 'edit' => 1, 'group_id1'=>true]);
|
||||
}
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '操作成功');
|
||||
}
|
||||
|
||||
@@ -319,10 +378,12 @@ class Member extends HD_Controller
|
||||
function channel_biz($json = [])
|
||||
{
|
||||
$biz_ids = $json['biz_id_arr'] ? implode(',', $json['biz_id_arr']) : 0;
|
||||
$group_id1 = $json['group_id1'] ? true : false;
|
||||
if ($json['edit'] == 1) {//编辑删除未添加的
|
||||
$where_d['uid'] = $json['uid'];
|
||||
$biz_ids && $where_d["biz_id not in({$biz_ids})"] = null;
|
||||
$this->mdChannelBiz->delete($where_d);
|
||||
!$group_id1 && $this->mdChannelBiz->delete($where_d);
|
||||
$group_id1 && $this->mdChannelBiz1->delete($where_d);
|
||||
}
|
||||
if (!$biz_ids) {
|
||||
return;
|
||||
@@ -330,10 +391,12 @@ class Member extends HD_Controller
|
||||
$res_b = $this->biz_model->select(["id in({$biz_ids})" => null], '', 0, 0, 'id as biz_id');
|
||||
foreach ($res_b as $key => $value) {
|
||||
$where = ["uid" => $json['uid'], 'biz_id' => $value['biz_id']];
|
||||
$re_cb = $this->mdChannelBiz->get($where);
|
||||
!$group_id1 && $re_cb = $this->mdChannelBiz->get($where);
|
||||
$group_id1 && $re_cb = $this->mdChannelBiz1->get($where);
|
||||
if (!$re_cb) {
|
||||
$where['c_time'] = time();
|
||||
$this->mdChannelBiz->add($where);
|
||||
!$group_id1 && $this->mdChannelBiz->add($where);
|
||||
$group_id1 && $this->mdChannelBiz1->add($where);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,20 +2,20 @@
|
||||
style="width: 90%;padding-top: 10px">
|
||||
<input type="hidden" name="id" value="<?= $row['id'] ?>"/>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">姓名:</label>
|
||||
<div class="am-para-input w300">
|
||||
<label class="am-para-label w120">姓名:</label>
|
||||
<div class="am-para-input w300" style="margin-left: 130px">
|
||||
<input type="text" placeholder="输入姓名" name="uname" v-model="info.uname" maxlength="30"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">手机号:</label>
|
||||
<div class="am-para-input w300">
|
||||
<label class="am-para-label w120">手机号:</label>
|
||||
<div class="am-para-input w300" style="margin-left: 130px">
|
||||
<input type="text" placeholder="输入手机号" name="mobile" v-model="info.mobile" maxlength="30"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">角色:</label>
|
||||
<div class="am-para-input w100">
|
||||
<label class="am-para-label w120">默认角色:</label>
|
||||
<div class="am-para-input w100" style="margin-left: 130px">
|
||||
<select name="group_id" v-model="info.group_id" @change="resetBiz">
|
||||
<option value="">选择角色</option>
|
||||
<option :value="i" v-for="(v,i) in groups">{{v}}</option>
|
||||
@@ -23,8 +23,8 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group" v-if="info.group_id==4">
|
||||
<label class="am-para-label">所在城市:</label>
|
||||
<div class="am-para-input w100">
|
||||
<label class="am-para-label w120">默认角色城市:</label>
|
||||
<div class="am-para-input w100" style="margin-left: 130px">
|
||||
<select v-model="info.city_id">
|
||||
<option value="0">选择城市</option>
|
||||
<option :value="v.city_id" v-for="(v,i) in show_info.cityList">{{v.name}}</option>
|
||||
@@ -32,8 +32,8 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">门店:</label>
|
||||
<div class="am-para-inline lh-default">
|
||||
<label class="am-para-label w120">默认角色门店:</label>
|
||||
<div class="am-para-input lh-default" style="margin-left: 130px">
|
||||
<button class="am-btn am-btn-default" type="button" @click="brandModal">选择门店</button>
|
||||
<div class="mt5">
|
||||
<button class="am-btn am-btn-default mr5" type="button" @click="brandModal"
|
||||
@@ -43,6 +43,36 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label w120">第二角色:</label>
|
||||
<div class="am-para-input w100" style="margin-left: 130px">
|
||||
<select name="group_id1" v-model="info.group_id1" @change="resetBiz1">
|
||||
<option value="0">选择角色</option>
|
||||
<option :value="i" v-for="(v,i) in groups">{{v}}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group" v-if="info.group_id1==4">
|
||||
<label class="am-para-label w120">第二角色城市:</label>
|
||||
<div class="am-para-input w100" style="margin-left: 130px">
|
||||
<select v-model="info.city_id1">
|
||||
<option value="0">选择城市</option>
|
||||
<option :value="v.city_id" v-for="(v,i) in show_info.cityList">{{v.name}}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label w120">第二角色门店:</label>
|
||||
<div class="am-para-input lh-default" style="margin-left: 130px">
|
||||
<button class="am-btn am-btn-default" type="button" @click="brandModal1">选择门店</button>
|
||||
<div class="mt5">
|
||||
<button class="am-btn am-btn-default mr5" type="button" @click="brandModal1"
|
||||
v-for="(item) in selectedBrands1">{{item.name}}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="am-form-group" style="margin-bottom: 2rem">
|
||||
<div class="am-para-input">
|
||||
<button class="am-btn am-btn-success" type="button" @click='saveEdit'>提交</button>
|
||||
@@ -134,6 +164,96 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="brand-modal1" style="display:none">
|
||||
<div class="modal-body">
|
||||
<div class="header">
|
||||
<div class="am-form am-form-horizontal">
|
||||
<div class="am-form-group fl">
|
||||
<div class="am-form-group am-para-inline w150">
|
||||
<select title="城市" v-model="search_info.city_id1">
|
||||
<option value="0">城市</option>
|
||||
<template v-for="(v,i) in cityAry">
|
||||
<option :value="v.id">{{v.name}}</option>
|
||||
</template>
|
||||
</select>
|
||||
</div>
|
||||
<div class="am-form-group am-para-inline w150">
|
||||
<select title="行政区" v-model="search_info.county_id1">
|
||||
<option value="0">行政区</option>
|
||||
<template v-for="(v,i) in countyAry">
|
||||
<option :value="v.id">{{v.name}}</option>
|
||||
</template>
|
||||
</select>
|
||||
</div>
|
||||
<div class="am-form-group am-para-inline w150">
|
||||
<select title="类型" v-model="search_info.type1">
|
||||
<option value="0">类型</option>
|
||||
<template v-for="(v,i) in show_info.typeAry">
|
||||
<option :value="i">{{v}}</option>
|
||||
</template>
|
||||
</select>
|
||||
</div>
|
||||
<div class="am-form-group fl ml10">
|
||||
<a class="am-btn am-btn-success am-btn-sm w100" @click="search1()">搜索</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div style="padding-top: 10px;">
|
||||
<div class="vuetable-body-wrapper">
|
||||
<table class="vuetable table table-middle table-hover fixed">
|
||||
<colgroup>
|
||||
<col class="vuetable-col-title" style="width: 50%;">
|
||||
<col class="vuetable-col-actions text-right" style="width: 10%;">
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="vuetable-th-slot-title">商家名</th>
|
||||
<th class="vuetable-th-slot-actions text-right">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tfoot></tfoot>
|
||||
<tbody class="vuetable-body">
|
||||
<tr v-for="(v,i) in brandsList1">
|
||||
<td class="vuetable-slot">
|
||||
{{v.name}}
|
||||
</td>
|
||||
<td class="vuetable-slot text-right">
|
||||
<button type='button' v-if="v.is_checked==0 || !v.is_checked"
|
||||
class="btn btn-sm btn-success"
|
||||
@click="addItem1(i)">添加
|
||||
</button>
|
||||
<button type='button' v-if="v.is_checked==1" class="btn btn-sm btn-danger"
|
||||
@click="removeItem1(v)">删除
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clearfix">
|
||||
<span class="pull-left text-muted">第{{brandsPage.page}}页(每页{{brandsPage.pageLimit}}条,共{{brandsPage.pageCount}}条)</span>
|
||||
<nav class="pull-right" aria-label="Page navigation">
|
||||
<ul class="pagination pagination-sm">
|
||||
<li>
|
||||
<a href="javascript:void(0);" @click="beforeShopPage1();" aria-label="上一页">
|
||||
<span class="glyphicon glyphicon-menu-left"></span>
|
||||
</a>
|
||||
</li>
|
||||
<li v-if="brandsPage.hasNext">
|
||||
<a href="javascript:void(0);" @click="afterShopPage1();" aria-label="下一页">
|
||||
<span class="glyphicon glyphicon-menu-right"></span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
<script type="text/javascript">
|
||||
var vue_app;
|
||||
@@ -149,11 +269,13 @@
|
||||
brandsPage: [],
|
||||
bizIds: [],
|
||||
brandsList: [],
|
||||
brandsList1: [],
|
||||
selectedBrands: [],
|
||||
selectedBrands1: [],
|
||||
cityAry: [],
|
||||
countyAry: [],
|
||||
show_info: {cityList: [], typeAry: []},
|
||||
search_info: {city_id: 0, county_id: 0, type: 0}
|
||||
search_info: {city_id: 0, county_id: 0, type: 0, city_id1: 0, county_id1: 0, type1: 0}
|
||||
},
|
||||
computed: {},
|
||||
created: function () {
|
||||
@@ -165,6 +287,7 @@
|
||||
vm.info = <?=json_encode($info, JSON_UNESCAPED_UNICODE)?>;
|
||||
vm.groups = <?=json_encode($groups, JSON_UNESCAPED_UNICODE)?>;
|
||||
vm.selectedBrands = <?=json_encode($selectedBrands, JSON_UNESCAPED_UNICODE)?>;
|
||||
vm.selectedBrands1 = <?=json_encode($selectedBrands1, JSON_UNESCAPED_UNICODE)?>;
|
||||
vm.show_info = <?=json_encode($show_info, JSON_UNESCAPED_UNICODE)?>;
|
||||
vm.init_citys();
|
||||
},
|
||||
@@ -172,6 +295,9 @@
|
||||
resetBiz: function () {
|
||||
this.selectedBrands = [];
|
||||
},
|
||||
resetBiz1: function () {
|
||||
this.selectedBrands1 = [];
|
||||
},
|
||||
search: function () {
|
||||
this.changePage(1);
|
||||
},
|
||||
@@ -278,6 +404,113 @@
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
//group_id1
|
||||
search1: function () {
|
||||
this.changePage1(1);
|
||||
},
|
||||
changePage1: function (page) {
|
||||
var that = this;
|
||||
that.brandsThPage = page;
|
||||
return this.brandModal1();
|
||||
},
|
||||
beforeShopPage1: function () {
|
||||
var vm = this;
|
||||
if (vm.brandsThPage == 1) {
|
||||
alert('已经是第一页了');
|
||||
return;
|
||||
}
|
||||
vm.brandsThPage--;
|
||||
return this.brandModal1();
|
||||
},
|
||||
afterShopPage1: function () {
|
||||
var vm = this;
|
||||
vm.brandsThPage++;
|
||||
return this.brandModal1();
|
||||
},
|
||||
addItem1: function (index) {
|
||||
var vm = this;
|
||||
var brand_id;
|
||||
var biz_id;
|
||||
biz_id = vm.brandsList1[index]['id'];
|
||||
var _shop = {
|
||||
biz_id: biz_id,
|
||||
name: vm.brandsList1[index]['name'],
|
||||
};
|
||||
if (vm.info.group_id1 == 4) {
|
||||
vm.selectedBrands1.push(_shop);
|
||||
vm.brandsList1[index]['is_checked'] = 1;
|
||||
} else {
|
||||
vm.selectedBrands1 = [];
|
||||
vm.selectedBrands1.push(_shop);
|
||||
this.brandsList1.map(function (_item, _index) {
|
||||
if (vm.brandsList1[index]['id'] == _item['id']) {
|
||||
vm.brandsList1[_index]['is_checked'] = 1;
|
||||
} else {
|
||||
vm.brandsList1[_index]['is_checked'] = 0;
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
removeItem1: function (item) {
|
||||
var vm = this;
|
||||
if (vm.info.group_id1 == 4) {
|
||||
this.selectedBrands1 = this.selectedBrands1.filter(function (_item) {
|
||||
var id = _item.biz_id > 0 ? _item.biz_id : _item.brand_id;
|
||||
return id != item.id;
|
||||
})
|
||||
} else {
|
||||
vm.selectedBrands1 = [];
|
||||
}
|
||||
this.brandsList1.map(function (_item, _index) {
|
||||
if (item.id == _item.id) {
|
||||
vm.brandsList1[_index].is_checked = 0;
|
||||
}
|
||||
})
|
||||
},
|
||||
brandModal1: function () {
|
||||
var that = this;
|
||||
layer.open({
|
||||
type: 1,
|
||||
area: ['55%', '80%'], //宽高
|
||||
content: $('#brand-modal1'),
|
||||
title: '选择商家',
|
||||
shade: false,
|
||||
btn: ['选好了'],
|
||||
yes: function (index) {
|
||||
layer.close(index);
|
||||
}
|
||||
});
|
||||
$.ajax({
|
||||
url: '/common/shop_app',
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
page: that.brandsThPage,
|
||||
type: that.search_info.type1,
|
||||
city_id: that.search_info.city_id1,
|
||||
county_id: that.search_info.county_id1,
|
||||
types:'1,2,3',
|
||||
},
|
||||
success: function (json) {
|
||||
var brandsList1 = json.data.shopList;
|
||||
that.brandsPage = json.data.shopPage;
|
||||
brandsList1.map(function (_item, _index) {
|
||||
for (var index in that.selectedBrands1) {
|
||||
var item = that.selectedBrands1[index];
|
||||
var id = that.sys_type_id == 1 ? item.brand_id : item.biz_id;
|
||||
if (id == _item.id) {
|
||||
brandsList1[_index].is_checked = 1;
|
||||
break;
|
||||
} else {
|
||||
brandsList1[_index].is_checked = 0;
|
||||
}
|
||||
}
|
||||
})
|
||||
that.brandsList1 = brandsList1;
|
||||
}
|
||||
});
|
||||
},
|
||||
init_citys: function () {
|
||||
var vm = this;
|
||||
$.get('common/area', {id: '350', key: 'city', type: 1}, function (response) {
|
||||
@@ -300,6 +533,7 @@
|
||||
|
||||
var vm = this;
|
||||
vm.info.bizs = vm.selectedBrands;
|
||||
vm.info.bizs1 = vm.selectedBrands1;
|
||||
loading = true;
|
||||
$.ajax({
|
||||
url: '<?=$action?>',
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label w100">角色:</label>
|
||||
<label class="am-para-label w100">默认角色:</label>
|
||||
<div class="am-para-inline w150">
|
||||
<select name="group_id">
|
||||
<option value="">全部</option>
|
||||
@@ -37,7 +37,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label w100">门店:</label>
|
||||
<label class="am-para-label w100">默认门店:</label>
|
||||
<div class="am-form-group am-para-inline w150">
|
||||
<select title="城市" name="city_id" v-model="params.city_id">
|
||||
<option value="">城市</option>
|
||||
@@ -75,8 +75,10 @@
|
||||
<th width="10%"><span>ID</span></th>
|
||||
<th width="20%"><span>姓名</span></th>
|
||||
<th width="20%"><span>手机号码</span></th>
|
||||
<th width="20%"><span>角色</span></th>
|
||||
<th width="20%"><span>门店</span></th>
|
||||
<th width="20%"><span>默认角色</span></th>
|
||||
<th width="20%"><span>默认门店</span></th>
|
||||
<th width="20%"><span>第二角色</span></th>
|
||||
<th width="20%"><span>第二角色门店</span></th>
|
||||
<th width="20%"><span>创建时间</span></th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -88,10 +90,12 @@
|
||||
<td><?= $v['mobile'] ?></td>
|
||||
<td><?= $v['group_name'] ?></td>
|
||||
<td><?= $v['biz_name'] ?></td>
|
||||
<td><?= $v['group_name1'] ?></td>
|
||||
<td><?= $v['biz_name1'] ?></td>
|
||||
<td><?= date('Y-m-d H:i:s', $v['c_time']) ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="6" class="align-r">
|
||||
<td colspan="8" class="align-r">
|
||||
<input type="hidden" class="id-<?= $v['id'] ?>" name="id" value="<?= $v['id'] ?>" checked>
|
||||
<select data-update-group="" data-list-target=".id-<?= $v['id'] ?>"
|
||||
data-action="/app/licheb/member/batch" data-field=""
|
||||
|
||||
@@ -273,6 +273,18 @@ abstract class Wxapp extends HD_Controller{
|
||||
$user = $row;
|
||||
}
|
||||
}
|
||||
// 角色切换处理
|
||||
if ($session['group_id_type']){
|
||||
$user['group_id'] = $user['group_id1'];
|
||||
$user['biz_id'] = $user['biz_id1'];
|
||||
$user['city_id'] = $user['city_id1'];
|
||||
}
|
||||
//设置默认城市,取biz_id对应城市
|
||||
if (strlen($user['biz_id']) > strlen(str_replace(',', '', $user['biz_id']))){
|
||||
$this->load->model("biz/biz_model");
|
||||
$biz = $this->biz_model->get(['id' => intval($user['biz_id']), 'status' => 1], 'city_id');
|
||||
$user['city_id'] = $biz && $biz['city_id'] ? $biz['city_id'] : 0;
|
||||
}
|
||||
}
|
||||
if($user){
|
||||
$session = array_merge($session, $user);
|
||||
|
||||
@@ -27,6 +27,7 @@ class User extends Wxapp
|
||||
$this->load->model('auto/auto_brand_biz_model');
|
||||
$this->load->model('items/items_model', 'mdItems');
|
||||
$this->load->model('items/items_oplogs_model', 'mdItemsOplogs');
|
||||
$this->load->model('sys/sys_city_model');
|
||||
$this->load->library('receiver/orders_v2_entity');
|
||||
}
|
||||
|
||||
@@ -137,8 +138,54 @@ class User extends Wxapp
|
||||
'biz_name' => $biz['biz_name'] ? $biz['biz_name'] : '',
|
||||
'biz_type' => $biz['type'] ? $biz['type'] : '',
|
||||
'show_sa' => $biz_id == 70 ? true : false,
|
||||
'new_biz_id' => $this->session['new_biz_id'] ? $this->session['new_biz_id'] : '',
|
||||
'group_id_type' => $this->session['group_id_type'] ? $this->session['group_id_type'] : '',
|
||||
);
|
||||
|
||||
# 用户可切换的组别
|
||||
$group_name1 = $group_arr[$user['group_id1']] ? $group_arr[$user['group_id1']] : '';
|
||||
$group_name_arr = array();
|
||||
if ($user['group_id'] && $user['group_id1']){
|
||||
# 渠道角色 再显示下城市名称,门店角色 再显示下门店名称
|
||||
$where_biz = ["id in ({$user['biz_id']}, {$user['biz_id1']})" => null];
|
||||
$map_biz = $this->biz_model->map('id', 'biz_name', $where_biz, '', 0, 0, 'id,biz_name');
|
||||
|
||||
$where_city = ["city_id in ({$user['city_id']}, {$user['city_id1']})" => null];
|
||||
$map_city = $this->sys_city_model->map('city_id', 'name', $where_city, '', 0, 0, 'city_id,name');
|
||||
|
||||
$group_name_ = '默认角色:'.$group_name;
|
||||
if ($user['group_id'] == 4){
|
||||
$group_name_ = $user['city_id'] ? $group_name_."({$map_city[$user['city_id']]})" : $group_name_;
|
||||
}
|
||||
else{
|
||||
$group_name_ = $user['biz_id'] ? $group_name_."({$map_biz[$user['biz_id']]})" : $group_name_;
|
||||
}
|
||||
|
||||
$group_name1_ = '第二角色:'.$group_name1;
|
||||
if ($user['group_id1'] == 4){
|
||||
$group_name1_ = $user['city_id1'] ? $group_name1_."({$map_city[$user['city_id1']]})" : $group_name1_;
|
||||
}
|
||||
else{
|
||||
$group_name1_ = $user['biz_id1'] ? $group_name1_."({$map_biz[$user['biz_id1']]})" : $group_name1_;
|
||||
}
|
||||
|
||||
$this->session['group_id_type'] && $group_name_arr[] = array('group_id'=>'group_id', "geoup_name"=>$group_name_);
|
||||
!$this->session['group_id_type'] && $group_name_arr[] = array('group_id'=>'group_id1', "geoup_name"=>$group_name1_);
|
||||
}
|
||||
$data['group_name_arr'] = $group_name_arr;
|
||||
if ($this->session['group_id_type']){
|
||||
$data['group_id'] = $user['group_id1'];
|
||||
$data['group_name'] = $group_name1;
|
||||
|
||||
if ($user['group_id1'] != 4){
|
||||
$biz_id1 = $user['biz_id1'];
|
||||
$data['biz_id'] = $biz_id1;
|
||||
$biz1 = $this->biz_model->get(['id' => $biz_id1, 'status' => 1], 'biz_name,type');
|
||||
$data['biz_name'] = $biz1['biz_name'] ? $biz1['biz_name'] : '';
|
||||
$data['biz_type'] = $biz1['type'] ? $biz1['type'] : '';
|
||||
}
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
@@ -582,4 +629,39 @@ class User extends Wxapp
|
||||
$this->app_redis->save($this->redis_login . $ukey, json_encode($this->session, JSON_UNESCAPED_UNICODE), 30 * 24 * 3600);
|
||||
throw new Exception('保存成功', API_CODE_SUCCESS);
|
||||
}
|
||||
|
||||
/**
|
||||
* 切换角色:重新设置用户session里的group_id
|
||||
*/
|
||||
protected function put_resetgroupid()
|
||||
{
|
||||
$ukey = $this->input_param('ukey');
|
||||
$group_id_type = $this->input_param('group_id');
|
||||
if (!$group_id_type) {
|
||||
throw new Exception('参数错误', API_CODE_INVILD_PARAM);
|
||||
}
|
||||
|
||||
$uid = $this->session['uid'];
|
||||
$user = $this->app_user_model->get(array('id' => $uid));
|
||||
|
||||
if ($group_id_type == 'group_id1'){
|
||||
$this->session['group_id'] = $user['group_id1'];
|
||||
$this->session['biz_id'] = $user['biz_id1'];
|
||||
$this->session['city_id'] = $user['city_id1'];
|
||||
|
||||
$this->session['group_id_type'] = $group_id_type;
|
||||
$this->session['new_biz_id'] = intval($user['biz_id1']);
|
||||
}
|
||||
else{
|
||||
$this->session['group_id'] = $user['group_id'];
|
||||
$this->session['biz_id'] = $user['biz_id'];
|
||||
$this->session['city_id'] = $user['city_id'];
|
||||
|
||||
$this->session['group_id_type'] = '';
|
||||
$this->session['new_biz_id'] = '';
|
||||
}
|
||||
|
||||
$this->app_redis->save($this->redis_login . $ukey, json_encode($this->session, JSON_UNESCAPED_UNICODE), 30 * 24 * 3600);
|
||||
throw new Exception('保存成功', API_CODE_SUCCESS);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* Notes:狸车宝渠道门店(group_id1)
|
||||
* Created on: 2021/11/12 12:45
|
||||
* Created by: dengbw
|
||||
*/
|
||||
class App_licheb_channel_biz1_model extends HD_Model
|
||||
{
|
||||
|
||||
private $table_name = 'lc_app_licheb_channel_biz1';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct($this->table_name, 'default');
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
class App_licheb_users_model extends HD_Model{
|
||||
private $table_name = 'lc_app_licheb_users';
|
||||
|
||||
private $group_arr = [ 1 => '销售',2 => '店长',3 => '老板'];
|
||||
private $group_arr = [ 1 => '销售',2 => '店长',3 => '老板', 4 => '渠道经理'];
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct($this->table_name, 'default');
|
||||
|
||||
Reference in New Issue
Block a user