channel_1117

channel_1117_2

channel_1117_3
This commit is contained in:
dengbw
2021-11-17 11:12:05 +08:00
committed by lccsw
parent 859cc89c2b
commit 50bab18192
13 changed files with 1044 additions and 200 deletions
+155
View File
@@ -0,0 +1,155 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Channel extends HD_Controller
{
public function __construct()
{
parent::__construct();
$this->load->model('app/licheb/App_licheb_users_model', 'mdUsers');
$this->load->model('app/licheb/App_licheb_channel_biz_model', 'mdChannelBiz');
$this->load->model('receiver/receiver_customers_model', 'mdCustomers');
$this->load->model('receiver/order/receiver_orders_model', 'mdOrders');
$this->load->model("biz/biz_model", 'mdBiz');
$this->load->model("area_model", 'mdArea');
}
//首页信息
public function index()
{
$this->lists();
}
//数据列表
public function lists()
{
$params = $this->input->get();
$params['page'] = $params['page'] ? intval($params['page']) : 1;
$params['size'] = $params['size'] ? intval($params['size']) : 20;
$lists = [];
$where['group_id'] = 4;
if ($params['uname']) {
$where['uname like "%' . $params['uname'] . '%"'] = null;
}
if ($params['mobile']) {
$where['mobile like "%' . $params['mobile'] . '%"'] = null;
}
$count = $this->mdUsers->count($where);
if ($count) {
$fileds = "id,uname,mobile,c_time";
$res = $this->mdUsers->select($where, "id desc", $params['page'], $params['size'], $fileds);
foreach ($res as $key => $value) {
$setValue = [];
$bizs = $this->db->select('lc_app_licheb_channel_biz.biz_id')
->join('lc_biz', 'lc_biz.id = lc_app_licheb_channel_biz.biz_id', 'left')
->where(['lc_app_licheb_channel_biz.uid' => $value['id'], 'lc_biz.status' => 1])
->count_all_results('lc_app_licheb_channel_biz');
$setValue['id'] = $value['id'];
$setValue['uname'] = $value['uname'];
$setValue['mobile'] = $value['mobile'];
$setValue['bizs'] = $bizs;
$setValue['c_time'] = date('Y-m-d H:i:s', $value['c_time']);
$lists[] = $setValue;
}
}
$this->data['lists'] = $lists;
$this->data['params'] = $params;
$this->data['_title'] = '渠道列表';
$this->data['pager'] = array('count' => ceil($count / $params['size']), 'curr' => $params['page'], 'totle' => $count);
return $this->show_view('/app/licheb/channel/lists', true);
}
public function lists_biz()
{
$params = $this->input->get();
if (!$params['uid']) {
return $this->show_json(SYS_CODE_FAIL, '参数错误');
}
$params['page'] = $params['page'] ? intval($params['page']) : 1;
$params['size'] = $params['size'] ? intval($params['size']) : 20;
$re = $this->mdUsers->get(array('id' => $params['uid']));
$lists = [];
$where['lc_app_licheb_channel_biz.uid'] = $params['uid'];
$where['lc_biz.status'] = 1;
!$params['city_id'] && $params['city_id'] = '';
!$params['county_id'] && $params['county_id'] = '';
if ($params['biz_name']) {
$where['lc_biz.biz_name like "%' . $params['biz_name'] . '%"'] = null;
}
if ($params['city_id']) {
$where['lc_biz.city_id'] = $params['city_id'];
}
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')
->where($where)
->count_all_results('lc_app_licheb_channel_biz');
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->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->limit($limit, $offset);
$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');
foreach ($res as $key => $value) {
$setValue = [];
$county = $Areas[$value['county_id']][0];
$setValue['biz_name'] = $value['biz_name'];
$setValue['county_name'] = $county ? $county['city_name'] . '-' . $county['county_name'] : '';
$setValue['wjkhs'] = $this->mdCustomers->count(['biz_id' => $value['id'], 'status' => 0]);
$setValue['dtkhs'] = $this->mdCustomers->count(['biz_id' => $value['id'], 'dt_time<>' => '0000-00-00 00:00:00']);
$setValue['ddkhs'] = $this->mdCustomers->count(['biz_id' => $value['id'], 'status' => 2]);
$setValue['zbkhs'] = $this->mdCustomers->count(['biz_id' => $value['id'], 'status' => 3]);
$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) . '天';
$lists[] = $setValue;
}
}
$this->data['lists'] = $lists;
$this->data['params'] = $params;
$this->data['_title'] = $re['uname'] . '_门店列表';
$this->data['pager'] = array('count' => ceil($count / $params['size']), 'curr' => $params['page'], 'totle' => $count);
return $this->show_view('/app/licheb/channel/lists_biz', true);
}
//展示单条数据
public function get()
{
}
//添加单条数据
public function add()
{
}
//编辑单条数据
public function edit()
{
}
//删除单条数据
public function del()
{
}
//批量操作(默认修改状态)
public function batch()
{
}
//导出数据列表
public function export()
{
}
}
+8
View File
@@ -35,6 +35,14 @@ class Main extends HD_Controller
array('name' => '查看详情', 'url' => '/app/licheb/member/index'),
),
);
$value = $this->userM->count(['group_id' => 4]);
$list[] = array(
'title' => '渠道列表(人)',
'value' => $value,
'btns' => array(
array('name' => '查看详情', 'url' => '/app/licheb/channel'),
),
);
$value = $this->mdTemplate->count();
$list[] = array(
'title' => '素材模版(个)',
+210 -41
View File
@@ -2,14 +2,16 @@
defined('BASEPATH') OR exit('No direct script access allowed');
class Member extends HD_Controller{
class Member extends HD_Controller
{
private $groups = [1=>'销售',2=>'店长',3=>'老板',4=>'渠道经理'];
private $groups = [1 => '销售', 2 => '店长', 3 => '老板', 4 => '渠道经理'];
public function __construct()
{
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("biz/biz_model");
}
@@ -35,7 +37,11 @@ class Member extends HD_Controller{
$where['mobile'] = $params['mobile'];
$this->data['mobile'] = $params['mobile'];
}
if($params['biz_id']){
if ($params['group_id']) {
$where['group_id'] = $params['group_id'];
$this->data['group_id'] = $params['group_id'];
}
if ($params['biz_id']) {
$where['biz_id'] = $params['biz_id'];
} else {
$params['city_id'] = '';
@@ -44,23 +50,20 @@ class Member extends HD_Controller{
}
$count = $this->userM->count($where);
$lists = $this->userM->select($where,'id desc',$page,$size);
foreach($lists as $key=>$val){
$bizs = [];
$biz_id_arr = explode(',',$val['biz_id']);
if($biz_id_arr){
$ids = implode(',',$biz_id_arr);
$b_where = [
"id in ($ids)" => null
];
$bizs = $this->biz_model->select($b_where,'',0,0,'biz_name');
$lists = $this->userM->select($where, 'id desc', $page, $size);
foreach ($lists as $key => $val) {
$biz_name = '';
if ($val['group_id'] == 4) {
$biz_name = ' <a href="javascript:void(0)" data-open="/app/licheb/channel/lists_biz?uid=' . $val['id'] . '">门店列表</a>';
} else if ($val['biz_id']) {
$re_biz = $this->biz_model->get(['id' => $val['biz_id'], 'status' => 1], 'biz_name');
$re_biz && $biz_name = $re_biz['biz_name'];
}
$lists[$key]['bizs'] = $bizs;
$lists[$key]['biz_name'] = $biz_name;
$lists[$key]['group_name'] = $this->groups[$val['group_id']];
if(SUPER_ADMIN == $this->role){//超级管理员才允许操作用户的披上超级马甲
if (SUPER_ADMIN == $this->role) {//超级管理员才允许操作用户的披上超级马甲
$majia = array();
if($val['jsondata']){
if ($val['jsondata']) {
$json = json_decode($val['jsondata'], true);
$majia = $json['majia'] ? $json['majia'] : array();
}
@@ -70,6 +73,7 @@ class Member extends HD_Controller{
$this->data['app_id'] = 2;
$this->data['params'] = $params;
$this->data['lists'] = $lists;
$this->data['groupAry'] = $this->groups;
$this->data['_title'] = '用户列表';
$this->data['pager'] = array('count' => ceil($count / $size), 'curr' => $page, 'totle' => $count);
@@ -80,50 +84,61 @@ class Member extends HD_Controller{
//展示单条数据
public function get()
{
$this->load->model("sys/sys_city_model", 'mdSysCity');
$id = $this->input->get('id');
$row = $this->userM->get(['id'=>$id]);
$row = $this->userM->get(['id' => $id]);
$selectedBrands = [];
if($id){
if ($id) {
$info = array(
'id' => $row['id'],
'uname' => $row['uname'],
'mobile' => $row['mobile'],
'group_id' => $row['group_id'],
'biz_id' => $row['biz_id'],
'city_id' => 0,
'county_id' => 0
'city_id' => $row['city_id'],
);
$biz_id_arr = explode(',',$row['biz_id']);
if($biz_id_arr){
$ids = implode(',',$biz_id_arr);
$where = [
"id in ($ids)" => null
];
$selectedBrands = $this->biz_model->select($where,'',0,0,'id as biz_id,biz_name as name');
if ($row['group_id'] == 4) {
$this->load->model('app/licheb/App_licheb_channel_biz_model', 'mdChannelBiz');
$res_biz = $this->mdChannelBiz->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);
$selectedBrands = $this->biz_model->select(["id in ($ids)" => null, 'status' => 1], '', 0, 0, 'id as biz_id,biz_name as name');
}
} else if ($row['biz_id']) {
$re_biz = $this->biz_model->get(["id" => $row['biz_id'], 'status' => 1], 'id ,biz_name');
if ($re_biz) {
$selectedBrands[] = ['biz_id' => $re_biz['id'], 'name' => $re_biz['biz_name']];
}
}
$action = '/app/licheb/member/edit';
$_title = '编辑用户';
} else {
$info = array('biz_id' => '', 'group_id' => '','city_id'=>0,'county_id'=>0);
$info = array('biz_id' => '', 'group_id' => '', 'city_id' => 0);
$action = '/app/licheb/member/add';
$_title = '添加用户';
}
$show_info['cityList'] = $this->mdSysCity->select(['status' => 1], 'id desc', 0, 0, 'city_id,name');
$this->data['selectedBrands'] = $selectedBrands;
$this->data['show_info'] = $show_info;
$this->data['info'] = $info;
$this->data['groups'] = $this->groups;
$this->data['action'] = $action;
$this->data['_title'] = $_title;
return $this->show_view('app/licheb/member/get',true);
return $this->show_view('app/licheb/member/get', true);
}
//添加单条数据
public function add(){
public function add()
{
$info = $this->input->post('info');
$uname = $info['uname'];
$mobile = $info['mobile'];
$group_id = $info['group_id'];
$bizs = $info['bizs'];
$biz_id_arr = array_column($bizs,'biz_id');
$city_id = $info['city_id'];
$biz_id_arr = array_column($bizs, 'biz_id');
if (!mobile_valid($mobile)) {
return $this->show_json(SYS_CODE_FAIL, '输入正确手机号');
@@ -140,13 +155,16 @@ class Member extends HD_Controller{
$add = array(
'mobile' => $mobile,
'uname' => $uname,
'city_id' => $city_id,
'status' => 1,
'c_time' => time(),
);
$group_id && $add['group_id'] = $group_id;
$biz_id_arr && $add['biz_id'] = implode(',',$biz_id_arr);
$biz_id_arr && $add['biz_id'] = implode(',', $biz_id_arr);
$id = $this->userM->add($add);
if ($id && $group_id == 4 && $biz_id_arr) {//加狸车宝渠道门店
$this->channel_biz(["uid" => $id, 'biz_id_arr' => $biz_id_arr]);
}
return $this->show_json(SYS_CODE_SUCCESS, '操作成功', '/app/licheb/member');
}
@@ -160,7 +178,8 @@ class Member extends HD_Controller{
$mobile = $info['mobile'];
$group_id = $info['group_id'];
$bizs = $info['bizs'];
$biz_id_arr = is_array($bizs) ? array_column($bizs,'biz_id') : '';
$city_id = $info['city_id'];
$biz_id_arr = is_array($bizs) ? array_column($bizs, 'biz_id') : '';
if (!mobile_valid($mobile)) {
return $this->show_json(SYS_CODE_FAIL, '输入正确手机号');
@@ -173,16 +192,19 @@ class Member extends HD_Controller{
$upd = array(
'mobile' => $mobile,
'city_id' => $city_id,
);
$upd['group_id'] = $group_id ? $group_id : 0;
$upd['biz_id'] = $biz_id_arr ? implode(',',$biz_id_arr) : 0;
$upd['biz_id'] = $biz_id_arr ? implode(',', $biz_id_arr) : 0;
$nickname && $upd['nickname'] = $nickname;
$uname && $upd['uname'] = $uname;
$this->userM->update($upd, array('id' => $id));
if ($id && $group_id == 4) {//加狸车宝渠道门店
$this->channel_biz(["uid" => $id, 'biz_id_arr' => $biz_id_arr, 'edit' => 1]);
}
return $this->show_json(SYS_CODE_SUCCESS, '操作成功');
}
@@ -223,14 +245,15 @@ class Member extends HD_Controller{
}
function json_lists(){
function json_lists()
{
$biz_id = $this->input->post('biz_id');
$status = $this->input->post('status');
$page = $this->input->post('page');
$size = $this->input->post('size');
$where = array();
if(strlen($status) > 0){
if (strlen($status) > 0) {
$where['status'] = $status;
} else {
$whre['status > -1'] = null;
@@ -240,12 +263,12 @@ class Member extends HD_Controller{
$total = $this->userM->count($where);
$lists = array();
if($total){
if ($total) {
$orderby = 'id desc';
$select = 'id,uname';
$rows = $this->userM->select($where, $orderby, $page, $size, $select);
foreach($rows as $v){
foreach ($rows as $v) {
$lists[] = array(
'id' => $v['id'],
'title' => $v['uname'],
@@ -256,4 +279,150 @@ class Member extends HD_Controller{
$this->data = array('total' => $total, 'list' => $lists);
return $this->show_json(SYS_CODE_SUCCESS);
}
/**
* Notes:加狸车宝渠道门店
* Created on: 2021/11/12 14:54
* Created by: dengbw
* @param array $json
*/
function channel_biz($json = [])
{
$biz_ids = $json['biz_id_arr'] ? implode(',', $json['biz_id_arr']) : 0;
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);
}
if (!$biz_ids) {
return;
}
$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);
if (!$re_cb) {
$where['c_time'] = time();
$this->mdChannelBiz->add($where);
}
}
}
/**
* Notes:获取门店渠道经理
* Created on: 2021/11/15 11:31
* Created by: dengbw
* @return bool
*/
function get_channel_uid()
{
$biz_id = $this->input->get('biz_id');
if (!$biz_id) {
return $this->show_json(SYS_CODE_FAIL, '参数错误');
}
$res_b = $this->mdChannelBiz->select(["biz_id" => $biz_id], '', 0, 0, 'uid');
$this->data = $res_b ? array_column($res_b, 'uid') : [];
return $this->show_json(SYS_CODE_SUCCESS);
}
/**
* Notes:保存渠道管理员
* Created on: 2021/11/15 15:54
* Created by: dengbw
* @return bool
*/
function edit_channel_uid()
{
$biz_id = $this->input->post('biz_id');
$channel_uid = $this->input->post('channel_uid');
if (!$biz_id) {
return $this->show_json(SYS_CODE_FAIL, '参数错误');
}
$re_biz = $this->biz_model->get(['id' => $biz_id]);
if (!$re_biz) {
return $this->show_json(SYS_CODE_FAIL, '店铺不存在!');
}
$where_del['biz_id'] = $biz_id;
if ($channel_uid) {
$channel_uid_str = implode(',', $channel_uid);
$where_del["uid not in({$channel_uid_str})"] = null;
}
$res_b = $this->mdChannelBiz->select($where_del, '', 0, 0, 'uid'); //临时
$this->mdChannelBiz->delete($where_del);
//临时
foreach ($res_b as $key => $value) {
$res_b2 = $this->mdChannelBiz->select(['uid' => $value['uid']], '', 0, 0, 'biz_id');
$biz_id = $res_b2 ? array_unique(array_column($res_b2, 'biz_id')) : 0;
$biz_id && $biz_id = implode(',', $biz_id);
$this->userM->update(['biz_id' => $biz_id], ['id' => $value['uid']]);
}
//临时
if ($channel_uid) {
foreach ($channel_uid as $key => $value) {
$uid = $value;
$where = ["uid" => $uid, 'biz_id' => $biz_id];
$re_cb = $this->mdChannelBiz->get($where);
if (!$re_cb) {
$where['c_time'] = time();
$this->mdChannelBiz->add($where);
//临时
$res_b2 = $this->mdChannelBiz->select(['uid' => $uid], '', 0, 0, 'biz_id');
$biz_id = $res_b2 ? array_unique(array_column($res_b2, 'biz_id')) : 0;
$biz_id && $biz_id = implode(',', $biz_id);
$this->userM->update(['biz_id' => $biz_id], ['id' => $uid]);
//临时
}
}
}
return $this->show_json(SYS_CODE_SUCCESS, '操作成功');
}
/**
* Notes:获取门店管理员
* Created on: 2021/11/15 17:33
* Created by: dengbw
* @return bool
*/
function get_users_group()
{
$group_id = $this->input->get('group_id');
$biz_id = $this->input->get('biz_id');
$admin_name = $this->input->get('admin_name');
if (!$group_id || !$biz_id) {
return $this->show_json(SYS_CODE_FAIL, '参数错误');
}
$where = ["group_id" => $group_id, 'status >' => -1];
$admin_name && $where['uname like "%' . $admin_name . '%"'] = null;
$res_u = $this->userM->select($where, '', 0, 0, 'id,uname as name');
$res_u2 = $this->userM->select(array_merge($where, ['biz_id' => $biz_id]), '', 0, 0, 'id');
$this->data['admins'] = $res_u ? $res_u : [];
$this->data['admin_id'] = $res_u2 ? array_column($res_u2, 'id') : [];
return $this->show_json(SYS_CODE_SUCCESS);
}
/**
* Notes:保存门店管理员
* Created on: 2021/11/15 17:33
* Created by: dengbw
* @return bool
*/
function edit_users_group()
{
$biz_manage = $this->input->post('biz_manage');
if (!$biz_manage['biz_id']) {
return $this->show_json(SYS_CODE_FAIL, '参数错误');
}
if (!$biz_manage['admin_name']) {
$where_del = ['biz_id' => $biz_manage['biz_id'], 'group_id' => $biz_manage['group_id']];
if ($biz_manage['admin_id']) {
$admin_id_str = implode(',', $biz_manage['admin_id']);
$where_del["id not in({$admin_id_str})"] = null;
}
$this->userM->update(["biz_id" => 0], $where_del);
}
foreach ($biz_manage['admin_id'] as $key => $value) {
$this->userM->update(["biz_id" => $biz_manage['biz_id']], ['id' => $value]);
}
return $this->show_json(SYS_CODE_SUCCESS, '操作成功');
}
}
+1 -6
View File
@@ -71,12 +71,7 @@ class Customer extends HD_Controller
$params['cf_title'] && $where['cf_title'] = $params['cf_title'];
$params['brand_id'] && $where['brand_id'] = $params['brand_id'];
if ($params['qdjl_id']) {
$re_bu = $this->app_licheb_users_model->get(array('id' => $params['qdjl_id']));
if ($re_bu['biz_id']) {
$where["biz_id in({$re_bu['biz_id']})"] = null;
} else {
$where['biz_id'] = -1;
}
$where["biz_id in(select biz_id from lc_app_licheb_channel_biz where uid={$params['qdjl_id']})"] = null;
}
//销售员筛选
if ($params['admin_id']) {
+7 -42
View File
@@ -130,12 +130,7 @@ class OrdersList
$where["payway"] = $params['payway'];
}
if ($params['qdjl_id']) {//渠道经理
$re_bu = $this->ci->mdLichebUsers->get(array('id' => $params['qdjl_id']));
if ($re_bu['biz_id']) {
$where["biz_id in({$re_bu['biz_id']})"] = null;
} else {
$where['biz_id'] = -1;
}
$where["biz_id in(select biz_id from lc_app_licheb_channel_biz where uid={$params['qdjl_id']})"] = null;
}
if ($params['title']) {
$where["{$params['search_tp']} like '%{$params['title']}%'"] = null;
@@ -336,12 +331,7 @@ class OrdersList
$where["{$t2}.payway"] = $params['payway'];
}
if ($params['qdjl_id']) {//渠道经理
$re_bu = $this->ci->mdLichebUsers->get(array('id' => $params['qdjl_id']));
if ($re_bu['biz_id']) {
$where["biz_id in({$re_bu['biz_id']})"] = null;
} else {
$where['biz_id'] = -1;
}
$where["$t2.biz_id in(select biz_id from lc_app_licheb_channel_biz where uid={$params['qdjl_id']})"] = null;
}
$statusAry = $this->ci->mdOrders->statusAry($status_pid);
if ($params['list_type'] == 'all') {
@@ -582,12 +572,7 @@ class OrdersList
$where["{$t2}.payway"] = $params['payway'];
}
if ($params['qdjl_id']) {//渠道经理
$re_bu = $this->ci->mdLichebUsers->get(array('id' => $params['qdjl_id']));
if ($re_bu['biz_id']) {
$where["biz_id in({$re_bu['biz_id']})"] = null;
} else {
$where['biz_id'] = -1;
}
$where["$t2.biz_id in(select biz_id from lc_app_licheb_channel_biz where uid={$params['qdjl_id']})"] = null;
}
$statusAry = $this->ci->mdOrders->statusAry($status_pid);
if ($params['list_type'] == 'all') {
@@ -772,12 +757,7 @@ class OrdersList
$where["{$t2}.payway"] = $params['payway'];
}
if ($params['qdjl_id']) {//渠道经理
$re_bu = $this->ci->mdLichebUsers->get(array('id' => $params['qdjl_id']));
if ($re_bu['biz_id']) {
$where["biz_id in({$re_bu['biz_id']})"] = null;
} else {
$where['biz_id'] = -1;
}
$where["$t2.biz_id in(select biz_id from lc_app_licheb_channel_biz where uid={$params['qdjl_id']})"] = null;
}
$statusAry = $this->ci->mdOrders->statusAry($status_pid);
if ($params['list_type'] == 'all') {
@@ -980,12 +960,7 @@ class OrdersList
$where["{$t2}.payway"] = $params['payway'];
}
if ($params['qdjl_id']) {//渠道经理
$re_bu = $this->ci->mdLichebUsers->get(array('id' => $params['qdjl_id']));
if ($re_bu['biz_id']) {
$where["biz_id in({$re_bu['biz_id']})"] = null;
} else {
$where['biz_id'] = -1;
}
$where["$t2.biz_id in(select biz_id from lc_app_licheb_channel_biz where uid={$params['qdjl_id']})"] = null;
}
$statusAry = $this->ci->mdOrders->statusAry($status_pid);
if ($params['list_type'] == 'all') {
@@ -1189,12 +1164,7 @@ class OrdersList
$where["{$t2}.payway"] = $params['payway'];
}
if ($params['qdjl_id']) {//渠道经理
$re_bu = $this->ci->mdLichebUsers->get(array('id' => $params['qdjl_id']));
if ($re_bu['biz_id']) {
$where["biz_id in({$re_bu['biz_id']})"] = null;
} else {
$where['biz_id'] = -1;
}
$where["$t2.biz_id in(select biz_id from lc_app_licheb_channel_biz where uid={$params['qdjl_id']})"] = null;
}
$statusAry = $this->ci->mdOrders->statusAry($status_pid);
if ($params['list_type'] == 'all') {
@@ -1397,12 +1367,7 @@ class OrdersList
$where["{$t2}.payway"] = $params['payway'];
}
if ($params['qdjl_id']) {//渠道经理
$re_bu = $this->ci->mdLichebUsers->get(array('id' => $params['qdjl_id']));
if ($re_bu['biz_id']) {
$where["biz_id in({$re_bu['biz_id']})"] = null;
} else {
$where['biz_id'] = -1;
}
$where["$t2.biz_id in(select biz_id from lc_app_licheb_channel_biz where uid={$params['qdjl_id']})"] = null;
}
$statusAry = $this->ci->mdOrders->statusAry($status_pid);
if ($params['list_type'] == 'all') {
+171
View File
@@ -0,0 +1,171 @@
<div class="coms-table-wrap mt10">
<form id="vue-app" class=" form-search coms-table-hd clearfix no-border" onsubmit="return false"
action="/app/licheb/channel">
<div class="am-form am-form-horizontal">
<div class="am-form-group fl">
<label class="am-para-label w100">姓名:</label>
<div class="am-para-inline w150">
<input type="text" name="uname" value="<?= $params['uname'] ?>"/>
</div>
</div>
<div class="am-form-group fl">
<label class="am-para-label w100">手机号码:</label>
<div class="am-para-inline w150">
<input type="text" name="mobile" value="<?= $params['mobile'] ?>"/>
</div>
</div>
<div class="am-form-group fl ml20">
<button type="submit" class="am-btn am-btn-success am-btn-sm w100">搜索</button>
</div>
</div>
</form>
<div class="coms-table-bd">
<div class="fr">共有<?= $pager['totle'] ?>条数据</div>
<table class="am-table am-table-bordered">
<thead>
<tr>
<th width="4%"><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="10%"><span>操作</span></th>
</tr>
</thead>
<tbody>
<?php foreach ($lists as $v) { ?>
<tr>
<td><?= $v['id'] ?></td>
<td><?= $v['uname'] ?></td>
<td><?= $v['mobile'] ?></td>
<td><?= $v['bizs'] ?></td>
<td><?= $v['c_time'] ?></td>
<td><a data-open="/app/licheb/channel/lists_biz?uid=<?= $v['id'] ?>"
class="am-btn am-btn-primary am-btn-xs">门店列表</a></td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
<div class="coms-table-ft clearfix">
<div class="coms-pagination fr mr20">
<?php page_view($pager) ?>
</div>
</div>
</div>
<script>
var vm = new Vue({
el: '#vue-app',
data: {
params: [],
cityAry: [],//城市
countyAry: [],//行政区
bizAry: [],
province_id: '350'
},
mounted: function () {
var vm = this;
vm.params = <?=json_encode($params)?>;
vm.init_citys(vm.province_id);
},
methods: {
init_citys: function (province_id) {
var vm = this;
$.ajax({
type: 'get',
url: '/common/area',
dataType: 'json',
data: {
id: province_id,
key: 'city',
type: 1
},
success: function (response) {
if (response.code == 1) {
vm.cityAry = response.data;
}
}
});
},
get_bizs: function () {
var that = this;
if (that.params.city_id > 0 || that.params.county_id > 0) {
$.ajax({
type: 'post',
url: '/biz/store/store/json_lists',
dataType: 'json',
data: {
province_id: that.province_id,
city_id: that.params.city_id,
county_id: that.params.county_id,
status: 1
},
success: function (response) {
if (response.code == 1) {
that.bizAry = response.data.list;
if (that.params.biz_id > 0) {
var biz_id = '';
for (var i in that.bizAry) {
if (that.params.biz_id == that.bizAry[i].id) {
biz_id = that.params.biz_id;
break;
}
}
that.params.biz_id = biz_id;
}
}
}
});
} else {
that.bizAry = [];
that.params.biz_id = '';
}
}
},
watch: {
'params.city_id': function (nv, ov) {
var that = this;
if (nv == '') {
that.countyAry = [];
that.params.county_id = '';
} else {
if (nv.substring(0, 4) != that.params.county_id.substring(0, 4)) {
that.params.county_id = '';
}
$.ajax({
type: 'get',
url: '/common/area',
dataType: 'json',
data: {
id: nv,
key: 'county',
type: 1
},
success: function (response) {
if (response.code == 1) {
that.countyAry = response.data;
}
}
});
}
that.get_bizs();
},
'params.county_id': function (nv, ov) {
var that = this;
that.get_bizs();
}
}
});
$(function () {
<?php page_script($pager) ?>
});
$('#majia').change(function () {
$('#vue-app').submit();
});
$('#dealer').change(function () {
$('#vue-app').submit();
});
</script>
@@ -0,0 +1,136 @@
<div class="coms-table-wrap mt10">
<form id="vue-app" class=" form-search coms-table-hd clearfix no-border" onsubmit="return false"
action="/app/licheb/channel/lists_biz">
<input type="hidden" name="uid" value="<?= $params['uid'] ?>"/>
<div class="am-form am-form-horizontal">
<div class="am-form-group fl">
<label class="am-para-label w100">门店:</label>
<div class="am-para-inline w200">
<input type="text" name="biz_name" value="<?= $params['biz_name'] ?>"/>
</div>
</div>
<div class="am-form-group fl">
<label class="am-para-label w80">地区:</label>
<div class="am-form-group am-para-inline w150">
<select title="城市" name="city_id" v-model="params.city_id">
<option value="">城市</option>
<option :value="v.id" v-for="(v,i) in cityAry">{{v.name}}</option>
</select>
</div>
<div class="am-form-group am-para-inline w150">
<select title="行政区" name="county_id" v-model="params.county_id">
<option value="">行政区</option>
<option :value="v.id" v-for="(v,i) in countyAry">{{v.name}}</option>
</select>
</div>
</div>
<div class="am-form-group fl ml20">
<button type="submit" class="am-btn am-btn-success am-btn-sm w100">搜索</button>
</div>
</div>
</form>
<div class="coms-table-bd">
<div class="fr">共有<?= $pager['totle'] ?>条数据</div>
<table class="am-table am-table-bordered">
<thead>
<tr>
<th width="20%"><span>门店</span></th>
<th width="20%"><span>地区</span></th>
<th width="10%"><span>未见客户数</span></th>
<th width="10%"><span>到店客户数</span></th>
<th width="10%"><span>订单客户数</span></th>
<th width="10%"><span>战败客户数</span></th>
<th width="10%"><span>订单数</span></th>
<th width="10%"><span>创建时间</span></th>
</tr>
</thead>
<tbody>
<?php foreach ($lists as $v) { ?>
<tr>
<td><?= $v['biz_name'] ?></td>
<td><?= $v['county_name'] ?></td>
<td><?= $v['wjkhs'] ?></td>
<td><?= $v['dtkhs'] ?></td>
<td><?= $v['ddkhs'] ?></td>
<td><?= $v['zbkhs'] ?></td>
<td><?= $v['orders'] ?></td>
<td><?= $v['days'] ?></td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
<div class="coms-table-ft clearfix">
<div class="coms-pagination fr mr20">
<?php page_view($pager) ?>
</div>
</div>
</div>
<script>
var vm = new Vue({
el: '#vue-app',
data: {
params: [],
cityAry: [],//城市
countyAry: [],//行政区
province_id: '350'
},
mounted: function () {
var vm = this;
vm.params = <?=json_encode($params)?>;
vm.init_citys(vm.province_id);
},
methods: {
init_citys: function (province_id) {
var vm = this;
$.ajax({
type: 'get',
url: '/common/area',
dataType: 'json',
data: {
id: province_id,
key: 'city',
type: 1
},
success: function (response) {
if (response.code == 1) {
vm.cityAry = response.data;
}
}
});
}
},
watch: {
'params.city_id': function (nv, ov) {
var that = this;
if (nv == '') {
that.countyAry = [];
that.params.county_id = '';
} else {
if (nv.substring(0, 4) != that.params.county_id.substring(0, 4)) {
that.params.county_id = '';
}
$.ajax({
type: 'get',
url: '/common/area',
dataType: 'json',
data: {
id: nv,
key: 'county',
type: 1
},
success: function (response) {
if (response.code == 1) {
that.countyAry = response.data;
}
}
});
}
}
}
});
$(function () {
<?php page_script($pager) ?>
});
</script>
+107 -89
View File
@@ -1,15 +1,16 @@
<form id="vue-edit" class="am-form am-form-horizontal" action="<?=$action?>" data-auto="true" method="post" style="width: 90%;padding-top: 10px">
<input type="hidden" name="id" value="<?=$row['id']?>"/>
<form id="vue-edit" class="am-form am-form-horizontal" action="<?= $action ?>" data-auto="true" method="post"
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">
<input type="text" placeholder="输入姓名" name="uname" v-model="info.uname" maxlength="30"/>
<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">
<input type="text" placeholder="输入手机号" name="mobile" v-model="info.mobile" maxlength="30"/>
<input type="text" placeholder="输入手机号" name="mobile" v-model="info.mobile" maxlength="30"/>
</div>
</div>
<div class="am-form-group">
@@ -21,18 +22,31 @@
</select>
</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">
<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>
</select>
</div>
</div>
<div class="am-form-group">
<label class="am-para-label">门店:</label>
<div class="am-para-inline lh-default">
<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" v-for="(item) in selectedBrands">{{item.name}}</button>
<button class="am-btn am-btn-default mr5" type="button" @click="brandModal"
v-for="(item) in selectedBrands">{{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></div>
<div class="am-para-input">
<button class="am-btn am-btn-success" type="button" @click='saveEdit'>提交</button>
</div>
</div>
<div id="brand-modal" style="display:none">
<div class="modal-body">
@@ -40,110 +54,114 @@
<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="info.city_id">
<option value="0">城市</option>
<select title="城市" v-model="search_info.city_id">
<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="行政区" name="county_id" v-model="info.county_id">
<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 fl ml10">
<a class="am-btn am-btn-success am-btn-sm w100" @click="search()">搜索</a>
<div class="am-form-group am-para-inline w150">
<select title="行政区" v-model="search_info.county_id">
<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 fl ml10">
<a class="am-btn am-btn-success am-btn-sm w100" @click="search()">搜索</a>
</div>
</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 brandsList">
<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="addItem(i)">添加
</button>
<button type='button' v-if="v.is_checked==1" class="btn btn-sm btn-danger"
@click="removeItem(v)">删除
</button>
</td>
</tr>
</tbody>
</table>
<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 brandsList">
<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="addItem(i)">添加
</button>
<button type='button' v-if="v.is_checked==1" class="btn btn-sm btn-danger"
@click="removeItem(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="beforeShopPage();" aria-label="上一页">
<span class="glyphicon glyphicon-menu-left"></span>
</a>
</li>
<li v-if="brandsPage.hasNext">
<a href="javascript:void(0);" @click="afterShopPage();" aria-label="下一页">
<span class="glyphicon glyphicon-menu-right"></span>
</a>
</li>
</ul>
</nav>
</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="beforeShopPage();" aria-label="上一页">
<span class="glyphicon glyphicon-menu-left"></span>
</a>
</li>
<li v-if="brandsPage.hasNext">
<a href="javascript:void(0);" @click="afterShopPage();" aria-label="下一页">
<span class="glyphicon glyphicon-menu-right"></span>
</a>
</li>
</ul>
</nav>
</div>
</div>
</div>
</form>
<script type="text/javascript">
var vue_app;
var loading = false;
$(function(){
$(function () {
vue_app = new Vue({
el: '#vue-edit',
data: {
info:{},
groups:[],
biz: { bizAry: [], biz_id: ''},
info: {},
groups: [],
biz: {bizAry: [], biz_id: ''},
brandsThPage: 0,
brandsPage: [],
bizIds:[],
brandsList:[],
bizIds: [],
brandsList: [],
selectedBrands: [],
cityAry: [],
countyAry: [],
show_info: {cityList: []},
search_info: {city_id: 0, county_id: 0}
},
computed: {},
created: function () {
},
updated: function () {
},
mounted:function() {
mounted: function () {
var vm = this;
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.selectedBrands = <?=json_encode($selectedBrands, JSON_UNESCAPED_UNICODE)?>;
vm.show_info = <?=json_encode($show_info, JSON_UNESCAPED_UNICODE)?>;
vm.init_citys();
},
methods: {
resetBiz:function(){
resetBiz: function () {
this.selectedBrands = [];
},
search: function () {
@@ -177,16 +195,16 @@
biz_id: biz_id,
name: vm.brandsList[index]['name'],
};
if(vm.info.group_id==4){
if (vm.info.group_id == 4) {
vm.selectedBrands.push(_shop);
vm.brandsList[index]['is_checked'] = 1;
}else{
} else {
vm.selectedBrands = [];
vm.selectedBrands.push(_shop);
this.brandsList.map(function (_item, _index) {
if(vm.brandsList[index]['id']==_item['id']){
if (vm.brandsList[index]['id'] == _item['id']) {
vm.brandsList[_index]['is_checked'] = 1;
}else{
} else {
vm.brandsList[_index]['is_checked'] = 0;
}
})
@@ -194,12 +212,12 @@
},
removeItem: function (item) {
var vm = this;
if(vm.info.group_id==4){
if (vm.info.group_id == 4) {
this.selectedBrands = this.selectedBrands.filter(function (_item) {
var id = _item.biz_id > 0 ? _item.biz_id : _item.brand_id;
return id != item.id;
})
}else{
} else {
vm.selectedBrands = [];
}
this.brandsList.map(function (_item, _index) {
@@ -228,8 +246,8 @@
dataType: 'json',
data: {
page: that.brandsThPage,
city_id: that.info.city_id,
county_id: that.info.county_id
city_id: that.search_info.city_id,
county_id: that.search_info.county_id
},
success: function (json) {
var brandsList = json.data.shopList;
@@ -257,8 +275,8 @@
vm.cityAry = response.data;
}
});
if (vm.info.city_id > 0) {
$.get('common/area', {id: vm.info.city_id, key: 'county', type: 1}, function (response) {
if (vm.search_info.city_id > 0) {
$.get('common/area', {id: vm.search_info.city_id, key: 'county', type: 1}, function (response) {
if (response.code == 1) {
vm.countyAry = response.data;
}
@@ -305,12 +323,12 @@
});
}
},
watch:{
'info.city_id': function (nv, ov) {
watch: {
'search_info.city_id': function (nv, ov) {
var that = this;
if (nv == '') {
that.countyAry = [];
that.info.county_id = 0;
that.search_info.county_id = 0;
} else {
$.get('common/area', {id: nv, key: 'county', type: 1}, function (response) {
if (response.code == 1) {
+13 -5
View File
@@ -14,6 +14,18 @@
<input type="text" name="mobile" value="<?= $mobile ?>"/>
</div>
</div>
<div class="am-form-group">
<label class="am-para-label w100">角色:</label>
<div class="am-para-inline w150">
<select name="group_id">
<option value="">全部</option>
<?php foreach ($groupAry as $key => $value) { ?>
<option value="<?= $key ?>"
<?= $key == $params['group_id'] ? 'selected' : '' ?>><?= $value ?></option>
<? } ?>
</select>
</div>
</div>
<div class="am-form-group fl">
<label class="am-para-label w100">门店:</label>
<div class="am-form-group am-para-inline w150">
@@ -65,11 +77,7 @@
<td><?= $v['uname'] ?></td>
<td><?= $v['mobile'] ?></td>
<td><?= $v['group_name'] ?></td>
<td>
<?php foreach ($v['bizs'] as $val) { ?>
<span><?= $val['biz_name'] ?></span><br>
<? } ?>
</td>
<td><?= $v['biz_name'] ?></td>
<td><?= date('Y-m-d H:i:s', $v['c_time']) ?></td>
</tr>
<tr>
+153 -1
View File
@@ -142,6 +142,10 @@
</tr>
<tr>
<td colspan="5" class="align-r">
<a href="javascript:void(0);" class="am-btn am-btn-primary am-btn-xs"
@click="channel_modal(<?= $v['id'] ?>)">渠道归属</a>
<a href="javascript:void(0);" class="am-btn am-btn-primary am-btn-xs"
@click="biz_manage_modal(<?= $v['id'] ?>)">门店管理员</a>
<a class="am-btn am-btn-primary am-btn-xs"
data-modal="/common/share_link?id=<?= $v['id'] ?>&app_id=1&pages=storeInfo"
data-title="狸车小程序店铺首页">分享链接</a>
@@ -177,7 +181,61 @@
<?php page_view($pager) ?>
</div>
</div>
<div id="channel-modal" style="display: none;">
<div class="am-form am-form-horizontal">
<div class="am-form-group" style="padding-top: 15px">
<label class="am-para-label">渠道经理:</label>
<div class="am-para-input">
<div class="am-g">
<label class="am-checkbox-inline" v-for="(v,i) in qdjl_lists">
<input type="checkbox" :value="v.id" v-model="channel_uid"/> {{v.name}}
</label>
</div>
</div>
</div>
</div>
</div>
<div id="biz_manage-modal" style="display: none;">
<div class="am-form am-form-horizontal" style="padding-top: 15px">
<div class="am-form-group">
<label class="am-para-label">角色:</label>
<div class="am-para-input">
<div class="am-g">
<select v-model="biz_manage.group_id" style="width: 150px;">
<option value="1">销售</option>
<option value="2">店长</option>
<option value="3">老板</option>
</select>
</div>
</div>
</div>
<div class="am-form-group">
<label class="am-para-label">管理员:</label>
<div class="am-para-input">
<div class="am-g">
<div class="col-sm-4" style="padding-left: 0px;">
<input type="text" v-model="biz_manage.admin_name" placeholder="门店管理员关键字"/>
</div>
<div class="col-sm-3" style="padding-top: 3px;">
<button type="button" class="am-btn am-btn-success am-btn-sm w100" @click="users_group">
搜索
</button>
</div>
</div>
</div>
</div>
<div class="am-form-group">
<label class="am-para-label">请选择:</label>
<div class="am-para-input">
<div class="am-g">
<label class="am-checkbox-inline" v-for="(v,i) in biz_manage.admins">
<input type="checkbox" :value="v.id" v-model="biz_manage.admin_id"/> {{v.name}}
</label>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
var vm = new Vue({
@@ -190,6 +248,8 @@
},
params: [],
qdjl_lists: [],
channel_uid: [],
biz_manage: {admins: [], group_id: 1, admin_id: 0, biz_id: 0, admin_name: ''},
companyAry:<?=$companyAry ? json_encode($companyAry) : '[]'?>
},
mounted: function () {
@@ -198,6 +258,98 @@
vm.qdjl_lists = <?=json_encode($qdjl_lists)?>;
},
methods: {
channel_modal: function (biz_id) {
//选择渠道归属
var vm = this;
vm.channels = [];
$.ajax({
type: 'get',
url: '/app/licheb/member/get_channel_uid',
dataType: 'json',
data: {biz_id: biz_id},
success: function (response) {
if (response.code == 1) {
vm.channel_uid = response.data;
}
}
});
layer.open({
type: 1,
area: ['50%'], //宽高
content: $('#channel-modal'),
title: '渠道归属',
shade: false,
btn: ['保存选择'],
yes: function (index) {
layer.close(index);
$.ajax({
type: 'post',
url: '/app/licheb/member/edit_channel_uid',
dataType: 'json',
data: {biz_id: biz_id, channel_uid: vm.channel_uid},
success: function (response) {
if (response.code == 1) {
layer.msg(response.msg, {icon: 1});
} else {
layer.msg(response.msg, {icon: 2});
}
}
});
}
});
},
biz_manage_modal: function (biz_id) {
//选择门店管理员
var vm = this;
vm.biz_manage = {admins: [], group_id: 1, admin_id: 0, biz_id: biz_id, admin_name: ''};
vm.users_group();
layer.open({
type: 1,
area: ['50%'], //宽高
content: $('#biz_manage-modal'),
title: '门店管理员',
shade: false,
btn: ['保存选择'],
yes: function (index) {
layer.close(index);
$.ajax({
type: 'post',
url: '/app/licheb/member/edit_users_group',
dataType: 'json',
data: {biz_manage: vm.biz_manage},
success: function (response) {
if (response.code == 1) {
layer.msg(response.msg, {icon: 1});
} else {
layer.msg(response.msg, {icon: 2});
}
}
});
}
});
},
users_group: function () {
var vm = this;
if (!vm.biz_manage.group_id) {
return;
}
$.ajax({
type: 'get',
url: '/app/licheb/member/get_users_group',
dataType: 'json',
data: {
group_id: vm.biz_manage.group_id,
biz_id: vm.biz_manage.biz_id,
admin_name: vm.biz_manage.admin_name
},
success: function (response) {
if (response.code == 1) {
vm.biz_manage.admins = response.data.admins;
vm.biz_manage.admin_id = response.data.admin_id;
}
}
});
},
getBrandList: function () {
var _self = this;
_self.brand_id = '';
+50
View File
@@ -16,6 +16,56 @@ class Temp extends HD_Controller
$this->log_file = 'temp.log';
}
/**
* Notes:更新狸车宝渠道门店
* Created on: 2021/9/18 11:58
* Created by: dengbw
* https://liche-api-dev.xiaoyu.com/plan/temp/channel_biz
* https://api.liche.cn/plan/temp/channel_biz
*/
public function channel_biz()
{
$this->load->model('app/licheb/App_licheb_users_model', 'mdUsers');
$this->load->model('app/licheb/App_licheb_channel_biz_model', 'mdChannelBiz');
$param = $this->input->get();
$param['page'] = intval($param['page']);
$param['size'] = intval($param['size']);
!$param['size'] && $param['size'] = 50;
!$param['page'] && $param['page'] = 1;
$counts = intval($param['counts']);
ob_start(); //打开缓冲区
$where = array('status ' => 1, 'group_id' => 4);
$res = $this->mdUsers->select($where, 'id ASC', $param['page'], $param['size'], 'id,biz_id,uname');
if (!$res) {
echo '<br>本次更新狸车宝渠道门店完成了:';
echo '<br><br>成功更新 <span style="color: red;">' . $counts . '</span> 条';
echo '<br><br><a href="/plan/temp/channel_biz">点击将再次更新狸车宝渠道门店>>></a>';
exit;
}
$log = array();
foreach ($res as $key => $value) {
if ($value['biz_id']) {
$biz_id_arr = explode(',', $value['biz_id']);
foreach ($biz_id_arr as $key2 => $value2) {
$where = ["uid" => $value['id'], 'biz_id' => $value2];
$re_cb = $this->mdChannelBiz->get($where);
if (!$re_cb) {
$where['c_time'] = time();
$this->mdChannelBiz->add($where);
}
}
$log[] = array('uname' => $value['uname'], 'biz_id' => $value['biz_id']);
$counts++;
}
}
echo '<br>成功更新:';
$log && print_r($log);
echo '<br><br>数据库获取:';
echo json_encode($res, JSON_UNESCAPED_UNICODE);
header('refresh:3;url=/plan/temp/channel_biz?counts=' . $counts . '&size=' . $param['size'] . '&page=' . ($param['page'] + 1));
ob_end_flush();//输出全部内容到浏览器
}
/**
* Notes:更新商品操作日志
* Created on: 2021/9/18 11:58
+1 -1
View File
@@ -25,7 +25,7 @@ class City extends Wxapp{
$size = $this->input_param('size');
!$page && $page = 1;
!$size && $size = 20;
$default_city = 350200;
$default_city = $this->session['city_id'] ? $this->session['city_id'] : 350200;
$where = [
'status' => 1
+32 -15
View File
@@ -22,10 +22,8 @@ class Area_model extends HD_Model
$result = array();
$list = $this->select(null, null, null, null, 'distinct(province_id), province_name');
if($list)
{
foreach ($list as $v)
{
if ($list) {
foreach ($list as $v) {
$result[$v['province_id']] = array(
'id' => $v['province_id'],
'name' => $v['province_name'],
@@ -36,15 +34,13 @@ class Area_model extends HD_Model
return $result;
}
public function city($province_id = '',$type = 0)
public function city($province_id = '', $type = 0)
{
$result = array();
$list = $this->select(array('province_id' => $province_id), null, null, null, 'distinct(city_id), city_name, firstchar');
$type == 0 && $result[] = array('name'=>'城市','id'=>'');
if($list)
{
foreach ($list as $v)
{
$type == 0 && $result[] = array('name' => '城市', 'id' => '');
if ($list) {
foreach ($list as $v) {
$item = array(
'id' => $v['city_id'],
'name' => $v['city_name'],
@@ -61,11 +57,9 @@ class Area_model extends HD_Model
{
$result = array();
$list = $this->select(array('city_id' => $city_id), null, null, null, 'distinct(county_id), county_name');
$type == 0 && $result[] = array('name'=>'行政区','id'=>'');
if($list)
{
foreach ($list as $v)
{
$type == 0 && $result[] = array('name' => '行政区', 'id' => '');
if ($list) {
foreach ($list as $v) {
$result[$v['county_id']] = array(
'id' => $v['county_id'],
'name' => $v['county_name'],
@@ -75,4 +69,27 @@ class Area_model extends HD_Model
return $result;
}
/**
* Notes:根据county_id获取数据
* Created on: 2021/11/16 14:18
* Created by: dengbw
* @param $ids
* @param string $fileds
* @param string $map_key
* @return array
*/
public function get_map_by_county_ids($ids, $fileds = '', $map_key = 'id')
{
$rows = [];
$ids = array_filter($ids);
if ($ids) {
$cf_ids = implode(',', $ids);
$where = [
"county_id in ($cf_ids)" => null
];
$rows = $this->map($map_key, '', $where, '', '', '', $fileds);
}
return $rows;
}
}