Commit ca6c6a54 by 朱继来

fix conflict

parents e06288d0 05f3d024
...@@ -475,7 +475,11 @@ Class OrderController extends Controller ...@@ -475,7 +475,11 @@ Class OrderController extends Controller
array('goods_name', '商品型号'), array('goods_name', '商品型号'),
array('goods_number', '数量'), array('goods_number', '数量'),
array('goods_price', '单价'), array('goods_price', '单价'),
array('order_amount', '应付金额'), array('goods_amount', '商品总额'),
array('shipping_fee', '运费'),
array('extra_fee', '附加费'),
array('coupon', '优惠券'),
array('order_amount', '订单总额'),
array('currency', '币种'), array('currency', '币种'),
array('order_type', '订单类型'), array('order_type', '订单类型'),
array('order_status', '订单状态'), array('order_status', '订单状态'),
...@@ -685,41 +689,59 @@ Class OrderController extends Controller ...@@ -685,41 +689,59 @@ Class OrderController extends Controller
'3' => '已签收', '3' => '已签收',
); );
$i = 0;
$tmp = array(); $tmp = array();
foreach ($order as $val) { for ($i = 0; $i < count($order); $i++) {
// 推送人 // 推送人
if ($val->sale_id) { if ($order[$i]->sale_id) {
$sales = DB::table('user_info')->where(['userId' => $val->sale_id])->select('name')->first(); $sales = DB::table('user_info')->where(['userId' => $order[$i]->sale_id])->select('name')->first();
} }
$tmp[$i]['order_id'] = $val->order_id; $tmp[$i]['order_id'] = $order[$i]->order_id;
$tmp[$i]['order_sn'] = $val->order_sn; $tmp[$i]['order_sn'] = $order[$i]->order_sn;
$tmp[$i]['user_account'] = $val->mobile ? $val->mobile : $val->email; $tmp[$i]['user_account'] = $order[$i]->mobile ? $order[$i]->mobile : $order[$i]->email;
$tmp[$i]['consignee'] = isset($val->consignee) ? $val->consignee : ''; $tmp[$i]['consignee'] = isset($order[$i]->consignee) ? $order[$i]->consignee : '';
$tmp[$i]['create_time'] = date('Y-m-d H:i:s', $val->create_time); $tmp[$i]['create_time'] = date('Y-m-d H:i:s', $order[$i]->create_time);
$tmp[$i]['com_name'] = isset($val->com_name) ? $val->com_name : ''; $tmp[$i]['com_name'] = isset($order[$i]->com_name) ? $order[$i]->com_name : '';
$tmp[$i]['goods_name'] = $val->goods_name; $tmp[$i]['goods_name'] = $order[$i]->goods_name;
$tmp[$i]['goods_number'] = $val->goods_number; $tmp[$i]['goods_number'] = $order[$i]->goods_number;
$tmp[$i]['goods_price'] = $val->goods_price; $tmp[$i]['goods_price'] = $order[$i]->goods_price;
$tmp[$i]['order_amount'] = $val->order_amount; $tmp[$i]['goods_amount'] = $order[$i]->goods_number*$order[$i]->goods_price;
$tmp[$i]['currency'] = $val->currency == 1 ? 'RMB' : 'USD';
$tmp[$i]['order_type'] = $order_type[$val->order_pay_type]; if ($i > 0 && $order[$i]->order_id == $order[$i-1]->order_id) {
$tmp[$i]['order_status'] = $order_status[$val->status]; $tmp[$i]['shipping_fee'] = '';
// 发货状态 $tmp[$i]['extra_fee'] = '';
$tmp[$i]['shipping_status'] = !empty($val->shipping_status) ? $shipping_status[$val->shipping_status] : '无发货信息'; $tmp[$i]['coupon'] = '';
$tmp[$i]['invoice_status'] = !empty($val->invoice_status) ? $invoice_status[$val->invoice_status] : '无发票信息'; // 发票状态 $tmp[$i]['order_amount'] = '';
$tmp[$i]['company_name'] = $val->supplier_name; } else {
$tmp[$i]['shipping_fee'] = $this->getOrderPrice($order[$i]->order_id, 3);
$tmp[$i]['extra_fee'] = $this->getOrderPrice($order[$i]->order_id, 2);
$tmp[$i]['coupon'] = $this->getOrderPrice($order[$i]->order_id, -4);
$tmp[$i]['order_amount'] = $order[$i]->order_amount;
}
$tmp[$i]['currency'] = $order[$i]->currency == 1 ? 'RMB' : 'USD';
$tmp[$i]['order_type'] = $order_type[$order[$i]->order_pay_type];
$tmp[$i]['order_status'] = $order_status[$order[$i]->status];
$tmp[$i]['shipping_status'] = !empty($order[$i]->shipping_status) ? $shipping_status[$order[$i]->shipping_status] : '无发货信息'; // 发货状态
$tmp[$i]['invoice_status'] = !empty($order[$i]->invoice_status) ? $invoice_status[$order[$i]->invoice_status] : '无发票信息'; // 发票状态
$tmp[$i]['company_name'] = $order[$i]->supplier_name;
$tmp[$i]['sale_name'] = isset($sales) ? $sales->name : ''; // 推送业务员 $tmp[$i]['sale_name'] = isset($sales) ? $sales->name : ''; // 推送业务员
unset($sales); unset($sales);
$i++;
} }
return $tmp; return $tmp;
} }
// 订单金额展示
public function getOrderPrice($order_id, $type)
{
$price = DB::connection('order')->table('lie_order_price')->where('order_id', '=', $order_id)->where('price_type', '=', $type)->select('price')->first();
return $price ? $price->price : 0;
}
// 下载合同 // 下载合同
public function ajaxDownloadContract(Request $request) public function ajaxDownloadContract(Request $request)
{ {
...@@ -1590,6 +1612,7 @@ Class OrderController extends Controller ...@@ -1590,6 +1612,7 @@ Class OrderController extends Controller
{ {
$order = DB::connection('order') $order = DB::connection('order')
->table('lie_order') ->table('lie_order')
->where('order_goods_type', '=', 1)
->where('status', '=', 2) ->where('status', '=', 2)
// ->whereNotIn('user_id', $this->testMobile()) // ->whereNotIn('user_id', $this->testMobile())
->where('is_type', '=', 0) ->where('is_type', '=', 0)
...@@ -1648,6 +1671,7 @@ Class OrderController extends Controller ...@@ -1648,6 +1671,7 @@ Class OrderController extends Controller
$order = DB::connection('order') $order = DB::connection('order')
->table('lie_order') ->table('lie_order')
->where('order_goods_type', '=', 1)
->where('status', '=', 2) ->where('status', '=', 2)
// ->whereNotIn('user_id', $this->testMobile()) // ->whereNotIn('user_id', $this->testMobile())
->where('is_type', '=', 0) ->where('is_type', '=', 0)
...@@ -1716,35 +1740,72 @@ Class OrderController extends Controller ...@@ -1716,35 +1740,72 @@ Class OrderController extends Controller
return ['errcode'=>0, 'errmsg'=>'延长成功']; return ['errcode'=>0, 'errmsg'=>'延长成功'];
} }
// 自营订单到达48小时后自动取消订单 public function tempCount(Request $request)
public function selfOrderCancel()
{ {
$order = DB::connection('order') $current = strtotime(date('Y-m-d', time())); // 当天0点
->table('lie_order')
->whereNotIn('user_id', $this->testMobile()) $half = strtotime('2017-11-28'); // 半年
->where('status', '=', 2)
->where('order_goods_type', '=', 2) $year = strtotime('2017-05-28'); // 一年
->where('is_type', '=', 0)
->select('order_id', 'create_time') // 订单数量
->orderBy('create_time', 'DESC') $halfCount = DB::connection('order')->table('lie_order')
->get(); // ->where('order_goods_type', 1)
// ->where('order_type', 1)
if (!empty($order)) { ->whereNotIn('user_id', $this->testMobile())
foreach ($order as $v) { ->where('is_type', 0)
$limit_time = $v->create_time + 2*86400; ->whereBetween('create_time', [$half, $current])
->count();
if ($limit_time <= time()) { echo '半年订单数:'.$halfCount.'<br>';
$update = DB::connection('order')
->table('lie_order') $yearCount = DB::connection('order')->table('lie_order')
->where('order_id', '=', $v->order_id) ->whereNotIn('user_id', $this->testMobile())
->update(['status' => -1, 'cancel_time' => time()]); ->where('is_type', 0)
->whereBetween('create_time', [$year, $current])
if ($update) { ->count();
continue; echo '一年订单数:'.$yearCount.'<br>';
}
} // 普票订单数
} $halfInvoice = DB::connection('order')
} ->table('lie_order as o')
->leftJoin('lie_order_invoice as i', 'o.order_id', '=', 'i.order_id')
->whereNotIn('o.user_id', $this->testMobile())
->where('o.is_type', 0)
->where('i.inv_type', 2)
->whereBetween('o.create_time', [$half, $current])
->count();
echo '半年普票订单数:'.$halfInvoice.'<br>';
$yearInvoice = DB::connection('order')
->table('lie_order as o')
->leftJoin('lie_order_invoice as i', 'o.order_id', '=', 'i.order_id')
->whereNotIn('o.user_id', $this->testMobile())
->where('o.is_type', 0)
->where('i.inv_type', 2)
->whereBetween('o.create_time', [$year, $current])
->count();
echo '一年普票订单数:'.$yearInvoice.'<br>';
// 增票订单数
$halfAddInvoice = DB::connection('order')
->table('lie_order as o')
->leftJoin('lie_order_invoice as i', 'o.order_id', '=', 'i.order_id')
->whereNotIn('o.user_id', $this->testMobile())
->where('o.is_type', 0)
->where('i.inv_type', 3)
->whereBetween('o.create_time', [$half, $current])
->count();
echo '半年增票订单数:'.$halfAddInvoice.'<br>';
$yearAddInvoice = DB::connection('order')
->table('lie_order as o')
->leftJoin('lie_order_invoice as i', 'o.order_id', '=', 'i.order_id')
->whereNotIn('o.user_id', $this->testMobile())
->where('o.is_type', 0)
->where('i.inv_type', 3)
->whereBetween('o.create_time', [$year, $current])
->count();
echo '一年增票订单数:'.$yearAddInvoice.'<br>';
} }
} }
\ No newline at end of file
...@@ -71,6 +71,7 @@ Route::group(['middleware' => 'web'], function () { ...@@ -71,6 +71,7 @@ Route::group(['middleware' => 'web'], function () {
Route::post('/ajaxSelfExpress', 'OrderController@ajaxSelfExpress'); Route::post('/ajaxSelfExpress', 'OrderController@ajaxSelfExpress');
Route::match(['get', 'post'], '/express_set', 'OrderController@expressSet'); Route::match(['get', 'post'], '/express_set', 'OrderController@expressSet');
Route::match(['get', 'post'], '/tempcount', 'OrderController@tempCount');
Route::post('/ajaxDownloadContract', 'OrderController@ajaxDownloadContract'); Route::post('/ajaxDownloadContract', 'OrderController@ajaxDownloadContract');
......
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