Commit d56eda19 by 杨树贤

fix

parent 33a56d4f
<div class="layui-header">
<div class="layui-logo">
<img src="/images/warehouse.png"/>
<cite>&nbsp;<?php echo e(config('website.webTitle')); ?> </cite>
</div>
<ul class="layui-nav layui-layout-left">
<li class="layui-nav-item" lay-unselect>
<a ew-event="flexible" title="侧边伸缩"><i class="layui-icon layui-icon-shrink-right"></i></a>
</li>
<li class="layui-nav-item" lay-unselect>
<a ew-event="refresh" title="刷新"><i class="layui-icon layui-icon-refresh-3"></i></a>
</li>
</ul>
<ul class="layui-nav layui-layout-right">
<?php /* <li class="layui-nav-item" lay-unselect>*/ ?>
<?php /* <a id="Warehouse">当前仓库: A仓库</a>*/ ?>
<?php /* <dl class="layui-nav-child">*/ ?>
<?php /* <dd lay-unselect>*/ ?>
<?php /* <a data-id="A" class="SwitchWarehouse">A仓库</a>*/ ?>
<?php /* <a data-id="B" class="SwitchWarehouse">B仓库</a>*/ ?>
<?php /* </dd>*/ ?>
<?php /* </dl>*/ ?>
<?php /* </li>*/ ?>
<li class="layui-nav-item layui-hide-xs" lay-unselect>
<a ew-event="fullScreen" title="全屏"><i class="layui-icon layui-icon-screen-full"></i></a>
</li>
<?php /* <li class="layui-nav-item layui-hide-xs" lay-unselect>*/ ?>
<?php /* <a ew-event="lockScreen" title="锁屏"><i class="layui-icon layui-icon-password"></i></a>*/ ?>
<?php /* </li>*/ ?>
<li class="layui-nav-item" lay-unselect>
<a>
<img src="<?php echo e(isset($header) ? $header : '/images/missing_face.png'); ?>" class="layui-nav-img">
<cite><?php echo e(isset($username) ? $username : ''); ?></cite>
</a>
<dl class="layui-nav-child">
<dd lay-unselect>
<a href="<?php echo e(Config::get('website.login')['logout'].'?redirect='.URL::current().'&from=login'); ?>" style="margin-right:10px;" onclick="clearTips()"><i class="fa fa-sign-out"></i><span class="nav-label">切换账号</span></a>
<a href="<?php echo e(Config::get('website.login')['logout'].'?redirect='.URL::current().'&from=login'); ?>" onclick="clearTips()" ><i class="fa fa-sign-out"></i><span class="nav-label">退出</span></a>
</dd>
</dl>
</li>
<li class="layui-nav-item" lay-unselect>
<a ew-event="" title=""><i class="layui-icon layui-icon-more-vertical"></i></a>
</li>
</ul>
</div>
<script>
function clearTips(){
layui.use(['admin', 'index'], function () {
let admin = layui.admin;
admin.putTempData('has_pop_up_all_channel_user_supplier_tips', 0);
});
}
</script>
\ No newline at end of file
<?php echo $__env->make('web.supplier.SupplierListFilter', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
<div class="layui-btn-group demoTable" style="margin-bottom: 15px;margin-top: 15px">
<?php if(checkPerm('AddSupplier')): ?>
<button type="button" class="layui-btn layui-btn-sm" id="add_supplier">新增</button>
<?php endif; ?>
<?php if(checkPerm('DisableSupplier')): ?>
<button type="button" class="layui-btn layui-btn-sm" id="disable_supplier">禁用</button>
<?php endif; ?>
<?php if(checkPerm('AuditSupplier')): ?>
<button type="button" class="layui-btn layui-btn-sm" id="audit_supplier">审核</button>
<?php endif; ?>
<?php /* <?php if(checkPerm('AllocatePurchaseUser')): ?>*/ ?>
<?php /* <button type="button" class="layui-btn layui-btn-sm" id="allocate_purchase_user">分配渠道员</button>*/ ?>
<?php /* <?php endif; ?>*/ ?>
<?php if(checkPerm('BatchAllocatePurchaseUser')): ?>
<?php /* <button type="button" class="layui-btn layui-btn-sm" id="batch_allocate_purchase_user">批量分配渠道员</button>*/ ?>
<button type="button" class="layui-btn layui-btn-sm" id="batch_allocate_purchase_user">分配渠道员</button>
<?php endif; ?>
<?php if(checkPerm('AllocateChannelUser')): ?>
<button type="button" class="layui-btn layui-btn-sm" id="allocate_channel_user">分配采购员</button>
<?php endif; ?>
<?php if(checkPerm('ChangeSupplierIsType')): ?>
<button type="button" class="layui-btn layui-btn-sm" title="该操作可以将竞调供应商转为正式供应商"
id="change_supplier_is_type">
转正供应商
</button>
<?php endif; ?>
<?php /* <button type="button" class="layui-btn layui-btn-sm" title="点击确定审核后会进入审核中状态"*/ ?>
<?php /* id="batch_apply_in_review_supplier">*/ ?>
<?php /* 申请审核*/ ?>
<?php /* </button>*/ ?>
<?php if(checkPerm('BlockSupplier')): ?>
<?php /* <button type="button" class="layui-btn layui-btn-sm" id="block_supplier">*/ ?>
<?php /* 拉黑*/ ?>
<?php /* </button>*/ ?>
<?php endif; ?>
<?php if(request()->user->userId==1000 || request()->user->userId==2082): ?>
<button type="button" class="layui-btn layui-btn-sm" title="该操作可以将供应商同步到供应商"
id="sync_supplier_to_erp">
金蝶同步
</button>
<button type="button" class="layui-btn layui-btn-sm" title="该操作可以将供应商同步到一体化"
id="sync_supplier_to_united">
一体化同步
</button>
<?php endif; ?>
<?php if(checkPerm('ApplySupplierShare')): ?>
<?php /* <?php if(checkPerm('BlockSupplier')): ?>*/ ?>
<button type="button" class="layui-btn layui-btn-sm" id="apply_supplier_share">
共用申请
</button>
<?php endif; ?>
<?php if(checkPerm('AuditSupplierShare')): ?>
<button type="button" class="layui-btn layui-btn-sm" id="audit_supplier_share_apply">
共用审核
<?php if(!empty($shareApplyCount)): ?>
(<?php echo e($shareApplyCount); ?>)
<span style="margin-left: 0" class="layui-badge-dot layui-bg-orange"></span>
<?php endif; ?>
</button>
<?php endif; ?>
<?php if(checkPerm('BatchAddTag')): ?>
<button type="button" class="layui-btn layui-btn-sm" id="batch_add_tags">
新增供应商标签
</button>
<?php endif; ?>
<?php if(checkPerm('BatchAllocateYunxinChannelUser')): ?>
<button type="button" class="layui-btn layui-btn-sm" id="batch_allocate_yunxin_channel_user">设置SKU采购
</button>
<?php endif; ?>
<?php if(checkPerm('ExportSupplier')): ?>
<button type="button" class="layui-btn layui-btn-sm" id="export_supplier">导出采购员全离职供应商</button>
<?php endif; ?>
<?php if(checkPerm('QuerySupplier')): ?>
<button type="button" class="layui-btn layui-btn-sm" id="query_supplier">查询供应商</button>
<?php endif; ?>
<?php if(checkPerm('TransferSupplier')): ?>
<button type="button" class="layui-btn layui-btn-sm" id="transfer_supplier">供应商交接</button>
<?php endif; ?>
</div>
<button type="button" id="refreshWindow" style="display: none">刷新页面</button>
<table class="layui-table" id="list" lay-filter="list"></table>
<script>
</script>
<script type="text/html" id="operate">
<div style="text-align: left;">
<?php if($canAudit): ?>
<a href="/supplier/AddSupplier?supplier_id={{ d.supplier_id}}" class="btn btn-xs btn-outline btn-success"
target="_blank">修改</a>
<?php else: ?>
<a href="/supplier/AddSupplier?supplier_id={{ d.supplier_id}}" class="btn btn-xs btn-outline btn-success"
target="_blank">查看</a>
<?php endif; ?>
</div>
</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: 170px;">
<div class="split-item" id="s1" style="text-align: center">
<div class="layui-row">
<a class="main_filter layui-badge layui-bg-green" id="total"></a>
<div class="layui-row">
<a class="main_filter" title="待复审" id="need_review">
待复审
</a>
</div>
</div>
</div>
<div class="split-item" id="s6" style="text-align: center">
<div class="layui-row">
<a class="main_filter" title="战略供应商" id="level_a">
</a>
</div>
<div class="layui-row">
<a class="main_filter" title="账期供应商" id="pay_type_term">
</a>
</div>
<div class="layui-row">
<a class="main_filter" title="缺少平台合作协议(线上)" id="no_cooperation_agreement">
缺少平台合作协议(线上)
</a>
</div>
<div class="layui-row">
<a class="main_filter" title="缺少品质协议(线上)" id="no_quality_assurance_agreement_all">
缺少品质协议(线上)
</a>
</div>
<?php if(checkPerm('SupplierBlockList')): ?>
<div class="layui-row">
<a class="main_filter" id="block" data-value="-3">
</a>
</div>
<?php endif; ?>
</div>
<div class="split-item" id="s7" style="text-align: center">
<div class="layui-row">
<a class="main_filter" title="历史平台合作供应商" id="uploaded_sku">
历史平台合作供应商
</a>
</div>
<div class="layui-row">
<a class="main_filter" title="非芯链供应商" id="not_yunxin">
非芯链供应商
</a>
</div>
<div class="layui-row">
<a class="main_filter" title="已上架(非芯链)供应商" id="not_yunxin_and_has_sku">
已上架(非芯链)供应商
</a>
</div>
<div class="layui-row">
<a class="main_filter" title="已下架(非芯链)供应商" id="not_yunxin_and_has_no_sku">
已下架(非芯链)供应商
</a>
</div>
<div class="layui-row">
<a class="main_filter" title="芯链供应商" id="yunxin">
芯链供应商
</a>
</div>
<div class="layui-row">
<a class="main_filter" title="已上架(芯链)供应商" id="yunxin_and_has_sku">
已上架(芯链)供应商
</a>
</div>
<div class="layui-row">
<a class="main_filter" title="已下架(芯链)供应商" id="yunxin_and_has_no_sku">
已下架(芯链)供应商
</a>
</div>
</div>
<div class="split-item" id="s8" style="text-align: center">
<div class="layui-row">
<a class="main_filter" title="3天内到期(芯链)供应商" id="yunxin_expired_at_days">
3天内到期(芯链)供应商
</a>
</div>
<div class="layui-row">
<a class="main_filter" title="3天内到期(非芯链)供应商" id="not_yunxin_expired_at_days">
3天内到期(非芯链)供应商
</a>
</div>
<div class="layui-row">
<a class="main_filter" title="已过期(芯链)供应商" id="yunxin_expired">
已过期(芯链)供应商
</a>
</div>
<div class="layui-row">
<a class="main_filter" title="已过期(非芯链)供应商" id="not_yunxin_expired">
已过期(非芯链)供应商
</a>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="layui-collapse">
<?php if(checkPerm('ViewFilter')): ?>
<!--通用的筛选-->
<form class="layui-form" style="margin-top: 15px">
<?php
$routerName = explode('/', request()->path())[1];
?>
<div class="layui-row">
<div class="layui-row">
<div class="layui-inline">
<?php $multiTransformableSelectPresenter = app('App\Presenters\Filter\MultiTransformableSelectPresenter'); ?>
<?php echo $multiTransformableSelectPresenter->render(['supplier_group'=>'供应商性质'],
['supplier_group'=>config('fixed.SupplierGroup')]); ?>
</div>
<div class="layui-inline">
<?php $transformableInputPresenter = app('App\Presenters\Filter\TransformableInputPresenter'); ?>
<?php echo $transformableInputPresenter->render(['supplier_name'=>'供应商名称']); ?>
</div>
<div class="layui-inline">
<?php $transformableInputPresenter = app('App\Presenters\Filter\TransformableInputPresenter'); ?>
<?php echo $transformableInputPresenter->render(['supplier_code'=>'供应商编码']); ?>
</div>
<div class="layui-inline">
<?php $multiSelectorPresenter = app('App\Presenters\MultiSelectorPresenter'); ?>
<?php echo $multiSelectorPresenter->render('status','供应商状态','',$statusData); ?>
</div>
<div class="layui-inline">
<?php $multiSelectorPresenter = app('App\Presenters\MultiSelectorPresenter'); ?>
<?php echo $multiSelectorPresenter->render('stockup_type','合作类型','',$stockupTypeData); ?>
</div>
</div>
<div class="layui-row">
<div class="layui-inline">
<?php $multiTransformableSelectPresenter = app('App\Presenters\Filter\MultiTransformableSelectPresenter'); ?>
<?php echo $multiTransformableSelectPresenter->render(['has_sku'=>'SKU上传'],
['has_sku'=>[1=>'是',-1=>'否']]); ?>
</div>
<div class="layui-inline">
<?php $multiTransformableSelectPresenter = app('App\Presenters\Filter\MultiTransformableSelectPresenter'); ?>
<?php echo $multiTransformableSelectPresenter->render(['yunxin_channel_uid' => '线上采购员'],
['yunxin_channel_uid' => $userCodes]); ?>
</div>
<div class="layui-inline">
<?php $multiTransformableSelectPresenter = app('App\Presenters\Filter\MultiTransformableSelectPresenter'); ?>
<?php echo $multiTransformableSelectPresenter->render(['source' => 'SKU上传方式',],
['source'=>config('field.SkuSource')]); ?>
</div>
<div class="layui-inline">
<?php $statusPresenter = app('App\Presenters\StatusPresenter'); ?>
<?php echo $statusPresenter->render('purchase_type','代购类型','',config('field.PurchaseType')); ?>
</div>
<div class="layui-inline">
<?php $multiTransformableSelectPresenter = app('App\Presenters\Filter\MultiTransformableSelectPresenter'); ?>
<?php echo $multiTransformableSelectPresenter->render(['has_uploaded_sku'=>'历史SKU合作'],
['has_uploaded_sku'=>[1=>'是',-1=>'否']]); ?>
</div>
<button class="layui-btn layui-btn-sm" type="button" id="show_filter_row2">展开</button>
</div>
</div>
<div class="layui-row" id="filter_row2" style="display: none">
<div class="layui-inline">
<?php $multiTransformableSelectPresenter = app('App\Presenters\Filter\MultiTransformableSelectPresenter'); ?>
<?php echo $multiTransformableSelectPresenter->render(['company_nature'=>'公司实际性质'],
['company_nature'=>config('field.CompanyNature')]); ?>
</div>
<div class="layui-inline">
<?php $transformableInputPresenter = app('App\Presenters\Filter\TransformableInputPresenter'); ?>
<?php echo $transformableInputPresenter->render(['group_code'=>'集团编码']); ?>
</div>
<div class="layui-inline">
<?php $transformableInputPresenter = app('App\Presenters\Filter\TransformableInputPresenter'); ?>
<?php echo $transformableInputPresenter->render(['supplier_id'=>'供应商ID']); ?>
</div>
<div class="layui-inline">
<?php $transformableSelectPresenter = app('App\Presenters\Filter\TransformableSelectPresenter'); ?>
<?php echo $transformableSelectPresenter->render(['channel_uid'=>'采购员'],$userCodes); ?>
</div>
<div class="layui-inline">
<?php $transformableSelectPresenter = app('App\Presenters\Filter\TransformableSelectPresenter'); ?>
<?php echo $transformableSelectPresenter->render(['purchase_uid'=>'开发员'],$userCodes); ?>
</div>
<div class="layui-inline">
<?php $transformableSelectPresenter = app('App\Presenters\Filter\TransformableSelectPresenter'); ?>
<?php echo $transformableSelectPresenter->render(['create_uid'=>'创建人'],$userCodes); ?>
</div>
<div class="layui-inline">
<?php $multiTransformableSelectPresenter = app('App\Presenters\Filter\MultiTransformableSelectPresenter'); ?>
<?php echo $multiTransformableSelectPresenter->render(['sku_tag'=>'SKU标准'],
['sku_tag'=>config('field.SkuTag')]); ?>
</div>
<div class="layui-inline">
<?php $multiTransformableSelectPresenter = app('App\Presenters\Filter\MultiTransformableSelectPresenter'); ?>
<?php echo $multiTransformableSelectPresenter->render(['sku_mode'=>'SKU模式'],
['sku_mode'=>config('field.SkuMode')]); ?>
</div>
<div class="layui-inline">
<?php $multiSelectorPresenter = app('App\Presenters\MultiSelectorPresenter'); ?>
<?php echo $multiSelectorPresenter->render('supplier_type','供应商类型','',$supplierTypeData); ?>
</div>
<div class="layui-inline">
<?php $multiSelectorPresenter = app('App\Presenters\MultiSelectorPresenter'); ?>
<?php echo $multiSelectorPresenter->render('level','等级','',$levelData); ?>
</div>
<div class="layui-inline">
<?php $multiTransformableSelectPresenter = app('App\Presenters\Filter\MultiTransformableSelectPresenter'); ?>
<?php echo $multiTransformableSelectPresenter->render(['has_cooperation_agreement'=>'平台合作协议'],
['has_cooperation_agreement'=>[1=>'是',-1=>'否']]); ?>
</div>
<div class="layui-inline">
<?php $statusPresenter = app('App\Presenters\StatusPresenter'); ?>
<?php echo $statusPresenter->render('is_entity','实体名单','',config('field.IsEntity')); ?>
</div>
<div class="layui-inline">
<?php $statusPresenter = app('App\Presenters\StatusPresenter'); ?>
<?php echo $statusPresenter->render('sign_com_id', '签约公司', 0, \App\Http\Services\CrmService::getSignCompanyListMap()); ?>
</div>
<div class="layui-inline">
<label class="layui-form-label">创建部门</label>
<div class="layui-input-inline">
<div id="create_user_department" style="width: 150px"></div>
</div>
</div>
<div class="layui-row">
<div class="layui-inline" style="width: 600px">
<?php $transformableTimeIntervalPresenter = app('App\Presenters\Filter\TransformableTimeIntervalPresenter'); ?>
<?php echo $transformableTimeIntervalPresenter->render(['update_time'=>'更新时间','create_time'=>'创建时间','sku_create_time' => '首次上传sku时间']); ?>
</div>
</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>
<?php endif; ?>
</div>
<div class="layui-side">
<div class="layui-side-scroll">
<ul class="layui-nav layui-nav-tree arrow2" lay-filter="admin-side-nav" lay-shrink="all">
<?php if(!empty($menus)): ?>
<?php foreach($menus as $k=>$v): ?>
<li class="layui-nav-item">
<?php if(!empty($v['title'])): ?>
<?php if(!empty($v['target'])): ?>
<a <?php if(!empty($v['href'])): ?> href="<?php echo e($v['href']); ?>" target="_blank" <?php endif; ?>>
<i class="layui-icon <?php echo e(isset($v['class']) ? $v['class'] : ''); ?>"></i>&emsp;<cite><?php echo e(isset($v['title']) ? $v['title'] : ''); ?></cite>
</a>
<?php else: ?>
<a <?php if(!empty($v['href'])): ?> lay-href="<?php echo e(iframeUrl($v['href'])); ?>" <?php endif; ?>>
<i class="layui-icon <?php echo e(isset($v['class']) ? $v['class'] : ''); ?>"></i>&emsp;<cite><?php echo e(isset($v['title']) ? $v['title'] : ''); ?></cite>
</a>
<?php endif; ?>
<?php endif; ?>
<?php echo $__env->make("layouts.menu", array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
</li>
<?php endforeach; ?>
<?php endif; ?>
</ul>
</div>
</div>
\ No newline at end of file
<?php if(!empty($v['childs'])): ?>
<dl class="layui-nav-child">
<?php foreach($v['childs'] as $k=>$v): ?>
<dd>
<a class="layui-icon <?php echo e(isset($v['class']) ? $v['class'] : ''); ?>" <?php if(!empty($v['href'])): ?> lay-href="<?php echo e(iframeUrl($v['href'])); ?>" <?php endif; ?>><?php echo e($v['title']); ?></a>
<?php echo $__env->make("layouts.menu", array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
</dd>
<?php endforeach; ?>
</dl>
<?php endif; ?>
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title><?php echo e(config('website.webTitle')); ?> | <?php echo e(isset($title) ? $title : ''); ?></title>
<script src="/js/jquery-2.2.1.js"></script>
<?php /* <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>*/ ?>
<link rel="stylesheet" href="/plugins/assets/libs/layui/css/layui.css"/>
<link rel="stylesheet" href="/plugins/assets/module/admin.css?v=317"/>
<script type="text/javascript" src="https://frq.ichunt.net/js/web/backpopx.js"></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>
<![endif]-->
</head>
<style>
.layui-layout-admin .layui-body {
buttom: 1px;
}
input:focus, textarea:focus {
outline: 1px solid #AFECAB;
}
</style>
<body class="layui-layout-body">
<div class="layui-layout layui-layout-admin">
<!-- 头部 -->
<?php echo $__env->make('layouts.header', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
<!-- 侧边栏 -->
<?php echo $__env->make('layouts.navigation', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
<!-- 主体部分 -->
<div class="layui-body">
</div>
</div>
<!-- 加载动画 -->
<!-- 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;
var layer = layui.layer;
var index = layui.index;
var admin = layui.admin;
if (layui.admin.setter.pageTabs && layui.admin.setter.tabAutoRefresh == true) {
$('.layui-layout-admin>.layui-body>.layui-tab').attr('lay-autoRefresh', 'true');
}
let jumpUrl = getQueryVariable('jump_url');
if (jumpUrl) {
index.loadHome({
menuPath: jumpUrl + location.search + '&view=iframe',
menuName: '<i class="layui-icon layui-icon-home"></i>'
});
} else {
// 默认加载主页
index.loadHome({
menuPath: '/index/Index?view=iframe',
menuName: '<i class="layui-icon layui-icon-home"></i>'
});
}
admin.on('tab', function (d) {
//判断列表是否需要刷新
if (d.layId.search('SupplierList') !== -1) {
setTimeout(function () {
$('.admin-iframe').contents().find('#refreshWindow').click()
}, 10);
}
//判断详情是否需要刷新
if (d.layId.search('SupplierDetail') !== -1) {
let vars = d.layId.split("&");
let supplierFlag = vars[1];
let data = admin.getTempData("needFreshDetail_" + supplierFlag);
if (data) {
admin.refresh();
admin.putTempData("needFreshDetail_" + supplierFlag, null);
}
}
if (d.layId.search('SupplierApplyList') !== -1) {
setTimeout(function () {
$('.admin-iframe').contents().find('#refreshWindow').click()
}, 10);
}
});
});
</script>
</body>
</html>
<div class="layui-row">
<div class="layui-col-md3">
<h2><b>供应商新增统计</b></h2>
</div>
<div class="layui-col-md9" style="text-align: right">
</div>
</div>
<div style="width: 100%">
<div id="main" style="width: 100%;height:400px;"></div>
</div>
<script src="/plugins/echarts/echarts.min.js"></script>
<script>
let myChart = echarts.init(document.getElementById('main'));
// 指定图表的配置项和数据
let option = {
tooltip: {
trigger: 'axis'
},
legend: {
data: ['所有新增供应商', '我的新增供应商']
},
toolbox: {
show: true,
feature: {
dataZoom: {
yAxisIndex: 'none'
},
dataView: {readOnly: false},
magicType: {type: ['line', 'bar']},
restore: {},
saveAsImage: {}
}
},
xAxis: {
type: 'category',
boundaryGap: false,
data: <?php echo json_encode($dates); ?>
},
yAxis: {
type: 'value',
axisLabel: {
formatter: '{value}'
}
},
series: [
{
name: '所有新增供应商',
type: 'line',
data: <?php echo e(json_encode($all_increase_statistics)); ?>,
markPoint: {
data: [
{type: 'max', name: '最大值'},
{type: 'min', name: '最小值'}
]
},
markLine: {
data: [
{type: 'average', name: '平均值'}
]
}
},
{
name: '我的新增供应商',
type: 'line',
data: <?php echo e(json_encode($user_increase_statistics)); ?>,
markPoint: {
data: [
{name: '周最低', value: -2, xAxis: 1, yAxis: -1.5}
]
},
markLine: {
data: [
{type: 'average', name: '平均值'},
[{
symbol: 'none',
x: '90%',
yAxis: 'max'
}, {
symbol: 'circle',
label: {
position: 'start',
formatter: '最大值'
},
type: 'max',
name: '最高点'
}]
]
}
}
]
};
// 使用刚指定的配置项和数据显示图表。
myChart.setOption(option);
layui.use(['admin', 'index'], function () {
let index = layui.index;
let admin = layui.admin;
});
</script>
<script>
layui.use(['table', 'form', 'element', 'layer'], function () {
var table = layui.table;
var form = layui.form;
table.render({
elem: '#list'
, url: '/api/supplier/GetSupplierList'
, method: 'post'
, cellMinWidth: 80 //全局定义常规单元格的最小宽度
, where: {
status: 1
}
, size: 'sm'
, limit: 8
, loading: true
, first: true //不显示首页
, last: false //不显示尾页
, cols: [[
{field: 'supplier_code', title: '供应商编码', align: 'center'},
{field: 'supplier_name', title: '供应商名称', align: 'center'},
{field: 'supplier_group', title: '供应商性质', align: 'center'},
{field: 'stockup_type', title: '合作类型', align: 'center'},
{field: 'channel_username', title: '渠道开发员', align: 'center'},
{field: 'create_name', title: '创建人', align: 'center'},
{field: 'create_time', title: '创建时间', align: 'center'},
{field: 'status_name', title: '状态', align: 'center'},
{field: 'operate', title: '操作', templet: '#operate', align: 'center'},
]]
, id: 'SupplierList'
, page: false
});
form.on('submit(load)', function (data) {
form.render();
//执行重载
table.reload('SupplierList', {
page: {
curr: 1
}
, where: data.field
});
return false;
});
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, '删除');
}
});
function up_status(data, info) {
layer.confirm('确定' + info + '组成员吗', {
title: info + '组成员'
, btn: ['确定', '取消']
}, function () {
layer.closeAll('dialog'); // 确定时关闭弹框
let res = ajax('/api/save_group_user', data);
if (!res) {
return layer.msg('禁用失败', {icon: 6});
} else {
layer.msg(res.errmsg, {icon: 6});
$('.load').click();
}
}, function () {
layer.close();
});
}
//我的供应商----------------------------------------------------
table.render({
elem: '#own'
, url: '/api/supplier/GetSupplierList'
, method: 'post'
, cellMinWidth: 80 //全局定义常规单元格的最小宽度
, where: {
source_type: 'own'
}
, limit: 8
, loading: true
, first: true //不显示首页
, last: false //不显示尾页
, cols: [[
{field: 'supplier_code', title: '供应商编码', align: 'center', width: 120},
{field: 'supplier_name', title: '供应商名称', align: 'center'},
{field: 'supplier_group', title: '供应商性质', align: 'center', width: 120},
{field: 'stockup_type', title: '合作类型', align: 'center', width: 100},
{field: 'channel_username', title: '采购员', align: 'center', width: 130},
{field: 'create_time', title: '创建时间', align: 'center', width: 170},
{field: 'purchase_username', title: '渠道开发员', align: 'center', width: 130},
{field: 'audit_time', title: '审批时间', align: 'center', width: 170},
{
field: 'status_name', title: '状态', align: 'center', width: 80, templet: function (data) {
if (data.status_name === "驳回") {
return "<span style='color: red' title='" + data.reject_reason + "'>" + data.status_name + "</sspan>";
}
return data.status_name;
}
},
{field: 'operate', title: '操作', templet: '#operate_own', align: 'center', width: 180},
]]
, id: 'SupplierList'
, page: false
});
form.on('submit(load)', function (data) {
form.render();
//执行重载
table.reload('SupplierList', {
page: {
curr: 1
}
, where: data.field
});
return false;
});
table.on('tool(own)', function (obj) {
let data = obj.data;
let layEvent = obj.event;
if (layEvent === 'draft') {
let map = {
supplier_id: data.supplier_id,
status: -1
};
updateStatus(map, '转为草稿');
}
});
});
</script>
\ No newline at end of file
<script>
layui.use(['table', 'form', 'element', 'layer', 'Split', 'admin', 'index', 'xmSelect'], function () {
let $ = layui.jquery;
let Split = layui.Split;
// 水平分割,需要分割的元素(id)、默认大小(百分比)、最小值(单位px)
Split(['#s1', '#s6', '#s7', '#s8'], {sizes: [9, 12, 12, 12], minSize: 70});
// Split(['#s1', '#s2', '#s3', '#s4', '#s5', '#s6', '#s7','#s8'], {sizes: [9, 12, 12, 12, 12, 12, 12,19], minSize: 70});
let table = layui.table;
let form = layui.form;
let index = layui.index;
let admin = layui.admin;
let xmSelect = layui.xmSelect;
let initCondition = {source_type: 'all'};
let whereCondition = initCondition;
let type = 'all';
let currentPage = 1;
//一进来就去获取统计数据
function supplierStatistics(hasLoading = false) {
if (hasLoading) {
admin.showLoading({
elem: '#type_filter',
type: 3,
});
}
$.ajax({
url: '/api/supplier_statistics/GetSupplierStatistics',
type: 'post',
async: true,
dataType: 'json',
timeout: 20000,
success: function (res) {
if (res.err_code === 0) {
$.each(res.data, function (index, value) {
let menuObj = $('#' + index);
menuObj.text('');
menuObj.append(value);
});
if (getQueryVariable('source_type')) {
$('#' + getQueryVariable('source_type')).click();
}
}
if (hasLoading) {
admin.removeLoading('#type_filter');
}
}
})
}
supplierStatistics(true);
//罗盘隐藏
$('.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();
});
$('#show_filter_row2').click(function () {
let isHidden = $('#filter_row2').is(':hidden');
if (isHidden) {
$('#filter_row2').show();
$('#show_filter_row2').text('隐藏');
} else {
$('#filter_row2').hide();
$('#show_filter_row2').text('展开');
}
});
$(function () {
$('.layui-form .layui-col-md5 .layui-edge').remove();
});
//这个是页面点击刷新方法,隐藏起来是为了页面切换回这个列表的时候触发的
$('#refreshWindow').click(function () {
//判断当前是否有layui弹窗窗口,有的话不刷新
let hasLayerIframe = $('.layui-layer').size() > 0;
if (!hasLayerIframe) {
$('#getSupplierListButton').click();
}
});
//点击罗盘筛选
$('.main_filter').click(function () {
clearTypeFilter();
$(this).attr('class', 'main_filter layui-badge layui-bg-green');
type = $(this).attr('id');
whereCondition.source_type = type
table.reload('list', {
page: {
curr: 1
}
, where: whereCondition
});
});
if (getQueryVariable('source_type')) {
whereCondition.source_type = getQueryVariable('source_type');
}
var createUserDepartmentSelector = xmSelect.render({
el: '#create_user_department',
autoRow: true,
name: 'create_user_department',
filterable: true,
direction: 'down',
tree: {
show: true,
showFolderIcon: true,
showLine: true,
indent: 20,
expandedKeys: true,
},
size: 'mini',
toolbar: {
show: true,
list: ['ALL', 'CLEAR']
},
height: 'auto',
data: function () {
//这个数据在对应的blade页面下面...
return <?php echo json_encode($createUserDepartmentList); ?>;
}
})
let cols = [
{type: 'checkbox', fixed: true},
{
field: 'supplier_code', title: '供应商编码', align: 'center', width: 90, templet: function (data) {
return "<a ew-href='/supplier/SupplierDetail?view=iframe&supplier_id=" + data.supplier_id +
"' class='list-href' ew-title='供应商详情 - " + data.supplier_code + "'>" + data.supplier_code + "</a>"
}
},
{field: 'group_code', title: '集团编码', align: 'center', width: 90},
{
field: 'supplier_name', title: '供应商名称', align: 'left', width: 180, templet: function (data) {
if (data.status === -3) {
return "<span title='" + data.block_reason + "'>" + data.supplier_name + "</span>"
} else {
return data.supplier_name;
}
}
},
{field: 'supplier_group', title: '供应商性质', align: 'center', width: 115},
{field: 'company_nature', title: '公司实际性质', align: 'center', width: 125},
{
field: 'level', title: '等级', align: 'center', width: 60, templet: function (d) {
return d.level ? d.level : '-';
}
},
{field: 'region_name', title: '区域', align: 'center', width: 60},
{
field: 'stockup_type', title: '合作类型', align: 'center', width: 120, templet: function (data) {
return "<span title='" + data.stockup_type + "'>" + data.stockup_type + "</span>"
}
},
{field: 'purchase_type_name', title: '代购类型', align: 'center', width: 80},
{
field: 'has_quality_assurance_agreement',
title: '品质协议',
align: 'center',
width: 80,
},
{
field: 'has_cooperation_agreement',
title: '平台合作协议',
align: 'center',
width: 120,
},
{
field: 'channel_username', title: '采购员', align: 'center', width: 130, templet: function (data) {
if (data.resign_channel_username) {
if (data.on_job_channel_username) {
return `<span>${data.on_job_channel_username}</span>` + `,<span style="color: #D7D7D7">${data.resign_channel_username}</span>`;
} else {
return `<span style="color: #D7D7D7">${data.resign_channel_username}</span>`
}
} else {
return `<span>${data.on_job_channel_username}</span>`;
}
}
},
{
field: 'is_entity', title: '实体名单', align: 'center', width: 80, templet: function (data) {
let color = '';
switch (data.is_entity) {
case 1:
color = '#FF0000';
break;
case 0:
color = '#FFA500';
break;
case -2:
color = '#ff0000';
break;
default:
color = '';
}
return '<span style="color: ' + color + ';" title="' + data.disable_reason + '">' + data.is_entity_name + '</span>';
}
},
{
field: 'status_name', title: '状态', align: 'center', width: 80, templet: function (data) {
switch (data.status) {
case 3:
return "<span style='color: red' title='" + data.reject_reason + "'>" + data.status_name + "</span>"
case -3:
return "<span style='color: red' title='" + data.block_reason + "'>" + data.status_name + "</span>"
case -2:
return "<span style='color: red' title='" + data.disable_reason + "'>" + data.status_name + "</span>"
default:
return data.status_name;
}
}
},
{field: 'sign_com_name', title: '签约公司', align: 'center', width: 130},
{field: 'last_update_name', title: '最新修改人', align: 'center', width: 110},
{
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 +
"' class='list-href' ew-title='供应商详情 - " + data.supplier_code + "' title='点击跳转查看联系人列表'>" + data.contact_num + "</a>"
}
},
{field: 'purchase_username', title: '渠道开发员', align: 'center', width: 110},
{field: 'yunxin_channel_username', title: '线上采购员', align: 'center', width: 110},
{field: 'has_sku', title: 'SKU上传', align: 'center', width: 80},
{
field: 'uploaded_sku', title: 'SKU合作', align: 'center', width: 80, templet: function (data) {
return data.uploaded_sku > 0 ? '是' : '否';
}
},
{field: 'average_sku_num', title: '日均上架数', align: 'center', width: 100},
{
field: 'cp_time_day', title: '有效期最高天数', align: 'center', width: 180, templet: function (data) {
let cpTime = data.cp_time_day == -1 ? '无限制' : data.cp_time_day + '天';
let futuresCpTime = data.futures_cp_time_day == -1 ? '无限制' : data.futures_cp_time_day + '天';
return '现货 : ' + cpTime + ' | 期货 : ' + futuresCpTime;
}
},
{field: 'create_name', title: '创建人', align: 'center', width: 70},
{field: 'create_user_department_name', title: '创建部门', align: 'center', width: 100},
{field: 'update_time', title: '最近修改时间', align: 'center', width: 145},
{field: 'supplier_type_name', title: '供应商类别', align: 'center', width: 110},
{field: 'create_time', title: '创建时间', align: 'center', width: 145},
{field: 'sku_create_time', title: '首次上传sku时间', align: 'center', width: 145},
{field: 'last_upload_sku_time', title: '最新上传sku时间', align: 'center', width: 145},
];
cols.push(
);
table.render({
elem: '#list'
, url: '/api/supplier/GetSupplierList'
, method: 'post'
, size: 'sm'
, limit: 20
, cellMinWidth: 50 //全局定义常规单元格的最小宽度
, where: whereCondition
, loading: true
, first: true //不显示首页
, last: false //不显示尾页
, cols: [cols]
, id: 'list'
, page: {}
, done: function (res, curr, count) {
//得到当前页码
currentPage = curr;
res.data.forEach(function (item, index) {
if (item.status === -3) {
//禁用复选框,设置不可选中标识,将该行设置为阴影色
var tr = $(".layui-table tr[data-index=" + index + "]");
tr.find("input[type='checkbox']").prop('disabled', true);
tr.find("input[type='checkbox']").next().addClass('layui-btn-disabled');
tr.find('.layui-form-checkbox').addClass('layui-hide');
tr.css("color", "#A9A5A5");
tr.addClass('block-class')
}
});
}
});
// 点击行checkbox选中
$(document).on("click", ".layui-table-body table.layui-table tbody tr", function () {
let index = $(this).attr('data-index');
let tableBox = $(this).parents('.layui-table-box');
let tableDiv = null;
if (tableBox.find(".layui-table-fixed.layui-table-fixed-l").length > 0) {
tableDiv = tableBox.find(".layui-table-fixed.layui-table-fixed-l");
} else {
tableDiv = tableBox.find(".layui-table-body.layui-table-main");
}
let checkCell = tableDiv.find("tr[data-index=" + index + "]").find("td div.laytable-cell-checkbox div.layui-form-checkbox I");
if (checkCell.length > 0) {
checkCell.click();
}
});
$(document).on("click", "td div.laytable-cell-checkbox div.layui-form-checkbox", function (e) {
e.stopPropagation();
});
//监听复选框事件,被选中的行高亮显示
table.on('checkbox(list)', function (obj) {
//拉黑就不用变色了
if (obj.data.status === -3) {
return
}
if (obj.checked === true && obj.type === 'all') {
//点击全选,拉黑的不用选上
$('.layui-table-body table.layui-table tbody tr:not(.block-class)').addClass('layui-table-click');
$('.layui-table-body table.layui-table tbody').find('.block-class').find('.layui-form-checkbox').remove();
$('.layui-table-body table.layui-table tbody tr .block-class').addClass('layui-table-click');
} else if (obj.checked === false && obj.type === 'all') {
//点击全不选
$('.layui-table-body table.layui-table tbody tr').removeClass('layui-table-click');
} else if (obj.checked === true && obj.type === 'one') {
//点击单行
if (obj.checked === true) {
obj.tr.addClass('layui-table-click');
} else {
obj.tr.removeClass('layui-table-click');
}
} else if (obj.checked === false && obj.type === 'one') {
//点击全选之后点击单行
if (obj.tr.hasClass('layui-table-click')) {
obj.tr.removeClass('layui-table-click');
}
}
});
//保存需要刷新的页面数据
function saveRefreshData(type, supplierId = 0) {
admin.putTempData("needFreshDetail_supplier_id=" + supplierId, 1);
}
//新增供应商弹窗
$("#add_supplier").click(function () {
index.openTab({
title: '新增供应商',
url: '/supplier/AddSupplier?view=iframe',
end: function () {
// insTb.reload();
}
});
})
//同步金蝶的手动操作
$("#sync_supplier_to_erp").click(function () {
let checkStatus = table.checkStatus('list');
let data = checkStatus.data;
if (!data.length) {
layer.msg('请先选择要操作的供应商', {icon: 5})
} else {
if (data.length > 1) {
layer.msg('该操作不支持多选', {icon: 5})
return;
}
let supplierId = data[0].supplier_id;
let res = ajax('/api/supplier/SyncToErp', {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})
}
}
});
//同步一体化的手动操作
$("#sync_supplier_to_united").click(function () {
let checkStatus = table.checkStatus('list');
let data = checkStatus.data;
if (!data.length) {
layer.msg('请先选择要操作的供应商', {icon: 5})
} else {
if (data.length > 1) {
layer.msg('该操作不支持多选', {icon: 5})
return;
}
let supplierId = data[0].supplier_id;
let res = ajax('/api/supplier/SyncToUnited', {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})
}
}
});
//审批供应商弹窗
$("#audit_supplier").click(function () {
let checkStatus = table.checkStatus('list');
let data = checkStatus.data;
if (!data.length) {
layer.msg('请先选择要操作的供应商', {icon: 5})
} else {
if (data.length > 1) {
layer.msg('该操作不支持多选', {icon: 5})
return;
}
let supplierId = data[0].supplier_id;
let status = data[0].status;
let canReviewSupplier = <?php echo e(checkPerm("ReviewSupplier")?1:0); ?>;
if (canReviewSupplier === 0 && status === -1) {
layer.msg('你没有复审供应商的权限', {icon: 5})
return
}
if (status === 0) {
layer.msg('该供应商还没有申请审核', {icon: 5});
return;
}
if (status !== 1 && status !== -1) {
layer.msg('该供应商已经被审核', {icon: 5});
return;
}
let checkAuditMsg = checkCanAudit(supplierId);
if (checkAuditMsg !== '') {
layer.msg(checkAuditMsg, {icon: 5});
return
}
layer.open({
type: 2,
content: '/supplier/AuditSupplier?view=iframe&supplier_id=' + supplierId,
area: ['800px', '65%'],
title: '审核供应商',
end: function () {
table.reload('list');
saveRefreshData('detail', supplierId)
supplierStatistics();
}
});
}
})
//批量修改(分配)渠道员
$("#batch_allocate_purchase_user").click(function () {
let checkStatus = table.checkStatus('list');
let data = checkStatus.data;
let supplierIds = Array.from(data, ({supplier_id}) => supplier_id);
supplierIds = supplierIds.join(',');
if (!data.length) {
layer.msg('请先选择要操作的供应商', {icon: 5})
} else {
let status = Array.from(data, ({status}) => status);
//分配采购员的多选操作,需要先去判断是否存在审核中的供应商,存在的话,要提示
if (status.indexOf(1) !== -1 || status.indexOf(-3) !== -1 || status.indexOf(-1) !== -1) {
layer.msg('选择的供应商里,存在审核中/待复审/黑名单的供应商,无法分配渠道员', {icon: 5})
return
}
layer.open({
type: 2,
content: '/supplier/BatchAllocatePurchaseUser?view=iframe&supplier_ids=' + supplierIds,
area: ['600px', '70%'],
title: '批量分配渠道员',
end: function () {
table.reload('list');
supplierStatistics();
}
});
}
})
//申请进入审核中的状态
$("#batch_apply_in_review_supplier").click(function () {
let checkStatus = table.checkStatus('list');
let data = checkStatus.data;
let supplierIds = Array.from(data, ({supplier_id}) => supplier_id);
if (data.length > 1) {
layer.msg('该操作不支持多选', {icon: 5})
return;
}
supplierIds = supplierIds.join(',');
if (!data.length) {
layer.msg('请先选择要操作的供应商', {icon: 5})
} else {
let status = Array.from(data, ({status}) => status);
let canApplyInReview = true;
$.each(status, function (index, value) {
if (value !== 0) {
canApplyInReview = false;
}
});
if (!canApplyInReview) {
layer.msg('选择的供应商里,存在非待提审状态的供应商,无法申请审核', {icon: 5})
return;
}
//还要去事先检测供应商信息是否完整
let checkApplyMsg = checkCanApplyInReview(supplierIds);
if (checkApplyMsg !== '') {
return false;
}
layer.open({
type: 2,
content: '/supplier/BatchApplyInReviewSupplier?view=iframe&supplier_ids=' + supplierIds,
area: ['800px', '70%'],
title: '申请审核供应商',
end: function () {
table.reload('list');
supplierStatistics();
}
});
}
})
//分配采购员,现在改成可以批量的了
$("#allocate_channel_user").click(function () {
let checkStatus = table.checkStatus('list');
let data = checkStatus.data;
if (!data.length) {
layer.msg('请先选择要操作的供应商', {icon: 5})
} else {
let status = Array.from(data, ({status}) => status);
let canApplyInReview = true;
$.each(status, function (index, value) {
console.log(value);
if (value === -1 || value === 1) {
canApplyInReview = false;
}
});
if (!canApplyInReview) {
layer.msg('选择的供应商里,存在 审核中/待复审 状态的供应商,无法分配采购员', {icon: 5})
} else {
let supplierIds = Array.from(data, ({supplier_id}) => supplier_id);
if (supplierIds.length > 20) {
layer.msg('最多一次操作20个供应商', {icon: 5})
return;
}
supplierIds = supplierIds.join(',');
layer.open({
type: 2,
content: '/supplier/AllocateChannelUser?view=iframe&supplier_ids=' + supplierIds,
area: ['80%', '80%'],
title: '新增采购员',
end: function () {
table.reload('list');
supplierStatistics();
}
});
}
}
})
//禁用供应商
$("#disable_supplier").click(function () {
let checkStatus = table.checkStatus('list');
let data = checkStatus.data;
if (!data.length) {
layer.msg('请先选择要操作的供应商', {icon: 5})
} else {
if (data.length > 1) {
layer.msg('该操作不支持多选', {icon: 5})
return;
}
const status = data[0].status;
const hasSku = data[0].sku_num;
const needReview = data[0].need_review;
if (needReview === 1 && status !== 0) {
layer.msg("该供应商还没有进行复审,不能直接禁用;", {icon: 5})
return;
}
if ((status === 3 || status === 2 || status === 0) && !hasSku) {
let supplierId = data[0].supplier_id;
layer.open({
type: 2,
content: '/supplier/DisableSupplier?view=iframe&supplier_id=' + supplierId,
area: ['700px', '70%'],
title: '禁用供应商',
end: function () {
saveRefreshData('detail', supplierId)
table.reload('list');
supplierStatistics();
}
});
} else {
layer.msg('只有待提审,已通过或者未通过状态,并且没有sku的供应商才可以禁用', {'icon': 5});
}
}
});
//转正供应商
$("#change_supplier_is_type").click(function () {
let checkStatus = table.checkStatus('list');
let data = checkStatus.data;
if (!data.length) {
layer.msg('请先选择要操作的供应商', {icon: 5})
} else {
if (data.length > 1) {
layer.msg('该操作不支持多选', {icon: 5})
return;
}
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('list')
supplierStatistics();
layer.closeAll();
layer.msg(res.err_msg, {icon: 6})
} else {
layer.msg(res.err_msg, {icon: 5})
}
});
}
});
//加入黑名单
$("#block_supplier").click(function () {
let checkStatus = table.checkStatus('list');
let data = checkStatus.data;
if (!data.length) {
layer.msg('请先选择要操作的供应商', {icon: 5})
} else {
if (data.length > 1) {
layer.msg('该操作不支持多选', {icon: 5})
return;
}
const status = data[0].status;
if (status === -3) {
layer.msg('该供应商已经在黑名单', {icon: 5});
return false;
}
if ((status === -1 || status === 1)) {
layer.msg('审核中/待复审状态的供应商无法加入黑名单', {icon: 5});
return false;
} else {
let supplierId = data[0].supplier_id;
layer.open({
type: 2,
content: '/supplier/BlockSupplier?view=iframe&supplier_id=' + supplierId,
area: ['700px', '70%'],
title: '加入黑名单',
end: function () {
saveRefreshData('detail', supplierId)
table.reload('list');
supplierStatistics();
}
});
}
}
});
//共用供应商申请
$("#apply_supplier_share").click(function () {
layer.open({
type: 2,
content: '/supplier_share_apply/ApplySupplierShare?view=iframe',
area: ['700px', '80%'],
title: '申请共用供应商',
end: function () {
}
});
});
//共用供应商审核
$("#audit_supplier_share_apply").click(function () {
layer.open({
type: 2,
content: '/supplier_share_apply/AuditSupplierShareApply?view=iframe',
area: ['70%', '80%'],
title: '共用申请审核',
end: function () {
}
});
});
//批量修改供应商标签
$("#batch_add_tags").click(function () {
layer.open({
type: 2,
content: '/supplier_tag/BatchAddTag?view=iframe',
area: ['70%', '90%'],
title: '供应商标签添加',
end: function () {
}
});
});
//设置SKU采购
$("#batch_allocate_yunxin_channel_user").click(function () {
let checkStatus = table.checkStatus('list');
let data = checkStatus.data;
let supplierIds = Array.from(data, ({supplier_id}) => supplier_id);
supplierIds = supplierIds.join(',');
if (!data.length) {
layer.msg('请先选择要操作的供应商', {icon: 5})
} else {
layer.open({
type: 2,
content: '/supplier/BatchAllocateYunxinChannelUser?view=iframe&supplier_ids=' + supplierIds,
area: ['80%', '80%'],
title: '批量配置线上采购员',
end: function () {
table.reload('list');
}
});
}
})
//查询供应商
$("#query_supplier").click(function () {
layer.open({
type: 2,
content: '/supplier/QuerySupplier?view=iframe',
area: ['70%', '30%'],
title: '查询供应商',
end: function () {
}
});
})
//交接供应商
$("#transfer_supplier").click(function () {
let checkStatus = table.checkStatus('list');
let data = checkStatus.data;
if (!data.length) {
layer.msg('请先选择要操作的供应商', {icon: 5})
} else {
if (data.length > 1) {
layer.msg('该操作不支持多选', {icon: 5})
return;
}
let supplierId = data[0].supplier_id;
layer.open({
type: 2,
content: '/supplier/TransferSupplier?view=iframe&supplier_id=' + supplierId,
area: ['50%', '70%'],
title: '交接供应商',
end: function () {
table.reload('list');
}
});
}
})
//判断是否要展示有全部离职采购员的供应商,有的话提示
if (!admin.getTempData('has_pop_up_all_channel_user_supplier_tips')) {
$.ajax({
url: '/api/supplier/checkHasAllResignedChannelUserSupplier',
type: 'POST',
async: true,
dataType: 'json',
timeout: 20000,
success: function (res) {
if (!res) {
layer.msg('网络错误,请重试', {icon: 6});
} else {
if (res.err_code === 0) {
layer.confirm('<div style="width: 400px;height: 50px;"><p>属于你部门的正式供应商有 <span style="color: red;">' + res.data + '</span> 没有有效采购员(采购员全离职)<p><p>请尽快分配采购员进行维护</p></div>', {
btn: ['立即前往', '关闭提示'], //按钮
offset: 'rb',
}, function () {
admin.putTempData('has_pop_up_all_channel_user_supplier_tips', 1);
layer.closeAll();
index.openTab({
title: '供应商列表',
url: '/supplier/SupplierList?view=iframe&source_type=all_channel_user_resigned',
end: function () {
}
});
}, function () {
admin.putTempData('has_pop_up_all_channel_user_supplier_tips', 1);
layer.closeAll();
});
} else {
}
}
},
error: function () {
layer.msg('网络错误', {icon: 5});
}
});
}
let formValue = {};
$('#export_supplier').click(function () {
window.open('/api/supplier/exportSupplier', '_blank');
});
//点击查询按钮
form.on('submit(load)', function (data) {
formValue = data.field;
//罗盘选项会跳回全部
clearTypeFilter();
$('#total').attr('class', 'main_filter layui-badge layui-bg-green');
whereCondition.source_type = 'all';
initCondition.source_type = whereCondition.source_type;
whereCondition = $.extend(false, initCondition, data.field);
//执行重载
table.reload('list', {
page: {
curr: 1
}
, where: whereCondition
});
supplierStatistics();
return false;
});
//点击重置按钮
form.on('submit(reset)', function (data) {
layer.load(1);
location.reload();
});
})
;
//检查是否能够审核,因为审核人只能审自己相关部门人员修改的供应商记录
function checkCanAudit(supplierId) {
let url = '/api/supplier/CheckCanAuditSupplier?supplier_id=' + supplierId;
let res = ajax(url);
if (res.err_code !== 0) {
return res.err_msg;
} else {
return '';
}
}
function checkCanApplyInReview(supplierIds) {
let url = '/api/supplier/CheckCanApplyInReview?supplier_ids=' + supplierIds;
let res = ajax(url);
if (res.err_code !== 0) {
let errMsg = res.err_msg;
let msg = '';
$.each(errMsg.split('|'), function (index, value) {
msg += "<span>" + value + "</span><br>"
});
layer.msg(msg, {icon: 5})
return false;
} else {
return '';
}
}
function clearTypeFilter() {
$('.main_filter').attr('class', 'main_filter');
}
</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