Refund.php 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <?php
  2. namespace app\store\controller\apps\sharing\order;
  3. use app\store\controller\Controller;
  4. use app\store\model\sharing\Order as OrderModel;
  5. use app\store\model\sharing\OrderRefund as OrderRefundModel;
  6. use app\store\model\ReturnAddress as ReturnAddressModel;
  7. /**
  8. * 售后管理
  9. * Class Refund
  10. * @package app\store\controller\order
  11. */
  12. class Refund extends Controller
  13. {
  14. /**
  15. * 帮助中心列表
  16. * @return mixed
  17. * @throws \think\exception\DbException
  18. */
  19. public function index()
  20. {
  21. $model = new OrderRefundModel;
  22. $list = $model->getList($this->getData());
  23. return $this->fetch('index', compact('list'));
  24. }
  25. /**
  26. * 售后单详情
  27. * @param $order_refund_id
  28. * @return mixed
  29. * @throws \think\exception\DbException
  30. */
  31. public function detail($order_refund_id)
  32. {
  33. // 售后单详情
  34. $detail = OrderRefundModel::detail($order_refund_id);
  35. // 订单详情
  36. $order = OrderModel::detail($detail['order_id']);
  37. // 退货地址
  38. $address = (new ReturnAddressModel)->getAll();
  39. return $this->fetch('detail', compact('detail', 'order', 'address'));
  40. }
  41. /**
  42. * 商家审核
  43. * @param $order_refund_id
  44. * @return array|bool
  45. * @throws \think\exception\DbException
  46. */
  47. public function audit($order_refund_id)
  48. {
  49. if (!$this->request->isAjax()) {
  50. return false;
  51. }
  52. $model = OrderRefundModel::detail($order_refund_id);
  53. if ($model->audit($this->postData('refund'))) {
  54. return $this->renderSuccess('操作成功');
  55. }
  56. return $this->renderError($model->getError() ?: '操作失败');
  57. }
  58. /**
  59. * 确认收货并退款
  60. * @param $order_refund_id
  61. * @return array|bool
  62. * @throws \think\exception\DbException
  63. */
  64. public function receipt($order_refund_id)
  65. {
  66. if (!$this->request->isAjax()) {
  67. return false;
  68. }
  69. $model = OrderRefundModel::detail($order_refund_id);
  70. if ($model->receipt($this->postData('refund'))) {
  71. return $this->renderSuccess('操作成功');
  72. }
  73. return $this->renderError($model->getError() ?: '操作失败');
  74. }
  75. }