function index() { $p = $this->_getid('p', 1); $group = $this->_getid('group', 0); $q = $this->_get('q'); $where = 'a.city_id=' . steadmin::$adminInfo['city_id']; $countWehre = array('city_id' => steadmin::$adminInfo['city_id']); if ($group) { $where .= ' AND a.groupid=' . ($group - 1); $countWehre['groupid'] = $group - 1; } if ($q) { $where .= " AND a.real_name LIKE '%" . parent::safeSearch($q) . "%'"; $countWehre['LIKE'] = array('real_name' => $q); } if (steadmin::$adminInfo['groupid'] == 7) { //总店 $where .= ' AND a.build_uid=' . steadmin::$adminInfo['user_id']; $countWehre['build_uid'] = steadmin::$adminInfo['user_id']; } if (parent::_checkIsPresident()) { //社长 $where .= ' AND a.service_id=' . steadmin::$adminInfo['service_id']; $countWehre['service_id'] = steadmin::$adminInfo['service_id']; } $pageShow = 20; $rs = D('steadmin')->query('SELECT a.*,b.stitle AS areaName FROM __TABLE__ AS a LEFT JOIN __PRE__ste_service AS b ON a.service_id=b.sid WHERE ' . $where . ' ORDER BY a.user_id DESC LIMIT ' . ($p - 1) * $pageShow . ',' . $pageShow); $total = D('steadmin')->where($countWehre)->count(); $this->assign(array('rs' => $rs, 'status' => $this->status, 'group' => $this->adminConfig['group'], 'p' => $p, 'total' => $total, 'group_id' => $group, 'setting' => $this->steSetting)); $this->display(); }
/** * 列表 */ public function index() { parent::_authUser(array(1, 2, 5, 7, 8, 9)); $title = $this->_get('q'); //关键字搜索 $areaId = $this->_getid('area_id', 0); //城区 $serviceId = $this->_getid('service_id', 0); //商圈 $shopType = $this->_getid('shop_type', 0); //店铺类型 $tips = $this->_getid('tips', 0); //参与活动 $status = $this->_getid('status', 2); //状态 $p = $this->_getid('p', 1); $where = array('AND' => array('city_id' => steadmin::$adminInfo['city_id'])); if ($title) { $where['LIKE'] = array('shop_name' => parent::safeSearch($title)); } if ($tips) { $where['LIKE'] = array('tips_list' => ',' . ($tips - 1) . ','); } if ($areaId) { $where['AND']['area_id'] = $areaId; } if ($serviceId) { $where['AND']['service_id'] = $serviceId; } if ($shopType) { $where['AND']['shop_type'] = $shopType - 1; } if ($status) { $where['AND']['status'] = $status - 1; } //DOTO:后期可能会让另外的帐号也可以来管理这个店(比喻品牌创建了多个分店,那么品牌可以管理所有的分店,分店也可以管理自己的店),那么需要额外指定管理权限 if (!parent::_checkIsAdmin()) { if (steadmin::$adminInfo['groupid'] == 8) { //店长 $where['AND']['shop_id'] = steadmin::$adminInfo['shop_id']; } elseif (parent::_checkIsPresident()) { $where['AND']['service_id'] = steadmin::$adminInfo['service_id']; } else { $where['AND']['user_id'] = steadmin::$adminInfo['user_id']; } } $rs = M('ste_shop')->where($where)->page($p)->order('shop_id DESC')->findAll(); $total = M('ste_shop')->getTotal(); // z(M('ste_shop')->getAllSql()); // z($rs); if ($rs) { foreach ($rs as $k => $v) { $rs[$k]['userName'] = parent::_getAdminName($v['user_id']); $rs[$k]['tipsList'] = implode(',', parent::_getTipsGroupList($this->steSetting['shop_tips'], $v['tips_list'])); $rs[$k]['areaName'] = parent::getAreaName($v['area_id']); $rs[$k]['serviceName'] = isset($this->serviceData[$v['service_id']]) ? $this->serviceData[$v['service_id']]['stitle'] : ''; $rs[$k]['stime'] = date('H:i', strtotime($v['stime'])); $rs[$k]['etime'] = date('H:i', strtotime($v['etime'])); } } $this->assign(array('adminData' => $this->adminData, 'service' => $this->serviceData, 'area' => M('area')->field('aid,name')->where(array('city_id' => steadmin::$adminInfo['city_id'], 'area_level' => 2))->findAll(false), 'rs' => $rs, 'total' => $total, 'p' => $p, 'area_id' => $areaId, 'service_id' => $serviceId, 'shop_type' => $shopType, 'title' => $title, 'tips_id' => $tips, 'status' => $status, 'setting' => $this->steSetting)); $this->display(); }
/** * 列表 */ public function index() { parent::_authUser(array(1, 2, 5, 6, 7, 8, 9)); $title = $this->_get('q'); //关键字搜索 $st = $this->_get('st', 'order_sn'); //关键字搜索 $deal = $this->_get('deal', ''); //分组查看 $orderType = $this->_getid('order_type', 0); //类别 $serviceId = $this->_getid('service_id', 0); //服务社 $villageId = $this->_getid('village_id', 0); //小区 $orderSource = $this->_getid('order_source', 0); //客户端 $uid = $this->_getid('uid', 0); //商圈 $startTime = $this->_get('stime', ''); //开始时间 $endTime = $this->_get('etime', ''); //结束时间 $status = $this->_getid('status', 0); //状态 $p = $this->_getid('p', 1); $searchType = array('order_sn' => 'order_sn', 'phone' => 'phone', 'username' => 'username'); $dealAction = array('service' => array('status' => array(1, 3, 4, 5, 13), 'arrive_date[<=]' => mktime(0, 0, 0, date('m'), date('d'), date('Y'))), 'finance' => array('status' => array(9, 10))); //报表页面每页显示数量为100 if ($deal == 'report') { jumpTo(U('report/today')); } $where = array(); if ($deal && isset($dealAction[$deal])) { $where = $dealAction[$deal]; } if (isset($_GET['q']) && !$_GET['q']) { unset($_GET['q']); } if ($deal == 'service') { $pageShow = 80; } else { $pageShow = 20; } if ($title && $st == 'user') { $user = D('member')->field('uid')->where(array('nickname' => $title))->findAll(false); if ($user) { $uid = array(); foreach ($user as $v) { $uid[] = $v['uid']; } $title = ''; } } elseif ($title && $st == 'uid') { $uid = $title; $title = ''; } if ($title && isset($searchType[$st])) { $where['LIKE'] = array($searchType[$st] => parent::safeSearch($title)); } if ($orderType) { $where['order_type'] = $orderType - 1; } if ($serviceId) { $where['service_id'] = $serviceId; } if ($villageId) { $where['village_id'] = $villageId; } if ($orderSource) { $where['order_source'] = $orderSource - 1; } if ($uid) { $where['uid'] = $uid; } if ($startTime && $endTime) { $where['arrive_date[>=]'] = inTime($startTime); $where['arrive_date[<=]'] = inTime($endTime) + 60 * 60 * 24 - 1; } if ($status) { $where['status'] = $status - 1; } if (parent::_checkIsPresident()) { //社长 $where['service_id'] = steadmin::$adminInfo['service_id']; } elseif (!parent::_checkIsAdmin()) { showError('抱歉,暂时无法查看所属订单'); } $rs = M('ste_order')->where($where)->page($p, $pageShow)->order('order_id DESC')->findAll(); $total = M('ste_order')->getTotal(); // z(M('ste_shop')->getAllSql()); // z($rs); if ($rs) { foreach ($rs as $k => $v) { $userName = getUser($v['uid']); $rs[$k]['userName'] = $userName ? $userName : $v['username']; $rs[$k]['villageName'] = parent::getVillageName($v['village_id']); $rs[$k]['serviceName'] = isset($this->serviceData[$v['service_id']]) ? $this->serviceData[$v['service_id']]['stitle'] : ''; } } $lastOrderId = M('ste_order')->order('order_id DESC')->getField('order_id'); // $this->steSetting['order_status'][1] = '<span class="red">已支付</span>'; $this->assign(array('pageShow' => $pageShow, 'rs' => $rs, 'total' => $total, 'p' => $p, 'lastOrderId' => $lastOrderId, 'service_id' => $serviceId, 'order_type' => $orderType, 'startTime' => $startTime, 'endTime' => $endTime, 'title' => $title, 'status' => $status, 'orderSource' => $orderSource, 'service' => $this->serviceData, 'setting' => $this->steSetting, 'setOrderStaus' => $this->setOrderStatus)); $this->display(); }
/** * 列表 */ public function index() { parent::_checkLogin(); parent::_authUser(array(1, 2, 5, 7, 8, 9)); $title = $this->_get('q'); //关键字搜索 $st = $this->_get('st', 'name'); //关键字搜索 $cateId = $this->_getid('cate_id', 0); //类别 $shopId = $this->_getid('shop_id', 0); //店铺 $userId = $this->_getid('user_id', 0); //创建者 $tips = $this->_getid('tips', 0); //参与活动 $act = $this->_get('act', ''); //属性 是否热门、新品、推荐 $startTime = $this->_get('stime', ''); //开始时间 $endTime = $this->_get('etime', ''); //结束时间 $status = $this->_getid('status', 2); //状态 $orderby = $this->_getid('orderby', 0); //状态 $deal = $this->_get('deal', ''); //分组查看 $p = $this->_getid('p', 1); $pageShow = $this->_getid('pageshow', 20); $pageShowList = array(20 => 20, 40 => 40, 60 => 60, 80 => 80, 100 => 100); $actList = array('is_realtime' => '预约', 'is_hot' => '热门', 'is_new' => '新品', 'is_recommend' => '推荐', 'is_limited' => '特价'); $searchType = array('name' => 'goods_name', 'subtitle' => 'goods_subtitle', 'sn' => 'goods_sn', 'bar' => 'bar_code', 'number' => 'goods_number'); $orderType = array('默认', '价格高到低↓', '价格低到高↑', '下单高到低↓', '下单低到高↑', '销量高到低↓', '销量低到高↑', '库存高到低↓', '库存低到高↑'); $orderList = array('gid DESC', 'price DESC', 'price ASC', 'order_counts DESC', 'order_counts ASC', 'sale_counts DESC', 'sale_counts ASC', 'storage_counts DESC', 'storage_counts ASC'); $dealAction = array('storage' => array('storage_counts[<=]' => $this->minStorage)); if (!isset($orderType[$orderby])) { $orderby = 0; } if (!isset($pageShowList[$pageShow])) { $pageShow = 20; } $where = array(); if (!$title) { unset($_GET['q']); } if (!$startTime || !$endTime) { unset($_GET['stime'], $_GET['etime']); } if (!$act) { unset($_GET['act']); } if (!$deal) { unset($_GET['deal']); } if ($title && isset($searchType[$st])) { $where['LIKE'] = array($searchType[$st] => parent::safeSearch($title)); } if ($deal && isset($dealAction[$deal])) { $where = $dealAction[$deal]; } if ($tips) { $where['LIKE'] = array('goods_tips' => ',' . ($tips - 1) . ','); } if ($cateId) { $where['cate_id'] = $cateId; } if ($shopId) { $where['shop_id'] = $shopId; } if ($userId) { $where['user_id'] = $userId; } if ($act && in_array($act, array_keys($actList))) { $where[$act] = 1; } if ($startTime && $endTime) { $where['info_time[>=]'] = inTime($startTime); $where['info_time[<=]'] = inTime($endTime) + 60 * 60 * 24 - 1; } if ($status && $status != 3) { $where['status'] = $status - 1; } //DOTO:后期可能会让另外的帐号也可以来管理这个店(比喻品牌创建了多个分店, //那么品牌可以管理所有的分店,分店也可以管理自己的店),那么需要额外指定管理权限 if (!parent::_checkIsAdmin()) { if (steadmin::$adminInfo['groupid'] == 8) { //店长 $where['shop_id'] = steadmin::$adminInfo['shop_id']; } elseif (parent::_checkIsPresident()) { $where['service_id'] = steadmin::$adminInfo['service_id']; } else { $myShopList = M('ste_shop')->field('shop_id,shop_name')->where(array('user_id' => steadmin::$adminInfo['user_id'], 'status' => 1))->select('shop_id'); $where['shop_id'] = array_keys($myShopList); } } $rs = M('ste_goods')->where($where)->page($p, $pageShow)->order($orderList[$orderby])->findAll(); $total = M('ste_goods')->getTotal(); // z(M('ste_shop')->getAllSql()); // z($rs); if ($rs) { foreach ($rs as $k => $v) { $rs[$k]['cateName'] = parent::_getCateName($v['cate_id']); $rs[$k]['tipsList'] = implode(',', parent::_getTipsGroupList($this->steSetting['goods_tips'], $v['goods_tips'])); $rs[$k]['shopName'] = parent::_getShopName($v['shop_id']); $rs[$k]['userName'] = parent::_getAdminName($v['user_id']); $rs[$k]['saleStatus'] = $this->getStatus($v['start_times'], $v['end_times'], $v['status']); $rs[$k]['start_times'] = outTime($v['start_times']); $rs[$k]['end_times'] = outTime($v['end_times']); $rs[$k]['cateData'] = $this->getCateTree($v['cate_id']); } } $cate = M('ste_goods_cate')->field('id,name')->where(array('is_del' => 0, 'city_id' => steadmin::$adminInfo['city_id'], 'pid' => $this->rootCateId))->order('`id`')->findAll(false); // z($rs); $this->assign(array('orderType' => $orderType, 'orderby' => $orderby, 'rs' => $rs, 'total' => $total, 'p' => $p, 'cate_id' => $cateId, 'shop_id' => $shopId, 'user_id' => $userId, 'title' => $title, 'tips_id' => $tips, 'status' => $status, 'actlist' => $actList, 'act' => $act, 'cate' => $cate, 'stime' => $startTime, 'etime' => $endTime, 'pageShow' => $pageShow, 'pageShowList' => $pageShowList, 'minStorage' => $this->minStorage, 'setting' => $this->steSetting)); $this->display(); }