Commit ba3cd837 by 朱继来

Merge branch 'zjl_order_list_20190902' into development

parents 761929ec d7619a7a
......@@ -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\OrderItemsTrackModel;
class ApiController extends Controller
{
......@@ -127,4 +128,36 @@ class ApiController extends Controller
$this->Export($KefuModel->top($request));
}
// 获取订单明细
public function getOrderItems($request)
{
$order_id = $request->input('order_id');
$url = Config('website.api_domain').'order/getOrderDetails';
$data['k1'] = time();
$data['k2'] = md5(md5($data['k1']).'fh6y5t4rr351d2c3bryi');
$userData = array("order_id"=>$order_id, "type"=>3, "k1"=>$data['k1'], "k2"=>$data['k2']);
$resp = json_decode(curlApi($url, $userData, "POST"), true);
$this->Export(0, '', $resp['data']['order_items_info']);
}
// 获取订单跟踪
public function getOrderItemsTrack($request)
{
$rec_id = $request->input('rec_id');
$OrderItemsTrackModel = new OrderItemsTrackModel;
$track = $OrderItemsTrackModel->getLastItemTrack($rec_id);
if (!$track) $this->Export(1, '无跟踪明细');
$data = $track['track_content'].',数量:'.$track['track_num'];
$this->Export(0, '', $data);
}
}
......@@ -317,4 +317,6 @@ input[type="color"],
.bs-select-all{float: left; width: 42% !important;}
.bs-deselect-all{float: right; width: 50% !important;}
.bootstrap-select .btn{padding: 4px 12px;}
\ No newline at end of file
.bootstrap-select .btn{padding: 4px 12px;}
.list-item-table .caption th { background: #fff; }
\ No newline at end of file
......@@ -4,6 +4,8 @@
$.extend($.lie, {
order:{
index:function(){
var self = this;
$.lie.droplist($('.droplist'));
$('#search').on('submit', function(e){
e.stopPropagation();
......@@ -14,6 +16,8 @@
return true;
});
self.orderTrack(); // 明细跟踪
// 特殊字符编码
function specialCode(chr)
{
......@@ -276,10 +280,80 @@
// 展示列表下的内容
$('.show-list').click(function(){
var nextTr = $(this).parent('tr').next('.show-other-content');
var self = $(this);
var nextTr = self.parent('tr').next('.show-other-content');
var order_id = self.parent('tr').data('oid');
var order_goods_type = self.parent('tr').data('type');
if (nextTr.css('display') == 'none') {
$(this).parent('tr').siblings('.show-other-content').hide();
self.parent('tr').siblings('.show-other-content').hide();
nextTr.show();
// 请求api接口,获取明细
$.ajax({
url: '/api/getOrderItems',
type: 'post',
data: {order_id:order_id},
dataType: 'json',
success: function(resp) {
if (resp.errcode == 0) {
var data = resp.data;
var len = data.length;
var html = '';
for (var i = 0; i < len; i++) {
if (i < 2) {
html += '<tr>\
<td>'+data[i].goods_name+'</td>\
<td>'+data[i].brand_name+'</td>\
<td>'+data[i].goods_number+'</td>\
<td>'+data[i].goods_price_format+'</td>\
<td>'+data[i].single_pre_price_format+'</td>\
<td>'+data[i].single_pre_price_amount+'</td>\
<td>'+data[i].supplier_name+'</td>\
<td>'+data[i].delivery_time+'</td>';
if (order_goods_type == 1) {
var rec_id = data[i].rec_id;
$.ajax({
url: '/api/getOrderItemsTrack',
type: 'post',
data: {rec_id: rec_id},
dataType: 'json',
async: false,
success: function(relt) {
if (relt.errcode == 0) {
html += '<td colspan="5"><a class="order-track" data-rid="'+rec_id+'">'+relt.data+'</a></td>';
} else {
html += '<td colspan="5"></td>';
}
}
})
}
html += '</tr>';
} else {
var details_url = order_goods_type == 1 ? '/details/'+order_id : '/details/'+order_id+'?tags=self';
html += '<tr>\
<td colspan="14" style="text-align: center;"><a href="'+details_url+'" target="_blank">查看更多明细...</a></td>\
</tr>';
}
}
// 插入到tbody
self.parent('tr').next('.show-other-content').find('.list-item-table>tbody').empty().append(html);
return false;
}
layer.msg(resp.msg);
},
error: function(err) {
console.log(err)
}
})
} else {
nextTr.hide();
}
......@@ -534,6 +608,48 @@
})
},
orderTrack:function() {
// 查看订单明细跟踪
$('.list-item-table').off().delegate('.order-track', 'click', function () {
var rid = $(this).data('rid');
$.ajax({
url : '/ajax/getOrderItemsTrack',
type: 'post',
data: {rec_id : rid},
success: function(resp) {
if (resp.errcode == 0) {
var data = resp.data;
var content = '<table class="table">\
<tr>\
<th width="30%">时间</th>\
<th>说明</th>\
<th width="13%">负责人</th>\
</tr>';
for (var i = 0; i < data.length; i++) {
content += '<tr><td>'+data[i].create_time+'</td><td>'+data[i].track_content+',数量:'+data[i].track_num+'</td><td>'+data[i].create_name+'</td></tr>';
}
content += '</table>';
layer.open({
title: '订单明细跟踪',
area: ['600px', '400px'],
content: content,
btn: [],
})
} else {
layer.alert(resp.errmsg || '网络异常');
}
},
error: function(err) {
console.log(err);
}
})
})
},
details:function(){
var self = this;
var action_type=$('.action_type').val();
......@@ -564,6 +680,7 @@
self.selfOrder();
self.cancelorder();
self.orderTrack();
$.lie.droplist($('.droplist'));
var order_sn = $('.order-save').attr('ordersn');
......@@ -756,46 +873,6 @@
})
})
// 查看订单明细跟踪
$('.order-track').click(function () {
var rid = $(this).data('rid');
$.ajax({
url : '/ajax/getOrderItemsTrack',
type: 'post',
data: {rec_id : rid},
success: function(resp) {
if (resp.errcode == 0) {
var data = resp.data;
var content = '<table class="table">\
<tr>\
<th width="30%">时间</th>\
<th>说明</th>\
<th width="13%">负责人</th>\
</tr>';
for (var i = 0; i < data.length; i++) {
content += '<tr><td>'+data[i].create_time+'</td><td>'+data[i].track_content+',数量:'+data[i].track_num+'</td><td>'+data[i].create_name+'</td></tr>';
}
content += '</table>';
layer.open({
title: '订单明细跟踪',
area: ['600px', '400px'],
content: content,
btn: [],
})
} else {
layer.alert(resp.errmsg || '网络异常');
}
},
error: function(err) {
console.log(err);
}
})
})
// 点击物流展开
$('.click-down').click(function() {
$(this).parents('tbody').find('.other-infos').show();
......
......@@ -521,7 +521,7 @@
@endif
@if ($order_info['order_goods_type'] == 1)
<th><a class="order-track" data-rid="{{$v['rec_id']}}">{{ App\Http\Controllers\getLastTrack($v['rec_id']) }}</a></th>
<td><a class="order-track" data-rid="{{$v['rec_id']}}">{{ App\Http\Controllers\getLastTrack($v['rec_id']) }}</a></td>
@endif
@if ($action_name == 'changeOrder' && count($order_items_info) > 1 && in_array($order_info['status'], [1, 2]))
......
......@@ -223,16 +223,18 @@
</div>
<div class="row-fluid table-responsive">
<table class="table table-hover">
<table class="table table-hover text-nowrap">
<thead>
<tr>
<th class="pl30">会员账号</th>
<th class="pl30">公司</th>
<th class="pl30">订单编号</th>
<th class="pl30">ERP单号</th>
<th class="pl30">应付金额</th>
<th class="pl30">订单状态</th>
<th class="pl30">付款类型</th>
<th class="pl30">支付方式</th>
<th class="pl30">推送业务员</th>
<th class="pl30">业务员</th>
@if ($username != 'vpadmin@ichunt.com')
<th class="pl30">订单来源</th>
<th class="pl30">同步状态</th>
......@@ -245,14 +247,18 @@
@if (empty($list))
<tr>
<td class="text-center" colspan="12">没有查询到相关记录~</td>
<td class="text-center" colspan="14">没有查询到相关记录~</td>
</tr>
@else
<tbody>
@foreach ($list as $v)
<tr>
<tr data-oid="{{ $v['order_id'] }}" data-type="1">
<td class="show-list"><?php print_r(App\Http\Controllers\getAccountName($v['user_id'])); ?></td>
<td class="show-list">
<p class="show-title" title="{{App\Http\Controllers\getCompanyName($v['user_id'])}}" style="width: 200px;">{{App\Http\Controllers\getCompanyName($v['user_id'])}}</p>
</td>
<td class="show-list">{{$v['order_sn']}}</td>
<td class="show-list">{{$v['erp_order_id']}}</td>
<td class="show-list">
<?php
$currencySign = $v['currency'] == 1 ? '¥' : '$';
......@@ -298,7 +304,7 @@
<td class="show-list">{{$username != 'vpadmin@ichunt.com' ? date('Y-m-d H:i:s', $v['create_time']) : date('Y-m-d', $v['create_time'])}}</td>
<td>
<div class="btn-group btn-group-xs">
<div class="btn-group btn-group-xs" style="width: 240px;">
<a class="btn btn-primary" href="{{URL('details', ['order_id'=>$v['order_id']])}}" target="_blank">详情</a>
@if (in_array('check_order', $userPerms) && in_array($v['status'], [1, 2, 3]))
......@@ -331,8 +337,27 @@
<!-- 点击展示内容 -->
<tr class="show-other-content">
<td colspan="12">
<table class="table table-hover table-bordered">
<td colspan="14">
<table class="table table-hover table-bordered list-item-table">
<thead>
<tr class="caption">
<th>型号</th>
<th>制造商</th>
<th>购买数量</th>
<th>购买时单价</th>
<th>均摊后单价</th>
<th>小计</th>
<th>供应商</th>
<th>交期</th>
<th colspan="5">生产跟踪</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
<!-- <table class="table table-hover table-bordered">
<tr>
<td class="table-list-title">公司名称</td>
<td class="table-list-content">
......@@ -441,7 +466,7 @@
<p><?php echo App\Http\Controllers\handleOrderSource($v['order_source']); ?></p>
</td>
</tr>
</table>
</table> -->
</td>
</tr>
@endforeach
......
......@@ -214,6 +214,7 @@
<thead>
<tr>
<th class="pl30">会员账号</th>
<th class="pl30">公司</th>
<th class="pl30">订单编号</th>
<th class="pl30">应付金额</th>
<th class="pl30">订单状态</th>
......@@ -230,18 +231,21 @@
@if (empty($list))
<tr>
<td class="text-center" colspan="12">没有查询到相关记录~</td>
<td class="text-center" colspan="13">没有查询到相关记录~</td>
</tr>
@else
<tbody>
@foreach ($list as $v)
<tr>
<tr data-oid="{{ $v['order_id'] }}" data-type="2">
<td class="show-list">
<?php print_r(App\Http\Controllers\getAccountName($v['user_id'])); ?>
@if (isset($credit[$v['user_id']]) && $credit[$v['user_id']])
<span>(账期)</span>
@endif
</td>
<td class="show-list">
<p class="show-title" title="{{App\Http\Controllers\getCompanyName($v['user_id'])}}" style="width: 200px;">{{App\Http\Controllers\getCompanyName($v['user_id'])}}</p>
</td>
<td class="show-list">{{$v['order_sn']}}</td>
<td class="show-list">
<?php
......@@ -328,8 +332,26 @@
<!-- 点击展示内容 -->
<tr class="show-other-content">
<td colspan="12">
<table class="table table-hover table-bordered">
<td colspan="13">
<table class="table table-hover table-bordered list-item-table">
<thead>
<tr class="caption">
<th>型号</th>
<th>制造商</th>
<th>购买数量</th>
<th>购买时单价</th>
<th>均摊后单价</th>
<th>小计</th>
<th>供应商</th>
<th colspan="5">交期</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
<!-- <table class="table table-hover table-bordered">
<tr>
<td class="table-list-title">公司名称</td>
<td class="table-list-content">
......@@ -338,23 +360,23 @@
<td class="table-list-title">支付时间</td>
<td class="table-list-content">
<?php
if ($v['order_pay_time'] != 0) {
if ($username != 'vpadmin@ichunt.com') {
echo date('Y-m-d H:i:s', $v['order_pay_time']);
} else {
echo date('Y-m-d', $v['order_pay_time']);
}
} else {
if ($v['advance_pay_time'] != 0) {
if ($username != 'vpadmin@ichunt.com') {
echo date('Y-m-d H:i:s', $v['advance_pay_time']);
} else {
echo date('Y-m-d', $v['advance_pay_time']);
}
} else {
echo '';
}
}
// if ($v['order_pay_time'] != 0) {
// if ($username != 'vpadmin@ichunt.com') {
// echo date('Y-m-d H:i:s', $v['order_pay_time']);
// } else {
// echo date('Y-m-d', $v['order_pay_time']);
// }
// } else {
// if ($v['advance_pay_time'] != 0) {
// if ($username != 'vpadmin@ichunt.com') {
// echo date('Y-m-d H:i:s', $v['advance_pay_time']);
// } else {
// echo date('Y-m-d', $v['advance_pay_time']);
// }
// } else {
// echo '';
// }
// }
?>
</td>
</tr>
......@@ -363,22 +385,22 @@
<td class="table-list-title">发票状态</td>
<td class="table-list-content">
<?php
$invoice_status = App\Http\Controllers\getInvoiceStatus($v['order_id']);
if ($invoice_status) {
switch ($invoice_status) {
case -1: echo "待确认";break;
case 1: echo "已开票";break;
case 2: echo "已发货";break;
case 3: echo "已签收";break;
}
} else {
echo '';
}
// $invoice_status = App\Http\Controllers\getInvoiceStatus($v['order_id']);
// if ($invoice_status) {
// switch ($invoice_status) {
// case -1: echo "待确认";break;
// case 1: echo "已开票";break;
// case 2: echo "已发货";break;
// case 3: echo "已签收";break;
// }
// } else {
// echo '';
// }
?>
</td>
<td class="table-list-title">优惠金额</td>
<td class="table-list-content"><?php echo App\Http\Controllers\getCoupon($v['order_id']); ?></td>
<td class="table-list-content"><?php // echo App\Http\Controllers\getCoupon($v['order_id']); ?></td>
</tr>
<tr>
......@@ -386,10 +408,10 @@
<td class="table-list-content">{{$shippingNo ? substr($shippingNo, 0, -2) : ''}}</td>
<td class="table-list-title">Adtag或其它</td>
<td class="table-list-content">
<p class="show-title" title="<?php echo App\Http\Controllers\handleOrderSource($v['order_source']); ?>"><?php echo App\Http\Controllers\handleOrderSource($v['order_source']); ?></p>
<p class="show-title" title="<?php //echo App\Http\Controllers\handleOrderSource($v['order_source']); ?>"><?php //echo App\Http\Controllers\handleOrderSource($v['order_source']); ?></p>
</td>
</tr>
</table>
</table> -->
</td>
</tr>
@endforeach
......
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