Commit 5d723e3b by 朱继来

temp

parent 827fd2c4
...@@ -19,6 +19,7 @@ use App\Model\OrderItemsModel; ...@@ -19,6 +19,7 @@ use App\Model\OrderItemsModel;
use App\Model\UserGroupModel; use App\Model\UserGroupModel;
use App\Model\BrandBlackListModel; use App\Model\BrandBlackListModel;
use App\Model\PayExtendModel; use App\Model\PayExtendModel;
use Illuminate\Support\Facades\Redis;
class ApiController extends Controller class ApiController extends Controller
{ {
...@@ -285,4 +286,61 @@ class ApiController extends Controller ...@@ -285,4 +286,61 @@ class ApiController extends Controller
$this->Export($PayExtendModel->setPay($request)); $this->Export($PayExtendModel->setPay($request));
} }
// 获取品牌库列表
public function getStandardBrandList($request)
{
$s_key = Config('config.s_standard_brand');
$data = Redis::get($s_key);
if (!$data) {
$url = Config('config.footstone_url').'/AuthApi/get_scm_brand_list';
$key = Config('config.auth_key');
$standard_brand_name = $request->input('standard_brand_name', '');
$standard_brand_name && $map['erp_brand_name'] = $standard_brand_name;
$map['time'] = time();
$map['AuthSign'] = MD5(MD5(http_build_query($map)) . $key);
$data['data'] = $map;
$result = json_decode(curlApi($url, $data, 'post'), true);
$expire = Config('config.s_standard_brand_expire');
Redis::set($s_key, json_encode($result['data']), $expire);
}
$this->ExportLayui($result['errcode'], $result['errmsg'], $result['data'], count($result['data']));
}
// 绑定品牌
public function apiBindStandardBrand($request)
{
$curr_brand = $request->input('curr_brand', '');
$standard_brand = $request->input('standard_brand', '');
if (!$curr_brand || !$standard_brand) return ['errcode'=>1, 'errmsg'=>'参数缺失'];
$url = Config('config.footstone_url').'/AuthApi/binding_scm_brand';
$key = Config('config.auth_key');
$map['time'] = time();
$map['scm_brand_id'] = 412;
$map['brand_id'] = [1];
$map['admin_id'] = 10000;
$map['admin_name'] = 'admin';
$map['AuthSign'] = MD5(MD5(http_build_query($map)) . $key);
$data['data'] = $map;
$result = curlApi($url, $data, 'post');
echo ($result);
}
} }
...@@ -23,4 +23,9 @@ return [ ...@@ -23,4 +23,9 @@ return [
// 'zoe@ichunt.com', // 'zoe@ichunt.com',
], ],
'footstone_url' => 'http://footstone.liexin.net',
'auth_key' => 'LX@ichunt.com82560956-0755',
's_standard_brand' => 'StandardBrand', // 缓存key
's_standard_brand_expire' => 7200, // 缓存两小时
]; ];
...@@ -88,4 +88,5 @@ return [ ...@@ -88,4 +88,5 @@ return [
'export_url' => 'http://export.liexin.com', 'export_url' => 'http://export.liexin.com',
'export_joint_source_id' => 16, 'export_joint_source_id' => 16,
'export_self_source_id' => 17, 'export_self_source_id' => 17,
]; ];
...@@ -883,7 +883,7 @@ ...@@ -883,7 +883,7 @@
'<td>'+(len - i)+'</td>'+ '<td>'+(len - i)+'</td>'+
'<td class="goods_id">'+list[i].goods_id+'</td>'+ '<td class="goods_id">'+list[i].goods_id+'</td>'+
'<td>'+list[i].goods_name+'</td>'+ '<td>'+list[i].goods_name+'</td>'+
'<td>'+list[i].brand_name+'</td>'; '<td class="brand_name">'+list[i].brand_name+'</td>';
if (goods_type == 1) { // 联营添加标准品牌列 if (goods_type == 1) { // 联营添加标准品牌列
if (list[i].standard_brand_name) { if (list[i].standard_brand_name) {
......
+(function($){ layui.use(['table', 'form'], function() {
$.lie = $.lie || {version: "v1.0.0"}; var table = layui.table;
var form = layui.form;
$.extend($.lie, {
standardBrand: { var renderTable = function() {
index: function() { table.render({
// 选择标准品牌 id: 'list'
$('.shop-table').delegate('.select-standard-brand', 'click', function() { ,elem: '#brandList'
layer.open({ ,url: '/api/getStandardBrandList' //数据接口
type: 1, ,method:'post'
area: ['700px'], ,cellMinWidth: 80 //全局定义常规单元格的最小宽度
title: '选择标准品牌', ,page: true //开启分页
content: $('#select-brand-pop'), ,cols: [[ //表头
btn: ['确定带回', '取消'], {type:'radio', width: 80}
btn1: function () { ,{field: 'erp_brand_name', title: '品牌名称', width: 596}
$.ajax({ ]]
type: "POST", ,limit: 10
url: '/ajax/deleteGoods', ,limits: [10, 20, 50,]
data: {uid : user_id, cart_id : cart_id}, });
dataType: "json", }
success: function(resp){
layer.msg(resp.errmsg); renderTable();
// self.parents('tr').remove();
loading.lists(user_id, goods_type, is_online, delivery_place); // 加载购物车列表 form.on('submit(load)', function(data) {
return false; //执行重载
}, table.reload('list', {
}) page: {
curr: 1
layer.msg('商品删除中...', {icon: 16, time: 0, shade: 0.3}); }
}, ,where: data.field
btn2: function (index) { });
layer.close(index);
}
})
})
return false;
});
//监听行单击事件(双击事件为:rowDouble)
table.on('row(brandList)', function(obj) { //注:test是table原始容器的属性 lay-filter="对应的值"
var data = obj.data;
selected = data;
console.log(data)
//选中行样式
obj.tr.addClass('layui-table-click').siblings().removeClass('layui-table-click');
//选中radio样式
obj.tr.find('i[class="layui-anim layui-icon"]').trigger("click");
});
// 选择标准品牌
$('.shop-table').delegate('.select-standard-brand', 'click', function() {
$('.standard_brand_name').val('');
renderTable(); // 重载表格
}, var curr_brand_id = $(this).parents('tr').find('.brand_id');
layer.open({
type: 1,
area: ['700px', '600px'],
title: '选择标准品牌',
content: $('#select-brand-pop'),
btn: ['确定带回', '取消'],
btn1: function () {
$.ajax({
type: "POST",
url: '/api/apiBindStandardBrand',
data: {uid : user_id, cart_id : cart_id},
dataType: "json",
success: function(resp){
layer.msg(resp.errmsg);
// self.parents('tr').remove();
// loading.lists(user_id, goods_type, is_online, delivery_place); // 加载购物车列表
return false;
},
})
} layer.msg('提交中...', {icon: 16, time: 0, shade: 0.3});
},
btn2: function (index) {
layer.close(index);
}
})
})
}); })
})(jQuery) \ No newline at end of file
...@@ -489,5 +489,5 @@ ...@@ -489,5 +489,5 @@
}) })
$.lie.add_order.lyorder(); $.lie.add_order.lyorder();
$.lie.standardBrand.index(); // $.lie.standardBrand.index();
</script> </script>
\ No newline at end of file
...@@ -6,14 +6,14 @@ ...@@ -6,14 +6,14 @@
#select-brand-pop .label-prompt{ padding: 6px !important; } #select-brand-pop .label-prompt{ padding: 6px !important; }
</style> </style>
<div class="shop-table"> <!-- <div class="shop-table">
<i class="fa fa-exclamation-triangle fa-2x select-standard-brand" aria-hidden="true"></i> <i class="fa fa-exclamation-triangle fa-2x select-standard-brand" aria-hidden="true"></i>
</div> </div> -->
<div id="select-brand-pop" class="select-content"> <div id="select-brand-pop" class="select-content">
<form class="layui-form layui-box" method="post"> <form class="layui-form layui-box" method="post">
<div class="layui-input-inline"> <div class="layui-input-inline">
<input type="text" name="brand_name" placeholder="输入品牌名称" autocomplete="off"> <input type="text" class="standard_brand_name" name="standard_brand_name" placeholder="输入品牌名称" autocomplete="off">
<button lay-submit lay-filter="load" class="layui-btn layui-btn-sm brand-search">搜索</button> <button lay-submit lay-filter="load" class="layui-btn layui-btn-sm brand-search">搜索</button>
</div> </div>
...@@ -24,39 +24,35 @@ ...@@ -24,39 +24,35 @@
</div> </div>
<script> <script>
layui.use(['table', 'form'], function() { // layui.use(['table', 'form'], function() {
var table = layui.table; // var table = layui.table;
var form = layui.form; // var form = layui.form;
var renderTable = function () { // table.render({
table.render({ // id: 'list'
id: 'list' // ,elem: '#brandList'
,elem: '#brandList' // ,url: '/api/getStandardBrandList' //数据接口
,url: '/api/ApiBrandBlackList' //数据接口 // ,method:'post'
,method:'post' // ,cellMinWidth: 80 //全局定义常规单元格的最小宽度
,cellMinWidth: 80 //全局定义常规单元格的最小宽度 // ,page: true //开启分页
,page: true //开启分页 // ,cols: [[ //表头
,cols: [[ //表头 // {type:'radio', width: 80}
{type:'radio', width: 80} // ,{field: 'erp_brand_name', title: '品牌名称', width: 596}
,{field: 'brand_name', title: '品牌名称', width: 596} // ]]
]] // ,limit: 10
,limit: 10 // ,limits: [10, 20, 50,]
,limits: [10, 20, 50,] // });
});
} // form.on('submit(load)', function(data) {
// //执行重载
renderTable(); // table.reload('list', {
// page: {
form.on('submit(load)', function(data) { // curr: 1
//执行重载 // }
table.reload('list', { // ,where: data.field
page: { // });
curr: 1
} // return false;
,where: data.field // });
}); // })
return false;
});
})
</script> </script>
\ 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