Commit 4d3b8901 by mushishixian

temp

parent dcf3e3ca
......@@ -78,42 +78,37 @@ class SupplierController extends Controller
}
//添加供应商
public function AddSupplier($request, $data)
public function AddSupplier($request)
{
$supplierId = $request->get('supplier_id');
$supplierService = new SupplierService();
$intracodeModel = new IntracodeModel();
$data['outside_contact_status'] = Config('fixed.OutsideContactStatus');
$data['outside_contact_type'] = Config('fixed.OutsideContactType');
$this->data['outside_contact_status'] = Config('fixed.OutsideContactStatus');
$this->data['outside_contact_type'] = Config('fixed.OutsideContactType');
$userCodes = $intracodeModel->getSampleEncode();
$data['userCodes'] = $userCodes;
$data['user'] = $userCodes;
$data['purchase_users'] = [];
$this->data['userCodes'] = $userCodes;
$this->data['user'] = $userCodes;
$this->data['purchase_users'] = [];
foreach ($userCodes as $userId => $code) {
$data['purchase_users'][] = [
$this->data['purchase_users'][] = [
'name' => $code,
'value' => $userId,
];
}
//编辑
if (!empty($supplierId)) {
$data['title'] = '编辑供应商';
$data['supplierInfo'] = $supplierService->getSupplier($supplierId);
$this->data['title'] = '编辑供应商';
$this->data['supplierInfo'] = $supplierService->getSupplier($supplierId);
$DB = DB::connection('yunxin');
$supplierAccountInfo = $DB->table('supplier_account')->where("supplier_com_id", "=",
$supplierId)->select('mobile', "password_raw")->first();
$data['supplier_account_info'] = $supplierAccountInfo;
$data['address'] = $supplierService->getAddress($supplierId);
$this->data['supplier_account_info'] = $supplierAccountInfo;
$this->data['address'] = $supplierService->getAddress($supplierId);
} else {
$data['title'] = '添加供应商';
}
//审核人已经查看
if ($data['canAudit']) {
$viewCheckService = new ViewCheckService();
$viewCheckService->addSupplierView($supplierId);
$this->data['title'] = '添加供应商';
}
return view('web', $data);
return $this->view('新增供应商');
}
//操作日志列表
......
......@@ -162,3 +162,15 @@ function iframeUrl($Url)
return $Url;
}
//上传文件接口签名
function Autograph()
{
$url = Config('website.UploadUrl');
$data['k1'] = time();
$data['k2'] = MD5(MD5($data['k1']) . Config('fixed.UploadKey'));
echo '<script>
k1="' . $data['k1'] . '";
k2="' . $data['k2'] . '";
UploadImgUrl="' . $url . '"
</script>';
}
<?php
namespace App\Model;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\DB;
class BrandModel extends Model
{
protected $connection = 'self';
public $timestamps = false;
protected $table = 'brand';
//获取缓存的二级分类
public function getBrandList()
{
$brandList = Cache::get('cube_brands');
if (!$brandList) {
$result = $this->select(['brand_id', 'brand_name', 'brand_logo', 'brand_brief'])
->where('status', 1)
->get()->toArray();
Cache::put('cube_brands', $result, 3600);
return $result;
}
return $brandList;
}
//根据条件获取自营和联营分类
public function getBrandListByType($type)
{
$redis = new RedisModel();
$brandList = [];
//1就是去取自营的品牌列表
if ($type == 1) {
$data = $redis->hgetall('Self_Brand');
foreach ($data as $key => $item) {
$item = json_decode($item, true);
if (!$item['brand_id'])continue;
$brandList[] = [
'brand_id' => $item['brand_id'],
'brand_name' => $item['brand_name'],
];
}
} else {
$data = $redis->get('brand_select');
if (empty($data)) {
$data = DB::connection('spu')->table('brand')->where('status',1)->orderBy('brand_id','asc')->pluck('brand_name', 'brand_id');
$redis->set('brand_select', json_encode($data));
$redis->expire('brand_select', 3600);
}else{
$data = json_decode($data, true);
}
foreach ($data as $brandId => $brandName) {
if (!$brandId)continue;
$brandList[] = [
'brand_id' => $brandId,
'brand_name' => $brandName,
];
}
}
return $brandList;
}
}
\ No newline at end of file
......@@ -38,7 +38,7 @@ class TransformableTimeIntervalPresenter
elem: '#$unique'
,type: 'date'
,trigger:'click'
,range: '~' //或 range: '~' 来自定义分割字符
,range: '-' //或 range: '~' 来自定义分割字符
});
});
</script>
......
......@@ -9,13 +9,14 @@ class StatusPresenter
public function render($name, $text, $status = null, $data = [0 => '禁用', 1 => '启用'], $option = [])
{
$isRequired = array_get($option, 'required', false);
$width = array_get($option, 'width','auto');
$requiredHtml = $isRequired ? '<span class="require">*</span>' : "";
$html = <<<EOF
<label class="layui-form-label">
$requiredHtml
$text
</label>
<div class="layui-input-inline">
<div class="layui-input-inline" style="width: $width">
<select name="$name" id="$name" lay-filter="$name" lay-search="">
{$this->optionsRender($data, $status)}
</select>
......
......@@ -13,7 +13,8 @@ layui.config({ // common.js是配置layui扩展模块的目录,每个页面
tagsInput: 'tagsInput/tagsInput',
citypicker: 'city-picker/city-picker',
introJs: 'introJs/introJs',
zTree: 'zTree/zTree'
zTree: 'zTree/zTree',
xmSelect: 'xmSelect/xm-select'
}).use(['layer', 'admin'], function () {
var $ = layui.jquery;
var layer = layui.layer;
......
<!DOCTYPE html><html><head><link rel="preload" href="./xm-select.js" as="script"><link rel="preload" href="./static/docs.js" as="script"><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"><title>xm-select</title><link rel="stylesheet" href="https://www.layuicdn.com/layui-v2.5.5/css/layui.css"><script src="https://www.layuicdn.com/layui-v2.5.5/layui.all.js"></script><script src="https://unpkg.com/axios/dist/axios.min.js"></script></head><body><div id="app"></div><script type="text/javascript" src="./xm-select.js"></script><script type="text/javascript" src="./static/docs.js"></script></body></html>
\ No newline at end of file
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
......@@ -18,7 +18,7 @@
<style>
html *
{
font-size: 13px !important;
font-size: 12px !important;
}
.layui-input {
height: 30px;
......
<script>
layui.use(['table', 'form', 'element', 'layer', 'admin', 'laydate','xmSelect'], function () {
let admin = layui.admin;
let form = layui.form;
let layDate = layui.laydate;
let element = layui.element;
let xmSelect = layui.xmSelect;
layDate.render({
elem: '#established_time'
, type: 'month'
, format: 'yyyy-MM'
});
//监听币种变化,人民币才显示公司税号
form.on('select(currency)', function (data) {
if (data.value === '1') {
$('#tax_number_div').show();
form.render('select');
} else {
$('#tax_number_div').hide();
form.render('select');
}
});
//渲染主营品牌的多选
function getBrandOption(element, brandType) {
let brandUrl = '/api/common/getBrandList?type=' + brandType;
let brandRes = ajax(brandUrl);
let brandList = brandRes.data;
return {
el: '#' + element,
filterable: true,
paging: true,
height: '300px',
direction: 'auto',
autoRow: true,
prop: {
name: 'brand_name',
value: 'brand_id',
},
pageSize: 30,
data: brandList,
on: function (brandList) {
let arr = brandList.arr;
let brandIds = '';
for (let i in arr) {
brandIds += arr[i].brand_id + ',';
}
let idName = 'main_brands';
$('#' + idName).val(brandIds);
},
};
}
let brandOption = getBrandOption('brand_selector', 2);
let brandSelector = xmSelect.render(brandOption);
let brandIds = $('#main_brands').attr('value');
brandSelector.setValue(brandIds.split(','));
form.on('submit(load)', function (data) {
let supplierId = getQueryVariable('supplier_id');
let url = '/api/supplier_contact/SaveSupplierContact?supplier_id=' + supplierId;
let res = ajax(url, 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;
});
});
</script>
\ No newline at end of file
<script>
layui.use(['table', 'form', 'element', 'layer', 'Split'], function () {
layui.use(['table', 'form', 'element', 'layer', 'Split','admin'], function () {
let $ = layui.jquery;
let Split = layui.Split;
let admin = layui.admin;
// 水平分割,需要分割的元素(id)、默认大小(百分比)、最小值(单位px)
Split(['#s1', '#s2', '#s3', '#s4', '#s5'], {sizes: [7, 9, 9, 9, 63], minSize: 70});
......@@ -62,21 +63,19 @@
, page: {}
});
// layer.confirm('确定禁用该供应商吗', {
// title: info + '供应商'
// , btn: ['确定', '取消']
// }, function () {
// layer.closeAll('dialog'); // 确定时关闭弹框
// let res = ajax('/api/supplier/ChangeSupplierStatus', data);
// if (!res) {
// layer.msg(res.err_msg, {icon: 6});
// } else {
// layer.msg(res.err_msg, {icon: 6});
// location.reload();
// }
// }, function () {
// layer.close();
// });
// allocate_purchase_user
//新增供应商弹窗
$("#add_supplier").click(function () {
admin.open({
type: 2,
content: '/supplier/AddSupplier?view=iframe',
area: ['1000px', '750px'],
title: '新增供应商',
end: function () {
// table.reload('list');
}
});
})
form.on('submit(load)', function (data) {
form.render();
......
<script>
layui.use(['table', 'form', 'element', 'layer', 'admin'], function () {
let table = layui.table;
let form = layui.form;
let admin = layui.admin;
let element = layui.element;
table.render({
elem: '#contactList',
url: '/api/supplier_contact/GetSupplierContactList',
method: 'get',
cellMinWidth: 80,//全局定义常规单元格的最小宽度
where: {
supplier_id: getQueryVariable("supplier_id")
},
loading: true,
first: true,//不显示首页
last: false,//不显示尾页
cols: [[
{type: 'checkbox',},
{field: 'supplier_consignee', title: '联系人', align: 'center'},
{field: 'supplier_position', title: '职位', align: 'center'},
{field: 'supplier_email', title: '邮箱', align: 'center'},
{field: 'supplier_mobile', title: '手机号', align: 'center'},
{field: 'supplier_telephone', title: '座机', align: 'center'},
{field: 'supplier_qq', title: 'QQ', align: 'center'},
{field: 'supplier_fax', title: '传真', align: 'center'},
{field: 'can_check_uids', title: '采购员', align: 'center'},
]],
id: 'contactList',
page: {},
});
//新增联系方式
$("#add_contact").click(function () {
let supplierId = getQueryVariable('supplier_id');
admin.open({
type: 2,
content: '/supplier_contact/AddSupplierContact?view=iframe&supplier_id=' + supplierId,
area: ['600px', '525px'],
title: '编辑联系人',
end: function () { // 监听弹窗关闭
table.reload('contactList');
}
});
})
//批量删除
$(document).on('click', '#batchDelete', function () {
let checkStatus = table.checkStatus('contactList');
let data = checkStatus.data;
let contactIds = [];
$.each(data, function (index, value) {
contactIds.push(value.contact_id);
});
batchDeleteContact(contactIds);
});
//批量删除操作
function batchDeleteContact(contactId) {
layer.confirm('确定要删除所选联系方式?', function (index) {
let resp = ajax('/api/supplier_contact/DeleteSupplierContact', {contact_id: contactId});
if (!resp) {
layer.msg('网络连接失败', {'icon': 5});
return false;
}
if (resp.err_code === 0) {
table.reload('contactList');
layer.closeAll();
layer.msg(resp.err_msg, {'icon': 6});
} else {
layer.msg(resp.err_msg, {'icon': 5});
return false;
}
});
}
});
</script>
\ No newline at end of file
{{Autograph()}}
<script>
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;
upload.render({
elem: '.uploadObj'
,url: 'https://httpbin.org/post' //改成您自己的上传接口
,accept: 'file' //音频
,data : {
k1:k1,
k2:k2,
source:1
}
,before: function(){
layer.tips('接口地址:'+ this.url, this.item, {tips: 1});
}
,done: function(res, index, upload){
var item = this.item;
console.log(item); //获取当前触发上传的元素,layui 2.1.0 新增
console.log(res); //获取当前触发上传的元素,layui 2.1.0 新增
}
});
});
</script>
\ No newline at end of file
<style>
.layui-form-item {
margin-bottom: 5px;
}
.layui-input-inline {
margin-top: 0px;
}
.xm-select {
height: 30px;
line-height: 30px;
}
/*.layui-form-label {*/
/* width: 150px;*/
/*}*/
/*.layui-input-block {*/
/* margin-left: 180px;*/
/*}*/
</style>
<div class="layui-card">
<div class="layui-card-body">
<form class="layui-form" action="">
<blockquote class="layui-elem-quote layui-text">
<b>基本信息</b>
</blockquote>
<div class="layui-form-item">
<label class="layui-form-label"><span class="require">*</span>供应商名称 : </label>
<div class="layui-input-block">
<input type="text" name="supplier_name" id="supplier_name"
placeholder="请输入供应商名称" class="layui-input"
value="">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">英文名称 : </label>
<div class="layui-input-block">
<input type="text" name="supplier_name_en" id="supplier_name_en"
placeholder="请输入供应商英文名称" class="layui-input"
value="">
</div>
</div>
<div class="layui-form-item">
<div class="layui-row">
<div class="layui-col-md4">
@inject('statusPresenter','App\Presenters\StatusPresenter')
{!! $statusPresenter->render('region','所在区域','',
config('fixed.Region'),['required'=>true,'width'=>'150px']) !!}
</div>
<div class="layui-col-md8">
<label class="layui-form-label">注册地址 :
</label>
<div class="layui-input-block">
<input type="text" name="supplier_address" id="supplier_address"
placeholder="请输入注册地址" class="layui-input"
value="">
</div>
</div>
</div>
</div>
<div class="layui-form-item">
<div class="layui-row">
<div class="layui-col-md4">
<label class="layui-form-label"><span class="require">*</span>法人代表 :
</label>
<div class="layui-input-block">
<input type="text" style="width: 150px" name="supplier_address" id="supplier_address"
placeholder="请输入法人代表" class="layui-input"
value="">
</div>
</div>
<div class="layui-col-md8">
<label class="layui-form-label" style="width: 80px">成立时间 :
</label>
<div class="layui-input-block" style="width: 150px">
<input type="text" id="established_time" name="established_time"
placeholder="请输入成立时间"
class="layui-input"
autocomplete="off"
value="">
</div>
</div>
</div>
<div class="layui-form-item layui-form-text">
<label class="layui-form-label">资信调查 : </label>
<div class="layui-input-block">
<textarea name="credit_investigation" placeholder="请输入资信调查" class="layui-textarea"></textarea>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">
主营品牌</label>
<div class="layui-input-block">
<div id="brand_selector" class="layui-input-inline" style="width: 660px;">
</div>
<input type="hidden" name="main_brands" value="{{$supplierInfo['main_brands'] or ''}}"
id="main_brands">
</div>
</div>
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label"><span class="require">*</span>合作类型</label>
<div class="layui-input-block">
<input type="hidden" name="stockup_type"
value="{{$supplierInfo['stockup_type'] or ''}}">
@foreach(config('fixed.StockupType') as $k=>$type)
<input type="checkbox" name="stockup_type[{{$k}}]"
lay-skin="primary"
@if(!empty($supplierInfo['stockup_type_data'])&&in_array($k,$supplierInfo['stockup_type_data']))
checked
@endif
title="{{$type}}">
@endforeach
</div>
</div>
</div>
<div class="layui-form-item">
<div class="layui-inline">
@inject('statusPresenter','App\Presenters\StatusPresenter')
{!! $statusPresenter->render('currency','结算币种',
isset($supplierInfo)?$supplierInfo['currency']:'',config('fixed.Currency'),['required'=>false]) !!}
</div>
<div class="layui-inline" id="tax_number_div"
@if(empty($supplierInfo) || (!empty($supplierInfo)&&$supplierInfo['currency']!=1))
style="display: none;"
@endif
>
<label class="layui-form-label"><span class="require">*</span>公司税号</label>
<div class="layui-input-inline">
<input type="text" name="tax_number" placeholder="请输入公司税号" class="layui-input"
value="{{$supplierInfo['tax_number'] or ''}}">
</div>
</div>
</div>
@include('web.supplier.SupplierFile')
<blockquote class="layui-elem-quote layui-text">
<b>跟进人</b>
</blockquote>
@inject('statusPresenter','App\Presenters\StatusPresenter')
<div class="layui-form-item">
{!! $statusPresenter->render('region','渠道开发员','',$userCodes,['required'=>true,'width'=>'150px']) !!}
</div>
</div>
</form>
</div>
</div>
\ No newline at end of file
......@@ -3,9 +3,9 @@
@include('web.supplier.SupplierListCommon')
<div class="layui-btn-group demoTable" style="margin-bottom: 15px;margin-top: 15px">
<button class="layui-btn layui-btn-sm" id="add">新增</button>
<button class="layui-btn layui-btn-sm" id="disable">禁用</button>
<button class="layui-btn layui-btn-sm" id="audit">审核</button>
<button class="layui-btn layui-btn-sm" id="add_supplier">新增</button>
<button class="layui-btn layui-btn-sm" id="disable_supplier">禁用</button>
<button class="layui-btn layui-btn-sm" id="audit_supplier">审核</button>
<button class="layui-btn layui-btn-sm" id="allocate_purchase_user">分配渠道员</button>
</div>
......
......@@ -6,81 +6,4 @@
<table class="layui-table" lay-filter="contactList" id="contactList"></table>
</div>
<script>
layui.use(['table', 'form', 'element', 'layer', 'admin'], function () {
let table = layui.table;
let form = layui.form;
let admin = layui.admin;
let element = layui.element;
table.render({
elem: '#contactList',
url: '/api/supplier_contact/GetSupplierContactList',
method: 'get',
cellMinWidth: 80,//全局定义常规单元格的最小宽度
where: {
supplier_id: getQueryVariable("supplier_id")
},
loading: true,
first: true,//不显示首页
last: false,//不显示尾页
cols: [[
{type: 'checkbox',},
{field: 'supplier_consignee', title: '联系人', align: 'center'},
{field: 'supplier_position', title: '职位', align: 'center'},
{field: 'supplier_email', title: '邮箱', align: 'center'},
{field: 'supplier_mobile', title: '手机号', align: 'center'},
{field: 'supplier_telephone', title: '座机', align: 'center'},
{field: 'supplier_qq', title: 'QQ', align: 'center'},
{field: 'supplier_fax', title: '传真', align: 'center'},
{field: 'can_check_uids', title: '采购员', align: 'center'},
]],
id: 'contactList',
page: {},
});
//新增联系方式
$("#add_contact").click(function () {
let supplierId = getQueryVariable('supplier_id');
admin.open({
type: 2,
content: '/supplier_contact/AddSupplierContact?view=iframe&supplier_id=' + supplierId,
area: ['600px', '525px'],
title: '编辑联系人',
end: function () { // 监听弹窗关闭
table.reload('contactList');
}
});
})
//批量删除
$(document).on('click', '#batchDelete', function () {
let checkStatus = table.checkStatus('contactList');
let data = checkStatus.data;
let contactIds = [];
$.each(data, function (index, value) {
contactIds.push(value.contact_id);
});
batchDeleteContact(contactIds);
});
//批量上下架操作
function batchDeleteContact(contactId) {
layer.confirm('确定要删除所选联系方式?', function (index) {
let resp = ajax('/api/supplier_contact/DeleteSupplierContact', {contact_id: contactId});
if (!resp) {
layer.msg('网络连接失败', {'icon': 5});
return false;
}
if (resp.err_code === 0) {
table.reload('contactList');
layer.closeAll();
layer.msg(resp.err_msg, {'icon': 6});
} else {
layer.msg(resp.err_msg, {'icon': 5});
return false;
}
});
}
});
</script>
\ No newline at end of file
@include('script.supplier.SupplierContact')
\ No newline at end of file
<div class="layui-form-item">
<div class="layui-row">
<div class="layui-col-md4">
<label class="layui-form-label">营业执照 :
</label>
<div class="layui-upload">
<button type="button" class="layui-btn layui-btn-primary layui-btn-sm uploadObj">选择文件</button>
</div>
</div>
<div class="layui-col-md4">
<label class="layui-form-label">开票资料 :
</label>
<div class="layui-upload">
<button type="button" class="layui-btn layui-btn-primary layui-btn-sm uploadObj">选择文件</button>
</div>
</div>
</div>
</div>
@include('script.supplier.SupplierFile')
\ No newline at end of file
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