Commit bc8a68b1 by mushishixian

temp

parent 087c79cf
<?php
namespace App\Http\Controllers\Api;
use App\Http\Controllers\Controller;
use App\Http\Services\SupplierContactService;
use App\Http\Services\SupplierStatisticsService;
use App\Http\Transformers\SupplierContactTransformer;
use App\Http\Validators\SupplierContactValidator;
use App\Model\SupplierContactModel;
use Illuminate\Http\Request;
//通用API,比如获取品牌列表,分类列表等
class SkuApiController extends Controller
{
public function Entrance(Request $request, $id)
{
$this->$id($request, $id);
}
public function GetSkuList($request)
{
$this->response(0, 'ok', []);
}
}
<?php
namespace App\Http\Controllers;
use App\Http\Controllers\Filter\LogFilter;
use App\Http\Controllers\Filter\SupplierLogFilter;
use App\Http\Services\LogService;
use App\Model\LogModel;
use App\Model\SupplierLogModel;
use Illuminate\Http\Request;
use DB;
class SkuController extends Controller
{
public function Entrance(Request $request, $id = 'index')
{
if ($request->path() == '/') {
$path = 'web/index';
} 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
];
return $this->$id($request);
}
public function __call($method, $parameters)
{
return $this->errhtml('Not', '没有这个页面');
}
public function SkuList($request)
{
return $this->view('供应商日志');
}
}
......@@ -20,8 +20,8 @@ Route::group(['middleware' => ['web', 'menu']], function () {
Route::match(['get', 'post'], '/supplier/{key}', 'SupplierController@info');
Route::match(['get', 'post'], '/supplier_contact/{key}', 'SupplierContactController@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'], '/sku/{key}', 'SkuController@Entrance');
Route::match(['get', 'post'], '/log/{key}', 'LogController@Entrance');
// Route::match(['get', 'post'], '/api/{key}', 'ApiController@Entrance');
// Route::match(['get', 'post'], '/hd/{key}', 'HandleController@Entrance');
......
......@@ -9,7 +9,8 @@ return [
'menuId' => env('MENU_ID'),
'menuUrl' => env('MENU_URL'),
'notAuth' => [
'SwitchWarehouse'
'SwitchWarehouse',
'SkuList'
]//不用验证权限的方法
],
];
......@@ -29,7 +29,7 @@ return [
'uploadskulist' => 'http://footstone.liexin.net/footstone/uploadskulist',
'batch' => 'http://footstone.liexin.net/footstone/Batches?', // 批量下架
'exportMonopoly' => 'http://footstone.liexin.net/footstone/exportMonopoly?', // 专卖商品批量导出
'templet' => 'http://footstone.liexin.com/footstone/templet?', // 专卖商品批量导出
'templet' => 'http://footstone.liexin.net/footstone/templet?', // 专卖商品批量导出
],
];
<script>
layui.use(['table', 'form', 'element', 'layer', 'Split', 'admin'], function () {
let $ = layui.jquery;
let Split = layui.Split;
// 水平分割,需要分割的元素(id)、默认大小(百分比)、最小值(单位px)
Split(['#s1', '#s2', '#s3', '#s4', '#s5'], {sizes: [9, 12, 12, 12, 55], minSize: 70});
let table = layui.table;
let form = layui.form;
let admin = layui.admin;
let initCondition = {source_type: 'all'};
let whereCondition = initCondition;
let type = 'all';
//点击罗盘筛选
$('.main_filter').click(function () {
$('.main_filter').attr('class', 'main_filter');
$(this).attr('class', 'main_filter layui-badge layui-bg-green');
type = $(this).attr('id');
whereCondition.source_type = type
table.reload('skuList', {
page: {
curr: 1
}
, where: whereCondition
});
});
let 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 + "'>" + data.supplier_code + "</a>"
}
},
{field: 'supplier_name', title: '供应商名称', align: 'center', width: 270},
{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: 70, templet: function (data) {
return "<a ew-href='/supplier/SupplierDetail?view=iframe&tab=contact&supplier_id=" + data.supplier_id +
"' style='color: dodgerblue' ew-title='供应商详情 - " + data.supplier_code + "' 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: 130},
{field: 'purchase_username', title: '渠道开发员', align: 'center', width: 120},
{field: 'create_name', title: '创建人', align: 'center', width: 80},
{field: 'update_time', title: '最近修改时间', align: 'center', width: 160},
{field: 'create_time', title: '创建时间', align: 'center', width: 150},
];
@if(checkPerm('ViewFakeSupplier'))
cols.push({
field: 'is_type', title: '正式供应商', align: 'center', width: 110, templet: function (data) {
return data.is_type === 0 ? '正式' : '<span style="color: red">竞调</span>';
}
})
@endif
table.render({
elem: '#skuList'
, url: '/api/supplier/GetSupplierList'
, method: 'post'
, size: 'sm'
, limit: 20
, cellMinWidth: 50 //全局定义常规单元格的最小宽度
, where: whereCondition
, loading: true
, first: true //不显示首页
, last: false //不显示尾页
, cols: [cols]
, id: 'skuList'
, page: {}
});
//新增供应商弹窗
$("#add_supplier").click(function () {
layer.open({
type: 2,
content: '/supplier/AddSupplier?view=iframe',
area: ['1000px', '97%'],
title: '新增供应商',
offset: ['10px'],
end: function () {
table.reload('skuList');
supplierStatistics();
}
});
})
//审批供应商弹窗
$("#audit_supplier").click(function () {
let checkStatus = table.checkStatus('skuList');
let data = checkStatus.data;
if (!data.length) {
layer.msg('请先选择要操作的供应商', {icon: 5})
} else {
let supplierId = data[0].supplier_id;
let status = data[0].status;
if (status !== 1 && status !== -1) {
layer.msg('该供应商已经被审核', {icon: 5})
return
}
if (status === -1) {
layer.msg('该供应商联系人未补全', {icon: 5});
return
}
layer.open({
type: 2,
content: '/supplier/AuditSupplier?view=iframe&supplier_id=' + supplierId,
area: ['800px', '50%'],
title: '审核供应商',
end: function () {
table.reload('skuList');
saveRefreshData('detail',supplierId)
supplierStatistics();
}
});
}
})
//分配渠道员
$("#allocate_purchase_user").click(function () {
let checkStatus = table.checkStatus('skuList');
let data = checkStatus.data;
if (!data.length) {
layer.msg('请先选择要操作的供应商', {icon: 5})
} else {
const status = data[0].status;
if ((status === 3 || status === 2 || status === -3)) {
let supplierId = data[0].supplier_id;
layer.open({
type: 2,
content: '/supplier/AllocatePurchaseUser?view=iframe&supplier_id=' + supplierId,
area: ['600px', '70%'],
title: '配置渠道开发员',
end: function () {
saveRefreshData('detail',supplierId)
table.reload('skuList');
supplierStatistics();
}
});
} else {
layer.msg('只能对已通过/未通过/禁用状态的供应商进行渠道员分配', {icon: 5})
return false;
}
}
})
$("#disable_supplier").click(function () {
let checkStatus = table.checkStatus('skuList');
let data = checkStatus.data;
if (!data.length) {
layer.msg('请先选择要操作的供应商', {icon: 5})
} else {
const status = data[0].status;
const hasSku = data[0].sku_num;
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) {
saveRefreshData('detail',supplierId)
table.reload('skuList')
supplierStatistics();
layer.closeAll();
layer.msg(res.err_msg, {icon: 6})
} else {
layer.msg(res.err_msg, {icon: 5})
}
});
} else {
layer.msg('只有已通过或者未通过状态,并且没有sku的供应商才可以禁用', {'icon': 5});
}
}
});
$("#change_supplier_is_type").click(function () {
let checkStatus = table.checkStatus('skuList');
let data = checkStatus.data;
if (!data.length) {
layer.msg('请先选择要操作的供应商', {icon: 5})
} else {
const isType = data[0].is_type;
if (isType === 0) {
layer.msg('该供应商已经是正式供应商', {'icon': 5});
return
}
layer.confirm('如果转成正式供应商,会进入待审核状态,需要补全相关信息申请审核,确定要转正该供应商吗?', function (index) {
let supplierId = data[0].supplier_id;
let res = ajax('/api/supplier/ChangeSupplierIsType', {supplier_id: supplierId, is_type: 0})
if (res.err_code === 0) {
saveRefreshData('detail',supplierId)
table.reload('skuList')
supplierStatistics();
layer.closeAll();
layer.msg(res.err_msg, {icon: 6})
} else {
layer.msg(res.err_msg, {icon: 5})
}
});
}
});
form.on('submit(load)', function (data) {
whereCondition = $.extend(false, initCondition, data.field);
//执行重载
table.reload('skuList', {
page: {
curr: 1
}
, where: whereCondition
});
supplierStatistics();
return false;
});
form.on('submit(reset)', function (data) {
layer.load(1);
location.reload();
});
});
</script>
\ No newline at end of file
{{--@include('web.supplier.SupplierListCommon')--}}
<div class="layui-btn-group demoTable" style="margin-bottom: 15px;margin-top: 15px">
@if(checkPerm('AddSupplier'))
<button type="button" class="layui-btn layui-btn-sm" id="add_supplier">新增</button>
@endif
@if(checkPerm('DisableSupplier'))
<button type="button" class="layui-btn layui-btn-sm" id="disable_supplier">禁用</button>
@endif
@if(checkPerm('AuditSupplier'))
<button type="button" class="layui-btn layui-btn-sm" id="audit_supplier">审核</button>
@endif
@if(checkPerm('AllocatePurchaseUser'))
<button type="button" class="layui-btn layui-btn-sm" id="allocate_purchase_user">分配渠道员</button>
@endif
@if(checkPerm('ChangeSupplierIsType'))
<button type="button" class="layui-btn layui-btn-sm" title="该操作可以将竞调供应商转为正式供应商" id="change_supplier_is_type">转正供应商</button>
@endif
</div>
<table class="layui-table" id="skuList" lay-filter="skuList"></table>
<script>
</script>
<style>
.main_filter {
cursor: pointer;
}
</style>
<div class="layui-fluid" id="type_filter">
<div class="layui-card">
<div class="layui-card-body" style="padding: 0;">
<div class="split-group" style="height: 130px;">
<div class="split-item" id="s1">
<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">
<div class="layui-row">
<a class="main_filter" id="pending">
</a>
</div>
<div class="layui-row">
<a class="main_filter" id="in_review">
</a>
</div>
</div>
</div>
<div class="split-item" id="s5">
</div>
</div>
</div>
</div>
</div>
<div class="layui-collapse">
@if(checkPerm('ViewFilter'))
<!--通用的筛选-->
<form class="layui-form" style="margin-top: 15px">
<?php
$routerName = explode('/', request()->path())[1];
?>
<div class="layui-row">
<div class="layui-inline">
@inject('statusPresenter','App\Presenters\StatusPresenter')
{!! $statusPresenter->render('supplier_group','供应商性质','',
config('fixed.SupplierGroup')) !!}
</div>
<div class="layui-inline">
@inject('transformableInputPresenter','App\Presenters\Filter\TransformableInputPresenter')
{!! $transformableInputPresenter->render(['supplier_name'=>'供应商名称','supplier_code'=>'供应商编码','supplier_id'=>'供应商ID']) !!}
</div>
{{-- <div class="layui-inline">--}}
{{-- @inject('statusPresenter','App\Presenters\StatusPresenter')--}}
{{-- {!! $statusPresenter->render('status','供应商状态','',config('fixed.SupplierStatus')) !!}--}}
{{-- </div>--}}
<div class="layui-inline">
@inject('statusPresenter','App\Presenters\StatusPresenter')
{!! $statusPresenter->render('stockup_type','合作类型','',config('fixed.StockupType')) !!}
</div>
<div class="layui-inline">
@inject('transformableSelectPresenter','App\Presenters\Filter\TransformableSelectPresenter')
{!! $transformableSelectPresenter->render(['channel_uid'=>'采购员','purchase_uid'=>'开发员','create_uid'=>'创建人'],$userCodes) !!}
</div>
@if(checkPerm('ViewFakeSupplier'))
<div class="layui-inline">
@inject('statusPresenter','App\Presenters\StatusPresenter')
{!! $statusPresenter->render('is_type','正式供应商','',[0=>'是',1=>'否'],['width'=>'100px']) !!}
</div>
@endif
</div>
<div class="layui-row">
<div class="layui-inline">
@inject('statusPresenter','App\Presenters\StatusPresenter')
{!! $statusPresenter->render('has_sku','SKU上传','',[-1=>'否',1=>'是']) !!}
</div>
<div class="layui-inline" style="width: 600px">
@inject('transformableTimeIntervalPresenter','App\Presenters\Filter\TransformableTimeIntervalPresenter')
{!! $transformableTimeIntervalPresenter->render(['update_time'=>'更新时间','create_time'=>'创建时间']) !!}
</div>
</div>
<div class="layui-row" style="margin-top:10px;margin-bottom: 10px;margin-left: 20px;">
<button class="layui-btn layui-btn-sm layui-btn load" id="getSupplierListButton" lay-submit=""
lay-filter="load">查询
</button>
<button type="button" class="layui-btn layui-btn-sm layui-btn" lay-submit="" lay-filter="reset">重置
</button>
<button type="button" class="layui-btn layui-btn-sm layui-btn hide_filter_type">隐藏罗盘</button>
<button type="button" class="layui-btn layui-btn-sm layui-btn show_filter_type"
style="display: none">显示罗盘
</button>
</div>
</form>
@endif
</div>
<script>
//一进来就去获取统计数据
function supplierStatistics() {
let res = ajax('/api/supplier_statistics/GetSupplierStatistics');
if (res.err_code === 0) {
$.each(res.data, function (index, value) {
let menuObj = $('#' + index);
menuObj.text('');
menuObj.append(value);
});
}
}
supplierStatistics();
//罗盘隐藏
$('.hide_filter_type').click(function () {
$(this).hide();
$('#type_filter').hide();
$('.show_filter_type').show();
});
$('.show_filter_type').click(function () {
$(this).hide();
$('#type_filter').show();
$('.hide_filter_type').show();
});
</script>
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