Commit 08be84de by 朱继来

手动同步到ERP

parent 574f1f63
......@@ -12,6 +12,7 @@ use App\Model\Pcb\PcbPurchaseModel;
use App\Model\Pcb\PcbServerModel;
use App\Model\KefuModel;
use App\Model\CmsModel;
use App\Model\OrderModel;
use App\Model\OrderExtendModel;
use App\Model\OrderItemsModel;
use App\Model\OrderItemsTrackModel;
......@@ -394,11 +395,24 @@ class ApiController extends Controller
if ($res === false) {
$this->Export(-1, '编辑ERP单号失败');
}
}
$this->Export(0, '编辑ERP单号成功');
}
// 手动推送到ERP,标记erp_syn=1
public function syn_erp($request)
{
$order_id = $request->input('order_id');
$OrderModel = new OrderModel;
$res = $OrderModel->where('order_id', $order_id)->update(['erp_syn' => 1]);
if ($res === false) $this->Export(-1, '更新失败');
$this->Export(0, '成功');
}
}
......@@ -576,7 +576,7 @@ console.log(listUrl)
dataType: 'json',
success: function(resp) {
if (resp.errcode != 0) {
layer.msg(resp.msg);
layer.msg(resp.errmsg);
return false;
}
......@@ -592,6 +592,39 @@ console.log(listUrl)
})
})
// 手动同步到ERP --- admin
$('.syn_erp').click(function() {
var order_id = $(this).data('oid');
layer.open({
area: ['300px'],
title: '同步ERP',
content: '确定同步到ERP吗?',
btn:['确认', '取消'],
btn1: function(index) {
$.ajax({
url: '/api/syn_erp',
type: 'post',
data: {order_id:order_id},
dataType: 'json',
success: function(resp) {
if (resp.errcode != 0) {
layer.msg(resp.errmsg);
return false;
}
layer.msg(resp.errmsg);
}
})
layer.msg('提交中...', {icon:16, time: 0, shade: 0.3});
},
btn2: function(index) {
layer.close(index)
}
})
})
},
}
......
......@@ -415,6 +415,10 @@
@if ($username == 'vpadmin@ichunt.com')
<a class="btn btn-info edit_erp_sn" data-oid="{{$v['order_id']}}" data-erp_sn="{{ $order_extend ? $order_extend->erp_sn : '' }}">编辑ERP单号</a>
@endif
@if ($username == 'admin@ichunt.com' && empty($order_extend->erp_sn) && $order_extend->is_manager_audit == 3)
<a class="btn btn-info syn_erp" data-oid="{{$v['order_id']}}">同步ERP</a>
@endif
</div>
</td>
</tr>
......
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