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
f67f56ad
authored
Mar 20, 2024
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
银行信息修改
parent
54ef12e0
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
189 additions
and
108 deletions
app/Http/Controllers/Api/SupplierReceiptApiController.php
app/Http/Controllers/Api/SupplierShareApplyApiController.php
app/Http/Controllers/LogController.php
app/Http/Services/SyncSupplierService.php
app/Http/Transformers/LogTransformer.php
app/Http/Validators/ReceiptValidator.php
public/plugins/assets/js/alpine.js
resources/views/iframe.blade.php
resources/views/script/AddSupplierReceiptScript.blade.php
resources/views/script/supplier/SupplierReceiptScript.blade.php
resources/views/web.blade.php
resources/views/web/AddSupplierReceipt.blade.php
app/Http/Controllers/Api/SupplierReceiptApiController.php
View file @
f67f56ad
...
...
@@ -58,6 +58,7 @@ class SupplierReceiptApiController extends Controller
'certificate'
,
'account_name'
,
'remark'
,
'international_code'
]);
$receipt
[
'account_adderss'
]
=
empty
(
$receipt
[
'account_adderss'
])
?
' '
:
$receipt
[
'account_adderss'
];
if
(
$receipt
[
'receipt_type'
]
==
1
)
{
...
...
@@ -80,12 +81,12 @@ class SupplierReceiptApiController extends Controller
//如果修改的只是备注,则不需要转成审核
$needAudit
=
$this
->
checkNeedAudit
(
$oldReceipt
,
$newReceipt
);
if
(
$needAudit
||
empty
(
$request
->
get
(
'receipt_id'
)))
{
//
$supplierModel = new SupplierChannelModel();
$supplierModel
=
new
SupplierChannelModel
();
//修改供应商为审核状态
//
$supplierModel->where('supplier_id', $supplierId)->update([
//
'update_time' => time(),
//
'status' => SupplierChannelModel::STATUS_PENDING,
//
]);
$supplierModel
->
where
(
'supplier_id'
,
$supplierId
)
->
update
([
'update_time'
=>
time
(),
'status'
=>
SupplierChannelModel
::
STATUS_PENDING
,
]);
}
$logService
=
new
LogService
();
...
...
@@ -95,7 +96,7 @@ class SupplierReceiptApiController extends Controller
(
new
SyncSupplierService
())
->
syncSupplierToErp
(
$supplierId
);
$this
->
response
(
0
,
'操作成功'
);
}
$this
->
response
(
-
1
,
'操作失败'
);
$this
->
response
(
-
1
,
'
没有内容变更,
操作失败'
);
}
//判断是否要进入审核中状态,因为部分字段修改是不需要走审核的
...
...
@@ -127,8 +128,24 @@ class SupplierReceiptApiController extends Controller
public
function
DeleteSupplierReceipt
(
$request
)
{
$receiptId
=
$request
->
get
(
'receipt_id'
);
$receipt
=
SupplierReceiptModel
::
where
(
'receipt_id'
,
$receiptId
)
->
first
()
->
toArray
();
$model
=
new
SupplierReceiptModel
();
$supplierModel
=
new
SupplierChannelModel
();
$supplier
=
$supplierModel
->
where
(
'supplier_id'
,
$receipt
[
'supplier_id'
]);
$supplierId
=
$supplier
[
'supplier_id'
];
//修改供应商为审核状态
$supplierModel
->
where
(
'supplier_id'
,
$supplierId
)
->
update
([
'update_time'
=>
time
(),
'status'
=>
SupplierChannelModel
::
STATUS_PENDING
,
]);
$result
=
$model
->
where
(
'receipt_id'
,
$receiptId
)
->
delete
();
$logService
=
new
LogService
();
$content
=
'删除银行信息'
;
$remark
=
json_encode
(
$receipt
);
$logService
->
AddLog
(
$receipt
[
'supplier_id'
],
LogModel
::
UPDATE_OPERATE
,
'修改供应商基本资料'
,
$content
,
$remark
);
(
new
SyncSupplierService
())
->
syncSupplierToErp
(
$supplierId
);
if
(
$result
)
{
$this
->
response
(
0
,
'操作成功'
);
}
...
...
app/Http/Controllers/Api/SupplierShareApplyApiController.php
View file @
f67f56ad
...
...
@@ -61,8 +61,7 @@ class SupplierShareApplyApiController extends Controller
$q
->
orWhere
(
'purchase_uid'
,
$codeId
)
->
orwhere
(
'channel_uid'
,
'like'
,
"%
$codeId
%"
);
}
})
->
where
(
'is_type'
,
0
)
->
first
();
})
->
where
(
'is_type'
,
0
)
->
first
();
if
(
$isOwn
)
{
$this
->
response
(
-
1
,
'你已经可以管理该供应商,无需申请共用'
);
}
...
...
app/Http/Controllers/LogController.php
View file @
f67f56ad
...
...
@@ -41,6 +41,7 @@ class LogController extends Controller
return
$this
->
errhtml
(
'Not'
,
'没有这个页面'
);
}
//供应商详情的操作日志
public
function
SupplierLog
(
$request
)
{
$supplierId
=
$request
->
get
(
'supplier_id'
,
1
);
...
...
app/Http/Services/SyncSupplierService.php
View file @
f67f56ad
...
...
@@ -93,6 +93,14 @@ class SyncSupplierService
$message
[
'bankinfo'
][]
=
[
"bank"
=>
$receipt
[
'bank_adderss'
],
'bankaccount'
=>
$receipt
[
'account_no'
],
'bankaccount'
=>
$receipt
[
'bank_name'
],
'bankaccount'
=>
$receipt
[
'bank_code'
],
'bankaccount'
=>
$receipt
[
'swift_code'
],
'bankaccount'
=>
$receipt
[
'account_name'
],
'bankaccount'
=>
$receipt
[
'account_adderss'
],
'bankaccount'
=>
$receipt
[
'certificate'
],
'bankaccount'
=>
$receipt
[
'business_license'
],
'bankaccount'
=>
$receipt
[
'international_code'
],
];
}
}
...
...
app/Http/Transformers/LogTransformer.php
View file @
f67f56ad
...
...
@@ -33,12 +33,46 @@ class LogTransformer
$item
[
'content'
]
=
$content
;
}
if
(
!
is_array
(
$item
[
'content'
])
&&
strpos
(
$item
[
'content'
],
'联系'
)
!==
false
)
{
$item
[
'content'
]
=
$item
[
'content'
]
.
':'
.
$logService
->
getContactDesc
(
$item
[
'remark'
]);
//如果是和银行信息有关的,还要把具体的信息展示出来
if
(
is_string
(
$item
[
'content'
]))
{
if
(
strpos
(
$item
[
'content'
],
'银行信息'
)
!==
FALSE
)
{
if
(
!
empty
(
$item
[
'remark'
]))
{
//获取当前的信息
$oldReceipt
=
json_decode
(
$item
[
'remark'
],
true
);
//新增
if
(
empty
(
$oldReceipt
[
'receipt_id'
]))
{
$item
[
'content'
]
.=
' : '
.
"银行名称 :
{
$oldReceipt
[
'bank_name'
]
}
| 账户号码 :
{
$oldReceipt
[
'account_no'
]
}
"
;
}
}
}
}
if
(
!
is_array
(
$item
[
'content'
])
&&
strpos
(
$item
[
'content'
],
'联系'
)
!==
false
)
{
$item
[
'content'
]
=
$item
[
'content'
]
.
':'
.
$logService
->
getContactDesc
(
$item
[
'remark'
]);
}
$item
[
'content'
]
=
$item
[
'content'
]
?:
'没有内容变化'
;
}
return
$item
;
}
}
\ No newline at end of file
public
static
function
transformReceiptLog
(
$oldReceipt
,
$receipt
)
{
if
(
empty
(
$oldReceipt
[
'receipt_id'
]))
{
//新增日志
$content
=
"银行名称 :
{
$oldReceipt
[
'bank_name'
]
}
| 账户号码 :
{
$oldReceipt
[
'account_no'
]
}
"
;
}
else
{
if
(
$receipt
)
{
//修改日志
}
else
{
//删除日志
}
}
}
}
app/Http/Validators/ReceiptValidator.php
View file @
f67f56ad
...
...
@@ -23,6 +23,9 @@ class ReceiptValidator
];
if
(
$receipt
[
'receipt_type'
]
==
2
)
{
$rules
[
"swift_code"
]
=
'required'
;
$rules
[
"account_adderss"
]
=
'required'
;
$rules
[
"account_name"
]
=
'required'
;
$rules
[
"international_code"
]
=
'required'
;
}
$messages
=
$this
->
messages
();
$validator
=
Validator
::
make
(
$receipt
,
$rules
,
$messages
);
...
...
@@ -47,6 +50,8 @@ class ReceiptValidator
'account_no.required'
=>
'银行账号 不能为空'
,
'account_name.required'
=>
'账户名称 不能为空'
,
'certificate.required'
=>
'银行信息凭证 不能为空'
,
'account_adderss.required'
=>
'银行地址 不能为空'
,
'international_code.required'
=>
'国际代码 不能为空'
,
];
}
}
\ No newline at end of file
}
public/plugins/assets/js/alpine.js
0 → 100644
View file @
f67f56ad
This diff is collapsed.
Click to expand it.
resources/views/iframe.blade.php
View file @
f67f56ad
...
...
@@ -10,6 +10,7 @@
<script
src=
"/js/jquery-2.2.1.js"
></script>
<script
type=
"text/javascript"
src=
"/plugins/assets/libs/layui/layui.js"
></script>
<script
type=
"text/javascript"
src=
"/plugins/assets/js/common.js?version={{time()}}"
></script>
<script
type=
"text/javascript"
src=
"/plugins/assets/js/alpine.js"
defer
></script>
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
...
...
resources/views/script/AddSupplierReceiptScript.blade.php
View file @
f67f56ad
{
!!
Autograph
()
!!
}
<
script
>
layui
.
use
([
'form'
,
'upload'
,
'admin'
],
function
()
{
const
form
=
layui
.
form
const
upload
=
layui
.
upload
;
const
admin
=
layui
.
admin
;
document
.
addEventListener
(
'alpine:init'
,
()
=>
{
Alpine
.
data
(
'receiptForm'
,
()
=>
({
receiptType
:
$
(
'#receipt_type'
)
.
val
(),
init
()
{
let
g
=
this
;
layui
.
use
([
'form'
,
'upload'
,
'admin'
],
function
()
{
const
form
=
layui
.
form
const
upload
=
layui
.
upload
;
const
admin
=
layui
.
admin
;
//提交数据
form
.
on
(
'submit(addSupplierReceipt)'
,
function
(
data
)
{
// layer.confirm('确定要保存银行信息吗?一旦保存,该供应商就会再次进入审核阶段', function (index) {
layer
.
confirm
(
'确定要保存银行信息吗?'
,
function
(
index
)
{
let
res
=
ajax
(
'/api/supplier_receipt/AddSupplierReceipt'
,
data
.
field
);
if
(
!
res
)
{
layer
.
msg
(
'网络错误,请重试'
,
{
icon
:
6
});
}
else
{
if
(
res
.
err_code
===
0
)
{
admin
.
putTempData
(
"needFreshList"
,
1
);
admin
.
closeThisDialog
();
parent
.
layer
.
msg
(
res
.
err_msg
,
{
icon
:
6
});
}
else
{
parent
.
layer
.
msg
(
res
.
err_msg
,
{
icon
:
5
});
}
}
return
false
;
});
return
false
;
})
//提交数据
form
.
on
(
'submit(addSupplierReceipt)'
,
function
(
data
)
{
// layer.confirm('确定要保存银行信息吗?一旦保存,该供应商就会再次进入审核阶段', function (index) {
layer
.
confirm
(
'确定要保存银行信息吗?'
,
function
(
index
)
{
let
res
=
ajax
(
'/api/supplier_receipt/AddSupplierReceipt'
,
data
.
field
);
if
(
!
res
)
{
layer
.
msg
(
'网络错误,请重试'
,
{
icon
:
6
});
}
else
{
if
(
res
.
err_code
===
0
)
{
admin
.
putTempData
(
"needFreshList"
,
1
);
admin
.
closeThisDialog
();
parent
.
layer
.
msg
(
res
.
err_msg
,
{
icon
:
6
});
}
else
{
parent
.
layer
.
msg
(
res
.
err_msg
,
{
icon
:
5
});
}
}
return
false
;
});
return
false
;
})
form
.
on
(
'radio(receipt_type)'
,
function
(
data
)
{
if
(
data
.
value
==
1
)
{
$
(
'#swift_code_div'
)
.
hide
();
}
else
{
$
(
'#swift_code_div'
)
.
show
();
}
});
form
.
on
(
'radio(receipt_type)'
,
function
(
data
)
{
g
.
receiptType
=
data
.
value
;
});
//图片上传
upload
.
render
({
elem
:
'.upload-img'
,
url
:
UploadImgUrl
,
field
:
'upload'
,
data
:
{
k1
:
k1
,
k2
:
k2
,
source
:
1
,
cancel_time_verify
:
1
,
}
,
accept
:
'file'
,
exts
:
'jpg|png|bmp|jpeg|zip|pdf'
,
size
:
20000
,
before
:
function
(
obj
)
{
layer
.
msg
(
'加载中'
,
{
icon
:
16
,
shade
:
0.01
});
let
item
=
this
.
item
;
//预读本地文件示例,不支持ie8
obj
.
preview
(
function
(
index
,
file
,
result
)
{
// if (file.type.indexOf('image') !== -1){
// $('#' + item.attr('preview')).attr('src', result); //图片链接(base64)
// }else{
// $('#' + item.attr('preview')).attr('src', '/images/file.png');
// }
//图片上传
upload
.
render
({
elem
:
'.upload-img'
,
url
:
UploadImgUrl
,
field
:
'upload'
,
data
:
{
k1
:
k1
,
k2
:
k2
,
source
:
1
,
cancel_time_verify
:
1
,
}
,
accept
:
'file'
,
exts
:
'jpg|png|bmp|jpeg|zip|pdf'
,
size
:
20000
,
before
:
function
(
obj
)
{
layer
.
msg
(
'加载中'
,
{
icon
:
16
,
shade
:
0.01
});
let
item
=
this
.
item
;
//预读本地文件示例,不支持ie8
obj
.
preview
(
function
(
index
,
file
,
result
)
{
// if (file.type.indexOf('image') !== -1){
// $('#' + item.attr('preview')).attr('src', result); //图片链接(base64)
// }else{
// $('#' + item.attr('preview')).attr('src', '/images/file.png');
// }
});
}
,
done
:
function
(
res
)
{
if
(
res
.
code
===
200
)
{
layer
.
msg
(
'上传成功'
,
{
icon
:
6
});
let
item
=
this
.
item
;
$
(
'#'
+
item
.
attr
(
'data-obj'
))
.
val
(
res
.
data
[
0
]);
$
(
'#certificate_url'
)
.
text
(
res
.
data
[
0
]);
return
false
;
}
else
{
layer
.
msg
(
'上传失败,'
+
res
.
message
,
{
icon
:
5
});
return
false
;
}
}
,
error
:
function
(
res
)
{
layer
.
msg
(
'上传失败:'
+
res
.
message
,
{
icon
:
5
});
return
false
;
}
});
});
}
,
done
:
function
(
res
)
{
if
(
res
.
code
===
200
)
{
layer
.
msg
(
'上传成功'
,
{
icon
:
6
});
let
item
=
this
.
item
;
$
(
'#'
+
item
.
attr
(
'data-obj'
))
.
val
(
res
.
data
[
0
]);
$
(
'#certificate_url'
)
.
text
(
res
.
data
[
0
]);
return
false
;
}
else
{
layer
.
msg
(
'上传失败,'
+
res
.
message
,
{
icon
:
5
});
return
false
;
}
}
,
error
:
function
(
res
)
{
layer
.
msg
(
'上传失败:'
+
res
.
message
,
{
icon
:
5
});
return
false
;
}
});
}));
});
</
script
>
\ No newline at end of file
</
script
>
resources/views/script/supplier/SupplierReceiptScript.blade.php
View file @
f67f56ad
...
...
@@ -34,6 +34,7 @@
{
field
:
'account_no'
,
title
:
'
<
span
class
=
"require"
>*
<
/span>银行账号', align: 'center', width: 130}
,
{
field
:
'account_name'
,
title
:
'账户名称'
,
align
:
'center'
,
width
:
150
},
{
field
:
'swift_code'
,
title
:
'电汇号码'
,
align
:
'center'
,
width
:
130
},
{
field
:
'international_code'
,
title
:
'国际代码'
,
align
:
'center'
,
width
:
130
},
{
field
:
'certificate'
,
title
:
'
<
span
class
=
"require"
>*
<
/span>信息凭证'
,
...
...
@@ -101,4 +102,4 @@
}
});
});
</script>
\ No newline at end of file
</script>
resources/views/web.blade.php
View file @
f67f56ad
...
...
@@ -45,6 +45,7 @@
<!-- js部分 -->
<script
type=
"text/javascript"
src=
"/plugins/assets/libs/layui/layui.js"
></script>
<script
type=
"text/javascript"
src=
"/plugins/assets/js/common.js?v=317"
></script>
<script
type=
"text/javascript"
src=
"/plugins/assets/js/alpine.js"
></script>
<script>
layui
.
use
([
'index'
,
'layer'
,
'admin'
],
function
()
{
var
$
=
layui
.
jquery
;
...
...
resources/views/web/AddSupplierReceipt.blade.php
View file @
f67f56ad
...
...
@@ -5,21 +5,22 @@
</style>
<div
class=
"layui-card"
>
<div
class=
"layui-card-body"
>
<form
class=
"layui-form"
action=
""
>
<form
class=
"layui-form"
action=
""
x-data=
"receiptForm"
>
<input
type=
"hidden"
name=
"supplier_id"
value=
"{{request()->get('supplier_id')}}"
>
<input
type=
"hidden"
name=
"receipt_id"
value=
"{{request()->get('receipt_id')}}"
>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
>
银行类型 :
</label>
<div
class=
"layui-input-block"
>
<input
type=
"hidden"
id=
"receipt_type"
value=
"{{$receipt['receipt_type'] or 1}}"
>
<input
type=
"radio"
name=
"receipt_type"
lay-filter=
"receipt_type"
value=
"1"
title=
"国内"
@
if
((!
empty
($
receipt
['
receipt_type
'])&&$
receipt
['
receipt_type
']==
1
)||
empty
($
receipt
))
checked
@
endif
checked
@
endif
>
<input
type=
"radio"
name=
"receipt_type"
lay-filter=
"receipt_type"
value=
"2"
title=
"港澳台和国外"
@
if
(!
empty
($
receipt
['
receipt_type
'])&&$
receipt
['
receipt_type
']==
2
)
checked
@
endif
checked
@
endif
>
</div>
</div>
...
...
@@ -48,7 +49,10 @@
</div>
</div>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
>
账户名称 :
</label>
<label
class=
"layui-form-label"
>
<span
x-show=
"receiptType === '1'"
>
账户名称 :
</span>
<span
x-show=
"receiptType === '2'"
><span
style=
"color: red"
>
*
</span>
国外受益人 :
</span>
</label>
<div
class=
"layui-input-block block-42"
>
<input
type=
"text"
name=
"account_name"
id=
"account_name"
placeholder=
"请输入账户名称"
class=
"layui-input"
...
...
@@ -56,16 +60,26 @@
</div>
</div>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
>
银行地址 :
</label>
<label
class=
"layui-form-label"
>
<span
style=
"color: red"
x-show=
"receiptType === '2'"
>
*
</span>
银行地址 :
</label>
<div
class=
"layui-input-block block-42"
>
<input
type=
"text"
name=
"account_adderss"
id=
"account_adderss"
placeholder=
"请输入银行具体地址,精确到街道"
class=
"layui-input"
value=
"{{$receipt['account_adderss'] or ''}}"
>
</div>
</div>
<div
class=
"layui-form-item"
id=
"swift_code_div"
@
if
((!
empty
($
receipt
['
receipt_type
'])&&$
receipt
['
receipt_type
']==
1
)||
empty
($
receipt
['
receipt_type
']))
style=
"display: none"
@
endif
>
<div
class=
"layui-form-item"
x-show=
"receiptType === '2'"
>
<label
class=
"layui-form-label"
>
<span
style=
"color: red"
>
*
</span>
国际代码 :
</label>
<div
class=
"layui-input-block block-42"
>
<input
type=
"text"
name=
"international_code"
id=
"international_code"
placeholder=
"请输入银行国际代码"
class=
"layui-input"
value=
"{{$receipt['international_code'] or ''}}"
>
</div>
</div>
<div
class=
"layui-form-item"
id=
"swift_code_div"
x-show=
"receiptType === '2'"
>
<label
class=
"layui-form-label"
><span
class=
"require"
>
*
</span>
Swift Code :
</label>
<div
class=
"layui-input-block block-42"
>
<input
type=
"text"
name=
"swift_code"
id=
"Swift Code"
...
...
@@ -84,9 +98,10 @@
<button
type=
"button"
class=
"layui-btn upload-img"
preview=
"preview"
data-obj=
"certificate"
>
<i
class=
"layui-icon"
>

</i>
上传文件
</button>
<a
target=
"_blank"
id=
"certificate_url"
href=
"{{$receipt['certificate'] or ''}}"
>
{{$receipt['certificate'] or ''}}
</a>
{{--
<img
@
if
(!
empty
($
receipt
['
certificate
']))
src=
"{{$receipt['certificate'] or ''}}"
--
}}
{{
--
@
endif
class=
"layui-upload-img"
width=
"50px"
height=
"50px"
id=
"preview"
>
--}}
<a
target=
"_blank"
id=
"certificate_url"
href=
"{{$receipt['certificate'] or ''}}"
>
{{$receipt['certificate'] or ''}}
</a>
{{--
<img
@
if
(!
empty
($
receipt
['
certificate
']))
src=
"{{$receipt['certificate'] or ''}}"
--
}}
{{
--
@
endif
class=
"layui-upload-img"
width=
"50px"
height=
"50px"
id=
"preview"
>
--}}
</div>
</div>
<div
class=
"layui-form-item"
>
...
...
@@ -107,4 +122,4 @@
</div>
</form>
</div>
</div>
\ No newline at end of file
</div>
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