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
4693c3ea
authored
Apr 12, 2021
by
朱继来
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
调整关联关系
parent
99fe26b1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
25 deletions
app/Http/Controllers/ApiController.php
public/js/add_inquiry_order.js
app/Http/Controllers/ApiController.php
View file @
4693c3ea
...
@@ -520,7 +520,7 @@ class ApiController extends Controller
...
@@ -520,7 +520,7 @@ class ApiController extends Controller
$com_id
=
0
;
$com_id
=
0
;
$user_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
)
{
if
(
$account
)
{
$field
=
preg_match
(
'/@/'
,
$account
)
?
'email'
:
'mobile'
;
$field
=
preg_match
(
'/@/'
,
$account
)
?
'email'
:
'mobile'
;
...
@@ -538,7 +538,8 @@ class ApiController extends Controller
...
@@ -538,7 +538,8 @@ class ApiController extends Controller
$map
[
'user_id'
]
=
$user_id
;
$map
[
'user_id'
]
=
$user_id
;
$map
[
'sale_id'
]
=
$request
->
user
->
userId
;
$map
[
'sale_id'
]
=
$request
->
user
->
userId
;
$map
[
'status'
]
=
0
;
$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
,
'当前公司、联系方式与客服不存在绑定关系'
);
if
(
!
$id
)
$this
->
Export
(
-
1
,
'当前公司、联系方式与客服不存在绑定关系'
);
$this
->
Export
(
0
,
''
,
[
'com_id'
=>
$com_id
,
'user_id'
=>
$user_id
,
'account'
=>
$account
]);
$this
->
Export
(
0
,
''
,
[
'com_id'
=>
$com_id
,
'user_id'
=>
$user_id
,
'account'
=>
$account
]);
...
@@ -553,7 +554,8 @@ class ApiController extends Controller
...
@@ -553,7 +554,8 @@ class ApiController extends Controller
$map
[
'com_id'
]
=
$com_id
;
$map
[
'com_id'
]
=
$com_id
;
$map
[
'sale_id'
]
=
$request
->
user
->
userId
;
$map
[
'sale_id'
]
=
$request
->
user
->
userId
;
$map
[
'status'
]
=
0
;
$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
,
'当前公司未绑定联系人'
);
if
(
!
$uid
)
$this
->
Export
(
-
1
,
'当前公司未绑定联系人'
);
$UserMainModel
=
new
UserMainModel
;
$UserMainModel
=
new
UserMainModel
;
...
@@ -566,20 +568,18 @@ class ApiController extends Controller
...
@@ -566,20 +568,18 @@ class ApiController extends Controller
// 公司不存在,联系方式存在
// 公司不存在,联系方式存在
if
(
!
$user_id
)
$this
->
Export
(
-
1
,
'当前联系方式不存在'
);
if
(
!
$user_id
)
$this
->
Export
(
-
1
,
'当前联系方式不存在'
);
// 判断会员是否与当前登录账号绑定
// 判断当前用户和登录用户是否存在于关联表
if
(
strpos
(
$_SERVER
[
'HTTP_HOST'
],
'sz'
)
===
false
)
{
// 非测试环境下执行
$map
=
[];
// 若用户已分配,则判断当前登录客服是否能给用户下单,若没分配,按之前流程,订单生成时分配给当前登录客服
$map
[
'user_id'
]
=
$user_id
;
$CrmModel
=
new
CrmModel
();
$map
[
'sale_id'
]
=
$request
->
user
->
userId
;
$sale_id
=
$CrmModel
->
getSaleId
(
$user_id
);
$map
[
'status'
]
=
0
;
if
(
$sale_id
&&
$sale_id
!=
$request
->
user
->
userId
)
{
$com_id
=
DB
::
connection
(
'crm'
)
->
table
(
'invoice_com_user'
)
->
where
(
$map
)
->
value
(
'com_id'
);
$CmsModel
=
new
CmsModel
();
if
(
!
$com_id
)
$this
->
Export
(
-
1
,
'当前登录用户未绑定该联系人'
);
$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
]);
}
}
// 获取用户绑定客服、发票
// 获取用户绑定客服、发票
...
@@ -596,7 +596,7 @@ class ApiController extends Controller
...
@@ -596,7 +596,7 @@ class ApiController extends Controller
// 个人发票
// 个人发票
if
(
$invoice_type
==
2
)
{
if
(
$invoice_type
==
2
)
{
$where
=
[];
$where
=
[];
$where
[
'user_id'
]
=
$user_id
;
$where
[
'user_id'
]
=
$user_id
;
$where
[
'inv_type'
]
=
2
;
$where
[
'inv_type'
]
=
2
;
$tax_info
=
DB
::
connection
(
'order'
)
->
table
(
'lie_taxinfo'
)
->
where
(
$where
)
->
select
(
'tax_title'
,
'tax_id'
)
->
get
();
$tax_info
=
DB
::
connection
(
'order'
)
->
table
(
'lie_taxinfo'
)
->
where
(
$where
)
->
select
(
'tax_title'
,
'tax_id'
)
->
get
();
...
@@ -606,25 +606,26 @@ class ApiController extends Controller
...
@@ -606,25 +606,26 @@ class ApiController extends Controller
if
(
!
$com_id
)
$this
->
Export
(
-
1
,
'未填写当前发票/公司'
);
if
(
!
$com_id
)
$this
->
Export
(
-
1
,
'未填写当前发票/公司'
);
$com_
name
=
DB
::
connection
(
'order'
)
->
table
(
'lie_invoice_company'
)
->
where
(
'id'
,
$com_id
)
->
value
(
'com_name'
);
$com_
info
=
DB
::
connection
(
'crm'
)
->
table
(
'invoice_company'
)
->
where
(
'id'
,
$com_id
)
->
first
(
);
if
(
!
$com_
name
)
$this
->
Export
(
-
1
,
'当前公司不存在'
);
if
(
!
$com_
info
)
$this
->
Export
(
-
1
,
'当前公司不存在'
);
$map
=
[];
$map
=
[];
$map
[
'tax_title'
]
=
$com_name
;
$map
[
'tax_title'
]
=
$com_
info
->
com_
name
;
$map
[
'user_id'
]
=
$user_id
;
$map
[
'user_id'
]
=
$user_id
;
$map
[
'inv_type'
]
=
$invoice_type
;
$map
[
'inv_type'
]
=
$invoice_type
;
$invoice
=
DB
::
connection
(
'order'
)
->
table
(
'lie_taxinfo'
)
->
where
(
$map
)
->
first
();
$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_id'
]
=
isset
(
$invoice
)
?
$invoice
->
tax_id
:
0
;
$tax_info
[
'tax_title'
]
=
isset
(
$invoice
)
?
$invoice
->
tax_title
:
''
;
$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
);
// 增值税普票
if
(
$invoice_type
==
4
)
$this
->
Export
(
0
,
''
,
$tax_info
);
// 增值税普票
$tax_info
[
'com_addr'
]
=
isset
(
$
invoice
)
?
$invoice
->
company_address
:
''
;
$tax_info
[
'com_addr'
]
=
isset
(
$
com_info
)
?
$com_info
->
com_addr
:
''
;
$tax_info
[
'com_tel'
]
=
isset
(
$
invoice
)
?
$invoice
->
company_phone
:
''
;
$tax_info
[
'com_tel'
]
=
isset
(
$
com_info
)
?
$com_info
->
com_tel
:
''
;
$tax_info
[
'com_bank'
]
=
isset
(
$
invoice
)
?
$invoice
->
bank_name
:
''
;
$tax_info
[
'com_bank'
]
=
isset
(
$
com_info
)
?
$com_info
->
com_bank
:
''
;
$tax_info
[
'com_bank_num'
]
=
isset
(
$
invoice
)
?
$invoice
->
bank_account
:
''
;
$tax_info
[
'com_bank_num'
]
=
isset
(
$
com_info
)
?
$com_info
->
com_bank_num
:
''
;
$tax_info
[
'consignee'
]
=
isset
(
$invoice
)
?
$invoice
->
consignee
:
''
;
$tax_info
[
'consignee'
]
=
isset
(
$invoice
)
?
$invoice
->
consignee
:
''
;
$tax_info
[
'consignee_phone'
]
=
isset
(
$invoice
)
?
$invoice
->
consignee_phone
:
''
;
$tax_info
[
'consignee_phone'
]
=
isset
(
$invoice
)
?
$invoice
->
consignee_phone
:
''
;
$tax_info
[
'consignee_addr'
]
=
isset
(
$invoice
)
?
$invoice
->
consignee_address
:
''
;
$tax_info
[
'consignee_addr'
]
=
isset
(
$invoice
)
?
$invoice
->
consignee_address
:
''
;
...
...
public/js/add_inquiry_order.js
View file @
4693c3ea
...
@@ -83,6 +83,7 @@ layui.config({
...
@@ -83,6 +83,7 @@ layui.config({
}
}
$
(
'.inv_com_id'
).
val
(
resp
.
data
.
com_id
);
$
(
'.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
);
$
(
'.user_id'
).
val
(
resp
.
data
.
user_id
);
$
(
'.account'
).
val
(
resp
.
data
.
account
);
$
(
'.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