新增店铺明细查询数据

This commit is contained in:
liu 2024-06-20 11:41:14 +08:00
parent 4339cf481e
commit 6cbffc01a8
6 changed files with 88 additions and 1 deletions

View File

@ -65,4 +65,16 @@ class UserController extends BaseAdminController
}
return $this->fail(UserLogic::getError());
}
//采购款明细、余额明细、礼品券明细、返还金明细
public function fundList()
{
$params = (new UserValidate())->goCheck('fund');
$res = UserLogic::dealDetails($params);
$res['page_no'] = $params['page_no'];
$res['page_size'] = $params['page_size'];
return $this->success('ok', $res);
}
}

View File

@ -63,7 +63,6 @@ class UserLists extends BaseAdminDataLists implements ListsExcelInterface
$data['sex_text'] = $data->sex_text;
})->toArray();
foreach ($lists as &$item) {
//返还金,采购款明细、余额明细、礼品券明细、返还金明细
$item['channel'] = UserTerminalEnum::getTermInalDesc($item['channel']);
$item['user_address'] = UserAddress::where([
'uid'=>$item['id'],'is_default'=>YesNoEnum::YES

View File

@ -13,13 +13,18 @@
// +----------------------------------------------------------------------
namespace app\admin\logic\user;
use app\common\enum\OrderEnum;
use app\common\enum\user\UserTerminalEnum;
use app\common\enum\YesNoEnum;
use app\common\logic\BaseLogic;
use app\common\model\finance\CapitalFlow;
use app\common\model\store_finance_flow\StoreFinanceFlow;
use app\common\model\user\User;
use app\common\model\user\UserAddress;
use app\common\model\user\UserRecharge;
use app\common\model\user_label\UserLabel;
use app\common\model\user_sign\UserSign;
use app\common\model\vip_flow\VipFlow;
use think\facade\Db;
use app\common\service\FileService;
use Webman\Config;
@ -178,4 +183,57 @@ class UserLogic extends BaseLogic
$params['field'] => $params['value']
]);
}
public static function dealDetails($params)
{
switch ($params['type']){
case 1:
//采购款明细
$query =CapitalFlow::where(['uid'=>$params['id']]);
$count = $query->count();
$data = $query
->page($params['page_no'],$params['page_size'])
->select()->toArray();
break;
case 2:
//余额明细
$query = StoreFinanceFlow::with(['store'])
->where([
'other_uid'=>$params['id'],'financial_type'=> OrderEnum::VIP_ORDER_OBTAINS,
'financial_pm'=>YesNoEnum::YES
]);
$count = $query->count();
$data = $query
->page($params['page_no'],$params['page_size'])
->select()->toArray();
break;
case 3:
//礼品券明细
$query = UserSign::where(['uid'=>$params['id']]);
$count = $query->count();
$data =$query
->page($params['page_no'],$params['page_size'])
->select()->toArray();
break;
case 4:
//返还金明细 -todo back
$query = VipFlow::with('store')->where(['user_id'=>$params['id']]);
$count = $query->count();
$data = $query
->page($params['page_no'],$params['page_size'])
->select()->toArray();
break;
default:
$data = [];
$count = 0;
}
return [
'list' => $data,
'count' => $count
];
}
}

View File

@ -34,6 +34,7 @@ class UserValidate extends BaseValidate
'village' => 'require',
'brigade' => 'require',
'user_ship' => 'require',
'type' => 'require|number',
];
@ -57,9 +58,14 @@ class UserValidate extends BaseValidate
'village' => '村',
'brigade' => ' 队',
'user_ship' => ' 会员类型',
'type' => '查询类型',
];
public function sceneFund()
{
return $this->only(['type','id']);
}
/**
* @notes 添加场景
* @return UserValidate

View File

@ -4,6 +4,7 @@ namespace app\common\model\store_finance_flow;
use app\common\model\BaseModel;
use app\common\model\system_store\SystemStore;
use app\common\model\system_store\SystemStoreStaff;
use app\common\model\user\User;
use think\model\concern\SoftDelete;
@ -20,6 +21,11 @@ class StoreFinanceFlow extends BaseModel
protected $name = 'store_finance_flow';
protected $deleteTime = 'delete_time';
public function store()
{
return $this->hasOne(SystemStore::class, 'id','store_id')
->bind(['store_name'=>'name', 'store_phone'=>'phone','store_detailed_address'=>'detailed_address','store_simple_address'=>'address']);
}
public function user()
{
return $this->hasOne(User::class, 'id', 'user_id')->bind(['nickname']);

View File

@ -3,6 +3,7 @@
namespace app\common\model\vip_flow;
use app\common\model\BaseModel;
use app\common\model\system_store\SystemStore;
use think\model\concern\SoftDelete;
class VipFlow extends BaseModel
@ -11,4 +12,9 @@ class VipFlow extends BaseModel
protected $name = 'vip_flow';
protected $deleteTime = 'delete_time';
public function store()
{
return $this->hasOne(SystemStore::class, 'id','store_id')
->bind(['store_name'=>'name', 'store_phone'=>'phone','store_detailed_address'=>'detailed_address','store_simple_address'=>'address']);
}
}