Commit fe261ff9 authored by zhuwei's avatar zhuwei

1

parent 4db69fad
...@@ -289,12 +289,26 @@ class CostDetail extends Basic ...@@ -289,12 +289,26 @@ class CostDetail extends Basic
$type = $params['type']; $type = $params['type'];
switch ($type) { switch ($type) {
case 0 : case 0 :
case 4 :
//办公室成本'; //办公室成本';
$field = 'c.id as apply_id,b.operator_name,a.create_time,a.total_fee, $field = 'c.id as apply_id,b.operator_name,a.create_time,a.total_fee,
a.type,a.fee_item,a.purpose,c.source,c.status,c.card_no,c.card_name, a.type,a.fee_item,a.purpose,c.source,c.status,c.card_no,c.card_name,
c.bank,b.setting_date,a.store_attendance_num,a.id,b.operator_id,a.assume_fee, c.bank,b.setting_date,a.store_attendance_num,a.id,b.operator_id,a.assume_fee,
a.apply_for_id'; a.apply_for_id';
$list = $this->storeCostExt->getCostInfo($field,$conditions);
if(!$list)
return $this->response("101", "不存在该记录", []);
$list['type_name'] = $this->getTypeName($list['type']);
$list['fee_item_name'] = $this->getFeeItemName($list['fee_item']);
$list['store_name'] = $this->getStoreName($list['store_id']);
$list['store_name'] = $this->getStoreName($list['store_id']);
$list['status_str'] = $this->getApplyForFeeStatus($list['status']);
$list['source_str'] = $list['source'] == 0 ? 'app申请' : 'excel导入';
$list['history_list'] = $this->getHistoryList($list['apply_for_id']);
break; break;
case 1 : case 1 :
//上海总部成本'; //上海总部成本';
...@@ -311,28 +325,13 @@ class CostDetail extends Basic ...@@ -311,28 +325,13 @@ class CostDetail extends Basic
break; break;
case 4 :
//门店单独成本';
break;
default : default :
//暂无'; //暂无';
} }
$list = $this->storeCostExt->getCostInfo($field,$conditions);
if(!$list)
return $this->response("101", "不存在该记录", []);
$list['type_name'] = $this->getTypeName($list['type']);
$list['fee_item_name'] = $this->getFeeItemName($list['fee_item']);
$list['store_name'] = $this->getStoreName($list['store_id']);
$list['store_name'] = $this->getStoreName($list['store_id']);
$list['status_str'] = $this->getApplyForFeeStatus($list['status']);
$list['source_str'] = $list['source'] == 0 ? 'app申请' : 'excel导入';
$list['history_list'] = $this->getHistoryList($list['apply_for_id']);
$result["list"] = $list; $result["list"] = $list;
return $this->response("200", "success", $result); return $this->response("200", "success", $result);
......
<?php
namespace app\index\controller;
use app\api_broker\service\RedisCacheService;
use app\index\extend\Basic;
use app\api\service\ActivityService;
use app\index\untils\ExportExcelUntil;
use app\model\AStore;
use app\model\CActivity;
use app\model\FApplyForFeeCheck;
use app\model\FStoreCostExt;
use think\Request;
/**
* 费用参数
* Created by PhpStorm.
* User: zw
* Date: 2019-07-19
* Time: 13:22:17
*/
class CostParameter extends Basic
{
private $m_store;
public function __construct(Request $request = null)
{
parent::__construct($request);
$this->m_store = new AStore();
}
/**
* 门店费用参数
* @return \think\Response
*/
public function getStoreCostParameterList()
{
$params = $this->params;
/* $params = array(
);*/
$pageNo = empty($params['pageNo']) ? 1 : $params['pageNo'];
$pageSize = empty($params['pageSize']) ? 15 : $params['pageSize'];
$conditions = [];
//城市
if (!empty($params["city"])) {
$conditions["a.city"] = $params["city"];
}
//部门
if (!empty($params['district_id'])) {
$conditions["a.district_id"] = $params["district_id"];
}
//门店
if (!empty($params['store_id'])) {
$conditions["a.id"] = $params["store_id"];
}
$field = 'a.id,a.cost_id,b.setting_date,a.create_time,b.operator_name,
a.type,a.fee_item,a.purpose,b.store_id,a.assume_fee';
$list = $this->m_store->getStoreCostParameterList($field, $conditions, $pageNo, $pageSize);
if(!$list)
return $this->response("200", "success", []);
foreach ($list as $k => $v) {
$list[$k]['type_name'] = $this->getTypeName($v['type']);
$list[$k]['fee_item_name'] = $this->getFeeItemName($v['fee_item']);
$list[$k]['store_name'] = $this->getStoreName($v['store_id']);
}
$count = $this->m_store->getStoreCostParameterList($field, $conditions);
$result["list"] = $list;
$result["total"] = $count;
return $this->response("200", "success", $result);
}
}
\ No newline at end of file
...@@ -369,4 +369,39 @@ class AStore extends BaseModel ...@@ -369,4 +369,39 @@ class AStore extends BaseModel
->select(); ->select();
} }
/**
* 门店费用参数查询数据
* @param $field
* @param $params
* @return false|\PDOStatement|string|\think\Collection
*/
public function getStoreCostParameterList($field,$params,$pageNo, $pageSize)
{
$params["a.status"] = 0;
$result = Db::table($this->table)
->field($field)
->alias('a')
->join('f_office b', 'a.office_id = b.id', 'left')
->join('f_store_data c', 'a.id = c.district_id', 'left')
->join('a_agents d', 'a.id = d.store_id and (level = 20 or level = 40) ', 'left')
->where($params)
->limit($pageSize)
->page($pageNo)
->select();
return $result;
}
public function getStoreCostParameterListTotal($field,$params)
{
$params["a.status"] = 0;
$result = Db::table($this->table)
->field($field)
->alias('a')
->join('f_office b', 'a.office_id = b.id', 'left')
->join('f_store_data c', 'a.id = c.district_id', 'left')
->where($params)
->count();
return $result;
}
} }
\ 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