Refund.php 2.3 KB

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