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
1b12633c
authored
Apr 13, 2021
by
朱继来
Browse files
Options
_('Browse Files')
Download
Plain Diff
Merge branch 'zjl_inquiry_order_20210311'
parents
5d618527
cac76ba0
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
52 additions
and
30 deletions
app/Http/Controllers/AddOrderController.php
app/Http/Controllers/ApiController.php
app/Model/CrmModel.php
public/js/add_inquiry_order.js
app/Http/Controllers/AddOrderController.php
View file @
1b12633c
...
...
@@ -180,13 +180,16 @@ Class AddOrderController extends Controller
if
(
strpos
(
$_SERVER
[
'HTTP_HOST'
],
'sz'
)
===
false
)
{
// 非测试环境下执行
// 若用户已分配,则判断当前登录客服是否能给用户下单,若没分配,按之前流程,订单生成时分配给当前登录客服
$CrmModel
=
new
CrmModel
();
$sale_id
=
$CrmModel
->
getSaleId
(
$user
->
user_id
);
//
$sale_id = $CrmModel->getSaleId($user->user_id);
if
(
$sale_id
&&
$sale_id
!=
$operator_id
)
{
$CmsModel
=
new
CmsModel
();
$sale_name
=
$CmsModel
->
getUserName
(
$sale_id
);
return
[
'errcode'
=>
-
1
,
'errmsg'
=>
'该客户由 '
.
$sale_name
.
' 跟进,请联系主管重新指派'
];
}
//if ($sale_id && $sale_id != $operator_id) {
// $CmsModel = new CmsModel();
// $sale_name = $CmsModel->getUserName($sale_id);
// return ['errcode' => -1, 'errmsg' => '该客户由 '.$sale_name.' 跟进,请联系主管重新指派'];
//}
$res
=
$CrmModel
->
isBind
(
$user
->
user_id
,
$operator_id
);
if
(
!
$res
)
return
[
'errcode'
=>-
1
,
'errmsg'
=>
'当前用户与登录客服无绑定关系'
];
}
$address
=
DB
::
connection
(
'order'
)
->
table
(
'lie_user_address'
)
->
where
(
'user_id'
,
$user
->
user_id
)
->
select
(
'address_id'
,
'consignee'
)
->
get
();
// 收货地址
...
...
app/Http/Controllers/ApiController.php
View file @
1b12633c
...
...
@@ -520,7 +520,7 @@ class ApiController extends Controller
$com_id
=
0
;
$user_id
=
0
;
$inv_com_name
&&
$com_id
=
DB
::
connection
(
'
order'
)
->
table
(
'lie_
invoice_company'
)
->
where
(
'com_name'
,
$inv_com_name
)
->
value
(
'id'
);
$inv_com_name
&&
$com_id
=
DB
::
connection
(
'
crm'
)
->
table
(
'
invoice_company'
)
->
where
(
'com_name'
,
$inv_com_name
)
->
value
(
'id'
);
if
(
$account
)
{
$field
=
preg_match
(
'/@/'
,
$account
)
?
'email'
:
'mobile'
;
...
...
@@ -538,7 +538,8 @@ class ApiController extends Controller
$map
[
'user_id'
]
=
$user_id
;
$map
[
'sale_id'
]
=
$request
->
user
->
userId
;
$map
[
'status'
]
=
0
;
$id
=
DB
::
connection
(
'order'
)
->
table
(
'lie_invoice_com_user'
)
->
where
(
$map
)
->
value
(
'id'
);
$id
=
DB
::
connection
(
'crm'
)
->
table
(
'invoice_com_user'
)
->
where
(
$map
)
->
value
(
'id'
);
if
(
!
$id
)
$this
->
Export
(
-
1
,
'当前公司、联系方式与客服不存在绑定关系'
);
$this
->
Export
(
0
,
''
,
[
'com_id'
=>
$com_id
,
'user_id'
=>
$user_id
,
'account'
=>
$account
]);
...
...
@@ -553,7 +554,8 @@ class ApiController extends Controller
$map
[
'com_id'
]
=
$com_id
;
$map
[
'sale_id'
]
=
$request
->
user
->
userId
;
$map
[
'status'
]
=
0
;
$uid
=
DB
::
connection
(
'order'
)
->
table
(
'lie_invoice_com_user'
)
->
where
(
$map
)
->
value
(
'user_id'
);
$uid
=
DB
::
connection
(
'crm'
)
->
table
(
'invoice_com_user'
)
->
where
(
$map
)
->
value
(
'user_id'
);
if
(
!
$uid
)
$this
->
Export
(
-
1
,
'当前公司未绑定联系人'
);
$UserMainModel
=
new
UserMainModel
;
...
...
@@ -566,20 +568,18 @@ class ApiController extends Controller
// 公司不存在,联系方式存在
if
(
!
$user_id
)
$this
->
Export
(
-
1
,
'当前联系方式不存在'
);
// 判断会员是否与当前登录账号绑定
if
(
strpos
(
$_SERVER
[
'HTTP_HOST'
],
'sz'
)
===
false
)
{
// 非测试环境下执行
// 若用户已分配,则判断当前登录客服是否能给用户下单,若没分配,按之前流程,订单生成时分配给当前登录客服
$CrmModel
=
new
CrmModel
();
$sale_id
=
$CrmModel
->
getSaleId
(
$user_id
);
// 判断当前用户和登录用户是否存在于关联表
$map
=
[];
$map
[
'user_id'
]
=
$user_id
;
$map
[
'sale_id'
]
=
$request
->
user
->
userId
;
$map
[
'status'
]
=
0
;
$com_id
=
DB
::
connection
(
'crm'
)
->
table
(
'invoice_com_user'
)
->
where
(
$map
)
->
value
(
'com_id'
);
if
(
!
$com_id
)
$this
->
Export
(
-
1
,
'当前登录用户未绑定该联系人'
);
if
(
$sale_id
&&
$sale_id
!=
$request
->
user
->
userId
)
{
$CmsModel
=
new
CmsModel
();
$sale_name
=
$CmsModel
->
getUserName
(
$sale_id
);
$this
->
Export
(
-
1
,
'该客户由 '
.
$sale_name
.
' 跟进,请联系主管重新指派'
);
}
}
$com_name
=
DB
::
connection
(
'crm'
)
->
table
(
'invoice_company'
)
->
where
(
'id'
,
$com_id
)
->
value
(
'com_name'
);
$this
->
Export
(
0
,
''
,
[
'com_id'
=>
''
,
'user_id'
=>
$user_id
,
'account'
=>
$account
]);
$this
->
Export
(
0
,
''
,
[
'com_id'
=>
$com_id
,
'com_name'
=>
$com_name
,
'user_id'
=>
$user_id
,
'account'
=>
$account
]);
}
// 获取用户绑定客服、发票
...
...
@@ -606,25 +606,26 @@ class ApiController extends Controller
if
(
!
$com_id
)
$this
->
Export
(
-
1
,
'未填写当前发票/公司'
);
$com_
name
=
DB
::
connection
(
'order'
)
->
table
(
'lie_invoice_company'
)
->
where
(
'id'
,
$com_id
)
->
value
(
'com_name'
);
if
(
!
$com_
name
)
$this
->
Export
(
-
1
,
'当前公司不存在'
);
$com_
info
=
DB
::
connection
(
'crm'
)
->
table
(
'invoice_company'
)
->
where
(
'id'
,
$com_id
)
->
first
(
);
if
(
!
$com_
info
)
$this
->
Export
(
-
1
,
'当前公司不存在'
);
$map
=
[];
$map
[
'tax_title'
]
=
$com_name
;
$map
[
'tax_title'
]
=
$com_
info
->
com_
name
;
$map
[
'user_id'
]
=
$user_id
;
$map
[
'inv_type'
]
=
$invoice_type
;
$invoice
=
DB
::
connection
(
'order'
)
->
table
(
'lie_taxinfo'
)
->
where
(
$map
)
->
first
();
if
(
!
$invoice
)
$this
->
Export
(
-
1
,
'未找到发票信息'
);
$tax_info
[
'tax_id'
]
=
isset
(
$invoice
)
?
$invoice
->
tax_id
:
0
;
$tax_info
[
'tax_title'
]
=
isset
(
$invoice
)
?
$invoice
->
tax_title
:
''
;
$tax_info
[
'tax_no'
]
=
isset
(
$
invoice
)
?
$invoice
->
tax_no
:
''
;
$tax_info
[
'tax_no'
]
=
isset
(
$
com_info
)
?
$com_info
->
com_tax_registration
:
''
;
if
(
$invoice_type
==
4
)
$this
->
Export
(
0
,
''
,
$tax_info
);
// 增值税普票
$tax_info
[
'com_addr'
]
=
isset
(
$
invoice
)
?
$invoice
->
company_address
:
''
;
$tax_info
[
'com_tel'
]
=
isset
(
$
invoice
)
?
$invoice
->
company_phone
:
''
;
$tax_info
[
'com_bank'
]
=
isset
(
$
invoice
)
?
$invoice
->
bank_name
:
''
;
$tax_info
[
'com_bank_num'
]
=
isset
(
$
invoice
)
?
$invoice
->
bank_account
:
''
;
$tax_info
[
'com_addr'
]
=
isset
(
$
com_info
)
?
$com_info
->
com_addr
:
''
;
$tax_info
[
'com_tel'
]
=
isset
(
$
com_info
)
?
$com_info
->
com_tel
:
''
;
$tax_info
[
'com_bank'
]
=
isset
(
$
com_info
)
?
$com_info
->
com_bank
:
''
;
$tax_info
[
'com_bank_num'
]
=
isset
(
$
com_info
)
?
$com_info
->
com_bank_num
:
''
;
$tax_info
[
'consignee'
]
=
isset
(
$invoice
)
?
$invoice
->
consignee
:
''
;
$tax_info
[
'consignee_phone'
]
=
isset
(
$invoice
)
?
$invoice
->
consignee_phone
:
''
;
$tax_info
[
'consignee_addr'
]
=
isset
(
$invoice
)
?
$invoice
->
consignee_address
:
''
;
...
...
app/Model/CrmModel.php
View file @
1b12633c
...
...
@@ -21,4 +21,16 @@ class CrmModel extends Model
return
$sales
?
$sales
->
sale_id
:
0
;
}
// 判断用户与客服是否存在关联关系
public
function
isBind
(
$user_id
,
$sale_id
)
{
$map
=
[];
$map
[
'user_id'
]
=
$user_id
;
$map
[
'sale_id'
]
=
$sale_id
;
$map
[
'status'
]
=
0
;
return
$this
->
from
(
'invoice_com_user'
)
->
where
(
$map
)
->
value
(
'id'
);
}
}
\ No newline at end of file
public/js/add_inquiry_order.js
View file @
1b12633c
...
...
@@ -24,8 +24,12 @@ layui.config({
form
.
on
(
'radio(invoice_type)'
,
function
(
data
)
{
var
val
=
data
.
value
;
if
(
!
val
)
{
$
(
'.tax_id'
).
val
(
''
);
$
(
'.inv-user-info'
).
val
(
''
);
$
(
'.user_id'
).
val
(
''
);
$
(
'.inv_com_id'
).
val
(
''
);
if
(
!
val
)
{
$
(
'.invoice-section-2'
).
hide
();
$
(
'.invoice-section-3'
).
hide
();
$
(
'.invoice-section-4'
).
hide
();
...
...
@@ -83,6 +87,7 @@ layui.config({
}
$
(
'.inv_com_id'
).
val
(
resp
.
data
.
com_id
);
resp
.
data
.
com_name
&&
$
(
'.inv_com_name'
).
val
(
resp
.
data
.
com_name
);
$
(
'.user_id'
).
val
(
resp
.
data
.
user_id
);
$
(
'.account'
).
val
(
resp
.
data
.
account
);
...
...
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