Receive.php 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: shenyang
  5. * Date: 2018/8/1
  6. * Time: 下午6:43
  7. */
  8. namespace app\frontend\modules\order\operations\member;
  9. use app\common\facades\Setting;
  10. use app\common\models\DispatchType;
  11. use app\frontend\modules\order\operations\OrderOperation;
  12. class Receive extends OrderOperation
  13. {
  14. public function getApi()
  15. {
  16. // todo 需要提取到门店插件复写的类中,在容器中判断实例哪个类
  17. if (in_array($this->order->dispatch_type_id, [DispatchType::SELF_DELIVERY, DispatchType::STORE_DELIVERY])) {
  18. return 'plugin.store-cashier.frontend.store.orderDetail.qrCodeUrl';
  19. }
  20. //配送站自提、核销
  21. if (in_array($this->order->dispatch_type_id, [DispatchType::DELIVERY_STATION_SELF, DispatchType::DELIVERY_STATION_SEND])) {
  22. return 'plugin.delivery-station.frontend.order.detail.qr-code-url';
  23. }
  24. return 'order.operation.receive';
  25. }
  26. public function getName()
  27. {
  28. // todo 需要提取到门店插件复写的类中,在容器中判断实例哪个类
  29. if ($this->order->dispatch_type_id == DispatchType::SELF_DELIVERY) {
  30. // 自提
  31. return '确认使用';
  32. }
  33. if ($this->order->dispatch_type_id == DispatchType::STORE_DELIVERY) {
  34. // 商家配送
  35. return '确认核销';
  36. }
  37. //配送站自提、核销
  38. if (in_array($this->order->dispatch_type_id, [DispatchType::DELIVERY_STATION_SELF, DispatchType::DELIVERY_STATION_SEND])) {
  39. return '确认核销';
  40. }
  41. return Setting::get('shop.lang.zh_cn.order.received_goods') ?: '确认收货';
  42. }
  43. public function getValue()
  44. {
  45. // todo 需要提取到门店插件复写的类中,在容器中判断实例哪个类
  46. if (in_array($this->order->dispatch_type_id, [DispatchType::SELF_DELIVERY, DispatchType::STORE_DELIVERY])) {
  47. return 'verification_code';
  48. }
  49. if (in_array($this->order->dispatch_type_id, [DispatchType::DELIVERY_STATION_SELF, DispatchType::DELIVERY_STATION_SEND])) {
  50. return 'clerk_code';
  51. }
  52. return static::COMPLETE;
  53. }
  54. public function enable()
  55. {
  56. if ($this->order->dispatch_type_id == DispatchType::HOTEL_CHECK_IN) {
  57. return false;
  58. }
  59. return true;
  60. }
  61. }