From 95acbe3dc6c20ef4a47446b9fe2f42811994d65d Mon Sep 17 00:00:00 2001
From: lccsw <1127794702@qq.com>
Date: Mon, 26 Jul 2021 10:41:48 +0800
Subject: [PATCH] add-api-licheb-cal
---
admin/config/qiniu.php | 28 ++++----
admin/controllers/Common.php | 28 ++++++--
admin/controllers/app/licheb/Member.php | 2 +-
admin/views/receiver/orders/get.php | 45 ++++++++++++-
admin/views/receiver/orders/oinfo.php | 66 +++++++++++++++++++
api/config/qiniu.php | 30 ++++-----
api/controllers/wxapp/liche/Contract.php | 4 +-
api/controllers/wxapp/licheb/Customers.php | 7 ++
api/controllers/wxapp/licheb/User.php | 25 ++++++-
.../receiver/Receiver_customers_model.php | 30 +++++++++
home/config/qiniu.php | 30 ++++-----
11 files changed, 240 insertions(+), 55 deletions(-)
diff --git a/admin/config/qiniu.php b/admin/config/qiniu.php
index ea526bc3..9afa9c88 100755
--- a/admin/config/qiniu.php
+++ b/admin/config/qiniu.php
@@ -1,26 +1,26 @@
input->post('select_id');
+ $brand_id = $this->input->post('brand_id');
+ $s_id = $this->input->post('s_id');
+ $v_id = $this->input->post('v_id');
+ $cor_id = $this->input->post('cor_id');
+ $incor_id = $this->input->post('incor_id');
$page = $this->input->post('page') ? intval($this->input->post('page')) : 1;
$size = $this->input->post('size') ? intval($this->input->post('size')) : 10;
- $where = [
- 'status' => 1
- ];
+ $where = "status=1 ";
+ $brand_id && $where.=" and brand_id=$brand_id";
+ $s_id && $where.=" and s_id=$s_id";
+ $v_id && $where.=" and v_id=$v_id";
+ $cor_id && $where.=" and cor_id=$cor_id";
+ $incor_id && $where.=" and incor_id=$incor_id";
+ if($select_id){
+ $fhwhere = [
+ "($where) or (id=$select_id)" => null
+ ];
+ }else{
+ $fhwhere = [
+ "($where)" => null
+ ];
+ }
$count = 0;
$list = array();
@@ -1348,9 +1366,9 @@ class Common extends CI_Controller
$this->load->model('auto/auto_brand_model');
$this->load->model('auto/auto_attr_model');
- $count = $this->items_model->count($where);
+ $count = $this->items_model->count($fhwhere);
if ($count) {
- $rows = $this->items_model->select($where, "id desc", $page, $size, 'id,brand_id,s_id,v_id,cor_id,incor_id,vin');
+ $rows = $this->items_model->select($fhwhere, "id desc", $page, $size, 'id,brand_id,s_id,v_id,cor_id,incor_id,vin');
//品牌车型
$brand_arr = array_unique(array_column($rows, 'brand_id'));
diff --git a/admin/controllers/app/licheb/Member.php b/admin/controllers/app/licheb/Member.php
index eee341ae..02c60e9a 100755
--- a/admin/controllers/app/licheb/Member.php
+++ b/admin/controllers/app/licheb/Member.php
@@ -4,7 +4,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
class Member extends HD_Controller{
- private $groups = [1=>'销售',2=>'店长',3=>'掌柜'];
+ private $groups = [1=>'销售',2=>'店长',3=>'老板'];
public function __construct()
{
diff --git a/admin/views/receiver/orders/get.php b/admin/views/receiver/orders/get.php
index db3e2368..fb0b007f 100644
--- a/admin/views/receiver/orders/get.php
+++ b/admin/views/receiver/orders/get.php
@@ -102,18 +102,56 @@
carslist: [],
page: [],
bx_imgs:[],
+ brand_list:[],
+ series_list:[],
+ v_list:[],
+ cor_list:[],
+ incor_list:[],
+ brand_id:'',
+ s_id:'',
+ v_id:'',
+ cor_id:'',
+ incor_id:''
},
mounted() {
var that = this;
that.info = =json_encode($info,JSON_UNESCAPED_UNICODE)?>;
+ that.brand_id = =$info['brand_id']?>,
+ that.s_id = =$info['s_id']?>,
+ that.v_id = =$info['v_id']?>,
+ that.cor_id = =$info['cor_id']?>,
+ that.incor_id = =$info['incor_id']?>,
that.bx_imgs = =json_encode($info['bx_imgs'])?>;
},
computed: {},
created: function () {
},
methods: {
+ setauto: function(type){
+ var that = this
+ var p_data = {'tp':1,'type':type}
+ if(type==2){
+ p_data['pid'] = that.brand_id
+ } else if(type==3){
+ p_data['pid'] = that.s_id
+ }
+ $.get("/common/auto",p_data,function(result){
+ if(type==1){
+ that.brand_list = result.data
+ }else if(type==2){
+ that.series_list = result.data
+ }else if(type==3){
+ that.v_list = result.data[3]
+ that.cor_list = result.data[4]
+ that.incor_list = result.data[5]
+ }
+ })
+ },
carModal: function () {
var that = this
+ that.setauto(1);
+ that.setauto(2);
+ that.setauto(3);
that.getCars(1);
layer.open({
type: 1,
@@ -143,7 +181,12 @@
dataType: 'json',
data: {
page: page,
- select_id:vm.info.item_id
+ select_id:vm.info.item_id,
+ brand_id:vm.brand_id,
+ s_id:vm.s_id,
+ v_id:vm.v_id,
+ cor_id:vm.cor_id,
+ incor_id:vm.incor_id
},
success: function (re) {
var carslist = re.data.list;
diff --git a/admin/views/receiver/orders/oinfo.php b/admin/views/receiver/orders/oinfo.php
index 4b4b9b18..e0718625 100644
--- a/admin/views/receiver/orders/oinfo.php
+++ b/admin/views/receiver/orders/oinfo.php
@@ -123,6 +123,72 @@
+
diff --git a/api/config/qiniu.php b/api/config/qiniu.php
index ecb48b96..9afa9c88 100755
--- a/api/config/qiniu.php
+++ b/api/config/qiniu.php
@@ -1,26 +1,26 @@
ckcars_model->update(['status'=>2],['o_id'=>$id]);
$this->orders_model->update(['status'=>3],['id'=>$id]);
- $this->bills_model->add(['o_id'=>$id,'c_time'=>time()]);
+ if(!$this->bills_model->count(['o_id'=>$id])){
+ $this->bills_model->add(['o_id'=>$id,'c_time'=>time()]);
+ }
throw new Exception('签名成功', API_CODE_SUCCESS);
}else{
throw new Exception('签名失败', API_CODE_INVILD_PARAM);
diff --git a/api/controllers/wxapp/licheb/Customers.php b/api/controllers/wxapp/licheb/Customers.php
index 8dfd5baa..624784e6 100644
--- a/api/controllers/wxapp/licheb/Customers.php
+++ b/api/controllers/wxapp/licheb/Customers.php
@@ -285,6 +285,13 @@ class Customers extends Wxapp{
$where['c_time <='] = strtotime(date('Y-m-d 23:59:59',strtotime($e_time)));
}
+ if(strlen($iscall)){
+ if($iscall){
+ $where['cont_time!='] = '0000-00-00 00:00:00';
+ }else{
+ $where['cont_time'] = '0000-00-00 00:00:00';
+ }
+ }
$unuse && $where['admin_id'] = 0;
strlen($istop) && $where['is_top'] = $istop;
strlen($if_driver) && $where['if_driver'] = 1;
diff --git a/api/controllers/wxapp/licheb/User.php b/api/controllers/wxapp/licheb/User.php
index 886b14e3..ebd3f533 100644
--- a/api/controllers/wxapp/licheb/User.php
+++ b/api/controllers/wxapp/licheb/User.php
@@ -102,20 +102,39 @@ class User extends Wxapp{
protected function get_cal(){
$uid = $this->session['uid'];
$biz_id = $this->session['biz_id'];
+ $group_id = $this->session['group_id'];
$this->load->model('receiver/receiver_customers_model','customers_model');
$this->load->model('receiver/order/receiver_orders_model','orders_model');
- $wl_count = $this->customers_model->count(['status'=>0,'admin_id'=>$uid]);
- $gz_count = $this->customers_model->count(['status>-1'=>null,'is_top'=>1,'admin_id'=>$uid]);
+ $this->load->model('receiver/order/receiver_order_signs_model','order_signs_model');
+ $wl_count = $this->customers_model->count(["cont_time = '0000-00-00 00:00:00'"=>null,'admin_id'=>$uid]);
+ $gz_count = $this->customers_model->count(['status>'=>-1,'is_top'=>1,'admin_id'=>$uid]);
$sign_count = $this->orders_model->count(['status'=>0,'admin_id'=>$uid]);
$loan_count = $this->orders_model->count(['status'=>1,'admin_id'=>$uid]);
//未派单客户
$unuse_count = $this->customers_model->count(['admin_id'=>0,'biz_id'=>$biz_id]);
+
+ //为创建订单客户
+ $uncre_count = $this->customers_model->count_order(['lc_receiver_orders.id is null'=>null,'lc_receiver_customers.admin_id'=>$uid]);
+ $t1 = 'lc_receiver_order_signs';
+ $t2 = 'lc_receiver_orders';
+ $need_sign = $this->order_signs_model->count_order(["$t1.status"=>0,"$t2.admin_id"=>$uid]);//需要签名
+ $loan_count = $this->orders_model->count(['status'=>1,'admin_id'=>$uid]);//未选择分期
+ $bill_count = $this->orders_model->count(['status'=>3,'admin_id'=>$uid]);//开票相关
+ $del_count = $this->orders_model->count(['status'=>5,'admin_id'=>$uid]);//交付确认
+ $deallist = [
+ ['title'=>'需登记订单','icon'=>'icon-dengji','total'=>$uncre_count,'page'=>'/pages/order/register/index'],
+ ['title'=>'需邀请签名','icon'=>'icon-qianming1','total'=>$need_sign,'page'=>'/pages/order/filterList/index?key=0'],
+ ['title'=>'未选择分期','icon'=>'icon-fenpei','total'=>$loan_count,'page'=>'/pages/order/filterList/index?key=1'],
+ ['title'=>'开票相关','icon'=>'icon-kaipiao1','total'=>$bill_count,'page'=>'/pages/order/filterList/index?key=3'],
+ ['title'=>'交付确认','icon'=>'icon-jiaofu','total'=>$del_count,'page'=>'/pages/order/filterList/index?key=5'],
+ ];
$data = [
'wl_count' => $wl_count,
'gz_count' => $gz_count,
'sign_count' => $sign_count,
'loan_count' => $loan_count,
- 'unuse_count' => $unuse_count
+ 'unuse_count' => $unuse_count,
+ 'deallist' => $deallist
];
return $data;
}
diff --git a/common/models/receiver/Receiver_customers_model.php b/common/models/receiver/Receiver_customers_model.php
index e121708c..79ca0bbd 100644
--- a/common/models/receiver/Receiver_customers_model.php
+++ b/common/models/receiver/Receiver_customers_model.php
@@ -41,4 +41,34 @@ class Receiver_customers_model extends HD_Model
public function get_status(){
return $this->status_arr;
}
+
+ public function count_order($where){
+ return $this->select_order($where,'','','','',1);
+ }
+
+ public function select_order($where = array(), $order = '', $page = 0, $page_size = 20 , $fileds = '', $count = 0){
+ !$fileds && $fileds = 'lc_receiver_customers.*';
+ $this->db->distinct()->select($fileds);
+ $this->db->from('lc_receiver_customers');
+ $this->db->join('lc_receiver_orders', 'lc_receiver_orders.rid = lc_receiver_customers.id','left');
+
+ if ($where) {
+ $this->db->where($where);
+ }
+ if ($count) {
+ return $this->db->count_all_results();
+ }
+ if ($order) {
+ $this->db->order_by($order);
+ }
+ if ($page) {
+ $offset = ($page - 1) * $page_size;
+ $limit = $page_size;
+ } else {
+ $offset = null;
+ $limit = null;
+ }
+ $this->db->limit($limit, $offset);
+ return $this->db->get()->result_array();
+ }
}
diff --git a/home/config/qiniu.php b/home/config/qiniu.php
index ecb48b96..9afa9c88 100755
--- a/home/config/qiniu.php
+++ b/home/config/qiniu.php
@@ -1,26 +1,26 @@