Commit b389ea04 by 朱继来

审单添加标准品牌

parent db894f20
......@@ -20,6 +20,7 @@ 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
{
......@@ -333,26 +334,45 @@ class ApiController extends Controller
// 绑定品牌
public function apiBindStandardBrand($request)
{
$curr_brand = $request->input('curr_brand', '');
$standard_brand = $request->input('standard_brand', '');
$type = $request->input('type', 1);
$cart_id = $request->input('cart_id', 0);
$curr_brand_id = $request->input('curr_brand_id', 0);
$scm_brand_id = $request->input('scm_brand_id', 0);
$scm_brand_name = $request->input('scm_brand_name', 0);
if (!$curr_brand || !$standard_brand) return ['errcode'=>1, 'errmsg'=>'参数缺失'];
if (!$curr_brand_id || !$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'] = 412;
$map['brand_id'] = [1];
$map['admin_id'] = 10000;
$map['admin_name'] = 'admin';
$map['AuthSign'] = MD5(MD5(http_build_query($map)) . $key);
$map['scm_brand_id'] = $scm_brand_id;
$map['brand_id'] = [$curr_brand_id];
$map['admin_id'] = $request->user->userId;
$map['admin_name'] = $request->user->name;
$map['AuthSign'] = MD5(MD5(http_build_query($map)) . $key);
$data['data'] = $map;
$result = curlApi($url, $data, 'post');
echo ($result);
$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, '更新标准品牌成功');
}
......
<?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
......@@ -889,9 +889,8 @@
if (list[i].standard_brand_name) {
html += '<td>'+list[i].standard_brand_name+'</td>';
} else {
html += '<td><input type="text" class="standard_brand_name" name="standard_brand_name" /><i class="fa fa-exclamation-triangle fa-2x select-standard-brand" aria-hidden="true"></i></td>';
}
html += '<td><input type="text" class="standard_brand_name" name="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) {
......
......@@ -33,46 +33,82 @@ layui.use(['table', 'form'], function() {
return false;
});
//监听行单击事件(双击事件为:rowDouble)
table.on('row(brandList)', function(obj) { //注:test是table原始容器的属性 lay-filter="对应的值"
var scm_brand_id = 0;
var scm_brand_name = '';
//监听radio事件
table.on('radio(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");
scm_brand_id = data.scm_brand_id;
scm_brand_name = data.erp_brand_name;
});
// 选择标准品牌
$('.shop-table').delegate('.select-standard-brand', 'click', function() {
var type = $(this).data('type'); // 1-后台购物车,2-后台审单
$('.standard_brand_name').val('');
renderTable(); // 重载表格
scm_brand_id = 0;
scm_brand_name = '';
renderTable(); // 重载表格
var curr_brand_id = $(this).parents('tr').data('brand_id');
var datax = {
type: type,
curr_brand_id : curr_brand_id
};
if (type == 1) {
var cart_id = $(this).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 () {
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: {uid : user_id, cart_id : cart_id},
data: datax,
dataType: "json",
success: function(resp){
layer.msg(resp.errmsg);
// self.parents('tr').remove();
// loading.lists(user_id, goods_type, is_online, delivery_place); // 加载购物车列表
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 {
$('.standard_brand_id').val(scm_brand_id);
$('.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) {
......
......@@ -6,9 +6,11 @@
<title>订单管理后台 | 人工审单</title>
<script>document.domain="{{ Config::get('website.domain') }}";</script>
@include('detail.css')
@include('changeOrder.js')
<link href="/js/layui/css/layui.css" rel="stylesheet">
</head>
<body class="">
......
......@@ -131,26 +131,28 @@
</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>
<th width="11%">标准品牌</th>
<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'] }}">
<input class="change_rec_id" type="hidden" name="change_rec_id" value="{{ $v['rec_id'] }}">
<td>{{ $k+1 }}</td>
<td>
......@@ -162,6 +164,19 @@
<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']}}">
<p>{{$v['brand_name']}}</p>
</td>
<td>
@if ($v['standard_brand_name'])
<p>{{$v['standard_brand_name']}}</p>
@else
<input type="hidden" class="standard_brand_id" name="change_info[{{$v['rec_id']}}][standard_brand_id]" />
<input type="text" class="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>
<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 +499,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"></script>
......@@ -15,12 +15,14 @@
<th>商品ID</th>
<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])) { ?>
......@@ -83,12 +85,13 @@
<td><?= $v['goods_id'] ?></td>
<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