Resend.php 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: Administrator
  5. * Date: 2020/12/15
  6. * Time: 14:49
  7. */
  8. namespace app\backend\modules\refund\services\steps;
  9. use app\common\models\refund\RefundApply;
  10. use app\common\services\steps\BaseStepFactory;
  11. class Resend extends BaseStepFactory
  12. {
  13. public function getTitle()
  14. {
  15. switch ($this->model->status) {
  16. case RefundApply::WAIT_RECEIVE_RESEND_GOODS:
  17. $name = '等待用户收货';
  18. break;
  19. case RefundApply::WAIT_RESEND_GOODS:
  20. $name = '商家分批发货中';
  21. break;
  22. default:
  23. $name = '待商家发货';
  24. }
  25. return $name;
  26. }
  27. public function getDescription()
  28. {
  29. if ($this->finishStatus() && !is_null($this->model->send_time)) {
  30. return $this->model->send_time->toDateTimeString();
  31. }
  32. return '';
  33. }
  34. public function getStatus()
  35. {
  36. if ($this->finishStatus()) {
  37. return 'finish';
  38. } elseif ($this->processStatus()) {
  39. return 'process';
  40. } elseif ($this->waitStatus()) {
  41. return 'wait';
  42. }
  43. return 'error';
  44. }
  45. public function isShow()
  46. {
  47. return (RefundApply::WAIT_CHECK < $this->model->status && $this->model->status < RefundApply::WAIT_RECEIVE_RESEND_GOODS) || !is_null($this->model->send_time);
  48. }
  49. public function waitStatus()
  50. {
  51. return $this->model->status < RefundApply::WAIT_RESEND_GOODS;
  52. }
  53. public function processStatus()
  54. {
  55. return RefundApply::WAIT_RECEIVE_RETURN_GOODS <= $this->model->status && $this->model->status < RefundApply::WAIT_RECEIVE_RESEND_GOODS;
  56. }
  57. public function finishStatus()
  58. {
  59. return !is_null($this->model->send_time);
  60. }
  61. public function sort()
  62. {
  63. return 30;
  64. }
  65. }