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
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
23 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
$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
:
''
;
...
...
public/js/add_inquiry_order.js
View file @
4693c3ea
...
...
@@ -83,6 +83,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