quanwei
2025-10-31 f226d5fe6327e31bb471a96b7370cf94689c6608
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
72
73
74
75
<?php
 
namespace app\shop\controller\takeout;
 
use app\shop\controller\Controller;
use app\shop\model\takeout\Order as OrderModel;
 
/**
 * 订单操作
 * @package app\shop\controller\order
 */
class Operate extends Controller
{
    /**
     * 订单导出
     */
    public function export($dataType)
    {
        $model = new OrderModel();
        $data = $this->postData();
        $data['order_type'] = 0;
        return $model->exportList($dataType, $data);
    }
 
    /**
     * 取消订单
     */
    public function orderCancel($order_id)
    {
        // 订单信息
        $model = OrderModel::detail($order_id);
        if ($model->orderCancel($this->postData())) {
            return $this->renderSuccess('操作成功');
        }
        return $this->renderError($model->getError() ?: '操作失败');
    }
 
    /**
     * 门店核销
     */
    public function extract($order_id)
    {
        $model = OrderModel::detail($order_id);
        if ($model->verificationOrder()) {
            return $this->renderSuccess('核销成功');
        }
        return $this->renderError($model->getError() ?: '核销失败');
    }
 
    /**
     * 退款
     */
    public function refund($order_id)
    {
        $model = OrderModel::detail($order_id);
        if ($model->refund($this->postData(), $this->store['user']['user_name'])) {
            return $this->renderSuccess('操作成功');
        }
        return $this->renderError($model->getError() ?: '操作失败');
    }
 
    /**
     * 订单配送
     */
    public function sendOrder($order_id)
    {
        // 订单详情
        $model = OrderModel::detail($order_id);
        if ($model->sendOrder($order_id)) {
            return $this->renderSuccess('发送成功');
        }
        return $this->renderError($model->getError() ?: '发送失败');
    }
 
}