123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147 |
- <?php
- namespace app\store\controller;
- use app\store\model\Order as OrderModel;
- use app\store\model\Express as ExpressModel;
- use app\store\model\store\shop\Clerk as ShopClerkModel;
- use app\store\model\store\Shop as ShopModel;
- /**
- * 订单管理
- * Class Order
- * @package app\store\controller
- */
- class Order extends Controller
- {
- /**
- * 待发货订单列表
- * @return mixed
- * @throws \think\exception\DbException
- */
- public function delivery_list()
- {
- return $this->getList('待发货订单列表', 'delivery');
- }
- /**
- * 待收货订单列表
- * @return mixed
- * @throws \think\exception\DbException
- */
- public function receipt_list()
- {
- return $this->getList('待收货订单列表', 'receipt');
- }
- /**
- * 待付款订单列表
- * @return mixed
- * @throws \think\exception\DbException
- */
- public function pay_list()
- {
- return $this->getList('待付款订单列表', 'pay');
- }
- /**
- * 已完成订单列表
- * @return mixed
- * @throws \think\exception\DbException
- */
- public function complete_list()
- {
- return $this->getList('已完成订单列表', 'complete');
- }
- /**
- * 已取消订单列表
- * @return mixed
- * @throws \think\exception\DbException
- */
- public function cancel_list()
- {
- return $this->getList('已取消订单列表', 'cancel');
- }
- /**
- * 全部订单列表
- * @return mixed
- * @throws \think\exception\DbException
- */
- public function all_list()
- {
- return $this->getList('全部订单列表', 'all');
- }
- /**
- * 订单详情
- * @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() ?: '修改失败');
- }
- /**
- * 订单列表
- * @param string $title
- * @param string $dataType
- * @return mixed
- * @throws \think\exception\DbException
- */
- private function getList($title, $dataType)
- {
- // 订单列表
- $model = new OrderModel;
- $list = $model->getList($dataType, $this->request->param());
- // 自提门店列表
- $shopList = ShopModel::getAllList();
- return $this->fetch('index', compact('title', 'dataType', 'list', 'shopList'));
- }
- }
|