diff --git a/app/api/controller/StoreKeeper.php b/app/api/controller/StoreKeeper.php index 16a9be5a..52aed918 100644 --- a/app/api/controller/StoreKeeper.php +++ b/app/api/controller/StoreKeeper.php @@ -189,7 +189,7 @@ class StoreKeeper extends Controller // 订单列表 if (!empty($params['dataType']) && $params['dataType'] == 'refund') { $model = new OrderRefundModel; - $list = $model->getList($params); + $list = $model->getNewList($params); return $this->renderSuccess(compact('list')); } else { $model = new OrderModel; diff --git a/app/store/model/Order.php b/app/store/model/Order.php index d47bd835..d3773494 100644 --- a/app/store/model/Order.php +++ b/app/store/model/Order.php @@ -106,9 +106,9 @@ class Order extends OrderModel // 检索查询条件 $filter = $this->getQueryFilter($param); //不是店长查询当前用户订单 - // if(!UserService::isStore()) { - // $filter[] = ['user.user_id' ,'=', UserService::getCurrentLoginUserId() ]; - // } + if(!UserService::isStore()) { + $filter[] = ['user.user_id' ,'=', UserService::getCurrentLoginUserId() ]; + } $filterOr = []; if (!empty($param['searchValue']) && $param['searchType'] == 'all') { // $filterOr = [ diff --git a/app/store/model/OrderRefund.php b/app/store/model/OrderRefund.php index ddd09f04..5b256551 100644 --- a/app/store/model/OrderRefund.php +++ b/app/store/model/OrderRefund.php @@ -41,7 +41,49 @@ class OrderRefund extends OrderRefundModel // if(!UserService::isStore()) { // $filter[] = ['user.user_id' ,'=', UserService::getCurrentLoginUserId() ]; // } - $filterOr = [];Ne + $filterOr = []; + if (!empty($param['searchValue']) && $param['searchType'] == 'all') { +// $filterOr = [ +// ['order.order_no', 'like', "%{$param['searchValue']}%"], +// ['user.nick_name', 'like', "%{$param['searchValue']}%"], +// ['order.user_id', '=', (int)$param['searchValue']] +// ]; + + $filterOr = [ + ['order.order_no|user.nick_name|order.user_id', 'like', "%{$param['searchValue']}%"] + ]; + } + + // 获取列表数据 + $query = $this->alias('refund') + ->field('refund.*, order.order_no') + ->join('order', 'order.order_id = refund.order_id') + ->join('user', 'user.user_id = order.user_id') + ->where($filter); + if(!empty($filterOr)){ +// $query = $query->whereOr($filterOr); + $query = $query->where($filterOr); + } + $list = $query->order(['refund.create_time' => 'desc', 'refund.' . $this->getPk()]) + ->paginate(10); + // 加载关联订单数据 + return static::preload($list, ['orderGoods.image', 'orderData', 'user.avatar']); + } + + /** + * 获取售后单列表 + * @param array $param + * @return iterable|\think\model\Collection|\think\Paginator + */ + public function getNewList(array $param = []) + { + // 检索查询条件 + $filter = $this->getFilter($param); + //不是店长查询当前用户订单 + if(!UserService::isStore()) { + $filter[] = ['user.user_id' ,'=', UserService::getCurrentLoginUserId() ]; + } + $filterOr = []; if (!empty($param['searchValue']) && $param['searchType'] == 'all') { // $filterOr = [ // ['order.order_no', 'like', "%{$param['searchValue']}%"],