Commit 98fba4c1 authored by clone's avatar clone

Merge branch '0731-v3.3.6' into test

# Conflicts: # application/api_broker/controller/Site.php
parents 2b3607b2 4de2138b
......@@ -49,7 +49,7 @@ class Site extends Basic
$user_id =$params['user_id'];
$site_id =$params['site_id'];
$res = $user_service->setUserSites($user_id, $site_id);
$res = $user_service->setUserSites($user_id, $site_id,$type = 0);
if ($res) {
return $this->response("200", "成功");
......
......@@ -126,6 +126,13 @@ class CollectHouse extends Basic
$get_params['agents_id'] = $params["agents_id"];
$get_params['CollectUser.status'] = 1;
if(empty($params["city"])){
$conditions["Houses.city"] = trim($this->city);
}else{
$conditions["Houses.city"] = $params["city"];
}
$res = $this->aCollectHouse->getCollectList($pageNo,$pageSize,$field,$get_params);
$res_total = $this->aCollectHouse->getCollectListTotal($field,$get_params);
$look_shop_service = new LookShopService();
......
......@@ -123,6 +123,11 @@ class CollectUser extends Basic
$get_params['CollectUser.status'] = 1;
$get_params['Users.entrust_type'] = isset($params["entrust_type"]) ? $params["entrust_type"] : 0;
// if (isset($params['site_id']) && $params['site_id']) {
// //城市筛选
// $get_params['Users.site_ids'] = [ 'LIKE', '%' . $params['site_id'] . '%' ];
// }
$res = $this->aCollectUser->getCollectList($pageNo,$pageSize,$field,$get_params);
$res_total = $this->aCollectUser->getCollectListTotal($field,$get_params);
foreach($res as $k=>$v)
......
......@@ -178,4 +178,7 @@ class DailyPaper extends Basic
return $this->response("200", "request null");
}
}
}
\ No newline at end of file
......@@ -132,6 +132,13 @@ class OfficeCollectHouse extends Basic
$get_params['agents_id'] = $params["agents_id"];
$get_params['CollectUser.status'] = 1;
if(empty($params["city"])){
$conditions["Houses.city"] = trim($this->city);
}else{
$conditions["Houses.city"] = $params["city"];
}
$res = $this->aCollectHouse->getCollectList($pageNo,$pageSize,$field,$get_params);
$res_total = $this->aCollectHouse->getCollectListTotal($field,$get_params);
$look_shop_service = new LookShopService();
......
......@@ -144,7 +144,7 @@ class OfficeOrderLog extends Basic{
$transfer_name = isset($params["transfer_name"]) ? $params["transfer_name"] : "";
$received_money = isset($params["received_money"]) ? $params["received_money"] : 0;
$type_ext = isset($params["type_ext"]) ? $params["type_ext"] : 0;
$is_open = isset($params['is_open']) ? $params['is_open'] : -1;
$is_open = isset($params['is_open']) ? $params['is_open'] : 0;
if ($pay_id > 0) {
$source = 2;
}
......
......@@ -4,6 +4,11 @@ namespace app\api_broker\controller;
use app\api_broker\extend\Basic;
use app\api_broker\service\OfficePayLogService;
use app\model\OfficeOImg;
use app\model\OfficeOPayLogModel;
use app\model\OfficeOrderModel;
use app\model\OfficeORefundLogModel;
use app\model\OfficeORefundModel;
use think\Request;
/**
......@@ -164,4 +169,100 @@ class OfficePayLog extends Basic
return $this->response("101",$result["msg"]);
}
}
/**
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function myRefundList()
{
$page_no = empty($this->params["page_no"]) ? 1 : $this->params["page_no"];
$page_size = empty($this->params["page_size"]) ? 2 : $this->params["page_size"];
if (empty($this->params['agent_id'])) {
return $this->response(101, '参数错误');
}
$where['agent_id'] = $this->params['agent_id'];
switch ($this->params['type']) {
case 1 :
$where['status'] = ['in', '0,1'];
break;
case 2 :
$where['status'] = 4;
break;
case 3 :
$where['status'] = 3;
break;
case 4 :
$where['status'] = 2;
break;
default :
return $this->response(101, '类型错误');
}
$field = 'id,create_time,agent_name,refund_money,order_id,pay_log_id,bank,card_no,name,remark,';
$field .= 'receipt_number,report_id,order_no,type,status';
$where['is_del'] = 0;
$m_refund = new OfficeORefundModel();
$m_pay = new OFficeOPayLogModel();
$m_order = new OfficeOrderModel();
$m_check_log = new OfficeORefundLogModel();
$m_img = new OfficeOImg();
$refund_data = $m_refund->getList($page_no, $page_size, 'ID DESC', $field, $where);
foreach ($refund_data as $k => $v) {
$refund_data[$k]['pay_create_time'] = $m_pay->getFieldValue('create_time', ['id' => $v['pay_log_id']]);
$house_data = $m_order->getHouseInfoByOrderIdOne('c.id,d.address', ['a.id' => $v['order_id']]);
if ($house_data) {
$refund_data[$k]['house_id'] = $house_data['id'];
$refund_data[$k]['house_address'] = $house_data['address'];
} else {
$refund_data[$k]['house_id'] = 0;
$refund_data[$k]['house_address'] = '';
}
$refund_data[$k]['image_array'] = $m_img->getImgList(['img_id' => $v['id'], 'img_type' => 3]);
$refund_data[$k]['check_log'] = $m_check_log->getListAll('create_time,operation_name', ['refund_id' => $v['id'], 'is_del' => 0]);
$refund_data[$k]['file_path'] = 'static/chat_image/';
if ($v['status'] == 2) {
$refund_data[$k]['transfer_image_array'] = $m_img->getImgList(['img_id' => $v['id'], 'img_type' => 4]);
} else {
$refund_data[$k]['transfer_image_array'] = [];
}
$refund_data[$k]['return_type'] = $this->params['type'];
}
return $this->response(200, '', $refund_data);
}
/*
* 保存退款图片
*/
public function uploadRefundImage()
{
if (empty($this->params['refund_id'])) {
return $this->response(101, '参数错误');
}
$remark_img = json_decode($this->params["remark_img"], true);
if (!is_array($remark_img)) {
return $this->response(101, '图片参数错误');
}
$id = $this->params['refund_id'];
$oImgModel = new OfficeOImg();
$result = $oImgModel->addImgAll($id, 3, $remark_img);
if ($result == 1) {
$code = 200;
} else {
$code = 101;
$msg = '保存图片失败';
}
return $this->response($code, $msg);
}
}
\ No newline at end of file
......@@ -292,6 +292,23 @@ class OfficeRoom extends Basic
return $this->response($this->code, $this->msg, $this->data);
}
/**
* 楼盘列表
* @return \think\Response
*/
public function getBuildingRoomH5()
{
header('Access-Control-Allow-Origin:*');
$result = $this->service->getRoomBuildingList($this->params);
if ($result['status'] == 'successful') {
$this->data = $result['data'];
} else {
$this->code = 101;
$this->msg = $result['msg'];
}
return $this->response($this->code, $this->msg, $this->data);
}
/**
* 约带看房源搜索
......@@ -356,6 +373,8 @@ class OfficeRoom extends Basic
*/
public function filtrateConditionRoom()
{
header('Access-Control-Allow-Origin:*');
$params = $this->params;
if (empty($params["city"])) {
return $this->response("101", "参数错误");
......
......@@ -174,7 +174,7 @@ class OrderLog extends Basic
$transfer_name = isset($params["transfer_name"]) ? $params["transfer_name"] : "";
$received_money = isset($params["received_money"]) ? $params["received_money"] : 0;
$type_ext = isset($params["type_ext"]) ? $params["type_ext"] : 0;
$is_open = isset($params['is_open']) ? $params['is_open'] : -1;
$is_open = isset($params['is_open']) ? $params['is_open'] : 0;
if ($pay_id > 0) {
$source = 2;
}
......
......@@ -4,6 +4,14 @@ namespace app\api_broker\controller;
use app\api_broker\extend\Basic;
use app\api_broker\service\PayLogService;
use app\api_broker\service\ReportService;
use app\model\AAgents;
use app\model\OImg;
use app\model\OPayLogAdjustment;
use app\model\OPayLogModel;
use app\model\OrderModel;
use app\model\ORefundLogModel;
use app\model\ORefundModel;
use think\Request;
/**
......@@ -105,31 +113,31 @@ class PayLog extends Basic
);*/
$refund_id = isset($params["refund_id"]) ? $params["refund_id"] : 0;
if($refund_id == 0 && !isset($params["remark_img"])){
if ($refund_id == 0 && !isset($params["remark_img"])) {
return $this->response("101", "请上传图片");
}
$agent_id = $params["agent_id"];
$agent_name = $params["agent_name"];
$report_id = $params["report_id"];
$order_id = $params["order_id"];
$order_no = $params["order_no"];
$refund_money = $params["refund_money"];
$name = $params["name"];
$phone = $params["phone"];
$bank = $params["bank"];
$card_no = $params["card_no"];
$agent_id = $params["agent_id"];
$agent_name = $params["agent_name"];
$report_id = $params["report_id"];
$order_id = $params["order_id"];
$order_no = $params["order_no"];
$refund_money = $params["refund_money"];
$name = $params["name"];
$phone = $params["phone"];
$bank = $params["bank"];
$card_no = $params["card_no"];
$receipt_number = $params["receipt_number"];
$type = $params["type"];
$refund_cause = $params["refund_cause"];
$pay_log_id = $params["pay_log_id"];
$refund_way = $params["refund_way"];
$remark = isset($params["remark"]) ? $params["remark"] : "";
$remark_img = isset($params["remark_img"]) ? json_decode($params["remark_img"], true) : "";
$del_img =isset($params["del_img"]) ? $params["del_img"] : "";
$type = $params["type"];
$refund_cause = $params["refund_cause"];
$pay_log_id = $params["pay_log_id"];
$refund_way = $params["refund_way"];
$remark = isset($params["remark"]) ? $params["remark"] : "";
$remark_img = isset($params["remark_img"]) ? json_decode($params["remark_img"], true) : "";
$del_img = isset($params["del_img"]) ? $params["del_img"] : "";
//todo 判断此单是否有付款
$is_ok = $this->service_->addRefund($agent_id, $agent_name, $report_id, $order_id, $order_no, $refund_money, $name,
$phone, $bank, $card_no, $receipt_number, $type, $refund_cause, $pay_log_id, $refund_way, $remark, $remark_img
,$refund_id,$del_img);
, $refund_id, $del_img);
if ($is_ok > 0) {
return $this->response("200", "request success", []);
} elseif ($is_ok == -2) {
......@@ -147,21 +155,249 @@ class PayLog extends Basic
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getRefund(){
public function getRefund()
{
$params = $this->params;
/* $params = array(
"refund_id" =>1
);*/
if(!isset($params["refund_id"])){
return $this->response("101","请求参数错误");
/* $params = array(
"refund_id" =>1
);*/
if (!isset($params["refund_id"])) {
return $this->response("101", "请求参数错误");
}
$result = $this->service_->getRefundDetail($params["refund_id"]);
if($result["code"] == 200){
return $this->response("200","success",$result["data"]);
}elseif($result["code"] == 101){
return $this->response("101",$result["msg"]);
if ($result["code"] == 200) {
return $this->response("200", "success", $result["data"]);
} elseif ($result["code"] == 101) {
return $this->response("101", $result["msg"]);
}
}
/**
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function myRefundList()
{
$page_no = empty($this->params["page_no"]) ? 1 : $this->params["page_no"];
$page_size = empty($this->params["page_size"]) ? 2 : $this->params["page_size"];
if (empty($this->params['agent_id'])) {
return $this->response(101, '参数错误');
}
$where['agent_id'] = $this->params['agent_id'];
switch ($this->params['type']) {
case 1 :
$where['status'] = ['in', '0,1'];
break;
case 2 :
$where['status'] = 4;
break;
case 3 :
$where['status'] = 3;
break;
case 4 :
$where['status'] = 2;
break;
default :
return $this->response(101, '类型错误');
}
$field = 'id,create_time,agent_name,refund_money,order_id,pay_log_id,bank,card_no,name,remark,';
$field .= 'receipt_number,report_id,order_no,type,status';
$where['is_del'] = 0;
$m_refund = new ORefundModel();
$m_pay = new OPayLogModel();
$m_order = new OrderModel();
$m_check_log = new ORefundLogModel();
$m_img = new OImg();
$refund_data = $m_refund->getList($page_no, $page_size, 'ID DESC', $field, $where);
foreach ($refund_data as $k => $v) {
$refund_data[$k]['pay_create_time'] = $m_pay->getFieldValue('create_time', ['id' => $v['pay_log_id']]);
$house_data = $m_order->getHouseInfoByOrderIdOne('a.house_id,b.internal_address', ['a.id' => $v['order_id']]);
if ($house_data) {
$refund_data[$k]['house_id'] = $house_data['house_id'];
$refund_data[$k]['house_address'] = $house_data['internal_address'];
} else {
$refund_data[$k]['house_id'] = 0;
$refund_data[$k]['house_address'] = '';
}
$refund_data[$k]['image_array'] = $m_img->getImgList(['img_id' => $v['id'], 'img_type' => 3]);
$refund_data[$k]['check_log'] = $m_check_log->getListAll('create_time,operation_name', ['refund_id' => $v['id'], 'is_del' => 0]);
$refund_data[$k]['file_path'] = 'static/chat_image/';
if ($v['status'] == 2) {
$refund_data[$k]['transfer_image_array'] = $m_img->getImgList(['img_id' => $v['id'], 'img_type' => 4]);
} else {
$refund_data[$k]['transfer_image_array'] = [];
}
$refund_data[$k]['return_type'] = $this->params['type'];
}
return $this->response(200, '', $refund_data);
}
/**我的收款记录列表
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getPayLogList()
{
$params = $this->params;
/* $params = array(
"agent_id" => 1,
"search_type" => 1,//1商铺编号,2商铺地址 3收款id,4带看id
"keyword" => "121",
"submit_time_start" => '123123123123',//时间戳
"submit_time_end" => '123123',
"type" => 10,//入账类型, 10.意向金 30.保管金 91.中介费 92.案场费
"source" => 0,//来源0app 1智能pos机 2调整
"is_open" => 0, //是否开业:0未开业 1开业
"is_all" => 0, //是否查看全部:0自己 1全部
"page_no" => 1,
"page_size" => 15
);*/
if (!isset($params["agent_id"])) {
return $this->response("101", "请求参数错误");
}
$pageNo = empty($params['page_no']) ? 1 : $params['page_no'];
$pageSize = empty($params['page_size']) ? 15 : $params['page_size'];
$agentModel = new AAgents();
$agents_data = $agentModel->getAgentInfo('id,level', $this->agentId);
$result = [];
$check_type = 0;
if (isset($params["is_all"]) && $params["is_all"] == 1) {
$check_type = 1;
if ($agents_data["level"] < 30) {
$orderLogService = new ReportService();
$check_type = $orderLogService->getCheckType($this->agentId);
if ($check_type == 0) {
return $this->response(101, "暂无权限");
}
}
}
$field = "a.type,a.id,a.create_time,a.income_time,a.money,a.type_ext,a.bargain_id,a.is_open,a.source,a.agent_id,a.agent_name";
$result = $this->service_->getPayLogList($field, $params, $pageNo, $pageSize, $check_type);
$adjustmentModel = new OPayLogAdjustment();
$refundModel = new ORefundModel();
$status = 0;
foreach ($result as $key => $item) {
$is_adjustment = $adjustmentModel->getFieldValue('id', ['paylog_id' => $item["id"], 'is_del' => 0]);
$is_refund = $refundModel->getFind('id', ['pay_log_id' => $item["id"], 'is_del' => 0]);
if ($is_adjustment && $is_refund) {
$status = 3;
} else if ($is_adjustment) {
$status = 1;
} else if ($is_refund) {
$status = 2;
}
$result[$key]["status"] = $status;
}
if (count($result) > 0) {
return $this->response("200", "request success", $result);
} else {
return $this->response("200", "request null");
}
}
/**
* 收款详情
*
* @return \think\Response
*/
public function getPayLogDetail()
{
header('Access-Control-Allow-Origin:*');
$params = $this->params;
/* $params = array(
"pay_id"=> 1038,
);*/
if (empty($params['pay_id'])) {
return $this->response("101", '参数错误');
}
$result = $this->service_->getCollectionDetail($params['pay_id']);
if ($result) {
return $this->response("200", "success", $result);
} else {
return $this->response("101", "request null");
}
}
/*
* 保存退款图片
*/
public function uploadRefundImage()
{
if (empty($this->params['refund_id'])) {
return $this->response(101, '参数错误');
}
$remark_img = json_decode($this->params["remark_img"], true);
if (!is_array($remark_img)) {
return $this->response(101, '图片参数错误');
}
$id = $this->params['refund_id'];
$oImgModel = new OImg();
$result = $oImgModel->addImgAll($id, 3, $remark_img);
if ($result == 1) {
$code = 200;
} else {
$code = 101;
$msg = '保存图片失败';
}
return $this->response($code, $msg);
}
/**
* 收款列表记录上传图片
* 朱伟 2018-07-04
*/
public function addReceiptImg()
{
header('Access-Control-Allow-Origin:*');
$params = $this->params;
$result = 0;
/*$params = array(
"img_id" => 1,
"img_name" => 123,
);*/
if (!isset($params["img_id"])) {
return $this->response("101", "请求参数错误");
}
if (!isset($params["img_name"])) {
return $this->response("101", "请求参数错误");
}
$order = new OImg();
$img_arr = explode(',', $params["img_name"]);
foreach ($img_arr as $k => $v) {
$time = date("Y-m-d H:i:s");
$save_data["img_id"] = $params["img_id"];//id根据img_type区分是收款还是进场还是其他'
$save_data["img_type"] = 2;//图片类型:1进场,2收款
$save_data["img_name"] = $v;//图片名称
$save_data["img_status"] = 0;//删除状态 0正常 1删除
$save_data["update_time"] = $time;//更新时间
$save_data["create_time"] = $time;//创建时间
$result = $order->addImgOnce($save_data);
}
if ($result) {
return $this->response("200", "成功");
} else {
return $this->response("101", "失败");
}
}
}
\ No newline at end of file
......@@ -41,8 +41,8 @@ class PayLogOpen extends Basic
"house_id" => 1,
"intro" => "123123",
"house_address" => "123123",
"remark" => "123123",
"open_img" => "123123",
"type" => 1 //默认为1 单独申请开业 2和该地址相关的收款全部申请开业
);*/
$checkResult = $this->validate($params, "PayLogOpenValidate.applyForOpen");
......@@ -57,6 +57,7 @@ class PayLogOpen extends Basic
$house_id = $params["house_id"];
$house_address = $params["house_address"];
$intro = $params["intro"];
$type = $params["type"] ? $params["type"] : 1;
try {
$open_img = json_decode($params["open_img"], true);
} catch (Exception $exception) {
......@@ -64,7 +65,7 @@ class PayLogOpen extends Basic
}
$return_id = $this->service_->addApplyForOpen($pay_log_id, $report_id, $bargain_id, $agent_id, $house_id, $intro,
$house_address, $open_img, $order_id, $this->agentId);
$house_address, $open_img, $order_id, $this->agentId,$type);
if ($return_id > 0) {
return $this->response("200", "success", ["id" => $return_id]);
} elseif ($return_id == -1){
......
......@@ -277,9 +277,14 @@ class Shop extends Basic
//$conditions['status'] = array( 'in', "1,2" ); //只显示上架或下架的
$conditions['status'] = !empty($params['status']) ? $params['status'] : array('in', "1,2"); //只显示上架或下架的
}
if(!empty($params["site_name"])){
$conditions["city"] = $params["site_name"];
}
$result = $this->gHousesModel->getHousesList($pageNo, $pageSize, $order_, $field, $conditions, $spTagArr);
$m_business_district = new GBusinessDistrict();
// $m_business_district = new GBusinessDistrict();
//获取图片信息
foreach ($result as $key => $val) {
$result[$key]["api_path"] = CK_IMG_URL . 'images/';
......@@ -581,7 +586,7 @@ class Shop extends Basic
$result['landlord_phone'] = $m_landlord->getAllList('id,name,phone',['house_id'=>$params["id"], 'status'=>0]);
foreach ($result['landlord_phone'] as $kk=>$vv){
$result['landlord_phone'][$kk]['phone'] = substr_replace($result['landlord_phone'][$kk]['phone'], '****', 3, 4);
$result['landlord_phone'][$kk]['name'] = '(编号ID:'.$result['landlord_phone'][$kk]['id'].')'.$result['landlord_phone'][$kk]['name'];
$result['landlord_phone'][$kk]['name'] = '(房东ID:'.$result['landlord_phone'][$kk]['id'].')'.$result['landlord_phone'][$kk]['name'];
}
$result['is_show_landlord'] = 1;
} else {
......@@ -723,10 +728,54 @@ class Shop extends Basic
}
}
//案场权限人
$result['stronghold_info'] = $this->getExclusiveInfo($result['id']);
unset($result['external_image_id']);
return $this->response("200", 'request success', $result);
}
/**
* 案场权限人
* @param $house_id
* @return null|string
*/
public function getExclusiveInfo($house_id)
{
// $m_agent_house = new GHousesToAgents();
// $exclusive_info = [];
// $params['a.houses_id'] = $house_id;
// $params['a.type'] = $type;
// $params['a.is_del'] = 0;
// $res = $m_agent_house->getAgentsHouses('b.id,name,a.type,b.phone', $params);
// if ($res) {
// $exclusive_info['name'] = $res[0]['name'];
// $exclusive_info['phone'] = $res[0]['phone'];
// } else {
// return null;
// }
// return $exclusive_info ;
$houseToAgentModel = new GHousesToAgents();
$params["a.houses_id"] = $house_id;
$params["a.type"] = array("in", '1'); //案场权限人,盘方和独家
$params["a.is_del"] = 0;
$house_arr = $houseToAgentModel->getHouseNameByAgentId("b.name", $params);
$ids = "";
foreach ($house_arr as $item) {
$ids .= $item["name"] . ",";
}
$ids = rtrim($ids, ",");
if (!$ids) { //代表没有案场
return null;
}
return $ids;
}
/**
* 是否显示对内地址
* @param $panPartyArr
......
......@@ -94,7 +94,6 @@ class Site extends Basic
$get_params['b.is_del'] = 0;
$get_params['a.phone'] = $params["agent_phone"];
// $get_params['a.site_id'] = $params["site_id"]; //去除其它城市
$site_city = $this->aAgentModel->getAgentSiteList($get_params, $field);
return $this->response("200", "success", $site_city);
}
......
......@@ -66,6 +66,7 @@ class Basic extends Controller
"broker/moveHouseAgent",
"broker/moveHouseSiteId",
"office/filtrateConditionRoom",
"office/getBuildingRoomH5",
);
/**
......
......@@ -4,6 +4,7 @@ namespace app\api_broker\service;
use app\api_broker\controller\Agent;
use app\api_broker\service\VerifyService;
use app\index\controller\DailyUncommitted;
use app\model\AAgents;
use app\model\AStore;
use app\model\GHouses;
......@@ -636,6 +637,9 @@ class DailyPaperService
$tenpay_2, $alipay_2, $site_id, $bank_card, $bank_card_yun, $bank_card_lin, $bank_card_new);
$is_ok = $this->oDailyModel->addDaily($params);
if ($is_ok > 0) {
//更新财务日报未提交记录表数据
$c_daily_uncommitted = new DailyUncommitted();
$c_daily_uncommitted->updateUncommittedList($agent_info[0]["store_id"],$daily_date);
return ["code" => 200, "data" => null];
} else {
return ["code" => 101, "msg" => "审核异常"];
......
......@@ -39,28 +39,52 @@ class PayLogOpenService
* @param $open_img
* @param $order_id
* @param $operation_id
* @param $type
* @return int
* @throws \think\Exception
*/
public function addApplyForOpen($pay_log_id, $report_id, $bargain_id, $agent_id, $house_id, $intro, $house_address, $open_img, $order_id, $operation_id)
public function addApplyForOpen($pay_log_id, $report_id, $bargain_id, $agent_id, $house_id, $intro, $house_address,
$open_img, $order_id, $operation_id, $type)
{
$params["pay_log_id"] = $pay_log_id;
$params["agent_id"] = $agent_id;
$pay_open_data = $this->payLogOpenModel->getFind("id", 0, $params);
if($pay_open_data){
if ($pay_open_data) {
return -1;
}
$return_id = 0;
switch ($type) {
case 1:
$return_id = $this->payLogOpenModel->addPayLogOpen(
$this->payLogOpenBin($pay_log_id, $report_id, $bargain_id, $agent_id, $house_id, $intro, $house_address, $order_id)
);
if ($return_id > 0) {
$this->oImgModel->addImgAll($return_id, 5, $open_img);
}
break;
case 2:
//查询所有和改地址相关的未申请开业的收款
$where["b.house_id"] = $house_id;
$where["a.is_open"] = 0;
$where["a.is_del"] = 0;
$where["a.type"] = array("in", "91,92");
$payLogArr = $this->payLogModel->selectListByHouseId("a.id", $where);
foreach ($payLogArr as $item) {
$return_id = $this->payLogOpenModel->addPayLogOpen(
$this->payLogOpenBin($item["id"], $report_id, $bargain_id, $agent_id, $house_id, $intro, $house_address, $order_id)
);
if ($return_id > 0) {
$this->oImgModel->addImgAll($return_id, 5, $open_img);
}
}
}
$return_id = $this->payLogOpenModel->addPayLogOpen(
$this->payLogOpenBin($pay_log_id, $report_id, $bargain_id, $agent_id, $house_id, $intro, $house_address, $order_id)
);
//save img
if ($return_id > 0) {
$this->oImgModel->addImgAll($return_id, 5, $open_img);
//todo 推送
$verifyService = new VerifyService();
$leaderId = $verifyService->getLeaderIdByAgentId($agent_id);
if($leaderId > 0){
$verifyService = new VerifyService();
$leaderId = $verifyService->getLeaderIdByAgentId($agent_id);
if ($leaderId > 0) {
$push_service = new PushMessageService();
$push_service->record(13, 0, [$leaderId], $operation_id, ['message' => "有业务员提交了开业申请,请及时审核"]);
}
......@@ -91,11 +115,11 @@ class PayLogOpenService
$this->payLogOpenModel->editData(['status' => $status], $open_id); //更新状态
if ($status == 3) {
$pay_log_id = $this->payLogOpenModel->getFieldOneValue('pay_log_id', ['id'=>$open_id]);
$pay_log_id = $this->payLogOpenModel->getFieldOneValue('pay_log_id', ['id' => $open_id]);
if ($pay_log_id) {
$update_data['id'] = $pay_log_id;
$update_data['is_open'] = 1;
$update_data['id'] = $pay_log_id;
$update_data['is_open'] = 1;
$update_data['open_time'] = date('Y-m-d H:i:s');
$this->payLogModel->updatePayLog($update_data);
}
......@@ -180,7 +204,7 @@ class PayLogOpenService
$list[$key]["img_path"] = CHAT_IMG_URL;
$list[$key]["img_arr"] = $img_arr;
$log_list = $this->payLogOpenLogModel->getAllList($field_log, 0, ["open_id"=>$item["id"]]);
$log_list = $this->payLogOpenLogModel->getAllList($field_log, 0, ["open_id" => $item["id"]]);
$list[$key]["log_list"] = $log_list;
}
return $list;
......
......@@ -2,10 +2,14 @@
namespace app\api_broker\service;
use app\model\OBargainModel;
use app\model\OImg;
use app\model\OPayLogAdjustment;
use app\model\OPayLogModel;
use app\model\OPayLogOpen;
use app\model\OrderModel;
use app\model\ORefundModel;
use app\model\OReportModel;
/**
* Created by PhpStorm.
......@@ -22,9 +26,9 @@ class PayLogService
public function __construct()
{
$this->payLogModel = new OPayLogModel();
$this->payLogModel = new OPayLogModel();
$this->payLogAdjustmentModel = new OPayLogAdjustment();
$this->oRefundModel = new ORefundModel();
$this->oRefundModel = new ORefundModel();
}
public function getBeForNum($order_id)
......@@ -39,10 +43,10 @@ class PayLogService
* @param $type
* @return int
*/
public function adjustment($pay_id,$type = 1)
public function adjustment($pay_id, $type = 1)
{
//todo 1.计算剩余金额 查询调整表 2.减去退款 3.减去转账
$filed = "id,money";
$filed = "id,money";
$pay_log_arr = $this->payLogModel->getBeforeBillInfo($filed, ["id" => $pay_id]);
if (count($pay_log_arr) < 0) {
return -1;
......@@ -50,12 +54,12 @@ class PayLogService
$pay_log_arr = $pay_log_arr[0];
$where_["paylog_id"] = $pay_id;
$where_["is_del"] = 0;
$where_["is_del"] = 0;
//调整
$adjustment_sum = $this->payLogAdjustmentModel->getAdjustmentSum("money", $where_);
//减去退款
$refund_params["pay_log_id"] = $pay_id;
if($type == 2){
if ($type == 2) {
//驳回退款 不会改变入账的状态,驳回退款是为了让店长重新编辑上传的东西。
$refund_params["status"] = array("neq", 4);
}
......@@ -77,13 +81,13 @@ class PayLogService
*/
public function addAdjustment($new_pay_id, $pay_id, $money, $type, $agent_id)
{
$filed = "id,type";
$filed = "id,type";
$pay_log_arr = $this->payLogModel->getBeforeBillInfo($filed, ["id" => $pay_id]);
if (count($pay_log_arr) < 0) {
return -1;
}
$oPayLogAdjustment = new OPayLogAdjustment();
$where_ = $this->adjustmentBin($new_pay_id, $pay_id, $money, $type, $agent_id, $pay_log_arr[0]["type"]);
$where_ = $this->adjustmentBin($new_pay_id, $pay_id, $money, $type, $agent_id, $pay_log_arr[0]["type"]);
$oPayLogAdjustment->addAdjustment($where_);
}
......@@ -99,10 +103,10 @@ class PayLogService
private function adjustmentBin($new_pay_id, $pay_id, $money, $type, $agent_id, $old_type)
{
$arr["paylog_id"] = $pay_id;
$arr["paylog_id"] = $pay_id;
$arr["new_paylog_id"] = $new_pay_id;
$arr["money"] = $money;
$val = 0;
$arr["money"] = $money;
$val = 0;
if ($old_type == 10) {//意向金
switch ($type) {
......@@ -135,10 +139,10 @@ class PayLogService
}
}
$arr["type"] = $val;
$arr["type"] = $val;
$arr["operation_id"] = $agent_id;
$arr["create_time"] = date("Y-m-d H:i:s", time());
$arr["update_time"] = date("Y-m-d H:i:s", time());
$arr["create_time"] = date("Y-m-d H:i:s", time());
$arr["update_time"] = date("Y-m-d H:i:s", time());
return $arr;
}
......@@ -172,9 +176,9 @@ class PayLogService
if (empty($refund_id)) {
$where['pay_log_id'] = $pay_log_id;
$where['status'] = 4;
$where['is_del'] = 0;
$id = $this->oRefundModel->getFind('id', $where);
$where['status'] = 4;
$where['is_del'] = 0;
$id = $this->oRefundModel->getFind('id', $where);
if ($id['id'] > 0) {
return -3; //在驳回上修改
}
......@@ -182,14 +186,14 @@ class PayLogService
//验证金额是否合法
$payLogService = new PayLogService();
$residue_money = $payLogService->adjustment($pay_log_id,2);
$residue_money = $payLogService->adjustment($pay_log_id, 2);
if ($residue_money < $refund_money) {
return -2;
}
$insert_id = 0;
$arr = $this->refundBin($agent_id, $agent_name, $report_id, $order_id, $order_no, $refund_money, $name,
$phone, $bank, $card_no, $receipt_number, $type, $refund_cause, $pay_log_id,$refund_way, $remark,$refund_id);
$phone, $bank, $card_no, $receipt_number, $type, $refund_cause, $pay_log_id, $refund_way, $remark, $refund_id);
if ($refund_id <= 0) {
$insert_id = $this->oRefundModel->addRefund($arr);
} else {
......@@ -200,8 +204,8 @@ class PayLogService
if ($insert_id > 0 && $remark_img) {
$this->addOImg($insert_id, 3, $remark_img);
}
if($del_img){
$this->delOImg(3,$del_img);
if ($del_img) {
$this->delOImg(3, $del_img);
}
$service_push = new PushMessageService();
......@@ -230,31 +234,31 @@ class PayLogService
*/
private function refundBin($agent_id, $agent_name, $report_id, $order_id, $order_no, $refund_money, $name,
$phone, $bank, $card_no, $receipt_number, $type, $refund_cause, $pay_log_id,
$refund_way, $remark,$refund_id)
$refund_way, $remark, $refund_id)
{
if($refund_id > 0){ //修改
if ($refund_id > 0) { //修改
$arr["id"] = $refund_id;
}else{
} else {
$arr["create_time"] = date("Y-m-d H:i:s", time());
}
$arr["report_id"] = $report_id;
$arr["agent_id"] = $agent_id;
$arr["agent_name"] = $agent_name;
$arr["order_no"] = $order_no;
$arr["order_id"] = $order_id;
$arr["refund_money"] = $refund_money;
$arr["name"] = $name;
$arr["phone"] = $phone;
$arr["status"] = 0;
$arr["bank"] = $bank;
$arr["card_no"] = $card_no;
$arr["remark"] = $remark;
$arr["report_id"] = $report_id;
$arr["agent_id"] = $agent_id;
$arr["agent_name"] = $agent_name;
$arr["order_no"] = $order_no;
$arr["order_id"] = $order_id;
$arr["refund_money"] = $refund_money;
$arr["name"] = $name;
$arr["phone"] = $phone;
$arr["status"] = 0;
$arr["bank"] = $bank;
$arr["card_no"] = $card_no;
$arr["remark"] = $remark;
$arr["receipt_number"] = $receipt_number;
$arr["type"] = $type;
$arr["refund_cause"] = $refund_cause;
$arr["pay_log_id"] = $pay_log_id;
$arr["refund_way"] = $refund_way;
$arr["update_time"] = date("Y-m-d H:i:s", time());
$arr["type"] = $type;
$arr["refund_cause"] = $refund_cause;
$arr["pay_log_id"] = $pay_log_id;
$arr["refund_way"] = $refund_way;
$arr["update_time"] = date("Y-m-d H:i:s", time());
return $arr;
}
......@@ -280,10 +284,10 @@ class PayLogService
private function getOImg($id, $img_type)
{
//查询图片
$oImgModel = new OImg();
$params["img_id"] = $id;
$oImgModel = new OImg();
$params["img_id"] = $id;
$params["img_type"] = $img_type;
$img_arr = $oImgModel->getImgList($params);
$img_arr = $oImgModel->getImgList($params);
return $img_arr;
}
......@@ -291,11 +295,12 @@ class PayLogService
* @param $type
* @param $del_img
*/
private function delOImg($type, $del_img){
$oImgModel = new OImg();
$ids = rtrim($del_img, ",");
$where_["id"] = array("in",$ids);
$where_["img_type"] = $type;
private function delOImg($type, $del_img)
{
$oImgModel = new OImg();
$ids = rtrim($del_img, ",");
$where_["id"] = array("in", $ids);
$where_["img_type"] = $type;
$params["img_status"] = 1;
$oImgModel->updateImgs($where_, $params);
......@@ -311,16 +316,16 @@ class PayLogService
*/
public function getRefundDetail($refund_id)
{
$field = "a.id,a.report_id,a.agent_id,a.agent_name,a.order_no,a.order_id,a.refund_money,a.status,a.name
$field = "a.id,a.report_id,a.agent_id,a.agent_name,a.order_no,a.order_id,a.refund_money,a.status,a.name
,a.phone,a.bank,a.card_no, a.remark,a.receipt_number,a.type,a.refund_cause,a.pay_log_id,a.refund_way,
a.create_time,b.income_time";
$params["id"] = $refund_id;
$params["id"] = $refund_id;
$params["is_del"] = 0;
$result = $this->oRefundModel->selectRefundDetailByOrderNo($field, $params);
$result = $this->oRefundModel->selectRefundDetailByOrderNo($field, $params);
if (count($result) > 0) {
$item = $result[0];
$item = $result[0];
$item["img_path"] = CHAT_IMG_URL;
$item["img_arr"] = $this->getOImg($item["id"], 3);
$item["img_arr"] = $this->getOImg($item["id"], 3);
return ["code" => 200, "data" => $item];
} else {
return ["code" => 101, "msg" => "没有找到此条退款数据"];
......@@ -333,20 +338,21 @@ class PayLogService
* @param $bargain_id
* @return bool|float|int
*/
public function getPayLogRefundSurplusMoney($bargain_id) {
public function getPayLogRefundSurplusMoney($bargain_id)
{
if (empty($bargain_id)) {
return false;
}
$pay_id = $this->payLogModel->getFieldColumn('id', ['bargain_id'=>$bargain_id]);
$pay_id = $this->payLogModel->getFieldColumn('id', ['bargain_id' => $bargain_id]);
if (empty($pay_id)) {
return false;
}
$money = $this->payLogModel->getSum('money', ['id'=> ['in', $pay_id]]);
$money = $this->payLogModel->getSum('money', ['id' => ['in', $pay_id]]);
if ($money > 0) {
$refund_money = $this->oRefundModel->getRefundSum('refund_money', ['pay_log_id'=>['in', $pay_id]]);
$result = $money - $refund_money;
$refund_money = $this->oRefundModel->getRefundSum('refund_money', ['pay_log_id' => ['in', $pay_id]]);
$result = $money - $refund_money;
} else {
$result = 0;
}
......@@ -357,17 +363,188 @@ class PayLogService
* @param $bargain_id
* @return bool
*/
public function checkPayLogAdjustment($bargain_id) {
public function checkPayLogAdjustment($bargain_id)
{
if (empty($bargain_id)) {
return false;
}
$result = false;
$pay_id = $this->payLogModel->getFieldColumn('id', ['bargain_id'=>$bargain_id]);
$id = $this->payLogAdjustmentModel->getFieldValue('id', ['paylog_id'=> ['in', $pay_id]]);
$pay_id = $this->payLogModel->getFieldColumn('id', ['bargain_id' => $bargain_id]);
$id = $this->payLogAdjustmentModel->getFieldValue('id', ['paylog_id' => ['in', $pay_id]]);
if ($id > 0) {
$result = true;
}
return $result;
}
/**
* 查询所有收款记录
* @param $field
* @param $params
* @param $pageNo
* @param $pageSize
* @param $check_type
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getPayLogList($field, $params, $pageNo, $pageSize, $check_type)
{
$conditions = [];
switch ($params["search_type"]) {
case 1:
$conditions["b.house_id"] = trim($params["keyword"]);
break;
case 2:
$conditions["h.internal_address"] = array("like", "%" . trim($params['keyword']) . "%");
break;
case 3:
$conditions["a.id"] = trim($params["keyword"]);
break;
case 4:
$conditions["a.order_id"] = trim($params["keyword"]);
break;
default:
break;
}
if (isset($params['submit_time_start']) && isset($params['submit_time_end'])) {
$start_time = date('Y-m-d H:i:s', $params['submit_time_start']);
$end_time = date('Y-m-d H:i:s', $params['submit_time_end']);
$conditions['a.create_time'] = array('between', array($start_time, $end_time));
}
if (isset($params['type'])) {
$conditions["a.type"] = $params["type"];
}
if (isset($params['source'])) {
$conditions["a.source"] = $params["source"];
}
if (isset($params['is_open'])) {
$conditions["a.is_open"] = $params["is_open"];
}
switch ($check_type) {
case 0://自己的
$conditions["a.agent_id"] = $params["agent_id"];
break;
case 1://公司
case 2://部门 和公司都可以看全部
break;
case 3://门店
$vModel = new VerifyService();
$agentArr = $vModel->getAgentsByAgentIdAndType($params["agent_id"], $check_type);
$conditions["a.agent_id"] = array("in", $agentArr);
break;
default:
return "";
}
return $this->payLogModel->getPayLogList($conditions, $field, $pageNo, $pageSize);
}
/**
* 收款详情
*
* @return \think\Response
*/
public function getCollectionDetail($pay_id)
{
$pay_data = [];
try {
$m_pay = new OPayLogModel();
$m_bargain = new OBargainModel();
$pay_fields = 'id,report_id,order_id,order_no,agent_name,create_time,income_time,house_number,type,real_money,income_time,
transfer_name,bargain_id,agent_id,transaction_fee,is_dividend,receipt_number,source,pay_type,last_transfer_time,
money,industry_type,received_money,type_ext,is_open,open_time,remark';
$pay_data = $m_pay->selectReceiptImgList($pay_fields, ['id' => $pay_id]);
$pay_data = $pay_data[0];
//成交报告id
if (empty($pay_data['bargain_id'])) {
$pay_data['bargain_id'] = "";
$pay_data['is_open'] = 0;
$pay_data['price'] = 0;
} else {
$bargain_where['father_id'] = 0;
$bargain_where['id'] = $pay_data['bargain_id'];
$price = $m_bargain->getFieldValue('price', $bargain_where);
$pay_data['price'] = empty($price) ? 0 : $price;
}
$m_order = new OrderModel();
$house_data = $m_order->selectOrderByOrderId('b.id,b.internal_address,a.f_id', ['order_id' => $pay_data['order_id']]);
$pay_data['house_id'] = empty($house_data[0]['id']) ? '' : $house_data[0]['id'];
$pay_data['address'] = empty($house_data[0]['internal_address']) ? '' : $house_data[0]['internal_address'];
$m_pay_adjustment = new OPayLogAdjustment();
$source_id = $m_pay_adjustment->getFieldColumn('id', ['paylog_id' => $pay_data['id']]);
$pay_data['source_id'] = empty($source_id) ? 0 : implode(',', $source_id);
$m_refund = new ORefundModel();
$num = $m_refund->getFind('id', ['pay_log_id' => $pay_data['id'], 'is_del' => 0]);
if ($num['id'] > 0) {
$pay_data['is_refund'] = 1;
} else {
$pay_data['is_refund'] = 0;
}
$m_report = new OReportModel();
$pay_data['current_agent_name'] = $pay_data['store_name'] = "";
if (($pay_data['type'] == 92 || $pay_data['type'] == 91) && $pay_data['bargain_id'] > 0) {
$where[] = ['EXP', 'a.id =' . $pay_data['bargain_id'] . ' or father_id=' . $pay_data['bargain_id']];
$where['a.status'] = ['in', '10,11,13'];
$where['a.role'] = ['in', '3,4,5'];
$bargain_data = $m_bargain->agentBargainAll('a.role,a.scale,b.name', $where);
$role_arr = [1 => '盘方', 2 => '客方', 3 => '反签', 4 => '独家', 5 => '合作方', 6 => 'APP盘下载方', 7 => 'APP客下载方'];
$name = '';
foreach ($bargain_data as $k => $v) {
$name .= $v['name'] . '(' . $role_arr[$v['role']] . $v['scale'] . '%),';
}
$pay_data['current_agent_name'] = rtrim($name, ',');
}
if (($pay_data['type'] == 10 || $pay_data['type'] == 30) && isset($house_data[0]['f_id'])) {
$current_agent_name = $m_report->selectReportById('report_agent_name,report_store_id', ['id' => $house_data[0]['f_id']]);
$pay_data['current_agent_name'] = empty($current_agent_name[0]['report_agent_name']) ? "" : $current_agent_name[0]['report_agent_name'];
}
$pay_data['site_id'] = '';
if ($pay_data['agent_id']) {
$redis_service = new RedisCacheService();
$agent_data = $redis_service->getRedisCache(2, $pay_data['agent_id']);
$pay_data['site_id'] = $agent_data['site_id'];
}
$pay_data["img_path"] = CHAT_IMG_URL;
$pay_data["img_arr"] = $this->getOImg($pay_id, 2);
$pay_data['open_time'] = empty($pay_data['open_time']) ? '' : $pay_data['open_time'];
$m_open = new OPayLogOpen();
$open_id = $m_open->getFind('id', 0, ['pay_log_id' => $pay_data['id']]);
$pay_data['is_check'] = 0;
if ($open_id['id'] > 0) {
$pay_data['is_check'] = 1;
}
$adjustmentModel = new OPayLogAdjustment();
$refundModel = new ORefundModel();
$status = 0;
$is_adjustment = $adjustmentModel->getFieldValue('id', ['paylog_id' => $pay_id, 'is_del' => 0]);
$is_refund = $refundModel->getFind('id', ['pay_log_id' => $pay_id, 'is_del' => 0]);
if ($is_adjustment && $is_refund) {
$status = 3;
} else if ($is_adjustment) {
$status = 1;
} else if ($is_refund) {
$status = 2;
}
$pay_data["status"] = $status;
} catch (\Exception $e) {
return null;
}
return $pay_data;
}
}
\ No newline at end of file
......@@ -413,6 +413,18 @@ class PushMessageService
$title = '委托找铺';
$type = '';
break;
case 13:
$title = '开盘申请';
$type = '';
break;
case 14:
$title = '退款驳回';
$type = '';
break;
case 15:
$title = '财务日报提醒';
$type = '';
break;
}
$this->pushAgentAllDeviceId($v['addressee_id'], $title, $v['message'], $type, $id, $is_forbidden,$v['house_id'], $v['order_id']);
......
......@@ -114,7 +114,7 @@ class RedisCacheService
* @param $id
* @return bool
*/
public function delRedisCache($type, $id)
public function delRedisCache($type, $id = 0)
{
$result = 0;
switch ($type) {
......@@ -129,6 +129,13 @@ class RedisCacheService
break;
case 4 :
$result = $this->redis_ext->del($this->rule_key.$id);
break;
case 5 :
$result = $this->redis_ext->del($this->group_site_key.$id);
break;
case 6 :
$result = $this->redis_ext->del($this->site_city_all_key);
break;
}
return $result;
......@@ -235,8 +242,13 @@ class RedisCacheService
$m_auth_rule = new AuthRule();
$field = 'id,name,title,pid,is_menu';
$data = $m_auth_rule->getRule($field, ['name'=>$name,'status'=>0]);
$this->setRedisCache($this->rule_key . $name, $data[0]);
$result = $data[0];
if (!empty($data)) {
$this->setRedisCache($this->rule_key . $name, $data[0]);
$result = $data[0];
} else {
$result = [];
}
} catch (\Exception $e) {
$result = [];
}
......@@ -275,7 +287,10 @@ class RedisCacheService
if (empty($result)) {
$m_auth_rule = new ASite();
$result = $m_auth_rule->getSiteList();
$this->setRedisCache($this->site_city_all_key, $result);
if (!empty($result)) {
$this->setRedisCache($this->site_city_all_key, $result);
}
} else {
$result = json_decode($result, true);
}
......@@ -294,7 +309,9 @@ class RedisCacheService
if (empty($label_data)) {
$m_label = new ULabels();
$label_data = $m_label->getColumn('id,name', ['type'=>1]); //获取标签
$this->setRedisCache($this->label_call_key, $label_data);
if (!empty($label_data)) {
$this->setRedisCache($this->label_call_key, $label_data);
}
} else {
$label_data = json_decode($label_data, true);
}
......
......@@ -25,6 +25,7 @@ class PayLogOpenValidate extends Validate
'status' => 'require|number|in:1,2,3',
'operation_id' => 'require|number',
'operation_name' => 'require',
'open_img' => 'require',
];
protected $message = [
......@@ -50,10 +51,11 @@ class PayLogOpenValidate extends Validate
'operation_id.require' => '操作人id必填',
'operation_id.number' => '操作人id只能为数字',
'operation_name.require' => '操作人姓名必填',
'open_img.require' => '图片必填',
];
protected $scene = [
'applyForOpen' => ['pay_log_id', 'report_id', 'bargain_id', 'order_id', 'agent_id', 'house_id', 'house_address', 'intro'],
'applyForOpen' => ['pay_log_id', 'report_id', 'bargain_id', 'order_id', 'agent_id', 'house_id', 'house_address', 'intro','open_img'],
'openCheck' => ['open_id', 'status', 'operation_id', 'operation_name'],
];
}
\ No newline at end of file
......@@ -182,6 +182,10 @@ class Index
{
return view('index/timeline_pc_office');
}
public function timeline_pc_financial()
{
return view('index/timeline_pc_financial');
}
public function bargaininfo_detail_static_pc()
{
return view('index/bargaininfo_detail_static_pc');
......
......@@ -57,7 +57,7 @@
</li>
<li>
<div>楼盘号:</div>
<div>商铺号:</div>
<div>{{detailData.house_number}}</div>
</li>
<li>
......
......@@ -165,12 +165,22 @@
</div>
</td>
</tr>
<tr v-if="false">
<tr v-if="true">
<td colspan="4">
<div class="fl">案场权限人:</div>
<div class="fl">
<ul class="oh phone-list">
<li class="fl oh" v-for="(item, index) in d.panParty" :key="index" :data-id="item.phone">{{item.name+'-'+item.phone}}</li>
<li class="fl oh">{{d.stronghold_info}}</li>
</ul>
</div>
</td>
</tr>
<tr v-if="true">
<td colspan="4">
<div class="fl">上传人:</div>
<div class="fl">
<ul class="oh phone-list">
<li class="fl oh">{{d.upload_user}}</li>
</ul>
</div>
</td>
......
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>同联商业</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0" />
<meta name="Keywords" content="" />
<meta name="Description" content="" />
</head>
<body style="display: none;">
<div id="app">
<ul id="main_list">
<li v-for="(item, index) in mainDataList" :class="{'main-li-first':index===0}">
<p>{{item.create_time}}</p>
<div class="main-area">
<div class="left-area"></div>
<div class="right-area">
<div class="right-area-top">
<h6 v-if="item.step_name==='financial'">
<p v-if="item.status == '1' && item.audit_level == '0'">财务部 申请撤销成交报告</p>
<p v-if="item.status == '1' && item.audit_level == '1'">财务部 一审通过</p>
<p v-if="item.status == '1' &&item.audit_level == '2'">财务部 二审通过</p>
<p v-if="item.status == '1' &&item.audit_level == '3'">财务部 三审通过 </p>
<p v-if="item.step_name==='financial' && item.status == '2'">财务部 审核驳回{{ item.status }}</p>
<p v-if="item.step_name==='financial' && item.status == '3' && item.audit_level == '1'">财务部 一审转到一级审核 </p>
<p v-if="item.step_name==='financial' && item.status == '3' && item.audit_level == '2'">财务部 二审转到一级审核 </p>
<p v-if="item.step_name==='financial' && item.status == '3' && item.audit_level == '3'">财务部 三审转到一级审核</p>
<p v-if="item.step_name==='financial' && item.status == '4'">财务部 成交报告已撤销</p>
</h6>
<h6 v-else>{{switchTitle2(item.step_name,item.status)}}</h6>
<p v-if="item.step_name==='refund_check' && item.status*1 == 4">备注:<span>{{item.remark}}</span></p>
<p v-if="item.step_name==='refund_check' && item.status*1 == 4">操作人:<span>{{item.operation_name}}</span></p>
<p v-if="item.step_name==='adjustment'">调整ID:<span>{{item.id}}</span></p>
<p v-if="item.step_name==='adjustment'">调整前收款ID:<span>{{item.paylog_id}}</span></p>
<p v-if="item.step_name==='adjustment'">调整后收款ID:<span>{{item.new_paylog_id}}</span></p>
<p v-if="item.step_name==='adjustment'">带看ID:<span>{{item.order_id}}</span></p>
<p v-if="item.step_name==='adjustment' && item.type == 1">调整类型:<span>意向金转中介费</span></p>
<p v-if="item.step_name==='adjustment' && item.type == 2">调整类型:<span>意向金转案场费</span></p>
<p v-if="item.step_name==='adjustment' && item.type == 3">调整类型:<span>意向金转意向金</span></p>
<p v-if="item.step_name==='adjustment' && item.type == 4">调整类型:<span>保管金转中介费</span></p>
<p v-if="item.step_name==='adjustment' && item.type == 5">调整类型:<span>保管金转案场费</span></p>
<p v-if="item.step_name==='adjustment' && item.type == 6">调整类型:<span>保管金转保管金</span></p>
<p v-if="item.step_name==='adjustment'">调整金额:<span>{{item.money}}元</span></p>
<p v-if="item.step_name==='report'">{{item.house_title}}</p>
<p v-if="item.step_name==='report'">客户:<span>{{item.user_name}}</span></p>
<p v-if="item.step_name==='report'">客户电话:<span>{{hideTel(item.user_phone)}}</span></p>
<p v-if="item.step_name==='report'">约带看人:<span>{{item.report_agent_name}}</span></p>
<p v-if="item.step_name==='report'">约带看人电话:<span><a href="javascript:;">{{item.report_agent_phone}}</a></span></p>
<p v-if="item.step_name==='report'">预计到场时间:<span>{{item.predict_see_time}}</span></p>
<p v-if="item.step_name==='report'">楼盘地址:<span>{{item.internal_address}}</span></p>
<p v-if="item.step_name==='follow_up_log'">属于哪类客户:<span>{{item.user_type}}</span></p>
<p v-if="item.step_name==='follow_up_log'">第一决策人:<span>{{item.decision_maker}}</span></p>
<p v-if="item.step_name==='follow_up_log'">租楼盘做什么:<span>{{item.industry_type}}</span></p>
<p v-if="item.step_name==='follow_up_log'">对面积的要求:<span>{{item.area_requirement}}</span></p>
<p v-if="item.step_name==='follow_up_log'">对价格的要求:<span>{{item.price_requirement}}</span></p>
<p v-if="item.step_name==='follow_up_log'">所在区域:<span>{{item.area_detail+' '+item.business_area}}</span></p>
<p v-if="item.step_name==='pay_log'">收款ID:<span>{{item.list[0].id}}</span></p>
<div v-if="item.step_name==='pay_log'">
<div class="sp-pay-log-div" v-for="(item2, idnex2) in item.list">
<p>入账类型:<span>{{switchRzType(item2.type)}}</span></p>
<p>支付方式:<span>{{switchPayType(item2.pay_type)}}</span></p>
<p>入账金额:<span class="span-active">{{item2.money}}元</span></p>
</div>
</div>
<p v-if="item.step_name==='pay_log'&&item.list[0].type==10">最后转定时间:<span>{{item.list[0].last_transfer_time}}</span></p>
<p v-if="item.step_name==='pay_log'&&item.list[0].type==10">收条编号:<span>{{item.list[0].receipt_number}}</span></p>
<p v-if="item.step_name==='pay_log'&&item.list[0].type==30">最后转定时间:<span>{{item.list[0].last_transfer_time}}</span></p>
<p v-if="item.step_name==='pay_log'&&item.list[0].type==30">收条编号:<span>{{item.list[0].receipt_number}}</span></p>
<p v-if="item.step_name==='pay_log'">入账姓名:<span>{{item.list[0].transfer_name}}</span></p>
<p v-if="item.step_name==='pay_log'">楼盘号:<span>{{item.list[0].house_number}}</span></p>
<p v-if="item.step_name==='pay_log'">业态/品牌:<span>{{item.list[0].industry_type}}</span></p>
<p v-if="item.step_name==='pay_log' && item.list[0].source == 0">来源:<span>APP</span></p>
<p v-if="item.step_name==='pay_log' && item.list[0].source == 1">来源:<span>智能pos机</span></p>
<p v-if="item.step_name==='pay_log' && item.list[0].source == 2">来源:<span>调整</span></p>
<ol v-if="item.step_name==='pay_log'" class="li-img-list">
<li v-for="(item2, idnex2) in item.img">
<a href="javascript:;" class="click-big-img-a"><img class="J_preview" :src="item.img_path+item2.img_name"></a>
</li>
<!--<li>
<a href="javascript:;" class="click-big-img-a"><img class="J_preview" src="https://pre2.tonglianjituan.com/static/chat_image/20190114/201901141550135536.jpg"></a>
</li>
<li>
<a href="javascript:;" class="click-big-img-a"><img class="J_preview" src="https://pre2.tonglianjituan.com/static/chat_image/20190114/20190114155013553693.jpg"></a>
</li>
<li>
<a href="javascript:;" class="click-big-img-a"><img class="J_preview" src="https://pre2.tonglianjituan.com/static/chat_image/20190114/201901141550135536932722.jpg"></a>
</li>-->
</ol>
<p v-if="item.step_name==='refund'">退款ID:<span class="span-active">{{item.id}}</span></p>
<p v-if="item.step_name==='refund'">要退金额的收款ID:<span class="span-active">{{item.pay_log_id}}</span></p>
<p v-if="item.step_name==='refund'">要退款类型:<span class="span-active">{{switchRefundTypeStr(item.type)}}</span></p>
<p v-if="item.step_name==='refund'">退款金额:<span class="span-active">{{item.refund_money}}</span></p>
<p v-if="item.step_name==='refund'">退款账户:<span class="span-active">{{item.card_no}}</span></p>
<p v-if="item.step_name==='refund'">开户行:<span class="span-active">{{item.bank}}</span></p>
<p v-if="item.step_name==='refund'">户名:<span class="span-active">{{item.name}}</span></p>
<p v-if="item.step_name==='refund'">收款人手机:<span class="span-active">{{item.phone}}</span></p>
<p v-if="item.step_name==='bargain'">成交类型:<span>{{switchTradeType(item.trade_type)}}</span></p>
<p v-if="item.step_name==='bargain'">楼盘号:<span>{{item.house_number}}</span></p>
<p v-if="item.step_name==='bargain'">业态/品牌:<span>{{item.industry_type}}</span></p>
<p v-if="item.step_name==='bargain'">成交价:<span class="span-active">{{item.price}}元</span></p>
<p v-if="item.step_name==='bargain'">应收佣金:<span class="span-active">{{item.commission}}元</span></p>
<div v-if="item.step_name==='bargain'">
<div class="sp-pay-log-div" v-for="(item2, idnex2) in item.list_array">
<p>分佣方:<span>{{switchRoleType(item2.role)}}</span></p>
<p>业务员:<span>{{item2.name+item2.phone}}</span></p>
<p>分佣比例:<span>{{item2.scale}}%</span></p>
<p>应分佣金:<span class="span-active">{{item2.scale_fee}}元</span></p>
<p class="li-caozuoren">操作人:<span>{{item2.submit_agent_name}}</span></p>
</div>
</div>
<p v-if="item.step_name==='march_in'">补充说明:<span class="buchongshuoming">{{item.march_in_remark}}</span></p>
<p v-if="item.step_name==='follow_up_log'">补充说明:<span class="buchongshuoming">{{item.explain}}</span></p>
<p v-if="item.step_name==='march_in'">地址:{{item.march_in_area}}</p>
<ol v-if="item.step_name==='march_in'" class="li-img-list">
<li v-for="(item2, idnex2) in item.img">
<a href="javascript:;" class="click-big-img-a"><img class="J_preview" :src="item.img_path+item2.img_name"></a>
</li>
</ol>
<ol v-if="item.step_name==='follow_up_log'" class="li-img-list">
<li>
<a href="javascript:;" class="click-big-img-a"><img class="J_preview" :src="item.img_path+item.explain_img"></a>
</li>
</ol>
<ol v-if="item.step_name==='refund_check' && item.status*1 == 2" class="li-img-list">
<li v-for="(item2, idnex2) in item.img">
<a href="javascript:;" class="click-big-img-a"><img class="J_preview" :src="item.img_path+item2.img_name"></a>
</li>
</ol>
<p v-if="item.step_name==='march_in'" class="li-caozuoren">操作人:<span>{{item.reception_name}}</span></p>
<p v-if="item.step_name==='follow_up_log'" class="li-caozuoren">操作人:<span>{{item.agent_name}}</span></p>
<p v-if="item.step_name==='pay_log'" class="li-caozuoren">操作人:<span>{{item.list[0].agent_name}}</span></p>
<p v-if="item.step_name==='refund'" class="li-caozuoren">操作人:<span>{{item.agent_name}}</span></p>
<!--<p v-if="item.step_name==='bargain'" class="li-caozuoren">操作人:<span>{{item.submit_agent_name}}</span></p>-->
<!--<p v-if="item.step_name==='financial' && item.status == '4' ">备注:<span>{{item.remark}}</span></p>-->
<p v-if="item.step_name==='financial'" class="li-caozuoren">操作人:<span>{{item.audit_name}}</span></p>
<p v-if="item.step_name==='adjustment'" class="li-caozuoren">操作人:<span>{{item.name}}</span></p>
<p v-if="item.step_name==='refund_check' && item.status*1 == 2">操作人:<span>{{item.operation_name}}</span></p>
<ol v-if="item.step_name==='refund'" class="li-img-list">
<li v-for="(item2, idnex2) in item.img">
<a href="javascript:;" class="click-big-img-a"><img class="J_preview" :src="item.img_path+item2.img_name"></a>
</li>
</ol>
</div>
</div>
</div>
<div class="round-tip">
<div></div>
</div>
</li>
</ul>
</div>
<script src="/app/js/libs/require.min.js" data-js="/app/js/timeline_pc_financial.js" data-main="/app/js/main" defer async="true"></script>
</body>
</html>
<!--
report 报备
march_in 进场
follow_up_log 跟进
pay_log 收款
refund 退款
bargain 成交报告
-->
\ No newline at end of file
......@@ -587,7 +587,7 @@ class AppChat extends Basic
//获取此经纪人的所有盘方楼盘id
$param["addressee_id"] = $params["agent_id"];
$param["type"] = 8;
$param["type"] = ['in', '8,14'];
$msgModel = new MPushMessage();
$history_result = $msgModel->getListByWhere($field, $param, $page_no, $page_size);
......
<?php
namespace app\index\controller;
use app\index\extend\Basic;
use app\model\ODailyUncommittedModel;
use think\Request;
class DailyUncommitted extends Basic
{
private $m_daily_uncommitted;
public function __construct(Request $request = null)
{
parent::__construct($request);
$this->m_daily_uncommitted = new ODailyUncommittedModel();
}
/**
* 财务日报未提交 记录
* @return \think\Response
*/
public function DailyUncommittedList()
{
$params = $this->params;
$pageNo = empty($this->params['pageNo']) ? 1 : $this->params['pageNo'];
$pageSize = empty($this->params['pageSize']) ? 10 : $this->params['pageSize'];
$conditions = [];
if (!empty($params['daily_date']) ) {
if(!checkTimeData($params['daily_date'])){
return $this->response("101", '非法时间');
}
$conditions['a.daily_date'] = $params['daily_date'];
}
if (!empty($params['store_id'])) {
$conditions['a.store_id'] = $params['store_id'];
}
$conditions['a.status'] = 0;
$field = 'a.daily_date,b.store_name';
$result = $this->m_daily_uncommitted->getDailyUncommittedList($field, $conditions, $pageNo, $pageSize);
if (!$result)
return $this->response("200", "成功", []);
$result_total = $this->m_daily_uncommitted->getDailyUncommittedTotal($field, $conditions);
$data['list'] = $result;
$data['total'] = $result_total;
return $this->response("200", "成功", $data);
}
/**
*
* @param $store_id
* @param $time
* @return bool
*/
public function updateUncommittedList($store_id,$time)
{
$params_d = [];
$params_d['store_id'] = $store_id;
$params_d['daily_date'] = $time;
$result = $this->m_daily_uncommitted->getDailyUncommitted('id',$params_d);
if ($result){
$this->m_daily_uncommitted->updateDailyUncommitted(['id'=>$result['id']],['status'=>1]);
}
return true;
}
}
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -6,6 +6,7 @@ use app\index\extend\Basic;
use app\index\service\UserAgentService;
use app\index\service\UserSiteService;
use app\model\GImageDepot;
use app\model\OPayLogModel;
/**
* zhuwei
......@@ -178,6 +179,14 @@ class ImageDepot extends Basic
}
public function ceshi()
{
$m_pay_log = new OPayLogModel();
$pay_log_info = $m_pay_log->getPayLogByOrderId("b.house_id", ['id'=>1126]);
dump($pay_log_info[0]['house_id']);
}
}
......
......@@ -197,7 +197,7 @@ class OfficeBargain extends Basic
$order = 'a.id DESC';
$where['a.status'] = 10;
$where['a.audit_level'] = 0;
$excel_title .= '-第级审核';
$excel_title .= '-第级审核';
}
if (!empty($this->params['status'])) {
......@@ -318,14 +318,28 @@ class OfficeBargain extends Basic
$excel_data[$k]['house_number'] = $v['house_number'];
$excel_data[$k]['price'] = $v['price'];
$excel_data[$k]['submit_agent_name'] = $v['submit_agent_name'];
$excel_data[$k]['trade_type'] = array_key_exists($v['trade_type'], $trade_type_arr) ? $trade_type_arr[$v['labels_id']] : '其他';
$excel_data[$k]['trade_type'] = array_key_exists($v['trade_type'], $trade_type_arr) ? $trade_type_arr[$v['trade_type']] : '其他';
$excel_data[$k]['commission'] = $v['commission'];
$excel_data[$k]['income_money'] = $m_real->sumField('money',['bargain_id'=>$v['id'], 'is_del'=>0]);
$excel_data[$k]['subtract'] = $v['commission'] - $excel_data[$k]['income_money'];
$where_role[] = ['EXP', 'a.id = '.$v['id'].' OR a.father_id = '.$v['id']];
$where_role['a.status'] = ['<>', 30];
$where_role['a.role'] = 3;
$agent_data = $this->m_bargain->agentBargainAll('b.name', $where_role);
if ($agent_data) {
$name_string = '';
foreach ($agent_data as $vv) {
$name_string .= $vv['name'].',';
}
$excel_data[$k]['agent_name'] = rtrim($name_string, ',');
} else {
$excel_data[$k]['agent_name'] = '';
}
}
$export = new ExportExcelUntil();
$title = [ 'ID', '提交时间', '商铺地址', '商铺号', '成交价', '提交人', '成交类型', '应收佣金(元)','已收佣金(元)','未收佣金(元)' ];
$title = [ 'ID', '提交时间', '商铺地址', '商铺号', '成交价', '提交人', '成交类型', '应收佣金(元)','已收佣金(元)','未收佣金(元)', '反签方'];
$export->exportTable($excel_title, $excel_data, 11, $excel_title, $title);
}
}
......@@ -566,14 +580,14 @@ class OfficeBargain extends Basic
return $this->response(101, '参数错误');
}
$m_report = new OfficeOReportModel();
$m_user = new Users();
$user_id = $m_report->getFieldValue('user_id', ['id'=>$report_id]);
$id = $m_user->getUserByWhereValue('id', ['id'=>$user_id,'referrer_source'=>10,'status'=>0]);
// $m_report = new OfficeOReportModel();
// $m_user = new Users();
// $user_id = $m_report->getFieldValue('user_id', ['id'=>$report_id]);
// $id = $m_user->getUserByWhereValue('id', ['id'=>$user_id,'referrer_source'=>10,'status'=>0]);
$is_show = 0;
if ($id) {
$is_show = 1;
}
// if ($id) {
// $is_show = 1;
// }
return $this->response(200,'', ['is_show'=>$is_show]);
}
......
......@@ -8,44 +8,15 @@
namespace app\index\controller;
use app\api\service\ConvertCouponService;
use app\api\service\CouponService;
use app\api_broker\service\OrderLogService;
use app\api_broker\service\PayLogOpenService;
use app\api_broker\service\PayLogService;
use app\api_broker\service\OfficeOrderLogService;
use app\api_broker\service\RedisCacheService;
use app\api_broker\service\VipService;
use app\index\extend\Basic;
use app\index\untils\ExportExcelUntil;
use app\model\AAgents;
use app\model\AStore;
use app\model\GHouses;
use app\model\GHousesToAgents;
use app\model\OBargainLogModel;
use app\model\OBargainModel;
use app\model\ODaily;
use app\model\OfficeOImg;
use app\model\OfficeOPartialCommission;
use app\model\OfficeOPayLogModel;
use app\model\OImg;
use app\model\OMarchInModel;
use app\model\OPayLogAdjustment;
use app\model\OPayLogOpen;
use app\model\OPayLogOpenLog;
use app\model\OrderModel;
use app\model\ORealIncome;
use app\model\ORefundLogModel;
use app\model\OReportModel;
use app\model\OTaxes;
use app\model\OFinancialAudit;
use app\model\OPartialCommission;
use app\model\OPayLogModel;
use app\model\ORefundModel;
use app\model\TAgentTotalModel;
use app\model\Users;
use app\task\controller\ResultsSummaryNewTask;
use think\Exception;
use app\model\OfficeORealIncome;
use app\model\OfficeOTaxes;
use think\Request;
class OfficeFinance extends Basic
......@@ -142,4 +113,447 @@ class OfficeFinance extends Basic
return $this->response("200", "request success", $data);
}
/**
* 税费承担明细表
*
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getTallAgeList()
{
if (!$this->request->isAjax() && ($this->params['excel'] != 1)) {
return view('tax');
}
$data['code'] = 200;
$data['msg'] = "";
$data['data'] = [];
$pageNo = empty($this->params['pageNo']) ? 1 : $this->params['pageNo'];
$pageSize = empty($this->params['pageSize']) ? 15 : $this->params['pageSize'];
$where['a.is_del'] = 0;
$where['a.father_id'] = [ 'neq', 0 ];
if (!empty($this->params['create_time']) && empty($this->params['end_time'])) {
$where['a.operation_date'] = [ '> time', $this->params['create_time'] . ' 00:00:00' ];
}
if (!empty($this->params['end_time']) && empty($this->params['create_time'])) {
$where['a.operation_date'] = [ '< time', $this->params['end_time'] . ' 23:59:59' ];
}
if (!empty($this->params['end_time']) && !empty($this->params['create_time'])) {
$where['a.operation_date'] = [ 'between time', [ $this->params['create_time'] . ' 00:00:00', $this->params['end_time'] . ' 23:59:59' ] ];
}
if (!empty($this->params['internal_address'])) {
$where['f.address'] = [ 'like', '%' . $this->params['internal_address'] . '%' ];
}
if (!empty($this->params['phone'])) {
$where['e.phone'] = [ 'like', '%' . $this->params['phone'] . '%' ];
}
if (!empty($this->params['name'])) {
$where['e.name'] = [ 'like', '%' . $this->params['name'] . '%' ];
}
if (!empty($this->params['house_number'])) {
$where['b.house_number'] = [ 'like', '%' . $this->params['house_number'] . '%' ];
}
if (!empty($this->params['bargain_id'])) {
$where['b.id'] = $this->params['bargain_id'];
}
$m_fee = new OfficeOTaxes();
$s_redis = new RedisCacheService();
$fields = 'a.id,a.operation_date,e.name,e.phone,a.fee,b.house_number,f.address as internal_address,a.agent_id,b.father_id,b.id as bargain_id,b.order_id';
if ($this->params['excel'] != 1) {
$list = $m_fee->getTaxesList($pageNo, $pageSize, 'a.id desc', $fields, $where);
foreach ($list as $k => $v) {
$agent_data = $s_redis->getRedisCache(2, $v['agent_id']);
$list[$k]['district_store'] = $agent_data['district_name'];
}
$data['data']['list'] = $list;
$data['data']['total'] = $m_fee->getTaxesListTotal($where);
$data['data']['total_fee'] = $m_fee->getTaxesListTotalFee($where);
return $this->response($data['code'], $data['msg'], $data['data']);
} else {
$list = $m_fee->getTaxesList($pageNo, 50000, 'a.id desc', $fields, $where);
if (count($data['data']) > 0) {
$excel_data = [];
foreach ($list as $k=>$v) {
$agent_data = $s_redis->getRedisCache(2, $v['agent_id']);
$list[$k]['district_store'] = $agent_data['district_name'];
$excel_data[$k]['bargain_id'] = $v['bargain_id'];
$excel_data[$k]['operation_date'] = $v['operation_date'];
$excel_data[$k]['name'] = $v['name'];
$excel_data[$k]['internal_address'] = $v['internal_address'];
$excel_data[$k]['house_number'] = $v['house_number'];
$excel_data[$k]['fee'] = $v['fee'];
}
$export = new ExportExcelUntil();
$title = [ '成交报告ID', '开票日期', '所属部门/门店', '业务员', '商铺地址', '商铺号', '税费(元)'];
$export->exportTable('税费明细', $excel_data, 7, '税费明细', $title);
} else {
return $this->response(101, '数据为空');
}
}
}
/**
* 报备时间轴
*
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function selectReportAll()
{
header('Access-Control-Allow-Origin:*');
$params = $this->params;
if (!isset($params["order_id"])) {
return $this->response("101", "请求参数错误");
}
$service_ = new OfficeOrderLogService();
$data = $service_->selectListByOrderNo($params["order_id"]);
return $this->response("200", "request success", $data);
}
/**
* 导出分佣提成明细表
*
* @return string
*/
public function exportExcel()
{
$pageNo = 1;
$pageSize = 250000;
$where = [];
$where['a.confirm_status'] = 1;
$where['a.is_del'] = 0;
$where['b.status'] = ['in','10,11,13'];
if (!empty($this->params['create_time']) && empty($this->params['end_time'])) {
$where['f.income_time'] = [ '>= time', $this->params['create_time'] . ' 00:00:00' ];
}
if (!empty($this->params['end_time']) && empty($this->params['create_time'])) {
$where['f.income_time'] = [ '<= time', $this->params['end_time'] . ' 23:59:59' ];
}
if (!empty($this->params['end_time']) && !empty($this->params['create_time'])) {
$where['f.income_time'] = [ 'between time', [ $this->params['create_time'] . ' 00:00:00', $this->params['end_time'] . ' 23:59:59' ] ];
}
if (!empty($this->params['internal_address'])) {
$where['d.internal_address'] = [ 'like', '%' . $this->params['internal_address'] . '%' ];
}
if (!empty($this->params['house_number'])) {
$where['b.house_number'] = [ 'like', '%' . $this->params['house_number'] . '%' ];
}
if (!empty($this->params['bargain_id'])) {
$where[] = [ 'EXP', 'b.id =' . $this->params['bargain_id'] . ' or father_id=' . $this->params['bargain_id'] ];
}
if (!empty($this->params['store_id'])) {
$where['e.store_id'] = $this->params['store_id'];
}
if (!empty($this->params['district_id'])) {
$where['e.district_id'] = $this->params['district_id'];
}
if (!empty($this->params['partial_id'])) {
$where['e.id'] = $this->params['partial_id'];
}
$field = 'a.id,a.confirm_date,a.practical_fee,b.scale_fee,b.scale,b.role,d.s.address as internal_address,b.agent_id,cash,';
$field .= 'service_charge,charity_fund,real_fee,a.real_income_id,a.should_commission,b.father_id,b.id as bargain_id';
$m_commission = new OfficeOPartialCommission();
try {
$data = $m_commission->getCommissionBargainColumn($pageNo, $pageSize, 'a.id desc', $field, $where);
$m_agent = new AAgents();
$m_real = new OfficeORealIncome();
$fields_str = 'a.id,a.name,a.phone,b.store_name,c.district_name';
$result = [];
foreach ($data as $k => $v) {
if ($v['father_id'] >0 ) {
$result[$k]['bargain_id'] = $v['father_id'];
} else {
$result[$k]['bargain_id'] = $v['bargain_id'];
}
$result[$k]['income_time'] = $m_real->where('id', $v['real_income_id'])->value('income_time');
if ($v['agent_id']) {
$agent_data = $m_agent->getStoreDistrict($fields_str, [ 'a.id' => $v['agent_id'] ]);
$result[$k]['district_store'] = $agent_data['store_name'] . '-' . $agent_data['store_name'];
$result[$k]['agent'] = $agent_data['name'] . '-' . $agent_data['phone'];
}
$result[$k]['internal_address'] = $v['internal_address'];
switch ($v['role']) {
case 1:
$result[$k]['role'] = '盘方';
break;
case 2:
$result[$k]['role'] = '客方';
break;
case 3:
$result[$k]['role'] = '反签';
break;
case 4:
$result[$k]['role'] = '独家';
break;
case 5:
$result[$k]['role'] = '合作方';
break;
case 6:
$result[$k]['role'] = 'APP盘下载方';
break;
case 7:
$result[$k]['role'] = 'APP客下载方';
break;
default:
$result[$k]['role'] = '未定义';
}
$result[$k]['scale'] = $v['scale'];
$result[$k]['should_commission'] = $v['should_commission'];
$result[$k]['real_fee'] = $v['real_fee'];
$result[$k]['service_charge'] = $v['service_charge'];
$result[$k]['charity_fund'] = $v['charity_fund'];
$result[$k]['cash'] = $v['cash'];
$result[$k]['practical_fee'] = $v['practical_fee'];
}
} catch (\Exception $e) {
return '<script>alert("导出分佣提成明细列表失败");window.close();</script>';
}
$export = new ExportExcelUntil();
$title = [ '成交报告ID','收佣日期', '所属部门/门店', '业务员','商铺地址','分佣角色', '分佣比例(%)','应分佣金(元)', '预分佣金(元)', '手续费(元)', '慈善基金(元)', '现金奖(元)', '实收佣金(元)' ];
$export->exportTable('实收明细表', $result, 12, '实收明细表', $title);
return '';
}
/**
* 分佣提成汇总表
*
* @return \think\Response|\think\response\View
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getCommissionTotalList()
{
if (!$this->request->isAjax() && $this->params['excel'] != 1) {
return view('commission_total');
}
$m_partial = new OfficeOPartialCommission();
$m_store = new AStore();
$m_tax = new OfficeOTaxes();
$data['code'] = 200;
$data['msg'] = "";
$data['data'] = $excel_data = [];
$pageSize = empty($this->params['pageSize']) ? 10 : $this->params['pageSize'];
$pageNo = empty($this->params['pageNo']) ? 1 : $this->params['pageNo'];
$operation_start_data = $operation_end_data = $income_date = $operation_date = '';
$where['a.confirm_status'] = 1;
$is_bargain = 0;
/**收佣日期 start**/
$sql_string = 'or a.agent_id in (SELECT agent_id FROM o_taxes WHERE is_del=0 and father_id > 0 and operation_date';
if (!empty($this->params['income_start_date']) && empty($this->params['income_end_date'])) {
$where[0] = ['EXP', "b.income_time > '{$this->params['income_start_date']}' {$sql_string} > '{$this->params['income_start_date']}' GROUP BY agent_id)"];
$income_date = date('Y.m.d', strtotime($this->params['income_start_date']));
$operation_start_data = $this->params['income_start_date'];
}
if (!empty($this->params['income_end_date']) && empty($this->params['income_start_date'])) {
$where[0] = ['EXP', "b.income_time < '{$this->params['income_end_date']}' {$sql_string} > '{$this->params['income_end_date']}' GROUP BY agent_id)"];
$income_date = '-' . date('Y.m.d', strtotime($this->params['income_end_date']));
$operation_end_data = $this->params['income_end_date'];
}
if (!empty($this->params['income_start_date']) && !empty($this->params['income_end_date'])) {
$where[0] =['EXP', "b.income_time BETWEEN '{$this->params['income_start_date']}' AND '{$this->params['income_end_date']}' {$sql_string} BETWEEN '{$this->params['income_start_date']}' AND '{$this->params['income_end_date']}' GROUP BY agent_id)"];
$income_date = date('Y.m.d', strtotime($this->params['income_start_date'])) . '-' . date('Y.m.d', strtotime($this->params['income_end_date']));
$operation_start_data = $this->params['income_start_date'];
$operation_end_data = $this->params['income_end_date'];
}
/**收佣日期 end**/
if (!empty($this->params['bargain_start_date']) && empty($this->params['bargain_end_date'])) {
$where[1] = ['EXP', "e.create_time > '{$this->params['bargain_start_date']} 00:00:00' {$sql_string} > '{$this->params['bargain_start_date']}' GROUP BY agent_id)"];
$operation_date = date('Y.m.d', strtotime($this->params['bargain_start_date']));
$operation_start_data = $this->params['bargain_start_date'];
$is_bargain = 1;
}
if (!empty($this->params['bargain_end_date']) && empty($this->params['bargain_start_date'])) {
$where[1] = ['EXP', "e.create_time < '{$this->params['bargain_end_date']} 23:59:59' {$sql_string} > '{$this->params['bargain_end_date']}' GROUP BY agent_id)"];
$operation_date = date('Y.m.d', strtotime($this->params['bargain_end_date']));
$operation_end_data = $this->params['bargain_end_date'];
$is_bargain = 1;
}
if (!empty($this->params['bargain_start_date']) && !empty($this->params['bargain_end_date'])) {
$where[1] =['EXP', "e.create_time BETWEEN '{$this->params['bargain_start_date']} 00:00:00' AND '{$this->params['bargain_end_date']} 23:59:59' {$sql_string} BETWEEN '{$this->params['bargain_start_date']}' AND '{$this->params['bargain_end_date']}' GROUP BY agent_id)"];
$operation_date = date('Y.m.d', strtotime($this->params['bargain_start_date'])) . '-' . date('Y.m.d', strtotime($this->params['bargain_end_date']));
$operation_start_data = $this->params['bargain_start_date'];
$operation_end_data = $this->params['bargain_end_date'];
$is_bargain = 1;
}
/**部门id**/
if (!empty($this->params['district_id'])) {
$taxes_where['c.district_id'] = $where['d.district_id'] = $this->params['district_id'];
}
/**门店名**/
if (!empty($this->params['store_id'])) {
$taxes_where['c.store_id'] = $where['d.store_id'] = $this->params['store_id'];
}
/**经纪人手机号**/
if (!empty($this->params['agent_id'])) {
$taxes_where['b.agent_id'] = $where['a.agent_id'] = $this->params['agent_id'];
}
$partial_fields = 'sum( a.practical_fee ) as practical_fee,sum( a.real_fee ) as real_fee,sum(a.cash) as cash,';
$partial_fields .= 'sum( a.service_charge ) as service_charge,sum( a.charity_fund ) as charity_fund';
$fields = 'a.agent_id,d.name,d.store_id,e.status';
$partial_where['b.status'] = ['IN', '10,11,13'];
$partial_where['a.is_del'] = $taxes_where['is_del'] = 0;
$taxes_where['a.father_id'] = ['>', 0];
$taxes_where['a.operation_date'] = ['between', [$operation_start_data, $operation_end_data]];
if (empty($this->params['excel']) && $this->params['excel'] != 1) {
$taxes_where['a.father_id'] = ['>', 0];
$taxes_where['a.is_del'] = 0;
$taxes_where['a.operation_date'] = ['between', [$operation_start_data, $operation_end_data]];
$data['data']['total_taxes'] = $m_tax->sumBargainFee('a.fee', $taxes_where);;
if (!empty($this->params['confirm_date'])) {
$partial_where['a.confirm_date'] = $where['a.confirm_date'] = ['<=', $this->params['confirm_date'].' 23:59:59'];
$partial_where['a.confirm_status'] = 1;
}
$list = $m_partial->getCommissionTotalList($pageNo, $pageSize, $fields, $where, $operation_start_data, $operation_end_data, $is_bargain);
foreach ($list as $k => $v) {
if (in_array($v['status'], [10,11,13])) {
$partial_where['a.agent_id'] =$v['agent_id'];
if ($is_bargain != 1) {
$partial_where['c.income_time'] = ['between', [$operation_start_data, $operation_end_data]];
} else {
$partial_where['b.create_time'] = ['between', [$operation_start_data, $operation_end_data]];
}
$partial_data = $m_partial->getSumMoney($partial_fields, $partial_where);
$list[$k]['service_charge'] = empty($partial_data['service_charge'])? 0:$partial_data['service_charge']; //手续费
$list[$k]['cash'] = empty($partial_data['cash']) ? 0:$partial_data['cash']; //现金奖
$list[$k]['charity_fund'] = empty($partial_data['charity_fund']) ? 0 : $partial_data['charity_fund']; //慈善基金
$list[$k]['practical_fee'] = empty($partial_data['practical_fee']) ? 0:$partial_data['practical_fee']; //实收佣金
} else {
$list[$k]['practical_fee'] = 0;
$list[$k]['real_fee'] = 0;
$list[$k]['service_charge'] = 0;
$list[$k]['charity_fund'] = 0;
}
$taxes_where['a.agent_id'] = $v['agent_id'];
$list[$k]['fee'] = $m_tax->sumBargainFee('a.fee', $taxes_where);
$list[$k]['income_date'] = $income_date;
$list[$k]['operation_date'] = $operation_date;
$list[$k]['district_store'] = $m_store->getStoreDistrictName($v['store_id']);
$list[$k]['name'] = $v['name'];
}
$data['data']['list'] = $list;
$data['data']['total'] = $m_partial->getCommissionTotalListTotal($where);
if (isset($where[0])) {
$where[0] = ['EXP',"b.income_time BETWEEN '{$this->params['income_start_date']}' AND '{$this->params['income_end_date']}'"];
}
if (isset($where[1])){
$where[1] =['EXP', "e.create_time BETWEEN '{$this->params['bargain_start_date']} 00:00:00' AND '{$this->params['bargain_end_date']} 23:59:59'"];
}
$where['e.status'] = ['IN', '10,11,13'];
unset($where['c.is_del']);
$data['data']['total_money'] = $m_partial->getCommissionTotalInfo('a.practical_fee', $where);
} else {
//导出Excel
$pageSize = 25000;
$partial_fields .= ',sum(a.should_commission) as should_commission,sum(a.cash) as cash';
if (!empty($this->params['confirm_date'])) {
$partial_where['a.confirm_date'] = $where['a.confirm_date'] = ['<=', $this->params['confirm_date'].' 23:59:59'];
$partial_where['a.confirm_status'] = 1;
}
$result_data = $m_partial->getCommissionTotalList($pageNo, $pageSize, $fields, $where, $operation_start_data, $operation_end_data, $is_bargain);
$partial_where['b.status'] = ['IN', '10,11,13'];
$partial_where['a.is_del'] = $taxes_where['is_del'] = 0;
if ($is_bargain != 1) {
$partial_where['c.income_time'] = ['between', [$operation_start_data, $operation_end_data]];
} else {
$partial_where['b.create_time'] = ['between', [$operation_start_data, $operation_end_data]];
}
foreach ($result_data as $k => $v) {
$excel_data[$k]['income_date'] = $income_date; //收佣日期
$excel_data[$k]['operation_date'] = $operation_date; //成交日期
$excel_data[$k]['district_store'] = $m_store->getStoreDistrictName($v['store_id']);; //所属部门/门店
$excel_data[$k]['name'] = $v['name']; //业务员
$partial_where['a.agent_id'] =$v['agent_id'];
$partial_data = $m_partial->getSumMoney($partial_fields, $partial_where);
$excel_data[$k]['should_commission'] = empty($partial_data['should_commission']) ? 0:$partial_data['should_commission']; //应分佣金
$excel_data[$k]['service_charge'] = empty($partial_data['service_charge'])? 0:$partial_data['service_charge']; //手续费
$excel_data[$k]['cash'] = empty($partial_data['cash']) ? 0:$partial_data['cash']; //现金奖
$excel_data[$k]['charity_fund'] = empty($partial_data['charity_fund']) ? 0 : $partial_data['charity_fund']; //慈善基金
$excel_data[$k]['practical_fee'] = empty($partial_data['practical_fee']) ? 0:$partial_data['practical_fee']; //实收佣金
//税费
$taxes_where['a.agent_id'] = $v['agent_id'];
$excel_data[$k]['fee'] = $m_tax->sumBargainFee('a.fee', $taxes_where);
$excel_data[$k]['over_fee'] = $partial_data['practical_fee'] - $excel_data[$k]['fee'];
}
$num = count($excel_data) + 2;
$excel_data[$num]['income_time'] = '合计'; //收佣日期
$excel_data[$num]['create_time'] = ''; //成交日期
$excel_data[$num]['district_store'] = ''; //所属部门/门店
$excel_data[$num]['name'] = ''; //业务员
$excel_data[$num]['should_commission'] = "=SUM(E3:E{$num})"; //应分佣金
$excel_data[$num]['service_charge'] = "=SUM(F3:F{$num})"; //手续费
$excel_data[$num]['cash'] = "=SUM(G3:G{$num})"; //现金奖
$excel_data[$num]['charity_fund'] = "=SUM(H3:H{$num})"; //慈善基金
$excel_data[$num]['money'] = "=SUM(I3:I{$num})"; //实收佣金
$excel_data[$num]['fee'] = "=SUM(J3:J{$num})"; //税费
$excel_data[$num]['over_fee'] = "=SUM(K3:K{$num})";
$export = new ExportExcelUntil();
$title = ['收佣日期/开票日期', '成交日期/开票日期', '所属部门/门店', '业务员', '应分佣金(元)', '手续费(元)', '现金奖(元)', '慈善基金(元)', '实收佣金(元)', '税费(元)', '最终实收(元)'];
$export->exportTable('实收汇总表-办公楼', $excel_data, 10, '实收汇总表-办公楼', $title);
}
return $this->response($data['code'], $data['msg'], $data['data']);
}
}
......@@ -6,6 +6,7 @@ namespace app\index\controller;
use app\api_broker\service\OfficeOrderLogService;
use app\api_broker\service\OfficePayLogService;
use app\api_broker\service\PushMessageService;
use app\api_broker\service\RedisCacheService;
use app\index\extend\Basic;
use app\index\untils\ExportExcelUntil;
......@@ -1131,6 +1132,7 @@ class OfficePayLog extends Basic
$field = 'id,img_name';
$order = new OfficeOImg();
$params_img['img_type'] = 2;
$res = $order->getImgList($params_img,$field);
foreach ($res as $k => $v) {
$res[$k]['img_name'] = CHAT_IMG_URL . $v['img_name'];
......@@ -2191,7 +2193,7 @@ class OfficePayLog extends Basic
}
$refund_where['is_del'] = $status = 0;
$refund_data = $m_refund->selectRefundByOrderNo('id,status,order_id', $refund_where);
$refund_data = $m_refund->selectRefundByOrderNo('id,status,order_id,agent_id', $refund_where);
if (empty($refund_data[0]['id'])) {
return $this->response($code, '没有该退款详情或审核完成');
......@@ -2252,6 +2254,13 @@ class OfficePayLog extends Basic
$save_data['status'] = $status = 4;
$m_refund_log->updateData(['is_del'=>1], ['refund_id'=>$this->params['refund_id'],'status'=>1,'is_del'=>0]);
$num = $m_refund_log->insertData($save_data);
$push = new PushMessageService();
$m_order = new OfficeOrderModel();
$house_title = $m_order->getOrderById('house_id,house_title', $refund_data[0]['order_id']);
$record_data['message'] = '['.$house_title['house_title'].']退款被驳回,驳回原因:'.$save_data['remark'];
$record_data['order_id'] = $refund_data[0]['order_id'];
$push->record(14, $house_title['house_id'], [$refund_data[0]['agent_id']],$this->userId, $record_data);
}
if ($num) {
......@@ -2355,7 +2364,7 @@ class OfficePayLog extends Basic
$transfer_name = isset($params["transfer_name"]) ? $params["transfer_name"] : "";
$received_money = isset($params["received_money"]) ? $params["received_money"] : 0;
$type_ext = isset($params["type_ext"]) ? $params["type_ext"] : 0;
$is_open = isset($params['is_open']) ? $params['is_open'] : -1;
$is_open = isset($params['is_open']) ? $params['is_open'] : 0;
if($pay_id > 0){
$source = 2;
}
......
......@@ -172,10 +172,15 @@ class PayLogOpen extends Basic
$list = $this->m_pay_open->getListCheck($pageNo, $pageSize, 'a.id desc', $fields, $where);
//付款类型 10意向金 20定金 30保管金 40押金 50 租金 60 进场费 70转让费 80其他 90佣金 91中介费 92 案场费
$type_array = [
10=>'意向金', 20=>'定金',30=>'保管金',40=>'押金',50=>'租金',60=>'进场费',
70=>'转让费',80=>'其他',90=>'佣金',91=>'中介费',92=>'案场费'
];
$redis = new RedisCacheService();
$m_pay = new OPayLogModel();
if ($this->params['excel'] == 0) {
$m_pay = new OPayLogModel();
$m_daily = new ODaily();
$redis = new RedisCacheService();
foreach ($list as $k=>$v) {
$log_where['open_id'] = $v['id'];
$log_where['is_del'] = 0;
......@@ -191,19 +196,31 @@ class PayLogOpen extends Basic
}
$list[$k]['agent_name'] = $v['name'];
//跳转财务日报页面数据
$pay_data = $m_pay->selectPayLogByOrderNo('agent_id,create_time', ['id'=>$v['pay_log_id']]);
$pay_data = $m_pay->selectPayLogByOrderNo('agent_id,create_time,type', ['id'=>$v['pay_log_id']]);
$agent_data = $redis->getRedisCache(2, $pay_data[0]['agent_id']);
$daily_where['daily_date'] = date('Y-m-d', strtotime($pay_data[0]['create_time']));
$daily_where['store_id'] = $agent_data['store_id'];
$daily_where['is_del'] = 0;
$num = $m_daily->getTotal($daily_where); //是否提交财务日报
if ($num) {
$list[$k]['daily_date'] = date('Y-m-d', strtotime($pay_data[0]['create_time']));
$agent_data = $redis->getRedisCache(2, $pay_data[0]['agent_id']);
$list[$k]['store_id'] = $agent_data['store_id'];
$list[$k]['store_name'] = $agent_data['store_name'];
unset($agent_data);
} else {
$list[$k]['daily_date'] = '';
$list[$k]['store_id'] = '';
$list[$k]['store_name'] = '';
}
if (isset($pay_data[0])) {
$list[$k]['type_name'] = $type_array[$pay_data[0]['type']];
$agent_data = $redis->getRedisCache(2, $pay_data[0]['agent_id']);
$list[$k]['commit_pay_name'] = $agent_data['name'];
unset($agent_data);
} else {
$list[$k]['type_name'] = $list[$k]['commit_pay_name'] = '';
}
}
$data['list'] = $list;
$data['total'] = $this->m_pay_open->getListCheckTotal($where);
......@@ -226,11 +243,23 @@ class PayLogOpen extends Basic
$check_time = '';
}
$pay_data = $m_pay->selectPayLogByOrderNo('type,agent_id', ['id'=>$v['pay_log_id']]);
if ($pay_data[0]) {
$type_name = $type_array[$pay_data[0]['type']];
$agent_data = $redis->getRedisCache(2, $pay_data[0]['agent_id']);
$commit_pay_name = $agent_data['name'];
unset($agent_data);
} else {
$type_name = $commit_pay_name = '';
}
$excel_data[$k] = [
'id' => $v['id'],
'create_time' => $v['create_time'],
'agent_name' => $v['name'],
'pay_log_id' => $v['pay_log_id'],
'commit_pay_name' => $commit_pay_name,
'type_name' => $type_name,
'bargain_id' => $v['bargain_id'],
'order_id' => $v['order_id'],
'house_id' => $v['house_id'],
......@@ -242,7 +271,7 @@ class PayLogOpen extends Basic
}
$export = new ExportExcelUntil();
$title = [ '申请ID', '提交时间', '提交人', '收款ID', '成交报告ID', '带看订单ID', '成交商铺ID', '成交商铺地址', '状态', '总监通过时间', '开业确定时间'];
$title = [ '申请ID', '提交时间', '提交人', '收款ID', '收款提交人','收款类型','成交报告ID', '带看订单ID', '成交商铺ID', '成交商铺地址', '状态', '总监通过时间', '开业确定时间'];
$file_name = '收款开业审核-'.$status_string;
$export->exportTable($file_name, $excel_data, 11, '开业审核-'.$status_string, $title);
return true;
......@@ -265,14 +294,15 @@ class PayLogOpen extends Basic
$m_pay_open = new OPayLogOpen();
$where['is_del'] = 0;
$where['id'] = $this->params['open_id'];
$id = $m_pay_open->getFieldOneValue('id', $where);
if (empty($id)) {
$data = $m_pay_open->getFind('id,pay_log_id', $this->params['open_id'], $where);
if (empty($data)) {
return $this->response(101, '没有该数据');
}
$num = $m_pay_open->editData(['is_del'=>1], $id);
$num = $m_pay_open->editData(['is_del'=>1], $data['id']);
if ($num) {
$m_pay = new OPayLogModel();
$m_pay->updatePayLog(['id'=>$data['pay_log_id'],'is_open'=>0]);
$code = 200;
$msg = '删除成功';
}
......@@ -348,8 +378,8 @@ class PayLogOpen extends Basic
"house_id" => 1,
"intro" => "123123",
"house_address" => "123123",
"remark" => "123123",
"open_img" => "123123",
"type" => 1 //默认为1 单独申请开业 2和该地址相关的收款全部申请开业
);*/
$checkResult = $this->validate($params, "api_broker/PayLogOpenValidate.applyForOpen");
......@@ -366,6 +396,7 @@ class PayLogOpen extends Basic
$house_id = $params["house_id"];
$house_address = $params["house_address"];
$intro = $params["intro"];
$type = $params["type"] ? $params["type"] : 1;
try {
$open_img = json_decode($params["open_img"], true);
} catch (\Exception $exception) {
......@@ -373,7 +404,7 @@ class PayLogOpen extends Basic
}
$return_id = $service_->addApplyForOpen($pay_log_id, $report_id, $bargain_id, $agent_id, $house_id, $intro,
$house_address, $open_img, $order_id, $this->userId);
$house_address, $open_img, $order_id, $this->userId,$type);
if ($return_id > 0) {
return $this->response("200", "success", ["id" => $return_id]);
} elseif ($return_id == -1){
......@@ -417,5 +448,4 @@ class PayLogOpen extends Basic
return $this->response("101", "审核失败");
}
}
}
\ No newline at end of file
......@@ -95,5 +95,19 @@ class RealTimePerformance extends Basic
return view('cost/accountingTable');
}
}
//收款日志
public function receivingLog()
{
if (!$this->request->isAjax()) {
return view('finance/receivingLog');
}
}
//财务日报未提交
public function forgetSubmitFinancial()
{
if (!$this->request->isAjax()) {
return view('finance/forgetSubmitFinancial');
}
}
}
\ No newline at end of file
<?php
namespace app\index\controller;
use app\api\service\AccountBalanceService;
use app\api_broker\service\RedisCacheService;
use app\index\extend\Basic;
use app\model\GReceiptOperatingRecords;
use think\Request;
class ReceiptOperatingRecords extends Basic
{
private $m_receipt_operating_records;
public function __construct(Request $request = null)
{
parent::__construct($request);
$this->m_receipt_operating_records = new GReceiptOperatingRecords();
}
/**
* 新增记录
* @param $agents_id
* @param $type
* @param $pay_log_id
* @return bool
*/
public function addOperating($agents_id,$type,$pay_log_id,$house_id)
{
$data["agents_id"] = $agents_id;
$data["type"] = $type;
$data["remark"] = $type == 1 ? "删除收款ID:{$pay_log_id}" : "撤销调整收款ID:{$pay_log_id}";
$data["house_id"] = $house_id;
$result = $this->m_receipt_operating_records->saveOperating($data);//int(1)
if ($result) {
return true;
} else {
return false;
}
}
/**
* 收款操作记录
* @return \think\Response
*/
public function receiptOperatingRecordsList()
{
$params = $this->params;
$pageNo = empty($this->params['pageNo']) ? 1 : $this->params['pageNo'];
$pageSize = empty($this->params['pageSize']) ? 10 : $this->params['pageSize'];
$conditions = [];
if (!empty($params['start_date']) && !empty($params['end_date'])) {
$conditions['create_time'] = ['between time', [$params['start_date'].' 00:00:00',$params['end_date'].' 23:59:59']];
}
if (!empty($params['house_id'])) {
$conditions['house_id'] = $params['house_id'];
}
$field = 'id,agents_id,type,remark,house_id,create_time';
$result = $this->m_receipt_operating_records->getOperatingList($field, $conditions, $pageNo, $pageSize);
if (!$result)
return $this->response("200", "成功", []);
$redis_cache = new RedisCacheService();
foreach ($result as $k => $v) {
$agent_data = $redis_cache->getRedisCache(2, $v['agents_id']);
$result[$k]['agents_name'] = $agent_data['name'];
$result[$k]['agents_phone'] = $agent_data['phone'];
}
$result_total = $this->m_receipt_operating_records->getOperatingTotal($field, $conditions);
$data['list'] = $result;
$data['total'] = $result_total;
return $this->response("200", "成功", $data);
}
}
\ No newline at end of file
......@@ -12,6 +12,7 @@ namespace app\index\controller;
use app\api_broker\service\RedisCacheService;
use app\index\extend\Basic;
use app\index\validate\StoreValidate;
use app\model\AAgents;
use app\model\ADistrict;
use app\model\AStore;
......@@ -24,51 +25,66 @@ class Store extends Basic
/**
* 门店列表
*
* @return string|\think\response\View
* @return \think\Response|\think\response\View
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function index() {
if ($this->request->isAjax()) {
$pageNo = empty($this->params['pageNo']) ? 1 : $this->params['pageNo'];
$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;
$join = 0;
//门店名
if (!empty($this->params['store_id'])) {
$where['a.id'] = $this->params['store_id'];
}
public function index()
{
if (!$this->request->isAjax()) {
return view('index');
}
if (!empty($this->params['city'])) {
$where['a.city'] = $this->params['city'];
}
$pageNo = empty($this->params['pageNo']) ? 1 : $this->params['pageNo'];
$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'];
}
if (!empty($this->params['district_id'])) {
$where['a.district_id'] = $this->params['district_id'];
}
if (!empty($this->params['city'])) {
$where['a.city'] = $this->params['city'];
}
//店长姓名
if (!empty($this->params['agents_name'])) {
$where['b.name'] = ['LIKE','%'.$this->params['agents_name'].'%'];
$join = 1;//连表查询店长名
}
if (!empty($this->params['district_id'])) {
$where['a.district_id'] = $this->params['district_id'];
}
//店长手机号
if (!empty($this->params['agents_phone'])) {
$where['b.phone'] = ['LIKE',$this->params['agents_phone'].'%'];
$join = 1;
//店长姓名
if (!empty($this->params['agents_name'])) {
$where['b.name'] = ['LIKE', '%' . $this->params['agents_name'] . '%'];
}
//店长手机号
if (!empty($this->params['agents_phone'])) {
$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);
$agent_where['level'] = 20;
$status_arr = [0 => '正常', 1 => '长假', 2 => '离职', 3 => '转勤', 4 => '黑名单', 5 => '冻结'];
$district_data = $m_district->getDistrictColumn('id,district_name', ['status' => 0]);
foreach ($list as $k => $v) {
$list[$k]['district_name'] = $district_data[$v['district_id']];
$list[$k]['agents_total'] = $m_agent->getListDistrictTotal(['store_id' => $v['id'], 'level' => 10]);
$agent_where['store_id'] = $v['id'];
$agent_data = $m_agent->getStoreIdByAgentId('name,phone,status', $agent_where);
$agent_name = '';
foreach ($agent_data as $k2 => $v2) {
$agent_name .= $v2['name'] . '-' . $v2['phone'] . '(' . $status_arr[$v2['status']] . '),';
}
$store = new AStore();
$this->data['list'] = $store->getStoreList($pageNo, $pageSize, 'id DESC', $field, $where, $join);
$this->data['total'] = $store->getStoreListTotal($where, $join);
$return = $this->response($this->code, $this->msg, $this->data);
} else {
//总监列表
$return = view('index');
$list[$k]['agents_name'] = rtrim($agent_name, ',');
}
return $return;
$this->data['list'] = $list;
return $this->response($this->code, $this->msg, $this->data);
}
/**
......
<?php
namespace app\index\controller;
use app\index\extend\Basic;
use app\index\service\OfficeUserLogService;
use app\index\service\UserLogService;
......@@ -12,8 +14,8 @@ use think\Request;
* Time : 2:23 PM
* Intro:
*/
class UserLog extends Basic{
class UserLog extends Basic
{
private $service_;
private $OfficeUserLogService;
......@@ -21,7 +23,7 @@ class UserLog extends Basic{
public function __construct(Request $request = null)
{
parent::__construct($request);
$this->service_ = new UserLogService();
$this->service_ = new UserLogService();
$this->OfficeUserLogService = new OfficeUserLogService();
}
......@@ -48,11 +50,11 @@ class UserLog extends Basic{
}
$user_id = $params['user_id'];
$agent_id = $params['agent_id'];
$result = $this->service_->userDetail($user_id,$agent_id, $this->siteId);
$result = $this->service_->userDetail($user_id, $agent_id, $this->siteId);
if($result["code"] == 200){
if ($result["code"] == 200) {
return $this->response("200", "success!", $result["data"]);
}else{
} else {
return $this->response("101", $result["msg"]);
}
......@@ -66,12 +68,14 @@ class UserLog extends Basic{
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function userLog(){
public function userLog()
{
$params = $this->params;
/* $params = array(
"user_id" => 828,
"type" => 1,
"site_id" => 10001,
);*/
$checkResult = $this->validate($params, "UserLogValidate.userLog");
......@@ -79,18 +83,19 @@ class UserLog extends Basic{
return $this->response(101, $checkResult);
}
$user_id = $params['user_id'];
$type = $params['type'];
$user_id = $params['user_id'];
$site_id = $params['site_id'];
$type = $params['type'];
if($params['entrust_type'] == 1){
$result = $this->OfficeUserLogService->userLog($user_id,$this->siteId,$type);
}else{
$result = $this->service_->userLog($user_id,$this->siteId,$type);
if ($params['entrust_type'] == 1) {
$result = $this->OfficeUserLogService->userLog($user_id, $site_id, $type);
} else {
$result = $this->service_->userLog($user_id, $site_id, $type);
}
if(count($result) > 0){
if (count($result) > 0) {
return $this->response("200", "success!", $result);
}else{
} else {
return $this->response("101", "请求数据为空");
}
......@@ -100,12 +105,14 @@ class UserLog extends Basic{
* 电话跟进
* @return \think\Response
*/
public function followUpLogNew(){
public function followUpLogNew()
{
$params = $this->params;
/* $params = array(
"user_id" => 828,
"page_no" => 1,
"site_id" => 10001,
"page_size" => 15
);*/
$checkResult = $this->validate($params, "UserLogValidate.followUpLog");
......@@ -114,18 +121,19 @@ class UserLog extends Basic{
}
$user_id = $params['user_id'];
$site_id = $params['site_id'];
$pageNo = empty($params['page_no']) ? 1 : $params['page_no'];
$pageSize = empty($params['page_size']) ? 15 : $params['page_size'];
if(isset($params['entrust_type']) && $params['entrust_type'] == 1){
if (isset($params['entrust_type']) && $params['entrust_type'] == 1) {
return $this->response("101", "请求数据空");
}else{
$result = $this->service_->phoneFollowUpNew($user_id,$this->siteId,$pageNo,$pageSize);
} else {
$result = $this->service_->phoneFollowUpNew($user_id, $site_id, $pageNo, $pageSize);
}
if(count($result) > 0){
if (count($result) > 0) {
return $this->response("200", "success!", $result);
}else{
} else {
return $this->response("101", "请求数据为空");
}
}
......@@ -134,12 +142,14 @@ class UserLog extends Basic{
* 电话跟进
* @return \think\Response
*/
public function followUpLog(){
public function followUpLog()
{
$params = $this->params;
/* $params = array(
"user_id" => 828,
"page_no" => 1,
"site_id" => 10001,
"page_size" => 15
);*/
$checkResult = $this->validate($params, "UserLogValidate.followUpLog");
......@@ -148,18 +158,19 @@ class UserLog extends Basic{
}
$user_id = $params['user_id'];
$site_id = $params['site_id'];
$pageNo = empty($params['page_no']) ? 1 : $params['page_no'];
$pageSize = empty($params['page_size']) ? 15 : $params['page_size'];
if(isset($params['entrust_type']) && $params['entrust_type'] == 1){
$result = $this->OfficeUserLogService->phoneFollowUp($user_id,$this->siteId,$pageNo,$pageSize);
}else{
$result = $this->service_->phoneFollowUp($user_id,$this->siteId,$pageNo,$pageSize);
if (isset($params['entrust_type']) && $params['entrust_type'] == 1) {
$result = $this->OfficeUserLogService->phoneFollowUp($user_id, $site_id, $pageNo, $pageSize);
} else {
$result = $this->service_->phoneFollowUp($user_id, $site_id, $pageNo, $pageSize);
}
if(count($result) > 0){
if (count($result) > 0) {
return $this->response("200", "success!", $result);
}else{
} else {
return $this->response("101", "请求数据为空");
}
}
......
......@@ -31,21 +31,29 @@ class RankingListService
"10001" => 20,
"10002" => 8,
"10003" => 8,
"10004" => 8,
"10005" => 8,
);
$this->crewNumMax = array(
"10001" => 25,
"10002" => 13,
"10003" => 13,
"10004" => 13,
"10005" => 13,
);
$this->weekNum = array(
"10001" => 5,
"10002" => 5,
"10003" => 5,
"10004" => 5,
"10005" => 5,
);
$this->weekNumMax = array(
"10001" => 6,
"10002" => 6,
"10003" => 6,
"10004" => 6,
"10005" => 6,
);
}
......
......@@ -414,16 +414,49 @@ class UserLogService
{
$is_collect = 2;
$collect_house = new ACollectUser();
$insert["agents_id"] = $agent_id;
$insert["user_id"] = $user_id;
$insert["status"] = 1;
$is_saved = $collect_house->getCollectUser('id',$insert);
if($is_saved){
$agent_ids = $this->getSiteAgentId($agent_id);
if ($agent_ids) {
//此经纪人有转勤账号
$insert["agents_id"] = array( 'in', $agent_ids );
} else {
$insert["agents_id"] = $agent_id;
}
$insert["user_id"] = $user_id;
$insert["status"] = 1;
$is_saved = $collect_house->getCollectUser('id', $insert);
if ($is_saved) {
$is_collect = 1;
}
return $is_collect;
}
/**
* 获取经纪人所有站点账号
* @param $agent_id
* @return string
*/
public function getSiteAgentId($agent_id)
{
$m_agent = new AAgents();
$agent_phone = $m_agent->getAgentsById($agent_id, 'phone');
$params = [];
$params["phone"] = $agent_phone;
$params["status"] = array( 'in', '0,3' );
$agentsArr = $m_agent->getAgentsByStoreId($params);
$agent_total = count($agentsArr);
$agent_ids = "";
if ($agent_total > 0) {
foreach ($agentsArr as $key1 => $value1) {
$agent_ids .= $value1["id"] . ",";
}
$agent_ids = rtrim($agent_ids, ",");//经纪人ID集合
}
return $agent_ids;
}
/**
* 判断当天被拨打是否超过5次
......
......@@ -642,9 +642,10 @@ class UserService
* 设置客户站点
* @param $user_id
* @param $site_id
* @param int $type 0:c端
* @return bool
*/
public function setUserSites($user_id, $site_id)
public function setUserSites($user_id, $site_id,$type = 1)
{
if (!$user_id) {
return false;
......@@ -653,16 +654,17 @@ class UserService
return false;
}
$s_user_site = new UserSiteService();
$s_user_site->delUserSite($user_id,1);
if($type == 1){
$s_user_site->delUserSite($user_id,1);
}
$site_ids_array = explode(',', rtrim($site_id, ','));
// dump($site_ids_array);
foreach ($site_ids_array as $k => $v) {
$is_site = $s_user_site->findUserSite($user_id,$v);
// dump($is_site);
if($is_site){//编辑
$s_user_site->delUserSite($is_site['id'],0);
if($type == 1){
$s_user_site->delUserSite($is_site['id'],0);
}
}else{//新增
$s_user_site->addUserSite($user_id,$v);
}
......
......@@ -92,6 +92,12 @@
<div class="table-responsive">
<table class="table table-striped table-bordered table-hover table-condensed">
<thead>
<tr>
<td colspan="14" class="maintable-top-sub-tr">
<a class="btn btn-info liudan_pic_btn">商铺</a>
<a class="btn btn-default liudan_pic_btn">办公楼</a>
</td>
</tr>
<tr>
<td colspan="12">
<form id="form_search">
......@@ -99,8 +105,8 @@
<input class="form-control btn4 ld-Marheight" value="" data-rule-phoneus="false" data-rule-required="false" id="create_time" name="start_date" type="date">
<span class="fore-span ld-Marheight">-</span>
<input class="form-control btn4 ld-Marheight" value="" data-rule-phoneus="false" data-rule-required="false" id="end_time" name="end_date" type="date">
<input class="form-control btn2 ld-Marheight" data-rule-phoneus="false" data-rule-required="false" id="internal_address" placeholder="商铺地址" type="text" value="">
<input class="form-control btn2 ld-Marheight" data-rule-phoneus="false" data-rule-required="false" id="internal_num" placeholder="商铺号" type="text" value="">
<input class="form-control btn2 ld-Marheight" data-rule-phoneus="false" data-rule-required="false" id="internal_address" placeholder="房源地址" type="text" value="">
<input class="form-control btn2 ld-Marheight" data-rule-phoneus="false" data-rule-required="false" id="internal_num" placeholder="房源号" type="text" value="">
<select name="district_id" class="form-control btn4 ld-Marheight">
<option value="">分佣方所属部门</option>
</select>
......@@ -127,9 +133,9 @@
<th class="text-center">收佣日期</th>
<th class="text-center">所属门店</th>
<th class="text-center">业务员</th>
<th class="text-center">商铺地址</th>
<th class="text-center">房源地址</th>
<th class="text-center">分佣角色</th>
<th class="text-center">商铺</th>
<th class="text-center">房源</th>
<th class="text-center">分佣比例</th>
<th class="text-center">应分佣金(元)</th>
<th class="text-center">实收佣金(元)</th>
......
......@@ -96,6 +96,13 @@
<div class="table-responsive">
<table class="table table-striped table-bordered table-hover table-condensed">
<thead>
<!--区分办公楼 商铺-->
<tr>
<td colspan="14" class="maintable-top-sub-tr">
<a class="btn btn-info liudan_pic_btn">商铺</a>
<a class="btn btn-default liudan_pic_btn">办公楼</a>
</td>
</tr>
<tr>
<td colspan="10">
<form id="form_search">
......@@ -103,6 +110,11 @@
<div class="clear">
</div>
<!--<select class="form-control ld-Marheight btn4" name="" id="maintable_shop_type_yeji">
<option value="">房源类型</option>
<option value="0">商铺</option>
<option value="1">办公楼</option>
</select>-->
<span class="fore-span ld-Marheight">收佣日期/开票日期:</span>
<input class="form-control btn4 ld-Marheight" value="" data-rule-phoneus="false" data-rule-required="false" id="create_time" name="start_date" type="date">
<span class="fore-span ld-Marheight">-</span>
......
......@@ -946,7 +946,14 @@
<div class="modal-body modal-body-height">
<ul class="list-group">
<li class="list-group-item">
<div class="form-group full-width-100 full-pic-area">
<span style="position: relative;top: 0px;">申请类型<span class="text-danger">(必填)</span></span><select style="height: 30px;" class="type-financial-open">
<option value="">请选择</option>
<option value="1">该笔收款单独开业</option>
<option value="2">和该地址相关的收款全部开业</option>
</select>
</div>
<div class="form-group full-width-100 full-pic-area">
<span style="position: relative;top: -50px;">开业说明<span class="text-danger">(必填)</span></span><textarea name="" rows="" cols=""style="width: 380px;height: 100px;" class="remark-financial-open"></textarea>
</div>
......@@ -955,7 +962,7 @@
<div>图片至少1张,最多三张:<span class="text-danger">(必填)</span></div>
<div id="container_body">
<button type="button btn2" class="btn btn-default">上传图片</button>
<input type="file" id="file_input_pic_open"/>
<input type="file" id="file_input_pic_open" multiple="multiple"/>
<div id="container_body_img_open"></div>
</div>
</div>
......
{layout name="global/frame_two_tpl" /}
<input type="hidden" class="page-load" id="forgetSubmitFinancial" />
<style>
#note_text{
width: 80%;
margin-left: 48px;
margin-top: -20px;
}
#note_text_re{
width: 80%;
margin-left: 48px;
margin-top: -20px;
}
.Tswitch_one{
display: none;
}
.Tswitch_two{
display: none;
}
.left{
float: left;
width: 340px;
line-height: 36px;
}
.right{
line-height: 36px;
}
.btn_2{
width: 60px;
display: inline-block;
height: 26px;
padding: 3px 6px
}
.edit_new{
float: right;
margin-bottom: 5px;
margin-top: -10px;
}
.form-control-one{
display: inline-block;
width: 40%;
}
#form_search{
line-height: 48px;
}
.modal-body-two{
height: 500px;
overflow-y: scroll;
}
.clear{
clear: both;
}
.font-size-16{
font-size: 16px;
font-weight: 600;
}
/*分佣方 姓名 下拉式列表*/
.user-ul{
height: auto;
float: left;
position: absolute;
width: 290px;
background: #fff;
border: 1px solid #ccc;
border-top:0;
left: 3px;
}
.user-ul li{
list-style: none;
line-height: 30px;
margin-left: -20px;
}
.left-phone{
width: 300px;
float: left;
margin-top: 7px;
margin-left: 10px;
position: relative;
}
</style>
<div id="page-content-wrapper">
<div class="container">
<div class="row">
<div class="">
<div class="panel panel-default">
<div class="panel-heading breadcrumb">
<li><a href="#">日报未提交</a></li>
</div>
<div class="panel-body">
<div class="table-responsive">
<table class="table table-striped table-bordered table-hover table-condensed">
<thead>
<tr>
<td colspan="12">
<form id="form_search">
<span class="fore-span ld-Marheight">财务日报日期:</span>
<input class="form-control btn4 ld-Marheight" value="" data-rule-phoneus="false" data-rule-required="false" id="create_time" name="start_date" type="date">
<select name="district_id" class="form-control btn4 ld-Marheight">
<option value="">分佣方所属部门</option>
</select>
<select name="store_id" class="form-control btn4 ld-Marheight">
<option value="">分佣方所属门店</option>
</select>
<span class="btn btn-info btn3" id="search">搜索</span>
<span class="btn btn-info btn3" id="reset">重置</span>
</form>
</td>
</tr>
<tr>
<th class="text-center">财务日报日期</th>
<th class="text-center">未提交门店名称</th>
</tr>
</thead>
<tbody class="text-center" id="business_list">
</table>
</div>
<div class="text-right" id="pagediv">
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- 弹出框 详情 -->
<div class="modal fade" id="modal_detail" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
×
</button>
</div>
<div class="modal-body detail-modal-body">
<iframe class="iframe-bargaininfo-static" name="iframe_bargaininfo_static"></iframe>
<a class="btn1 bargain-detail-shop btn-info" href="#modal_shop_detail" data-toggle="modal" style="display: none;">商铺</a>
<a class="btn1 caozuo genj_ure btn-info" href="#modal_user_detail" data-toggle="modal" style="display: none;">客户</a>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal -->
</div>
</div>
<!-- 弹出框 时间轴 -->
<div class="modal fade" id="modal-time" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
×
</button>
<h4 class="modal-title">
时间轴
</h4>
</div>
<div class="modal-body" class="iframe-div-parent">
<iframe class="iframe-time-line"></iframe>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal -->
</div>
......@@ -375,8 +375,10 @@
<th class="text-center">提交时间</th>
<th class="text-center">提交人</th>
<th class="text-center">收款ID</th>
<th class="text-center">成交报告ID</th>
<th class="text-center">带看订单ID</th>
<!--<th class="text-center">成交报告ID</th>
<th class="text-center">带看订单ID</th>-->
<th class="text-center">收款提交人</th>
<th class="text-center">收款类型</th>
<th class="text-center">成交商铺ID</th>
<th class="text-center">成交商铺地址</th>
<th class="text-center">状态</th>
......
{layout name="global/frame_two_tpl" /}
<input type="hidden" class="page-load" id="receivingLog" />
<style>
#note_text{
width: 80%;
margin-left: 48px;
margin-top: -20px;
}
#note_text_re{
width: 80%;
margin-left: 48px;
margin-top: -20px;
}
.Tswitch_one{
display: none;
}
.Tswitch_two{
display: none;
}
.left{
float: left;
width: 340px;
line-height: 36px;
}
.right{
line-height: 36px;
}
.btn_2{
width: 60px;
display: inline-block;
height: 26px;
padding: 3px 6px
}
.edit_new{
float: right;
margin-bottom: 5px;
margin-top: -10px;
}
.form-control-one{
display: inline-block;
width: 40%;
}
#form_search{
line-height: 48px;
}
.modal-body-two{
height: 500px;
overflow-y: scroll;
}
.clear{
clear: both;
}
.font-size-16{
font-size: 16px;
font-weight: 600;
}
/*分佣方 姓名 下拉式列表*/
.user-ul{
height: auto;
float: left;
position: absolute;
width: 290px;
background: #fff;
border: 1px solid #ccc;
border-top:0;
left: 3px;
}
.user-ul li{
list-style: none;
line-height: 30px;
margin-left: -20px;
}
.left-phone{
width: 300px;
float: left;
margin-top: 7px;
margin-left: 10px;
position: relative;
}
</style>
<div id="page-content-wrapper">
<div class="container">
<div class="row">
<div class="">
<div class="panel panel-default">
<div class="panel-heading breadcrumb">
<li><a href="#">收款日志</a></li>
</div>
<div class="panel-body">
<div class="table-responsive">
<table class="table table-striped table-bordered table-hover table-condensed">
<thead>
<!--<tr>
<td colspan="14" class="maintable-top-sub-tr">
<a class="btn btn-info liudan_pic_btn">商铺</a>
<a class="btn btn-default liudan_pic_btn">公楼</a>
</td>
</tr>-->
<tr>
<td colspan="12">
<form id="form_search">
<span class="fore-span ld-Marheight">修改时间:</span>
<input class="form-control btn4 ld-Marheight" value="" data-rule-phoneus="false" data-rule-required="false" id="create_time" name="" type="date">
<span class="fore-span ld-Marheight">-</span>
<input class="form-control btn4 ld-Marheight" value="" data-rule-phoneus="false" data-rule-required="false" id="end_time" name="" type="date">
<input class="form-control btn2 ld-Marheight" data-rule-phoneus="false" data-rule-required="false" id="house_id" placeholder="房源ID" type="text" value="">
<div class="clear"></div>
<span class="btn btn-info btn3" id="search">搜索</span>
<span class="btn btn-info btn3" id="reset">重置</span>
</form>
</td>
</tr>
<tr>
<th class="text-center">修改时间</th>
<th class="text-center">修改内容</th>
<th class="text-center">修改人</th>
</tr>
</thead>
<tbody class="text-center" id="business_list">
</table>
</div>
<div class="text-right" id="pagediv">
</div>
</div>
</div>
</div>
</div>
</div>
</div>
......@@ -80,6 +80,12 @@
<div class="table-responsive">
<table class="table table-striped table-bordered table-hover table-condensed">
<thead>
<tr>
<td colspan="14" class="maintable-top-sub-tr">
<a class="btn btn-info liudan_pic_btn">商铺</a>
<a class="btn btn-default liudan_pic_btn">办公楼</a>
</td>
</tr>
<tr>
<td colspan="9">
<form id="form_search">
......@@ -87,8 +93,8 @@
<input class="form-control btn4 ld-Marheight" value="" data-rule-phoneus="false" data-rule-required="false" id="create_time" name="start_date" type="date">
<span class="fore-span ld-Marheight">-</span>
<input class="form-control btn4 ld-Marheight" value="" data-rule-phoneus="false" data-rule-required="false" id="end_time" name="end_date" type="date">
<input class="form-control btn2 ld-Marheight" data-rule-phoneus="false" data-rule-required="false" id="internal_address" placeholder="商铺地址" type="text" value="">
<input class="form-control btn2 ld-Marheight" data-rule-phoneus="false" data-rule-required="false" id="internal_num" placeholder="商铺号" type="text" value="">
<input class="form-control btn2 ld-Marheight" data-rule-phoneus="false" data-rule-required="false" id="internal_address" placeholder="房源地址" type="text" value="">
<input class="form-control btn2 ld-Marheight" data-rule-phoneus="false" data-rule-required="false" id="internal_num" placeholder="房源号" type="text" value="">
<input class="form-control btn2 ld-Marheight" data-rule-phoneus="false" data-rule-required="false" id="user_name" placeholder="分佣方姓名" type="text" value="">
<input class="form-control btn2 ld-Marheight" data-rule-phoneus="false" data-rule-required="false" id="user_phone" placeholder="分佣方手机号" type="text" value="">
......@@ -108,8 +114,8 @@
<th class="text-center">开票日期</th>
<th class="text-center">所属部门/门店</th>
<th class="text-center">业务员</th>
<th class="text-center">商铺地址</th>
<th class="text-center">商铺</th>
<th class="text-center">房源地址</th>
<th class="text-center">房源</th>
<th class="text-center">税费(元)</th>
<th class="text-center">操作</th>
</tr>
......
......@@ -564,7 +564,7 @@
<div class="form-group full-width-100 full-pic-area">
<label for="">详情页轮播图(至少2张)</label>
<input readonly="readonly" type="text" name="xiangqing_pic_input" class="form-control" style="display: none" id="xiangqing_pic_input" placeholder="请选择图片">
<input class="upload-image-btn" id="xiangqing_pic_btn" type="file" data-limittop="20" style="display: inline-block;">
<input class="upload-image-btn" id="xiangqing_pic_btn" type="file" data-limittop="20" style="display: inline-block;" multiple="multiple">
<button class="btn btn-default btn-default-liu">选择图片</button>
<span class="tip"></span>
<label for="isShowShopDetail">是否对客户展示对内详情图</label>
......@@ -580,7 +580,7 @@
<div class="form-group full-width-100 full-pic-area">
<label for="">楼层平面图(选填)</label>
<input readonly="readonly" type="text" name="louceng_pic_input" class="form-control" style="display: none" id="louceng_pic_input" placeholder="请选择图片">
<input readonly="readonly" class="upload-image-btn" id="louceng_pic_btn" type="file" data-limittop="20" style="display: inline-block;">
<input readonly="readonly" class="upload-image-btn" id="louceng_pic_btn" type="file" data-limittop="20" style="display: inline-block;" multiple="multiple">
<button class="btn btn-default btn-default-liu">选择图片</button>
<span class="tip"></span>
......@@ -644,7 +644,7 @@
<div class="form-group full-width-100 full-pic-area">
<label for="">独家合同上传</label>
<input readonly="readonly" type="text" name="dujia_pic_input" class="form-control" style="display: none" id="dujia_pic_input" placeholder="请选择图片">
<input class="upload-image-btn" id="dujia_pic_btn" type="file" data-limittop="20" style="display: inline-block;">
<input class="upload-image-btn" id="dujia_pic_btn" type="file" data-limittop="20" style="display: inline-block;" multiple="multiple">
<button class="btn btn-default btn-default-liu">选择图片</button>
<span class="tip"></span>
......
......@@ -707,12 +707,20 @@
</table>
</div>
<div class="clear modal-title-genjing">
<span class="modal-title-genjing-con">
<span class="btn-info-liu">客户动态</span>
<span>带看动态</span>
</span>
</div>
<span class="modal-title-genjing-con">
<span class="btn-info-liu">客户动态</span>
<span>带看动态</span>
</span>
<!--城市筛选-->
<select class="user_city_list" style="font-size: 14px;font-weight: 500;float: right;margin-top: 8px;">
<!--<option value="">选择城市</option>-->
<option value="10001">上海市</option>
<option value="10002">杭州市</option>
<option value="10003">深圳市</option>
<option value="10004">广州市</option>
<option value="10005">北京市</option>
</select>
</div>
<div id="gen_jing_user">
<div>
<div class="follow-up-modal-list-area" style="height: 212px">
......
......@@ -53,10 +53,16 @@
<div class="">
<div class="panel panel-default">
<div class="panel-heading breadcrumb">
<li>
<li style="margin-bottom: 6px;">
<a href="javascript:;">商铺收藏</a>
</li>
<li> <span class="btn btn-info btn3 " id="fresh_btn">刷新</span></li>
<br />
<div>
<select class="form-control btn4" id="user_city" style="width: 200px;">
</select>
<span class="btn btn-info btn3 " id="fresh_btn">搜索</span>
</div>
</div>
<div class="panel-body">
<div class="table-responsive">
......
......@@ -307,7 +307,18 @@
<div class="panel panel-default">
<div class="panel-heading breadcrumb">
<li><a href="#">我收藏的客户</a></li>
<li> <span class="btn btn-info btn3 " id="fresh_btn">刷新</span></li>
<!--<li>
<span class="btn btn-info btn3 " id="fresh_btn">刷新</span>
</li>-->
<div>
<select class="form-control btn4" id="user_city" style="width: 200px;">
</select>
<span class="btn btn-info btn3 " id="fresh_btn">搜索</span>
</div>
<!--<li class="active">新增</li>-->
<div class="pull-right">
<ul class="bread_btn">
......
......@@ -470,7 +470,7 @@
<div href="#modal_date_select" data-toggle="modal">打开收佣日期选择框(默认隐藏)</div>
<a class="btn btn-primary maid_ok_btn">确认分佣</a>
<a id="maid_save_btn" class="btn btn-primary" data-toggle="modal">保存</a>
<a class="btn btn-success envelope-list" href="#modal-envelope" data-toggle="modal">红包提现</a>
<!--<a class="btn btn-success envelope-list" href="#modal-envelope" data-toggle="modal">红包提现</a>-->
</div>
<!--分佣提成-->
</div>
......
......@@ -1441,7 +1441,13 @@
<tr class="anchangfei">
<td>
<span class="span-width-90">是否开业:</span>
<span class="shop-is-open"></span>
<!--<span class="shop-is-open">是</span>-->
<select class="shop-is-open-anchang">
<option value="3">请选择</option>
<option value="1"></option>
<option value="0"></option>
</select>
</td>
<td>
<span class="span-width-90">是否分红:</span>
......
{layout name="global/frame_two_tpl" /}
<input type="hidden" class="page-load" id="getCollectionShop" />
<style>
#file_input_pic_open {
opacity: 0;
position: absolute;
top: 0;
left: 0;
height: 35px;
width: 80px;
}
.reportAreaLiu{
list-style: none;
}
......@@ -215,14 +224,14 @@
.hide {
display: none !important;
}
.result {
.result,.result-du-open {
width:130px;
height:auto;
float:left;
text-align:center;
color:red;
}
.result>img,.result2>img{
.result>img,.result2>img,.result-du-open>img{
width: 120px;
height: 120px;
margin-top: 8px;
......@@ -1312,3 +1321,53 @@
</div>
<!-- /.modal -->
</div>
<!--申请开业-->
<div class="modal fade" id="modal_open" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
×
</button>
<h4 class="modal-title">
申请开业
</h4>
</div>
<div class="modal-body modal-body-height">
<ul class="list-group">
<li class="list-group-item">
<div class="form-group full-width-100 full-pic-area">
<span style="position: relative;top: 0px;">申请类型<span class="text-danger">(必填)</span></span><select style="height: 30px;" class="type-financial-open">
<option value="">请选择</option>
<option value="1">该笔收款单独开业</option>
<option value="2">和该地址相关的收款全部开业</option>
</select>
</div>
<div class="form-group full-width-100 full-pic-area">
<span style="position: relative;top: -50px;">开业说明<span class="text-danger">(必填)</span></span><textarea name="" rows="" cols=""style="width: 380px;height: 100px;" class="remark-financial-open"></textarea>
</div>
<div class="form-group full-width-100 full-pic-area">
<!--input上传图片-->
<div>图片至少1张,最多三张:<span class="text-danger">(必填)</span></div>
<div id="container_body">
<button type="button btn2" class="btn btn-default">上传图片</button>
<input type="file" id="file_input_pic_open" multiple="multiple"/>
<div id="container_body_img_open"></div>
</div>
</div>
</li>
</ul>
</div>
<div class="modal-footer">
<button type="button btn2" class="btn btn-primary" id="saveBtnOpen">
保存
</button>
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal -->
</div>
......@@ -56,7 +56,13 @@
<li>
<a href="javascript:;">办公楼收藏</a>
</li>
<li> <span class="btn btn-info btn3 " id="fresh_btn">刷新</span></li>
<!--<li> <span class="btn btn-info btn3 " id="fresh_btn">刷新</span></li>-->
<div>
<select class="form-control btn4" id="user_city" style="width: 200px;">
</select>
<span class="btn btn-info btn3 " id="fresh_btn">搜索</span>
</div>
</div>
<div class="panel-body">
<div class="table-responsive">
......
......@@ -62,6 +62,12 @@
<div class="table-responsive">
<table class="table table-striped table-bordered table-hover table-condensed">
<thead>
<tr>
<td colspan="14" class="maintable-top-sub-tr">
<a class="btn btn-info liudan_pic_btn">商铺</a>
<a class="btn btn-default liudan_pic_btn">办公楼</a>
</td>
</tr>
<!--三级审核的搜索功能-->
<tr>
<td colspan="16">
......@@ -84,8 +90,8 @@
<input class="form-control btn4" value="" data-rule-phoneus="false" data-rule-required="false" id="maintable_create_time" name="start_date" type="date">
<span class="fore-span margin-left-10"></span>
<input class="form-control btn4" value="" data-rule-phoneus="false" data-rule-required="false" id="maintable_end_time" name="end_date" type="date">
<input class="form-control btn2" data-rule-phoneus="false" data-rule-required="false" id="maintable_internal_address" placeholder="商铺地址" type="text" value="">
<input class="form-control btn2" data-rule-phoneus="false" data-rule-required="false" id="maintable_shop_num" placeholder="商铺编号" type="text" value="">
<input class="form-control btn2" data-rule-phoneus="false" data-rule-required="false" id="maintable_internal_address" placeholder="房源地址" type="text" value="">
<input class="form-control btn2" data-rule-phoneus="false" data-rule-required="false" id="maintable_shop_num" placeholder="房源编号" type="text" value="">
<!--<input class="form-control btn2" data-rule-phoneus="false" data-rule-required="false" id="maintable_user_phone" placeholder="客户电话" type="text" value="">-->
<select name="district_id" class="form-control btn4">
<option value="">分佣方所在部门</option>
......@@ -121,8 +127,8 @@
<th class="text-center">分佣ID</th>
<th class="text-center">提交时间</th>
<th class="text-center">成交类型</th>
<th class="text-center">商铺地址</th>
<th class="text-center">商铺编号</th>
<th class="text-center">房源地址</th>
<th class="text-center">房源编号</th>
<th class="text-center">分佣提成方</th>
<th class="text-center">分佣角色</th>
<th class="text-center">所属门店</th>
......
......@@ -284,7 +284,7 @@
</div>
</div>
</div>
<div style="height: 1rem;"></div>
<div style="height: 2rem;"></div>
<div class="pc-contact-agent b4_font">
<p class="b4_font_p">
咨询经纪人
......@@ -326,8 +326,7 @@
<a href="javascript:;" id="fix_area_bottom_btn"><img src="/app/images/xq_cha@2x.png" /></a>
</div>
<div class="shop-list">
<img src="/app/images/clik_shop_icon2.png" />
<!--<img src="/app/images/clik_shop_icon2.png" />-->
</div>
<!--点击任意视频 全屏显示(轮播)-->
......
......@@ -216,4 +216,14 @@ class ADistrict extends BaseModel
return $result;
}
/**
* @param $field
* @param $where
* @return array
*/
public function getDistrictColumn($field, $where)
{
return $this->where($where)
->column($field);
}
}
\ No newline at end of file
......@@ -176,6 +176,42 @@ class AStore extends BaseModel
return $data;
}
/**
* 门店列表
*
* @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 getStoreAgentList($pageNo = 1, $pageSize = 15, $order_ = 'id desc', $field = '', $params = '')
{
return $this->field($field)->alias('a')
->join('a_agents b', 'a.id = b.store_id', 'left')
->where($params)
->order($order_)
->limit($pageSize)
->page($pageNo)
->select();
}
/**
* @param string $params
* @return int|string
*/
public function getStoreAgentListTotal($params = '')
{
return $this->alias('a')
->join('a_agents b', 'a.id = b.store_id', 'left')
->where($params)
->count('a.id');
}
/**
* 门店列表总数
*
......@@ -468,4 +504,42 @@ class AStore extends BaseModel
return $this->where($where)
->column($field);
}
/**
* 查询未提交日报门店详细信息
* @param $field
* @param $params
* @return false|\PDOStatement|string|\think\Collection
*/
public function selectDailyUncommitted($field,$params)
{
$params["a.status"] = 0;
$result = Db::table($this->table)
->field($field)
->alias('a')
->join('a_agents b', 'a.id = b.store_id and (b.level = 20 or b.level = 40) and b.status = 0', 'left')
->where($params)
->select();
// big_log($this->getLastSql());
return $result;
}
/**
* 查询未提交日报门店id
* @param $time
* @return mixed
*/
public function getDailyUncommittedId($time)
{
$sql = "SELECT
*
FROM
( ( SELECT id AS store_id FROM a_store ) UNION ALL ( SELECT store_id FROM o_daily WHERE daily_date = '{$time}' ) ) c
GROUP BY
store_id
HAVING
count( store_id ) = 1 ";
$result = Db::table($this->table)->query($sql);
return $result;
}
}
\ No newline at end of file
......@@ -309,6 +309,20 @@ class GHousesToAgents extends BaseModel
return $result;
}
public function getHouseNameByAgentId($field, $params)
{
$result = Db::name($this->table)
->field($field)
->alias("a")
->join('a_agents b', 'a.agents_id = b.id', 'left')
->where($params)
->group("houses_id")
->select();
//echo Db::name($this->table)->getLastSql();
return $result;
}
/**
* @param $field
* @param $params
......
<?php
namespace app\model;
use think\Db;
use think\Model;
class GReceiptOperatingRecords extends Model
{
// 设置当前模型对应的完整数据表名称
protected $table = 'g_receipt_operating_records';
private $db_;
public function __construct($data = [])
{
parent::__construct($data);
$this->db_ = Db::name($this->table);
}
public function saveOperating($data) {
$time = date("Y-m-d H:i:s", time());
$data['create_time'] = $time;
return $this->db_ ->insert($data);
}
/**
*收款操作记录
* @param $field
* @param $params
* @param $pageNo
* @param $pageSize
* @return false|\PDOStatement|string|\think\Collection
*/
public function getOperatingList($field,$params,$pageNo, $pageSize)
{
$result = $this->db_
->field($field)
->where($params)
->limit($pageSize)
->page($pageNo)
->order('id desc')
->select();
return $result;
}
/**
* 收款操作记录
* @param $field
* @param $params
* @return int|string
*/
public function getOperatingTotal($field,$params)
{
$result = $this->db_
->field($field)
->where($params)
->count();
return $result;
}
}
<?php
namespace app\model;
use think\Db;
use think\Model;
class ODailyUncommittedModel extends Model
{
// 设置当前模型对应的完整数据表名称
protected $table = 'o_daily_uncommitted';
private $db_;
public function __construct($data = [])
{
parent::__construct($data);
$this->db_ = Db::name($this->table);
}
public function saveDailyUncommitted($data) {
$time = date("Y-m-d H:i:s", time());
$data['create_time'] = $time;
$data['update_time'] = $time;
$data['is_del'] = 0;
return $this->db_ ->insert($data);
}
/**
* 查询数据
*/
public function getDailyUncommitted($field,$params)
{
$params["a.is_del"] = 0;
$result = $this->db_
->field($field)
->alias('a')
->where($params)
->find();
//echo $this->getLastSql();
return $result;
}
/**
* 财务日报未提交 记录
* @param $field
* @param $params
* @param $pageNo
* @param $pageSize
* @return false|\PDOStatement|string|\think\Collection
*/
public function getDailyUncommittedList($field,$params,$pageNo, $pageSize)
{
$result = $this->db_
->field($field)
->alias("a")
->join("a_store b","a.store_id=b.id","left")
->where($params)
->limit($pageSize)
->page($pageNo)
->order('a.id desc')
->select();
return $result;
}
/**
* 财务日报未提交 记录
* @param $field
* @param $params
* @return int|string
*/
public function getDailyUncommittedTotal($field,$params)
{
$result = $this->db_
->field($field)
->alias("a")
->join("a_store b","a.store_id=b.id","left")
->where($params)
->count();
return $result;
}
public function updateDailyUncommitted($where,$params)
{
$result = $this->db_ ->where($where)->update($params);
//dump($this->getLastSql());
return $result;
}
}
......@@ -155,6 +155,23 @@ class OPayLogModel extends Model
->select();
}
public function getPayLogByOrderIdV2($field, $params)
{
$where_ = [];
if (isset($params["id"])) {
$where_["a.id"] = $params["id"];
}
return Db::table($this->table)
->field($field)
->alias("a")
->join("o_order b", "a.order_id = b.id", "left")
->join("a_agents c", "a.agent_id = c.id", "left")
->join("a_store d", "c.store_id = d.id", "left")
->where($where_)
->select();
}
/**
* @param $params
......@@ -631,5 +648,32 @@ class OPayLogModel extends Model
->find();
}
public function getPayLogList($params, $field, $page_no, $page_size)
{
$params["a.is_del"] = 0;
$result = Db::table($this->table)
->field($field)
->alias("a")
->join("o_order b", "a.order_id = b.id", "left")
->join("g_houses h", "b.house_id = h.id", "left")
->where($params)
->order("a.id desc")
->limit($page_size)
->page($page_no)
->select();
//echo $this->getLastSql();
return $result;
}
public function selectListByHouseId($filed,$params)
{
return $this->db_->field($filed)
->alias("a")
->join("o_order b", "a.order_id = b.id", "left")
->where($params)
->select();
}
}
\ No newline at end of file
......@@ -33,6 +33,19 @@ class OPayLogOpen extends BaseModel
}
}
public function addPayLogOpenAll($params)
{
Db::startTrans();
try {
$this->db_->insertAll($params);
Db::commit();
return 1;
} catch (\Exception $e) {
Db::rollback();
return 0;
}
}
/**
* @param int $pageNo
* @param int $pageSize
......
......@@ -13,7 +13,7 @@ use think\Model;
* Intro:
*/
class ORefundModel extends Model{
class ORefundModel extends BaseModel{
protected $table = "o_refund";
private $db_;
......@@ -326,7 +326,7 @@ class ORefundModel extends Model{
* @return ORefundModel
*/
public function updateData($data, $where) {
return $this->where($where)->update($data);
return $this->db_->where($where)->update($data);
}
/**
......
......@@ -101,11 +101,12 @@ class OfficeOPartialCommission extends BaseModel
public function getCommissionBargainColumn($pageNo, $pageSize, $order_ = 'id desc', $fields, $where)
{
$data = $this->alias('a')
->join('o_bargain b', 'a.bargain_id = b.id', 'left')
->join('o_order c', 'b.order_id = c.id', 'left')
->join('g_houses d', 'c.house_id = d.id', 'left')
->join('office_o_bargain b', 'a.bargain_id = b.id', 'left')
->join('office_o_order c', 'b.order_id = c.id', 'left')
->join("office_g_room r", "c.house_id = r.id", "left")
->join("office_g_building s", "r.building_id = s.id", "left")
->join('a_agents e', 'b.agent_id = e.id', 'left')
->join('o_real_income f', 'a.real_income_id = f.id', 'left')
->join('office_o_real_income f', 'a.real_income_id = f.id', 'left')
->where($where)
->order($order_)
->limit($pageSize)
......@@ -182,7 +183,7 @@ class OfficeOPartialCommission extends BaseModel
$result = $this->field($field)
->alias("a")
->join("a_agents b", "a.agent_id=b.id", "left")
->join("o_bargain c", "a.bargain_id=c.id or a.bargain_id = c.father_id", "left")
->join("office_o_bargain c", "a.bargain_id=c.id or a.bargain_id = c.father_id", "left")
->where($params)
->order("a.create_time desc")
->select();
......@@ -221,9 +222,9 @@ class OfficeOPartialCommission extends BaseModel
{
return $this->alias('a')
->field($field)
->join('o_real_income b', 'a.real_income_id = b.id', 'left')
->join('office_o_real_income b', 'a.real_income_id = b.id', 'left')
->join('a_agents d', 'a.agent_id = d.id', 'left')
->join('o_bargain e', 'a.bargain_id = e.id', 'left')
->join('office_o_bargain e', 'a.bargain_id = e.id', 'left')
->where($params)
->limit($pageSize)
->page($pageNo)
......@@ -234,8 +235,8 @@ class OfficeOPartialCommission extends BaseModel
public function getSumMoney($field, $where) {
return $this->alias('a')
->field($field)
->join('o_bargain b', 'a.bargain_id = b.id', 'left')
->join('o_real_income c', ' a.real_income_id = c.id', 'left')
->join('office_o_bargain b', 'a.bargain_id = b.id', 'left')
->join('office_o_real_income c', ' a.real_income_id = c.id', 'left')
->where($where)
->find();
}
......@@ -248,84 +249,13 @@ class OfficeOPartialCommission extends BaseModel
public function getCommissionTotalInfo($field, $where) {
return $this->alias('a')
->field('distinct a.id')
->join('o_real_income b', 'a.real_income_id = b.id', 'left')
->join('office_o_real_income b', 'a.real_income_id = b.id', 'left')
->join('a_agents d', 'a.agent_id = d.id', 'left')
->join('o_bargain e', 'a.bargain_id = e.id', 'left')
->join('office_o_bargain e', 'a.bargain_id = e.id', 'left')
->where($where)
->sum($field);
}
/**
* 分佣提成汇总表
*
* @param int $pageNo
* @param int $pageSize
* @param string $order_
* @param string $field
* @param string $params
* @param $operation_start_data
* @param $operation_end_data
* @return mixed
*/
public function getCommissionTotalListV2($pageNo = 1, $pageSize = 15, $order_ = 'a.id desc', $field = '', $params = '', $operation_start_data, $operation_end_data)
{
try {
$data = $this->alias('a')
->field($field)
->join('a_agents b', 'a.agent_id = b.id', 'left')
->join('o_bargain c', 'a.bargain_id = c.id', 'left')
->join('o_real_income d', 'a.real_income_id = d.id', 'left')
->join('o_taxes f', 'a.bargain_id = f.bargain_id', 'left')
->where($params)
->order($order_)
->limit($pageSize)
->page($pageNo)
->group('b.id')
->select();
$m_agent = new AAgents();
$m_tax = new OTaxes();
foreach ($data as $k => $v) {
if (isset($v['agent_id'])) {
$district_store = $m_agent->getStoreDistrict('store_name,district_name', [ 'a.id' => $v['agent_id'] ]);
$data[$k]['district_store'] = $district_store['district_name'] . '-' . $district_store['store_name'];
// //去除多次应分佣金
// $should_commission = $this->where('confirm_date', 'between time', [ $operation_start_data, $operation_end_data ])
// ->where('agent_id', $v['agent_id'])
// ->where('confirm_status', 1)
// ->where('is_del', 0)
// ->group('bargain_id')
// ->column('should_commission');
//
// $data[$k]['should_commission'] = 0;
// foreach ($should_commission as $kk => $vv) {
// $data[$k]['should_commission'] += $vv;
// }
}
}
$result['status'] = 'successful';
$result['data'] = $data;
} catch (\Exception $e) {
$result['status'] = 'fail';
$result['msg'] = $e->getMessage();
}
return $result;
}
public function getCommissionTotalField($filed, $params) {
return $this->alias('a')
->join('a_agents b', 'a.agent_id = b.id', 'left')
->join('o_bargain c', 'a.bargain_id = c.id', 'left')
->join('o_real_income d', 'a.real_income_id = d.id', 'left')
->join('o_taxes f', 'a.bargain_id = f.bargain_id', 'left')
->where($params)
->group('b.id')
->sum($filed);
}
/**
* @param $params
* @return int|string
......@@ -339,26 +269,10 @@ class OfficeOPartialCommission extends BaseModel
public function getCommissionTotalListTotal($params)
{
return $this->alias('a')
->join('o_real_income b', 'a.real_income_id = b.id', 'left')
->join('o_taxes c', 'a.agent_id = c.agent_id', 'left')
->join('office_o_real_income b', 'a.real_income_id = b.id', 'left')
->join('office_o_taxes c', 'a.agent_id = c.agent_id', 'left')
->join('a_agents d', 'a.agent_id = d.id', 'left')
->join('o_bargain e', 'a.bargain_id = e.id', 'left')
->where($params)
->group('a.agent_id')
->count();
}
/**
* @param $params
* @return int|string
*/
public function getCommissionTotalListTotalV2($params)
{
return $this->alias('a')
->join('a_agents b', 'a.agent_id = b.id', 'left')
->join('o_bargain c', 'a.bargain_id = c.id', 'left')
->join('o_real_income d', 'a.real_income_id = d.id', 'left')
->join('o_taxes f', 'a.bargain_id = f.bargain_id', 'left')
->join('office_o_bargain e', 'a.bargain_id = e.id', 'left')
->where($params)
->group('a.agent_id')
->count();
......@@ -376,7 +290,7 @@ class OfficeOPartialCommission extends BaseModel
try {
$data = $this->field('confirm_status')
->alias('a')
->join('o_bargain b', 'a.bargain_id = b.id', 'left')
->join('office_o_bargain b', 'a.bargain_id = b.id', 'left')
->where('EXP', 'a.id ='.$bargain_id . ' or b.father_id = '. $bargain_id)
->where('b.status', '<>', 30)
->where('a.is_del', 0)
......@@ -448,25 +362,6 @@ class OfficeOPartialCommission extends BaseModel
return $this->where($where)->value($field);
}
/**
* @param $field
* @param $where
* @return array|false|\PDOStatement|string|\think\Model
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function sumCommission($field, $where)
{
$where['a.is_del'] = 0;
$where['b.is_del'] = 0;
return $partial_commission = $this->field($field)
->alias('a')
->join('o_real_income b', 'a.real_income_id = b.id', 'left')
->where($where)
->find();
}
/**
* @param $fields
* @param $where
......@@ -530,7 +425,7 @@ class OfficeOPartialCommission extends BaseModel
$date = $this
->field($field)
->alias("a")
->join("o_real_income b", "a.real_income_id = b.id", "left")
->join("office_o_real_income b", "a.real_income_id = b.id", "left")
->where($where_)
->select();
return $date;
......
......@@ -13,7 +13,7 @@ use think\Model;
* Intro:
*/
class OfficeORefundModel extends Model{
class OfficeORefundModel extends BaseModel{
protected $table = "office_o_refund";
private $db_;
......@@ -326,7 +326,7 @@ class OfficeORefundModel extends Model{
* @return ORefundModel
*/
public function updateData($data, $where) {
return $this->where($where)->update($data);
return $this->db_->where($where)->update($data);
}
/**
......
......@@ -222,23 +222,16 @@ class OfficeOTaxes extends BaseModel
public function getTaxesList($pageNo = 1, $pageSize = 15, $order_ = 'a.id desc', $field = '', $params = '')
{
$data = $this->field($field)->alias('a')
->join('o_bargain b', 'a.bargain_id = b.id', 'left')
->join('o_order c', 'b.order_id = c.id', 'left')
->join('g_houses d', 'c.house_id = d.id', 'left')
->join('office_o_bargain b', 'a.bargain_id = b.id', 'left')
->join('office_o_order c', 'b.order_id = c.id', 'left')
->join('office_g_room d', 'c.house_id = d.id', 'left')
->join('office_g_building f', 'd.building_id = f.id', 'left')
->join('a_agents e', 'a.agent_id = e.id', 'left')
->where($params)
->order($order_)
->limit($pageSize)
->page($pageNo)
->select();
$m_agent = new AAgents();
foreach ($data as $k => $v) {
if (isset($v['agent_id'])) {
$district_store = $m_agent->getStoreDistrict('store_name,district_name', [ 'a.id' => $v['agent_id'] ]);
$data[$k]['district_store'] = $district_store['district_name'] . '-' . $district_store['store_name'];
}
}
return $data;
}
......@@ -251,10 +244,11 @@ class OfficeOTaxes extends BaseModel
public function getTaxesListTotal($params)
{
$data = $this->alias('a')
->join('o_bargain b', 'a.bargain_id = b.id', 'left')
->join('o_order c', 'b.order_id = c.id', 'left')
->join('g_houses d', 'c.house_id = d.id', 'left')
->join('a_agents e', 'b.agent_id = e.id', 'left')
->join('office_o_bargain b', 'a.bargain_id = b.id', 'left')
->join('office_o_order c', 'b.order_id = c.id', 'left')
->join('office_g_room d', 'c.house_id = d.id', 'left')
->join('office_g_building f', 'd.building_id = f.id', 'left')
->join('a_agents e', 'a.agent_id = e.id', 'left')
->where($params)
->count();
return $data;
......@@ -268,9 +262,10 @@ class OfficeOTaxes extends BaseModel
public function getTaxesListTotalFee($params)
{
$data = $this->alias('a')
->join('o_bargain b', 'a.bargain_id = b.id', 'left')
->join('o_order c', 'b.order_id = c.id', 'left')
->join('g_houses d', 'c.house_id = d.id', 'left')
->join('office_o_bargain b', 'a.bargain_id = b.id', 'left')
->join('office_o_order c', 'b.order_id = c.id', 'left')
->join('office_g_room d', 'c.house_id = d.id', 'left')
->join('office_g_building f', 'd.building_id = f.id', 'left')
->join('a_agents e', 'a.agent_id = e.id', 'left')
->where($params)
->sum("a.fee");
......@@ -332,7 +327,7 @@ class OfficeOTaxes extends BaseModel
public function sumBargainFee($field = 'a.fee', $where) {
return $this->field($field)
->alias('a')
->join('o_bargain b', 'a.bargain_id = b.id', 'left')
->join('office_o_bargain b', 'a.bargain_id = b.id', 'left')
->join('a_agents c', 'b.agent_id = c.id', 'left')
->where($where)
->sum($field);
......
......@@ -218,7 +218,7 @@ class OfficeOrderModel extends Model
*/
public function getOrderById($field, $order_id)
{
return $this->field($field)
return $this->db_->field($field)
->where('id', $order_id)
->find();
}
......@@ -276,7 +276,9 @@ class OfficeOrderModel extends Model
return $this->db_
->field($field)
->alias("a")
->join("g_houses b", "a.house_id = b.id", "left")
->join("office_o_report b","a.f_id = b.id","left")
->join("office_g_room c","a.house_id = c.id","left")
->join("office_g_building d","c.building_id = d.id","left")
->where($params)
->find();
}
......
......@@ -49,6 +49,7 @@ Route::group('app_broker', [
'customerinfo_genjin' => ['app_broker/index/customerinfo_genjin', ['method' => 'get']],
'timeline_pc' => ['app_broker/index/timeline_pc', ['method' => 'get']],
'timeline_pc_office' => ['app_broker/index/timeline_pc_office', ['method' => 'get']],
'timeline_pc_financial' => ['app_broker/index/timeline_pc_financial', ['method' => 'get']],
'shop_detail_pc' => ['app_broker/index/shop_detail_pc', ['method' => 'get']],
'office_detail_pc' => ['app_broker/index/office_detail_pc', ['method' => 'get']],
'submit_report_pc' => ['app_broker/index/submit_report_pc', ['method' => 'get']],
......@@ -369,6 +370,9 @@ Route::group('index', [
'publicCostDetails' => ['index/RealTimePerformance/publicCostDetails', ['method' => 'GET']],//费用报销详情 liu
'publicCostDetailsStore' => ['index/RealTimePerformance/publicCostDetailsStore', ['method' => 'GET']],//成本明细详情 liu
'accountingTable' => ['index/RealTimePerformance/accountingTable', ['method' => 'GET']],//成本核算表 liu
'receivingLog' => ['index/RealTimePerformance/receivingLog', ['method' => 'GET']],//收款日志 liu
'forgetSubmitFinancial' => ['index/RealTimePerformance/forgetSubmitFinancial', ['method' => 'GET']],//财务日报未提交 liu
'shopinspectionLog' => ['index/ShopInspectionLog/shopinspectionLogList', ['method' => 'POST|GET']],//商铺查看日志liu
'opensquareLog' => ['index/OpenSquareLog/opensquarelogList', ['method' => 'POST|GET']],//开盘广场liu
......@@ -540,28 +544,33 @@ Route::group('index', [
'checkCostFour/:check_status' => ['index/Cost/checkCost', ['method' => 'POST'], ['check_status' => 3]], //费用报销审核二审
'checkCostFive/:check_status' => ['index/Cost/checkCost', ['method' => 'POST'], ['check_status' => 4]], //费用报销审核三审
'getDetailCost' => ['index/Cost/getDetailCost', ['method' => 'GET']], //费用报销详情
'delStoreFeeImage' => ['index/StoreFee/delStoreFeeImage', ['method' => 'POST']],//删除图片
'getCostDetailList' => ['index/CostDetail/getCostDetailList', ['method' => 'POST|GET']],
'getCostDetailListExcel' => ['index/CostDetail/getCostDetailListExcel', ['method' => 'POST|GET']],
'delStoreFeeImage' => ['index/StoreFee/delStoreFeeImage', ['method' => 'POST']],//删除图片
'getCostDetailList' => ['index/CostDetail/getCostDetailList', ['method' => 'POST|GET']],
'getCostDetailListExcel' => ['index/CostDetail/getCostDetailListExcel', ['method' => 'POST|GET']],
'getAllStoreCost' => ['index/CostDetail/getAllStoreCost', ['method' => 'POST|GET']],
'getCostInfo' => ['index/CostDetail/getCostInfo', ['method' => 'POST|GET']],
'addApplyFor' => ['index/StoreFee/addApplyFor', ['method' => 'POST']],//新增报销申请
'editApplyFor' => ['index/StoreFee/addApplyFor', ['method' => 'POST']],//修改报销申请
'getApplyForFeeStore' => ['index/StoreFee/getApplyForFeeStore', ['method' => 'GET']],//获取费用承担办公室
'addFeeImage' => ['index/StoreFee/addFeeImage', ['method' => 'POST']],//新增报销申请图片
'getStoreOffice' => ['index/Store/getStoreOffice', ['method' => 'GET']],//获取费用承担办公室
'creationStoreFee' => [ 'index/StoreFee/creationStoreFee', [ 'method' => 'POST|GET' ] ],
'getStoreFeeDetail' => [ 'index/StoreFee/getStoreFeeDetail', [ 'method' => 'POST|GET' ] ],
'getStoreCostParameterList' => [ 'index/CostParameter/getStoreCostParameterList', [ 'method' => 'POST|GET' ] ],
'editCostParameter' => [ 'index/CostParameter/editCostParameter', [ 'method' => 'POST|GET' ] ],
'checkCostParameter' => [ 'index/CostParameter/checkCostParameter', [ 'method' => 'POST' ] ],//核对参数
'getCostParameter' => [ 'index/CostParameter/getCostParameter', [ 'method' => 'GET' ] ],//核对记录
'getCompanyCostParameterList' => [ 'index/CostParameter/getCompanyCostParameterList', [ 'method' => 'POST|GET' ] ],
'editCompanyData' => [ 'index/CostParameter/editCompanyData', [ 'method' => 'POST|GET' ] ],
'editDiscounts' => [ 'index/CostParameter/editDiscounts', [ 'method' => 'POST|GET' ] ],
'getCostInfo' => ['index/CostDetail/getCostInfo', ['method' => 'POST|GET']],
'addApplyFor' => ['index/StoreFee/addApplyFor', ['method' => 'POST']],//新增报销申请
'editApplyFor' => ['index/StoreFee/addApplyFor', ['method' => 'POST']],//修改报销申请
'getApplyForFeeStore' => ['index/StoreFee/getApplyForFeeStore', ['method' => 'GET']],//获取费用承担办公室
'addFeeImage' => ['index/StoreFee/addFeeImage', ['method' => 'POST']],//新增报销申请图片
'getStoreOffice' => ['index/Store/getStoreOffice', ['method' => 'GET']],//获取费用承担办公室
'creationStoreFee' => ['index/StoreFee/creationStoreFee', ['method' => 'POST|GET']],
'getStoreFeeDetail' => ['index/StoreFee/getStoreFeeDetail', ['method' => 'POST|GET']],
'getStoreCostParameterList' => ['index/CostParameter/getStoreCostParameterList', ['method' => 'POST|GET']],
'editCostParameter' => ['index/CostParameter/editCostParameter', ['method' => 'POST|GET']],
'checkCostParameter' => ['index/CostParameter/checkCostParameter', ['method' => 'POST']],//核对参数
'getCostParameter' => ['index/CostParameter/getCostParameter', ['method' => 'GET']],//核对记录
'getCompanyCostParameterList' => ['index/CostParameter/getCompanyCostParameterList', ['method' => 'POST|GET']],
'editCompanyData' => ['index/CostParameter/editCompanyData', ['method' => 'POST|GET']],
'editDiscounts' => ['index/CostParameter/editDiscounts', ['method' => 'POST|GET']],
'receiptOperatingRecordsList' => ['index/ReceiptOperatingRecords/receiptOperatingRecordsList', ['method' => 'POST|GET']],
'DailyUncommittedList' => ['index/DailyUncommitted/DailyUncommittedList', ['method' => 'POST|GET']],
'selectDailyUncommitted' => ['index/DailyUncommitted/selectDailyUncommitted', ['method' => 'POST|GET']],
]);
......@@ -746,6 +755,7 @@ Route::group('task', [
'test' => ['task/FollowUpTask/test', ['method' => 'get']],
'isExistTable' => ['task/FollowUpTask/isExistTable', ['method' => 'get']],
'moveFollowUpList' => ['task/FollowUpTask/moveFollowUpList', ['method' => 'get']],
'delOldTable' => ['task/FollowUpTask/delOldTable', ['method' => 'get']],
'frostAgent' => ['task/FrostAgentTask/frostAgent', ['method' => 'get']],
'squareBackUp' => ['task/SquareTask/squareBackUp', ['method' => 'get']], //redis备份开盘排序
......@@ -762,6 +772,9 @@ Route::group('task', [
'delAgent' => ['task/UpdateRedisCache/delAgent', ['method' => 'get']],//清空经纪人缓存
'delCache' => ['task/UpdateRedisCache/delCache', ['method' => 'get']],//清空多种缓存
'delGroup' => ['task/UpdateRedisCache/delGroup', ['method' => 'get']],//批量去除角色缓存
'delRule' => ['task/UpdateRedisCache/delRule', ['method' => 'get']],//批量去除规则缓存
'selectDailyUncommitted' => ['task/DailyUncommittedTask/selectDailyUncommitted', ['method' => 'get']], //未提交财务日报的门店
]);
Route::group('broker', [
......@@ -776,6 +789,7 @@ Route::group('broker', [
'collectingBillV2' => ['api_broker/OrderLog/collectingBillV2', ['method' => 'get|post']],
'refund' => ['api_broker/PayLog/refund', ['method' => 'get|post']],
'getRefund' => ['api_broker/PayLog/getRefund', ['method' => 'get|post']],
'myRefundList' => ['api_broker/PayLog/myRefundList', ['method' => 'get']], //退款审核
'bargain' => ['api_broker/OrderLog/bargain', ['method' => 'get|post']],
'statusBargain' => ['api_broker/OrderLog/statusBargain', ['method' => 'get|post']],
'getIsAccountStatement' => ['api_broker/OrderLog/getIsAccountStatement', ['method' => 'get|post']],
......@@ -859,7 +873,7 @@ Route::group('broker', [
'center' => ['api_broker/MyCenter/center', ['method' => 'get|post']],
'centerV2' => ['api_broker/MyCenter/centerV2', ['method' => 'get|post']],
'centerV2' => ['api_broker/MyCenter/centerV2', ['method' => 'get|post']],
// 'houseEdit' => [ 'api_broker/shop/edit', [ 'method' => 'get|post' ] ], //编辑商铺
// 'houseEditV2' => [ 'api_broker/shop/editV2', [ 'method' => 'get|post' ] ], //编辑商铺
'houseEditV2' => ['api_broker/shop/edit', ['method' => 'get|post']], //编辑商铺
......@@ -974,18 +988,22 @@ Route::group('broker', [
'getExclusive' => ['api_broker/Shop/getExclusive', ['method' => 'get|post']],
'editExclusive' => ['api_broker/Shop/editExclusive', ['method' => 'get|post']],
'getBeForNum' => ['api_broker/PayLog/getBeForNum', ['method' => 'get|post']],
'adjustment' => ['api_broker/PayLog/adjustment', ['method' => 'get|post']],
'getBeForNum' => ['api_broker/PayLog/getBeForNum', ['method' => 'get|post']],
'adjustment' => ['api_broker/PayLog/adjustment', ['method' => 'get|post']],
'getPayLogList' => ['api_broker/PayLog/getPayLogList', ['method' => 'get|post']],
'getPayLogDetail' => ['api_broker/PayLog/getPayLogDetail', ['method' => 'get|post']],
'uploadRefundImage' => ['api_broker/PayLog/uploadRefundImage', ['method' => 'post']],
'addReceiptImg' => ['api_broker/PayLog/addReceiptImg', ['method' => 'post']], //收款上传图片
//原生客户详情
'getUserLabels' => ['api_broker/User/getUserLabels', ['method' => 'get|post']],//获取电话跟进标签列表
'userDetail' => ['api_broker/User/userDetail', ['method' => 'get|post']],//
'userLog' => ['api_broker/User/userLog', ['method' => 'get|post']],//
'followUpLog' => ['api_broker/User/followUpLog', ['method' => 'get|post']],//
'followUpLogNew' => ['api_broker/User/followUpLogNew', ['method' => 'get|post']],//
'userDetailFull' => ['api_broker/User/userDetailFull', ['method' => 'get|post']],//
'addUserBind' => ['api_broker/User/addUserBind', ['method' => 'get|post']],
'removeUserBind' => ['api_broker/User/removeUserBind', ['method' => 'get|post']],
'getUserLabels' => ['api_broker/User/getUserLabels', ['method' => 'get|post']],//获取电话跟进标签列表
'userDetail' => ['api_broker/User/userDetail', ['method' => 'get|post']],//
'userLog' => ['api_broker/User/userLog', ['method' => 'get|post']],//
'followUpLog' => ['api_broker/User/followUpLog', ['method' => 'get|post']],//
'followUpLogNew' => ['api_broker/User/followUpLogNew', ['method' => 'get|post']],//
'userDetailFull' => ['api_broker/User/userDetailFull', ['method' => 'get|post']],//
'addUserBind' => ['api_broker/User/addUserBind', ['method' => 'get|post']],
'removeUserBind' => ['api_broker/User/removeUserBind', ['method' => 'get|post']],
'dailyDetail' => ['api_broker/DailyPaper/dailyDetail', ['method' => 'get|post']],
......@@ -1012,6 +1030,7 @@ Route::group('broker', [
'getAgentDistrictId' => ['api_broker/Broker/getAgentDistrictId', ['method' => 'GET|POST']],
'getOpenList' => ['api_broker/PayLogOpen/getOpenList', ['method' => 'GET|POST']],
'openCheck' => ['api_broker/PayLogOpen/openCheck', ['method' => 'GET|POST']],
'applyForOpen' => ['api_broker/PayLogOpen/applyForOpen', ['method' => 'GET|POST']],
'costList' => ['api_broker/ApplyForCost/costList', ['method' => 'GET']], //费用申请列表
'moveHouseAgent' => ['api_broker/User/moveHouseAgent', ['method' => 'GET|POST']],//客方同步到新表
'moveHouseSiteId' => ['api_broker/User/moveHouseSiteId', ['method' => 'GET|POST']],//站点同步到新表
......@@ -1073,6 +1092,7 @@ Route::group('office', [
'addCollectHouse' => ['api_broker/OfficeCollectHouse/addCollectHouse', ['method' => 'POST|GET']], //收藏或取消收藏商铺
'getCollectHouseList' => ['api_broker/OfficeCollectHouse/getCollectHouseList', ['method' => 'POST|GET']], //查询收藏数据
'getBuildingRoom' => ['api_broker/OfficeRoom/getBuildingRoom', ['method' => 'POST|GET']], //楼盘列表
'getBuildingRoomH5' => ['api_broker/OfficeRoom/getBuildingRoomH5', ['method' => 'POST|GET']], //楼盘列表
'report' => ['api_broker/OfficeReport/report', ['method' => 'get|post']], //报备
'addFollowUp' => ['api_broker/OfficeReport/addFollowUp', ['method' => 'get|post']], //新增跟进
'getFollowUpList' => ['api_broker/OfficeReport/getFollowUpList', ['method' => 'get|post']],
......@@ -1085,10 +1105,12 @@ Route::group('office', [
'addShopFollowUp' => ['api_broker/OfficeRoom/addShopFollowUp', ['method' => 'get|post']],
'getMyBuildingRoom' => ['api_broker/OfficeRoom/getMyBuildingRoom', ['method' => 'get|post']],
'getBeForNum' => ['api_broker/OfficePayLog/getBeForNum', ['method' => 'get|post']],
'adjustment' => ['api_broker/OfficePayLog/adjustment', ['method' => 'get|post']],
'refund' => ['api_broker/OfficePayLog/refund', ['method' => 'get|post']],
'getRefund' => ['api_broker/OfficePayLog/getRefund', ['method' => 'get|post']],
'getBeForNum' => ['api_broker/OfficePayLog/getBeForNum', ['method' => 'get|post']],
'adjustment' => ['api_broker/OfficePayLog/adjustment', ['method' => 'get|post']],
'refund' => ['api_broker/OfficePayLog/refund', ['method' => 'get|post']],
'getRefund' => ['api_broker/OfficePayLog/getRefund', ['method' => 'get|post']],
'uploadRefundImage' => ['api_broker/OfficePayLog/uploadRefundImage', ['method' => 'post']],
'myRefundList' => ['api_broker/OfficePayLog/myRefundList', ['method' => 'get']], //退款审核
'bargainListSearchBargainId' => ['api_broker/OfficeBargain/bargainListSearchBargainId', ['method' => 'POST|GET']],
'bargainMain' => ['api_broker/OfficeBargain/bargainList', ['method' => 'POST|GET']],
......@@ -1201,12 +1223,16 @@ Route::group('office_index', [
'checkOver' => ['index/OfficeBargain/checkOver', ['method' => 'POST']], //财务结单
'toReportListOne' => ['index/OfficeBargain/toReportListOne', ['method' => 'POST']], //回到一级审核
'partialCommissionList' => ['index/OfficeFinance/partialCommissionList', ['method' => 'get']], //分佣提成明细表
'performanceInfo' => ['index/OfficePerformanceInfo/performanceInfo', ['method' => 'GET|POST']],//业绩明细办公楼
'selectDistrictPerformance' => ['index/OfficePerformance/selectDistrictPerformance', ['method' => 'GET|POST']],//区域业绩排行
'selectStorePerformance' => ['index/OfficePerformance/selectStorePerformance', ['method' => 'GET|POST']],//门店排行
'selectIndividualPerformance' => ['index/OfficePerformance/selectIndividualPerformance', ['method' => 'GET|POST']],//个人业绩排行
'getEditLog' => ['index/OfficeRoom/getEditLog', ['method' => 'get']],//楼盘修改日志
'getTallAgeList' => ['index/OfficeFinance/getTallAgeList', ['method' => 'GET']], //税费承担明细表
'selectReportAll' => ['index/OfficeFinance/selectReportAll', ['method' => 'GET']], //时间轴
'exportExcel' => ['index/OfficeFinance/exportExcel', ['method' => 'get']], //导出分佣
'getCommissionTotalList' => ['index/OfficeFinance/getCommissionTotalList', ['method' => 'GET']], //分佣提成汇总表
'performanceInfo' => ['index/OfficePerformanceInfo/performanceInfo', ['method' => 'GET|POST']],//业绩明细办公楼
'getPerformanceInfoExcel' => ['index/OfficePerformanceInfo/getPerformanceInfoExcel', ['method' => 'GET|POST']],//
'selectDistrictPerformance' => ['index/OfficePerformance/selectDistrictPerformance', ['method' => 'GET|POST']],//区域业绩排行
'selectStorePerformance' => ['index/OfficePerformance/selectStorePerformance', ['method' => 'GET|POST']],//门店排行
'selectIndividualPerformance' => ['index/OfficePerformance/selectIndividualPerformance', ['method' => 'GET|POST']],//个人业绩排行
'getEditLog' => ['index/OfficeRoom/getEditLog', ['method' => 'get']],//楼盘修改日志
]);
Route::group('office_api', [
......
<?php
namespace app\task\controller;
use app\api_broker\service\PushMessageService;
use app\model\AStore;
use app\model\ODailyUncommittedModel;
/**
* Class DailyUncommittedTask
* @package app\task\controller
*/
class DailyUncommittedTask
{
private $m_daily_uncommitted;
function __construct()
{
$this->m_daily_uncommitted = new ODailyUncommittedModel();
}
/**
* 未提交财务日报的门店
* @return string
*/
public function selectDailyUncommitted()
{
$time = date("Y-m-d");
$s_push_msg = new PushMessageService();
$m_store = new AStore();
//未提交日报门店集合
$id_str = $this->getDailyUncommittedId($time);
if(!$id_str){
return '无数据';
}
$params_select=[];
$params_select['a.id'] = array('in',$id_str);
$params_select["a.district_id"] = array( 'not in', array( '13', '14', '15' ) );//排除测试门店
$store_result = $m_store->selectDailyUncommitted('a.id,a.district_id,b.id as agent_id,b.name', $params_select);
if(!$store_result){
return '无数据';
}
foreach ($store_result as $k => $v) {
if(!$v['agent_id']){
continue;
}
$params_save=[];
$params_save['agent_id'] = $v['agent_id'];
$params_save['daily_date'] = $time;
$get_result = $this->m_daily_uncommitted->getDailyUncommitted('id',$params_save);
if($get_result){
continue;
}
//没提交插入数据表
$params_add = [];
$params_add["agent_id"] = $v['agent_id'];
$params_add["agent_name"] = $v['name'];
$params_add["store_id"] = $v['id'];
$params_add["district_id"] = $v['district_id'];
$params_add["daily_date"] = $time;
$this->addDailyUncommitted($params_add);
$agent_ids[] = $v['agent_id'];
}
//推送
if (isset($agent_ids)){
$message = '辛苦了!记得提交今日的财务日报!';
$s_push_msg->record(15,0,$agent_ids,0,['message'=>$message]);
}
return "成功";
}
public function getDailyUncommittedId($time)
{
$m_store = new AStore();
$res = $m_store->getDailyUncommittedId($time);
$id_str = "";
if (count($res) > 0) {
foreach ($res as $k => $v) {
$id_str .= $v["store_id"]. ",";
}
$id_str = rtrim($id_str, ",");
}
return $id_str;
}
/**
* 新增
* @param $params
* @return bool
*/
public function addDailyUncommitted($params)
{
$data["agent_id"] = $params['agent_id'];
$data["agent_name"] = $params['agent_name'];
$data["store_id"] = $params['store_id'];
$data["district_id"] = $params['district_id'];
$data["daily_date"] = $params['daily_date'];
$data["status"] = 0;
$data["is_inform"] = 1;
$result = $this->m_daily_uncommitted->saveDailyUncommitted($data);//int(1)
if ($result) {
return true;
} else {
return false;
}
}
}
\ No newline at end of file
......@@ -7,6 +7,7 @@ use app\extra\RedisExt;
use app\model\ASite;
use app\model\UPhoneFollowUp;
use app\model\UPhoneFollowUpTemporary;
use Think\Exception;
/**
* Created by PhpStorm.
......@@ -23,7 +24,7 @@ class FollowUpTask
public function __construct()
{
$this->redis_ = RedisExt::getRedis();
$this->redis_ = RedisExt::getRedis();
$this->siteModel = new ASite();
}
......@@ -36,11 +37,11 @@ class FollowUpTask
*/
public function isExistTable($time, $siteId)
{
if(!$siteId){
if (!$siteId) {
return false;
}
$redis_service = new RedisCacheService();
$site_arr = $redis_service->getRedisCache(4, $siteId);
$site_arr = $redis_service->getRedisCache(4, $siteId);
if (empty($site_arr)) {
$site_arr = $this->siteModel->findByOne('city', ["id" => $siteId]);
}
......@@ -71,6 +72,44 @@ class FollowUpTask
return false;
}
/**
* @throws \think\db\exception\BindParamException
* @throws \think\exception\PDOException
*/
public function delOldTable()
{
$redisCache = new RedisCacheService();
$siteIdArr = $redisCache->siteAllCityCache();
$date = date("Y-m-d", strtotime("-5 day")); //获取5天前的时间
foreach ($siteIdArr as $item) {
$this->delTable($date, $item["id"]);
}
}
/**
* @param $time
* @param $siteId
* @return bool|void
* @throws \think\db\exception\BindParamException
* @throws \think\exception\PDOException
*/
private function delTable($time, $siteId)
{
if (!$time || !$siteId || $time < '2019-02-27') {
return;
}
$phoneFollowUpModel = new UPhoneFollowUpTemporary($siteId);
$table_name = $this->table . $siteId . "_" . $time;
$isTable = $phoneFollowUpModel->query('SHOW TABLES LIKE "' . $table_name . '"');
if ($isTable) {//存在
//删除表
$sql = "DROP TABLE `" . $table_name . "`";
$phoneFollowUpModel->execute($sql);
}
$date = date('Y-m-d', strtotime("-1 day", strtotime($time)));
$this->delTable($date, $siteId);
}
/**
* @param $db
* @param $tableName
......@@ -121,12 +160,12 @@ class FollowUpTask
//todo 判断参数和时间
$checkDayStr = date('Y-m-d ', time());
$timeBegin1 = strtotime($checkDayStr . "0:10" . ":00");
$timeEnd1 = strtotime($checkDayStr . "0:50" . ":00");
$timeBegin1 = strtotime($checkDayStr . "0:10" . ":00");
$timeEnd1 = strtotime($checkDayStr . "0:50" . ":00");
$curr_time = time();
if (!$key || $key!= "zw" ||$curr_time < $timeBegin1 || $curr_time > $timeEnd1) {
if (!$key || $key != "zw" || $curr_time < $timeBegin1 || $curr_time > $timeEnd1) {
echo "hello world";
return;
}
......@@ -134,18 +173,18 @@ class FollowUpTask
if (count($site_arr) <= 0) {
return;
}
$date = date("Y-m-d",strtotime("-1 day"));
$date = date("Y-m-d", strtotime("-1 day"));
foreach ($site_arr as $item) {
$site_id = $item["id"];
//判断此站点是否执行过
if ($this->redis_->get("is_run_" . $date . "_" . $site_id) > 0) {
continue;
}
$table_name = $this->table . $site_id . "_" . $date;
$table_name = $this->table . $site_id . "_" . $date;
$phoneFollowUpModel = new UPhoneFollowUpTemporary($site_id);
$isTable = $phoneFollowUpModel->query('SHOW TABLES LIKE "' . $table_name . '"');
$isTable = $phoneFollowUpModel->query('SHOW TABLES LIKE "' . $table_name . '"');
if ($isTable) {
$sql = "INSERT into u_phone_follow_up_" . $site_id . "
$sql = "INSERT into u_phone_follow_up_" . $site_id . "
(content,labels_id,user_id,agent_id,province,city,disc,type,create_time,update_time,user_status,img_str )
select content,labels_id,user_id,agent_id,province,city,disc,type,create_time,update_time,user_status,img_str
from `" . $table_name . "`";
......
......@@ -12,6 +12,7 @@ namespace app\task\controller;
use app\api_broker\service\RedisCacheService;
use app\model\AAgents;
use app\model\AuthGroup;
use app\model\AuthRule;
use think\Request;
class UpdateRedisCache
......@@ -63,4 +64,25 @@ class UpdateRedisCache
}
}
/**
* 批量去除权限规则缓存
*
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function delRule()
{
$m_rule = new AuthRule();
$rule_data = $m_rule->getRule('name', []);
$num = 0;
foreach ($rule_data as $v) {
$is_del = $this->redis_service->delRedisCache(4, $v['name']);
if ($is_del) {
$num++;
}
}
echo $num;
}
}
\ No newline at end of file
......@@ -450,7 +450,7 @@ body{
height: 2rem;
width: 1.64rem;
display: none;
background: url(/app/images/clik_shop_icon1.png) no-repeat 0 0/1.64rem 1.78rem;
background: url(/app/images/clik_office_icon1.gif) no-repeat 0 0/1.66rem 1.66rem;
}
.shop-list>img{
width: .8rem;
......
......@@ -23,4 +23,4 @@
if(!doc.addEventListener) return;
win.addEventListener(resizeEvt, recalc, false);
doc.addEventListener('DOMContentLoaded', recalc, false);
})(document, window);</script><link href=./static/css/app.40412676afcedfeaa92cbe7460d34019.css rel=stylesheet></head><body><div id=app></div><script src=https://api.tonglianjituan.com/app/js/libs/vue.min.js></script><script src=https://api.tonglianjituan.com/app/js/libs/vue-router.min.js></script><script type=text/javascript src=./static/js/manifest.3ad1d5771e9b13dbdad2.js></script><script type=text/javascript src=./static/js/vendor.1b35a927314506fe4a4f.js></script><script type=text/javascript src=./static/js/app.1ee79839b2ecca459d29.js></script></body></html>
\ No newline at end of file
})(document, window);</script><link href=./static/css/app.55755464f6625584e0e88681def052a7.css rel=stylesheet></head><body><div id=app></div><script src=https://api.tonglianjituan.com/app/js/libs/vue.min.js></script><script src=https://api.tonglianjituan.com/app/js/libs/vue-router.min.js></script><script type=text/javascript src=./static/js/manifest.3ad1d5771e9b13dbdad2.js></script><script type=text/javascript src=./static/js/vendor.1b35a927314506fe4a4f.js></script><script type=text/javascript src=./static/js/app.bcc4cff6ef8812895ee5.js></script></body></html>
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
No preview for this file type
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