feat: 添加门店ID字段到用户列表

This commit is contained in:
mkm 2024-07-26 10:17:30 +08:00
parent 0c1b3ed5da
commit 945fdac2c2

View File

@ -13,6 +13,7 @@ use app\common\model\user\UserAddress;
use app\common\model\vip_flow\VipFlow;
use support\Db;
use app\common\lists\ListsSearchInterface;
use app\common\model\system_store\SystemStore;
class UserLists extends BaseAdminDataLists implements ListsExcelInterface,ListsSearchInterface
{
@ -44,7 +45,7 @@ class UserLists extends BaseAdminDataLists implements ListsExcelInterface,ListsS
public function lists(): array
{
$field = "id,nickname,real_name,sex,avatar,account,mobile,channel,create_time,purchase_funds,user_ship,
label_id,integral,now_money,total_recharge_amount,vip_time";
label_id,integral,now_money,total_recharge_amount,vip_time,store_id";
$lists = User::where($this->searchWhere)
->with(['user_ship','user_label'])
->limit($this->limitOffset, $this->limitLength)
@ -68,6 +69,10 @@ class UserLists extends BaseAdminDataLists implements ListsExcelInterface,ListsS
if($item['label_name']== null){
$item['label_name'] = '无';
}
$item['store_name']='';
if($item['store_id']>0){
$item['store_name'] = SystemStore::where('id',$item['store_id'])->value('name');
}
$item['return_money'] = VipFlow::
where(['user_id'=>$item['id'],'status'=>0])
->sum('number')??0;
@ -138,8 +143,13 @@ class UserLists extends BaseAdminDataLists implements ListsExcelInterface,ListsS
'nickname' => '用户昵称',
'account' => '账号',
'mobile' => '手机号码',
'channel' => '注册来源',
'create_time' => '注册时间',
'now_money' => '用户余额',
'integral' => '礼品券',
'vip_name' => '会员类型',
'store_name' => '门店',
'total_recharge_amount' => '累计消费',
'purchase_funds' => '采购款',
'format_address'=>'地址'
];
}
}