更新pcb后台

parent 0a66d671
......@@ -64,7 +64,7 @@ class ApiController extends Controller
}
//pcb客服点击转采购
private function ApiAddPurchase($request){
$this->Export((new PcbServerModel())->AddPurchase($request->user->userId,$request->input("order_id")));
echo (new PcbServerModel())->AddPurchase($request->user->userId,$request->input("order_id"));
}
//pcb客服审核订单,反馈给前台
private function ApiAuditOrder($request){
......@@ -80,6 +80,6 @@ class ApiController extends Controller
}
//pcb后台点击采购确认
private function ApiConfirmOrder($request){
$this->Export((new PcbServerModel())->confirmOrder($request->user->userId,$request->input("purchase_id")));
echo (new PcbServerModel())->confirmOrder($request->user->userId,$request->input("purchase_id"));
}
}
......@@ -80,6 +80,7 @@ class WebController extends Controller
//pcb详情
private function PcbOrderDetail($request,$data,$id){
$data['title']='PCB订单详情';
$data['paths'] = [["title" => 'PCB管理', "href" => '#'], ["title" => 'PCB订单列表', "href" => '/web/PcbOrderList'], ["title" => 'PCB订单详情', "href" => '#']];
$order_id = $request->input("order_id");
$con = DB::connection('pcb');
//订单基本信息
......@@ -106,12 +107,20 @@ class WebController extends Controller
//查询操作日志
$actionLog = $con->table("action_log")->where(["type"=>1,'oid'=>$order_id])->orderBy("id","desc")->get();
//拼接基本信息
$orderBase = objectToArray($orderBase);
$orderBase['tiaojia'] = "";
if (!$purchase){
$orderBase['tiaojia'] = $purchase['purchase_amount'] != $purchase['order_amount'] ? "是" :"否"; //是否调价、
//拼接采购信息
if ($purchase){
$purchase= objectToArray($purchase);
if ( $purchase['purchase_amount'] > 0 && $purchase['purchase_amount'] != $purchase['order_amount']){
$orderBase['tiaojia'] = "是";
}else{
$orderBase['tiaojia'] = "否";
}
$purchase['shipping_time'] = $purchase['shipping_time'] > 0 ? date('Y-m-d H:i:s',$purchase['shipping_time']) : "";
$purchase['finish_time'] = $purchase['finish_time'] > 0 ? date('Y-m-d H:i:s',$purchase['finish_time']) : "";
}
//拼接基本信息
$orderBase['order_pay_type'] = PcbOrderMap::$order_pay_type[$orderBase['order_pay_type']];
$orderBase['order_type'] = PcbOrderMap::$order_type[$orderBase['order_type']];
$orderBase['status_name'] = PcbOrderMap::$status[$orderBase['status']];
......@@ -135,11 +144,6 @@ class WebController extends Controller
$orderInvoice['inv_type'] = PcbOrderInvoiceMap::$inv_type[$orderInvoice['inv_type']];
$orderInvoice['invoice_status'] = PcbOrderInvoiceMap::$invoice_status[$orderInvoice['invoice_status']];
}
//拼接采购信息
if ($purchase){
$purchase = objectToArray($purchase);
$purchase['shipping_time'] = $purchase['shipping_time'] > 0 ? date('Y-m-d H:i:s',$purchase['shipping_time']) : "";
}
//拼接订单详细信息
$orderInfo = objectToArray($orderInfo);
$orderInfo['teshu'] = ($orderInfo['sp_half_hole'] == 1 ? "是":"否").($orderInfo['sp_goldfingers'] == 1 ? "是":"否").$orderInfo['sp_goldfingers_bevelling'].$orderInfo['sp_UL_marking']; //特殊工艺
......@@ -167,6 +171,8 @@ class WebController extends Controller
//pcb详情
private function PcbPurchaseDetail($request,$data,$id){
$data['title']='PCB采购详情';
$data['paths'] = [["title" => 'PCB管理', "href" => '#'], ["title" => 'PCB采购列表', "href" => '/web/PcbPurchaseList'], ["title" => 'PCB采购详情', "href" => '#']];
$purchase_id = $request->input("purchase_id");
$order_id = $request->input("order_id");
......
......@@ -208,6 +208,7 @@
$ret .= '<li><a href="#">' . $menus[$actives[0]]->title . '</a></li>';
}
}
return $ret;
}
......
......@@ -77,8 +77,12 @@ class PcbOrderModel extends Model
$puchase = $PcbPurchaseModel->where("order_id",$v['order_id'])->first();
$v['tiaojia']=$v['purchase_amount'] = $v['purchase_sn'] = "";
if ($puchase){
$v['tiaojia'] = $puchase['purchase_amount'] != $v['order_amount'] ? "是" :"否"; //是否调价、
$v['purchase_amount'] = $puchase['purchase_amount'];
if ( $puchase['purchase_amount'] > 0 && $puchase['purchase_amount'] != $v['order_amount']){
$v['tiaojia'] = "是";
}else{
$v['tiaojia'] = "否";
}
$v['purchase_amount'] = $puchase['purchase_amount'] > 0 ? $puchase['purchase_amount'] : "";
$v['purchase_sn'] = $puchase['purchase_sn'];
}
......
......@@ -44,25 +44,24 @@ class PcbPublicModel
*/
public function orderShipping($user_id,$data){
$con = DB::connection('pcb');
$data = [
'order_id'=>$data['order_id'],
'order_sn'=>$data['order_sn'],
'order_shipping_type'=>1,
$datas = [
'shipping_type'=>1,
'relevance_id'=>$data['order_id'],
'relevance_sn'=>$data['order_sn'],
'shipping_no'=>$data['shipping_no'],
'shipping_name'=>$data['shipping_name'],
'shipping_id'=>$data['shipping_id'],
'shipping_type'=>1,
'status'=>1,
'update_time'=>time(),
];
$shippingCon = $con->table("order_shipping");
$checkHave =$shippingCon->where(['order_id'=>$data['order_id'],'shipping_type'=>1])->first();
$shippingCon = $con->table("shipping");
$checkHave =$shippingCon->where(['relevance_id'=>$data['order_id'],'shipping_type'=>1])->first();
if ($checkHave){
$in = $shippingCon->where(['order_id'=>$data['order_id'],'shipping_type'=>1])->update($data);
$in = $shippingCon->where(['relevance_id'=>$data['order_id'],'shipping_type'=>1])->update($datas);
}else{
$data['create_time'] = time();
$in = $shippingCon->insert($data);
$in = $shippingCon->insert($datas);
}
if ($in){
PcbActionLogModel::log(1,'admin_add_shipping',"后台填写发货信息","",$data['order_id'],$user_id);
......
......@@ -23,7 +23,6 @@ class PcbPurchaseModel extends Model
// //查询数据\
$list = $this->where(function ($query) use ($input) {
$PcbPurchaseModel = new PcbPurchaseModel();
foreach ($input as $k => $v){
$v = trim($v);
switch ($k){
......@@ -38,24 +37,12 @@ class PcbPurchaseModel extends Model
case "end_time":
$query->where('create_time', '<=',strtotime($v));
break;
case "end_time":
$query->where('create_time', '<=',strtotime($v));
break;
case "purchase_sn":
$items = $PcbPurchaseModel->select("order_id")->where("purchase_sn","like","%".$v."%")->get();
if ($items->count()){
$orderIds = arrayToCommaStr($items->toArray(),'order_id',1);
$query->whereIn("order_id",$orderIds);
}else{
$query->where("order_id",0);
}
break;
default:
$query->whereIn($k, explode(',',trim($v,',')));
break;
}
}
})->orderBy('order_id','desc');
})->orderBy('purchase_id','desc');
//getSql();
if ($type == 1){
$list = $list->paginate($input['limit'], ['*'], 'p', $input['p'])->toArray();
......@@ -73,7 +60,12 @@ class PcbPurchaseModel extends Model
}
foreach ($data as $k=>&$v){
//查询采购
$v['tiaojia'] = $v['purchase_amount'] != $v['order_amount'] ? "是" :"否"; //是否调价、
if ($v['purchase_amount'] > 0){
$v['tiaojia'] = $v['purchase_amount'] != $v['order_amount'] ? "是" :"否"; //是否调价
}else{
$v['tiaojia'] = $v['purchase_amount'] = "";
}
$v['order_pay_type'] = PcbOrderMap::$order_pay_type[$v['order_pay_type']];
$v['order_type'] = PcbOrderMap::$order_type[$v['order_type']];
$v['status_name'] = PcbOrderMap::$status[$v['status']];
......@@ -87,6 +79,7 @@ class PcbPurchaseModel extends Model
$data = $this->getList(2);
$column = array('ID','会员账号','交易订单编号','采购订单编号','是否调价','订单金额','调整后订单金额','订单状态','订单类型','支付方式','下单时间'); // 表头
$fileName = 'PCB采购列表导出'.date('YmdHis', time()).'.csv';
$temp = [];
foreach ($data as $k=>$v){
array_push($temp,[
......
......@@ -23,7 +23,7 @@ class PcbServerModel
'order_id'=>$order_id,
];
$res = curlApi($this->PcbUrl.'/pcb/adminapi/addPurchase',$param,'POST');
return json_decode($res);
return $res;
}
/*
*
......@@ -39,6 +39,6 @@ class PcbServerModel
if ($json['err_code'] == 0){
PcbActionLogModel::log(1,'confirm_order',"采购确认","",$purchase_id,$admin_id);
}
return $json;
return $res;
}
}
\ No newline at end of file
......@@ -31,6 +31,8 @@ layui.use(['table','form','element','layer', 'laydate'], function() {
,{field:'order_type', title: '订单类型',width:160,align:'center'}
,{field:'order_pay_type', title: '支付方式',width:160,align:'center'}
,{field:'create_time', title: '下单时间',width:160,align:'center'}
,{field:'adtag', title: 'adtag',width:160,align:'center'}
,{field:'ptag', title: 'ptag',width:160,align:'center'}
,{field:'cahe', title: '操作',templet:'#cahe',width:150,align:'center', fixed: 'right'}
]]
,page:{ }
......@@ -162,9 +164,9 @@ function SendStock() {
dataType:'json',
timeout:10000,
success:function (res) {
if(res.errcode == 200){
if(res.errcode == 0){
alert_succ(res.errmsg,function () {
window.location.href='/web/Abnormal';
window.location.href='/web/PcbOrderList';
})
}else{
alert_err(res.errmsg)
......
......@@ -20,7 +20,7 @@ layui.use(['table','form','element','layer', 'laydate'], function() {
,last: false //不显示尾页
,id:'Abnormal'
,cols: [[
{field:'order_id', title: 'ID',width:120,align:'center'}
{field:'purchase_id', title: 'ID',width:120,align:'center'}
,{field:'user_account', title: '会员账号',width:160,align:'center'}
,{field:'order_sn', title: '交易订单编号',width:160,align:'center'}
,{field:'purchase_sn', title: '采购订单编号',width:160,align:'center'}
......
......@@ -196,7 +196,7 @@
<th>焊盘喷镀</th>
<th>阻焊覆盖</th>
<th>内层铜厚</th>
<th>交货时间</th>
<th>生产周期</th>
<th>交货日期</th>
<th></th>
</tr>
......@@ -204,8 +204,8 @@
<td><?= @$orderInfo['surface'] ?></td>
<td><?= $orderInfo['via_process'] ?></td>
<td><?= $orderInfo['copper_thickness'] ?></td>
<td><?= @$orderInfo['finish_time'] ?></td>
<td><?= $purchase['shipping_time'] ?></td>
<td><?= @$orderInfo['days'].'天' ?></td>
<td><?= $purchase['finish_time'] ?></td>
<td></td>
</tr>
<tr>
......@@ -293,12 +293,13 @@
</tbody>
</table>
<!--费用信息end-->
<?Php if(!count($purchase)) { ?>
<div style="margin-top: 10px;margin-bottom: 20px;">
<div style="">
<button class="layui-btn export" onclick="AddPurchase()">发起采购</button>
</div>
</div>
<?php } ?>
</div>
......
......@@ -7,11 +7,11 @@
<div class="layui-inline">
<label class="layui-form-label">下单时间:</label>
<div class="layui-input-inline" style="width: 200px;">
<input type="text" name="start_time" id="start_time" value="{{date("Y-m-d 00:00:00",strtotime("-3 month"))}}" placeholder="开始时间" autocomplete="off" class="layui-input">
<input type="text" name="start_time" id="start_time" placeholder="开始时间" autocomplete="off" class="layui-input">
</div>
<div class="layui-form-mid">-</div>
<div class="layui-input-inline" style="width: 200px;">
<input type="text" name="end_time" id="end_time" value="{{date("Y-m-d 23:59:59")}}" placeholder="结束时间" autocomplete="off" class="layui-input">
<input type="text" name="end_time" id="end_time" placeholder="结束时间" autocomplete="off" class="layui-input">
</div>
</div>
</div>
......@@ -36,9 +36,9 @@
</div>
</div>
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">订单状态:</label>
<div class="layui-input-inline payment-status">
<div class="layui-input-inline">
<div class="layui-input-inline payment-status" style="width: 800px !important;">
<input type="hidden" name="status" value="">
@if(!empty($status) && is_array($status))
@foreach($status as $k=>$v)
......@@ -87,7 +87,7 @@
<table class="layui-table" lay-filter="test" id="list"></table>
<script type="text/html" id="cahe">
<a href="/web/PcbOrderDetail?order_id=@{{ d.order_id }}" target="_blank" class="btn btn-xs btn-outline btn-success"><strong>详情</strong></a>
<a href="/web/PcbOrderDetail?order_id=@{{ d.order_id }}" class="btn btn-xs btn-outline btn-success"><strong>详情</strong></a>
@{{# if(d.status==1){ }}
<button class="btn btn-xs btn-outline btn-danger" lay-submit="" order_id="@{{ d.order_id }}" order_sn="@{{ d.order_sn }}" onclick="AddPurchase(@{{ d.order_id }})">发起采购</button>
@{{# } }}
......@@ -98,14 +98,14 @@
<!--弹出层-->
<div id="sendPurchase" style="display: none">
<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;配送快递:&nbsp;&nbsp;
<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;配送快递:&nbsp;&nbsp;
<select type='text' style='width: 200px;height: 30px;' id="shipping_id">
<?php foreach($shipping as $k=>$v){ ?>
<option value="<?= $v['shipping_id']; ?>"><?= $v['shipping_name']; ?></option>
<?php } ?>
</select><br/><br/>
&nbsp;&nbsp;&nbsp;&nbsp;快递单号:&nbsp;&nbsp;<input type='text' id="shipping_no" style='width: 200px;height: 30px;' ><br/><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;快递单号:&nbsp;&nbsp;<input type='text' id="shipping_no" style='width: 200px;height: 30px;' ><br/><br/>
<input type='hidden' id='sure_order_id'> <input type='hidden' id='sure_order_sn'>
&nbsp;&nbsp;&nbsp;&nbsp;<button class='layui-btn' onclick='SendStock()'>确定发货</button>
&nbsp;&nbsp;&nbsp;&nbsp;<button class='layui-btn' onclick='SendStock()' style="margin-left: 130px;">确定发货</button>
</div>
......@@ -163,7 +163,7 @@
<th>焊盘喷镀</th>
<th>阻焊覆盖</th>
<th>内层铜厚</th>
<th>交货时间</th>
<th>生产周期</th>
<th>交货日期</th>
<th></th>
</tr>
......@@ -172,7 +172,7 @@
<td><?= $orderInfo['via_process'] ?></td>
<td><?= $orderInfo['copper_thickness'] ?></td>
<td><?= @$orderInfo['finish_time'] ?></td>
<td><?= $purchase['shipping_time'] ?></td>
<td><?= $purchase['finish_time'] ?></td>
<td></td>
</tr>
<tr>
......
......@@ -7,11 +7,11 @@
<div class="layui-inline">
<label class="layui-form-label">下单时间:</label>
<div class="layui-input-inline" style="width: 200px;">
<input type="text" name="start_time" id="start_time" value="{{date("Y-m-d 00:00:00",strtotime("-3 month"))}}" placeholder="开始时间" autocomplete="off" class="layui-input">
<input type="text" name="start_time" id="start_time" placeholder="开始时间" autocomplete="off" class="layui-input">
</div>
<div class="layui-form-mid">-</div>
<div class="layui-input-inline" style="width: 200px;">
<input type="text" name="end_time" id="end_time" value="{{date("Y-m-d 23:59:59")}}" placeholder="结束时间" autocomplete="off" class="layui-input">
<input type="text" name="end_time" id="end_time" placeholder="结束时间" autocomplete="off" class="layui-input">
</div>
</div>
</div>
......@@ -38,7 +38,7 @@
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">订单状态:</label>
<div class="layui-input-inline payment-status">
<div class="layui-input-inline payment-status" style="width: 800px !important;">
<input type="hidden" name="status" value="">
@if(!empty($status) && is_array($status))
@foreach($status as $k=>$v)
......@@ -87,7 +87,7 @@
<table class="layui-table" lay-filter="test" id="list"></table>
<script type="text/html" id="cahe">
<a href="/web/PcbPurchaseDetail?purchase_id=@{{ d.purchase_id }}&order_id=@{{ d.order_id }}" target="_blank" class="btn btn-xs btn-outline btn-success"><strong>详情</strong></a>
<a href="/web/PcbPurchaseDetail?purchase_id=@{{ d.purchase_id }}&order_id=@{{ d.order_id }}" class="btn btn-xs btn-outline btn-success"><strong>详情</strong></a>
@{{# if(d.status==3){ }}
<button class="btn btn-xs btn-outline btn-danger" lay-submit="" order_id="@{{ d.purchase_id }}" order_sn="@{{ d.purchase_sn }}" onclick="SurePurchase(@{{ d.purchase_id }})">采购确认</button>
@{{# } }}
......
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