Commit def0c6dd by 朱继来

fix

parents 1f517382 66042ee6
......@@ -19,6 +19,8 @@ use App\Model\OrderItemsModel;
use App\Model\UserGroupModel;
use App\Model\BrandBlackListModel;
use App\Model\PayExtendModel;
use Illuminate\Support\Facades\Redis;
use App\Model\ShoppingCartModel;
class ApiController extends Controller
{
......@@ -285,4 +287,95 @@ class ApiController extends Controller
$this->Export($PayExtendModel->setPay($request));
}
// 获取品牌库列表
public function getStandardBrandList($request)
{
$standard_brand_name = $request->input('standard_brand_name', '');
// 搜索指定品牌
if ($standard_brand_name) {
$res = $this->apiStandardBrandList($standard_brand_name);
$this->ExportLayui(0, '', $res['data'], count($res['data']));
}
$s_key = Config('config.s_standard_brand');
$data = Redis::get($s_key);
// 无缓存情况下
if (!$data) {
$res = $this->apiStandardBrandList();
$data = json_encode($res['data']);
$expire = Config('config.s_standard_brand_expire');
Redis::setex($s_key, $expire, $data);
}
$data = json_decode($data, true);
$this->ExportLayui(0, '', $data, count($data));
}
public function apiStandardBrandList($standard_brand_name='')
{
$url = Config('config.footstone_url').'/AuthApi/get_scm_brand_list';
$key = Config('config.auth_key');
$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;
return json_decode(curlApi($url, $data, 'post'), true);
}
// 绑定品牌
public function apiBindStandardBrand($request)
{
$type = $request->input('type', 1);
$cart_id = $request->input('cart_id', 0);
$curr_brand_id = $request->input('curr_brand_id', 0);
$curr_brand_name = $request->input('curr_brand_name', '');
$scm_brand_id = $request->input('scm_brand_id', 0);
$scm_brand_name = $request->input('scm_brand_name', '');
if (!$scm_brand_id) $this->Export(1, '参数缺失');
if ($type == 1 && !$cart_id) $this->Export(1, '当前行购物车ID缺失');
$url = Config('config.footstone_url').'/AuthApi/binding_scm_brand';
$key = Config('config.auth_key');
$map['time'] = time();
$map['scm_brand_id'] = $scm_brand_id;
$map['brand_id'] = [$curr_brand_id];
$map['brand_name'] = [$curr_brand_name];
$map['admin_id'] = $request->user->userId;
$map['admin_name'] = $request->user->name;
$map['AuthSign'] = MD5(MD5(http_build_query($map)) . $key);
$data['data'] = $map;
$res = json_decode(curlApi($url, $data, 'post'), true);
if ($res['errcode'] != 0) $this->Export($res['errcode'], $res['errmsg']);
$save = [];
$save['standard_brand_id'] = $scm_brand_id;
$save['standard_brand_name'] = $scm_brand_name;
// 将标准品牌添加到购物车
if ($type == 1) {
$ShoppingCartModel = new ShoppingCartModel;
$res = $ShoppingCartModel->where('cart_id', $cart_id)->update($save);
if ($res === false) $this->Export(1, '更新标准品牌失败');
}
$this->Export(0, '更新标准品牌成功');
}
}
......@@ -37,7 +37,7 @@ class CheckRequest
// if ($count > 1) return abort(501, '请勿重新提交!'); // 501服务器不支持当前请求
$lock = Redis::set($key, 1, "nx", "ex", 5); // 5秒内重复点击提交按钮无效
$lock = Redis::set($key, 1, "nx", "ex", 2); // 2秒内重复点击提交按钮无效
if (!$lock) return abort(501, '请勿重新提交!');
......
<?php
namespace App\Model;
use Illuminate\Database\Eloquent\Model;
use Request;
class ShoppingCartModel extends Model
{
protected $connection = 'order';
protected $table = 'lie_shopping_cart';
protected $primaryKey = 'cart_id';
public $timestamps = false;
}
\ No newline at end of file
......@@ -35,4 +35,9 @@ return [
'zty@ichunt.com',
],
'footstone_url' => 'http://footstone.liexin.net',
'auth_key' => 'LX@ichunt.com82560956-0755',
's_standard_brand' => 'StandardBrand', // 缓存key
's_standard_brand_expire' => 7200, // 缓存两小时
];
......@@ -99,4 +99,5 @@ return [
'export_url' => 'http://export.liexin.com',
'export_joint_source_id' => 16,
'export_self_source_id' => 17,
];
......@@ -254,3 +254,17 @@ li {
.order_contain { margin-left: 80px !important; }
}
.select-standard-brand {
float: right;
color: #ff8601;
cursor: pointer;
}
p, h4 {
margin-bottom: 10px !important;
}
.create-order span>a {
color: #337ab7 !important;
}
......@@ -879,12 +879,16 @@
// list = list.reverse();
// 购物车列表
for (var i = len - 1 ; i >= 0; i--) {
html += '<tr data-cid="'+list[i].cart_id+'" data-type="'+list[i].type+'" min_buy="'+list[i].min_buy+'" data-sup_name="'+list[i].supplier_name+'" data-sup_id="'+list[i].supplier_id+'">'+
html += '<tr data-cid="'+list[i].cart_id+'" data-type="'+list[i].type+'" min_buy="'+list[i].min_buy+'" data-sup_name="'+list[i].supplier_name+'" data-sup_id="'+list[i].supplier_id+'" data-brand_id="'+list[i].brand_id+'" data-brand_name="'+list[i].brand_name+'">'+
'<td>'+(len - i)+'</td>'+
'<td class="goods_id">'+list[i].goods_id+'</td>'+
'<td>'+list[i].goods_name+'</td>'+
'<td>'+list[i].brand_name+'</td>';
if (goods_type == 1) { // 联营添加标准品牌列
html += '<td><input type="text" class="change_standard_brand_name" name="standard_brand_name" value="'+list[i].standard_brand_name+'" readonly /><i class="fa fa-exclamation-triangle fa-2x select-standard-brand" aria-hidden="true" data-type=1></i></td>';
}
if (goods_type == 2) {
html += '<td><span class="goods_mpl">'+list[i].mpl+'</span></td>';
}
......
......@@ -565,17 +565,21 @@
data: $('#checkOrderForm').serialize(),
dataType: 'json',
success: function (resp) {
if(resp.errcode === 0){
if(resp.errcode == 0){
layer.msg(resp.errmsg || '操作成功');
setTimeout(function(){
// location.reload();
location.href = url;
}, 1000);
} else {
layer.alert(resp.errmsg || '网络异常', function() {
location.reload();
});
return false;
}
layer.alert(resp.errmsg);
return false;
// layer.alert(resp.errmsg || '网络异常', function() {
// location.reload();
// });
},
error: function (res) {
......@@ -583,7 +587,7 @@
}
})
// layer.msg('审核提交中...', {icon: 16, time: 0, shade: 0.3}); // 阻止重复提交
layer.msg('审核提交中...', {icon: 16, time: 0, shade: 0.3}); // 阻止重复提交
},
btn2: function(index, layero){
layer.close(index);
......@@ -680,6 +684,8 @@
if (!items[i].is_add) {
$('.change_item_'+i).find('.change_goods_price').val(items[i].goods_price);
$('.change_item_'+i).find('.change_goods_number').val(items[i].goods_number);
$('.change_item_'+i).find('.change_standard_brand_id').val(items[i].standard_brand_id);
$('.change_item_'+i).find('.change_standard_brand_name').val(items[i].standard_brand_name);
if (items[i].status == -1) {
$('.change_item_'+i).find('.change_status').val(items[i].status);
......@@ -690,14 +696,15 @@
items_len++;
}
// 添加新增商品
for (var i in items) {
if (!items[i].is_add) continue;
if (!items[i].add_type) {
var sup = items[i].canal ? items[i].supplier_id+'.'+items[i].canal : items[i].supplier_id;
new_str += '<tr data-sup="'+sup+'">';
new_str += '<tr data-sup="'+sup+'" data-brand_id="'+items[i].brand_id+'" data-brand_name="'+items[i].brand_name+'">';
} else {
new_str += '<tr>';
new_str += '<tr data-brand_id="'+items[i].brand_id+'" data-brand_name="'+items[i].brand_name+'">';
}
new_str += '<td>'+i+'</td>\
......@@ -710,6 +717,16 @@
<p>'+items[i].goods_name+'</p>\
</td>\
<td>\
<input class="change_brand_id" type="hidden" name="change_info['+i+'][brand_id]" value="'+items[i].brand_id+'">\
<input class="change_brand_name" type="hidden" name="change_info['+i+'][brand_name]" value="'+items[i].brand_name+'">\
<p>'+items[i].brand_name+'</p>\
</td>\
<td>\
<input type="hidden" class="change_standard_brand_id" name="change_info['+i+'][standard_brand_id]" value="'+items[i].standard_brand_id+'" />\
<input type="text" class="change_standard_brand_name" name="change_info['+i+'][standard_brand_name]" value="'+items[i].standard_brand_name+'" readonly />\
<i class="fa fa-exclamation-triangle fa-2x select-standard-brand" aria-hidden="true" data-type=21></i>\
</td>\
<td>\
<input class="only_number num change_goods_number" name="change_info['+i+'][goods_number]" value="'+items[i].goods_number+'">\
</td>\
<td>\
......
......@@ -95,7 +95,7 @@
var order_item = data.item; // 当前新增商品信息
var sup = order_item.canal ? order_item.supplier_id+'.'+order_item.canal : order_item.supplier_id;
html += '<tr data-sup="'+sup+'">\
html += '<tr data-sup="'+sup+'" data-brand_name="'+order_item.brand_name+'">\
<td>'+curr_no+'</td>\
<td>\
<input type="hidden" name="change_info['+curr_no+'][supplier_id]" value="'+order_item.supplier_id+'">\
......@@ -107,6 +107,26 @@
<p>'+order_item.goods_name+'</p>\
</td>\
<td>\
<input class="change_brand_id" type="hidden" name="change_info['+curr_no+'][brand_id]" value="'+order_item.brand_id+'">\
<p>'+order_item.brand_name+'</p>\
</td>';
if (order_item.standard_brand_name) {
html += '<td>\
<input class="change_standard_brand_id" type="hidden" name="change_info['+curr_no+'][standard_brand_id]" value="'+order_item.standard_brand_id+'">\
<input class="change_standard_brand_name" type="hidden" name="change_info['+curr_no+'][standard_brand_name]" value="'+order_item.standard_brand_name+'">\
<p>'+order_item.standard_brand_name+'</p>\
</td>';
} else {
html += '<td>\
<input class="change_standard_brand_id" type="hidden" name="change_info['+curr_no+'][standard_brand_id]">\
<input class="change_standard_brand_name" type="text" name="change_info['+curr_no+'][standard_brand_name]" readonly>\
<i class="fa fa-exclamation-triangle fa-2x select-standard-brand" aria-hidden="true" data-type=2></i>\
</td>';
}
html += '<td>\
<input class="only_number num change_goods_number" name="change_info['+curr_no+'][goods_number]" value="'+order_item.goods_number+'">\
</td>\
<td>\
......@@ -161,6 +181,7 @@
},
})
layer.msg('新增中...', {icon: 16, time: 0, shade: 0.3});
},
btn2: function(index) {
layer.close(index)
......@@ -276,6 +297,8 @@
<input class="change_goods_name" type="hidden" name="change_info['+curr_no+'][goods_name]" value="'+add_goods_name+'">\
<p>'+add_goods_name+'</p>\
</td>\
<td></td>\
<td></td>\
<td>\
<input class="only_number num change_goods_number" name="change_info['+curr_no+'][goods_number]" value="'+add_goods_number+'">\
</td>\
......@@ -339,6 +362,7 @@
})
}
layer.msg('新增中...', {icon: 16, time: 0, shade: 0.3});
},
btn2: function(index) {
layer.close(index)
......
layui.use(['table', 'form'], function() {
var table = layui.table;
var form = layui.form;
var renderTable = function() {
table.render({
id: 'list'
,elem: '#brandList'
,url: '/api/getStandardBrandList' //数据接口
,method:'post'
,cellMinWidth: 80 //全局定义常规单元格的最小宽度
,page: false //开启分页
,cols: [[ //表头
{type:'radio', width: 80}
,{field: 'erp_brand_name', title: '品牌名称', width: 596}
]]
// ,limit: 10
// ,limits: [10, 20, 50,]
});
}
renderTable();
form.on('submit(load)', function(data) {
//执行重载
table.reload('list', {
page: {
curr: 1
}
,where: data.field
});
return false;
});
var scm_brand_id = 0;
var scm_brand_name = '';
//监听radio事件
table.on('radio(brandList)', function(obj) { //注:test是table原始容器的属性 lay-filter="对应的值"
var data = obj.data;
scm_brand_id = data.scm_brand_id;
scm_brand_name = data.erp_brand_name;
});
// 选择标准品牌
$('.shop-table').delegate('.select-standard-brand', 'click', function() {
var self = $(this);
var type = self.data('type'); // 1-后台购物车,2-后台审单
scm_brand_id = 0;
scm_brand_name = '';
renderTable(); // 重载表格
var curr_brand_id = self.parents('tr').data('brand_id'); // 当前品牌ID
var curr_brand_name = self.parents('tr').data('brand_name'); // 当前品牌名称
var datax = {
type: type,
curr_brand_id : curr_brand_id,
curr_brand_name: curr_brand_name,
};
if (type == 1) {
var cart_id = self.parents('tr').data('cid') || 0;
datax.cart_id = cart_id;
}
layer.open({
type: 1,
area: ['700px', '600px'],
title: '选择标准品牌',
content: $('#select-brand-pop'),
btn: ['确定带回', '取消'],
btn1: function (index) {
if (!scm_brand_id && !scm_brand_name) {
layer.msg('请选择标准品牌');
return false;
}
datax.scm_brand_id = scm_brand_id;
datax.scm_brand_name = scm_brand_name;
$.ajax({
type: "POST",
url: '/api/apiBindStandardBrand',
data: datax,
dataType: "json",
success: function(resp){
if (resp.errcode == 0) {
layer.msg(resp.errmsg);
if (type == 1) { // 加载购物车列表
var user_id = $('.user_id').val();
var delivery_place = $('input[name=delivery_place]:checked').val();
$.lie.add_order.lists(user_id, 1, 1, delivery_place);
} else {
self.parents('tr').find('.change_standard_brand_id').val(scm_brand_id);
self.parents('tr').find('.change_standard_brand_name').val(scm_brand_name);
}
return false;
}
layer.alert(resp.errmsg);
return false;
},
})
layer.close(index);
layer.msg('提交中...', {icon: 16, time: 0, shade: 0.3});
},
btn2: function (index) {
layer.close(index);
}
})
$('.standard_brand_name').val('');
$('.curr-brand').text(curr_brand_name);
})
})
\ No newline at end of file
<link href="/css/bootstrap.min.css" rel="stylesheet">
<link href="/js/layui/css/layui.css" rel="stylesheet">
<link href="/font-awesome/css/font-awesome.css" rel="stylesheet">
<link href="/css/style.css" rel="stylesheet">
<link href="/layer/skin/layer.css" rel="stylesheet">
......
......@@ -5,7 +5,9 @@
<script src="/js/plugins/slimscroll/jquery.slimscroll.min.js"></script>
<script src="/js/plugins/metisMenu/jquery.metisMenu.js"></script>
<script src="/js/inspinia.min.js"></script>
<script src="/js/layui/layui.js"></script>
<script src="/js/common.js"></script>
<script src="/js/add_order.js?v=<?= time() ?>"></script>
<script src="/js/plugins/DatePicker/WdatePicker.js"></script>
<script src="/js/standardBrand.js?v=<?= time() ?>"></script>
......@@ -390,6 +390,7 @@
<th width="10%">SKUID</th>
<th width="15%">商品名称</th>
<th width="10%">制造商</th>
<th width="10%">标准品牌</th>
<th width="8%">采购数量</th>
<th width="7%">采购单价</th>
<th width="7%">小计</th>
......@@ -450,6 +451,8 @@
</div>
</form>
@include('common.selectBrand')
<script>
var sale_id = "{{$sale_id}}";
var URL_api = "{{Config('website.api_domain')}}";
......@@ -486,4 +489,5 @@
})
$.lie.add_order.lyorder();
// $.lie.standardBrand.index();
</script>
\ No newline at end of file
......@@ -9,6 +9,8 @@
@include('detail.css')
@include('changeOrder.js')
<link href="/js/layui/css/layui.css" rel="stylesheet">
</head>
<body class="">
......
......@@ -131,26 +131,30 @@
</div>
<!-- 调价 -->
<table class="table table-bordered table-hover order-change-table">
<table class="table table-bordered table-hover order-change-table shop-table">
<thead>
<th width="5%">序号</th>
<th width="20%">供应商</th>
<th>型号</th>
<th>调整数量</th>
<th>调整单价</th>
<th width="10%">供应商</th>
<th width="10%">型号</th>
<th width="10%">品牌</th>
@if ($order_info['order_goods_type'] == 1)
<th width="11%">标准品牌</th>
@endif
<th width="10%">调整数量</th>
<th width="10%">调整单价</th>
<!-- 销售类型为预售时展示 -->
@if ($order_info['sale_type'] == 2)
<th>交期时间/天</th>
<th>锁定库存</th>
<th width="10%">交期时间/天</th>
<th width="10%">锁定库存</th>
@endif
<td>状态</td>
<td width="5%">状态</td>
<th width="5%">操作</th>
</thead>
<tbody>
@foreach ($order_items_info as $k=>$v)
<tr class="change_item_{{$v['rec_id']}}" data-sup="{{$v['canal'] ? $v['supplier_id'].'.'.$v['canal'] : $v['supplier_id']}}">
<tr class="change_item_{{$v['rec_id']}}" data-sup="{{$v['canal'] ? $v['supplier_id'].'.'.$v['canal'] : $v['supplier_id']}}" data-brand_id="{{ $v['brand_id'] }}" data-brand_name="{{ $v['brand_name'] }}">
<input class="change_rec_id" type="hidden" name="change_rec_id" value="{{ $v['rec_id'] }}">
<td>{{ $k+1 }}</td>
<td>
......@@ -162,6 +166,23 @@
<p>{{$v['goods_name']}}</p>
</td>
<td>
<input class="change_brand_id" type="hidden" name="change_info[{{$v['rec_id']}}][brand_id]" value="{{$v['brand_id']}}">
<input class="change_brand_name" type="hidden" name="change_info[{{$v['rec_id']}}][brand_name]" value="{{$v['brand_name']}}">
<p>{{$v['brand_name']}}</p>
</td>
@if ($order_info['order_goods_type'] == 1)
<td>
<input type="hidden" class="change_standard_brand_id" name="change_info[{{$v['rec_id']}}][standard_brand_id]" value="{{$v['standard_brand_id']}}" />
@if ($v['standard_brand_name'] || $v['status'] == -1)
<input type="hidden" class="change_standard_brand_name" name="change_info[{{$v['rec_id']}}][standard_brand_name]" value="{{$v['standard_brand_name']}}"/>
<p>{{$v['standard_brand_name']}}</p>
@else
<input type="text" class="change_standard_brand_name" name="change_info[{{$v['rec_id']}}][standard_brand_name]" readonly />
<i class="fa fa-exclamation-triangle fa-2x select-standard-brand" aria-hidden="true" data-type=2></i>
@endif
</td>
@endif
<td>
<input class="only_number num change_goods_number" name="change_info[{{$v['rec_id']}}][goods_number]" value="{{$v['goods_number']}}" <?= $v['status'] == -1 ? 'readonly' : '' ?>>
</td>
<td>
......@@ -484,6 +505,7 @@
@include('changeOrder.addGoods')
@include('changeOrder.addGoodsNoSkuid')
@include('common.selectBrand')
<script>
var is_manager = "{{ in_array($role, [1, 2, 5]) ? true : false }}";
......
......@@ -7,7 +7,9 @@
<script src="/js/plugins/metisMenu/jquery.metisMenu.js"></script>
<script src="/js/inspinia.min.js"></script>
<script src="/js/plugins/DatePicker/WdatePicker.js"></script>
<script src="/js/layui/layui.js"></script>
<script src="/js/common.js"></script>
<script src="/js/change_order.js?v=<?= time() ?>"></script>
<script src="/js/goods.js?v=<?= time() ?>"></script>
<script src="/js/standardBrand.js?v=<?= time() ?>"></script>
......@@ -28,7 +28,8 @@
<table class="table table-bordered table-hover">
<thead>
<tr>
<th width="40%">型号</th>
<th width="20%">型号</th>
<th width="20%">标准品牌</th>
<th>调整数量</th>
<th>调整单价</th>
<th width="20%">状态</th>
......@@ -40,6 +41,7 @@
@foreach ($order_temp_info['temp_save_info']['change_info'] as $k => $v)
<tr>
<td>{{$v['goods_name']}}</td>
<td>{{ isset($v['standard_brand_name']) ? $v['standard_brand_name'] : '' }}</td>
<td>{{$v['goods_number']}}</td>
<td>{{$v['goods_price']}}</td>
<td>
......
<style>
#select-brand-pop{ display: none; }
.select-content{ margin: 10px; }
.confirm-standard-brand{ float: right; }
.brand-search{ margin-top: -3px; }
#select-brand-pop .label-prompt{ padding: 6px !important; }
.show-right{ float: right; }
</style>
<div id="select-brand-pop" class="select-content">
<form class="layui-form layui-box" method="post">
<span>当前品牌:<strong class="layui-btn-sm curr-brand"></strong></span>
<div class="layui-input-inline show-right">
<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>
</div>
</form>
<table id="brandList" lay-filter="brandList"></table>
</div>
\ No newline at end of file
......@@ -16,11 +16,13 @@
<th>商品名</th>
<?php } ?>
<th>制造商</th>
<?php if ($order_info['order_goods_type'] == 1) { ?>
<th>标准品牌</th>
<th>供应商</th>
<?php } ?>
<th>制造商</th>
<!-- ERP或京东订单 -->
<?php if (in_array($order_info['order_type'], [2, 3])) { ?>
......@@ -84,11 +86,12 @@
<td><a href="<?= Config('website.main_url').'goods_'.$v['goods_id'].'.html?ptag=order' ?>" target="_blank"><?= $v['goods_name'] ?></a></td>
<?php } ?>
<td><?= $v['brand_name'] ?></td>
<?php if ($order_info['order_goods_type'] == 1) { ?>
<td><?= $v['standard_brand_name'] ?></td>
<td><?= $v['supplier_name'] ?></td>
<?php } ?>
<td><?= $v['brand_name'] ?></td>
<td id="goods_number_<?= $v['rec_id'] ?>"><?= $v['goods_number'] ?></td>
<td>
<span id="<?= $v['rec_id'] ?>"><?= $v['goods_price'] ?></span>
......@@ -155,21 +158,21 @@
<?php if ($order_info['order_remark']) { ?>
<tr>
<td>订单备注信息:</td>
<td colspan="20"><?= $order_info['order_remark'] ?></td>
<td colspan="21"><?= $order_info['order_remark'] ?></td>
</tr>
<?php } ?>
<?php if ($order_temp_info['kefu_remark']) { ?>
<tr>
<td>客服备注信息:</td>
<td colspan="20"><?= $order_temp_info['kefu_remark'] ?></td>
<td colspan="21"><?= $order_temp_info['kefu_remark'] ?></td>
</tr>
<?php } ?>
<?php if ($order_info['order_goods_type'] == 2 && $order_temp_info['business_type'] == 1) { ?>
<tr>
<td>项目需求描述:</td>
<td colspan="20"><?= $order_temp_info['sample_demand_desc'] ?></td>
<td colspan="21"><?= $order_temp_info['sample_demand_desc'] ?></td>
</tr>
<?php } ?>
</tfoot>
......
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