Commit 4d0a2987 by 朱继来

Merge branch 'zjl_remark_20200311'

parents a6e9a965 6542aa08
......@@ -189,28 +189,39 @@ class ApiController extends Controller
/*
修改订单详情
*/
public function update_order_items($request){
public function update_order_items($request)
{
$OrderItemsModel = new OrderItemsModel();
// $OrderItemsModel = new OrderItemsModel();
$data['id'] = $request->input('id');
$data['remarks'] = $request->input('remarks');
$data['buyer_id'] = $request->input('buyer_id');//采购id
$data['batch'] = $request->input('batch');//采购id
$data['order_id'] = $request->input('order_id');
$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']);
}
// if($data['buyer_id'] == -1){
// unset($data['buyer_id']);
// }
$result = $OrderItemsModel->updateData($data);
// $result = $OrderItemsModel->updateData($data);
if($result !== false){
$this->Export(0, '编辑明细成功');
}else{
$this->Export(1, '编辑明细失败');
}
// if($result !== false){
// $this->Export(0, '编辑明细成功');
// }else{
// $this->Export(1, '编辑明细失败');
// }
$url = Config('website.api_domain').'order/updateorderitems';
$data['k1'] = time();
$data['k2'] = md5(md5($data['k1']).'fh6y5t4rr351d2c3bryi');
$temp = json_decode(curlApi($url, $data, "POST"), true); // 连接API
$this->Export($temp['err_code'], $temp['err_msg']);
}
/*
......
......@@ -1164,6 +1164,7 @@
// 编辑商品明细
$('.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');
......@@ -1238,7 +1239,7 @@
$.ajax({
url: '/api/update_order_items',
data: {id: rec_id, batch: batch, buyer_id: buyer_id, remarks: remarks},
data: {order_id: order_id, id: rec_id, batch: batch, buyer_id: buyer_id, remarks: remarks},
type:'post',
dataType: 'json',
success:function(resp){
......
......@@ -586,7 +586,7 @@
<td><a class="order-track" data-rid="{{$v['rec_id']}}">{{ App\Http\Controllers\getLastTrack($v['rec_id']) }}</a></td>
@endif
<td class="remarks">
<td>
@if(!empty($v['remarks']))
{{$v['remarks']}}
@endif
......@@ -594,8 +594,8 @@
<td>
<!-- <button type="button" class="btn btn-success btn-xs remarks">编辑</button> -->
@if ($order_info['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>
@if ($order_info['status'] < 4)
<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>
@endif
</td>
......@@ -1120,73 +1120,6 @@
$.lie.order.details();
$.lie.goods.add();
//备注填写确定按钮被点击
$(document).on('click','.remarks_enter',function(){
user_id = -1;
//获取备注
$remarks = $('#remarks_input').val();
// console.log('备注:'+$remarks);
//采购员
$remarks_user = $('#remarks_user').val();
// console.log('采购员:'+$remarks_user);
//批次
$batch = $('#batch').val();
// console.log($batch);
//检查采购员是否存在
if($remarks_user.length >0){
$.ajaxSettings.async = false;
$.post("/api/check_user_exists",{user:$remarks_user}, function(result) {
//请求处理
console.log(result);
if(result.errmsg == 'error'){
alert('采购员不存在或未录入系统,请确认后再填写')
return false;
}else{
user_id = result.data
}
},"json");
$.ajaxSettings.async = true;
}
if($remarks_user.length >0 && user_id == -1){
return false;
}
if($remarks.length >0 || user_id > 0 || $batch.length >0){
$.post('/api/update_order_items',{id:$id,remarks:$remarks,userId:user_id,batch:$batch},function(data){
history.go(0);
},'json')
}else{
alert('您未填写任何信息,请至少填写一处');
return false;
}
})
//备注填写确定按钮被点击
$(document).on('click','.remarks_cancel',function(){
console.log('cancel');
layer.close(index_windows);
})
// 发送邮件
$(document).on('click','.send_mail',function(data){
......@@ -1253,51 +1186,6 @@
$('.layui-layer-content').css('overflow', 'visible');
})
$(function(){
$('.remarks').click(function(){
$id = $(this).parent().parent().find('.order-track').attr('data-rid');
//展示采购员
$buyerName = trim($(this).parent().parent().find('.buyerName').html());
// console.log($buyerName);
//展示备注
$remarks = trim($(this).parent().parent().find('.remarks').html());
// console.log($remarks);
//展示批次
$batch = trim($(this).parent().parent().find('.batch').html());
// console.log($batch);
index_windows = layer.open({
type: 1,
skin: 'layui-layer-demo', //样式类名
closeBtn: 0, //不显示关闭按钮
anim: 2,
shadeClose: true, //开启遮罩关闭
content: '<div> <h2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;编辑信息</h2>\
<br/><div>&nbsp;&nbsp;批次:&nbsp;&nbsp;&nbsp;&nbsp;<input id="batch" value="'+$batch+'"><br/> \
<br/> <div>&nbsp;&nbsp;采购员:<input id="remarks_user" value = "'+$buyerName+'"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div> <br/> \
<div>&nbsp;&nbsp;备注:&nbsp;&nbsp;&nbsp;&nbsp;<input id="remarks_input" value="'+$remarks+'"></div> &nbsp;&nbsp;&nbsp;&nbsp;\
<br/>\
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\
<button type="button" class="layui-btn remarks_enter layui-btn-primary">确定</button>\
&nbsp;&nbsp;&nbsp;&nbsp;\
<button type="button" class="layui-btn remarks_cancel layui-btn-primary">取消</button>\
<br/><br/>\
</div>'
});
})
$('.send_mail').click(function(){
console.log('send_mail')
})
})
//供使用者调用
function trim(s){
return trimRight(trimLeft(s));
......
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