Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
朱继来
/
后台订单管理
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
2f415eae
authored
Sep 13, 2021
by
朱继来
Browse files
Options
_('Browse Files')
Download
Plain Diff
Merge branch 'zjl_crm_v3_20210903'
parents
05e9a79d
09d8a582
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
43 additions
and
0 deletions
app/Http/Controllers/AddOrderController.php
app/Http/Controllers/OrderController.php
app/Model/CrmModel.php
public/js/add_order.js
app/Http/Controllers/AddOrderController.php
View file @
2f415eae
...
@@ -180,6 +180,15 @@ Class AddOrderController extends Controller
...
@@ -180,6 +180,15 @@ Class AddOrderController extends Controller
// return ['errcode' => -1, 'errmsg' => '该客户由 '.$sale_name.' 跟进,请联系主管重新指派'];
// return ['errcode' => -1, 'errmsg' => '该客户由 '.$sale_name.' 跟进,请联系主管重新指派'];
// }
// }
// 获取当前销售 已成交的用户上限
$order_user_limit
=
$CrmModel
->
getOrderUserLimit
(
$request
->
user
->
userId
);
if
(
$order_user_limit
)
{
$count
=
$CrmModel
->
getSaleOrderUserCount
(
$request
->
user
->
userId
);
if
(
$count
>
$order_user_limit
)
return
[
'errcode'
=>
11001
,
'errmsg'
=>
'你已达到成交用户上限,请先释放你跟进的已下单用户或联系主管重新分配当前用户'
];
}
$res
=
$CrmModel
->
isBind
(
$user
->
user_id
,
$operator_id
);
$res
=
$CrmModel
->
isBind
(
$user
->
user_id
,
$operator_id
);
if
(
!
$res
)
{
if
(
!
$res
)
{
// 检查当前用户是否有人跟进
// 检查当前用户是否有人跟进
...
...
app/Http/Controllers/OrderController.php
View file @
2f415eae
...
@@ -26,6 +26,7 @@ use App\Model\PayExtendModel;
...
@@ -26,6 +26,7 @@ use App\Model\PayExtendModel;
use
App\Model\OrderPurPriceModel
;
use
App\Model\OrderPurPriceModel
;
use
App\Model\OrderServiceModel
;
use
App\Model\OrderServiceModel
;
use
App\Model\OrderServiceItemsModel
;
use
App\Model\OrderServiceItemsModel
;
use
App\Model\CrmModel
;
use
Session
;
use
Session
;
use
Hprose\Http\Client
;
use
Hprose\Http\Client
;
...
@@ -926,6 +927,16 @@ Class OrderController extends Controller
...
@@ -926,6 +927,16 @@ Class OrderController extends Controller
return
[
'errcode'
=>-
1
,
'errmsg'
=>
'此订单已被'
.
$name
.
'锁定,不能提交审单!'
];
return
[
'errcode'
=>-
1
,
'errmsg'
=>
'此订单已被'
.
$name
.
'锁定,不能提交审单!'
];
}
}
// 获取当前销售 已成交的用户上限
$CrmModel
=
new
CrmModel
;
$order_user_limit
=
$CrmModel
->
getOrderUserLimit
(
$request
->
user
->
userId
);
if
(
$order_user_limit
)
{
$count
=
$CrmModel
->
getSaleOrderUserCount
(
$request
->
user
->
userId
);
if
(
$count
>
$order_user_limit
)
return
[
'errcode'
=>
11001
,
'errmsg'
=>
'你已达到成交用户上限,请先释放你跟进的已下单用户或联系主管重新分配当前用户'
];
}
$perm
=
new
PermController
;
$perm
=
new
PermController
;
$OrderModel
=
new
OrderModel
;
$OrderModel
=
new
OrderModel
;
$relation_id
=
[];
$relation_id
=
[];
...
...
app/Model/CrmModel.php
View file @
2f415eae
<?php
<?php
namespace
App\Model
;
namespace
App\Model
;
use
Illuminate\Database\Eloquent\Model
;
use
Illuminate\Database\Eloquent\Model
;
use
App\Model\OrderModel
;
class
CrmModel
extends
Model
class
CrmModel
extends
Model
{
{
...
@@ -38,4 +39,21 @@ class CrmModel extends Model
...
@@ -38,4 +39,21 @@ class CrmModel extends Model
return
$this
->
from
(
'invoice_com_user'
)
->
where
(
'user_id'
,
$user_id
)
->
value
(
'sale_id'
);
return
$this
->
from
(
'invoice_com_user'
)
->
where
(
'user_id'
,
$user_id
)
->
value
(
'sale_id'
);
}
}
// 获取当前销售的成交用户上限
public
function
getOrderUserLimit
(
$sale_id
)
{
return
$this
->
from
(
'employee_card'
)
->
where
(
'sale_id'
,
$sale_id
)
->
value
(
'order_user_limit'
);
}
// 获取当前销售 已下单用户数量
public
function
getSaleOrderUserCount
(
$sale_id
)
{
$users
=
$this
->
from
(
'invoice_com_user'
)
->
where
(
'user_id'
,
'<>'
,
0
)
->
where
(
'sale_id'
,
$sale_id
)
->
lists
(
'user_id'
);
if
(
empty
(
$users
))
return
0
;
return
OrderModel
::
whereIn
(
'user_id'
,
$users
)
->
where
(
'status'
,
'<>'
,
-
1
)
->
where
(
'sale_id'
,
$sale_id
)
->
groupBy
(
'user_id'
)
->
get
()
->
count
();
// 去重+统计 laravel需要先get()
}
}
}
\ No newline at end of file
public/js/add_order.js
View file @
2f415eae
...
@@ -98,6 +98,10 @@
...
@@ -98,6 +98,10 @@
loading
.
lists
(
data
.
user
.
user_id
,
goods_type
,
is_online
);
// 加载该用户购物车
loading
.
lists
(
data
.
user
.
user_id
,
goods_type
,
is_online
);
// 加载该用户购物车
return
false
;
return
false
;
}
else
if
(
resp
.
errcode
==
11001
)
{
$
(
'.search-user'
).
val
(
''
);
layer
.
alert
(
resp
.
errmsg
)
return
false
;
}
}
layer
.
msg
(
resp
.
errmsg
)
layer
.
msg
(
resp
.
errmsg
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment