This commit is contained in:
faiz 2024-06-27 14:15:20 +08:00
commit 5398a59322
4 changed files with 38 additions and 7 deletions

View File

@ -75,6 +75,9 @@ class AdminController extends base
if(!empty($name) && $item->name != $name) {
$item->name = $name;
}
if(!empty($username) && $item->username != $username) {
$item->username = $username;
}
if(!empty($password) && strlen($password) < 6) return $this->error(2001, '密码长度错误');
if(!empty($password)) {
$item->password = $password;

View File

@ -19,8 +19,27 @@ class DataController extends base
->leftJoin('admins a','a.id = o.admin_id')
->order('o.admin_id','desc')
->group('a.id,a.name,o.admin_id')
->having('o.admin_id>0')
->fieldRaw('count(o.id) as orders, SUM(o.total_price) as total_price, SUM(IF(o.asset_price>0 AND o.status=2,1,0)) as assets, SUM(IF(o.asset_price>0 AND o.status=2,o.asset_price,0)) as asset_price, sum(if(o.order_status=0,1,0)) as nopays, sum(if(o.order_status=0,o.total_price,0)) as nopay_price, o.admin_id,a.name');
->fieldRaw('
count(o.id) as orders,
SUM(o.total_price) as total_price,
SUM(CASE
WHEN (o.os = 1 AND o.order_status = 4) OR (o.os = 3 AND o.order_status = 2) OR (o.os = 2 AND o.order_status = 5) THEN 1
ELSE 0
END) as assets,
SUM(CASE
WHEN (o.os = 1 AND o.order_status = 4) OR (o.os = 3 AND o.order_status = 2) OR (o.os = 2 AND o.order_status = 5) THEN asset_price
ELSE 0
END) as asset_price,
SUM(CASE
WHEN (o.os = 1 AND o.order_status = 5) OR (o.os = 3 AND o.order_status = 4) OR (o.os = 2 AND o.order_status = 1) THEN 1
ELSE 0
END) AS nopays,
SUM(CASE
WHEN (o.os = 1 AND o.order_status = 5) OR (o.os = 3 AND o.order_status = 4) OR (o.os = 2 AND o.order_status = 1) THEN actual_price
ELSE 0
END) AS nopay_price,
o.admin_id,a.name');
if($times) {
$query->whereBetween('o.create_at',[strtotime($times[0])*1000,strtotime($times[1])*1000+999]);

View File

@ -195,21 +195,27 @@ class IndexController extends base
$limit = $request->get('limit', 10);
$product_name = $request->get('product_name');
$os = $request->get('os_status');
$list = Orders::where('sn','>',0)
$list = Orders::where('id','>',0)
->fieldRaw('
os,product_name,
SUM(IF(status=0,1,0)) as wait,
SUM(IF(status=1,1,0)) as doing,
SUM(total_price) as total,
count(id) as `all`,
SUM(IF(asset_price>0 AND status=2,1,0)) as asset,
SUM(IF(asset_price>0 AND status=2,asset_price,0)) as asset_price,
SUM(CASE
WHEN (os = 1 AND STATUS = 5) OR (os = 3 AND STATUS = 4) OR (os = 2 AND STATUS = 1) THEN 1
WHEN (os = 1 AND order_status = 4) OR (os = 3 AND order_status = 2) OR (os = 2 AND order_status = 5) THEN 1
ELSE 0
END) as asset,
SUM(CASE
WHEN (os = 1 AND order_status = 4) OR (os = 3 AND order_status = 2) OR (os = 2 AND order_status = 5) THEN asset_price
ELSE 0
END) as asset_price,
SUM(CASE
WHEN (os = 1 AND order_status = 5) OR (os = 3 AND order_status = 4) OR (os = 2 AND order_status = 1) THEN 1
ELSE 0
END) AS refund,
SUM(CASE
WHEN (os = 1 AND STATUS = 5) OR (os = 3 AND STATUS = 4) OR (os = 2 AND STATUS = 1) THEN actual_price
WHEN (os = 1 AND order_status = 5) OR (os = 3 AND order_status = 4) OR (os = 2 AND order_status = 1) THEN actual_price
ELSE 0
END) AS refund_price
')

View File

@ -200,6 +200,9 @@ class OrderController extends base
if(empty($desc) || empty($status)) return $this->error(2004, '跟进说明需要填写!');
if(empty($personnel)) return $this->error(2004, '人员情况需要填写!');
if(empty($travel_date)) return $this->error(2004, '出游时间需要填写!');
if ($status != 2){
if(empty($next_follow)) return $this->error(2004, '下次跟进时间需要填写!');
}
$lock = 'Travel:Order:'.$id.':lock';
$back = Redis::set($lock, $request->admin->id, 'EX', 6, 'NX');