|
|
@@ -32,8 +32,28 @@ class CustomController extends BaseController
|
|
|
//客户列表 ssh 2019.11.30
|
|
|
public function actionList()
|
|
|
{
|
|
|
+ $get = Yii::$app->request->get();
|
|
|
+ $type = isset($get['type']) ? $get['type'] : 0;
|
|
|
+ $name = isset($get['name']) ? $get['name'] : '';
|
|
|
$where = ['shopId' => $this->shopId];
|
|
|
- $list = CustomService::getCustomList($where);
|
|
|
+ if ($type == 1) {
|
|
|
+ //消费排行
|
|
|
+ $sort = 'buyAmount DESC';
|
|
|
+ } else if ($type == 2) {
|
|
|
+ //欠款客户
|
|
|
+ $where['isDebt'] = 1;
|
|
|
+ $sort = 'debtAmount DESC';
|
|
|
+ } else {
|
|
|
+ $sort = 'visitTime DESC';
|
|
|
+ }
|
|
|
+ if (!empty($name)) {
|
|
|
+ if (stringUtil::isLetter($name)) {
|
|
|
+ $where['py'] = ['like', $name];
|
|
|
+ } else {
|
|
|
+ $where['name'] = ['like', $name];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $list = CustomService::getCustomList($where, $sort);
|
|
|
util::success($list);
|
|
|
}
|
|
|
|