Commit ad976e08 by 朱继来

自营线下订单

parent bf9e86a3
......@@ -104,6 +104,14 @@ Class AddOrderController extends Controller
return $data;
}
// 查询省市区
public function getAddress($id)
{
$addr = DB::connection('order')->table('lie_region')->where('region_id', $id)->select('region_name')->first();
return $addr->region_name;
}
// 新增自营线下订单
public function addOffline(Request $request)
{
......@@ -116,7 +124,17 @@ Class AddOrderController extends Controller
$internal = DB::connection('order')->table('lie_user_main')->where('mobile', Config('website.internal-account'))->select('user_id')->first();
$info['internal_uid'] = $internal->user_id;
// 默认内部账号收货地址
$address = DB::connection('order')->table('lie_user_address')->where(['user_id' => $info['internal_uid'], 'is_default' => 1])->first();
$address->province_val = $this->getAddress($address->province);
$address->city_val = $this->getAddress($address->city);
$address->district_val = $this->getAddress($address->district);
$info['address'] = $address;
$sale_id = $request->user->userId;
$info['sale_id'] = $sale_id;
// 当前登录用户名称
$userInfo = DB::table('user_info')->where('userId', $sale_id)->select('name')->first();
......@@ -151,4 +169,165 @@ Class AddOrderController extends Controller
}
}
// 添加到购物车
public function addCart(Request $request)
{
if ($request->isMethod('post')) {
$data['uid'] = $request->input('uid');
$data['id'] = $request->input('id');
$data['num'] = $request->input('num');
$data['buy'] = $request->input('buy');
$data['delivery_place'] = $request->input('delivery_place');
$data['pf'] = 4;
$data['k1'] = time();
$data['k2'] = md5(md5($data['k1']).'fh6y5t4rr351d2c3bryi');
$url = Config('website.api_domain').'cart/addByOrderSystem';
$response = json_decode(curlApi($url, $data), true);
return ['errcode' => $response['err_code'], 'errmsg' => $response['err_msg']];
}
}
// 获取购物车列表
public function cartList(Request $request)
{
if ($request->isMethod('post')) {
$data['uid'] = $request->input('uid');
$data['type'] = $request->input('type');
$data['k1'] = time();
$data['k2'] = md5(md5($data['k1']).'fh6y5t4rr351d2c3bryi');
$url = Config('website.api_domain').'cart/listsByOrderSystem';
$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 changeNum(Request $request)
{
if ($request->isMethod('post')) {
$data['uid'] = $request->input('uid');
$data['num'] = $request->input('num');
$data['cart_id'] = $request->input('cart_id');
$data['k1'] = time();
$data['k2'] = md5(md5($data['k1']).'fh6y5t4rr351d2c3bryi');
$url = Config('website.api_domain').'cart/changeNumByOrderSystem';
$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 deleteGoods(Request $request)
{
if ($request->isMethod('post')) {
$data['uid'] = $request->input('uid');
$data['cart_id'] = $request->input('cart_id');
$data['k1'] = time();
$data['k2'] = md5(md5($data['k1']).'fh6y5t4rr351d2c3bryi');
$url = Config('website.api_domain').'cart/deleteByOrderSystem';
$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)
{
if ($request->isMethod('post')) {
$data['uid'] = $request->input('uid');
$data['sale_id'] = $request->input('sale_id');
$data['address_id'] = $request->input('address_id');
$data['cart_id'] = implode(',', $request->input('cart_ids'));
$data['type'] = $request->input('type');
if ($data['type'] == 3) {
$data['address_name'] = $request->input('address_name');
$data['address_mobile'] = $request->input('address_mobile');
}
$data['k1'] = time();
$data['k2'] = md5(md5($data['k1']).'fh6y5t4rr351d2c3bryi');
$url = Config('website.api_domain').'order/createByOrderSystem';
$response = json_decode(curlApi($url, $data), true);
if ($response['err_code'] == 0) {
return ['errcode' => $response['err_code'], 'errmsg' => $response['err_msg'], 'data'=>['order_id' => $response['data'], 'type' => $data['type']]];
} else {
return ['errcode' => $response['err_code'], 'errmsg' => $response['err_msg']];
}
}
}
// 提交订单成功页面
public function success(Request $request)
{
$info = $this->getPageInfo($request);
$order_id = $request->input('order_id');
$type = $request->input('type');
if ($type == 1) {
$title = '新增联营订单';
} else if ($type == 2) {
$title = '新增自营线上订单';
} else {
$title = '新增自营线下订单';
}
$info['title'] = $title;
$info['paths'] = [["title" => $title, "href" => '#']];
$order = DB::connection('order')->table('lie_order')->where('order_id', $order_id)->first();
$info['order_info'] = $order;
return view('success', $info);
}
// 自营线下订单审核
public function selfCheck(Request $request)
{
if ($request->isMethod('post')) {
$order_id = $request->input('order_id');
$update = DB::connection('order')->table('lie_order')->where('order_id', $order_id)->update(['status' => 4]); // 待发货状态
if (!empty($update)) {
return ['errcode' => 0, 'errmsg' => '审核成功'];
} else {
return ['errcode' => -1, 'errmsg' => '审核失败'];
}
}
}
}
\ No newline at end of file
......@@ -80,6 +80,14 @@ Route::group(['middleware' => 'web'], function () {
Route::get('/add_offline', 'AddOrderController@addOffline');
Route::post('/ajax/getSku', 'AddOrderController@getSku');
Route::post('/ajax/addCart', 'AddOrderController@addCart');
Route::post('/ajax/cartList', 'AddOrderController@cartList');
Route::post('/ajax/changeNum', 'AddOrderController@changeNum');
Route::post('/ajax/deleteGoods', 'AddOrderController@deleteGoods');
Route::post('/ajax/create', 'AddOrderController@create');
Route::get('/addorder/success', 'AddOrderController@success');
Route::post('/ajax/selfCheck', 'AddOrderController@selfCheck');
});
......
......@@ -53,7 +53,9 @@ return [
// 新增SKU入口
'add-sku-url' => 'http://footstone.liexin.net/manage/addsku',
// 查询SKU入口
'search-sku-url' => 'http://footstone.liexin.net/manage/skulist',
// 查询联营SKU入口
'search-sku-url-1' => 'http://footstone.liexin.net/manage/skulist',
// 查询自营SKU入口
'search-sku-url-2' => 'http://footstone.liexin.net/manage/GoodsList',
];
......@@ -137,3 +137,30 @@ li {
.shop-lists input {
width: 100px;
}
.amount-section{
margin-top: 40px;
text-align: right;
display: none;
}
/*提交订单成功页面*/
.section-1, .section-3{
text-align: center;
margin: 20px;
}
.section-1 img{
margin-bottom: 20px;
}
.section-2 {
width: 50%;
height: 100px;
border: 1px solid #ccc;
margin: 0 25%;
padding: 25px;
background: #f0f0f0;
}
.section-2 p {
margin-left: 33%;
}
......@@ -1491,6 +1491,40 @@
});
})
// 自营审单
$('.self-check').click(function(){
var order_id = $(this).data('id');
layer.open({
title: '审核自营线下订单',
content: '确定审核通过吗?',
btn:['取消','确定'],
yes: function(index, layero){
layer.close(index);
},
btn2: function(index, layero){
$.ajax({
url: '/ajax/selfCheck',
type: 'post',
data: {order_id: order_id},
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)
}
})
}
});
})
},
}
......
......@@ -43,6 +43,9 @@
<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">
......@@ -71,7 +74,7 @@
<div class="col-sm-6">
<div class="form-group">
<span>收货地址:</span>
<span>广东省深圳市龙岗区坂田街道五和大道南路2号万科星火Online天枢仓6栋3楼</span>
<span>{{ $address->province_val.$address->city_val.$address->district_val.$address->detail_address }}</span>
</div>
</div>
</div>
......@@ -93,7 +96,7 @@
<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>
<span>快捷入口:<a href="{{Config('website.search-sku-url-2')}}" target="_blank">查询SKU</a></span>
</div>
</div>
......@@ -161,7 +164,6 @@
</div>
<input type="hidden" name="goods_id" class="goods_id" value="">
<input type="hidden" name="cn_delivery_time" class="cn_delivery_time" value="">
<div class="clear"></div>
......@@ -171,6 +173,7 @@
<!-- 商品列表 -->
<div class="shop-lists">
<table class="table table-bordered table-hover shop-table">
<thead>
<tr>
<th width="15%">商品型号</th>
<th width="15%">制造商</th>
......@@ -181,16 +184,19 @@
<th width="15%">供应商</th>
<th width="10%">操作</th>
</tr>
</thead>
<tbody></tbody>
</table>
</div>
</div>
<div class="ibox-title">
<h3>订单信息</h3>
<!-- 订单金额 -->
<div class="amount-section">
<p>应付金额:<span class="text-danger order_amount"></span></p>
</div>
</div>
<div class="ibox-content">
<div class="ibox-title" style="text-align: right;">
<a class="btn btn-success submit-order" data-type="3">提交</a>
</div>
</form>
</div>
......@@ -200,5 +206,9 @@
</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
......@@ -554,7 +554,7 @@
@endif
<!-- 预付款 管理员完成首款对账后改变'对账'按钮 -->
@if ($order_info['status'] >= 2 && in_array('check_account', $userPerms))
@if (in_array($order_info['status'], [2, 3]) && in_array('check_account', $userPerms))
@if ($order_info['status'] == 3 && (!empty($order_pay_log) && $order_pay_log[0]['pay_type'] != ''))
<a href="javascript:;" data-id="{{$order_info['order_id']}}" class="btn btn-default last-check">对账</a>
@else
......@@ -576,6 +576,10 @@
<p style="padding-left: 5px;">操作</p>
<div class="tabs-box">
<!-- 判断状态和权限 -->
@if ($order_info['status'] == 1)
<a class="btn btn-success self-check" data-id="{{$order_info['order_id']}}" class="btn btn-default">审单</a>
@endif
@if (in_array($order_info['status'], [2, 3, 4]) && in_array('self_order_cancel', $userPerms))
<a class="btn btn-default self_cancel" href="javascript:;" data-id="{{$order_info['order_id']}}" class="btn btn-default">取消订单</a>
@endif
......
<!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('success.content')
</div>
</body>
<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">
<div class="ibox-title" style="border-top:0;">
<?php
$currency = $order_info->currency == 1 ? '¥' : '$';
?>
<div class="section-1">
<img src="../img/success.png" alt="提交成功">
<h3>订单提交成功</h3>
<p>下单时间:{{ date('Y-m-d H:i:s', $order_info->create_time) }}</p>
<p class="title-tips"><i class="fa fa-info-circle"></i>为了方便后续操作,请将如下订单编号,备注在ERP中的采购单中。</p>
</div>
<div class="section-2">
<p>订单编号:{{ $order_info->order_sn }}</p>
<p>应付金额:<span class="text-danger">{{ $currency.$order_info->order_amount }}</span></p>
</div>
<div class="section-3">
<a class="btn btn-success" href="/self_order">查看订单</a>
<a class="btn btn-default" href="/add_offline">继续新增</a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
// $.lie.add_order.offline();
</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