pull/1/head
ztt 11 months ago
parent 22e5694174
commit 3048b9a993
  1. 2
      app/api/controller/StoreKeeper.php
  2. 6
      app/store/model/Order.php
  3. 44
      app/store/model/OrderRefund.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;

@ -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 = [

@ -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']}%"],

Loading…
Cancel
Save