Commit 440575ba by mushishixian

银行管理

parent 6a05c889
......@@ -11,7 +11,7 @@ use App\Model\SupplierReceiptModel;
use Illuminate\Http\Request;
//通用API,比如获取品牌列表,分类列表等
class ReceiptApiController extends Controller
class SupplierReceiptApiController extends Controller
{
public function Entrance(Request $request, $id)
{
......@@ -41,10 +41,22 @@ class ReceiptApiController extends Controller
if ($validateResult) {
$this->response(-1, $validateResult);
}
$receipt = $request->get('receipt');
$receipt = $request->only([
'receipt_id',
'supplier_id',
'receipt_type',
'bank_name',
'bank_adderss',
'account_no',
'account_adderss',
'swift_code',
'certificate',
'account_name',
'remark',
]);
$receipt['account_adderss'] = empty($receipt['account_adderss']) ? ' ' : $receipt['account_adderss'];
$receiptId = $request->get('receipt_id');
$supplierId = $request->get('supplier_id');
unset($receipt['currency']);
$model = new SupplierReceiptModel();
if (!empty($receiptId)) {
$result = $model->where('receipt_id', $receiptId)->update($receipt);
......
......@@ -24,10 +24,9 @@ class Controller extends BaseController
return view('errors.error', $data);
}
protected function view($title = '', $module = '')
protected function view($title = '')
{
$this->data['title'] = $title;
$view = $module ?: request('view', 'web');
$view =request('view', 'web');
return view($view, $this->data);
}
......
......@@ -13,7 +13,7 @@ use App\Model\SupplierReceiptModel;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
class ReceiptController extends Controller
class SupplierReceiptController extends Controller
{
public function info(Request $request, $id = '')
{
......@@ -23,23 +23,14 @@ class ReceiptController extends Controller
} else {
$path = $request->path();
}
$this->data = [
'menus' => $request->menus,
'header' => $request->user->header,
'username' => $request->user->email,
'user_email' => $request->user->email,
'uri' => '/' . $path,
'id' => $id
'id' => $id,
];
$userId = $request->user->userId;
$canAudit = perm($userId, 'AuditSupplier');
$this->data['canAudit'] = $canAudit;
//把是否是领导查看放到模板,用来区分部门老大能干的权限
$leaderView = perm($userId, 'LeaderView');
$this->data['leaderView'] = $leaderView;
return $this->$id($request);
}
}
......@@ -52,19 +43,23 @@ class ReceiptController extends Controller
//供应商详情
public function PureAddReceipt($request)
public function AddSupplierReceipt($request)
{
$this->data['title'] = '添加供应商银行';
return $this->view('添加供应商银行');
}
//供应商详情
public function UpdateSupplierReceipt($request)
{
$receiptId = $request->get('receipt_id');
if (!empty($receiptId)) {
$model = new SupplierReceiptModel();
$this->data['receipt'] = $model->where('receipt_id', $receiptId)->first()->toArray();
}
$this->data['title'] = '添加供应商多银行';
$this->data['stockup_type'] = Config('fixed.SupplierStockupType');
$this->data['currency'] = Config('fixed.Currency');
$this->data['pay_type'] = Config('fixed.SupplierPayType');
$this->data['receipt_type'] = Config('fixed.ReceiptType');
return $this->view('添加银行');
$this->data['title'] = '修改供应商银行';
$this->data['view'] = 'AddSupplierReceipt';
return $this->view('修改供应商银行');
}
......
......@@ -9,7 +9,7 @@ class ReceiptTransformer
public function transformList($list)
{
foreach ($list as &$item) {
$item['receipt_type'] = $item['receipt_type'] == 1 ? '国内' : '港澳台和国外';
}
unset($item);
......
......@@ -13,26 +13,15 @@ class ReceiptValidator
public function checkSave($request)
{
//整理下请求数据
$receipt = $request->get('receipt');
$receiptType = $receipt['receipt_type'];
if ($receiptType == 1) {
$rules = [
"bank_name" => "required",
"bank_adderss" => "required",
"account_no" => "required",
"account_name" => "required",
"certificate" => "required",
];
} else {
$rules = [
"bank_name" => "required",
"bank_adderss" => "required",
"account_no" => "required",
"swift_code" => "required",
"account_name" => "required",
"certificate" => "required",
];
}
$receipt = $request->all();
$rules = [
"bank_name" => "required",
"bank_adderss" => "required",
"account_no" => "required",
"swift_code" => "required",
"account_name" => "required",
// "certificate" => "required",
];
$messages = $this->messages();
$validator = Validator::make($receipt, $rules, $messages);
......@@ -45,10 +34,10 @@ class ReceiptValidator
private function messages()
{
return [
'bank_name.required' => '银行名称不能为空',
'bank_adderss.required' => '银行地址不能为空',
'account_no.required' => '账户号码不能为空',
'swift_code.required' => '电汇号码不能为空',
'bank_name.required' => '开户名称不能为空',
'bank_adderss.required' => '开户行不能为空',
'swift_code.required' => '电汇号码 Swift Code 不能为空',
'account_no.required' => '银行账号不能为空',
'account_name.required' => '账户名称不能为空',
'certificate.required' => '银行信息凭证不能为空',
......
......@@ -19,7 +19,7 @@ Route::group(['middleware' => ['web', 'menu']], function () {
// Route::match(['get', 'post'], '/web/{key}', 'WebController@info');
Route::match(['get', 'post'], '/supplier/{key}', 'SupplierController@info');
Route::match(['get', 'post'], '/supplier_contact/{key}', 'SupplierContactController@info');
Route::match(['get', 'post'], '/receipt/{key}', 'ReceiptController@info');
Route::match(['get', 'post'], '/supplier_receipt/{key}', 'SupplierReceiptController@info');
// Route::match(['get', 'post'], '/supplier_sync_log/{key}', 'SupplierSyncLogController@info');
Route::match(['get', 'post'], '/index/{key}', 'IndexController@Entrance');
Route::match(['get', 'post'], '/log/{key}', 'LogController@Entrance');
......@@ -36,6 +36,6 @@ Route::group(['middleware' => ['web'], 'namespace' => 'Api'], function () {
Route::match(['get', 'post'], '/api/supplier_contact/{key}', 'SupplierContactApiController@Entrance');
Route::match(['get', 'post'], '/api/supplier/{key}', 'SupplierApiController@Entrance');
Route::match(['get', 'post'], '/api/log/{key}', 'LogApiController@Entrance');
Route::match(['get', 'post'], '/api/receipt/{key}', 'ReceiptApiController@Entrance');
Route::match(['get', 'post'], '/api/supplier_receipt/{key}', 'SupplierReceiptApiController@Entrance');
Route::match(['get', 'post'], '/api/supplier_sync_log/{key}', 'SupplierSyncLogApiController@Entrance');
});
\ No newline at end of file
......@@ -7,7 +7,6 @@
<title>控制台</title>
<link rel="stylesheet" href="/plugins/assets/libs/layui/css/layui.css"/>
<link rel="stylesheet" href="/plugins/assets/module/admin.css"/>
{{-- <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>--}}
<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"></script>
......@@ -17,16 +16,18 @@
<![endif]-->
</head>
<style>
html *
{
html * {
font-size: 12px !important;
}
.layui-input {
height: 30px;
}
.layui-input-inline {
margin-top: 5px;
}
.require {
color: red;
font-size: 16px;
......@@ -38,7 +39,11 @@
<div class="layui-fluid ew-console-wrapper">
<div class="layui-card">
<div class="layui-card-body">
@include("web.$id")
@if(!empty($view))
@include("web.$view")
@else
@include("web.$id")
@endif
</div>
</div>
</div>
......@@ -53,5 +58,9 @@
<!-- 引入同名的js,默认引入 -->
@if(empty($lead_in_js) || $lead_in_js === true)
{{-- <script type="text/javascript" src="/js/{{$id}}.js?v={{random(3,true)}}"></script>--}}
@include('script.'.$id.'Script')
@if(!empty($view))
@include('script.'.$view.'Script')
@else
@include('script.'.$id.'Script')
@endif
@endif
{!! Autograph() !!}
<script>
layui.use(['form', 'upload','admin'], function () {
const form = layui.form
const upload = layui.upload;
const admin = layui.admin;
//提交数据
form.on('submit(addSupplierReceipt)', function (data) {
let res = ajax('/api/supplier_receipt/AddSupplierReceipt', data.field);
if (!res) {
layer.msg('网络错误,请重试', {icon: 6});
} else {
if (res.err_code === 0) {
admin.closeThisDialog();
parent.layer.msg(res.err_msg, {icon: 6});
} else {
parent.layer.msg(res.err_msg, {icon: 5});
}
}
return false;
})
//图片上传
upload.render({
elem: '.upload-img'
, url: UploadImgUrl
, field: 'upload'
, data: {
k1: k1,
k2: k2,
source: 1
}
, before: function (obj) {
layer.msg('加载中', {
icon: 16
, shade: 0.01
});
let item = this.item;
//预读本地文件示例,不支持ie8
obj.preview(function (index, file, result) {
$('#' + item.attr('preview')).attr('src', result); //图片链接(base64)
});
}
, done: function (res) {
if (res.code === 200) {
layer.msg('上传成功', {icon: 6});
let item = this.item;
$('#' + item.attr('data-obj')).val(res.data[0]);
return false;
} else {
layer.msg('上传失败', {icon: 5});
return false;
}
}
, error: function (res) {
layer.msg('上传失败', {icon: 5});
return false;
}
});
});
</script>
\ No newline at end of file
<script>
layui.use(['table', 'form', 'element', 'layer','admin'], function () {
layui.use(['table', 'form', 'element', 'layer', 'admin', 'upload'], function () {
let table = layui.table;
let form = layui.form;
let admin = layui.admin;
let element = layui.element;
let upload = layui.upload;
let supplierId = getQueryVariable('supplier_id')
table.render({
elem: '#receiptList',
url: '/api/receipt/getSupplierReceiptList',
method: 'get',
url: '/api/supplier_receipt/getSupplierReceiptList',
method: 'post',
size: 'sm',
cellMinWidth: 80,//全局定义常规单元格的最小宽度
where: {
supplier_id: getQueryVariable("supplier_id")
supplier_id: supplierId
},
width: '70%',
loading: true,
first: true,//不显示首页
last: false,//不显示尾页
cols: [[
{field: 'receipt_type', title: '收款账户所在地', align: 'center'},
{field: 'bank_name', title: '银行名称', align: 'center'},
{field: 'bank_adderss', title: '开户行', align: 'center'},
{field: 'account_no', title: '账户号码', align: 'center'},
{field: 'bank_code', title: '银行编号', align: 'center'},
{field: 'branch_no', title: '分行编号', align: 'center'},
{field: 'swift_code', title: '电汇号码', align: 'center'},
{field: 'account_no', title: '账户号码', align: 'center'},
{field: 'account_name', title: '账户名称', align: 'center'},
{field: 'account_adderss', title: '账户地址', align: 'center'},
{type: 'radio',},
{field: 'receipt_type', title: '银行类型', align: 'center', width: 120},
{field: 'bank_name', title: '开户名称', align: 'center', width: 150},
{field: 'bank_adderss', title: '开户行', align: 'center', width: 150},
{field: 'account_no', title: '银行账号', align: 'center', width: 130},
{field: 'account_name', title: '账户名称', align: 'center', width: 150},
{field: 'swift_code', title: '电汇号码', align: 'center', width: 150},
{
field: 'certificate', title: '供应商银行信息凭证', align: 'center', templet: function (data) {
field: 'certificate', title: '信息凭证', width: 150, align: 'center', templet: function (data) {
return "<img class='certificate_img' style='width: 70px;height: 60px' src='" + data.certificate + "'>";
}
},
{field: 'remark', title: '备注', align: 'center', width: 200},
]],
id: 'receiptList',
page: {},
});
table.render({
elem: '#list'
, url: '/api/supplier/GetSupplierList'
, method: 'post'
, size: 'sm'
, cellMinWidth: 80 //全局定义常规单元格的最小宽度
, where: {
source_type: 'all'
}
, loading: true
, first: true //不显示首页
, last: false //不显示尾页
, cols: [[
{type: 'radio'},
{field: 'supplier_id', title: '供应商ID', align: 'center', width: 80},
{
field: 'supplier_code', title: '供应商编码', align: 'center', width: 90, templet: function (data) {
return "<a ew-href='/supplier/SupplierDetail?view=iframe&supplier_id=" + data.supplier_id +
"' style='color: dodgerblue' ew-title='供应商详情'>" + data.supplier_code + "</a>"
}
},
{field: 'supplier_name', title: '供应商名称', align: 'center'},
{field: 'supplier_group', title: '供应商性质', align: 'center', width: 120},
{
field: 'stockup_type', title: '合作类型', align: 'center', width: 120, templet: function (data) {
return "<span title='" + data.stockup_type + "'>" + data.stockup_type + "</span>"
}
},
{
field: 'contact_num', title: '联系人', align: 'center', width: 80, templet: function (data) {
return "<a title='点击跳转查看联系人列表'>" + data.contact_num + "</a>"
}
},
{field: 'has_sku', title: 'SKU上传', align: 'center', width: 80},
{
field: 'status_name', title: '状态', align: 'center', width: 80, templet: function (data) {
if (data.status === 3) {
return "<span style='color: red' title='" + data.reject_reason + "'>" + data.status_name + "</span>"
} else {
return data.status_name;
}
}
},
{field: 'channel_username', title: '采购员', align: 'center', width: 150},
{field: 'purchase_username', title: '渠道开发员', align: 'center', width: 110},
{field: 'create_name', title: '创建人', align: 'center', width: 80},
{field: 'update_time', title: '最近修改时间', align: 'center', width: 150},
{field: 'create_time', title: '创建时间', align: 'center', width: 150},
]]
, id: 'SupplierList'
, page: {}
});
function openLogView(){
// 打开右侧面板
layer.open({
type: 2,
content: '/log/SupplierLog?view=iframe&supplier_id=' + supplierId,
area: ['400px', '85%'],
shade: 0,
offset: 'rb',
title: '操作日志',
});
}
form.on('submit(load)', function (data) {
form.render();
//执行重载
table.reload('SupplierList', {
page: {
curr: 1
openLogView();
//新增银行弹窗
$("#add_bank").click(function () {
layer.open({
type: 2,
content: '/supplier_receipt/AddSupplierReceipt?view=iframe&supplier_id=' + supplierId,
area: ['50%', '70%'],
title: '新增银行',
end: function () {
table.reload('receiptList');
}
, where: data.field
});
return false;
});
})
let supplierId = getQueryVariable('supplier_id')
// 打开右侧面板
layer.open({
type: 2,
content: '/log/SupplierLog?view=iframe&supplier_id=' + supplierId,
area: ['400px', '85%'],
shade: 0,
offset: 'rb',
title: '操作日志',
});
//修改银行弹窗
$("#update_bank").click(function () {
let checkStatus = table.checkStatus('receiptList');
let data = checkStatus.data;
if (!data.length) {
layer.msg('请先选择要操作的银行数据', {icon: 5})
} else {
let receiptId = data[0].receipt_id;
let supplierId = data[0].supplier_id;
alert(receiptId);
alert(supplierId);
layer.open({
type: 2,
content: '/supplier_receipt/UpdateSupplierReceipt?view=iframe&supplier_id=' + supplierId + '&receipt_id=' + receiptId,
area: ['50%', '70%'],
title: '修改银行',
end: function () {
table.reload('receiptList');
}
});
}
})
table.on('tool(list)', function (obj) {
let data = obj.data;
let layEvent = obj.event;
let datas = {
group_id: data.group_id,
id: data.id
};
if (layEvent === 'edit') {
window.location = '/supplier'
} else if (layEvent === 'Del') {
datas.status = 3;
up_status(datas, '删除');
$("#delete_bank").click(function () {
let checkStatus = table.checkStatus('receiptList');
let data = checkStatus.data;
if (!data.length) {
layer.msg('请先选择要操作的银行', {icon: 5})
} else {
layer.confirm('确定要删除该银行信息?', function (index) {
let receiptId = data[0].receipt_id;
let res = ajax('/api/supplier_receipt/DeleteSupplierReceipt', {receipt_id: receiptId})
if (res.err_code === 0) {
table.reload('receiptList')
layer.msg(res.err_msg, {icon: 6})
openLogView();
} else {
layer.msg(res.err_msg, {icon: 5})
}
});
}
});
});
......
......@@ -87,7 +87,7 @@
let supplierId = data[0].supplier_id;
let status = data[0].status;
if (status !== 1) {
layer.msg('该供应商已经被审核',{icon: 5})
layer.msg('该供应商已经被审核', {icon: 5})
return
}
layer.open({
......@@ -128,17 +128,24 @@
if (!data.length) {
layer.msg('请先选择要操作的供应商', {icon: 5})
} else {
layer.confirm('对应供应商设为禁用后,猎芯将无法与其进行交易,如要再次启用,则须再次走入驻流程,是否执行当前操作?', function (index) {
let supplierId = data[0].supplier_id;
let res = ajax('/api/supplier/DisableSupplier', {supplier_id: supplierId})
if (res.err_code === 0) {
layer.msg(res.err_msg, {icon: 6})
layer.closeAll();
table.reload('list')
} else {
layer.msg(res.err_msg, {icon: 5})
}
});
const status = data[0].status;
const hasSku = data[0].hasSku;
if ((status === 3 || status === 2) && !hasSku) {
layer.confirm('对应供应商设为禁用后,猎芯将无法与其进行交易,如要再次启用,则须再次走入驻流程,是否执行当前操作?', function (index) {
let supplierId = data[0].supplier_id;
let res = ajax('/api/supplier/DisableSupplier', {supplier_id: supplierId})
if (res.err_code === 0) {
table.reload('list')
layer.closeAll();
layer.msg(res.err_msg, {icon: 6})
} else {
layer.msg(res.err_msg, {icon: 5})
}
});
} else {
layer.msg('只有已通过或者未通过状态,并且没有sku的供应商才可以禁用',{'icon': 5});
}
}
});
......
<script>
console.log('example');
</script>
\ No newline at end of file
<style>
.layui-form-item {
margin-bottom: 5px;
}
</style>
<div class="layui-card">
<div class="layui-card-body">
<form class="layui-form" action="">
<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="radio" name="receipt_type" value="1" title="国内" checked>
<input type="radio" name="receipt_type" value="2" title="港澳台和国外">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label"><span class="require">*</span>开户名称 : </label>
<div class="layui-input-block block-42">
<input type="text" name="bank_name" id="bank_name"
placeholder="请输入开户名称,比如建设银行" class="layui-input"
value="{{$receipt['bank_name'] or ''}}">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label"><span class="require">*</span>开户行 : </label>
<div class="layui-input-block block-42">
<input type="text" name="bank_adderss" id="bank_adderss"
placeholder="请输入开户行,比如深圳建设银行" class="layui-input"
value="{{$receipt['bank_adderss'] or ''}}">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label"><span class="require">*</span>银行账号 : </label>
<div class="layui-input-block block-42">
<input type="text" name="account_no" id="account_no"
placeholder="请输入银行账号" class="layui-input"
value="{{$receipt['account_no'] or ''}}">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">账户名称 : </label>
<div class="layui-input-block block-42">
<input type="text" name="account_name" id="account_name"
placeholder="请输入账户名称" class="layui-input"
value="{{$receipt['account_name'] or ''}}">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">银行地址 : </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">
<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"
placeholder="请输入电汇号码" class="layui-input"
value="{{$receipt['swift_code'] or ''}}">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">
<span class="require">*</span>供应商银行信息凭证:
</label>
<div class="layui-input-block">
<input type="hidden" name="certificate" id="certificate"
value="{{$receipt['certificate'] or ''}}">
<button type="button" class="layui-btn upload-img" preview="preview" data-obj="certificate">
<i class="layui-icon">&#xe67c;</i>上传图片
</button>
<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">
<label class="layui-form-label">备注 : </label>
<div class="layui-input-block block-42">
<input type="text" name="remark" id="remark"
placeholder="请输入备注" class="layui-input"
value="{{$receipt['remark'] or ''}}">
</div>
</div>
<div class="layui-form-item">
<div align="center" style="margin-top: 20px">
<button type="button" id="addSupplierReceipt" class="layui-btn layui-btn-info" lay-submit
lay-filter="addSupplierReceipt">保存
</button>
</div>
</div>
</form>
</div>
</div>
\ No newline at end of file
......@@ -126,6 +126,11 @@
<b>财务信息</b>
</blockquote>
<div class="layui-row">
<div class="layui-btn-group demoTable" style="margin-bottom: 15px;margin-top: 15px">
<button class="layui-btn layui-btn-sm" id="add_bank">新增</button>
<button class="layui-btn layui-btn-sm" id="update_bank">修改</button>
<button class="layui-btn layui-btn-sm" id="delete_bank">删除</button>
</div>
<table class="layui-table" lay-filter="receiptList" id="receiptList"></table>
</div>
<blockquote class="layui-elem-quote layui-text">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment