Commit 7d62d6ad by 朱继来

新增联营、自营线上订单

parent c5007003
......@@ -105,6 +105,132 @@ Class AddOrderController extends Controller
return $data;
}
// 新增联营订单
public function addOrder(Request $request)
{
$info = $this->getPageInfo($request);
$info['title'] = '新增联营订单';
$info['paths'] = [["title" => '新增联营订单', "href" => '#']];
$info['sale_id'] = $request->user->userId;
return view('addOrder', $info);
}
// 新增自营线上订单
public function addOnline(Request $request)
{
$info = $this->getPageInfo($request);
$info['title'] = '新增自营线上订单';
$info['paths'] = [["title" => '新增自营线上订单', "href" => '#']];
$info['sale_id'] = $request->user->userId;
return view('addOnline', $info);
}
// 获取用户信息
public function getUserInfo(Request $request)
{
if ($request->isMethod('post')) {
$mobile = $request->input('mobile');
$user = DB::connection('order')->table('lie_user_main')->where('mobile', $mobile)->select('user_id', 'mobile', 'is_test')->first();
if (!empty($user)) {
// 收货地址
$address = DB::connection('order')->table('lie_user_address')->where('user_id', $user->user_id)->get();
// 发票信息
$invoice = DB::connection('order')->table('lie_taxinfo')->where('user_id', $user->user_id)->get();
$info['user'] = $user;
$info['address'] = $address;
$info['invoice'] = $invoice;
}
if (isset($info)) {
return ['errcode' => 0, 'errmsg' => '', 'data' => $info];
} else {
return ['errcode' => -1, 'errmsg' => '未找用户信息'];
}
}
}
// 选择收货地址
public function selectAddr(Request $request)
{
if ($request->isMethod('post')) {
$address_id = $request->input('address_id');
$address = DB::connection('order')->table('lie_user_address')->where('address_id', $address_id)->first();
$address->province_val = $this->getAddress($address->province);
$address->city_val = $this->getAddress($address->city);
$address->district_val = $this->getAddress($address->district);
return ['errcode' => 0, 'errmsg' => '', 'data' => $address];
}
}
// 选择发票信息
public function selectInv(Request $request)
{
if ($request->isMethod('post')) {
$tax_id = $request->input('tax_id');
$invoice = DB::connection('order')->table('lie_taxinfo')->where('tax_id', $tax_id)->first();
$invoice->province_val = $this->getAddress($invoice->consignee_province);
$invoice->city_val = $this->getAddress($invoice->consignee_city);
$invoice->district_val = $this->getAddress($invoice->consignee_district);
return ['errcode' => 0, 'errmsg' => '', 'data' => $invoice];
}
}
// 根据发票类型选择发票信息
public function selectInvType(Request $request)
{
if ($request->isMethod('post')) {
$user_id = $request->input('user_id');
$inv_type = $request->input('inv_type');
if ($inv_type == 3) {
$invoice = DB::connection('order')->table('lie_taxinfo')->where(['user_id' => $user_id, 'inv_type' => $inv_type])->get();
} else {
$invoice = DB::connection('order')->table('lie_taxinfo')->where('user_id', $user_id)->whereIn('inv_type', [2, 4])->get();
}
return ['errcode' => 0, 'errmsg' => '', 'data' => $invoice];
}
}
// 获取可用优惠券
public function getCoupon(Request $request)
{
if ($request->isMethod('post')) {
$data['uid'] = $request->input('uid');
$data['order_goods_type'] = $request->input('goods_type');
$data['cart_ids'] = $request->input('cart_ids');
$data['k1'] = time();
$data['k2'] = md5(md5($data['k1']).'fh6y5t4rr351d2c3bryi');
$url = Config('website.api_domain').'ucoupon/bestusebyordersystem';
$response = json_decode(curlApi($url, $data), true);
if ($response['err_code'] == 0) {
return ['errcode' => $response['err_code'], 'errmsg' => $response['err_msg'], 'data'=>$response['data']];
} else {
return ['errcode' => $response['err_code'], 'errmsg' => $response['err_msg']];
}
}
}
// 查询省市区
public function getAddress($id)
{
......@@ -259,6 +385,28 @@ Class AddOrderController extends Controller
}
}
// 获取自营运费
public function getExpressFee(Request $request)
{
if ($request->isMethod('post')) {
$data['uid'] = $request->input('uid');
$data['address_id'] = $request->input('address_id');
$data['k1'] = time();
$data['k2'] = md5(md5($data['k1']).'fh6y5t4rr351d2c3bryi');
$url = Config('website.api_domain').'cart/getExpressFeeByOrder';
$response = json_decode(curlApi($url, $data), true);
if ($response['err_code'] == 0) {
return ['errcode' => $response['err_code'], 'errmsg' => $response['err_msg'], 'data'=>$response['data']];
} else {
return ['errcode' => $response['err_code'], 'errmsg' => $response['err_msg']];
}
}
}
// 提交订单
public function create(Request $request)
{
......@@ -269,9 +417,12 @@ Class AddOrderController extends Controller
$data['cart_id'] = implode(',', $request->input('cart_ids'));
$data['type'] = $request->input('type');
if ($data['type'] == 3) {
if ($data['type'] == 3) { // 自营线下订单
$data['address_name'] = $request->input('address_name');
$data['address_mobile'] = $request->input('address_mobile');
} else { // 联营、自营线上订单
$data['tax_id'] = $request->input('tax_id');
$data['user_coupon_id'] = $request->input('user_coupon_id');
}
$data['k1'] = time();
......@@ -307,10 +458,16 @@ Class AddOrderController extends Controller
$info['title'] = $title;
$info['paths'] = [["title" => $title, "href" => '#']];
$info['type'] = $type;
$order = DB::connection('order')->table('lie_order')->where('order_id', $order_id)->first();
$info['order_info'] = $order;
if ($type != 3) {
$user = DB::connection('order')->table('lie_user_main')->where('user_id', $order->user_id)->select('mobile')->first();
$info['user_info'] = $user;
}
$info['order_info'] = $order;
return view('success', $info);
}
......
......@@ -78,6 +78,16 @@ Route::group(['middleware' => 'web'], function () {
Route::post('/ajaxInputCancelReason', 'OrderController@ajaxInputCancelReason');
Route::get('/add_order', 'AddOrderController@addOrder');
Route::post('/ajax/getUserInfo', 'AddOrderController@getUserInfo');
Route::post('/ajax/selectAddr', 'AddOrderController@selectAddr');
Route::post('/ajax/selectInv', 'AddOrderController@selectInv');
Route::post('/ajax/selectInvType', 'AddOrderController@selectInvType');
Route::post('/ajax/getCoupon', 'AddOrderController@getCoupon');
Route::get('/add_online', 'AddOrderController@addOnline');
Route::post('/ajax/getExpressFee', 'AddOrderController@getExpressFee');
Route::get('/add_offline', 'AddOrderController@addOffline');
Route::post('/ajax/getSku', 'AddOrderController@getSku');
Route::post('/ajax/addCart', 'AddOrderController@addCart');
......
......@@ -58,4 +58,6 @@ return [
// 查询自营SKU入口
'search-sku-url-2' => 'http://footstone.liexin.net/manage/GoodsList',
// 新增自营线上订单付款地址
'pay_online_url' => 'http://www.liexin.com/v3/pay/online?id=',
];
......@@ -100,6 +100,10 @@ li {
}
/*新增订单*/
.user-info, .address-content, .invoice-content, .order-info {
display: none;
}
.title-tips {
font-size: 12px;
color: #ff9900;
......@@ -164,3 +168,14 @@ li {
margin-left: 33%;
}
.con-title {
float: left;
width: 100px;
}
.con-title span {
float: right;
}
.con-val {
float: left;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>订单管理后台 | {{ $title }}</title>
<script>document.domain="{{ Config::get('website.domain') }}";</script>
@include('addOffline.css')
@include('addOffline.js')
</head>
<body class="body-small" style="min-width:1024px;">
<div id="wrapper">
<!-- layouts.navigation -->
@include('layouts.navigation')
@include('addOnline.content')
</div>
</body>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>订单管理后台 | {{ $title }}</title>
<script>document.domain="{{ Config::get('website.domain') }}";</script>
@include('addOffline.css')
@include('addOffline.js')
</head>
<body class="body-small" style="min-width:1024px;">
<div id="wrapper">
<!-- layouts.navigation -->
@include('layouts.navigation')
@include('addOrder.content')
</div>
</body>
......@@ -18,13 +18,29 @@
</div>
<div class="section-2">
@if ($type != 3)
<style>.section-2{height: 150px;}</style>
<p>手机号码:{{ $user_info->mobile }}</p>
@endif
<p>订单编号:{{ $order_info->order_sn }}</p>
<p>应付金额:<span class="text-danger">{{ $currency.$order_info->order_amount }}</span></p>
@if ($type == 2)
<div style="text-align: center;">付款地址:{{ Config('website.pay_online_url').$order_info->order_id }}</div>
@endif
</div>
<div class="section-3">
<a class="btn btn-success" href="/self_order">查看订单</a>
<a class="btn btn-default" href="/add_offline">继续新增</a>
@if ($type == 1)
<a class="btn btn-success" href="/change/{{ $order_info->order_id }}">审核订单</a>
<a class="btn btn-default" href="/add_order">继续新增</a>
@elseif ($type == 2)
<a class="btn btn-success" href="/self_order">查看订单</a>
<a class="btn btn-default" href="/add_online">继续新增</a>
@else
<a class="btn btn-success" href="/self_order">查看订单</a>
<a class="btn btn-default" href="/add_offline">继续新增</a>
@endif
</div>
</div>
......
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