<?php
namespace app\store\controller\apps\sharing\order;
use app\store\controller\Controller;
use app\store\model\sharing\Order as OrderModel;
use app\store\model\Express as ExpressModel;
class Operate extends Controller
{
private $model;
public function _initialize()
{
parent::_initialize();
$this->model = new OrderModel;
}
public function export($dataType)
{
return $this->model->exportList($dataType, $this->request->param());
}
public function batchDelivery()
{
if (!$this->request->isAjax()) {
return $this->fetch('batchDelivery', [
'express_list' => ExpressModel::getAll()
]);
}
if ($this->model->batchDelivery($this->postData('order'))) {
return $this->renderSuccess('发货成功');
}
return $this->renderError($this->model->getError() ?: '发货失败');
}
public function confirmCancel($order_id)
{
$model = OrderModel::detail($order_id);
if ($model->confirmCancel($this->postData('order'))) {
return $this->renderSuccess('操作成功');
}
return $this->renderError($model->getError() ?: '操作失败');
}
public function refund($order_id)
{
$model = OrderModel::detail($order_id);
if ($model->refund()) {
return $this->renderSuccess('操作成功');
}
return $this->renderError($model->getError() ?: '操作失败');
}
public function extract($order_id)
{
$model = OrderModel::detail($order_id);
$data = $this->postData('order');
if ($model->verificationOrder($data['extract_clerk_id'])) {
return $this->renderSuccess('核销成功');
}
return $this->renderError($model->getError() ?: '核销失败');
}
}