Commit 1d4cd546 by allen

订单周迭代3.08

parent f13850ed
...@@ -15,6 +15,7 @@ use App\Model\CmsModel; ...@@ -15,6 +15,7 @@ use App\Model\CmsModel;
use App\Model\OrderItemsTrackModel; use App\Model\OrderItemsTrackModel;
use App\Model\UserSampleApplyModel; use App\Model\UserSampleApplyModel;
use App\Model\UserSampleInviteModel; use App\Model\UserSampleInviteModel;
use App\Model\OrderItemsModel;
class ApiController extends Controller class ApiController extends Controller
{ {
...@@ -183,4 +184,24 @@ class ApiController extends Controller ...@@ -183,4 +184,24 @@ class ApiController extends Controller
$this->ExportLayui($UserSampleInviteModel->lists($request)); $this->ExportLayui($UserSampleInviteModel->lists($request));
} }
/*
修改订单详情
*/
public function update_order_items($request){
$OrderItemsModel = new OrderItemsModel();
$data['id'] = $request->input('id');
$data['remarks'] = $request->input('remarks');
$result = $OrderItemsModel->updateData($data);
if($result){
$this->Export($result, 'success');
}else{
$this->Export($result, 'error');
}
}
} }
<?php
namespace App\Model;
use Illuminate\Database\Eloquent\Model;
use Request;
use Excel;
use DB;
class OrderItemsModel extends Model
{
protected $connection = 'order';
protected $table = 'lie_order_items';
public function getUpdatedAtColumn() {
return null;
}
/*
修改订单详情
*/
public function UpdateData($data){
$rec_id = $data['id'];
unset($data['id']);
return $this->where('rec_id',$rec_id)->update($data);
}
}
\ No newline at end of file
...@@ -232,7 +232,7 @@ class OrderModel extends Model ...@@ -232,7 +232,7 @@ class OrderModel extends Model
}) })
->where('it.status', 1) ->where('it.status', 1)
->where('o.order_goods_type', '=', $map['order_goods_type']) ->where('o.order_goods_type', '=', $map['order_goods_type'])
->select('it.goods_id', 'it.goods_name', 'it.goods_number', 'it.goods_price', 'it.single_pre_price', 'it.brand_name', 'it.supplier_name', 'it.goods_class', 'it.self_supplier_type', 'o.order_id', 'o.order_sn', 'o.order_type', 'o.order_pay_type', 'o.order_goods_type', 'o.order_source', 'o.create_time', 'o.status', 'o.order_amount', 'o.sale_type', 'o.currency', 'o.sale_id', 'o.cancel_reason', 'i.tax_title', 'i.inv_type', 'i.invoice_status', 'i.tax_title', 'i.company_address', 'i.company_phone', 'i.tax_no', 'i.bank_name', 'i.bank_account', 'a.consignee', 'a.address', 's.status as shipping_status', 'u.user_id', 'u.mobile', 'u.email', 'u.client_source', 'u.is_new', 'u.is_test', 'c.com_name', 'oe.erp_sn', 'oe.send_remark', 'oe.is_new as is_new_order', 'oe.business_type', 'oe.jd_order_id', 'oe.exchange_rate', 'oe.sample_demand_desc') ->select('it.goods_id', 'it.goods_name', 'it.goods_number', 'it.goods_price', 'it.single_pre_price', 'it.brand_name', 'it.supplier_name', 'it.goods_class', 'it.self_supplier_type', 'o.order_id', 'o.order_sn', 'o.order_type', 'o.order_pay_type', 'o.order_goods_type', 'o.order_source', 'o.create_time', 'o.status', 'o.order_amount', 'o.sale_type', 'o.currency', 'o.sale_id', 'o.cancel_reason', 'i.tax_title', 'i.inv_type', 'i.invoice_status', 'i.tax_title', 'i.company_address', 'i.company_phone', 'i.tax_no', 'i.bank_name', 'i.bank_account', 'a.consignee', 'a.address', 's.status as shipping_status', 'u.user_id', 'u.mobile', 'u.email', 'u.client_source', 'u.is_new', 'u.is_test', 'c.com_name', 'oe.erp_sn', 'oe.send_remark', 'oe.is_new as is_new_order', 'oe.business_type', 'oe.jd_order_id', 'oe.exchange_rate', 'oe.sample_demand_desc','a.mobile','a.province','a.city','a.district')
->groupBy('it.rec_id') ->groupBy('it.rec_id')
->orderBy('o.create_time', 'DESC') ->orderBy('o.create_time', 'DESC')
->get() ->get()
...@@ -251,7 +251,7 @@ class OrderModel extends Model ...@@ -251,7 +251,7 @@ class OrderModel extends Model
if ($map['order_goods_type'] == 1) { if ($map['order_goods_type'] == 1) {
$headerCell = ['订单ID', '订单编号', 'ERP单号', '京东订单号', '会员账号', '收货人', '下单日期', '下单时间', '客户名称', '平台来源', 'SKUID', '商品型号', '商品分类', '制造商', '供应商', '数量', '单价', '均摊后单价', '商品小计', '币种', '客服', '商品总额', '运费', '附加费', '优惠券', '订单总额', '人民币总额', '付款类型', '订单状态', '发货状态', '收货地址', '发票类型', '发票状态', '发票抬头', '公司注册地址', '公司电话', 'adtags来源', '新用户来源', '取消原因', '推送备注', '是否为测试订单', '是否为新订单']; $headerCell = ['订单ID', '订单编号', 'ERP单号', '京东订单号', '会员账号', '收货人', '下单日期', '下单时间', '客户名称', '平台来源', 'SKUID', '商品型号', '商品分类', '制造商', '供应商', '数量', '单价', '均摊后单价', '商品小计', '币种', '客服', '商品总额', '运费', '附加费', '优惠券', '订单总额', '人民币总额', '付款类型', '订单状态', '发货状态', '收货地址', '发票类型', '发票状态', '发票抬头', '公司注册地址', '公司电话', 'adtags来源', '新用户来源', '取消原因', '推送备注', '是否为测试订单', '是否为新订单'];
} else { } else {
$headerCell = ['订单ID', '订单编号', 'ERP单号', '京东订单号', '会员账号', '收货人', '下单日期', '下单时间', '客户名称', '平台来源', 'SKUID', '商品型号', '商品分类', '制造商', '供应商', '数量', '单价', '均摊后单价', '商品小计', '币种', '客服', '商品总额', '运费', '附加费', '优惠券', '订单总额', '付款类型', '订单状态', '发货状态', '收货地址', '发票类型', '发票状态', '发票抬头', '公司注册地址', '公司电话', 'adtags来源', '新用户来源', '取消原因', '推送备注', '是否为测试订单', '销售类型', '业务类型', '自采标记', '项目需求描述']; $headerCell = ['订单ID', '订单编号', 'ERP单号', '京东订单号', '会员账号', '收货人', '下单日期', '下单时间', '客户名称', '平台来源', 'SKUID', '商品型号', '商品分类', '制造商', '供应商', '数量', '单价', '均摊后单价', '商品小计', '币种', '客服', '商品总额', '运费', '附加费', '优惠券', '订单总额', '付款类型', '订单状态', '发货状态', '收货地址', '发票类型', '发票状态', '发票抬头', '公司注册地址', '公司电话', 'adtags来源', '新用户来源', '取消原因', '推送备注', '是否为测试订单', '销售类型', '业务类型', '自采标记', '项目需求描述','收货联系电话'];
} }
array_unshift($cellData, $headerCell); array_unshift($cellData, $headerCell);
...@@ -372,13 +372,20 @@ class OrderModel extends Model ...@@ -372,13 +372,20 @@ class OrderModel extends Model
$tmp[$i]['order_type'] = !empty($order[$i]['order_pay_type']) ? Config('params.order_pay_type')[$order[$i]['order_pay_type']] : '未知'; $tmp[$i]['order_type'] = !empty($order[$i]['order_pay_type']) ? Config('params.order_pay_type')[$order[$i]['order_pay_type']] : '未知';
$tmp[$i]['order_status'] = !empty($order[$i]['status']) ? Config('params.order_status')[$order[$i]['status']] : '未知'; $tmp[$i]['order_status'] = !empty($order[$i]['status']) ? Config('params.order_status')[$order[$i]['status']] : '未知';
$tmp[$i]['shipping_status'] = !empty($order[$i]['shipping_status']) ? $shipping_status[$order[$i]['shipping_status']] : '无发货信息'; // 发货状态 $tmp[$i]['shipping_status'] = !empty($order[$i]['shipping_status']) ? $shipping_status[$order[$i]['shipping_status']] : '无发货信息'; // 发货状态
$tmp[$i]['address'] = $order[$i]['address'];
//查询发货地址的省市区
$province = self::get_address_name($order[$i]['province']);
$city = self::get_address_name($order[$i]['city']);
$district = self::get_address_name($order[$i]['district']);
$tmp[$i]['address'] = $province.$city.$district.$order[$i]['address'];
$tmp[$i]['inv_type'] = $order[$i]['inv_type'] ? $inv_type[$order[$i]['inv_type']] : '未知'; // 发票类型 $tmp[$i]['inv_type'] = $order[$i]['inv_type'] ? $inv_type[$order[$i]['inv_type']] : '未知'; // 发票类型
$tmp[$i]['invoice_status'] = !empty($order[$i]['invoice_status']) ? $invoice_status[$order[$i]['invoice_status']] : '无发票信息'; // 发票状态 $tmp[$i]['invoice_status'] = !empty($order[$i]['invoice_status']) ? $invoice_status[$order[$i]['invoice_status']] : '无发票信息'; // 发票状态
$tmp[$i]['tax_title'] = $order[$i]['tax_title']; $tmp[$i]['tax_title'] = $order[$i]['tax_title'];
$tmp[$i]['company_address'] = $order[$i]['company_address']; $tmp[$i]['company_address'] = $order[$i]['company_address'];
$tmp[$i]['company_phone'] = $order[$i]['company_phone']; $tmp[$i]['company_phone'] = $order[$i]['company_phone'];
if ($i > 0 && $order[$i]['order_id'] == $order[$i-1]['order_id']) { if ($i > 0 && $order[$i]['order_id'] == $order[$i-1]['order_id']) {
$tmp[$i]['adtags'] = ''; $tmp[$i]['adtags'] = '';
$tmp[$i]['client_source'] = ''; $tmp[$i]['client_source'] = '';
...@@ -403,12 +410,38 @@ class OrderModel extends Model ...@@ -403,12 +410,38 @@ class OrderModel extends Model
$tmp[$i]['is_new_order'] = $order[$i]['is_new_order'] == 1 ? '是' : '否'; // 是否为新订单 $tmp[$i]['is_new_order'] = $order[$i]['is_new_order'] == 1 ? '是' : '否'; // 是否为新订单
} }
//收货地址
$tmp[$i]['receiving_address'] = $order[$i]['mobile'];
unset($sales); unset($sales);
} }
return $tmp; return $tmp;
} }
public function get_address_name($id){
$result = $this->from('lie_region')->where(['region_id' => $id])->select(array('region_name','parent_id','region_type'))->get()->toArray();
$city = array('天津','北京','上海','重庆');
//如果名字是这几个 就是直辖市
if(in_array($result[0]['region_name'], $city) && $result[0]['region_type'] != 2){
return '';
}else if($result[0]['region_type'] == 2){
$suffix = '市';
}else if($result[0]['parent_id'] == 1){
$suffix = '省';
}else{
$suffix = '';
}
return $result[0]['region_name'].$suffix;
}
// 获取自营商品型号 // 获取自营商品型号
public function getGoodsName($goods_id) public function getGoodsName($goods_id)
{ {
......
...@@ -481,6 +481,11 @@ ...@@ -481,6 +481,11 @@
<th>生产跟踪</th> <th>生产跟踪</th>
@endif @endif
@if (empty($_REQUEST['tags']))
<th>备注</th>
@endif
<?php <?php
if ($action_name == 'changeOrder' && count($order_items_info) > 1 && in_array($order_info['status'], [1, 2])) { if ($action_name == 'changeOrder' && count($order_items_info) > 1 && in_array($order_info['status'], [1, 2])) {
echo '<th>操作</th>'; echo '<th>操作</th>';
...@@ -521,15 +526,6 @@ ...@@ -521,15 +526,6 @@
<td>{{$v['supplier_name']}}</td> <td>{{$v['supplier_name']}}</td>
@endif @endif
@if ($order_info['order_goods_type'] == 1)
<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]))
<td><a class="btn btn-danger deletegoods" href="javascript:;" data-id="{{$v['rec_id']}}">删除</a></td>
@endif
<td> <td>
@if($v['self_supplier_type'] == 1) @if($v['self_supplier_type'] == 1)
自采 自采
...@@ -541,6 +537,32 @@ ...@@ -541,6 +537,32 @@
</td> </td>
@if ($order_info['order_goods_type'] == 1)
<td><a class="order-track" data-rid="{{$v['rec_id']}}">{{ App\Http\Controllers\getLastTrack($v['rec_id']) }}</a></td>
@endif
@if (empty($_REQUEST['tags']))
<td>
@if(!empty($v['remarks']))
{{$v['remarks']}}
@else
<button type="button" class="btn btn-success btn-xs remarks">填写备注</button>
@endif
</td>
@endif
@if ($action_name == 'changeOrder' && count($order_items_info) > 1 && in_array($order_info['status'], [1, 2]))
<td><a class="btn btn-danger deletegoods" href="javascript:;" data-id="{{$v['rec_id']}}">删除</a></td>
@endif
</tr> </tr>
@endforeach @endforeach
@endif @endif
...@@ -1000,4 +1022,28 @@ ...@@ -1000,4 +1022,28 @@
$.lie.order.details(); $.lie.order.details();
$.lie.goods.add(); $.lie.goods.add();
$(function(){
$('.remarks').click(function(){
layer.prompt({title: '请输入备注信息', formType: 3}, function($remarks, index){
var $id = $('.order-track').attr('data-rid');
$.post('/api/update_order_items',{id:$id,remarks:$remarks},function(data){
if(data.errcode == 1){
history.go(0)
}
},'json')
layer.close(index);
});
})
})
</script> </script>
\ No newline at end of file
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