Browse Source

订单详情页

master
lanzu_qsy 5 years ago
parent
commit
60df32efde
  1. 15
      app/Admin/Controllers/ImsCjdcOrderMainController.php
  2. 56
      app/Admin/Extensions/MyDetailPage.php
  3. 28
      app/Admin/Extensions/OrderDetail.php
  4. 2
      app/Admin/routes.php
  5. 11
      app/Models/LanzuServiceHorseman.php
  6. 12
      config/order.php
  7. 38
      resources/views/orderdetail.php

15
app/Admin/Controllers/ImsCjdcOrderMainController.php

@ -15,8 +15,10 @@ use App\Admin\Repositories\ImsCjdcOrderMain;
use Dcat\Admin\Admin;
use Dcat\Admin\Form;
use Dcat\Admin\Grid;
use Dcat\Admin\Layout\Content;
use Dcat\Admin\Show;
use Dcat\Admin\Controllers\AdminController;
use Dcat\Admin\Widgets\Lazy;
use Dcat\Admin\Widgets\Modal;
;
@ -128,9 +130,16 @@ class ImsCjdcOrderMainController extends AdminController
});
}
public function orderDetail()
/**
* 订单详情
* @param Content $content
* @return Content
*/
public function orderDetail(Content $content)
{
echo 111;
$oid = request()->get('order_id');
// 实例化表单类并传递自定义参数
$detail = MyDetailPage::make(['order_id'=>$oid]);
return $content->header('订单详情')->body(Lazy::make($detail));
}
}

56
app/Admin/Extensions/MyDetailPage.php

@ -4,6 +4,7 @@
namespace App\Admin\Extensions;
use App\Models\ImsCjdcOrderMain;
use App\Models\LanzuServiceHorseman;
use Dcat\Admin\Admin;
use Dcat\Admin\Support\LazyRenderable;
@ -18,22 +19,47 @@ class MyDetailPage extends LazyRenderable
public function render()
{
$order = ImsCjdcOrderMain::where('id',$this->order_id)->first()->toArray();
if ($order){
$order['created_at'] = date('Y-m-d H:i:s',$order['created_at']);
$order['updated_at'] =$order['updated_at'] ? date('Y-m-d H:i:s',$order['updated_at']):null;
$order['pay_type'] = config('order.pay_type')[$order['pay_type']];
$order['shipping_type'] = config('order.shipping_type')[$order['shipping_type']];
$order['horseman_name'] = LanzuServiceHorseman::getName($order['horseman_id']);
// Admin::script(
// <<<JS
//
// var app = new Vue({
// el:"#detail",
// data:{
// order_num: "{$order['order_num']}"
// }
// });
//
//JS
//
// );
return view('orderdetail',['order_num'=>'000000000000000000000009999']);
}
//配送距离
//配送费
//拒绝退款理由
//退款总备注原因,单个商品或者单个子订单
//dd($order);
Admin::script(
<<<JS
var app = new Vue({
el:"#detail",
data:{
order_num: "{$order['order_num']}",
name: "{$order['name']}",
created_at: "{$order['created_at']}",
updated_at: "{$order['updated_at']}",
pay_type: "{$order['pay_type']}",
shipping_type: "{$order['shipping_type']}",
tel: "{$order['tel']}",
delivery_time_note: "{$order['delivery_time_note']}",
address: "{$order['address']}",
note: "{$order['note']}",
money: "{$order['money']}",
total_money: "{$order['total_money']}",
services_money: "{$order['services_money']}",
coupon_money: "{$order['coupon_money']}",
delivery_money: "{$order['delivery_money']}",
horseman_name: "{$order['horseman_name']}"
}
});
JS
);
return view('orderdetail');
}

28
app/Admin/Extensions/OrderDetail.php

@ -18,23 +18,25 @@ class OrderDetail extends RowAction
{
$this->order_id = $orderId;
parent::__construct($title);
}
public function render()
/**
* 添加JS
* @return string
*/
protected function script()
{
// 实例化表单类并传递自定义参数
$detail = MyDetailPage::make(['order_id'=>$this->order_id]);
return <<<JS
$('.detail_{$this->order_id}').on('click', function () {
window.location.href ="detail?order_id={$this->order_id}";
});
JS;
}
return Modal::make()
->xl()
->title('订单详情')
->body($detail)
->delay(300)
->button($this->title);
public function html()
{
$this->setHtmlAttribute(['class'=>"detail_{$this->order_id}"]);
return parent::html();
}
}

2
app/Admin/routes.php

@ -50,5 +50,5 @@ Route::group([
$router->resource('/horseman', 'LanzuServiceHorsemanController');
$router->any('/test', 'Test@test');
$router->any('/detail', 'Test@getOrderDetail');
});

11
app/Models/LanzuServiceHorseman.php

@ -27,4 +27,15 @@ class LanzuServiceHorseman extends Model
}
return $item;
}
public static function getName($hid=null)
{
//获取骑手名称
if ($hid){
$horseman = LanzuServiceHorseman::find($hid);
return $horseman->name;
}else{
return '-';
}
}
}

12
config/order.php

@ -30,6 +30,18 @@ return [
1000=>'创建达达运单失败',
],
//支付类型 1.微信支付2.余额支付3.积分支付4.货到付款
'pay_type'=>[
1=>'微信支付',
2=>'余额支付',
3=>'积分支付',
4=>'货到付款',
],
//配送方式:1服务站配送,2达达配送
'shipping_type'=>[1=>'服务站配送',2=>'达达配送'],
//达达测试0 如果为1则用为正式环境
'online'=>0,
'dada_test_config'=>[

38
resources/views/orderdetail.php

@ -1,32 +1,31 @@
<div id="detail">
<!-- 用户信息表格 -->
<table class="table table-bordered table-striped">
<tbody>
<tr>
<td class="text-nowrap" scope="col">订单编号:$order_num</td>
<td colspan="5">创建时间:333333</td>
<td class="text-nowrap" scope="col">订单编号:{{order_num}}</td>
<td colspan="5">创建时间:{{created_at}}</td>
</tr>
<tr>
<td class="text-nowrap" scope="row">用户名称:33333</td>
<td colspan="5">联系电话:333</td>
<td class="text-nowrap" scope="row">用户名称:{{name}}</td>
<td colspan="5">联系电话:{{tel}}3</td>
</tr>
<tr>
<td class="text-nowrap" scope="row">收货地址:33333</td>
<td colspan="5">更新时间:3333</td>
<td class="text-nowrap" scope="row">收货地址:{{address}}</td>
<td colspan="5">更新时间:{{updated_at}}</td>
</tr>
<tr>
<td class="text-nowrap" scope="row">预约送达时间:33333</td>
<td class="text-nowrap" scope="row">预约送达时间:{{delivery_time_note}}</td>
<td class="text-nowrap" scope="col">配送员:{{horseman_name}}</td>
</tr>
<tr>
<td class="text-nowrap" scope="row">配送距离:3333 km</td>
<td colspan="5">配送费:3333 </td>
<td class="text-nowrap" scope="row">配送距离:-- km</td>
<td colspan="5">配送费:{{delivery_money}} </td>
</tr>
<tr>
<td class="text-nowrap" scope="col">备注:33333</td>
<td class="text-nowrap" scope="col"></td>
<td class="text-nowrap" scope="col">备注:{{note}}</td>
</tr>
</tbody>
</table>
@ -51,17 +50,16 @@
</div>
</div>
<div class="money">
总金额: 111
总金额: {{total_money}}
&ensp;&ensp;
优惠金额: <span style="color: red">-111</span>
优惠金额: <span style="color: red">-{{coupon_money}}</span>
&ensp;&ensp;
配送费: <span style="color: green">+1111</span>
配送费: <span style="color: green">+{{delivery_money}}</span>
&ensp;&ensp;
实付金额: 1111
增值服务费: <span style="color: green">+{{services_money}}</span>
&ensp;&ensp;
实付金额: {money}
</div>
<!-- 店铺END -->
</div>
<script>
</script>
Loading…
Cancel
Save