quanwei
2025-11-21 2d9362ae6f528f57e6133d5d80f0b633c24e8eb6
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<?php
 
namespace app\shop\controller\order;
 
use app\shop\controller\Controller;
use app\shop\model\order\Order as OrderModel;
use app\shop\model\order\OrderRefund as OrderRefundModel;
use app\shop\model\settings\ReturnAddress as ReturnAddressModel;
use app\shop\model\supplier\Supplier as SupplierModel;
 
/**
 * 平台售后管理
 */
class Platerefund extends Controller
{
    /**
     * 售后列表
     */
    public function index()
    {
        //获取该角色管理的区域 by yj 2023.12.20
        $shop_supplier_ids = SupplierModel::getSupplierIdsByUser($this->store['user']);
        $model = new OrderRefundModel;
        $params = $this->postData();
        if(!empty($shop_supplier_ids)){
            $params["shop_supplier_ids"] = $shop_supplier_ids;
        }
        //列表数据
        $list = $model->getplateList($params);
        //重要数字
        $num_arr = $model->plategroupCount($params);
        $arr = [];
        $arr[40] = $model->finishcount($params);
        foreach ($num_arr as $key => $val) {
            $k = $val['plate_status']['value'];
            $arr[$k] = $val;
        }
 
        return $this->renderSuccess('', compact('list', 'arr'));
    }
 
    /**
     * 售后单详情
     */
    public function detail($order_refund_id)
    {
        // 售后单详情
        $detail = OrderRefundModel::detail($order_refund_id);
        if (isset($detail['send_time']) && $detail['send_time'] > 0) {
            $detail['send_time'] = date('Y-m-d H:i:s', $detail['send_time']);
        }
        // 订单详情
        $order = OrderModel::detail($detail['order_id']);
        // 退货地址
        $address = (new ReturnAddressModel)->getAll($detail['shop_supplier_id']);
        return $this->renderSuccess('', compact('detail', 'order', 'address'));
    }
 
    /**
     * 商家审核
     */
    public function audit($order_refund_id)
    {
        $model = OrderRefundModel::detail($order_refund_id);
        if ($model->plateaudit($this->postData())) {
            return $this->renderSuccess('操作成功');
        }
        return $this->renderError($model->getError() ?: '操作失败');
    }
 
}