Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
杨树贤
/
liexin_supplier
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
a02b4b1e
authored
Jun 27, 2023
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Plain Diff
Merge branch 'master' into ysx-供应商需求-20230619
parents
861c913b
fd203a47
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
43 additions
and
14 deletions
.env
app/Http/Controllers/Api/SupplierContactApiController.php
app/Http/Services/AdminUserService.php
app/Http/Services/DataService.php
resources/views/script/SkuListScript.blade.php
.env
View file @
a02b4b1e
...
...
@@ -140,6 +140,6 @@ PERM_GOURL=http://perm.liexin.net
ADMIN_GROUP=10000,20000
MENU_ID=16
MENU_URL=http://data.liexin.net/api/config/
FOOTSTONE_URL=http://footstone.liexin.net
FOOTSTONE_URL=http://footstone.liexin
dev
.net
#标签系统的地址
TAG_URL=http://192.168.1.18:32581
\ No newline at end of file
app/Http/Controllers/Api/SupplierContactApiController.php
View file @
a02b4b1e
...
...
@@ -34,6 +34,12 @@ class SupplierContactApiController extends Controller
$query
=
$model
->
where
(
'supplier_id'
,
$supplierId
)
->
orderBy
(
'contact_id'
,
'desc'
);
$adminId
=
$request
->
user
->
userId
;
$codeId
=
$request
->
user
->
codeId
;
//大家都可以查看离职的采购员的联系人
$allCanCheckUids
=
SupplierContactModel
::
where
(
'supplier_id'
,
$supplierId
)
->
pluck
(
'can_check_uids'
)
->
toArray
();
$resignedUsers
=
(
new
AdminUserService
())
->
getResignedUsers
();
$resignedUserCodes
=
array_column
(
$resignedUsers
,
'code_id'
);
$resignedCanCheckUids
=
array_intersect
(
$allCanCheckUids
,
$resignedUserCodes
);
//不能查看所有的,就是说只能看绑定的采购的
if
(
$canViewAllSupplierContact
)
{
...
...
@@ -47,7 +53,7 @@ class SupplierContactApiController extends Controller
$subordinateCodeIds
=
$subordinateCodeIds
->
toArray
();
//因为可以查看自己部下相关的采购员,开发员的供应商,所以要构建复杂likeIn语句需要的数据
//注意下面三个条件最外层要用()包围起来,要不然mysql数据会有问题,具体自己查询mysql的and和or的语法注意事项
$inCodeIdSql
=
implode
(
','
,
$subordinateCodeIds
);
$inCodeIdSql
=
implode
(
','
,
array_merge
(
$subordinateCodeIds
,
$resignedCanCheckUids
)
);
$inUserIdSql
=
implode
(
','
,
$subordinateUserIds
);
$inCodeIdSql
=
"("
.
$inCodeIdSql
.
")"
;
$inUserIdSql
=
"("
.
$inUserIdSql
.
")"
;
...
...
@@ -58,11 +64,14 @@ class SupplierContactApiController extends Controller
}
}
else
{
if
(
$codeId
)
{
$query
->
whereRaw
(
"(can_check_uids =
$codeId
or admin_id =
$adminId
)"
);
$inCodeIdSql
=
implode
(
','
,
array_merge
([
$codeId
],
$resignedCanCheckUids
));
$inCodeIdSql
=
"("
.
$inCodeIdSql
.
")"
;
$query
->
whereRaw
(
"(can_check_uids in
$inCodeIdSql
or admin_id =
$adminId
)"
);
}
else
{
$query
->
whereRaw
(
"(admin_id =
$adminId
)"
);
}
}
$list
=
$query
->
paginate
(
$limit
)
->
toArray
();
$transformer
=
new
SupplierContactTransformer
();
$list
[
'data'
]
=
$transformer
->
transformList
(
$list
[
'data'
]);
...
...
@@ -155,7 +164,7 @@ class SupplierContactApiController extends Controller
{
$contactId
=
$request
->
input
(
'contact_id'
);
$type
=
$request
->
input
(
'type'
);
$contact
=
SupplierContactModel
::
select
([
$type
,
'supplier_consignee'
,
'contact_id'
,
'supplier_id'
])
->
where
(
'contact_id'
,
$contactId
)
->
first
()
->
toArray
();
$contact
=
SupplierContactModel
::
select
([
$type
,
'supplier_consignee'
,
'contact_id'
,
'supplier_id'
])
->
where
(
'contact_id'
,
$contactId
)
->
first
()
->
toArray
();
$logService
=
new
LogService
();
$content
=
$request
->
user
->
name
.
' 查看了联系人 '
.
$contact
[
'supplier_consignee'
]
.
' 的'
.
array_get
(
config
(
'field.SupplierContactFieldMap'
),
$type
);
...
...
app/Http/Services/AdminUserService.php
View file @
a02b4b1e
...
...
@@ -76,9 +76,9 @@ class AdminUserService
public
function
getResignedUsers
()
{
$userInfoModel
=
new
UserInfoModel
();
$user
=
$userInfoModel
->
leftJoin
(
'lie_intracode'
,
'user_info.userId'
,
'='
,
'lie_intracode.admin_id'
)
$user
s
=
$userInfoModel
->
leftJoin
(
'lie_intracode'
,
'user_info.userId'
,
'='
,
'lie_intracode.admin_id'
)
->
where
(
'user_info.status'
,
4
)
->
where
(
'lie_intracode.code_id'
,
'!='
,
''
)
->
get
();
return
$user
?
$user
->
toArray
()
:
[];
return
$user
s
?
$users
->
toArray
()
:
[];
}
//获取未离职人员列表
...
...
app/Http/Services/DataService.php
View file @
a02b4b1e
...
...
@@ -1426,7 +1426,9 @@ class DataService
'supplier_code'
,
'supplier_id'
,
'channel_uid'
,
'yunxin_channel_uid'
'yunxin_channel_uid'
,
'create_uid'
,
'create_name'
,
])
->
where
(
'is_type'
,
0
)
->
whereIn
(
'supplier_code'
,
$supplierCodeList
)
->
whereRaw
(
'supplier_name NOT LIKE "%-1"'
)
->
get
()
->
toArray
();
$excelData
=
[];
...
...
@@ -1434,17 +1436,28 @@ class DataService
'供应商名称'
,
'最大金额采购员'
,
'sku采购员'
,
'采购员'
,
'创建人'
,
];
$intraCodeModel
=
new
IntracodeModel
();
$users
=
$intraCodeModel
->
getSampleName
(
true
);
foreach
(
$suppliers
as
$supplier
)
{
$skuUserName
=
$skuUserNameRaw
=
$purchasePurchaseName
=
''
;
$
purchaseNames
=
$
skuUserName
=
$skuUserNameRaw
=
$purchasePurchaseName
=
''
;
if
(
$supplier
[
'yunxin_channel_uid'
])
{
$skuUserNameRaw
=
array_get
(
$users
,
$supplier
[
'yunxin_channel_uid'
]);
$skuUserName
=
$skuUserNameRaw
;
}
if
(
$supplier
[
'create_name'
])
{
$createName
=
$supplier
[
'create_name'
];
}
else
if
(
$supplier
[
'create_uid'
])
{
$createUser
=
(
new
AdminUserService
())
->
getAdminUserInfo
(
$supplier
[
'create_uid'
]);
$createName
=
array_get
(
$createUser
,
'name'
,
''
);
}
if
(
$supplier
[
'channel_uid'
])
{
$purchaseCodeIdList
=
explode
(
','
,
$supplier
[
'channel_uid'
]);
$usersT
=
(
new
AdminUserService
())
->
getAdminUserListByCodeIds
(
$purchaseCodeIdList
);
$purchaseNames
=
array_column
(
$usersT
,
'name'
);
$purchaseNames
=
implode
(
','
,
$purchaseNames
);
$channelUids
=
IntracodeModel
::
whereIn
(
'code_id'
,
$purchaseCodeIdList
)
->
pluck
(
'admin_id'
)
->
toArray
();
//去采购系统找最多金额的用户id
$purchaseAmountMap
=
[];
...
...
@@ -1471,7 +1484,7 @@ class DataService
arsort
(
$purchaseAmountMap
);
if
(
array_values
(
$purchaseAmountMap
)[
0
]
==
0
)
{
$purchasePurchaseName
=
''
;
}
else
{
}
else
{
$maxAmountPurchaseAdminId
=
array_keys
(
$purchaseAmountMap
)[
0
];
$codeId
=
IntracodeModel
::
where
(
'admin_id'
,
$maxAmountPurchaseAdminId
)
->
value
(
'code_id'
);
if
(
$codeId
)
{
...
...
@@ -1491,11 +1504,12 @@ class DataService
$supplier
[
'supplier_name'
],
$purchasePurchaseName
,
$skuUserName
,
$purchaseNames
,
$createName
,
];
$excelData
[]
=
$itemData
;
}
array_unshift
(
$excelData
,
$header
);
dd
(
$excelData
);
Excel
::
create
(
'供应商导出'
,
function
(
$excel
)
use
(
$excelData
)
{
$excel
->
sheet
(
'sheet1'
,
function
(
$sheet
)
use
(
$excelData
)
{
$sheet
->
fromArray
(
$excelData
);
...
...
resources/views/script/SkuListScript.blade.php
View file @
a02b4b1e
...
...
@@ -64,7 +64,7 @@
{
field
:
'encoded_user_name'
,
title
:
'内部采购'
,
align
:
'center'
,
width
:
100
},
{
field
:
'goods_name'
,
title
:
'型号'
,
align
:
'center'
,
width
:
200
,
templet
:
function
(
data
)
{
return
"
<
a
href
=
'{{config('
website
.
FootstoneUrl
')}}/
footstone/addsku?sku
_id=" + data.goods_id + "'
style
=
'color:blue'
target
=
'_blank'
>
"
return
"
<
a
href
=
'{{config('
website
.
FootstoneUrl
')}}/
web/sku/saveSku?goods
_id=" + data.goods_id + "'
style
=
'color:blue'
target
=
'_blank'
>
"
+ data.goods_name + "
<
/href>
"
}
},
...
...
@@ -73,16 +73,21 @@
},
{
field
:
'stock'
,
title
:
'库存数量'
,
align
:
'center'
,
width
:
80
},
{
field
:
'cn_price'
,
title
:
'
国内含币价(¥)
'
,
align
:
'left'
,
width
:
150
,
templet
:
function
(
data
)
{
field
:
'cn_price'
,
title
:
'
人民币成本价(¥)
'
,
align
:
'left'
,
width
:
150
,
templet
:
function
(
data
)
{
if
(
data
.
ladder_price
)
{
let
ladder
=
data
.
ladder_price
[
data
.
ladder_price
.
length
-
1
];
return
'
<
div
class
=
"view_ladder_price_cn layui-row"
><
div
class
=
"layui-col-xs5"
><
span
>
'+ (ladder.purchases) + '
+<
/span></
div
><
div
class
=
"layui-col-xs7"
><
span
>
¥
' + (ladder.price_cn) + '
<
/span></
div
><
/div>'
;
if
(
ladder
)
{
return
'
<
div
class
=
"view_ladder_price_cn layui-row"
><
div
class
=
"layui-col-xs5"
><
span
>
'+ (ladder.purchases) + '
+<
/span></
div
><
div
class
=
"layui-col-xs7"
><
span
>
¥
' + (ladder.price_cn) + '
<
/span></
div
><
/div>'
;
}
else
{
return
''
;
}
}
return
''
;
}
},
{
field
:
'us_price'
,
title
:
'
USD成本价(未税
)'
,
align
:
'left'
,
width
:
150
,
templet
:
function
(
data
)
{
field
:
'us_price'
,
title
:
'
美金成本价($
)'
,
align
:
'left'
,
width
:
150
,
templet
:
function
(
data
)
{
if
(
data
.
ladder_price
)
{
let
ladder
=
data
.
ladder_price
[
data
.
ladder_price
.
length
-
1
];
if
(
ladder
.
price_us
)
{
...
...
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