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
f3014987
authored
Apr 21, 2021
by
mushishixian
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
审核状态
parent
aef138ec
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
75 additions
and
25 deletions
app/Http/Controllers/Api/SupplierContactApiController.php
app/Http/Controllers/Api/SupplierReceiptApiController.php
app/Http/Controllers/LogController.php
app/Http/Services/SupplierContactService.php
app/Http/Services/SupplierService.php
app/Http/Transformers/SupplierTransformer.php
app/Http/Validators/SupplierValidator.php
app/Model/SupplierChannelModel.php
resources/views/script/SupplierDetailScript.blade.php
resources/views/script/supplier/SupplierFileScript.blade.php
resources/views/web/SupplierDetail.blade.php
resources/views/web/UpdateSupplier.blade.php
resources/views/web/supplier/SupplierBase.blade.php
app/Http/Controllers/Api/SupplierContactApiController.php
View file @
f3014987
...
...
@@ -7,6 +7,7 @@ use App\Http\Services\LogService;
use
App\Http\Services\SupplierContactService
;
use
App\Http\Transformers\SupplierContactTransformer
;
use
App\Http\Validators\SupplierContactValidator
;
use
App\Model\SupplierChannelModel
;
use
App\Model\SupplierContactModel
;
use
Illuminate\Http\Request
;
...
...
@@ -69,6 +70,12 @@ class SupplierContactApiController extends Controller
if
(
!
$result
)
{
$this
->
response
(
-
1
,
'删除失败'
);
}
$supplierId
=
$model
->
where
(
'contact_id'
,
$contactId
)
->
value
(
'supplier_id'
);
$supplierModel
=
new
SupplierChannelModel
();
$supplierModel
->
where
(
'supplier_id'
,
$supplierId
)
->
update
([
'update_time'
=>
time
(),
'status'
=>
1
,
]);
$this
->
response
(
0
,
'删除成功'
);
}
$this
->
response
(
-
1
,
'找不到删除对象'
);
...
...
app/Http/Controllers/Api/SupplierReceiptApiController.php
View file @
f3014987
...
...
@@ -8,6 +8,7 @@ use App\Http\Transformers\LogTransformer;
use
App\Http\Transformers\ReceiptTransformer
;
use
App\Http\Validators\ReceiptValidator
;
use
App\Model\LogModel
;
use
App\Model\SupplierChannelModel
;
use
App\Model\SupplierReceiptModel
;
use
Illuminate\Http\Request
;
...
...
@@ -66,6 +67,12 @@ class SupplierReceiptApiController extends Controller
$result
=
$model
->
insert
(
$receipt
);
}
if
(
$result
)
{
//供应商变成待审核
$supplierModel
=
new
SupplierChannelModel
();
$supplierModel
->
where
(
'supplier_id'
,
$supplierId
)
->
update
([
'update_time'
=>
time
(),
'status'
=>
1
,
]);
$logService
=
new
LogService
();
$content
=
!
empty
(
$receipt
[
'receipt_id'
])
?
'修改银行信息'
:
'添加银行信息'
;
$remark
=
json_encode
(
$receipt
);
...
...
@@ -82,6 +89,13 @@ class SupplierReceiptApiController extends Controller
$model
=
new
SupplierReceiptModel
();
$result
=
$model
->
where
(
'receipt_id'
,
$receiptId
)
->
delete
();
if
(
$result
)
{
//修改供应商为审核状态
$supplierId
=
$model
->
where
(
'receipt_id'
,
$receiptId
)
->
value
(
'supplier_id'
);
$supplierModel
=
new
SupplierChannelModel
();
$supplierModel
->
where
(
'supplier_id'
,
$supplierId
)
->
update
([
'update_time'
=>
time
(),
'status'
=>
1
,
]);
$this
->
response
(
0
,
'操作成功'
);
}
$this
->
response
(
-
1
,
'操作失败'
);
...
...
app/Http/Controllers/LogController.php
View file @
f3014987
...
...
@@ -40,14 +40,13 @@ class LogController extends Controller
public
function
SupplierLog
(
$request
)
{
$supplierId
=
$request
->
get
(
'supplier_id'
,
1
);
$supplierId
=
$request
->
get
(
'supplier_id'
,
1
);
$logModel
=
new
LogModel
();
// $logs = $logModel->where('supplier_id', $supplierId)->get();
$logs
=
$logModel
->
orderBy
(
'id'
,
'desc'
)
->
get
();
$updateLogs
=
$logModel
->
orderBy
(
'id'
,
'desc'
)
->
get
();
$viewLogs
=
$logModel
->
orderBy
(
'id'
,
'desc'
)
->
get
();
$logs
=
$logModel
->
where
(
'supplier_id'
,
$supplierId
)
->
orderBy
(
'id'
,
'desc'
)
->
get
();
$updateLogs
=
$logModel
->
where
(
'supplier_id'
,
$supplierId
)
->
where
(
'type'
,
LogModel
::
UPDATE_OPERATE
)
->
orderBy
(
'id'
,
'desc'
)
->
get
();
$viewLogs
=
$logModel
->
where
(
'supplier_id'
,
$supplierId
)
->
where
(
'type'
,
LogModel
::
VIEW_OPERATE
)
->
orderBy
(
'id'
,
'desc'
)
->
get
();
$supplierLogModel
=
new
SupplierLogModel
();
$supplierLogs
=
$supplierLogModel
->
orderBy
(
'id'
,
'desc'
)
->
get
();
$supplierLogs
=
$supplierLogModel
->
where
(
'supplier_id'
,
$supplierId
)
->
orderBy
(
'id'
,
'desc'
)
->
get
();
$this
->
data
[
'logs'
]
=
$logs
;
$this
->
data
[
'supplierId'
]
=
$supplierId
;
$this
->
data
[
'updateLogs'
]
=
$updateLogs
;
...
...
app/Http/Services/SupplierContactService.php
View file @
f3014987
...
...
@@ -5,6 +5,7 @@ namespace App\Http\Services;
use
App\Model\LogModel
;
use
App\Model\SupplierChannelModel
;
use
App\Model\SupplierContactModel
;
class
SupplierContactService
...
...
@@ -49,10 +50,19 @@ class SupplierContactService
$contact
[
'add_time'
]
=
time
();
$result
=
$model
->
insert
(
$contact
);
}
$logService
=
new
LogService
();
$content
=
!
empty
(
$contact
[
'contact_id'
])
?
'修改联系人'
:
'添加联系人'
;
$remark
=
json_encode
(
$contact
);
$logService
->
AddLog
(
$contact
[
'supplier_id'
],
LogModel
::
UPDATE_OPERATE
,
'修改供应商基本资料'
,
$content
,
$remark
);
if
(
$result
)
{
//修改供应商为审核状态
$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
);
$logService
->
AddLog
(
$contact
[
'supplier_id'
],
LogModel
::
UPDATE_OPERATE
,
'修改供应商基本资料'
,
$content
,
$remark
);
}
return
$result
;
}
...
...
app/Http/Services/SupplierService.php
View file @
f3014987
...
...
@@ -88,6 +88,7 @@ class SupplierService
$channel
[
'create_uid'
]
=
request
()
->
user
->
userId
;
$channel
[
'create_name'
]
=
request
()
->
user
->
name
;
$channel
[
'create_time'
]
=
time
();
$channel
[
'status'
]
=
SupplierChannelModel
::
STATUS_PENDING
;
$supplierId
=
$model
->
insertGetId
(
$channel
);
$this
->
saveSupplierCode
(
$supplierId
);
$logAction
=
"新增供应商"
;
...
...
@@ -99,15 +100,16 @@ class SupplierService
$extraFaxService
->
saveSupplierExtraFee
(
$extraFax
);
$supplierId
=
$channel
[
'supplier_id'
];
$oldSupplier
=
$model
->
where
(
'supplier_id'
,
$supplierId
)
->
first
();
$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
]);
'old'
=>
$oldSupplier
,
'new'
=>
$newSupplier
]);
}
//插入系数到redis
$this
->
saveRatioToRedis
(
$supplierId
);
...
...
app/Http/Transformers/SupplierTransformer.php
View file @
f3014987
...
...
@@ -7,6 +7,7 @@ namespace App\Http\Transformers;
use
App\Http\Services\AdminUserService
;
use
App\Http\Services\ViewCheckService
;
use
App\Model\IntracodeModel
;
use
App\Model\LogModel
;
use
App\Model\RedisModel
;
use
App\Model\SupplierContactModel
;
use
App\Model\SupplierExtendModel
;
...
...
@@ -126,6 +127,11 @@ class SupplierTransformer
$ExtendModel
=
new
SupplierExtendModel
();
//获取该supplier_code对应的数据
$supplier
[
'extra_fee'
]
=
$ExtendModel
->
getExtendExtra
(
$supplier
[
'supplier_code'
],
$supplier
[
'supplier_id'
]);
//获取最近修改信息
$logModel
=
new
LogModel
();
$log
=
$logModel
->
where
(
'supplier_id'
,
$supplier
[
'supplier_id'
])
->
orderBy
(
'id'
,
'desc'
)
->
first
();
$supplier
[
'last_update_name'
]
=
$log
[
'admin_name'
];
$supplier
[
'last_update_time'
]
=
date
(
'Y-m-d H:i:s'
,
$log
[
'add_time'
]);
return
$supplier
;
}
...
...
app/Http/Validators/SupplierValidator.php
View file @
f3014987
...
...
@@ -36,22 +36,22 @@ class SupplierValidator
if
(
$requestData
[
'currency'
]
==
1
)
{
$rules
[
'tax_number'
]
=
'required'
;
}
// if ($requestData['status'] == -1) {
// $rules = ['supplier_name' => 'required'];
// }
$messages
=
$this
->
messages
();
$validator
=
Validator
::
make
(
$requestData
,
$rules
,
$messages
);
//判断联系方式的表单验证
if
(
$validator
->
fails
())
{
// dd($validator->errors());
return
$validator
->
errors
()
->
first
();
}
//检验名称是否已经存在数据库
$supplierModel
=
new
SupplierChannelModel
();
$companyNameCount
=
0
;
if
(
empty
(
$request
->
get
(
'supplier_id'
)))
{
$count
=
$supplierModel
->
where
(
'supplier_name'
,
$request
->
get
(
'supplier_name'
))
->
count
();
$companyNameCount
=
$supplierModel
->
where
(
'register_company_name'
,
$request
->
get
(
'register_company_name'
))
->
count
();
}
else
{
$count
=
$supplierModel
->
where
(
'supplier_name'
,
$request
->
get
(
'supplier_name'
))
->
where
(
'supplier_id'
,
'!='
,
$request
->
get
(
'supplier_id'
))
->
count
();
...
...
@@ -59,6 +59,9 @@ class SupplierValidator
if
(
$count
)
{
return
"该供应商名称已经存在,请核验后再提交"
;
}
if
(
$companyNameCount
)
{
return
"该注册公司名已经存在,请核验后再提交"
;
}
}
private
function
messages
()
...
...
app/Model/SupplierChannelModel.php
View file @
f3014987
This diff is collapsed.
Click to expand it.
resources/views/script/SupplierDetailScript.blade.php
View file @
f3014987
...
...
@@ -24,7 +24,9 @@
});
}
@
if
(
checkPerm
(
'SupplierLog'
))
openLogView
();
@
endif
//判断是否要切换tab
let
tab
=
'{{request()->get('
tab
')}}'
;
...
...
resources/views/script/supplier/SupplierFileScript.blade.php
View file @
f3014987
...
...
@@ -10,7 +10,7 @@
upload
.
render
({
elem
:
'.uploadButton'
,
url
:
'{{config('
website
.
UploadUrl
')}}'
//改成您自己的上传接口
,
accept
:
'file'
//
音频
,
accept
:
'file'
//
文件
,
field
:
'upload'
,
data
:
{
k1
:
k1
,
...
...
resources/views/web/SupplierDetail.blade.php
View file @
f3014987
...
...
@@ -33,7 +33,14 @@
<div
class=
"layui-row"
>
<a
id=
"updateSupplierUrl"
href=
"/supplier/UpdateSupplier?view=iframe&supplier_id={{$supplier['supplier_id']}}"
style=
"margin-bottom: 25px;margin-top: 5px"
class=
"layui-btn layui-btn"
>
点击修改
</a>
style=
"margin-bottom: 25px;margin-top: 5px"
class=
"layui-btn layui-btn"
>
修改
</a>
</div>
@endif
@if($supplier['status']==\App\Model\SupplierChannelModel::STATUS_DISABLE)
<div
class=
"layui-row"
>
<a
id=
"updateSupplierUrl"
href=
"/supplier/UpdateSupplier?view=iframe&supplier_id={{$supplier['supplier_id']}}"
style=
"margin-bottom: 25px;margin-top: 5px"
class=
"layui-btn layui-btn"
>
申请重新入驻
</a>
</div>
@endif
</div>
...
...
@@ -160,10 +167,10 @@
</div>
<div
class=
"layui-row"
>
<div
class=
"layui-col-md2"
>
最近修改人 :{{$supplier['
supplier
_name']}}
最近修改人 :{{$supplier['
last_update
_name']}}
</div>
<div
class=
"layui-col-md2"
>
最近修改时间 :{{$supplier['update_time']}}
最近修改时间 :{{$supplier['
last_
update_time']}}
</div>
</div>
<hr/>
...
...
resources/views/web/UpdateSupplier.blade.php
View file @
f3014987
...
...
@@ -52,11 +52,11 @@
<div
class=
"layui-row"
>
<div
class=
"layui-btn-group"
style=
"margin-bottom: 25px;margin-top: 5px"
>
<button
type=
"button"
class=
"layui-btn layui-btn"
lay-submit
lay-filter=
"updateSupplier"
>
保存修改
lay-filter=
"updateSupplier"
>
提交
</button>
<a
id=
"supplierDetailUrl"
href=
"/supplier/SupplierDetail?view=iframe&supplier_id={{$supplier['supplier_id']}}"
class=
"layui-btn layui-btn-warm"
>
返回详情
</a>
class=
"layui-btn layui-btn-warm"
>
取消
</a>
</div>
</div>
</div>
...
...
@@ -160,10 +160,10 @@
</div>
<div
class=
"layui-row"
>
<div
class=
"layui-col-md2"
>
最近修改人:{{$supplier['
supplier
_name']}}
最近修改人:{{$supplier['
last_update
_name']}}
</div>
<div
class=
"layui-col-md2"
>
最近修改时间:{{$supplier['update_time']}}
最近修改时间:{{$supplier['
last_
update_time']}}
</div>
</div>
<hr/>
...
...
resources/views/web/supplier/SupplierBase.blade.php
View file @
f3014987
This diff is collapsed.
Click to expand it.
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