Commit 89258934 by 朱继来

调整新增自营线下订单

parent ad976e08
...@@ -9,6 +9,7 @@ use DB; ...@@ -9,6 +9,7 @@ use DB;
use Cookie; use Cookie;
use App\Http\Page; use App\Http\Page;
use App\Http\Controllers\PermController; use App\Http\Controllers\PermController;
use App\Http\Error;
function CheckActive($menus, &$arr, $url) function CheckActive($menus, &$arr, $url)
{ {
...@@ -319,9 +320,80 @@ Class AddOrderController extends Controller ...@@ -319,9 +320,80 @@ Class AddOrderController extends Controller
{ {
if ($request->isMethod('post')) { if ($request->isMethod('post')) {
$order_id = $request->input('order_id'); $order_id = $request->input('order_id');
$status = $request->input('status');
// 审核通过推到WMS
if ($status == 4) {
$data['order_id'] = $order_id;
$data['k1'] = time();
$data['k2'] = md5(md5($data['k1']).'fh6y5t4rr351d2c3bryi');
$url = Config('website.api_domain').'order/wmsOrder';
$response = json_decode(curlApi($url, $data), true);
if ($response['err_code'] == 0) {
$orderInfo = DB::connection('order')->table('lie_order')->where('order_id', $order_id)->first();
DB::beginTransaction();
try {
// 待发货状态
$update = DB::connection('order')->table('lie_order')->where('order_id', $order_id)->update(['status' => $status]);
// 插入到order_price
$price['order_id'] = $order_id;
$price['order_sn'] = $orderInfo->order_sn;
$price['price_type'] = -1;
$price['price'] = '-'.$orderInfo->order_amount;
$price['create_time'] = time();
$priceAdd = DB::connection('order')->table('lie_order_price')->insert($price);
// 添加付款记录
$pay['user_id'] = $orderInfo->user_id;
$pay['order_id'] = $order_id;
$pay['order_sn'] = $orderInfo->order_sn;
$pay['pay_id'] = 0; // 支付方式ID
$pay['pay_name'] = '交通银行'; // 支付方式名
$pay['pay_type'] = 1;
$pay['pay_amount'] = $orderInfo->order_amount;
$pay['is_paid'] = 1;
$pay['create_time'] = time();
$pay['pay_time'] = time();
$payLog = DB::connection('order')->table('lie_pay_log')->insert($pay);
if ($update && $priceAdd && $payLog) {
DB::commit();
}
} catch (Exception $e) {
DB::rollBack();
}
} else {
return ['errcode' => $response['err_code'], 'errmsg' => $response['err_msg']];
}
$event = '自营线下订单审核通过';
} else {
$update = DB::connection('order')->table('lie_order')->where('order_id', $order_id)->update(['status' => $status]); // 订单取消状态
$update = DB::connection('order')->table('lie_order')->where('order_id', $order_id)->update(['status' => 4]); // 待发货状态 $event = '自营线下订单审核不通过';
}
// 操作记录
$log['order_id'] = $order_id;
$log['operator_id'] = $request->user->userId;
$log['operator_type'] = 2;
$log['event'] = $event;
$log['ip'] = get_client_ip();
$log['create_time'] = time();
$actionLog = DB::connection('order')->table('lie_order_action_log')->insert($log);
if (!$actionLog){
errorLog(Error::E_ADD_FAILED, '添加操作记录失败');
return ['errcode'=>Error::E_ADD_FAILED, 'errmsg'=>'添加操作记录失败'];
}
if (!empty($update)) { if (!empty($update)) {
return ['errcode' => 0, 'errmsg' => '审核成功']; return ['errcode' => 0, 'errmsg' => '审核成功'];
} else { } else {
......
...@@ -31,30 +31,43 @@ ...@@ -31,30 +31,43 @@
$('.sku-info').show(); $('.sku-info').show();
var data = resp.data; var data = resp.data;
var status_val = '';
$('.goods_name').text(data.goods_name); $('.goods_name').text(data.goods_name);
$('.brand_name').text(data.brand_name); $('.brand_name').text(data.brand_name);
$('.supplier_name').text(data.supplier_name); $('.supplier_name').text(data.supplier_name);
$('.stock').text(data.stock); $('.stock').text(data.stock);
$('.moq').text(data.moq); $('.moq').text(data.moq);
$('.mpq').text(data.mpq); $('.mpq').text(data.mpq);
switch (data.status) {
case 0: status_val = '待入库'; break;
case 1: status_val = '审核通过(上架)'; break;
case 3: status_val = '下架'; break;
case 4: status_val = '删除'; break;
}
$('.status').text(status_val);
$('.goods_id').val(data.goods_id); $('.goods_id').val(data.goods_id);
//阶梯价格 //阶梯价格
var len = data.ladder_price.length; if (data.ladder_price != null) {
if (len > 0) { var len = data.ladder_price.length;
var html = ''; if (len > 0) {
var html = '';
for (var i = 0; i < len; i++) {
if (i == 0) { for (var i = 0; i < len; i++) {
html += '<tr><td><span class="goods-min-num">'+data.ladder_price[i]['purchases']+'</span></td><td>¥<span class="goods-min-price">'+data.ladder_price[i]['price_cn']+'</span></td></tr>'; if (i == 0) {
} else { html += '<tr><td><span class="goods-min-num">'+data.ladder_price[i]['purchases']+'</span></td><td>¥<span class="goods-min-price">'+data.ladder_price[i]['price_cn']+'</span></td></tr>';
html += '<tr><td><span>'+data.ladder_price[i]['purchases']+'</span></td><td>¥<span>'+data.ladder_price[i]['price_cn']+'</span></td></tr>'; } else {
} html += '<tr><td><span>'+data.ladder_price[i]['purchases']+'</span></td><td>¥<span>'+data.ladder_price[i]['price_cn']+'</span></td></tr>';
}
}
$('.ladder_price_table tr:gt(0)').remove();
$('.ladder_price_table').append(html);
} }
}
$('.ladder_price_table tr:gt(0)').remove();
$('.ladder_price_table').append(html);
}
} }
}) })
}) })
...@@ -204,6 +217,7 @@ ...@@ -204,6 +217,7 @@
if (len > 0) { if (len > 0) {
for (var i = 0; i < len; i++) { for (var i = 0; i < len; i++) {
html += '<tr data-cid="'+list[i].cart_id+'">'+ html += '<tr data-cid="'+list[i].cart_id+'">'+
'<td>'+list[i].goods_id+'</td>'+
'<td>'+list[i].goods_name+'</td>'+ '<td>'+list[i].goods_name+'</td>'+
'<td>'+list[i].brand_name+'</td>'+ '<td>'+list[i].brand_name+'</td>'+
'<td><input type="text" class="goods_num" name="goods_num" value="'+list[i].goods_number+'"></td>'+ '<td><input type="text" class="goods_num" name="goods_num" value="'+list[i].goods_number+'"></td>'+
...@@ -231,6 +245,9 @@ ...@@ -231,6 +245,9 @@
$('.amount-section').show(); $('.amount-section').show();
$('.order_amount').empty().text(order_amount); $('.order_amount').empty().text(order_amount);
} }
} else {
$('.shop-lists').hide();
$('.amount-section').hide();
} }
}, },
}); });
......
...@@ -1498,15 +1498,33 @@ ...@@ -1498,15 +1498,33 @@
layer.open({ layer.open({
title: '审核自营线下订单', title: '审核自营线下订单',
content: '确定审核通过吗?', content: '确定审核通过吗?',
btn:['取消','确定'], btn:['通过', '不通过'],
yes: function(index, layero){ yes: function(index, layero){
layer.close(index); $.ajax({
url: '/ajax/selfCheck',
type: 'post',
data: {order_id: order_id, status: 4},
dataType:'json',
success: function(resp) {
if(resp.errcode === 0){
layer.msg(resp.errmsg || '操作成功');
setTimeout(function(){
location.reload();
}, 1000);
} else {
layer.alert(resp.errmsg || '网络异常');
}
},
error: function(err) {
console.log(err)
}
})
}, },
btn2: function(index, layero){ btn2: function(index, layero){ // 不通过--取消订单
$.ajax({ $.ajax({
url: '/ajax/selfCheck', url: '/ajax/selfCheck',
type: 'post', type: 'post',
data: {order_id: order_id}, data: {order_id: order_id, status: -1},
dataType:'json', dataType:'json',
success: function(resp) { success: function(resp) {
if(resp.errcode === 0){ if(resp.errcode === 0){
......
...@@ -152,6 +152,15 @@ ...@@ -152,6 +152,15 @@
</div> </div>
</div> </div>
</div> </div>
<div class="row">
<div class="col-sm-6">
<div class="form-group">
<span>状态:</span>
<span class="status"></span>
</div>
</div>
</div>
</div> </div>
<div class="sku-info-right"> <div class="sku-info-right">
...@@ -175,14 +184,15 @@ ...@@ -175,14 +184,15 @@
<table class="table table-bordered table-hover shop-table"> <table class="table table-bordered table-hover shop-table">
<thead> <thead>
<tr> <tr>
<th width="15%">商品型号</th> <th width="15%">SKUID</th>
<th width="15%">制造商</th> <th width="20%">商品名称</th>
<th width="10%">制造商</th>
<th width="10%">采购数量</th> <th width="10%">采购数量</th>
<th width="10%">采购单价</th> <th width="10%">采购单价</th>
<th width="10%">小计</th> <th width="10%">小计</th>
<th width="15%">货期</th> <th width="10%">货期</th>
<th width="15%">供应商</th> <th width="10%">供应商</th>
<th width="10%">操作</th> <th width="5%">操作</th>
</tr> </tr>
</thead> </thead>
<tbody></tbody> <tbody></tbody>
......
<div id="page-wrapper" class="gray-bg">
@include('layouts.header')
<div class="wrapper wrapper-content">
<div class="row">
<div class="col-lg-12">
<div class="ibox float-e-margins">
<form>
<div class="ibox-title" style="border-top:0;">
<h3>客户信息</h3>
</div>
<div class="ibox-content">
<div class="account-info">
<h4>账户信息 <span class="title-tips"><i class="fa fa-info-circle"></i> 此账号为内部下单账号,前台不可登录。</span></h4>
<input type="hidden" name="user_id" value="{{$internal_uid}}">
<div class="row">
<div class="col-sm-6">
<div class="form-group">
<span>手机号码:</span>
<span>{{Config('website.internal-account')}}</span>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<span>密码:</span>
<span>******</span>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-6">
<div class="form-group">
<span>测试账号:</span>
<span></span>
</div>
</div>
</div>
</div>
<div class="express-info">
<h4>快递信息</h4>
<input type="hidden" name="address_id" value="{{ $address->address_id }}">
<input type="hidden" name="address_name" value="{{ $name }}">
<input type="hidden" name="address_mobile" value="{{ $mobile }}">
<div class="row">
<div class="col-sm-6">
<div class="form-group">
<span>收货方式:</span>
<span>快递上门</span>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<span>联系人:</span>
<span>{{$name}}</span>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-6">
<div class="form-group">
<span>联系电话:</span>
<span>{{$mobile}}</span>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<span>收货地址:</span>
<span>{{ $address->province_val.$address->city_val.$address->district_val.$address->detail_address }}</span>
</div>
</div>
</div>
</div>
</div>
<div class="ibox-title">
<h3>商品信息</h3>
</div>
<div class="ibox-content">
<div class="row">
<style>
.search-sku{width: 240px !important;}
.label-prompt{padding: 6px 6px;}
.get-sku{padding: 3px 6px; margin-right: 20px;}
</style>
<div class="col-sm-6">
<input type="text" class="search-sku" name="sku_id" value="" placeholder="请输入SKUID">
<a class="btn btn-info get-sku">获取SKU信息</a>
<span>快捷入口:<a href="{{Config('website.search-sku-url')}}" target="_blank">查询SKU</a></span>
</div>
</div>
<!-- SKU信息 -->
<div class="sku-info">
<h4>型号信息</h4>
<div class="sku-info-left">
<div class="row">
<div class="col-sm-6">
<div class="form-group">
<span>SKU型号:</span>
<span class="goods_name"></span>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<span>制造商:</span>
<span class="brand_name"></span>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-6">
<div class="form-group">
<span>供应商:</span>
<span class="supplier_name"></span>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<span>库存数量:</span>
<span class="stock"></span>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-6">
<div class="form-group">
<span>起订量:</span>
<span class="moq"></span>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<span>标准包装量:</span>
<span class="mpq"></span>
</div>
</div>
</div>
</div>
<div class="sku-info-right">
<table class="table table-hover ladder_price_table">
<tr>
<th>阶梯</th>
<th>RMB价格</th>
</tr>
</table>
</div>
<div class="clear"></div>
<a class="btn btn-success add-to-lists">添加至商品列表</a>
</div>
<!-- 商品列表 -->
<div class="shop-lists">
<table class="table table-bordered table-hover shop-table">
<thead>
<tr>
<th width="15%">商品型号</th>
<th width="15%">制造商</th>
<th width="10%">采购数量</th>
<th width="10%">采购单价</th>
<th width="10%">小计</th>
<th width="15%">货期</th>
<th width="15%">供应商</th>
<th width="10%">操作</th>
</tr>
</thead>
<tbody></tbody>
</table>
</div>
<!-- 订单金额 -->
<div class="amount-section">
<p>应付金额:<span class="text-danger order_amount"></span></p>
</div>
</div>
<div class="ibox-title" style="text-align: right;">
<a class="btn btn-success submit-order" data-type="3">提交</a>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<script>
var user_id = "{{$internal_uid}}";
var sale_id = "{{$sale_id}}";
var URL_api = "{{Config('website.api_domain')}}";
$.lie.add_order.offline();
</script>
\ No newline at end of file
...@@ -245,7 +245,7 @@ ...@@ -245,7 +245,7 @@
@if($order_info['status'] < 10 && $order_invoice_info['invoice_status'] < 2 && in_array('update_invoice', $userPerms)) @if($order_info['status'] < 10 && $order_invoice_info['invoice_status'] < 2 && in_array('update_invoice', $userPerms))
<a href="/changeInvoice/{{$order_info['order_id']}}" class="btn btn-success btn-sm changeBtn">更改发票</a> <a href="/changeInvoice/{{$order_info['order_id']}}" class="btn btn-success btn-sm changeBtn">更改发票</a>
@endif @endif
@elseif (isset($_REQUEST['tags']) && $_REQUEST['tags'] == 'self') @elseif (isset($_REQUEST['tags']) && $_REQUEST['tags'] == 'self' && $user_mobile != Config('website.internal-account'))
@if($order_info['status'] < 10 && $order_invoice_info['invoice_status'] < 2 && in_array('self_order_update_invoice', $userPerms)) @if($order_info['status'] < 10 && $order_invoice_info['invoice_status'] < 2 && in_array('self_order_update_invoice', $userPerms))
<a href="/changeInvoice/{{$order_info['order_id']}}?tags={{$_REQUEST['tags']}}" class="btn btn-success btn-sm changeBtn">更改发票</a> <a href="/changeInvoice/{{$order_info['order_id']}}?tags={{$_REQUEST['tags']}}" class="btn btn-success btn-sm changeBtn">更改发票</a>
@endif @endif
......
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