You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
87 lines
2.3 KiB
87 lines
2.3 KiB
<?php
|
|
|
|
namespace app\store\controller\apps\sharing;
|
|
|
|
use app\store\controller\Controller;
|
|
use app\store\model\Express as ExpressModel;
|
|
use app\store\model\store\Shop as ShopModel;
|
|
use app\store\model\sharing\Order as OrderModel;
|
|
use app\store\model\store\shop\Clerk as ShopClerkModel;
|
|
|
|
/**
|
|
* 订单管理
|
|
* Class Order
|
|
* @package app\store\controller
|
|
*/
|
|
class Order extends Controller
|
|
{
|
|
/**
|
|
* 全部订单列表
|
|
* @param string $dataType
|
|
* @return mixed
|
|
* @throws \think\exception\DbException
|
|
*/
|
|
public function index($dataType = 'all')
|
|
{
|
|
// 订单列表
|
|
$model = new OrderModel;
|
|
$list = $model->getList($dataType, $this->request->param());
|
|
// 自提门店列表
|
|
$shopList = ShopModel::getAllList();
|
|
return $this->fetch('index', compact('dataType', 'list', 'shopList'));
|
|
}
|
|
|
|
/**
|
|
* 订单详情
|
|
* @param $order_id
|
|
* @return mixed
|
|
* @throws \think\exception\DbException
|
|
*/
|
|
public function detail($order_id)
|
|
{
|
|
// 订单详情
|
|
$detail = OrderModel::detail($order_id);
|
|
// 物流公司列表
|
|
$expressList = ExpressModel::getAll();
|
|
// 门店店员列表
|
|
$shopClerkList = (new ShopClerkModel)->getList(true);
|
|
return $this->fetch('detail', compact(
|
|
'detail',
|
|
'expressList',
|
|
'shopClerkList'
|
|
));
|
|
}
|
|
|
|
/**
|
|
* 确认发货
|
|
* @param $order_id
|
|
* @return array
|
|
* @throws \app\common\exception\BaseException
|
|
* @throws \think\Exception
|
|
* @throws \think\exception\DbException
|
|
*/
|
|
public function delivery($order_id)
|
|
{
|
|
$model = OrderModel::detail($order_id);
|
|
if ($model->delivery($this->postData('order'))) {
|
|
return $this->renderSuccess('发货成功');
|
|
}
|
|
return $this->renderError($model->getError() ?: '发货失败');
|
|
}
|
|
|
|
/**
|
|
* 修改订单价格
|
|
* @param $order_id
|
|
* @return array
|
|
* @throws \think\exception\DbException
|
|
*/
|
|
public function updatePrice($order_id)
|
|
{
|
|
$model = OrderModel::detail($order_id);
|
|
if ($model->updatePrice($this->postData('order'))) {
|
|
return $this->renderSuccess('修改成功');
|
|
}
|
|
return $this->renderError($model->getError() ?: '修改失败');
|
|
}
|
|
|
|
}
|
|
|