Commit a5102256 authored by hujun's avatar hujun

store

parent 09e30d12
......@@ -40,7 +40,6 @@ class Store extends Basic
$pageSize = empty($this->params['pageSize']) ? 10 : $this->params['pageSize'];
$field = 'a.id,a.district_id,a.store_name,a.create_time';
$where['a.status'] = 0;
$where['b.level'] = ['in', '20,40'];
//门店名
if (!empty($this->params['store_id'])) {
$where['a.id'] = $this->params['store_id'];
......@@ -56,18 +55,27 @@ class Store extends Basic
//店长姓名
if (!empty($this->params['agents_name'])) {
$is_join = 1;
$where['b.name'] = ['LIKE', '%' . $this->params['agents_name'] . '%'];
}
//店长手机号
if (!empty($this->params['agents_phone'])) {
$is_join = 1;
$where['b.phone'] = ['LIKE', $this->params['agents_phone'] . '%'];
}
$store = new AStore();
$m_agent = new AAgents();
$m_district = new ADistrict();
$list = $store->getStoreAgentList($pageNo, $pageSize, 'id DESC', $field, $where);
$this->data['total'] = $store->getStoreAgentListTotal($where);
if (isset($is_join)) {
$where['b.level'] = ['in', '20,40'];
$list = $store->getStoreAgentList($pageNo, $pageSize, 'id DESC', $field, $where);
$this->data['total'] = $store->getStoreAgentListTotal($where);
} else {
$list = $store->getListAlias($pageNo, $pageSize, 'id DESC', $field, $where);
$this->data['total'] = $store->getTotalAlias($where);
}
$agent_where['level'] = 20;
$status_arr = [0 => '正常', 1 => '长假', 2 => '离职', 3 => '转勤', 4 => '黑名单', 5 => '冻结'];
......
......@@ -542,4 +542,38 @@ class AStore extends BaseModel
$result = Db::table($this->table)->query($sql);
return $result;
}
/**
* 公用方法,列表
*
* @param int $pageNo
* @param int $pageSize
* @param string $order_
* @param string $field
* @param string $params
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getListAlias($pageNo = 1, $pageSize = 15, $order_ = 'id desc', $field = '', $params = '') {
return $this->field($field)->alias('a')
->where($params)
->order($order_)
->limit($pageSize)
->page($pageNo)
->select();
}
/**
* 记录总数
*
* @param $params
* @param string $field
* @return int|string
*/
public function getTotalAlias($params,$field = 'id')
{
return $this->alias('a')->where($params)->count($field);
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment