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
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
848 additions
and
229 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{
...
@@ -77,7 +77,14 @@ class BomApiController extends Controller{
//bom单详情 保存bom单
//bom单详情 保存bom单
public
function
saveBomInfo
(
$request
,
$id
){
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
<?php
<?php
namespace
App\Model\Bom
;
namespace
App\Model\Bom
;
class
BomItemMatchModel
extends
BomItemMatchBaseModel
{
class
BomItemMatchModel
extends
BomItemMatchBaseModel
{
protected
$connection
=
'bom'
;
//库名
protected
$connection
=
'bom'
;
//库名
protected
$table
=
'bom_item_matching'
;
//库名
protected
$table
=
'bom_item_matching'
;
//库名
protected
$primaryKey
=
'matching_id'
;
//设置id
protected
$primaryKey
=
'matching_id'
;
//设置id
protected
$guarded
=
[
'matching_id'
];
//设置字段黑名单
protected
$guarded
=
[
'matching_id'
];
//设置字段黑名单
public
$timestamps
=
true
;
public
$timestamps
=
true
;
const
CREATED_AT
=
'add_time'
;
const
CREATED_AT
=
'add_time'
;
const
UPDATED_AT
=
'update_time'
;
const
UPDATED_AT
=
'update_time'
;
protected
$dateFormat
=
'Y-m-d H:i:s'
;
protected
$dateFormat
=
'Y-m-d H:i:s'
;
public
function
fromDateTime
(
$value
){
public
function
fromDateTime
(
$value
){
return
strtotime
(
parent
::
fromDateTime
(
$value
));
return
strtotime
(
parent
::
fromDateTime
(
$value
));
}
}
public
function
getBomAmount
(
$bom_id
){
public
function
getBomAmount
(
$bom_id
){
$suffix
=
substr
(
strrev
(
$bom_id
),
0
,
1
);
$suffix
=
substr
(
strrev
(
$bom_id
),
0
,
1
);
return
self
::
suffix
(
$suffix
)
->
where
(
'bom_id'
,
$bom_id
)
->
where
(
"status"
,
1
)
->
selectRaw
(
"sum(price*number) as amount"
)
->
first
();
return
self
::
suffix
(
$suffix
)
->
where
(
'bom_id'
,
$bom_id
)
->
where
(
"status"
,
1
)
->
selectRaw
(
"sum(price*number) as amount"
)
->
first
();
}
}
public
function
getBomItemsMatching
(
$bom_id
,
$bom_item_id
){
public
function
getBomItemsMatching
(
$bom_id
,
$bom_item_id
){
$suffix
=
substr
(
strrev
(
$bom_id
),
0
,
1
);
$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
);
}
}
}
\ No newline at end of file
app/Model/Bom/BomItemModel.php
View file @
0540a7fb
<?php
<?php
namespace
App\Model\Bom
;
namespace
App\Model\Bom
;
class
BomItemModel
extends
BomItemMatchBaseModel
{
class
BomItemModel
extends
BomItemMatchBaseModel
{
protected
$connection
=
'bom'
;
//库名
protected
$connection
=
'bom'
;
//库名
protected
$table
=
'bom_item'
;
//库名
protected
$table
=
'bom_item'
;
//库名
protected
$primaryKey
=
'bom_item_id'
;
//设置id
protected
$primaryKey
=
'bom_item_id'
;
//设置id
protected
$guarded
=
[
'bom_item_id'
];
//设置字段黑名单
protected
$guarded
=
[
'bom_item_id'
];
//设置字段黑名单
public
$timestamps
=
true
;
public
$timestamps
=
true
;
const
CREATED_AT
=
'add_time'
;
const
CREATED_AT
=
'add_time'
;
const
UPDATED_AT
=
'update_time'
;
const
UPDATED_AT
=
'update_time'
;
protected
$dateFormat
=
'Y-m-d H:i:s'
;
protected
$dateFormat
=
'Y-m-d H:i:s'
;
public
function
fromDateTime
(
$value
){
public
function
fromDateTime
(
$value
){
return
strtotime
(
parent
::
fromDateTime
(
$value
));
return
strtotime
(
parent
::
fromDateTime
(
$value
));
}
}
public
function
getBomAmount
(
$bom_id
){
public
function
getBomAmount
(
$bom_id
){
$suffix
=
substr
(
strrev
(
$bom_id
),
0
,
1
);
$suffix
=
substr
(
strrev
(
$bom_id
),
0
,
1
);
return
self
::
suffix
(
$suffix
)
->
where
(
'bom_id'
,
$bom_id
)
->
where
(
"status"
,
1
)
->
selectRaw
(
"sum(price*number) as amount"
)
->
first
();
return
self
::
suffix
(
$suffix
)
->
where
(
'bom_id'
,
$bom_id
)
->
where
(
"status"
,
1
)
->
selectRaw
(
"sum(price*number) as amount"
)
->
first
();
}
}
public
function
getBomItems
(
$bom_id
){
public
function
getBomItems
(
$request
,
$bom_id
){
$suffix
=
substr
(
strrev
(
$bom_id
),
0
,
1
);
$page
=
$request
->
input
(
"page"
,
1
);
return
self
::
suffix
(
$suffix
)
->
where
(
'bom_id'
,
$bom_id
)
->
get
();
$limit
=
$request
->
input
(
"limit"
,
10
);
}
$suffix
=
substr
(
strrev
(
$bom_id
),
0
,
1
);
$query
=
self
::
suffix
(
$suffix
)
->
select
(
"*"
)
->
where
(
'bom_id'
,
$bom_id
);
$query
=
$query
->
paginate
(
$limit
,[],
'page'
,
$page
);
return
$query
;
}
}
}
\ No newline at end of file
app/Services/Bom/BomService.php
View file @
0540a7fb
...
@@ -5,11 +5,22 @@ use App\Model\Bom\BomModel;
...
@@ -5,11 +5,22 @@ use App\Model\Bom\BomModel;
use
App\Model\Bom\BomItemMatchModel
;
use
App\Model\Bom\BomItemMatchModel
;
use
App\Model\Bom\BomItemModel
;
use
App\Model\Bom\BomItemModel
;
use
App\Model\Bom\BomItemMatchExtendModel
;
use
App\Model\Bom\BomItemMatchExtendModel
;
use
App\Exceptions\BomException
;
use
DB
;
class
BomService
{
class
BomService
{
//1专卖2联营3自营4寄售5第三方仓库 0:自营 1:联营 2:专卖
public
static
$GOODSTYPE
=
[
1
=>
2
,
2
=>
1
,
3
=>
0
,
4
=>
0
,
5
=>
0
,
];
public
function
__construct
(){
public
function
__construct
(){
$this
->
bomModel
=
new
BomModel
;
$this
->
bomModel
=
new
BomModel
;
$this
->
bomItemMatchModel
=
new
BomItemMatchModel
;
}
}
protected
function
getRole
(
$request
){
protected
function
getRole
(
$request
){
...
@@ -67,10 +78,14 @@ class BomService {
...
@@ -67,10 +78,14 @@ class BomService {
$bomItemModel
=
new
BomItemModel
;
$bomItemModel
=
new
BomItemModel
;
$bomItemModelMatch
=
new
BomItemMatchModel
;
$bomItemModelMatch
=
new
BomItemMatchModel
;
$bomItemMatchExtendModel
=
new
BomItemMatchExtendModel
;
$bomItemMatchExtendModel
=
new
BomItemMatchExtendModel
;
$bom_items
=
$bomItemModel
->
getBomItems
(
$bom
->
bom_id
);
$bom_items
=
$bomItemModel
->
getBomItems
(
$
request
,
$
bom
->
bom_id
);
foreach
(
$bom_items
as
$k
=>&
$item
){
foreach
(
$bom_items
as
$k
=>&
$item
){
$bom_item_matching
=
$bomItemModelMatch
->
getBomItemsMatching
(
$bom
->
bom_id
,
$item
->
bom_item_id
);
$bom_item_matching
=
$bomItemModelMatch
->
getBomItemsMatching
(
$bom
->
bom_id
,
$item
->
bom_item_id
);
if
(
$bom_item_matching
){
if
(
$bom_item_matching
){
$item
->
match_is_corder
=
$bom_item_matching
->
is_corder
;
$item
->
match_goods_type
=
$bom_item_matching
->
goods_type
;
$item
->
matching_id
=
$bom_item_matching
->
matching_id
;
$item
->
match_number
=
$bom_item_matching
->
number
;
$item
->
match_goods_id
=
$bom_item_matching
->
goods_id
;
$item
->
match_goods_id
=
$bom_item_matching
->
goods_id
;
$item
->
match_goods_name
=
$bom_item_matching
->
goods_name
;
$item
->
match_goods_name
=
$bom_item_matching
->
goods_name
;
$item
->
match_brand_name
=
$bom_item_matching
->
brand_name
;
$item
->
match_brand_name
=
$bom_item_matching
->
brand_name
;
...
@@ -81,39 +96,517 @@ class BomService {
...
@@ -81,39 +96,517 @@ class BomService {
$item
->
match_price
=
$bom_item_matching
->
price
;
$item
->
match_price
=
$bom_item_matching
->
price
;
$item
->
match_amount
=
$bom_item_matching
->
price
*
$bom_item_matching
->
number
;
$item
->
match_amount
=
$bom_item_matching
->
price
*
$bom_item_matching
->
number
;
$item
->
is_corder
=
$bom_item_matching
->
is_corder
;
$item
->
is_corder
=
$bom_item_matching
->
is_corder
;
$item
->
bom_match_extend
=
$bomItemMatchExtendModel
->
get_bom_match_extend
(
$bom
->
bom_id
,
$bom_item_matching
->
matching_id
);
}
}
$item
->
bom_match_extend
=
$bomItemMatchExtendModel
->
get_bom_match_extend
(
$bom
->
bom_id
,
$bom_item_matching
->
matching_id
);
}
}
return
[
count
(
$bom_items
),
collect
(
$bom_items
)
->
toArray
()];
$list
=
$bom_items
->
toArray
();
// dump($list);
return
[
$list
[
'total'
],
$list
[
"data"
]];
}
}
protected
function
getSku
(
$goods_id
){
protected
function
getSku
(
$user_id
,
$item
,
$extend
){
$url
=
Config
(
'website.search-skuid'
);
try
{
$data
[
'id'
]
=
$goods_id
;
$url
=
Config
(
'website.search-skuid-finalInfo'
);
$data
[
'k1'
]
=
time
();
$data
[
'id'
]
=
$item
[
"match_goods_id"
];
$data
[
'k2'
]
=
md5
(
md5
(
$data
[
'k1'
])
.
'fh6y5t4rr351d2c3bryi'
);
$data
[
'num'
]
=
isset
(
$item
[
"match_number"
])
?
intval
(
$item
[
"match_number"
])
:
0
;
$data
[
'currency'
]
=
$extend
[
"currency"
];
$data
[
'uid'
]
=
intval
(
$user_id
)
?
intval
(
$user_id
)
:
0
;
$data
[
'k1'
]
=
time
();
$data
[
'k2'
]
=
md5
(
md5
(
$data
[
'k1'
])
.
'fh6y5t4rr351d2c3bryi'
);
$response
=
json_decode
(
curlApi
(
$url
,
$data
,
'POST'
),
true
);
if
(
$response
[
'err_code'
]
!=
0
){
return
false
;
}
else
{
return
$response
[
'data'
];
}
}
catch
(
\Exception
$e
){
return
false
;
}
}
$response
=
json_decode
(
curlApi
(
$url
,
$data
,
'POST'
),
true
);
dump
(
$response
);
/**
* 新获取最终销售价
* @param [type] $goods [description]
* @return [type] [description]
*/
function
ladder_final_price
(
$goods
,
$extend
)
{
$currency
=
isset
(
$extend
[
'currency'
])
?
$extend
[
'currency'
]
:
1
;
$use_ac
=
isset
(
$goods
[
'ac_type'
])
?
$goods
[
'ac_type'
]
:
0
;
if
(
$currency
==
1
)
{
$field
=
$use_ac
?
'price_ac'
:
'price_cn'
;
}
else
{
$field
=
$use_ac
?
'price_us'
:
'price_us'
;
//美元不支持优惠
}
$arr
=
[
'price'
=>
$goods
[
$field
],
'price_total'
=>
isset
(
$goods
[
$field
.
'_total'
])
?
$goods
[
$field
.
'_total'
]
:
$goods
[
$field
]
*
$goods
[
'num'
],
'num'
=>
$goods
[
'num'
],
];
return
$arr
;
}
/*
* 获取商品的会员价
*/
protected
function
saveBomItemMatchingBySearchApi
(
$bom_item_matching
,
$goods
,
$extend
=
[]){
// dump("获取api商品信息 修改商品");
//价格计算
$goods_prices
=
$this
->
ladder_final_price
(
$goods
,
$extend
);
//获取优惠前 原始价格
// $initial_prices = $this->ladder_final_price($goods, $extend);
//修改bom单匹配信息
$goodsInfo
=
$goods
[
'goods_info'
];
// dump($goodsInfo);
$where
=
[
'bom_id'
=>
$bom_item_matching
[
'bom_id'
],
"matching_id"
=>
$bom_item_matching
[
'matching_id'
]];
$delivery
=
""
;
if
(
is_array
(
$goodsInfo
[
'delivery_time'
])){
if
(
isset
(
$goodsInfo
[
'delivery_time'
][
$extend
[
'delivery_type'
]])){
$delivery
=
$goodsInfo
[
'delivery_time'
][
$extend
[
'delivery_type'
]];
}
}
$num
=
$bom_item_matching
[
'match_number'
];
if
(
in_array
(
$goodsInfo
[
'goods_type'
],
array
(
1
,
2
))){
//联营
}
else
{
//自营
$mpl
=
!
empty
(
$goodsInfo
[
'mpl'
])
?
$goodsInfo
[
'mpl'
]
:
1
;
//旧数据
$modNum
=
$num
%
$mpl
;
$num
=
$num
-
intval
(
$modNum
);
}
$data
=
[
"goods_id"
=>
$goodsInfo
[
'goods_id'
],
"goods_name"
=>
$goodsInfo
[
'goods_name'
],
"brand_id"
=>
$goodsInfo
[
'brand_id'
],
"brand_name"
=>
$goodsInfo
[
'brand_name'
],
"goods_type"
=>
static
::
$GOODSTYPE
[
$goodsInfo
[
'goods_type'
]],
"supplier_id"
=>
$goodsInfo
[
'supplier_id'
],
"supplier_name"
=>
$goodsInfo
[
'supplier_name'
],
"delivery"
=>
$delivery
,
//货期
"delivery_type"
=>
$extend
[
'delivery_type'
],
//交货类型
"number"
=>
$num
,
"price"
=>
$goods_prices
[
'price'
],
"pdf"
=>
$goodsInfo
[
'pdf'
],
"stock"
=>
$goodsInfo
[
'goods_number'
],
"moq"
=>
$goodsInfo
[
'min_buy'
],
"mpq"
=>
$goodsInfo
[
'min_mpq'
],
"encap"
=>
$goodsInfo
[
'encap'
],
"status"
=>
1
,
"update_time"
=>
time
(),
"ladder_price"
=>
json_encode
(
$goodsInfo
[
'tiered'
]),
];
$bk
=
$this
->
bomItemMatchModel
->
updateBomMatch
(
$bom_item_matching
[
'bom_id'
],
$where
,
$data
);
if
(
$bk
===
false
){
return
false
;
}
else
{
return
true
;
}
}
protected
function
addBomItemMatchingBySearchApi
(
$bom_item_matching
,
$goods
,
$extend
=
[]){
//价格计算
$goods_prices
=
$this
->
ladder_final_price
(
$goods
,
$extend
);
//获取优惠前 原始价格
// $initial_prices = $this->ladder_final_price($goods, $extend);
//修改bom单匹配信息
$goodsInfo
=
$goods
[
'goods_info'
];
// $where = ['bom_id'=>$bom_item_matching['bom_id'],"matching_id"=>$bom_item_matching['matching_id']];
$num
=
$bom_item_matching
[
'match_number'
];
if
(
in_array
(
$goodsInfo
[
'goods_type'
],
array
(
1
,
2
))){
//联营
}
else
{
//自营
$mpl
=
!
empty
(
$goodsInfo
[
'mpl'
])
?
$goodsInfo
[
'mpl'
]
:
1
;
//旧数据
$modNum
=
$num
%
$mpl
;
$num
=
$num
-
intval
(
$modNum
);
}
$data
=
[
"bom_id"
=>
$bom_item_matching
[
'bom_id'
],
"bom_item_id"
=>
$bom_item_matching
[
'bom_item_id'
],
"goods_id"
=>
$goodsInfo
[
'goods_id'
],
"goods_name"
=>
$goodsInfo
[
'goods_name'
],
"brand_id"
=>
$goodsInfo
[
'brand_id'
],
"brand_name"
=>
$goodsInfo
[
'brand_name'
],
"goods_type"
=>
static
::
$GOODSTYPE
[
$goodsInfo
[
'goods_type'
]],
"supplier_id"
=>
$goodsInfo
[
'supplier_id'
],
"supplier_name"
=>
$goodsInfo
[
'supplier_name'
],
"delivery"
=>
$goodsInfo
[
'delivery_time'
],
"delivery_type"
=>
$extend
[
'delivery_type'
],
//交货类型
"number"
=>
$num
,
"price"
=>
$goods_prices
[
'price'
],
"pdf"
=>
$goodsInfo
[
'pdf'
],
"stock"
=>
$goodsInfo
[
'goods_number'
],
"moq"
=>
$goodsInfo
[
'min_buy'
],
"mpq"
=>
$goodsInfo
[
'min_mpq'
],
"encap"
=>
$goodsInfo
[
'encap'
],
"status"
=>
1
,
"update_time"
=>
time
(),
"ladder_price"
=>
json_encode
(
$goodsInfo
[
'tiered'
]),
];
// dump($data);
$bk
=
$this
->
bomItemMatchModel
->
addBomMatch
(
$bom_item_matching
[
'bom_id'
],
$data
);
if
(
$bk
===
false
){
return
false
;
}
else
{
return
true
;
}
}
}
public
function
saveBomItemMatching
(
$bom_item_matching
,
$extend
){
// dump("不需要匹配商品,直接修改bom单");
$goodsInfo
=
$bom_item_matching
;
// dump($goodsInfo);return;
if
(
isset
(
$bom_item_matching
[
'matching_id'
])
&&
$bom_item_matching
[
'matching_id'
]
>
0
){
//修改
$where
=
[
'bom_id'
=>
$bom_item_matching
[
'bom_id'
],
"matching_id"
=>
$bom_item_matching
[
'matching_id'
]];
$data
=
[
"goods_id"
=>
0
,
"goods_name"
=>
trim
(
$goodsInfo
[
'match_goods_name'
]),
"brand_id"
=>
0
,
"brand_name"
=>
trim
(
$goodsInfo
[
'match_brand_name'
]),
"goods_type"
=>
1
,
//默认联营
"delivery"
=>
trim
(
$goodsInfo
[
'match_delivery'
]),
//货期
"delivery_type"
=>
$extend
[
'delivery_type'
],
//交货类型
"number"
=>
intval
(
$goodsInfo
[
'match_number'
]),
"price"
=>
$goodsInfo
[
'match_price'
],
"pdf"
=>
""
,
"supplier_name"
=>
trim
(
$goodsInfo
[
'match_supplier_name'
]),
"supplier_id"
=>
"0"
,
"stock"
=>
0
,
"moq"
=>
0
,
"mpq"
=>
0
,
"encap"
=>
""
,
"status"
=>
1
,
"update_time"
=>
time
(),
"ladder_price"
=>
""
,
];
$bk
=
$this
->
bomItemMatchModel
->
updateBomMatch
(
$goodsInfo
[
'bom_id'
],
$where
,
$data
);
if
(
$bk
===
false
){
return
false
;
}
else
{
return
true
;
}
}
else
{
//新增
$data
=
[
"bom_id"
=>
$goodsInfo
[
'bom_id'
],
"bom_item_id"
=>
$goodsInfo
[
'bom_item_id'
],
"goods_id"
=>
0
,
"goods_name"
=>
isset
(
$goodsInfo
[
'match_goods_name'
])
?
trim
(
$goodsInfo
[
'match_goods_name'
])
:
''
,
"brand_id"
=>
0
,
"brand_name"
=>
isset
(
$goodsInfo
[
'match_brand_name'
])
?
trim
(
$goodsInfo
[
'match_brand_name'
])
:
''
,
"goods_type"
=>
1
,
//默认联营
"delivery"
=>
isset
(
$goodsInfo
[
'match_delivery'
])
?
trim
(
$goodsInfo
[
'match_delivery'
])
:
''
,
//货期
"delivery_type"
=>
isset
(
$extend
[
'delivery_type'
])
?
$extend
[
'delivery_type'
]
:
1
,
//交货类型
"number"
=>
isset
(
$goodsInfo
[
'match_number'
])
?
intval
(
$goodsInfo
[
'match_number'
])
:
0
,
"price"
=>
isset
(
$goodsInfo
[
'match_price'
])
?
$goodsInfo
[
'match_price'
]
:
0
,
"supplier_name"
=>
isset
(
$goodsInfo
[
'match_supplier_name'
])
?
trim
(
$goodsInfo
[
'match_supplier_name'
])
:
''
,
"supplier_id"
=>
"0"
,
"pdf"
=>
""
,
"stock"
=>
0
,
"moq"
=>
0
,
"mpq"
=>
0
,
"encap"
=>
""
,
"status"
=>
1
,
"add_time"
=>
time
(),
"update_time"
=>
time
(),
"ladder_price"
=>
""
,
];
$bk
=
$this
->
bomItemMatchModel
->
addBomMatch
(
$goodsInfo
[
'bom_id'
],
$data
);
if
(
$bk
===
false
){
return
false
;
}
else
{
return
true
;
}
}
}
public
function
saveBomInfo
(
$request
){
public
function
saveBomInfo
(
$request
){
try
{
try
{
$err_msg
=
[];
$data
=
$request
->
input
(
"data"
,
''
);
$data
=
$request
->
input
(
"data"
,
''
);
// dump($data);exit;
$bom_id
=
$data
[
0
][
"bom_id"
];
$bom
=
BomModel
::
where
([
"bom_id"
=>
intval
(
$bom_id
)])
->
select
(
"user_id"
,
"where"
)
->
first
();
$user_id
=
$bom
->
user_id
;
$bom_where
=
$bom
->
where
;
$delivery_type
=
0
;
//交货地
if
(
!
$user_id
){
throw
new
BomException
(
"该bom单没有绑定用户id"
,
-
1
);
}
if
(
$bom_where
){
$bom_where_arr
=
json_decode
(
$bom_where
,
true
);
if
(
isset
(
$bom_where_arr
[
"delivery_type"
])){
$delivery_type
=
$bom_where_arr
[
"delivery_type"
];
}
}
if
(
!
in_array
(
$delivery_type
,[
1
,
2
])){
$delivery_type
=
1
;
}
$currency
=
$delivery_type
;
$extend
[
"delivery_type"
]
=
$delivery_type
;
$extend
[
"currency"
]
=
$currency
;
foreach
(
$data
as
$k
=>
$item
){
//已下单的不能修改
if
(
isset
(
$item
[
'match_is_corder'
])
&&
$item
[
'match_is_corder'
]
==
1
){
// array_push($err_msg,sprintf("第%s个型号已下单,无法更改;",$k));
continue
;
}
//设置匹配的默认数量
if
(
!
isset
(
$item
[
"match_number"
])
||
intval
(
$item
[
"match_number"
])
<=
0
){
if
(
isset
(
$item
[
'number'
])
&&
$item
[
'number'
]
>
0
){
$item
[
"match_number"
]
=
intval
(
$item
[
'number'
]);
}
else
{
$item
[
"match_number"
]
=
1
;
}
}
//如果客服修改了goods_id则 需要重新匹配的商品信息
if
(
isset
(
$item
[
'match_goods_id'
])
&&
$item
[
'match_goods_id'
]
&&
intval
(
$item
[
'match_goods_id'
])
>
0
){
// dump($item);continue;
//请求api 获取商品信息
$res
=
$this
->
getSku
(
$user_id
,
$item
,
$extend
);
// dump($res);
//如果获取到了商品数据
if
(
$res
!==
false
){
if
(
isset
(
$item
[
'matching_id'
])
&&
$item
[
'matching_id'
]
>
0
){
//修改 查询到了商品信息 修改本地bom单信息
if
(
$this
->
saveBomItemMatchingBySearchApi
(
$item
,
$res
,
$extend
)){
continue
;
}
}
else
{
//新增
if
(
$this
->
addBomItemMatchingBySearchApi
(
$item
,
$res
,
$extend
)){
continue
;
}
}
}
else
{
//没搜索到商品 直接将商品id设为0
$item
[
"match_goods_id"
]
=
0
;
}
}
//没有找到商品信息
//直接按照客服提交的信息修改内容 并且修改goods_id=0 goods_type类型为联营
$this
->
saveBomItemMatching
(
$item
,
$extend
);
}
return
[
'errcode'
=>
0
,
"errmsg"
=>
"保存成功"
];
}
catch
(
BomException
$e
){
return
[
'errcode'
=>
$e
->
getCode
(),
"errmsg"
=>
$e
->
getMessage
()];
}
catch
(
\Exception
$e
){
return
[
'errcode'
=>-
1
,
"errmsg"
=>
$e
->
getMessage
()];
}
}
/*
* bom下单
* 自营单
* 联营单
*/
public
function
createBomOrder
(
$request
){
try
{
$err_msg
=
[];
$data
=
$request
->
input
(
"data"
,
''
);
// dump($data);exit;
$bom_id
=
$data
[
0
][
"bom_id"
];
$bom
=
BomModel
::
where
([
"bom_id"
=>
intval
(
$bom_id
)])
->
select
(
"user_id"
,
"where"
)
->
first
();
$user_id
=
$bom
->
user_id
;
$bom_where
=
$bom
->
where
;
$delivery_type
=
0
;
//交货地
if
(
!
$user_id
){
throw
new
BomException
(
"该bom单没有绑定用户id"
,
-
1
);
}
if
(
$bom_where
){
$bom_where_arr
=
json_decode
(
$bom_where
,
true
);
if
(
isset
(
$bom_where_arr
[
"delivery_type"
])){
$delivery_type
=
$bom_where_arr
[
"delivery_type"
];
}
}
if
(
!
in_array
(
$delivery_type
,[
1
,
2
])){
$delivery_type
=
1
;
}
$currency
=
$delivery_type
;
$extend
[
"delivery_type"
]
=
$delivery_type
;
$extend
[
"currency"
]
=
$currency
;
$extend
[
"bom_id"
]
=
$bom_id
;
dump
(
$extend
);
// dump($data);
// dump($data);
$address_id
=
$this
->
getAddress
(
$user_id
);
dump
(
$address_id
);
$ziying
=
[];
$lianying
=
[];
foreach
(
$data
as
$k
=>
$item
){
foreach
(
$data
as
$k
=>
$item
){
dump
(
$item
[
'match_goods_id'
]);
if
(
$item
[
"is_corder"
]
==
1
)
continue
;
if
(
$item
[
'match_goods_id'
]
&&
intval
(
$item
[
'match_goods_id'
])
>
0
){
if
(
in_array
(
$item
[
"match_goods_type"
],[
0
])){
$this
->
getSku
(
$item
[
'match_goods_id'
]);
//自营
$ziying
[
$k
][
"id"
]
=
$item
[
"match_goods_id"
];
$ziying
[
$k
][
"num"
]
=
$item
[
"match_number"
];
}
else
{
//联营
//
}
}
//加入购物车
$addZYShopCart
=
$this
->
createZYOrderToShopCart
(
$user_id
,
$ziying
,
$extend
);
if
(
!
empty
(
$addZYShopCart
)
&&
$addZYShopCart
[
'err_code'
]
==
0
){
//假如购物车成功
//获取自营购物车
$car_ids
=
$this
->
getShopCart
(
$user_id
,
3
);
array_push
(
$err_msg
,
$addZYShopCart
[
"err_msg"
]);
if
(
!
empty
(
$car_ids
)){
$extend
[
'address_id'
]
=
$address_id
;
//创建订单
$addzyOrder
=
$this
->
createOrder
(
$user_id
,
$car_ids
,
$extend
,
3
);
if
(
!
empty
(
$addzyOrder
)
&&
$addzyOrder
[
'err_code'
]
==
0
){
//创建订单成功
}
else
{
if
(
is_array
(
$addzyOrder
)
&&
!
empty
(
$addzyOrder
)){
array_push
(
$err_msg
,
$addzyOrder
[
"err_msg"
]);
}
}
}
}
else
{
//bom加入购物车失败
if
(
is_array
(
$addZYShopCart
)
&&
!
empty
(
$addZYShopCart
)){
array_push
(
$err_msg
,
$addZYShopCart
[
"err_msg"
]);
}
}
}
}
// $this->createZYOrder($lianying);
}
catch
(
BomException
$e
){
return
[
'errcode'
=>
$e
->
getCode
(),
"errmsg"
=>
$e
->
getMessage
()];
}
catch
(
\Exception
$e
){
}
catch
(
\Exception
$e
){
return
[
'errcode'
=>-
1
,
"errmsg"
=>
$e
->
getMessage
()];
}
}
/*
* 创建订单
*
*/
protected
function
createOrder
(
$user_id
,
$car_ids
,
$extend
,
$type
=
3
){
$url
=
Config
(
'website.api_create_order'
);
$data
[
'bom_id'
]
=
$extend
[
"bom_id"
];
$data
[
'uid'
]
=
intval
(
$user_id
)
?
intval
(
$user_id
)
:
0
;
$data
[
"type"
]
=
2
;
//订单类型:1.联营, 2.自营线上, 3.自营线下, 4.自营其他业务订单
$data
[
"cart_id"
]
=
implode
(
","
,
$car_ids
);
$data
[
'address_id'
]
=
$extend
[
"address_id"
];
$data
[
'k1'
]
=
time
();
$data
[
'k2'
]
=
md5
(
md5
(
$data
[
'k1'
])
.
'fh6y5t4rr351d2c3bryi'
);
$response
=
json_decode
(
curlApi
(
$url
,
$data
,
'POST'
),
true
);
return
$response
;
}
/*
* 获取到后台加入的自营的购物车商品
*/
protected
function
getShopCart
(
$user_id
=
0
,
$type
=
3
){
$goodsType
=
[];
if
(
$type
==
3
){
//自营
$goodsType
=
[
3
];
}
else
{
//联营
$goodsType
=
[
1
,
2
];
}
}
$query
=
DB
::
connection
(
"order"
)
->
table
(
"lie_shopping_cart"
)
->
where
([
"user_id"
=>
$user_id
,
"status"
=>
1
])
->
where
(
"bom_id"
,
"!="
,
0
)
->
whereIn
(
"goods_type"
,
$goodsType
)
->
select
(
"cart_id"
)
->
pluck
(
"cart_id"
);
return
$query
;
}
}
/*
* 创建自营订单 到购物车
*/
protected
function
createZYOrderToShopCart
(
$user_id
,
$ziying
,
$extend
){
$url
=
Config
(
'website.addzyorder_url'
);
$data
[
'type'
]
=
2
;
$data
[
'bom_id'
]
=
$extend
[
"bom_id"
];
$data
[
'delivery_place'
]
=
$extend
[
'delivery_type'
];
$data
[
"data"
]
=
array_merge
(
$ziying
);
$data
[
'uid'
]
=
intval
(
$user_id
)
?
intval
(
$user_id
)
:
0
;
$data
[
'k1'
]
=
time
();
$data
[
'k2'
]
=
md5
(
md5
(
$data
[
'k1'
])
.
'fh6y5t4rr351d2c3bryi'
);
$response
=
json_decode
(
curlApi
(
$url
,
$data
,
'POST'
),
true
);
return
$response
;
}
protected
function
getAddress
(
$user_id
){
$address
=
DB
::
connection
(
"order"
)
->
table
(
"lie_user_address"
)
->
where
([
"user_id"
=>
$user_id
])
->
select
(
"address_id"
,
"is_default"
)
->
orderBy
(
"address_id"
,
"desc"
)
->
get
();
if
(
!
$address
){
throw
new
BomException
(
"没有找到该用户对应的收货地址"
,
-
1
);
}
$address_id
=
0
;
foreach
(
$address
as
$k
=>
$item
){
if
(
$item
->
is_default
==
1
){
$address_id
=
$item
->
address_id
;
break
;
}
}
if
(
$address_id
){
return
$address_id
;
}
return
$address
[
0
]
->
address_id
;
}
protected
function
getTax
(
$user_id
){
$tax
=
DB
::
connection
(
"order"
)
->
table
(
"lie_taxinfo"
)
->
where
([
"user_id"
=>
$user_id
])
->
select
(
"tax_id"
,
"tax_title"
,
"inv_type"
,
"is_default"
)
->
orderBy
(
"tax_id"
,
"desc"
)
->
get
();
if
(
!
tax_id
){
return
false
;
}
$tax_id
=
0
;
foreach
(
$tax
as
$k
=>
$item
){
if
(
$item
->
is_default
==
1
){
$tax_id
=
$item
->
tax_id
;
break
;
}
}
if
(
$tax_id
){
return
$tax_id
;
}
return
$tax
[
0
]
->
tax_id
;
}
}
}
\ No newline at end of file
config/website.php
View file @
0540a7fb
<?php
<?php
return
[
return
[
'admin'
=>
[
'admin@ichunt.com'
],
'admin'
=>
[
'admin@ichunt.com'
],
'login'
=>
[
'login'
=>
[
'login'
=>
'http://'
.
env
(
'LOGIN_DOMAIN'
,
''
)
.
'/login'
,
'login'
=>
'http://'
.
env
(
'LOGIN_DOMAIN'
,
''
)
.
'/login'
,
'logout'
=>
'http://'
.
env
(
'LOGIN_DOMAIN'
,
''
)
.
'/logout'
,
'logout'
=>
'http://'
.
env
(
'LOGIN_DOMAIN'
,
''
)
.
'/logout'
,
'check'
=>
'http://'
.
env
(
'LOGIN_DOMAIN'
,
''
)
.
'/api/checklogin'
,
'check'
=>
'http://'
.
env
(
'LOGIN_DOMAIN'
,
''
)
.
'/api/checklogin'
,
'search'
=>
'http://'
.
env
(
'LOGIN_DOMAIN'
,
''
)
.
'/api/search'
,
'search'
=>
'http://'
.
env
(
'LOGIN_DOMAIN'
,
''
)
.
'/api/search'
,
],
],
'domain'
=>
'liexin.net'
,
'domain'
=>
'liexin.net'
,
// 订单系统
// 订单系统
'order_url'
=>
'http://order.liexin.net'
,
'order_url'
=>
'http://order.liexin.net'
,
// API项目
// API项目
'api_domain'
=>
'http://api.liexin.com/'
,
'api_domain'
=>
'http://api.liexin.com/'
,
'upload_key'
=>
'fh6y5t4rr351d2c3bryi'
,
// 上传文件key
'upload_key'
=>
'fh6y5t4rr351d2c3bryi'
,
// 上传文件key
// 权限系统
// 权限系统
'perm_url'
=>
'http://perm.liexin.net'
,
'perm_url'
=>
'http://perm.liexin.net'
,
// 获取用户权限接口
// 获取用户权限接口
'perm_api'
=>
'http://perm.liexin.net/api/perms/'
,
'perm_api'
=>
'http://perm.liexin.net/api/perms/'
,
// 获取用户许可权限接口
// 获取用户许可权限接口
'check_access_api'
=>
'http://perm.liexin.net/api/perms/access'
,
'check_access_api'
=>
'http://perm.liexin.net/api/perms/access'
,
// 竞调账户配置显示时间
// 竞调账户配置显示时间
'vp_time_set'
=>
'2018-05-01'
,
'vp_time_set'
=>
'2018-05-01'
,
// 基石服务地址
// 基石服务地址
'SERVICE_DOMAIN'
=>
'http://192.168.1.100'
,
'SERVICE_DOMAIN'
=>
'http://192.168.1.100'
,
//中间服务秘钥
//中间服务秘钥
'SERVICE_KEY'
=>
'j9q##VRhaXBEtznIEeDiR@1Hvy0sW3wp'
,
'SERVICE_KEY'
=>
'j9q##VRhaXBEtznIEeDiR@1Hvy0sW3wp'
,
// 快递配置
// 快递配置
'express_fee_key'
=>
'express_fee'
,
'express_fee_key'
=>
'express_fee'
,
'express_fee'
=>
[
'express_fee'
=>
[
'sz_inside'
=>
10
,
'sz_inside'
=>
10
,
'gd_inside'
=>
10
,
'gd_inside'
=>
10
,
'gd_outside'
=>
15
,
'gd_outside'
=>
15
,
],
],
// www站点
// www站点
'main_url'
=>
'https://www.liexin.com/'
,
'main_url'
=>
'https://www.liexin.com/'
,
// 新增自营线下订单内部账号
// 新增自营线下订单内部账号
'internal-account'
=>
'15011111111'
,
'internal-account'
=>
'15011111111'
,
// 新增用户入口
// 新增用户入口
'add-user-url'
=>
'http://member.liexin.net/add'
,
'add-user-url'
=>
'http://member.liexin.net/add'
,
// 编辑用户入口
// 编辑用户入口
'check-user-url'
=>
'http://member.liexin.net/list'
,
'check-user-url'
=>
'http://member.liexin.net/list'
,
// 查询SKUID接口
// 查询SKUID接口
// 'search-skuid' => 'http://footstone.liexin.net/webapi/sku_list',
// 'search-skuid' => 'http://footstone.liexin.net/webapi/sku_list',
// 'search-skuid' => 'http://www.liexin.com/v3/sku/list',
// 'search-skuid' => 'http://www.liexin.com/v3/sku/list',
'search-skuid'
=>
'http://api.liexin.com/goods/detail'
,
'search-skuid'
=>
'http://api.liexin.com/goods/detail'
,
// 新增SKU入口
'search-skuid-finalInfo'
=>
'http://api.liexin.com/cart/bomOrderGetFinalGoods'
,
'add-sku-url'
=>
'http://footstone.liexin.net/manage/addsku'
,
//批量下自营订单
// 查询联营SKU入口
'addzyorder_url'
=>
'http://api.liexin.com/cart/addBatch'
,
'search-sku-url-1'
=>
'http://footstone.liexin.net/manage/skulist'
,
// 查询自营SKU入口
//联营
'search-sku-url-2'
=>
'http://footstone.liexin.net/manage/GoodsList'
,
'addlyorder_url'
=>
'http://api.liexin.com/cart/addBatchByOrderSystem'
,
// 新增自营线上订单付款地址
//创建订单
'pay_online_url'
=>
'http://www.liexin.com/v3/pay/online?id='
,
'api_create_order'
=>
'http://api.liexin.com/order/create'
,
// 获取自营商品库存
// 新增SKU入口
'self-stock-url'
=>
'http://footstone.liexin.net/webapi/goods_details?sku_id='
,
'add-sku-url'
=>
'http://footstone.liexin.net/manage/addsku'
,
// 财务系统接口地址 (自营发票)
// 查询联营SKU入口
'finance-self-invoice-url'
=>
'http://192.168.1.97/webapi/checkOrderBillStatus'
,
'search-sku-url-1'
=>
'http://footstone.liexin.net/manage/skulist'
,
// 查询自营SKU入口
// 支付地址
'search-sku-url-2'
=>
'http://footstone.liexin.net/manage/GoodsList'
,
'pay_url'
=>
'https://www.liexin.com/v3/pay/online?id='
,
// 新增自营线上订单付款地址
// 订单微服务
'pay_online_url'
=>
'http://www.liexin.com/v3/pay/online?id='
,
'order_api_domain'
=>
'http://orderapi.liexin.com'
,
// 获取自营商品库存
// crm
'self-stock-url'
=>
'http://footstone.liexin.net/webapi/goods_details?sku_id='
,
'crm_domain'
=>
'http://lcrm.liexin.net'
,
// 财务系统接口地址 (自营发票)
// 导出系统
'finance-self-invoice-url'
=>
'http://192.168.1.97/webapi/checkOrderBillStatus'
,
'export_url'
=>
'http://export.liexin.com'
,
'export_joint_source_id'
=>
16
,
// 支付地址
'export_self_source_id'
=>
17
,
'pay_url'
=>
'https://www.liexin.com/v3/pay/online?id='
,
];
// 订单微服务
'order_api_domain'
=>
'http://orderapi.liexin.com'
,
// crm
'crm_domain'
=>
'http://lcrm.liexin.net'
,
// 导出系统
'export_url'
=>
'http://export.liexin.com'
,
'export_joint_source_id'
=>
16
,
'export_self_source_id'
=>
17
,
];
public/js/web/BomView.js
View file @
0540a7fb
...
@@ -2,65 +2,138 @@ layui.use(['form', 'table', 'laydate'], function() {
...
@@ -2,65 +2,138 @@ layui.use(['form', 'table', 'laydate'], function() {
var
form
=
layui
.
form
;
var
form
=
layui
.
form
;
var
table
=
layui
.
table
;
var
table
=
layui
.
table
;
var
laydate
=
layui
.
laydate
;
var
laydate
=
layui
.
laydate
;
var
table
=
layui
.
table
;
//转换静态表格
//转换静态表格
table
.
init
(
'bomView'
,
{
table
.
init
(
'bomView'
,
{
url
:
'/ajax/bom/BomView?bom_id='
+
bom_id
//数据接口
limit
:
10
,
url
:
'/ajax/bom/BomView?bom_id='
+
bom_id
//数据接口
,
toolbar
:
'#toolbarDemo'
//开启头部工具栏,并为其绑定左侧模板
,
toolbar
:
'#toolbarDemo'
//开启头部工具栏,并为其绑定左侧模板
,
defaultToolbar
:[]
,
defaultToolbar
:[]
,
method
:
'post'
,
method
:
'post'
,
cellMinWidth
:
80
//全局定义常规单元格的最小宽度
,
cellMinWidth
:
80
//全局定义常规单元格的最小宽度
,
page
:
fals
e
//开启分页
,
page
:
tru
e
//开启分页
});
});
//头工具栏事件
function
renderTable
(){
table
.
on
(
'toolbar(bomView)'
,
function
(
obj
){
table
.
init
(
'bomView'
,
{
switch
(
obj
.
event
){
limit
:
10
case
'save_form'
:
,
url
:
'/ajax/bom/BomView?bom_id='
+
bom_id
//数据接口
var
listdata
=
layui
.
table
.
cache
;
,
toolbar
:
'#toolbarDemo'
//开启头部工具栏,并为其绑定左侧模板
console
.
log
(
listdata
[
1
])
,
defaultToolbar
:[]
var
datax
=
{}
datax
.
data
=
listdata
[
1
]
,
method
:
'post'
layer
.
open
({
,
cellMinWidth
:
80
//全局定义常规单元格的最小宽度
title
:
"保存bom单"
,
,
page
:
true
//开启分页
content
:
"你确定保存吗?"
,
});
btn
:
[
'确认?'
,
'取消'
],
}
yes
:
function
(
index
)
{
layer
.
close
(
index
);
$
.
ajax
({
form
.
on
(
'checkbox(checkall)'
,
function
(
data
)
{
url
:
"/ajax/bom/saveBomInfo"
,
var
child
=
$
(
data
.
elem
).
parents
(
'.layui-tab-item'
).
find
(
'input[type="checkbox"]'
);
type
:
'post'
,
child
.
each
(
function
(
index
,
item
)
{
data
:
datax
,
item
.
checked
=
data
.
elem
.
checked
;
success
:
function
(
resp
)
{
});
//if (resp.err_code == 0) {
form
.
render
(
'checkbox'
);
// layer.msg(resp.err_msg);
});
// // renderTable(); // 重新加载table
// $('.search').trigger("click"); // 触发搜索按钮
// if(typeof resp.data.redictUrl != "undefined"){
//监听单元格编辑
// window.location.href=resp.data.redictUrl;
table
.
on
(
'edit(bomView)'
,
function
(
obj
){
// }
var
value
=
obj
.
value
//得到修改后的值
// return false;
,
data
=
obj
.
data
//得到所在行所有键值
//}
,
field
=
obj
.
field
;
//得到字段
//
if
(
field
!=
"match_goods_id"
){
//layer.alert(resp.err_msg);
obj
.
data
.
match_goods_id
=
0
;
},
obj
.
update
(
data
)
//修改当前行数据
error
:
function
(
err
)
{
}
console
.
log
(
err
)
});
}
})
function
save_form_ajax
(
datax
){
//layer.msg('保存中...', {icon: 16, time: 0, shade: 0.3}); // 阻止重复提交
layer
.
open
({
title
:
"保存bom单"
,
return
false
;
content
:
"你确定保存吗?"
,
btn
:
[
'确认?'
,
'取消'
],
yes
:
function
(
index
)
{
layer
.
close
(
index
);
$
.
ajax
({
url
:
"/ajax/bom/saveBomInfo"
,
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
);
}
})
}
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
);
}
},
},
cancel
:
function
(
index
)
{
error
:
function
(
err
)
{
layer
.
close
(
index
);
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
;
break
;
};
};
});
});
...
...
resources/views/web/BomView.blade.php
View file @
0540a7fb
...
@@ -22,19 +22,22 @@
...
@@ -22,19 +22,22 @@
-webkit-border-radius
:
6px
;
-webkit-border-radius
:
6px
;
}
}
</style>
</style>
<table
class=
"layui-table"
lay-filter=
"bomView"
>
<table
class=
"layui-table"
lay-filter=
"bomView"
id=
"layui_table_bomView"
>
<thead>
<thead>
<tr>
<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=
"{type:'numbers', width:80, sort: true,fixed: 'left'}"
>
序号
</th>
<th
lay-data=
"{field:'goods_name', width:150,fixed: 'left'}"
>
需求型号
</th>
<th
lay-data=
"{field:'goods_name', width:150}"
>
需求型号
</th>
<th
lay-data=
"{field:'brand_name',fixed: 'left',width:140,}"
>
品牌
</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_id',width:150,edit:'text'}"
>
skuID(可修改)
</th>
<th
lay-data=
"{field: 'match_goods_name',width:200,edit:'text'}"
>
推荐型号(可修改)
</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: '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_price',width:130,edit:'text'}"
>
单价(可修改)
</th>
<th
lay-data=
"{field:'match_delivery',width:160,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_mpq'}"
>
包装
</th>
<th
lay-data=
"{field:'match_moq'}"
>
起订量
</th>
<th
lay-data=
"{field:'match_moq'}"
>
起订量
</th>
<th
lay-data=
"{field:'match_amount',width:100}"
>
小计
</th>
<th
lay-data=
"{field:'match_amount',width:100}"
>
小计
</th>
...
@@ -48,6 +51,7 @@
...
@@ -48,6 +51,7 @@
<script
type=
"text/html"
id=
"toolbarDemo"
>
<script
type=
"text/html"
id=
"toolbarDemo"
>
<
div
class
=
"layui-btn-container"
>
<
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
=
"save_form"
>
保存
<
/button>
<
button
class
=
"layui-btn layui-btn-sm"
lay
-
event
=
"create_order"
>
下单
<
/button>
<
/div>
<
/div>
</script>
</script>
...
@@ -60,6 +64,11 @@
...
@@ -60,6 +64,11 @@
@{{
#
}
}}
@{{
#
}
}}
</script>
</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"
>
<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