链街Dcat后台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

80 lines
2.9 KiB

<?php
namespace App\Admin\Extensions;
use App\Models\ImsCjdcOrder;
use App\Models\ImsCjdcOrderMain;
use App\Models\LanzuOrderGoods;
use App\Models\LanzuServiceHorseman;
use Dcat\Admin\Admin;
use Dcat\Admin\Support\LazyRenderable;
use Endroid\QrCode\Exceptions\DataDoesntExistsException;
class MyDetailPage extends LazyRenderable
{
protected static $js = ['https://cdn.jsdelivr.net/npm/vue'];
protected static $css = ['css/deatail.css'];
public function render()
{
//>>1.主订单数据
$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']);
//>>2.获取子订单
$orders = ImsCjdcOrder::with('user')->with('store')
->where('order_main_id',$order['id'])->get()->toArray();
if (count($orders)){
foreach ($orders as &$or){
$or['goods'] = LanzuOrderGoods::where('order_id',$or['id'])->get()->toArray();
}
}
$orders = json_encode($orders);
}
//配送距离
//配送费
//拒绝退款理由
//退款总备注原因,单个商品或者单个子订单
Admin::script(
<<<JS
var orders = JSON.stringify($orders)
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']}",
refuse_refund_note: "{$order['refuse_refund_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']}",
orders: JSON.parse(orders)
}
});
JS
);
return view('orderdetail');
}
}