Browse Source

订单详情

master
lanzu_qinsheng 6 years ago
parent
commit
3cd01f3b4c
  1. 4
      app/Admin/Controllers/ImsCjdcOrderMainController.php
  2. 39
      app/Admin/Extensions/MyDetailPage.php
  3. 15
      app/Models/ImsCjdcOrder.php
  4. 11
      app/Models/ImsCjdcOrderMain.php
  5. 2
      resources/views/orderdetail.php

4
app/Admin/Controllers/ImsCjdcOrderMainController.php

@ -148,4 +148,8 @@ class ImsCjdcOrderMainController extends AdminController
)
->body(Lazy::make($detail));
}
}

39
app/Admin/Extensions/MyDetailPage.php

@ -22,34 +22,16 @@ class MyDetailPage extends LazyRenderable
public function render()
{
//>>1.主订单数据
$order = ImsCjdcOrderMain::where('id', $this->order_id)->first()->toArray();
$order = ImsCjdcOrderMain::getOrderData($this->order_id);
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) {
if (substr($or['store']['logo'], 0, 4) != 'http') {
$or['store']['logo'] = env('IMG_HOST') . '/' . $or['store']['logo'];
}
$or['goods'] = LanzuOrderGoods::where('order_id', $or['id'])->get()->toArray();
}
}
//dd($orders);
$orders = json_encode($orders);
}
//配送距离
//配送费
//拒绝退款理由
//退款总备注原因,单个商品或者单个子订单
Admin::script(
<<<JS
$orders = ImsCjdcOrder::getOrdersData($order['id']);
//配送距离
//配送费
//拒绝退款理由
//退款总备注原因,单个商品或者单个子订单
Admin::script(
<<<JS
var orders = JSON.stringify($orders)
var app = new Vue({
el:"#detail",
@ -82,7 +64,6 @@ class MyDetailPage extends LazyRenderable
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
@ -97,8 +78,8 @@ class MyDetailPage extends LazyRenderable
}
});
JS
);
);
}
return view('orderdetail');
}

15
app/Models/ImsCjdcOrder.php

@ -22,5 +22,18 @@ class ImsCjdcOrder extends Model
return $this->hasOne('\App\Models\LanzuStore','id','store_id');
}
public static function getOrdersData($oid)
{
$orders = ImsCjdcOrder::with('user')->with('store')
->where('order_main_id', $oid)->get()->toArray();
if (count($orders)) {
foreach ($orders as &$or) {
if (substr($or['store']['logo'], 0, 4) != 'http') {
$or['store']['logo'] = env('IMG_HOST') . '/' . $or['store']['logo'];
}
$or['goods'] = LanzuOrderGoods::where('order_id', $or['id'])->get()->toArray();
}
}
return json_encode($orders);
}
}

11
app/Models/ImsCjdcOrderMain.php

@ -50,4 +50,15 @@ class ImsCjdcOrderMain extends Model
{
return self::where('id',$oid)->update(['shipping_type'=>$type]);
}
public static function getOrderData($oid)
{
$order = ImsCjdcOrderMain::where('id', $oid)->first()->toArray();
$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']);
return $order;
}
}

2
resources/views/orderdetail.php

@ -50,7 +50,7 @@
</div>
<p class="mb-0" style="color: red;font-size: 1.4rem;">{{goods.price}}</p>
<el-button type="info" style="float: right;" @click="refund()">退款审核</el-button>
<el-button type="danger" style="float: right;" @click="refund()">退款审核</el-button>
</div>
</div>
<p v-if="item.note">店铺备注: ({{item.note}})</p>

Loading…
Cancel
Save