Commit 71d54bda by 朱继来

调整编辑明细

parent 4590e66b
......@@ -194,28 +194,9 @@ class ApiController extends Controller
*/
public function update_order_items($request)
{
// $OrderItemsModel = new OrderItemsModel();
$data['order_id'] = $request->input('order_id');
$data['order_id'] = $request->input('edit_order_id');
$data['change_item'] = $request->input('change_item');
$data['operator_id'] = $request->user->userId;
$data['id'] = $request->input('id');
$data['remarks'] = $request->input('remarks');
$data['buyer_id'] = $request->input('buyer_id');//采购id
$data['batch'] = $request->input('batch');//批次
// if($data['buyer_id'] == -1){
// unset($data['buyer_id']);
// }
// $result = $OrderItemsModel->updateData($data);
// if($result !== false){
// $this->Export(0, '编辑明细成功');
// }else{
// $this->Export(1, '编辑明细失败');
// }
$url = Config('website.api_domain').'order/updateorderitems';
......
......@@ -414,82 +414,19 @@
// 编辑商品明细
$('.edit-item').click(function() {
var order_id = $('#order_id').val();
var order_goods_type = $('#order_goods_type').val();
var rec_id = $(this).data('id');
var item_batch = $(this).data('batch');
var item_remarks = $(this).data('remarks');
if (order_goods_type == 1) {
var item_buyer_id = $(this).data('bid');
var buyer_count = buyers.length;
var html = '';
for (var i = 0; i < buyer_count; i++) {
if (item_buyer_id && item_buyer_id == buyers[i].userId) {
html += '<option value="'+buyers[i].userId+'" selected>'+buyers[i].name+'</option>';
} else {
html += '<option value="'+buyers[i].userId+'">'+buyers[i].name+'</option>';
}
}
}
var content = '';
content = '<div class="form-horizontal">\
<div class="form-group">';
if (order_goods_type == 1) {
content += '<label class="col-sm-3 control-label"><i class="error">*</i> 批次</label>';
} else {
content += '<label class="col-sm-3 control-label"> 批次</label>';
}
content += '<div class="col-sm-9">\
<input type="text" class="form-control" name="batch" value="'+item_batch+'" placeholder="请填写批次" style="width:200px;">\
</div>\
</div>';
if (order_goods_type == 1) {
content += '<div class="form-group">\
<label class="col-sm-3 control-label">采购员</label>\
<div class="col-sm-9" style="width:230px;">\
<select class="form-control buyer_id selectpicker" name="buyer_id" data-live-search="true" data-size="7">\
<option value="">请选择采购员</option>\
'+html+'\
</select>\
</div>\
</div>';
}
content += '<div class="form-group">';
content += '<label class="col-sm-3 control-label">备注</label>';
content += '<div class="col-sm-9">\
<textarea class="form-control" name="remarks" placeholder="请填写备注" style="width:200px;">'+item_remarks+'</textarea>\
</div>\
</div>\
</div>';
layer.open({
area: ['400px'],
type: 1,
area: ['1000px', '500px'],
title:'编辑明细',
content: content,
content: $('#edit-items'),
btn:['确认', '取消'],
//提交事件
btn1:function(){
var batch = $('input[name=batch]').val();
var buyer_id = $('select[name=buyer_id]').val() || 0;
var remarks = $('textarea[name=remarks]').val();
if (order_goods_type == 1 && !batch) {
layer.tips('请填写批次', $('input[name=batch]'));
return false;
}
btn1:function(index){
var datax = $('.editItemsFrom').serialize();
$.ajax({
url: '/api/update_order_items',
data: {order_id: order_id, id: rec_id, batch: batch, buyer_id: buyer_id, remarks: remarks},
data: datax,
type:'post',
dataType: 'json',
success:function(resp){
......@@ -507,14 +444,14 @@
layer.alert('网络异常');
}
});
layer.close(index);
layer.msg('提交中...', {icon:16, time: 0, shade: 0.3});
},
btn2:function(index){
layer.close(index);
}
});
$(".buyer_id").selectpicker();
$('.layui-layer-content').css('overflow', 'visible');
})
// 自营申请收款 --- 2020.4.21
......
......@@ -30,7 +30,6 @@
</div>
</div>
<?php
if ($order_temp_info['contract_com_name']) {
$contract_com_name = $order_temp_info['contract_com_name'];
......@@ -76,7 +75,8 @@
<div class="tabs-box goods-price table-responsive list-item-table">
@include('detail.detail_items_info')
</div>
@include('detail.edit_items')
<?php $client_source = App\Http\Controllers\clientSource($order_info['user_id']); ?>
@if (!empty($client_source))
<div class="tabs-box table-responsive">
......
<div style="width: 100%; height: 40px;">
<h3>商品信息</h3>
<h3 style="float: left; width: 100px;">商品信息</h3>
<?php if (in_array($order_info['status'], [1, 2, 3, 4])) { ?>
<button type="button" class="btn btn-success changeBtn edit-item">编辑</button>
<?php } ?>
</div>
<div class="row-fluid table-responsive">
<table class="table table-hover text-nowrap">
<table class="table table-hover text-nowrap">
<thead>
<tr class="caption">
<th>序号</th>
......@@ -17,13 +21,12 @@
<?php } ?>
<th>制造商</th>
<?php if ($order_info['order_goods_type'] == 1) { ?>
<th>标准品牌</th>
<th>供应商</th>
<?php } ?>
<!-- ERP或京东订单 -->
<?php if (in_array($order_info['order_type'], [2, 3])) { ?>
<th>采购数量</th>
......@@ -52,9 +55,7 @@
<th>采购员</th>
<?php } ?>
<th>自采标记</th>
<th >批次</th>
<th>批次</th>
<?php if ($order_info['order_goods_type'] == 1) { ?>
<th>生产跟踪</th>
......@@ -62,14 +63,6 @@
<th>备注</th>
<th>状态</th>
<th>来源</th>
<th>操作</th>
<?php
if ($action_name == 'changeOrder' && count($order_items_info) > 1 && in_array($order_info['status'], [1, 2])) {
echo '<th>操作</th>';
}
?>
</tr>
</thead>
<tbody>
......@@ -121,18 +114,6 @@
</td>
<?php } ?>
<td>
<?php
if($v['self_supplier_type'] == 1) {
echo '自采';
} elseif($v['self_supplier_type'] == 2) {
echo '自采';
} else {
echo '自采';
}
?>
</td>
<td class="batch"><?= !empty($v['batch']) ? $v['batch'] : ''; ?> </td>
<?php if ($order_info['order_goods_type'] == 1) { ?>
......@@ -142,14 +123,6 @@
<td><?= !empty($v['remarks']) ? $v['remarks'] : '' ?></td>
<td><?= $v['status'] == 1 ? '正常' : '<i class="error">已关闭</i>' ?></td>
<td><?= $v['goods_source'] == 1 ? '前台' : '后台' ?></td>
<td>
<!-- <button type="button" class="btn btn-success btn-xs remarks">编辑</button> -->
<?php if (in_array($order_info['status'], [1, 2, 3, 4]) && $v['status'] == 1) { ?>
<button type="button" class="btn btn-success btn-xs edit-item" data-id="<?= $v['rec_id'] ?>" data-batch="<?= $v['batch'] ?>" data-bid="<?= $v['buyer_id'] ?>" data-remarks="<?= $v['remarks'] ?>">编辑</button>
<?php } ?>
</td>
</tr>
<?php } ?>
<?php } ?>
......@@ -158,21 +131,21 @@
<?php if ($order_info['order_remark']) { ?>
<tr>
<td>订单备注信息:</td>
<td colspan="21"><?= $order_info['order_remark'] ?></td>
<td colspan="18"><?= $order_info['order_remark'] ?></td>
</tr>
<?php } ?>
<?php if ($order_temp_info['kefu_remark']) { ?>
<tr>
<td>客服备注信息:</td>
<td colspan="21"><?= $order_temp_info['kefu_remark'] ?></td>
<td colspan="18"><?= $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="21"><?= $order_temp_info['sample_demand_desc'] ?></td>
<td colspan="18"><?= $order_temp_info['sample_demand_desc'] ?></td>
</tr>
<?php } ?>
</tfoot>
......
<style>
#edit-items{ display: none; }
.editItemsFrom{ margin: 20px; }
.edit_buyer_id{ width: 150px !important; }
</style>
<div id="edit-items">
<form class="form-horizontal editItemsFrom">
<input type="hidden" name="edit_order_id" value="{{ $order_info['order_id'] }}">
<table class="table table-hover text-nowrap">
<thead>
<tr>
<th>商品名称</th>
<th>制造商</th>
<th>供应商</th>
@if ($order_info['order_goods_type'] == 1)
<th>采购员</th>
@endif
<th>批次</th>
<th>备注</th>
</tr>
</thead>
<tbody>
@foreach ($order_items_info as $item)
<tr>
<td>{{ $item['goods_name'] }}</td>
<td>{{ $item['brand_name'] }}</td>
<td>{{ $item['supplier_name'] }}</td>
@if ($order_info['order_goods_type'] == 1)
<td>
<select id="edit_buyer_id_{{ $item['rec_id'] }}" class="form-control edit_buyer_id selectpicker" name="change_item[{{ $item['rec_id'] }}][buyer_id]" data-live-search="true" data-size="7" title="请选择采购员">
<option value="">请选择采购员</option>
@if (!empty($buyers))
@foreach ($buyers as $v)
<option value="{{ $v->userId }}">{{ $v->name }}</option>
@endforeach
@endif
</select>
</td>
@endif
<td>
<input type="text" class="form-control edit_batch" name="change_item[{{ $item['rec_id'] }}][batch]" value="{{ $item['batch'] }}" placeholder="请填写批次" >
</td>
<td>
<input type="text" class="form-control edit_remarks" name="change_item[{{ $item['rec_id'] }}][remarks]" value="{{ $item['remarks'] }}" placeholder="请填写备注" style="width:200px;">
</td>
</tr>
<!-- 采购员赋值 -->
<script>
var rec_id = "{{ $item['rec_id'] }}";
var edit_buyer_id = "{{ $item['buyer_id'] }}";
$('#edit_buyer_id_'+rec_id).selectpicker('val', edit_buyer_id);
</script>
@endforeach
</tbody>
</table>
</form>
</div>
\ 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