Merge branch 'dev' of https://gitea.lihaink.cn/mkm/multi-store into dev
This commit is contained in:
commit
283e8f1747
@ -6,8 +6,11 @@ namespace app\admin\lists\user;
|
||||
|
||||
use app\admin\lists\BaseAdminDataLists;
|
||||
use app\common\enum\user\UserTerminalEnum;
|
||||
use app\common\enum\YesNoEnum;
|
||||
use app\common\lists\ListsExcelInterface;
|
||||
use app\common\model\user\User;
|
||||
use app\common\model\user\UserAddress;
|
||||
use app\common\model\vip_flow\VipFlow;
|
||||
|
||||
class UserLists extends BaseAdminDataLists implements ListsExcelInterface
|
||||
{
|
||||
@ -49,8 +52,10 @@ class UserLists extends BaseAdminDataLists implements ListsExcelInterface
|
||||
if(isset($params['is_disable']) && $params['is_disable'] != ''){
|
||||
$where[] = ['is_disable','=', $params['is_disable']];
|
||||
}
|
||||
$field = "id,nickname,real_name,sex,avatar,account,mobile,channel,create_time";
|
||||
$field = "id,nickname,real_name,sex,avatar,account,mobile,channel,create_time,purchase_funds,user_ship,
|
||||
label_id,integral";
|
||||
$lists = User::withSearch($this->setSearch(), $this->params)->where($where)
|
||||
->with(['user_ship','user_label'])
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->field($field)
|
||||
->order('id desc')
|
||||
@ -58,7 +63,20 @@ 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
|
||||
])->value('detail');
|
||||
if($item['vip_name']== null){
|
||||
$item['vip_name'] = '普通会员';
|
||||
}
|
||||
if($item['label_name']== null){
|
||||
$item['label_name'] = '无';
|
||||
}
|
||||
$item['return_money'] = VipFlow::
|
||||
where(['user_id'=>$item['id'],'status'=>0])
|
||||
->sum('number')??0;
|
||||
}
|
||||
|
||||
return $lists;
|
||||
|
@ -105,25 +105,12 @@ class ProductLists extends BaseAdminDataLists implements ListsSearchInterface, L
|
||||
|
||||
$this->searchWhere[] = ['status', '=', 1];
|
||||
$this->searchWhere[] = ['stock', '>', 0];
|
||||
$data = StoreBranchProduct::where($this->searchWhere)
|
||||
return StoreBranchProduct::where($this->searchWhere)
|
||||
->field(['id', 'product_id', 'cate_id', 'store_name', 'cost', 'store_id', 'price', 'bar_code', 'image', 'sales', 'store_info', 'delete_time', 'unit', 'batch'])
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->with(['className', 'unitName'])
|
||||
->order($this->sortOrder)
|
||||
->select()?->toArray();
|
||||
// $check = DictType::where('type','activities')->find();
|
||||
// foreach ($data as &$value){
|
||||
// if(isset($check) && $check['status'] == 1){
|
||||
// // $value['price'] = StoreProduct::where('id',$value['product_id'])->value('ot_price');
|
||||
// $value['ot_price'] = $value['price'];
|
||||
// $value['price'] = $value['cost'];
|
||||
// }
|
||||
// $value['is_default'] = 0;
|
||||
// if($store_id == 2){
|
||||
// $value['is_default'] = 1;
|
||||
// }
|
||||
// }
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
@ -149,29 +136,20 @@ class ProductLists extends BaseAdminDataLists implements ListsSearchInterface, L
|
||||
$this->searchWhere[] = ['store_id', '=', $store_id];
|
||||
}
|
||||
$class_all = $this->request->get('class_all');
|
||||
$where = [];
|
||||
if ($class_all) {
|
||||
//查3级别的
|
||||
$arr = Cate::where('pid', $class_all)->column('id');
|
||||
if ($arr) {
|
||||
$arr2 = Cate::where('pid', 'in', $arr)->column('id');
|
||||
$where[] = ['cate_id', 'in', array_merge($arr, $arr2)];
|
||||
$this->searchWhere[] = ['cate_id', 'in', array_merge($arr, $arr2)];
|
||||
}else{
|
||||
$this->searchWhere[] = ['cate_id','=',$class_all];
|
||||
}
|
||||
}
|
||||
if (empty($where) && $class_all) {
|
||||
//2或者1
|
||||
$where[] = ['cate_id', '=', $class_all];
|
||||
}
|
||||
$M_store_id = $this->request->__get('store_id');
|
||||
|
||||
$this->searchWhere[] = ['status', '=', 1];
|
||||
$this->searchWhere[] = ['stock', '>', 0];
|
||||
if ($M_store_id) {
|
||||
$where[] = ['store_id', '=', $M_store_id];
|
||||
$data = StoreBranchProduct::where($this->searchWhere)->where($where)
|
||||
->count();
|
||||
} else {
|
||||
$data = StoreBranchProduct::where($this->searchWhere)->where($where)
|
||||
->count();
|
||||
}
|
||||
return $data;
|
||||
return StoreBranchProduct::where($this->searchWhere)
|
||||
->count();
|
||||
}
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ namespace app\common\model\user;
|
||||
|
||||
use app\common\enum\user\UserEnum;
|
||||
use app\common\model\BaseModel;
|
||||
use app\common\model\user_label\UserLabel;
|
||||
use app\common\service\FileService;
|
||||
use think\model\concern\SoftDelete;
|
||||
|
||||
@ -20,12 +21,18 @@ class User extends BaseModel
|
||||
|
||||
protected $deleteTime = 'delete_time';
|
||||
|
||||
|
||||
//会员类型
|
||||
public function userShip()
|
||||
{
|
||||
return $this->hasOne(UserShip::class, 'id', 'user_ship')
|
||||
// return $this->hasOne(UserShip::class,'user_ship','id')
|
||||
->bind(['vip_name' => 'title', 'discount', 'limit']);
|
||||
return $this->hasOne(UserShip::class,'id','user_ship')
|
||||
->bind(['vip_name'=>'title','discount','limit']);
|
||||
}
|
||||
|
||||
public function userLabel()
|
||||
{
|
||||
return $this->hasOne(UserLabel::class,'label_id','label_id')
|
||||
->bind(['label_name']);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
14
app/common/model/vip_flow/VipFlow.php
Normal file
14
app/common/model/vip_flow/VipFlow.php
Normal file
@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace app\common\model\vip_flow;
|
||||
|
||||
use app\common\model\BaseModel;
|
||||
use think\model\concern\SoftDelete;
|
||||
|
||||
class VipFlow extends BaseModel
|
||||
{
|
||||
use SoftDelete;
|
||||
protected $name = 'vip_flow';
|
||||
protected $deleteTime = 'delete_time';
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user