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
33e5e809
authored
Feb 18, 2022
by
朱继来
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
下单添加发票抬头类型判断
parent
c8e7a192
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
77 additions
and
32 deletions
app/Http/Controllers/AddOrderController.php
app/Model/InvoiceCompanyModel.php
public/js/add_order.js
app/Http/Controllers/AddOrderController.php
View file @
33e5e809
...
@@ -259,7 +259,6 @@ Class AddOrderController extends Controller
...
@@ -259,7 +259,6 @@ Class AddOrderController extends Controller
// 选择发票信息
// 选择发票信息
public
function
selectInv
(
Request
$request
)
public
function
selectInv
(
Request
$request
)
{
{
if
(
$request
->
isMethod
(
'post'
))
{
$tax_id
=
$request
->
input
(
'tax_id'
);
$tax_id
=
$request
->
input
(
'tax_id'
);
$invoice
=
TaxInfoModel
::
where
(
'tax_id'
,
$tax_id
)
->
first
();
$invoice
=
TaxInfoModel
::
where
(
'tax_id'
,
$tax_id
)
->
first
();
...
@@ -273,17 +272,20 @@ Class AddOrderController extends Controller
...
@@ -273,17 +272,20 @@ Class AddOrderController extends Controller
$company_info
=
InvoiceCompanyModel
::
where
(
'com_name'
,
$invoice
->
tax_title
)
->
first
();
$company_info
=
InvoiceCompanyModel
::
where
(
'com_name'
,
$invoice
->
tax_title
)
->
first
();
if
(
$company_info
)
{
if
(
$company_info
)
{
if
(
$company_info
[
'company_category'
]
==
3
)
return
[
'errcode'
=>
1
,
'errmsg'
=>
'该客户为黑名单客户,禁止下单!'
];
$invoice
->
customer_en
=
$company_info
->
customer_en
;
$invoice
->
customer_en
=
$company_info
->
customer_en
;
$invoice
->
customer_type
=
$company_info
->
customer_type
;
$invoice
->
customer_type
=
$company_info
->
customer_type
;
$invoice
->
product_use_classone_sn
=
$company_info
->
product_use_classone_sn
;
$invoice
->
product_use_classone_sn
=
$company_info
->
product_use_classone_sn
;
$invoice
->
product_use_classtwo_sn
=
$company_info
->
product_use_classtwo_sn
;
$invoice
->
product_use_classtwo_sn
=
$company_info
->
product_use_classtwo_sn
;
$invoice
->
customer_website
=
$company_info
->
customer_website
;
$invoice
->
customer_website
=
$company_info
->
customer_website
;
if
(
$company_info
[
'company_category'
]
==
4
)
return
[
'errcode'
=>
2
,
'errmsg'
=>
'该客户为实体名单客户,是否继续下单!'
,
'data'
=>
$invoice
];
}
}
}
}
return
[
'errcode'
=>
0
,
'errmsg'
=>
''
,
'data'
=>
$invoice
];
return
[
'errcode'
=>
0
,
'errmsg'
=>
''
,
'data'
=>
$invoice
];
}
}
}
// 根据发票类型选择发票信息
// 根据发票类型选择发票信息
public
function
selectInvType
(
Request
$request
)
public
function
selectInvType
(
Request
$request
)
...
@@ -695,7 +697,6 @@ Class AddOrderController extends Controller
...
@@ -695,7 +697,6 @@ Class AddOrderController extends Controller
// 提交订单
// 提交订单
public
function
create
(
Request
$request
)
public
function
create
(
Request
$request
)
{
{
if
(
$request
->
isMethod
(
'post'
))
{
$data
[
'type'
]
=
$request
->
input
(
'type'
);
$data
[
'type'
]
=
$request
->
input
(
'type'
);
$data
[
'inv_com_id'
]
=
$request
->
input
(
'inv_com_id'
,
0
);
$data
[
'inv_com_id'
]
=
$request
->
input
(
'inv_com_id'
,
0
);
$data
[
'uid'
]
=
$request
->
input
(
'uid'
);
$data
[
'uid'
]
=
$request
->
input
(
'uid'
);
...
@@ -763,7 +764,6 @@ Class AddOrderController extends Controller
...
@@ -763,7 +764,6 @@ Class AddOrderController extends Controller
return
[
'errcode'
=>
$response
[
'err_code'
],
'errmsg'
=>
$response
[
'err_msg'
],
'data'
=>
[
'order_id'
=>
$response
[
'data'
],
'type'
=>
$data
[
'type'
]]];
return
[
'errcode'
=>
$response
[
'err_code'
],
'errmsg'
=>
$response
[
'err_msg'
],
'data'
=>
[
'order_id'
=>
$response
[
'data'
],
'type'
=>
$data
[
'type'
]]];
}
}
}
// 提交订单成功页面
// 提交订单成功页面
public
function
success
(
Request
$request
)
public
function
success
(
Request
$request
)
...
...
app/Model/InvoiceCompanyModel.php
View file @
33e5e809
...
@@ -8,8 +8,8 @@ use DB;
...
@@ -8,8 +8,8 @@ use DB;
class
InvoiceCompanyModel
extends
Model
class
InvoiceCompanyModel
extends
Model
{
{
protected
$connection
=
'
web
'
;
protected
$connection
=
'
crm
'
;
protected
$table
=
'
lie_
invoice_company'
;
protected
$table
=
'invoice_company'
;
protected
$primaryKey
=
'id'
;
protected
$primaryKey
=
'id'
;
public
$timestamps
=
false
;
public
$timestamps
=
false
;
...
...
public/js/add_order.js
View file @
33e5e809
...
@@ -259,8 +259,31 @@
...
@@ -259,8 +259,31 @@
data
:
{
tax_id
:
tax_id
},
data
:
{
tax_id
:
tax_id
},
dataType
:
'json'
,
dataType
:
'json'
,
success
:
function
(
resp
)
{
success
:
function
(
resp
)
{
if
(
resp
.
errcode
==
0
)
{
if
(
resp
.
errcode
==
1
)
{
var
data
=
resp
.
data
;
layer
.
alert
(
resp
.
errmsg
);
return
false
;
}
if
(
resp
.
errcode
==
2
)
{
layer
.
confirm
(
resp
.
errmsg
,
function
(
index
)
{
addInvoiceInfo
(
resp
.
data
)
layer
.
close
(
index
)
});
return
false
;
}
addInvoiceInfo
(
resp
.
data
)
}
})
}
else
{
$
(
'.invoice-content'
).
hide
();
$
(
'.tax_id'
).
val
(
''
);
}
})
// 添加发票信息
function
addInvoiceInfo
(
data
)
{
var
inv_type_val
=
''
;
var
inv_type_val
=
''
;
$
(
'.invoice-content'
).
show
();
$
(
'.invoice-content'
).
show
();
...
@@ -305,15 +328,7 @@
...
@@ -305,15 +328,7 @@
layer
.
msg
(
'购物车中存在digikey商品,请选择增值税普票或专票'
);
layer
.
msg
(
'购物车中存在digikey商品,请选择增值税普票或专票'
);
}
}
}
}
}
}
}
})
}
else
{
$
(
'.invoice-content'
).
hide
();
$
(
'.tax_id'
).
val
(
''
);
}
})
// 获取SKU信息
// 获取SKU信息
$
(
'.get-sku'
).
click
(
function
()
{
$
(
'.get-sku'
).
click
(
function
()
{
...
@@ -762,11 +777,40 @@
...
@@ -762,11 +777,40 @@
// 提交订单
// 提交订单
// $('.submit-order').on('click', function() {
// $('.submit-order').on('click', function() {
$
(
'.submit-order'
).
off
().
on
(
'click'
,
function
()
{
$
(
'.submit-order'
).
off
().
on
(
'click'
,
function
()
{
var
self
=
$
(
this
);
var
tax_id
=
$
(
'.tax_id'
).
val
();
if
(
tax_id
)
{
$
.
ajax
({
url
:
'/ajax/selectInv'
,
type
:
'post'
,
data
:
{
tax_id
:
tax_id
},
dataType
:
'json'
,
success
:
function
(
resp
)
{
if
(
resp
.
errcode
==
1
)
{
layer
.
alert
(
resp
.
errmsg
);
return
false
;
}
if
(
resp
.
errcode
==
2
)
{
layer
.
confirm
(
resp
.
errmsg
,
function
(
index
)
{
createOrder
();
layer
.
close
(
index
)
});
return
false
;
}
}
})
}
})
function
createOrder
()
{
var
shipping_type
=
$
(
'#shipping_type'
).
val
();
// 配送方式
var
shipping_type
=
$
(
'#shipping_type'
).
val
();
// 配送方式
var
address_id
=
$
(
'input[name=address_id]'
).
val
();
var
address_id
=
$
(
'input[name=address_id]'
).
val
();
var
type
=
self
.
data
(
'type'
);
// 1-联营线上,2-自营线上,3-自营线下,4-自营其他业务
var
type
=
$
(
'.submit-order'
)
.
data
(
'type'
);
// 1-联营线上,2-自营线上,3-自营线下,4-自营其他业务
var
cart_ids
=
[];
var
cart_ids
=
[];
var
user_id
=
0
;
var
user_id
=
0
;
var
remark
=
$
(
'#remark'
).
val
();
// 订单备注
var
remark
=
$
(
'#remark'
).
val
();
// 订单备注
...
@@ -780,7 +824,7 @@
...
@@ -780,7 +824,7 @@
var
is_dgk
=
false
;
var
is_dgk
=
false
;
$
(
'.shop-table tbody tr'
).
each
(
function
()
{
$
(
'.shop-table tbody tr'
).
each
(
function
()
{
var
cid
=
$
(
this
).
data
(
'cid'
);
var
cid
=
$
(
this
).
data
(
'cid'
);
cart_ids
.
push
(
cid
);
cart_ids
.
push
(
cid
);
...
@@ -846,7 +890,7 @@
...
@@ -846,7 +890,7 @@
return
false
;
return
false
;
}
}
if
((
typeof
(
inv_type
)
==
'undefined'
||
inv_type
!=
''
)
&&
!
tax_id
)
{
if
((
typeof
(
inv_type
)
==
'undefined'
||
inv_type
!=
''
)
&&
!
tax_id
)
{
layer
.
msg
(
'请选择发票信息'
);
layer
.
msg
(
'请选择发票信息'
);
return
false
;
return
false
;
}
}
...
@@ -923,11 +967,11 @@
...
@@ -923,11 +967,11 @@
var
sale_type
=
$
(
'#sale_type'
).
val
();
var
sale_type
=
$
(
'#sale_type'
).
val
();
var
cart_info
=
[];
var
cart_info
=
[];
$
(
'.shop-table tbody tr'
).
each
(
function
()
{
$
(
'.shop-table tbody tr'
).
each
(
function
()
{
var
gid
=
$
(
this
).
find
(
'.goods_id'
).
text
();
var
gid
=
$
(
this
).
find
(
'.goods_id'
).
text
();
var
num
=
$
(
this
).
find
(
'.goods_num'
).
val
();
var
num
=
$
(
this
).
find
(
'.goods_num'
).
val
();
cart_info
.
push
({
'gid'
:
gid
,
'num'
:
num
});
cart_info
.
push
({
'gid'
:
gid
,
'num'
:
num
});
})
})
datax
.
role
=
role
;
// 自营线上下单添加角色
datax
.
role
=
role
;
// 自营线上下单添加角色
...
@@ -935,17 +979,17 @@
...
@@ -935,17 +979,17 @@
$
.
ajax
({
$
.
ajax
({
type
:
"POST"
,
type
:
"POST"
,
url
:
'/ajax/checkStock'
,
url
:
'/ajax/checkStock'
,
data
:
{
cart_info
:
JSON
.
stringify
(
cart_info
),
sale_type
:
sale_type
},
data
:
{
cart_info
:
JSON
.
stringify
(
cart_info
),
sale_type
:
sale_type
},
dataType
:
"json"
,
dataType
:
"json"
,
async
:
false
,
async
:
false
,
success
:
function
(
resp
)
{
success
:
function
(
resp
)
{
if
(
resp
.
errcode
==
-
1
)
{
if
(
resp
.
errcode
==
-
1
)
{
var
data
=
eval
(
resp
.
data
);
var
data
=
eval
(
resp
.
data
);
var
content
=
'<p>'
+
resp
.
errmsg
+
'</p>'
;
var
content
=
'<p>'
+
resp
.
errmsg
+
'</p>'
;
submit
=
false
;
submit
=
false
;
for
(
var
i
=
0
;
i
<
data
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
data
.
length
;
i
++
)
{
content
+=
'<p><span>'
+
(
i
+
1
)
+
'、</span>'
+
data
[
i
][
'goods_name'
]
+
',可用库存:'
+
data
[
i
][
'stock'
]
+
'</p>'
;
content
+=
'<p><span>'
+
(
i
+
1
)
+
'、</span>'
+
data
[
i
][
'goods_name'
]
+
',可用库存:'
+
data
[
i
][
'stock'
]
+
'</p>'
;
}
}
// 弹出提示
// 弹出提示
...
@@ -970,17 +1014,17 @@
...
@@ -970,17 +1014,17 @@
url
:
'/ajax/create'
,
url
:
'/ajax/create'
,
data
:
datax
,
data
:
datax
,
dataType
:
"json"
,
dataType
:
"json"
,
success
:
function
(
resp
)
{
success
:
function
(
resp
)
{
if
(
resp
.
errcode
==
0
)
{
if
(
resp
.
errcode
==
0
)
{
layer
.
msg
(
resp
.
errmsg
);
layer
.
msg
(
resp
.
errmsg
);
location
.
href
=
'/addorder/success?order_id='
+
resp
.
data
.
order_id
+
'&type='
+
resp
.
data
.
type
;
location
.
href
=
'/addorder/success?order_id='
+
resp
.
data
.
order_id
+
'&type='
+
resp
.
data
.
type
;
return
false
;
return
false
;
}
else
if
(
resp
.
errcode
==
21024
)
{
}
else
if
(
resp
.
errcode
==
21024
)
{
layer
.
alert
(
'该用户已进入公司黑名单,具体请联系吴承义,同时订单无法提交'
);
layer
.
alert
(
'该用户已进入公司黑名单,具体请联系吴承义,同时订单无法提交'
);
return
false
;
return
false
;
}
else
if
(
resp
.
errcode
==
21030
)
{
}
else
if
(
resp
.
errcode
==
21030
)
{
layer
.
alert
(
resp
.
errmsg
,
function
()
{
layer
.
alert
(
resp
.
errmsg
,
function
()
{
var
delivery_place
=
$
(
'.delivery_place'
).
val
();
var
delivery_place
=
$
(
'.delivery_place'
).
val
();
loading
.
lists
(
user_id
,
goods_type
,
is_online
,
delivery_place
);
// 加载购物车列表
loading
.
lists
(
user_id
,
goods_type
,
is_online
,
delivery_place
);
// 加载购物车列表
...
@@ -994,12 +1038,13 @@
...
@@ -994,12 +1038,13 @@
},
},
})
})
layer
.
msg
(
'订单生成中...'
,
{
icon
:
16
,
time
:
0
,
shade
:
0.3
});
layer
.
msg
(
'订单生成中...'
,
{
icon
:
16
,
time
:
0
,
shade
:
0.3
});
}
}
}
else
{
}
else
{
layer
.
msg
(
'请先添加商品'
);
layer
.
msg
(
'请先添加商品'
);
}
}
})
}
// 发货方式
// 发货方式
$
(
'.zy_delivery_type'
).
change
(
function
()
{
$
(
'.zy_delivery_type'
).
change
(
function
()
{
...
...
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