链街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.

53 lines
1.3 KiB

5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
  1. <?php
  2. namespace App\Admin\Forms;
  3. use App\Admin\Common\Auth;
  4. use App\Models\ImsCjdcOrderMain;
  5. use App\Models\LanzuServiceHorseman;
  6. use App\Models\v3\LanzuEmployees;
  7. use Dcat\Admin\Contracts\LazyRenderable;
  8. use Dcat\Admin\Traits\LazyWidget;
  9. use Dcat\Admin\Widgets\Form;
  10. use Symfony\Component\HttpFoundation\Response;
  11. class SelectHorseman extends Form
  12. {
  13. /**
  14. * Handle the form request.
  15. *
  16. * @param array $input
  17. *
  18. * @return Response
  19. */
  20. protected $orderId;
  21. public function handle(array $input)
  22. {
  23. $hid = request()->input('horseman_id');
  24. $oid = request()->input('order_id');
  25. $current_page = request()->get('current_page');
  26. $result = ImsCjdcOrderMain::where('id',$oid)->update(['shipping_type'=>1,'horseman_id'=>$hid,'updated_at'=>time()]);
  27. if ($result){
  28. return $this->success('操作成功',"order?page={$current_page}");
  29. }else{
  30. return $this->error('操作失败');
  31. }
  32. }
  33. /**
  34. * Build a form here.
  35. */
  36. public function form()
  37. {
  38. $this->select('horseman_id','配送员')
  39. ->options(LanzuEmployees::getHorseman(Auth::getMarket()))
  40. ->required();
  41. $this->hidden('order_id');
  42. $this->hidden('current_page');
  43. }
  44. }