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
7880b1f3
authored
Apr 22, 2021
by
mushishixian
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
暂时
parent
66bb8d31
Hide whitespace changes
Inline
Side-by-side
Showing
27 changed files
with
336 additions
and
114 deletions
app/Http/Controllers/Api/SupplierApiController.php
app/Http/Controllers/Api/SupplierContactApiController.php
app/Http/Controllers/Filter/SupplierFilter.php
app/Http/Controllers/Filter/SupplierLogFilter.php
app/Http/Controllers/LogController.php
app/Http/Controllers/SupplierController.php
app/Http/Services/AdminUserService.php
app/Http/Services/DepartmentService.php
app/Http/Services/LogService.php
app/Http/Services/SupplierAuditService.php
app/Http/Services/SupplierContactService.php
app/Http/Services/SupplierService.php
app/Http/Transformers/LogTransformer.php
app/Http/Transformers/SupplierTransformer.php
app/Http/Validators/SupplierValidator.php
app/Presenters/Filter/TransformableSelectPresenter.php
config/validate.php
resources/views/errors/error.blade.php
resources/views/script/SupplierListScript.blade.php
resources/views/script/UpdateSupplierScript.blade.php
resources/views/web/AuditSupplier.blade.php
resources/views/web/SupplierDetail.blade.php
resources/views/web/SupplierLog.blade.php
resources/views/web/UpdateSupplier.blade.php
resources/views/web/supplier/SupplierBase.blade.php
resources/views/web/supplier/SupplierListCommon.blade.php
resources/views/web/supplier/SupplierRuler.blade.php
app/Http/Controllers/Api/SupplierApiController.php
View file @
7880b1f3
...
...
@@ -145,9 +145,9 @@ class SupplierApiController extends Controller
//发送队列消息同步到金蝶
$service
=
new
SyncSupplierService
();
$service
->
syncSupplierToErp
(
$supplierId
);
$this
->
response
(
0
,
'
禁用成功
'
);
$this
->
response
(
0
,
'
操作成功,进入审核状态
'
);
}
else
{
$this
->
response
(
-
1
,
'
禁用失败
'
);
$this
->
response
(
-
1
,
'
操作失败,进入审核状态
'
);
}
}
...
...
app/Http/Controllers/Api/SupplierContactApiController.php
View file @
7880b1f3
...
...
@@ -19,15 +19,21 @@ class SupplierContactApiController extends Controller
$this
->
$id
(
$request
,
$id
);
}
//获取供应商
收款信息
//获取供应商
联系人
public
function
GetSupplierContactList
(
$request
)
{
$supplierId
=
$request
->
get
(
'supplier_id'
);
$limit
=
$request
->
get
(
'limit'
,
10
);
$canViewAllSupplierContact
=
checkPerm
(
'ViewAllSupplierContact'
);
$model
=
new
SupplierContactModel
();
$model
->
where
(
'supplier_id'
,
$supplierId
)
->
paginate
();
$list
=
$model
->
where
(
'supplier_id'
,
$supplierId
)
->
orderBy
(
'contact_id'
,
'desc'
)
->
paginate
(
$limit
)
->
toArray
();
$query
=
$model
->
where
(
'supplier_id'
,
$supplierId
)
->
orderBy
(
'contact_id'
,
'desc'
);
//不能查看所有的,就是说只能看绑定的采购的
if
(
!
$canViewAllSupplierContact
)
{
$adminId
=
$request
->
user
->
userId
;
$codeId
=
$request
->
user
->
codeId
;
$query
->
whereRaw
(
"(can_check_uids =
$codeId
or admin_id =
$adminId
)"
);
}
$list
=
$query
->
paginate
(
$limit
)
->
toArray
();
$transformer
=
new
SupplierContactTransformer
();
$list
[
'data'
]
=
$transformer
->
transformList
(
$list
[
'data'
]);
$this
->
response
(
0
,
'ok'
,
$list
[
'data'
],
$list
[
'total'
]);
...
...
@@ -97,12 +103,11 @@ class SupplierContactApiController extends Controller
$this
->
response
(
-
1
,
'删除失败'
);
}
//修改为审核状态
//$supplierModel->where('supplier_id', $supplierId)->update([
// 'update_time' => time(),
// 'status' => 1,
//]);
$supplierModel
=
new
SupplierChannelModel
();
$supplierModel
->
where
(
'supplier_id'
,
$contact
[
'supplier_id'
])
->
update
([
'update_time'
=>
time
(),
'status'
=>
1
,
]);
$this
->
response
(
0
,
'删除成功'
);
}
$this
->
response
(
-
1
,
'找不到删除对象'
);
...
...
app/Http/Controllers/Filter/SupplierFilter.php
View file @
7880b1f3
...
...
@@ -153,7 +153,7 @@ class SupplierFilter
$adminUserService
=
new
AdminUserService
();
$resignedUsers
=
$adminUserService
->
getResignedUsers
();
$resignedUserCodes
=
array_column
(
$resignedUsers
,
'code_id'
);
//因为可以查看
自己部下相关的采购员,开发
员的供应商,所以要构建复杂likeIn语句需要的数据
//因为可以查看
相关的采购
员的供应商,所以要构建复杂likeIn语句需要的数据
//注意下面三个条件最外层要用()包围起来,要不然mysql数据会有问题,具体自己查询mysql的and和or的语法注意事项
$likeSqlRaw
=
implode
(
'|'
,
$resignedUserCodes
);
$query
->
whereRaw
(
DB
::
raw
(
"(channel_uid REGEXP '
$likeSqlRaw
')"
));
...
...
app/Http/Controllers/Filter/SupplierLogFilter.php
View file @
7880b1f3
...
...
@@ -13,7 +13,7 @@ class SupplierLogFilter
public
function
listFilter
(
$query
)
{
$map
=
request
()
->
all
();
$query
=
$query
->
orderBy
(
'
id
'
,
'desc'
);
$query
=
$query
->
orderBy
(
'
add_time
'
,
'desc'
);
$query
=
$this
->
defaultFilter
(
$query
);
return
$query
;
}
...
...
app/Http/Controllers/LogController.php
View file @
7880b1f3
...
...
@@ -4,6 +4,7 @@ namespace App\Http\Controllers;
use
App\Http\Controllers\Filter\LogFilter
;
use
App\Http\Controllers\Filter\SupplierLogFilter
;
use
App\Http\Services\LogService
;
use
App\Model\ApplyExamineUserModel
;
use
App\Model\ApplyModel
;
use
App\Model\DingTalk
;
...
...
@@ -43,9 +44,10 @@ class LogController extends Controller
public
function
SupplierLog
(
$request
)
{
$supplierId
=
$request
->
get
(
'supplier_id'
,
1
);
$logs
=
$this
->
getLogs
(
$supplierId
);
$updateLogs
=
$this
->
getLogs
(
$supplierId
,
LogModel
::
UPDATE_OPERATE
);
$viewLogs
=
$this
->
getLogs
(
$supplierId
,
LogModel
::
VIEW_OPERATE
);
$logService
=
new
LogService
();
$logs
=
$logService
->
getLogs
(
$supplierId
);
$updateLogs
=
$logService
->
getLogs
(
$supplierId
,
LogModel
::
UPDATE_OPERATE
);
$viewLogs
=
$logService
->
getLogs
(
$supplierId
,
LogModel
::
VIEW_OPERATE
);
$supplierLogFilter
=
new
SupplierLogFilter
();
$query
=
$supplierLogFilter
->
listFilter
(
new
SupplierLogModel
());
...
...
@@ -63,18 +65,4 @@ class LogController extends Controller
return
$this
->
view
(
'供应商日志'
);
}
private
function
getLogs
(
$supplierId
,
$type
=
''
)
{
$model
=
new
LogModel
();
$query
=
$model
->
where
(
'id'
,
'>'
,
0
);
//显示默认的数据(有权限逻辑)
$filter
=
new
LogFilter
();
$query
=
$filter
->
defaultFilter
(
$query
);
if
(
$type
)
{
return
$query
->
where
(
'supplier_id'
,
$supplierId
)
->
where
(
'type'
,
$type
)
->
get
();
}
else
{
return
$query
->
where
(
'supplier_id'
,
$supplierId
)
->
get
();
}
}
}
app/Http/Controllers/SupplierController.php
View file @
7880b1f3
...
...
@@ -2,12 +2,14 @@
namespace
App\Http\Controllers
;
use
App\Http\Services\AdminUserService
;
use
App\Http\Services\LogService
;
use
App\Http\Services\RoleService
;
use
App\Http\Services\SupplierContactService
;
use
App\Http\Services\SupplierService
;
use
App\Http\Services\SupplierStatisticsService
;
use
App\Http\Services\ViewCheckService
;
use
App\Http\Transformers\LogTransformer
;
use
App\Http\Transformers\SupplierTransformer
;
use
App\Model\IntracodeModel
;
use
App\Model\LogModel
;
...
...
@@ -77,7 +79,7 @@ class SupplierController extends Controller
//记录查看日志(1个小时内查看的跳过)
$logModel
=
new
LogModel
();
$lastViewAddTime
=
$logModel
->
where
(
'supplier_id'
,
$supplierId
)
->
where
(
'admin_id'
,
$request
->
user
->
userId
)
->
where
(
'type'
,
LogModel
::
VIEW_OPERATE
)
->
orderBy
(
'id'
,
'desc'
)
->
value
(
'add_time'
);
->
where
(
'type'
,
LogModel
::
VIEW_OPERATE
)
->
orderBy
(
'id'
,
'desc'
)
->
value
(
'add_time'
);
$oneHourTimestamp
=
3600
;
if
(
time
()
-
$lastViewAddTime
>
$oneHourTimestamp
)
{
$logService
=
new
LogService
();
...
...
@@ -159,7 +161,13 @@ class SupplierController extends Controller
$model
=
new
SupplierChannelModel
();
$supplier
=
$model
->
where
(
'supplier_id'
,
$supplierId
)
->
first
();
//获取最后一条非分配渠道员的日志
//todo
$logModel
=
new
LogModel
();
$auditContent
=
$logModel
->
where
(
'supplier_id'
,
$supplierId
)
->
where
(
'action'
,
'!='
,
'分配渠道开发员'
)
->
where
(
'type'
,
'!='
,
3
)
->
orderBy
(
'id'
,
'desc'
)
->
first
();
$logTransformer
=
new
LogTransformer
();
$auditContent
=
$logTransformer
->
transformInfo
(
$auditContent
);
$this
->
data
[
'auditContent'
]
=
$auditContent
;
$this
->
data
[
'supplier'
]
=
$supplier
?
$supplier
->
toArray
()
:
[];
return
$this
->
view
(
'审核供应商'
);
}
...
...
@@ -175,6 +183,8 @@ class SupplierController extends Controller
$supplier
=
$transformer
->
transformInfo
(
$supplier
);
$this
->
data
[
'supplier'
]
=
$supplier
;
$intracodeModel
=
new
IntracodeModel
();
$adminUserService
=
new
AdminUserService
();
$users
=
$adminUserService
->
getPurchaseUsers
();
$this
->
data
[
'userCodes'
]
=
$intracodeModel
->
getSampleEncode
();
$logModel
=
new
LogModel
();
$this
->
data
[
'logs'
]
=
$logModel
->
where
(
'supplier_id'
,
$supplierId
)
...
...
app/Http/Services/AdminUserService.php
View file @
7880b1f3
...
...
@@ -46,4 +46,13 @@ class AdminUserService
$intracodeModel
=
new
IntracodeModel
();
return
$intracodeModel
->
whereIn
(
'admin_id'
,
$userIds
)
->
pluck
(
'code_id'
);
}
//获取渠道开发员(运营部)的所有用户信息
public
function
getPurchaseUsers
()
{
$departmentName
=
'运营部'
;
$departmentService
=
new
DepartmentService
();
$departmentId
=
$departmentService
->
getDepartmentId
(
$departmentName
);
return
$departmentService
->
getUserByDepartmentId
(
$departmentId
);
}
}
\ No newline at end of file
app/Http/Services/DepartmentService.php
View file @
7880b1f3
...
...
@@ -2,11 +2,18 @@
namespace
App\Http\Services
;
use
DB
;
//部门数据服务
class
DepartmentService
{
public
function
getDepartmentId
(
$departmentName
)
{
return
DB
::
table
(
'user_department'
)
->
where
(
'department_name'
,
$departmentName
)
->
value
(
'department_id'
);
}
public
function
getSubordinateUserIds
(
$adminId
)
{
$departmentId
=
DB
::
table
(
'user_info'
)
->
where
(
'userId'
,
$adminId
)
->
value
(
'department_id'
);
...
...
@@ -15,19 +22,19 @@ class DepartmentService
}
// 获取部门人员
public
function
getUserByDepartmentId
(
$departmentId
,
$status
=
''
,
$filter
=
''
)
public
function
getUserByDepartmentId
(
$departmentId
,
$status
=
''
,
$filter
=
''
)
{
$departmentIds
=
[];
$this
->
getSubDepartmentId
(
$departmentId
,
$departmentIds
);
return
DB
::
table
(
'user_info'
)
->
whereIn
(
'department_id'
,
$departmentIds
)
->
where
(
function
(
$query
)
use
(
$status
)
{
->
where
(
function
(
$query
)
use
(
$status
)
{
if
(
$status
!==
''
)
{
$query
->
where
(
'status'
,
'='
,
$status
);
}
})
->
where
(
function
(
$query
)
use
(
$filter
)
{
->
where
(
function
(
$query
)
use
(
$filter
)
{
if
(
$filter
)
{
$query
->
whereRaw
(
$filter
);
}
...
...
@@ -40,7 +47,8 @@ class DepartmentService
public
function
getSubDepartmentId
(
$departmentId
,
&
$departmentIds
)
{
// 获取下级部门
$sub_department
=
DB
::
table
(
'user_department'
)
->
where
(
'parent_id'
,
$departmentId
)
->
select
(
'department_id'
,
'department_name'
)
->
get
();
$sub_department
=
DB
::
table
(
'user_department'
)
->
where
(
'parent_id'
,
$departmentId
)
->
select
(
'department_id'
,
'department_name'
)
->
get
();
if
(
$sub_department
)
{
foreach
(
$sub_department
as
$v
)
{
$this
->
getSubDepartmentId
(
$v
[
'department_id'
],
$departmentIds
);
...
...
app/Http/Services/LogService.php
View file @
7880b1f3
...
...
@@ -4,7 +4,11 @@
namespace
App\Http\Services
;
//后台用户相关信息服务
use
App\Http\Controllers\Filter\LogFilter
;
use
App\Http\Transformers\LogTransformer
;
use
App\Http\Transformers\SupplierTransformer
;
use
App\Model\LogModel
;
use
App\Model\SupplierChannelModel
;
use
Illuminate\Support\Facades\DB
;
class
LogService
...
...
@@ -14,6 +18,7 @@ class LogService
public
$fieldMapToLogContent
=
[
'supplier_name'
=>
'供应商名称'
,
];
//添加日志
public
function
AddLog
(
$supplierId
,
$type
,
$action
,
$content
,
$remark
=
''
)
{
...
...
@@ -32,4 +37,70 @@ class LogService
$model
=
new
LogModel
();
$model
->
insert
(
$data
);
}
public
function
getLogs
(
$supplierId
,
$type
=
''
,
$limit
=
100
)
{
$model
=
new
LogModel
();
$query
=
$model
->
where
(
'id'
,
'>'
,
0
);
//显示默认的数据(有权限逻辑)
$filter
=
new
LogFilter
();
$query
=
$filter
->
defaultFilter
(
$query
);
if
(
$type
)
{
$logs
=
$query
->
where
(
'supplier_id'
,
$supplierId
)
->
where
(
'type'
,
$type
)
->
limit
(
$limit
)
->
get
();
}
else
{
$logs
=
$query
->
where
(
'supplier_id'
,
$supplierId
)
->
limit
(
$limit
)
->
get
();
}
$transformer
=
new
LogTransformer
();
$logs
=
$transformer
->
transformList
(
$logs
);
return
$logs
;
}
//比对供应商修改前后的变化数据
public
function
compareSupplierChange
(
$newSupplier
,
$oldSupplier
)
{
$transformer
=
new
SupplierTransformer
();
$newSupplier
=
$transformer
->
transformInfo
(
$newSupplier
);
$oldSupplier
=
$transformer
->
transformInfo
(
$oldSupplier
);
//二维数组转成一维数组,因为array_diff只支持一维,反正二维的内容还要更细致的比较
$newSupplier
=
array_map
(
function
(
$value
)
{
if
(
is_array
(
$value
))
{
$value
=
json_encode
(
$value
);
}
return
$value
;
},
$newSupplier
);
$oldSupplier
=
array_map
(
function
(
$value
)
{
if
(
is_array
(
$value
))
{
$value
=
json_encode
(
$value
);
}
return
$value
;
},
$oldSupplier
);
$diff
=
array_diff
(
$newSupplier
,
$oldSupplier
);
$result
=
[];
foreach
(
$diff
as
$key
=>
$item
)
{
$columnMap
=
config
(
'validate.SupplierNeedLogColumn'
);
if
(
in_array
(
$key
,
array_keys
(
$columnMap
)))
{
$oldValue
=
array_get
(
$oldSupplier
,
$key
,
'空'
);
$newValue
=
array_get
(
$newSupplier
,
$key
,
'空'
);
$content
=
array_get
(
$columnMap
,
$key
)
.
'由 [ '
.
$oldValue
.
' ] 改成 [ '
.
$newValue
.
' ]'
;
}
else
{
// switch ($key) {
// case 'qualification_photos':
// $newSupplier['qualification_photos'] = json_decode($newSupplier['qualification_photos'], true);
// $oldSupplier['qualification_photos'] = json_decode($oldSupplier['qualification_photos'], true);
//// dd(array_diff($newSupplier['qualification_photos'],$oldSupplier['qualification_photos']));
// case 'extra_fee':
// $newSupplier['extra_fee'] = json_decode($newSupplier['extra_fee'], true);
// $oldSupplier['extra_fee'] = json_decode($oldSupplier['extra_fee'], true);
//// dd(array_diff($newSupplier['extra_fee'],$oldSupplier['extra_fee']));
// }
}
if
(
!
empty
(
$content
))
{
$result
[]
=
$content
;
}
$result
=
array_unique
(
$result
);
}
return
$result
;
}
}
\ No newline at end of file
app/Http/Services/SupplierAuditService.php
View file @
7880b1f3
...
...
@@ -5,6 +5,7 @@ namespace App\Http\Services;
use
App\Http\Transformers\SupplierTransformer
;
use
App\Model\LogModel
;
use
App\Model\RedisModel
;
use
App\Model\SupplierAddressModel
;
use
App\Model\SupplierChannelModel
;
use
App\Model\SupplierContactModel
;
...
...
@@ -15,14 +16,32 @@ class SupplierAuditService
public
function
auditSupplier
(
$supplierId
,
$status
,
$rejectReason
)
{
$model
=
new
SupplierChannelModel
();
//判断当前要审核的供应商是不是想要被禁用的
$redis
=
new
RedisModel
();
$disableExist
=
$redis
->
hget
(
'audit_disable_supplier_list'
,
$supplierId
);
if
(
$disableExist
)
{
if
(
$status
==
2
)
{
$status
=
SupplierChannelModel
::
STATUS_DISABLE
;
}
else
{
$status
=
2
;
}
}
$result
=
$model
->
where
(
'supplier_id'
,
$supplierId
)
->
update
([
'update_time'
=>
time
(),
'status'
=>
$status
,
'reject_reason'
=>
$rejectReason
,
]);
if
(
$disableExist
)
{
$redis
->
hdel
(
'audit_disable_supplier_list'
,
$supplierId
);
}
if
(
$result
)
{
//记录日志
$auditStatus
=
$status
==
2
?
'审核通过'
:
'审核不通过,原因是 : '
.
$rejectReason
;
if
(
$disableExist
)
{
$auditStatus
=
$status
==
-
2
?
'审核通过,禁用供应商'
:
'审核不通过,原因是 : '
.
$rejectReason
;
}
else
{
$auditStatus
=
$status
==
2
?
'审核通过'
:
'审核不通过,原因是 : '
.
$rejectReason
;
}
$logService
=
new
LogService
();
$content
=
$auditStatus
;
$logService
->
AddLog
(
$supplierId
,
LogModel
::
UPDATE_OPERATE
,
'审核供应商'
,
$content
);
...
...
app/Http/Services/SupplierContactService.php
View file @
7880b1f3
...
...
@@ -56,6 +56,7 @@ class SupplierContactService
$result
=
$model
->
where
(
'contact_id'
,
$contact
[
'contact_id'
])
->
update
(
$contact
);
}
else
{
$contact
[
'add_time'
]
=
time
();
$contact
[
'admin_id'
]
=
request
()
->
user
->
userId
;
$result
=
$model
->
insert
(
$contact
);
}
//不存在则写入
...
...
@@ -67,12 +68,12 @@ class SupplierContactService
'update_time'
=>
time
(),
]);
if
(
$result
)
{
//
//修改供应商为审核状态
//
$supplierModel = new SupplierChannelModel();
//
$supplierModel->where('supplier_id', $contact['supplier_id'])->update([
//
'update_time' => time(),
//
'status' => 1,
//
]);
//修改供应商为审核状态
$supplierModel
=
new
SupplierChannelModel
();
$supplierModel
->
where
(
'supplier_id'
,
$contact
[
'supplier_id'
])
->
update
([
'update_time'
=>
time
(),
'status'
=>
1
,
]);
$logService
=
new
LogService
();
$content
=
!
empty
(
$contact
[
'contact_id'
])
?
'修改联系人'
:
'添加联系人'
;
$remark
=
json_encode
(
$contact
);
...
...
app/Http/Services/SupplierService.php
View file @
7880b1f3
...
...
@@ -14,6 +14,8 @@ use Illuminate\Support\Facades\DB;
class
SupplierService
{
public
$newSupplierId
=
0
;
public
function
getSupplier
(
$supplierId
)
{
$model
=
new
SupplierChannelModel
();
...
...
@@ -64,8 +66,17 @@ class SupplierService
unset
(
$channel
[
'upload_file'
]);
$channel
[
'established_time'
]
=
strtotime
(
$channel
[
'established_time'
]);
$channel
[
'sku_upload_ruler'
]
=
$this
->
getSkuRulerData
(
$channel
[
'sku_upload_ruler'
]);
$logService
=
new
LogService
();
$model
=
new
SupplierChannelModel
();
//获取未修改前的供应商,做数据比较存储
$oldSupplier
=
$newSupplier
=
[];
if
(
!
empty
(
$channel
[
'supplier_id'
])){
$oldSupplier
=
$model
->
where
(
'supplier_id'
,
$channel
[
'supplier_id'
])
->
first
();
}
//走事务
return
DB
::
connection
(
'web'
)
->
transaction
(
function
()
use
(
$channel
)
{
$dataResult
=
DB
::
connection
(
'web'
)
->
transaction
(
function
()
use
(
$channel
)
{
$model
=
new
SupplierChannelModel
();
$extraFax
=
[
'supplier_id'
=>
$channel
[
'supplier_id'
],
...
...
@@ -91,45 +102,39 @@ class SupplierService
return
$value
;
},
$channel
);
$channel
[
'status'
]
=
SupplierChannelModel
::
STATUS_PENDING
;
$supplierId
=
$model
->
insertGetId
(
$channel
);
$supplierId
=
$
this
->
newSupplierId
=
$
model
->
insertGetId
(
$channel
);
$this
->
saveSupplierCode
(
$supplierId
);
$logAction
=
"新增供应商"
;
$logContent
=
'新增供应商'
;
$newSupplier
=
$model
->
where
(
'supplier_id'
,
$supplierId
)
->
first
();
$logRemark
=
json_encode
(
$newSupplier
);
}
else
{
$supplierAddressService
=
new
SupplierAddressService
();
$supplierAddressService
->
saveAddress
(
$address
);
$extraFaxService
=
new
SupplierExtraFeeService
();
$extraFaxService
->
saveSupplierExtraFee
(
$extraFax
);
$supplierId
=
$channel
[
'supplier_id'
];
$oldSupplier
=
$model
->
where
(
'supplier_id'
,
$supplierId
)
->
first
();
$supplierId
=
$this
->
newSupplierId
=
$channel
[
'supplier_id'
];
$channel
[
'status'
]
=
SupplierChannelModel
::
STATUS_IN_REVIEW
;
$model
->
where
(
'supplier_id'
,
$supplierId
)
->
update
(
$channel
);
$newSupplier
=
$model
->
where
(
'supplier_id'
,
$supplierId
)
->
first
();
$this
->
saveSupplierCode
(
$supplierId
);
$logAction
=
"更新供应商"
;
$logContent
=
"更新供应商"
;
$logRemark
=
json_encode
([
'old'
=>
$oldSupplier
,
'new'
=>
$newSupplier
]);
}
//插入系数到redis
$this
->
saveRatioToRedis
(
$supplierId
);
//重新生成外部显示的编码
$supplierSn
=
$this
->
generateSupplierSn
(
$supplierId
,
$channel
[
'supplier_group'
]);
//保存日志
$logService
=
new
LogService
();
$logType
=
!
empty
(
$channel
[
'supplier_id'
])
?
LogModel
::
UPDATE_OPERATE
:
LogModel
::
ADD_OPERATE
;
$logService
->
AddLog
(
$supplierId
,
$logType
,
$logAction
,
$logContent
,
$logRemark
);
//修改数据
$model
->
where
(
'supplier_id'
,
$supplierId
)
->
update
([
'supplier_sn'
=>
$supplierSn
]);
// $messageService = new MessageService();
// $messageService->sendSupplierMessage($supplierId, $channel['status']);
return
true
;
});
//如果是重新入驻的,写重新入驻的日志
//保存日志
$newSupplier
=
$model
->
where
(
'supplier_id'
,
$this
->
newSupplierId
)
->
first
();
$logType
=
!
empty
(
$channel
[
'supplier_id'
])
?
LogModel
::
UPDATE_OPERATE
:
LogModel
::
ADD_OPERATE
;
$logAction
=
!
empty
(
$channel
[
'supplier_id'
])
?
"修改供应商基本资料"
:
"新增供应商"
;
$logContent
=
!
empty
(
$channel
[
'supplier_id'
])
?
'修改供应商'
:
'新增供应商'
;
$logService
->
AddLog
(
$this
->
newSupplierId
,
$logType
,
$logAction
,
$logContent
,
json_encode
([
'old_supplier'
=>
$oldSupplier
,
'new_supplier'
=>
$newSupplier
]));
return
$dataResult
;
}
public
function
getPhotosData
(
$uploadFiles
)
...
...
@@ -240,7 +245,7 @@ class SupplierService
//还要去记录日志
$adminUserService
=
new
AdminUserService
();
$prePurchaseUser
=
$adminUserService
->
getAdminUserInfoByCodeId
(
$prePurchaseUid
);
$prePurchaseUserName
=
array_get
(
$prePurchaseUser
,
'name'
,
''
);
$prePurchaseUserName
=
array_get
(
$prePurchaseUser
,
'name'
,
'
'
);
$purchaseUser
=
$adminUserService
->
getAdminUserInfoByCodeId
(
$purchaseUid
);
$purchaseUserName
=
array_get
(
$purchaseUser
,
'name'
,
''
);
$logService
=
new
LogService
();
...
...
app/Http/Transformers/LogTransformer.php
View file @
7880b1f3
...
...
@@ -4,17 +4,34 @@
namespace
App\Http\Transformers
;
use
App\Http\Services\LogService
;
class
LogTransformer
{
public
function
transformList
(
$list
)
{
foreach
(
$list
as
&
$item
)
{
$item
[
'add_time'
]
=
date
(
'Y-m-d H:i:s'
,
$item
[
'add_time'
]
);
$item
[
'type'
]
=
array_get
(
config
(
'fixed.LogType'
),
$item
[
'type
'
]);
$item
=
$this
->
transformInfo
(
$item
);
unset
(
$item
[
'remark
'
]);
}
unset
(
$item
);
return
$list
;
}
public
function
transformInfo
(
$item
)
{
$item
[
'add_time'
]
=
date
(
'Y-m-d H:i:s'
,
$item
[
'add_time'
]);
$item
[
'type'
]
=
array_get
(
config
(
'fixed.LogType'
),
$item
[
'type'
]);
//如果action是修改供应商,就要做对比处理
if
(
$item
[
'action'
]
===
'修改供应商基本资料'
)
{
$logService
=
new
LogService
();
$remark
=
json_decode
(
$item
[
'remark'
],
true
);
$oldSupplier
=
array_get
(
$remark
,
'old_supplier'
);
$newSupplier
=
array_get
(
$remark
,
'new_supplier'
);
$content
=
$logService
->
compareSupplierChange
(
$newSupplier
,
$oldSupplier
);
$item
[
'content'
]
=
$content
;
}
return
$item
;
}
}
\ No newline at end of file
app/Http/Transformers/SupplierTransformer.php
View file @
7880b1f3
...
...
@@ -138,6 +138,8 @@ class SupplierTransformer
private
function
transformDeliveryTimeData
(
$supplier
)
{
$supplier
[
'cn_delivery_time_full'
]
=
$supplier
[
'cn_delivery_time'
];
$supplier
[
'us_delivery_time_full'
]
=
$supplier
[
'us_delivery_time'
];
$supplier
[
'cn_delivery_time_period'
]
=
strpos
(
$supplier
[
'cn_delivery_time'
],
'天'
)
!==
false
?
'天'
:
'周'
;
$supplier
[
'us_delivery_time_period'
]
=
strpos
(
$supplier
[
'us_delivery_time'
],
'天'
)
!==
false
?
'天'
:
'周'
;
$supplier
[
'cn_delivery_time'
]
=
str_replace
(
'天'
,
''
,
$supplier
[
'cn_delivery_time'
]);
...
...
app/Http/Validators/SupplierValidator.php
View file @
7880b1f3
...
...
@@ -86,7 +86,7 @@ class SupplierValidator
'supplier_name.required'
=>
'供应商名称不能为空'
,
'stockup_type.required'
=>
'合作类型不能为空'
,
'register_company_name.required'
=>
'注册公司名不能为空'
,
'supplier_group.required'
=>
'
行业
性质不能为空'
,
'supplier_group.required'
=>
'
公司
性质不能为空'
,
'region.required'
=>
'所在区域不能为空'
,
'purchase_uid.required'
=>
'渠道开发员不能为空'
,
'cn_ratio.min'
=>
'人民币系数必须是大于1的浮点数'
,
...
...
app/Presenters/Filter/TransformableSelectPresenter.php
View file @
7880b1f3
...
...
@@ -22,7 +22,7 @@ class TransformableSelectPresenter
</div>
<div class="layui-col-md7" style="margin-left: -3px">
<div class="layui-input-inline">
<select class="value_select" name="$defaultKey" lay-filter="$selectUnique">
<select class="value_select" name="$defaultKey" lay-filter="$selectUnique"
lay-search=""
>
{$this->selectOptionsRender($data)}
</select>
</div>
...
...
config/validate.php
View file @
7880b1f3
...
...
@@ -11,5 +11,36 @@ return [
'supplier_group'
=>
'公司性质'
,
'business_license'
=>
'营业执照'
,
'contact'
=>
'联系方式'
,
],
//供应商需要记录日志字段对应的中文
'SupplierNeedLogColumn'
=>
[
'supplier_name'
=>
'供应商名称'
,
'stockup_type'
=>
'合作方式'
,
'pay_type_name'
=>
'付款类型'
,
'supplier_address'
=>
'公司详细地址'
,
'currency_name'
=>
'默认结算币种'
,
'remark'
=>
'附加备注'
,
'supplier_group_name'
=>
'供应商分组'
,
'channel_user_name'
=>
'采购员'
,
'purchase_user_name'
=>
'开发员'
,
'tax_number'
=>
'税务登记号'
,
'cn_ratio'
=>
'人民币系数'
,
'us_ratio'
=>
'美金系数'
,
'is_type'
=>
'转正供应商'
,
'supplier_name_en'
=>
'供应商英文名称'
,
'main_brand_names'
=>
'主营品牌'
,
'region_name'
=>
'所属区域'
,
'legal_representative'
=>
'法人代表'
,
'established_time'
=>
'公司成立时间'
,
'credit_investigation'
=>
'资信调查'
,
// 'qualification_photos' => '资质照片',
'sku_upload_ruler'
=>
'上传sku的规则'
,
'register_company_name'
=>
'注册公司名'
,
'trading_method_name'
=>
'交易方式'
,
'channel_username'
=>
'采购员'
,
'purchase_username'
=>
'渠道开发员'
,
'us_delivery_time_full'
=>
'香港交期'
,
'cn_delivery_time_full'
=>
'国内交期'
,
]
];
\ No newline at end of file
resources/views/errors/error.blade.php
View file @
7880b1f3
...
...
@@ -12,6 +12,7 @@
</head>
<body
class=
"gray-bg"
>
<div
style=
"text-align: center"
>
<div
class=
"middle-box text-center animated fadeInDown"
>
<h1>
{{$errcode}}
</h1>
<h3
class=
"font-bold"
>
{{$errinfo}}
</h3>
...
...
@@ -19,10 +20,14 @@
@if(!empty($url))
<div
class=
"error-desc"
>
没有访问权限
<br/>
请前往权限系统申请权限
<br/>
请前往权限系统申请权限
<br/>
<br/>
<a
href=
"{{$url}}"
target=
"_blank"
><i
class=
"fa fa-mail-reply"
></i>
Go
</a>
</div>
@endif
</div>
</div>
</body>
</html>
resources/views/script/SupplierListScript.blade.php
View file @
7880b1f3
...
...
@@ -24,7 +24,6 @@
,
where
:
whereCondition
});
});
let
cols
=
[
{
type
:
'radio'
},
{
field
:
'supplier_id'
,
title
:
'供应商ID'
,
align
:
'center'
,
width
:
80
},
...
...
resources/views/script/UpdateSupplierScript.blade.php
View file @
7880b1f3
...
...
@@ -12,7 +12,13 @@
});
form
.
on
(
'submit(updateSupplier)'
,
function
(
data
)
{
layer
.
confirm
(
'确定要修改供应商信息吗?一旦修改,该供应商就会再次进入审核阶段'
,
function
(
index
)
{
let
confirmMessage
=
''
;
if
(
data
.
status
===
-
2
)
{
confirmMessage
=
'确定要重新入驻吗,该供应商就会再次进入审核阶段'
}
else
{
confirmMessage
=
'确定要修改供应商信息吗?一旦修改,该供应商就会再次进入审核阶段'
}
layer
.
confirm
(
confirmMessage
,
function
(
index
)
{
let
res
=
ajax
(
'/api/supplier/UpdateSupplier'
,
data
.
field
)
if
(
res
.
err_code
===
0
)
{
table
.
reload
(
'receiptList'
)
...
...
resources/views/web/AuditSupplier.blade.php
View file @
7880b1f3
...
...
@@ -9,16 +9,23 @@
<input
type=
"hidden"
name=
"supplier_id"
value=
"{{$supplier['supplier_id']}}"
>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
>
基本信息 :
</label>
<div
class=
"layui-input-
inline
"
>
<div
class=
"layui-input-
block block-42"
style=
"padding-top: 7px
"
>
{{$supplier['supplier_name']}}
<a
style=
"color: dodgerblue;margin-left: 20px"
href=
"/supplier/SupplierDetail?view=iframe&supplier_id={{$supplier['supplier_id']}}"
>
{{$supplier['supplier_code']}}
</a>
ew-href=
"/supplier/SupplierDetail?view=iframe&supplier_id={{$supplier['supplier_id']}}"
ew-title=
'供应商详情 - {{$supplier['
supplier_code
']}}'
>
{{$supplier['supplier_code']}}
</a>
</div>
</div>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
>
审核内容 :
</label>
<div
class=
"layui-input-inline"
>
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
<div
class=
"layui-input-block block-42"
style=
"padding-top: 7px"
>
{{$auditContent['action'] .' : '}}
@if(is_array($auditContent['content']))
@foreach($auditContent['content'] as $content)
{{$content}} ;
@endforeach
@endif
</div>
</div>
<div
class=
"layui-form-item"
>
...
...
resources/views/web/SupplierDetail.blade.php
View file @
7880b1f3
<style>
.fix-top
{
height
:
140px
;
margin-top
:
15px
;
padding
:
10px
15px
;
margin-top
:
0
;
margin-left
:
-30px
;
padding
:
10px
45px
;
position
:
fixed
;
top
:
0
;
background
:
white
;
...
...
@@ -37,7 +38,10 @@
合作类型 :{{$supplier['stockup_type_name']}}
</div>
<div
class=
"layui-col-md8"
></div>
<div
class=
"layui-col-md3"
>
采购员 : {{$supplier['channel_username']}}
</div>
<div
class=
"layui-col-md5"
></div>
</div>
@if($supplier['status']==\App\Model\SupplierChannelModel::STATUS_PENDING
||$supplier['status']==\App\Model\SupplierChannelModel::STATUS_PASSED
...
...
@@ -55,8 +59,13 @@
style=
"margin-bottom: 25px;margin-top: 5px"
class=
"layui-btn layui-btn"
>
申请重新入驻
</a>
</div>
@endif
@if($supplier['status']==\App\Model\SupplierChannelModel::STATUS_IN_REVIEW)
<div
class=
"layui-row"
>
<button
type=
"button"
style=
"margin-bottom: 25px;margin-top: 5px"
class=
"layui-btn layui-btn layui-btn-disabled"
>
审核中,不能修改
</button>
</div>
@endif
</div>
<div
class=
"layui-card-body"
style=
"margin-top: 1
6
0px"
>
<div
class=
"layui-card-body"
style=
"margin-top: 1
4
0px"
>
<div
class=
"layui-tab"
>
<ul
class=
"layui-tab-title"
>
<li
class=
"layui-this"
id=
"base_info"
>
基本信息
</li>
...
...
resources/views/web/SupplierLog.blade.php
View file @
7880b1f3
...
...
@@ -43,39 +43,58 @@
<div
id=
"logs"
style=
"margin-left: 5px"
>
{{--所有操作记录列表查看--}}
@foreach($logs as $log)
<p>
{{$log['action']}} : {{$log['content']}}
</p>
<p
style=
"color: grey"
>
{{date('Y-m-d H:i:s',$log['add_time']).' '.$log['admin_name']}}
</p>
@if(is_array($log['content']))
<p>
{{$log['action']}} :
</p>
@foreach($log['content'] as $content)
<p>
{{$content}}
</p>
@endforeach
@else
<p>
{{$log['action']}} : {{$log['content']}}
</p>
@endif
<p
style=
"color: grey"
>
{{$log['add_time'].' '.$log['admin_name']}}
</p>
<hr/>
@endforeach
</div>
@endif
</div>
<div
class=
"layui-tab-item"
>
@if(checkPerm('View
All
Log'))
@if(checkPerm('View
Update
Log'))
@foreach($updateLogs as $log)
<p>
{{$log['content']}}
</p>
<p
style=
"color: grey"
>
{{date('Y-m-d H:i:s',$log['add_time']).' '.$log['admin_name']}}
</p>
@if(is_array($log['content']))
<p>
{{$log['action']}} :
</p>
@foreach($log['content'] as $content)
<p>
{{$content}}
</p>
@endforeach
@else
<p>
{{$log['action']}} : {{$log['content']}}
</p>
@endif
<hr/>
@endforeach
@endif
</div>
<div
class=
"layui-tab-item"
>
@if(checkPerm('ViewAllLog'))
@foreach($viewLogs as $log)
<p>
{{$log['content']}}
</p>
<p
style=
"color: grey"
>
{{date('Y-m-d H:i:s',$log['add_time']).' '.$log['admin_name']}}
</p>
<hr/>
@endforeach
@if(checkPerm('ViewLog'))
@foreach($viewLogs as $log)
@if(is_array($log['content']))
<p>
{{$log['action']}} :
</p>
@foreach($log['content'] as $content)
<p>
{{$content}}
</p>
@endforeach
@else
<p>
{{$log['action']}} : {{$log['content']}}
</p>
@endif
<hr/>
@endforeach
@endif
</div>
<div
class=
"layui-tab-item"
>
@if(checkPerm('View
All
Log'))
@foreach($supplierLogs as $log)
<p>
{{$log['desc']}}
</p>
<p
style=
"color: grey"
>
{{date('Y-m-d H:i:s',$log['add_time'])
.' '.$log['admin_name']}}
</p>
<hr/>
@endforeach
@endif
@if(checkPerm('View
Supplier
Log'))
@foreach($supplierLogs as $log)
<p>
{{$log['desc']}}
</p>
<p
style=
"color: grey"
>
{{$log['add_time']
.' '.$log['admin_name']}}
</p>
<hr/>
@endforeach
@endif
</div>
</div>
</div>
...
...
resources/views/web/UpdateSupplier.blade.php
View file @
7880b1f3
...
...
@@ -14,8 +14,9 @@
.fix-top
{
height
:
140px
;
margin-top
:
15px
;
padding
:
10px
15px
;
margin-top
:
0
;
margin-left
:
-30px
;
padding
:
10px
45px
;
position
:
fixed
;
top
:
0
;
background
:
white
;
...
...
@@ -58,7 +59,10 @@
<div
class=
"layui-col-md2"
>
合作类型:{{$supplier['stockup_type_name']}}
</div>
<div
class=
"layui-col-md8"
></div>
<div
class=
"layui-col-md3"
>
采购员 : {{$supplier['channel_username']}}
</div>
<div
class=
"layui-col-md5"
></div>
</div>
<div
class=
"layui-row"
style=
"margin-bottom: 25px;margin-top: 5px"
>
<button
type=
"button"
class=
"layui-btn layui-btn"
lay-submit
...
...
@@ -69,7 +73,7 @@
class=
"layui-btn layui-btn-primary"
>
取消
</a>
</div>
</div>
<div
class=
"layui-card-body"
style=
"margin-top: 1
6
0px"
>
<div
class=
"layui-card-body"
style=
"margin-top: 1
4
0px"
>
<input
type=
"hidden"
name=
"supplier_id"
value=
"{{$supplier['supplier_id']}}"
>
<input
type=
"hidden"
name=
"supplier_code"
value=
"{{$supplier['supplier_code']}}"
>
<div
class=
"layui-tab"
>
...
...
resources/views/web/supplier/SupplierBase.blade.php
View file @
7880b1f3
...
...
@@ -16,7 +16,7 @@
<label
class=
"layui-form-label"
><span
class=
"require"
>
*
</span>
注册公司名 :
</label>
<div
class=
"layui-input-block"
>
<input
type=
"text"
name=
"register_company_name"
id=
"register_company_name"
placeholder=
"请输入注册公司名
,注册公司名一旦设置,后续无法更改
"
class=
"layui-input @if(!empty($supplier))layui-disabled @endif"
placeholder=
"请输入注册公司名"
class=
"layui-input @if(!empty($supplier))layui-disabled @endif"
value=
"{{$supplier['register_company_name'] or ''}}"
>
</div>
</div>
...
...
resources/views/web/supplier/SupplierListCommon.blade.php
View file @
7880b1f3
...
...
@@ -8,7 +8,9 @@
<div
class=
"layui-card-body"
style=
"padding: 0;"
>
<div
class=
"split-group"
style=
"height: 130px;"
>
<div
class=
"split-item"
id=
"s1"
>
<a
class=
"main_filter layui-badge layui-bg-green"
id=
"all"
>
全部({{$statistics['total']}})
</a>
<div
class=
"layui-row"
>
<a
class=
"main_filter layui-badge layui-bg-green"
id=
"all"
>
全部({{$statistics['total']}})
</a>
</div>
</div>
<div
class=
"split-item"
id=
"s2"
style=
"text-align: center"
>
@if(checkPerm('SupplierPendingList'))
...
...
resources/views/web/supplier/SupplierRuler.blade.php
View file @
7880b1f3
...
...
@@ -124,14 +124,14 @@
</div>
</div>
<div
class=
"layui-form-item"
>
<div
class=
"layui-inline"
>
<label
class=
"layui-form-label"
>
审核内容配置 :
</label>
<div
class=
"layui-input-inline"
style=
"width: 50px"
>
{{--
<div
class=
"layui-form-item"
>
--}}
{{--
<div
class=
"layui-inline"
>
--}}
{{--
<label
class=
"layui-form-label"
>
审核内容配置 :
</label>
--}}
{{--
<div
class=
"layui-input-inline"
style=
"width: 50px"
>
--}}
</div>
</div>
</div>
{{--
</div>
--}}
{{--
</div>
--}}
{{--
</div>
--}}
@include('script.supplier.SupplierRulerScript')
\ No newline at end of file
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