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
0540a7fb
authored
Jun 16, 2020
by
孙龙
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
up
parent
5b331f1e
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
155 additions
and
32 deletions
app/Exceptions/BomException.php
app/Http/Controllers/BomApiController.php
app/Model/Bom/BomItemMatchModel.php
app/Model/Bom/BomItemModel.php
app/Services/Bom/BomService.php
config/website.php
public/js/web/BomView.js
resources/views/web/BomView.blade.php
app/Exceptions/BomException.php
0 → 100644
View file @
0540a7fb
<?php
namespace
App\Exceptions
;
class
BomException
extends
\Exception
{
}
\ No newline at end of file
app/Http/Controllers/BomApiController.php
View file @
0540a7fb
...
...
@@ -77,7 +77,14 @@ class BomApiController extends Controller{
//bom单详情 保存bom单
public
function
saveBomInfo
(
$request
,
$id
){
$this
->
bomService
->
saveBomInfo
(
$request
);
$res
=
$this
->
bomService
->
saveBomInfo
(
$request
);
return
$this
->
ajaxReturn
(
$res
[
'errcode'
],
$res
[
'errmsg'
]);
}
public
function
createBomOrder
(
$request
,
$id
){
$res
=
$this
->
bomService
->
createBomOrder
(
$request
);
return
$this
->
ajaxReturn
(
$res
[
'errcode'
],
$res
[
'errmsg'
]);
}
...
...
app/Model/Bom/BomItemMatchModel.php
View file @
0540a7fb
...
...
@@ -27,10 +27,22 @@ class BomItemMatchModel extends BomItemMatchBaseModel{
public
function
getBomItemsMatching
(
$bom_id
,
$bom_item_id
){
$suffix
=
substr
(
strrev
(
$bom_id
),
0
,
1
);
return
self
::
suffix
(
$suffix
)
->
where
(
'bom_id'
,
$bom_id
)
->
where
(
"bom_item_id"
,
$bom_item_id
)
->
first
();
return
self
::
suffix
(
$suffix
)
->
where
(
'bom_id'
,
$bom_id
)
->
where
(
"bom_item_id"
,
$bom_item_id
)
->
where
(
"status"
,
1
)
->
first
();
}
public
function
updateBomMatch
(
$bom_id
,
$where
,
$data
){
$suffix
=
substr
(
strrev
(
$bom_id
),
0
,
1
);
return
self
::
suffix
(
$suffix
)
->
where
(
$where
)
->
update
(
$data
);
}
public
function
addBomMatch
(
$bom_id
,
$data
){
$suffix
=
substr
(
strrev
(
$bom_id
),
0
,
1
);
return
self
::
suffix
(
$suffix
)
->
insert
(
$data
);
}
...
...
app/Model/Bom/BomItemModel.php
View file @
0540a7fb
...
...
@@ -25,9 +25,13 @@ class BomItemModel extends BomItemMatchBaseModel{
}
public
function
getBomItems
(
$bom_id
){
public
function
getBomItems
(
$request
,
$bom_id
){
$page
=
$request
->
input
(
"page"
,
1
);
$limit
=
$request
->
input
(
"limit"
,
10
);
$suffix
=
substr
(
strrev
(
$bom_id
),
0
,
1
);
return
self
::
suffix
(
$suffix
)
->
where
(
'bom_id'
,
$bom_id
)
->
get
();
$query
=
self
::
suffix
(
$suffix
)
->
select
(
"*"
)
->
where
(
'bom_id'
,
$bom_id
);
$query
=
$query
->
paginate
(
$limit
,[],
'page'
,
$page
);
return
$query
;
}
...
...
app/Services/Bom/BomService.php
View file @
0540a7fb
This diff is collapsed.
Click to expand it.
config/website.php
View file @
0540a7fb
...
...
@@ -58,6 +58,17 @@ return [
// 'search-skuid' => 'http://www.liexin.com/v3/sku/list',
'search-skuid'
=>
'http://api.liexin.com/goods/detail'
,
'search-skuid-finalInfo'
=>
'http://api.liexin.com/cart/bomOrderGetFinalGoods'
,
//批量下自营订单
'addzyorder_url'
=>
'http://api.liexin.com/cart/addBatch'
,
//联营
'addlyorder_url'
=>
'http://api.liexin.com/cart/addBatchByOrderSystem'
,
//创建订单
'api_create_order'
=>
'http://api.liexin.com/order/create'
,
// 新增SKU入口
'add-sku-url'
=>
'http://footstone.liexin.net/manage/addsku'
,
...
...
public/js/web/BomView.js
View file @
0540a7fb
...
...
@@ -2,28 +2,56 @@ layui.use(['form', 'table', 'laydate'], function() {
var
form
=
layui
.
form
;
var
table
=
layui
.
table
;
var
laydate
=
layui
.
laydate
;
var
table
=
layui
.
table
;
//转换静态表格
table
.
init
(
'bomView'
,
{
url
:
'/ajax/bom/BomView?bom_id='
+
bom_id
//数据接口
limit
:
10
,
url
:
'/ajax/bom/BomView?bom_id='
+
bom_id
//数据接口
,
toolbar
:
'#toolbarDemo'
//开启头部工具栏,并为其绑定左侧模板
,
defaultToolbar
:[]
,
method
:
'post'
,
cellMinWidth
:
80
//全局定义常规单元格的最小宽度
,
page
:
fals
e
//开启分页
,
page
:
tru
e
//开启分页
});
//头工具栏事件
table
.
on
(
'toolbar(bomView)'
,
function
(
obj
){
switch
(
obj
.
event
){
case
'save_form'
:
var
listdata
=
layui
.
table
.
cache
;
console
.
log
(
listdata
[
1
])
var
datax
=
{}
datax
.
data
=
listdata
[
1
]
function
renderTable
(){
table
.
init
(
'bomView'
,
{
limit
:
10
,
url
:
'/ajax/bom/BomView?bom_id='
+
bom_id
//数据接口
,
toolbar
:
'#toolbarDemo'
//开启头部工具栏,并为其绑定左侧模板
,
defaultToolbar
:[]
,
method
:
'post'
,
cellMinWidth
:
80
//全局定义常规单元格的最小宽度
,
page
:
true
//开启分页
});
}
form
.
on
(
'checkbox(checkall)'
,
function
(
data
)
{
var
child
=
$
(
data
.
elem
).
parents
(
'.layui-tab-item'
).
find
(
'input[type="checkbox"]'
);
child
.
each
(
function
(
index
,
item
)
{
item
.
checked
=
data
.
elem
.
checked
;
});
form
.
render
(
'checkbox'
);
});
//监听单元格编辑
table
.
on
(
'edit(bomView)'
,
function
(
obj
){
var
value
=
obj
.
value
//得到修改后的值
,
data
=
obj
.
data
//得到所在行所有键值
,
field
=
obj
.
field
;
//得到字段
if
(
field
!=
"match_goods_id"
){
obj
.
data
.
match_goods_id
=
0
;
obj
.
update
(
data
)
//修改当前行数据
}
});
function
save_form_ajax
(
datax
){
layer
.
open
({
title
:
"保存bom单"
,
content
:
"你确定保存吗?"
,
...
...
@@ -35,32 +63,77 @@ layui.use(['form', 'table', 'laydate'], function() {
type
:
'post'
,
data
:
datax
,
success
:
function
(
resp
)
{
//if (resp.err_code == 0) {
// layer.msg(resp.err_msg);
// // renderTable(); // 重新加载table
// $('.search').trigger("click"); // 触发搜索按钮
// if(typeof resp.data.redictUrl != "undefined"){
// window.location.href=resp.data.redictUrl;
// }
// return false;
//}
//
//layer.alert(resp.err_msg);
if
(
resp
.
errcode
==
0
)
{
layer
.
msg
(
resp
.
errmsg
);
renderTable
();
// 重新加载table
}
else
{
layer
.
alert
(
resp
.
errmsg
);
}
},
error
:
function
(
err
)
{
console
.
log
(
err
)
}
})
return
false
;
},
cancel
:
function
(
index
)
{
layer
.
close
(
index
);
}
})
}
//layer.msg('保存中...', {icon: 16, time: 0, shade: 0.3}); // 阻止重复提交
function
create_order_ajax
(
datax
){
layer
.
open
({
title
:
"创建bom订单"
,
content
:
"你确定下单吗?"
,
btn
:
[
'确认?'
,
'取消'
],
yes
:
function
(
index
)
{
layer
.
close
(
index
);
$
.
ajax
({
url
:
"/ajax/bom/createBomOrder"
,
type
:
'post'
,
data
:
datax
,
success
:
function
(
resp
)
{
if
(
resp
.
errcode
==
0
)
{
layer
.
msg
(
resp
.
errmsg
);
renderTable
();
// 重新加载table
}
else
{
layer
.
alert
(
resp
.
errmsg
);
}
},
error
:
function
(
err
)
{
console
.
log
(
err
)
}
})
return
false
;
},
cancel
:
function
(
index
)
{
layer
.
close
(
index
);
}
})
}
//头工具栏事件
table
.
on
(
'toolbar(bomView)'
,
function
(
obj
){
var
checkStatus
=
table
.
checkStatus
(
"layui_table_bomView"
);
var
data
=
checkStatus
.
data
;
if
(
checkStatus
.
data
.
length
<=
0
){
layer
.
msg
(
'请先选择需要保存的数据行'
,
{
icon
:
16
,
time
:
3000
,
shade
:
0.3
})
return
}
var
datax
=
{}
datax
.
data
=
data
switch
(
obj
.
event
){
case
'create_order'
:
create_order_ajax
(
datax
);
break
;
case
'save_form'
:
save_form_ajax
(
datax
)
break
;
};
});
...
...
resources/views/web/BomView.blade.php
View file @
0540a7fb
...
...
@@ -22,19 +22,22 @@
-webkit-border-radius
:
6px
;
}
</style>
<table
class=
"layui-table"
lay-filter=
"bomView"
>
<table
class=
"layui-table"
lay-filter=
"bomView"
id=
"layui_table_bomView"
>
<thead>
<tr>
<th
lay-data=
"{fixed: 'left',templet:'#checkbd'}"
><input
type=
"checkbox"
>
全选
</th>
<th
lay-data=
"{type:'numbers', width:80, sort: true,fixed: 'left'}"
>
序号
</th>
<th
lay-data=
"{field:'goods_name', width:150,fixed: 'left'}"
>
需求型号
</th>
<th
lay-data=
"{field:'brand_name',fixed: 'left',width:140,}"
>
品牌
</th>
<th
lay-data=
"{field:'goods_name', width:150}"
>
需求型号
</th>
<th
lay-data=
"{field:'brand_name',width:140,}"
>
品牌
</th>
<th
lay-data=
"{field:'number',width:120,}"
>
需求数量
</th>
<th
lay-data=
"{field:'attrs',width:120,}"
>
参数
</th>
<th
lay-data=
"{field: 'match_goods_id',width:150,edit:'text'}"
>
skuID(可修改)
</th>
<th
lay-data=
"{field: 'match_goods_name',width:200,edit:'text'}"
>
推荐型号(可修改)
</th>
<th
lay-data=
"{field: 'match_brand_name',width:200,edit:'text'}"
>
推荐品牌(可修改)
</th>
<th
lay-data=
"{field:'
number', width:130,edit: 'text',edit:'text'}"
>
数量(可修改)
</th>
<th
lay-data=
"{field:'
match_number', width:130,edit:'text'}"
><i
class=
"layui-icon-edit"
></i>
推荐
数量(可修改)
</th>
<th
lay-data=
"{field:'match_price',width:130,edit:'text'}"
>
单价(可修改)
</th>
<th
lay-data=
"{field:'match_delivery',width:160,edit:'text'}"
>
货期/天(可修改)
</th>
<th
lay-data=
"{field:'match_supplier_name'
}"
>
供应商
</th>
<th
lay-data=
"{field:'match_supplier_name'
,edit:'text',width:160}"
>
供应商(可修改)
</th>
<th
lay-data=
"{field:'match_mpq'}"
>
包装
</th>
<th
lay-data=
"{field:'match_moq'}"
>
起订量
</th>
<th
lay-data=
"{field:'match_amount',width:100}"
>
小计
</th>
...
...
@@ -48,6 +51,7 @@
<script
type=
"text/html"
id=
"toolbarDemo"
>
<
div
class
=
"layui-btn-container"
>
<
button
class
=
"layui-btn layui-btn-sm"
lay
-
event
=
"save_form"
>
保存
<
/button>
<
button
class
=
"layui-btn layui-btn-sm"
lay
-
event
=
"create_order"
>
下单
<
/button>
<
/div>
</script>
...
...
@@ -60,6 +64,11 @@
@{{
#
}
}}
</script>
<script
type=
"text/html"
id=
"checkbd"
>
@{{
#
if
(
d
.
is_corder
!=
1
)
{
}}
<
input
type
=
"checkbox"
name
=
"layTableCheckbox"
lay
-
skin
=
"primary"
>
@{{
#
}
}}
</script>
<script
type=
"text/html"
id=
"match_extend_order_amount"
>
...
...
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