Commit d786ca2b authored by hujun's avatar hujun

调整详情

parent 422f019c
...@@ -10,6 +10,7 @@ namespace app\index\controller; ...@@ -10,6 +10,7 @@ namespace app\index\controller;
use app\api_broker\service\OrderLogService; use app\api_broker\service\OrderLogService;
use app\api_broker\service\PayLogService;
use app\api_broker\service\VipService; use app\api_broker\service\VipService;
use app\index\extend\Basic; use app\index\extend\Basic;
use app\index\untils\ExportExcelUntil; use app\index\untils\ExportExcelUntil;
...@@ -2891,12 +2892,12 @@ class Finance extends Basic ...@@ -2891,12 +2892,12 @@ class Finance extends Basic
$pageNo = empty($this->params['pageNo']) ? 1 : $this->params['pageNo']; $pageNo = empty($this->params['pageNo']) ? 1 : $this->params['pageNo'];
$pageSize = empty($this->params['pageSize']) ? 10 : $this->params['pageSize']; $pageSize = empty($this->params['pageSize']) ? 10 : $this->params['pageSize'];
$data['data'] = []; $data = [];
$where['a.is_del'] = $is_show = 0; $where['a.is_del'] = $is_show = 0;
$msg = ''; $msg = '';
$code = 200;
// try { try {
$m_paylog = new OPayLogAdjustment(); $m_paylog = new OPayLogAdjustment();
/*提交时间 start*/ /*提交时间 start*/
if (!empty($this->params['start_time']) && empty($this->params['end_time'])) { if (!empty($this->params['start_time']) && empty($this->params['end_time'])) {
...@@ -2943,7 +2944,7 @@ class Finance extends Basic ...@@ -2943,7 +2944,7 @@ class Finance extends Basic
//商铺ID //商铺ID
if (!empty($this->params['house_id'])) { if (!empty($this->params['house_id'])) {
$where['b.house_id'] = $this->params['house_id']; $where['e.house_id'] = $this->params['house_id'];
$is_show = 1; $is_show = 1;
} }
...@@ -2983,23 +2984,18 @@ class Finance extends Basic ...@@ -2983,23 +2984,18 @@ class Finance extends Basic
$is_show = 1; $is_show = 1;
} }
if (!empty($this->params['bargain_id'])) {
$order_id = $this->m_bargain->getFieldValue('order_id', $this->params['bargain_id']);
$where[] = ['EXP', 'a.id=' . $order_id];
}
if (!empty($this->params['pay_id'])) { if (!empty($this->params['pay_id'])) {
$where['a.id'] = $this->params['pay_id']; $where['a.paylog_id'] = $this->params['pay_id'];
} }
if (!empty($this->params['order_id'])) { if (!empty($this->params['id'])) {
$where['a.order_id'] = $this->params['order_id']; $where['a.id'] = $this->params['id'];
} }
$field = 'a.create_time,a.id,c.id as march_id,a.paylog_id,a.money,b.income_time,a.type,a.new_paylog_id,a.operation_id,b.order_id'; $field = 'a.create_time,a.id,c.id as march_id,a.paylog_id,a.money,b.income_time,a.type,a.new_paylog_id,a.operation_id,b.order_id';
$list = $m_paylog->getAdjustmentListLimit($pageNo, $pageSize, $order_ = 'a.id desc', $field, $where); $list = $m_paylog->getAdjustmentListLimit($pageNo, $pageSize, $order_ = 'a.id desc', $field, $where);
$data['total'] = 0; $data['total'] = $m_paylog->getAdjustmentListTotal($where);
$m_agent = new AAgents(); $m_agent = new AAgents();
$m_house = new GHouses(); $m_house = new GHouses();
...@@ -3017,19 +3013,20 @@ class Finance extends Basic ...@@ -3017,19 +3013,20 @@ class Finance extends Basic
} }
} }
var_dump($list);die;
$data['list'] = $list;
//加时间条件 //加时间条件
if ($is_show) { if ($is_show) {
$data['money_total'] = $order->getMoneyTotal($where, 'a.money'); //总额 $data['money_total'] = $m_paylog->getMoneyTotal($where, 'a.money'); //总额
} else { } else {
$data['money_total'] = ''; $data['money_total'] = '';
} }
$data['list'] = $list;
$data['list'] = $this->numberTransitionString($data['list']); $data['list'] = $this->numberTransitionString($data['list']);
// } catch (\Exception $e) { } catch (\Exception $e) {
// $code = 101;
// } $msg = '内部错误:'.$e->getMessage();
}
return $this->response($code, $msg, $data);
} }
public function dailyList() { public function dailyList() {
...@@ -3039,4 +3036,49 @@ class Finance extends Basic ...@@ -3039,4 +3036,49 @@ class Finance extends Basic
public function dailyDetails() { public function dailyDetails() {
return view('daily_details'); return view('daily_details');
} }
/**
* 获取上次提交收款的门牌号等
* @return \think\Response
*/
public function getBeForNum()
{
$params = $this->params;
/* $params = array(
"order_id" => 15523, //关联order表id
);*/
if (!isset($params["order_id"])) {
return $this->response("101", "订单编号不能为空");
}
$service_ = new PayLogService();
$billInfo = $service_->getBeForNum($params["order_id"]);
if (count($billInfo) > 0) {
return $this->response("200", "request success", $billInfo[0]);
} else {
return $this->response("200", "request null");
}
}
/**
* 剩余可以调整或退款的钱
* @return \think\Response
*/
public function getAdjustment()
{
$params = $this->params;
/* $params = array(
"pay_id" => 1,
);*/
if (empty($params["pay_id"])) {
return $this->response("101", "请求参数错误");
}
$service_ = new PayLogService();
$result = $service_->adjustment($params["pay_id"]);
if ($result == -1) {
return $this->response("101", "不存在此条记录");
}
return $this->response("200","success",["residue_money"=>$result]);
}
} }
...@@ -117,6 +117,7 @@ class OPayLogAdjustment extends BaseModel{ ...@@ -117,6 +117,7 @@ class OPayLogAdjustment extends BaseModel{
->join("o_paylog b", "a.paylog_id = b.id", "left") ->join("o_paylog b", "a.paylog_id = b.id", "left")
->join("o_march_in c", "b.order_id = c.id", "left") ->join("o_march_in c", "b.order_id = c.id", "left")
->join("a_agents d", "b.agent_id = d.id", "left") ->join("a_agents d", "b.agent_id = d.id", "left")
->join("o_order e", "b.order_id = e.id")
->limit($pageSize) ->limit($pageSize)
->page($pageNo) ->page($pageNo)
->order($order_) ->order($order_)
...@@ -124,11 +125,33 @@ class OPayLogAdjustment extends BaseModel{ ...@@ -124,11 +125,33 @@ class OPayLogAdjustment extends BaseModel{
->select(); ->select();
} }
/**
* @param $params
* @return int|string
*/
public function getAdjustmentListTotal($params) { public function getAdjustmentListTotal($params) {
return $this->db_->join("o_paylog b", "a.paylog_id = b.id", "left") return $this->db_->alias('a')
->join("o_paylog b", "a.paylog_id = b.id", "left")
->join("o_march_in c", "b.order_id = c.id", "left")
->join("a_agents d", "b.agent_id = d.id", "left")
->join("o_order e", "b.order_id = e.id")
->where($params)
->count('a.id');
}
/**
* 调整计算
*
* @param $params
* @return float|int
*/
public function getMoneyTotal($params) {
return $this->db_->alias('a')
->join("o_paylog b", "a.paylog_id = b.id", "left")
->join("o_march_in c", "b.order_id = c.id", "left") ->join("o_march_in c", "b.order_id = c.id", "left")
->join("a_agents d", "b.agent_id = d.id", "left") ->join("a_agents d", "b.agent_id = d.id", "left")
->join("o_order e", "b.order_id = e.id")
->where($params) ->where($params)
->count('a.di'); ->sum('a.money');
} }
} }
\ No newline at end of file
...@@ -416,22 +416,22 @@ class OPayLogModel extends Model ...@@ -416,22 +416,22 @@ class OPayLogModel extends Model
$data = Db::table($this->table) $data = Db::table($this->table)
->alias("a") ->alias("a")
->join("o_order b", "a.order_id = b.id", "left") ->join("o_order b", "a.order_id = b.id", "left")
->join("o_report c", "b.f_id = c.id", "left") // ->join("o_report c", "b.f_id = c.id", "left")
->join('g_houses d', 'b.house_id = d.id', 'left') ->join('g_houses d', 'b.house_id = d.id', 'left')
->join('a_agents e', 'c.report_agent_id=e.id', 'left') ->join('a_agents e', 'c.report_agent_id=e.id', 'left')
->join('a_store f', 'e.store_id=f.id', 'left') // ->join('a_store f', 'e.store_id=f.id', 'left')
->join('a_district g', 'f.district_id=g.id', 'left') // ->join('a_district g', 'f.district_id=g.id', 'left')
->where($where) ->where($where)
->sum($field); ->sum($field);
} else { } else {
$data = Db::table($this->table) $data = Db::table($this->table)
->alias("a") ->alias("a")
->join("o_order b", "a.order_id = b.id", "left") ->join("o_order b", "a.order_id = b.id", "left")
->join("o_report c", "b.f_id = c.id", "left") // ->join("o_report c", "b.f_id = c.id", "left")
->join('g_houses d', 'b.house_id = d.id', 'left') ->join('g_houses d', 'b.house_id = d.id', 'left')
->join('a_agents e', 'c.report_agent_id=e.id', 'left') ->join('a_agents e', 'c.report_agent_id=e.id', 'left')
->join('a_store f', 'e.store_id=f.id', 'left') // ->join('a_store f', 'e.store_id=f.id', 'left')
->join('a_district g', 'f.district_id=g.id', 'left') // ->join('a_district g', 'f.district_id=g.id', 'left')
->where($where) ->where($where)
->sum($field); ->sum($field);
......
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