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
7711c919
authored
Apr 08, 2021
by
朱继来
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
调整询价下单页面
parent
6db8641c
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
227 additions
and
82 deletions
app/Http/Controllers/AddOrderController.php
app/Http/routes.php
public/js/add_inquiry_order.js
resources/views/addInquiryOrder/content.blade.php
resources/views/addInquiryOrder/goodsInfo.blade.php
app/Http/Controllers/AddOrderController.php
View file @
7711c919
...
...
@@ -106,6 +106,9 @@ Class AddOrderController extends Controller
// $info['company'] = (new CmsModel())->getCompany(); // 获取公司组织
$info
[
'report_ids'
]
=
$request
->
input
(
'report_ids'
,
''
);
// 询价系统销售报价ID
$perm
=
new
PermController
;
$info
[
'buyers'
]
=
$perm
->
getUserByDepartmentId
(
8
,
0
);
// 获取采购部人员
return
view
(
'addInquiryOrder'
,
$info
);
}
...
...
@@ -428,6 +431,16 @@ Class AddOrderController extends Controller
if
(
$data
[
'is_new'
])
{
// 新版下单页面,layui格式返回
$data
=
isset
(
$response
[
'data'
][
'list'
])
?
$response
[
'data'
][
'list'
]
:
[];
$perm
=
new
PermController
;
$buyers
=
$perm
->
getUserByDepartmentId
(
8
,
0
);
// 获取采购部人员
if
(
!
empty
(
$data
))
{
foreach
(
$data
as
&
$v
)
{
$v
[
'buyerSelect'
]
=
$this
->
getPurchaseSelect
(
$buyers
,
$v
[
'buyer_id'
]);
}
}
return
[
'code'
=>
$response
[
'err_code'
],
'msg'
=>
$response
[
'err_msg'
],
'data'
=>
$data
,
'count'
=>
count
(
$data
)];
}
...
...
@@ -439,6 +452,21 @@ Class AddOrderController extends Controller
}
}
// 生成采购下拉列表
public
function
getPurchaseSelect
(
$buyers
,
$buyer_id
)
{
$option
=
'<option vlaue=""></option>'
;
foreach
(
$buyers
as
$k
=>
$v
)
{
if
(
$v
->
userId
==
$buyer_id
)
{
$option
.=
'<option vlaue="'
.
$v
->
userId
.
'" selected>'
.
$v
->
name
.
'</option>'
;
}
else
{
$option
.=
'<option vlaue="'
.
$v
->
userId
.
'">'
.
$v
->
name
.
'</option>'
;
}
}
return
$option
;
}
// 获取订单赠品信息
public
function
getOrderGift
(
Request
$request
)
{
...
...
@@ -469,7 +497,7 @@ Class AddOrderController extends Controller
$data
[
'k1'
]
=
time
();
$data
[
'k2'
]
=
md5
(
md5
(
$data
[
'k1'
])
.
'fh6y5t4rr351d2c3bryi'
);
if
(
$type
==
3
)
{
// 联营批量添加
if
(
$type
==
3
||
$type
==
4
)
{
// 3-联营批量添加、4-询价单
$url
=
Config
(
'website.api_domain'
)
.
'cart/changeNumForJoint'
;
}
else
{
$url
=
Config
(
'website.api_domain'
)
.
'cart/changeNumByOrderSystem'
;
...
...
@@ -485,6 +513,47 @@ Class AddOrderController extends Controller
}
}
// 修改购物车字段
public
function
changeField
(
Request
$request
)
{
if
(
$request
->
isMethod
(
'post'
))
{
$uid
=
$request
->
input
(
'uid'
);
$cart_id
=
$request
->
input
(
'cart_id'
);
$goods_price
=
$request
->
input
(
'goods_price'
,
0
);
$delivery_time
=
$request
->
input
(
'delivery_time'
,
''
);
$batch
=
$request
->
input
(
'batch'
,
''
);
$buyer
=
$request
->
input
(
'buyer'
,
0
);
$data
=
[];
if
(
!
$delivery_time
)
{
// 交期不存在
$goods_price
&&
$data
[
'goods_price'
]
=
$goods_price
;
$batch
&&
$data
[
'batch'
]
=
$batch
;
if
(
$buyer
)
{
$CmsModel
=
new
CmsModel
;
$data
[
'buyer_id'
]
=
$CmsModel
->
getSaleId
(
$buyer
);
}
}
else
{
// 修改交期
$goods_data
=
DB
::
connection
(
'order'
)
->
table
(
'lie_shopping_cart'
)
->
where
(
'cart_id'
,
$cart_id
)
->
value
(
'goods_data'
);
if
(
!
$goods_data
)
{
$goods_data
[
'delivery_time'
]
=
$delivery_time
;
}
else
{
$goods_data
=
json_decode
(
$goods_data
,
true
);
$goods_data
[
'delivery_time'
]
=
$delivery_time
;
}
$data
[
'goods_data'
]
=
json_encode
(
$goods_data
);
}
$res
=
DB
::
connection
(
'order'
)
->
table
(
'lie_shopping_cart'
)
->
where
(
'cart_id'
,
$cart_id
)
->
update
(
$data
);
if
(
$res
===
false
)
return
[
'errcode'
=>
-
1
,
'errmsg'
=>
'修改失败'
];
return
[
'errcode'
=>
0
,
'errmsg'
=>
'修改成功'
];
}
}
// 删除购物车商品
public
function
deleteGoods
(
Request
$request
)
{
...
...
app/Http/routes.php
View file @
7711c919
...
...
@@ -106,6 +106,7 @@ Route::group(['middleware' => 'web'], function () {
Route
::
post
(
'/ajax/cartList'
,
'AddOrderController@cartList'
);
Route
::
post
(
'/ajax/getOrderGift'
,
'AddOrderController@getOrderGift'
);
Route
::
post
(
'/ajax/changeNum'
,
'AddOrderController@changeNum'
);
Route
::
post
(
'/ajax/changeField'
,
'AddOrderController@changeField'
);
Route
::
post
(
'/ajax/deleteGoods'
,
'AddOrderController@deleteGoods'
);
Route
::
post
(
'/ajax/create'
,
'AddOrderController@create'
);
Route
::
get
(
'/addorder/success'
,
'AddOrderController@success'
);
...
...
public/js/add_inquiry_order.js
View file @
7711c919
...
...
@@ -731,10 +731,10 @@ layui.config({
return
false
;
}
var
is_dgk
=
false
;
if
(
$
(
'.client-info'
).
css
(
'display'
)
==
'block'
)
{
is_dgk
=
true
;
}
//
var is_dgk = false;
//
if ($('.client-info').css('display') == 'block') {
//
is_dgk = true;
//
}
if
(
cart_ids
.
length
==
0
)
{
layer
.
msg
(
'请先添加商品'
);
...
...
@@ -756,54 +756,54 @@ layui.config({
cart_ids
:
cart_ids
,
}
if
(
is_dgk
)
{
// 联营包含digikey商品,则填写终端资料
var
customer_cn
=
$
(
'.customer_cn'
).
val
();
var
customer_en
=
$
(
'.customer_en'
).
val
();
var
customer_type
=
$
(
'.customer_type'
).
val
();
var
product_use_classone_sn
=
$
(
'.product_use_classone_sn'
).
val
();
var
product_use_classtwo_sn
=
$
(
'.product_use_classtwo_sn'
).
val
();
var
customer_website
=
$
(
'.customer_website'
).
val
();
//
if (is_dgk) { // 联营包含digikey商品,则填写终端资料
//
var customer_cn = $('.customer_cn').val();
//
var customer_en = $('.customer_en').val();
//
var customer_type = $('.customer_type').val();
//
var product_use_classone_sn = $('.product_use_classone_sn').val();
//
var product_use_classtwo_sn = $('.product_use_classtwo_sn').val();
//
var customer_website = $('.customer_website').val();
if
(
!
customer_cn
)
{
layer
.
msg
(
'请填写终端中文名称'
);
return
false
;
}
//
if (!customer_cn) {
//
layer.msg('请填写终端中文名称');
//
return false;
//
}
if
(
customer_type
==
''
)
{
layer
.
msg
(
'请选择客户类型'
);
return
false
;
}
//
if (customer_type == '') {
//
layer.msg('请选择客户类型');
//
return false;
//
}
if
(
customer_type
==
1
)
{
// 若客户类型为终端,则外文名称,产品用途和网址为必填
if
(
!
customer_en
)
{
layer
.
msg
(
'请填写终端英文名称'
);
return
false
;
}
//
if (customer_type == 1) { // 若客户类型为终端,则外文名称,产品用途和网址为必填
//
if (!customer_en) {
//
layer.msg('请填写终端英文名称');
//
return false;
//
}
var
en_reg
=
/^
[
a-zA-Z0-9
\.\-\s\,\(\)]
+$/
;
if
(
!
en_reg
.
test
(
customer_en
)){
layer
.
msg
(
'请填写全英文名称'
);
return
false
;
}
//
var en_reg = /^[a-zA-Z0-9\.\-\s\,\(\)]+$/;
//
if(!en_reg.test(customer_en)){
//
layer.msg('请填写全英文名称');
//
return false;
//
}
if
(
product_use_classone_sn
==
''
)
{
layer
.
msg
(
'请选择产品用途一级分类'
);
return
false
;
}
//
if (product_use_classone_sn == '') {
//
layer.msg('请选择产品用途一级分类');
//
return false;
//
}
if
(
!
customer_website
)
{
layer
.
msg
(
'请填写客户网址'
);
return
false
;
}
}
//
if (!customer_website) {
//
layer.msg('请填写客户网址');
//
return false;
//
}
//
}
datax
.
customer_cn
=
customer_cn
;
datax
.
customer_en
=
customer_en
;
datax
.
customer_type
=
customer_type
;
datax
.
product_use_classone_sn
=
product_use_classone_sn
;
datax
.
product_use_classtwo_sn
=
product_use_classtwo_sn
;
datax
.
customer_website
=
customer_website
;
}
//
datax.customer_cn = customer_cn;
//
datax.customer_en = customer_en;
//
datax.customer_type = customer_type;
//
datax.product_use_classone_sn = product_use_classone_sn;
//
datax.product_use_classtwo_sn = product_use_classtwo_sn;
//
datax.customer_website = customer_website;
//
}
$
.
ajax
({
type
:
"POST"
,
...
...
@@ -864,14 +864,13 @@ layui.config({
,{
field
:
'goods_id'
,
title
:
'SKUID'
,
width
:
180
}
,{
field
:
'goods_name'
,
title
:
'商品名称'
,
width
:
200
}
,{
field
:
'brand_name'
,
title
:
'制造商'
,
width
:
200
}
,{
field
:
'mpl'
,
title
:
'倍数'
}
,{
field
:
'goods_number'
,
title
:
'采购数量'
,
edit
:
'text'
,
style
:
'backgroud: #ccc'
,
width
:
100
}
,{
field
:
'goods_price'
,
title
:
'采购单价'
,
width
:
120
}
,{
field
:
'goods_amount_format'
,
title
:
'小计'
}
,{
field
:
'delivery_time'
,
title
:
'货期'
}
,{
field
:
'supplier_name'
,
title
:
'供应商'
}
,{
field
:
'buyer_id'
,
title
:
'采购员'
,
templet
:
'#buyer_id'
}
,{
field
:
'batch'
,
title
:
'批次'
}
,{
field
:
'goods_number'
,
title
:
'采购数量'
,
edit
:
'text'
,
style
:
'cursor: pointer;'
,
width
:
120
}
,{
field
:
'goods_price'
,
title
:
'采购单价'
,
edit
:
'text'
,
style
:
'cursor: pointer;'
,
width
:
120
}
,{
field
:
'goods_amount_format'
,
title
:
'小计'
}
,{
field
:
'delivery_time'
,
title
:
'货期'
,
edit
:
'text'
,
style
:
'cursor: pointer;'
}
,{
field
:
'buyer_id'
,
title
:
'采购员'
,
templet
:
'#t_buyer_id'
}
,{
field
:
'batch'
,
title
:
'批次'
,
edit
:
'text'
,
style
:
'cursor: pointer;'
}
,{
title
:
'操作'
,
align
:
'center'
,
fixed
:
'right'
,
toolbar
:
'#list_action'
,
width
:
80
}
]]
// ,limit: 10
...
...
@@ -884,10 +883,11 @@ layui.config({
}
$
(
'.carts-info'
).
show
();
// 显示商品table
$
(
".layui-table-body, .layui-table-box, .layui-table-cell"
).
css
(
'overflow'
,
'visible'
);
// 下拉显示
cart_ids
=
[];
for
(
i
=
0
;
i
<
count
;
i
++
){
for
(
var
i
=
0
;
i
<
count
;
i
++
){
cart_ids
.
push
(
res
.
data
[
i
].
cart_id
);
}
...
...
@@ -900,8 +900,36 @@ layui.config({
orderConfirm
(
user_id
,
address_id
,
cart_ids
,
user_coupon_id
);
// 确认订单信息
}
});
form
.
render
(
'select'
);
};
//下拉框监听事件
form
.
on
(
'select(buyer_id)'
,
function
(
data
)
{
var
cart_id
=
$
(
'#buyer_id'
).
data
(
'cid'
);
var
value
=
data
.
value
;
var
datax
=
{
cart_id
:
cart_id
,
buyer
:
value
,
};
$
.
ajax
({
type
:
"POST"
,
url
:
'/ajax/changeField'
,
data
:
datax
,
dataType
:
"json"
,
success
:
function
(
resp
){
if
(
resp
.
errcode
==
0
)
{
layer
.
msg
(
resp
.
errmsg
)
return
false
;
}
layer
.
msg
(
resp
.
errmsg
);
},
})
});
// 检查自营商品倍数
function
checkSelfMpl
(
user_id
,
data
,
count
)
{
...
...
@@ -980,47 +1008,83 @@ layui.config({
})
}
//
修改数量
//
编辑
table
.
on
(
'edit(list)'
,
function
(
obj
){
//注:edit是固定事件名,test是table原始容器的属性 lay-filter="对应的值"
var
old
=
$
(
this
).
prev
().
text
();
// 原数量
var
num
=
obj
.
value
;
// 修改后数量
var
value
=
obj
.
value
;
// 编辑后值
var
cart_id
=
obj
.
data
.
cart_id
;
var
user_id
=
$
(
'.user_id'
).
val
()
?
$
(
'.user_id'
).
val
()
:
0
;
var
url
=
''
;
if
(
!
num
)
{
var
datax
=
{
uid
:
user_id
,
cart_id
:
cart_id
,
};
console
.
log
(
old
)
switch
(
obj
.
field
)
{
case
'goods_number'
:
var
min_buy
=
obj
.
data
.
min_buy
;
var
type
=
obj
.
data
.
type
;
// 商品添加类型
if
(
!
value
)
{
layer
.
msg
(
'数量不能为0或空'
);
return
false
;
}
var
min_buy
=
obj
.
data
.
min_buy
;
var
cart_id
=
obj
.
data
.
cart_id
;
var
type
=
obj
.
data
.
type
;
// 商品添加类型
var
user_id
=
$
(
'.user_id'
).
val
()
?
$
(
'.user_id'
).
val
()
:
0
;
var
delivery_place
=
1
;
// 1.大陆,2.香港 自营默认是大陆
if
(
num
<
min_buy
)
{
self
.
val
(
min_buy
);
if
(
value
<
min_buy
)
{
layer
.
msg
(
'购买数量低于最小起订量,默认调整为最小起订量'
);
num
=
min_buy
;
value
=
min_buy
;
}
var
curr_goods_type
=
obj
.
data
.
goods_type
;
var
joint_goods_type
=
[
1
,
2
];
// 商品联营类型
if
(
joint_goods_type
.
indexOf
(
curr_goods_type
)
!=
-
1
)
{
delivery_place
=
$
(
'.delivery_place'
).
val
();
}
else
{
// 自营数量需要结合倍数
if
(
joint_goods_type
.
indexOf
(
curr_goods_type
)
==
-
1
)
{
// 自营数量需要结合倍数
var
mpl
=
Number
(
obj
.
data
.
mpl
);
// 倍数
num
=
Math
.
ceil
(
num
/
mpl
)
*
mpl
;
value
=
Math
.
ceil
(
value
/
mpl
)
*
mpl
;
}
datax
.
type
=
type
;
datax
.
num
=
value
;
url
=
'/ajax/changeNum'
;
break
;
case
'goods_price'
:
if
(
!
value
)
{
layer
.
msg
(
'单价不能为0或空'
);
return
false
;
}
datax
.
goods_price
=
value
;
url
=
'/ajax/changeField'
;
break
;
case
'delivery_time'
:
// 货期
datax
.
delivery_time
=
value
;
url
=
'/ajax/changeField'
;
break
;
case
'batch'
:
// 批次
datax
.
batch
=
value
;
url
=
'/ajax/changeField'
;
break
;
}
$
.
ajax
({
type
:
"POST"
,
url
:
'/ajax/changeNum'
,
data
:
{
uid
:
user_id
,
num
:
num
,
cart_id
:
cart_id
,
type
:
type
}
,
url
:
url
,
data
:
datax
,
dataType
:
"json"
,
success
:
function
(
resp
){
if
(
resp
.
errcode
==
0
)
{
layer
.
msg
(
resp
.
errmsg
)
if
(
obj
.
field
==
'goods_number'
||
obj
.
field
==
'goods_price'
)
{
renderTable
();
}
return
false
;
}
...
...
resources/views/addInquiryOrder/content.blade.php
View file @
7711c919
...
...
@@ -38,12 +38,12 @@
</div>
</div>
<div
class=
"layui-colla-item client-info"
>
<
!-- <
div class="layui-colla-item client-info">
<h2 class="layui-colla-title">终端客户信息</h2>
<div class="layui-colla-content layui-show">
@include('addInquiryOrder.dgkInfo')
</div>
</div>
</div>
-->
<div
class=
"layui-colla-item order-info"
>
<h2
class=
"layui-colla-title"
>
订单信息
</h2>
...
...
resources/views/addInquiryOrder/goodsInfo.blade.php
View file @
7711c919
...
...
@@ -102,14 +102,25 @@
<table
id=
"list"
lay-filter=
"list"
></table>
<textarea
name=
"remark"
id=
"remark"
class=
"layui-textarea"
placeholder=
"填写订单备注信息"
></textarea>
</div>
<script
type=
"text/html"
id=
"buyer_id"
>
@{{
#
if
(
d
.
buyer_id
!=
0
)
{
}}
@{{
d
.
buyer_id
}}
@{{
#
}
}}
</script>
<script>
var
buyers
=
eval
(
'{!! json_encode($buyers) !!}'
);
</script>
<script
type=
"text/html"
id=
"list_action"
>
<style>
td
.layui-form-select
{
margin-top
:
-10px
;
margin-left
:
-15px
;
margin-right
:
-15px
;
}
</style>
<script
type=
"text/html"
id=
"t_buyer_id"
>
<
select
name
=
"buyer_id"
id
=
"buyer_id"
lay
-
filter
=
"buyer_id"
data
-
cid
=
"@{{ d.cart_id }}"
>
@{{
d
.
buyerSelect
}}
<
/select>
</script>
<script
type=
"text/html"
id=
"list_action"
>
<
a
class
=
"btn btn-xs btn-danger"
lay
-
event
=
"del"
>
删除
<
/a>
</script>
</div>
</script>
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