Browse Source

修复:查看订单详情,配送员未显示:为空

master
lanzu_qinsheng 5 years ago
parent
commit
62d6d2771a
  1. 2
      app/Admin/Controllers/ImsCjdcOrderMainController.php
  2. 5
      app/Admin/Forms/SelectHorseman.php
  3. 2
      app/Models/ImsCjdcOrderMain.php
  4. 3
      app/Models/LanzuServiceHorseman.php
  5. 12
      app/Models/v3/LanzuEmployees.php

2
app/Admin/Controllers/ImsCjdcOrderMainController.php

@ -155,7 +155,7 @@ class ImsCjdcOrderMainController extends AdminController
return $content->header('订单详情') return $content->header('订单详情')
->breadcrumb( ->breadcrumb(
['text' => '列表', 'url' => "order?page={$page}"], ['text' => '列表', 'url' => "order?page={$page}"],
['text' => '详情', 'url' => 'detail'],
['text' => '详情', 'url' => 'detail']
) )
->body(Lazy::make($detail)); ->body(Lazy::make($detail));
} }

5
app/Admin/Forms/SelectHorseman.php

@ -27,8 +27,9 @@ class SelectHorseman extends Form
$hid = request()->input('horseman_id'); $hid = request()->input('horseman_id');
$oid = request()->input('order_id'); $oid = request()->input('order_id');
$current_page = request()->get('current_page');
$result = ImsCjdcOrderMain::where('id',$oid)->update(['shipping_type'=>1,'horseman_id'=>$hid,'updated_at'=>time()]);
$current_page = request()->input('current_page');
$horseman = LanzuEmployees::getName($hid);//骑手名称
$result = ImsCjdcOrderMain::where('id',$oid)->update(['shipping_type'=>1,'horseman_id'=>$hid,'shipping_name'=>$horseman,'updated_at'=>time()]);
if ($result){ if ($result){
return $this->success('操作成功',"order?page={$current_page}"); return $this->success('操作成功',"order?page={$current_page}");
}else{ }else{

2
app/Models/ImsCjdcOrderMain.php

@ -59,7 +59,7 @@ class ImsCjdcOrderMain extends Model
$order['updated_at'] = $order['updated_at'] ? date('Y-m-d H:i:s', $order['updated_at']) : null; $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['pay_type'] = config('order.pay_type')[$order['pay_type']];
$order['shipping_type'] = config('order.shipping_type')[$order['shipping_type']]; $order['shipping_type'] = config('order.shipping_type')[$order['shipping_type']];
$order['horseman_name'] = LanzuServiceHorseman::getName($order['horseman_id']);
$order['horseman_name'] = $order['shipping_name']??LanzuServiceHorseman::getName($order['horseman_id']);
//获取市场经纬度 //获取市场经纬度
//$market = LanzuMarket::where('id',$order['market_id'])->first()->toArray(); //$market = LanzuMarket::where('id',$order['market_id'])->first()->toArray();

3
app/Models/LanzuServiceHorseman.php

@ -2,6 +2,7 @@
namespace App\Models; namespace App\Models;
use App\Models\v3\LanzuEmployees;
use Dcat\Admin\Traits\HasDateTimeFormatter; use Dcat\Admin\Traits\HasDateTimeFormatter;
use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
@ -32,7 +33,7 @@ class LanzuServiceHorseman extends Model
{ {
//获取骑手名称 //获取骑手名称
if ($hid){ if ($hid){
$horseman = LanzuServiceHorseman::find($hid);
$horseman = LanzuEmployees::find($hid);
if ($horseman){ if ($horseman){
return $horseman->name; return $horseman->name;
} }

12
app/Models/v3/LanzuEmployees.php

@ -88,5 +88,15 @@ class LanzuEmployees extends Model
} }
return $item; return $item;
} }
public static function getName($hid=null)
{
//获取骑手名称
if ($hid){
$horseman = self::find($hid);
if ($horseman){
return $horseman->name;
}
}
return '--';
}
} }
Loading…
Cancel
Save