This commit is contained in:
yaosen 2024-07-01 11:25:55 +08:00
parent 5bcc31ae9a
commit 9e3abfdbd7
6 changed files with 70 additions and 57 deletions

View File

@ -104,19 +104,19 @@
</div> </div>
</div> </div>
</el-col> </el-col>
<el-col :xs="12" :sm="12" :lg="6" class="card-panel-col"> <!-- <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
<div class="card-panel" @click="handleOrder({os_status:[4,3],times:[handleGetStartTime(30),handleEndTime()]})"> <div class="card-panel" @click="handleOrder({os_status:[4,3],times:[handleGetStartTime(30),handleEndTime()]})">
<div class="card-panel-icon-wrapper icon-camellia"> <div class="card-panel-icon-wrapper icon-camellia">
<svg-icon icon-class="documentation" class-name="card-panel-icon" /> <svg-icon icon-class="documentation" class-name="card-panel-icon" />
</div> </div>
<div class="card-panel-description"> <div class="card-panel-description">
<div class="card-panel-text"> <div class="card-panel-text">
退款订单数30天 待使用订单数30天
</div> </div>
<count-to :start-val="0" :end-val="refund_30" :duration="10" class="card-panel-num" /> <count-to :start-val="0" :end-val="tobeused_30" :duration="10" class="card-panel-num" />
</div> </div>
</div> </div>
</el-col> </el-col>-->
<el-col :xs="12" :sm="12" :lg="6" class="card-panel-col"> <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
<div class="card-panel" @click="handleOrder({os_status:[4,3],times:[handleGetStartTime(30),handleEndTime()]})"> <div class="card-panel" @click="handleOrder({os_status:[4,3],times:[handleGetStartTime(30),handleEndTime()]})">
<div class="card-panel-icon-wrapper icon-camellia"> <div class="card-panel-icon-wrapper icon-camellia">
@ -124,25 +124,27 @@
</div> </div>
<div class="card-panel-description"> <div class="card-panel-description">
<div class="card-panel-text"> <div class="card-panel-text">
退款订单金额30天 待使用订单数30天 <count-to :start-val="0" :end-val="tobeused_30" :duration="10" class="card-panel-num" style="color: #666" />
</div>
<div class="card-panel-text">
待使用订单金额30天 <count-to :start-val="0" :end-val="tobeused_price_30" :duration="10" class="card-panel-num" style="color: #666" />
</div> </div>
<count-to :start-val="0" :end-val="refund_price_30" :duration="10" class="card-panel-num" />
</div> </div>
</div> </div>
</el-col> </el-col>
<el-col :xs="12" :sm="12" :lg="6" class="card-panel-col"> <!-- <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
<div class="card-panel" @click="handleOrder({os_status:[4,3],times:[handleGetStartTime(60),handleEndTime()]})"> <div class="card-panel" @click="handleOrder({os_status:[4,3],times:[handleGetStartTime(60),handleEndTime()]})">
<div class="card-panel-icon-wrapper icon-camellia-sixty"> <div class="card-panel-icon-wrapper icon-camellia-sixty">
<svg-icon icon-class="documentation" class-name="card-panel-icon" /> <svg-icon icon-class="documentation" class-name="card-panel-icon" />
</div> </div>
<div class="card-panel-description"> <div class="card-panel-description">
<div class="card-panel-text"> <div class="card-panel-text">
退款订单数60天 待使用订单数60天
</div> </div>
<count-to :start-val="0" :end-val="refund_60" :duration="10" class="card-panel-num" /> <count-to :start-val="0" :end-val="tobeused_60" :duration="10" class="card-panel-num" />
</div> </div>
</div> </div>
</el-col> </el-col>-->
<el-col :xs="12" :sm="12" :lg="6" class="card-panel-col"> <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
<div class="card-panel" @click="handleOrder({os_status:[4,3],times:[handleGetStartTime(60),handleEndTime()]})"> <div class="card-panel" @click="handleOrder({os_status:[4,3],times:[handleGetStartTime(60),handleEndTime()]})">
<div class="card-panel-icon-wrapper icon-camellia-sixty"> <div class="card-panel-icon-wrapper icon-camellia-sixty">
@ -150,25 +152,27 @@
</div> </div>
<div class="card-panel-description"> <div class="card-panel-description">
<div class="card-panel-text"> <div class="card-panel-text">
退款订单金额60天 待使用订单数60天 <count-to :start-val="0" :end-val="tobeused_60" :duration="10" class="card-panel-num" style="color: #666" />
</div>
<div class="card-panel-text">
待使用订单金额60天 <count-to :start-val="0" :end-val="tobeused_price_60" :duration="10" class="card-panel-num" style="color: #666" />
</div> </div>
<count-to :start-val="0" :end-val="refund_price_60" :duration="10" class="card-panel-num" />
</div> </div>
</div> </div>
</el-col> </el-col>
<el-col :xs="12" :sm="12" :lg="6" class="card-panel-col"> <!-- <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
<div class="card-panel" @click="handleOrder({os_status:[4,3],times:[handleGetStartTime(80),handleEndTime()]})"> <div class="card-panel" @click="handleOrder({os_status:[4,3],times:[handleGetStartTime(80),handleEndTime()]})">
<div class="card-panel-icon-wrapper icon-camellia-fourscore"> <div class="card-panel-icon-wrapper icon-camellia-fourscore">
<svg-icon icon-class="documentation" class-name="card-panel-icon" /> <svg-icon icon-class="documentation" class-name="card-panel-icon" />
</div> </div>
<div class="card-panel-description"> <div class="card-panel-description">
<div class="card-panel-text"> <div class="card-panel-text">
退款订单数80天 待使用订单数80天
</div> </div>
<count-to :start-val="0" :end-val="refund_80" :duration="10" class="card-panel-num" /> <count-to :start-val="0" :end-val="tobeused_80" :duration="10" class="card-panel-num" />
</div> </div>
</div> </div>
</el-col> </el-col>-->
<el-col :xs="12" :sm="12" :lg="6" class="card-panel-col"> <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
<div class="card-panel" @click="handleOrder({os_status:[4,3],times:[handleGetStartTime(80),handleEndTime()]})"> <div class="card-panel" @click="handleOrder({os_status:[4,3],times:[handleGetStartTime(80),handleEndTime()]})">
<div class="card-panel-icon-wrapper icon-camellia-fourscore"> <div class="card-panel-icon-wrapper icon-camellia-fourscore">
@ -176,9 +180,12 @@
</div> </div>
<div class="card-panel-description"> <div class="card-panel-description">
<div class="card-panel-text"> <div class="card-panel-text">
退款订单金额80天 待使用订单数80天 <count-to :start-val="0" :end-val="tobeused_80" :duration="10" class="card-panel-num" style="color: #666" />
</div> </div>
<count-to :start-val="0" :end-val="refund_price_80" :duration="10" class="card-panel-num" /> <div class="card-panel-text">
待使用订单金额80天<count-to :start-val="0" :end-val="tobeused_price_80" :duration="10" class="card-panel-num" style="color: #666" />
</div>
</div> </div>
</div> </div>
</el-col> </el-col>
@ -202,12 +209,12 @@ export default {
asset_price:0, asset_price:0,
refund:0, refund:0,
refund_price:0, refund_price:0,
refund_30: 0, tobeused_30: 0,
refund_60: 0, tobeused_60: 0,
refund_80: 0, tobeused_80: 0,
refund_price_30: 0, tobeused_price_30: 0,
refund_price_60: 0, tobeused_price_60: 0,
refund_price_80: 0 tobeused_price_80: 0
} }
}, },
mounted() { mounted() {
@ -221,12 +228,12 @@ export default {
this.asset_price = parseFloat(res.data.asset_price)/100 this.asset_price = parseFloat(res.data.asset_price)/100
this.refund = parseFloat(res.data.refund) this.refund = parseFloat(res.data.refund)
this.refund_price = parseFloat(res.data.refund_price)/100 this.refund_price = parseFloat(res.data.refund_price)/100
this.refund_30 = parseFloat(res.data.refund_30) this.tobeused_30 = parseFloat(res.data.tobeused_30)
this.refund_price_30 = parseFloat(res.data.refund_price_30)/100 this.tobeused_price_30 = parseFloat(res.data.tobeused_price_30)/100
this.refund_60 = parseFloat(res.data.refund_60) this.tobeused_60 = parseFloat(res.data.tobeused_60)
this.refund_price_60 = parseFloat(res.data.refund_price_60)/100 this.tobeused_price_60 = parseFloat(res.data.tobeused_price_60)/100
this.refund_80 = parseFloat(res.data.refund_80) this.tobeused_80 = parseFloat(res.data.tobeused_80)
this.refund_price_80 = parseFloat(res.data.refund_price_80)/100 this.tobeused_price_80 = parseFloat(res.data.tobeused_price_80)/100
}).catch(err=>{ }).catch(err=>{
console.log(err) console.log(err)
}) })

View File

@ -146,6 +146,7 @@ body{
border-right: 2px solid #46a6ff; border-right: 2px solid #46a6ff;
height: calc(100vh - 154px); height: calc(100vh - 154px);
.btn{ .btn{
color: #fff;
padding: 10px 20px; padding: 10px 20px;
cursor: pointer; cursor: pointer;
text-align: center; text-align: center;

View File

@ -68,10 +68,8 @@ class DataController extends base
] ]
]; ];
foreach ($list as $k => $v) { foreach ($list as $k => $v) {
$list[$k]['write_rate'] = number_format(($v['assets']/$v['orders']),4); $list[$k]['write_rate'] = number_format(($v['assets']/$v['orders'])*100,2);
$list[$k]['write_rate_price'] = number_format(($v['asset_price']/$v['total_price']),4); $list[$k]['write_rate_price'] = number_format(($v['asset_price']/$v['total_price'])*100,2);
$totalArr[1]['write_rate'] += $list[$k]['write_rate'];
$totalArr[1]['write_rate_price'] += $list[$k]['write_rate_price'];
$totalArr[1]['orders'] += $list[$k]['orders']; $totalArr[1]['orders'] += $list[$k]['orders'];
$totalArr[1]['total_price'] += $list[$k]['total_price']; $totalArr[1]['total_price'] += $list[$k]['total_price'];
$totalArr[1]['assets'] += $list[$k]['assets']; $totalArr[1]['assets'] += $list[$k]['assets'];
@ -79,7 +77,8 @@ class DataController extends base
$totalArr[1]['nopays'] += $list[$k]['nopays']; $totalArr[1]['nopays'] += $list[$k]['nopays'];
$totalArr[1]['nopay_price'] += $list[$k]['nopay_price']; $totalArr[1]['nopay_price'] += $list[$k]['nopay_price'];
} }
$totalArr[1]['write_rate_price'] = (float)number_format($totalArr[1]['write_rate_price'],4); $totalArr[1]['write_rate'] = (float)number_format(($totalArr[1]['assets']/$totalArr[1]['orders'])*100,2);
$totalArr[1]['write_rate_price'] = (float)number_format(($totalArr[1]['asset_price']/$totalArr[1]['total_price'])*100,2);
$list = array_merge($list->toArray(), $totalArr); $list = array_merge($list->toArray(), $totalArr);
return $this->success(array_values($list), null, ['oss' => Orders::OSS]); return $this->success(array_values($list), null, ['oss' => Orders::OSS]);

View File

@ -144,29 +144,29 @@ class IndexController extends base
ELSE 0 ELSE 0
END) AS refund_price, END) AS refund_price,
SUM(CASE SUM(CASE
WHEN ((os = 1 AND status = 5) OR (os = 3 AND status = 4) OR (os = 2 AND status = 1)) AND create_at >= ' . $startOfThirtyDaysAgoTimestamp . ' AND create_at <= ' . $endOfDayTimestamp . ' THEN 1 WHEN ((os=1 AND order_status=3) OR (os=2 AND order_status=4) OR (os=3 AND order_status=1)) AND create_at >= ' . $startOfThirtyDaysAgoTimestamp . ' AND create_at <= ' . $endOfDayTimestamp . ' THEN 1
ELSE 0 ELSE 0
END) AS refund_30, END) AS tobeused_30,
SUM(CASE SUM(CASE
WHEN ((os = 1 AND status = 5) OR (os = 3 AND status = 4) OR (os = 2 AND status = 1)) AND create_at >= ' . $startOfThirtyDaysAgoTimestamp . ' AND create_at <= ' . $endOfDayTimestamp . ' THEN actual_price WHEN ((os=1 AND order_status=3) OR (os=2 AND order_status=4) OR (os=3 AND order_status=1)) AND create_at >= ' . $startOfThirtyDaysAgoTimestamp . ' AND create_at <= ' . $endOfDayTimestamp . ' THEN actual_price
ELSE 0 ELSE 0
END) AS refund_price_30, END) AS tobeused_price_30,
SUM(CASE SUM(CASE
WHEN ((os = 1 AND status = 5) OR (os = 3 AND status = 4) OR (os = 2 AND status = 1)) AND create_at >= ' . $startOfSixtyDaysAgoTimestamp . ' AND create_at <= ' . $endOfDayTimestamp . ' THEN 1 WHEN ((os=1 AND order_status=3) OR (os=2 AND order_status=4) OR (os=3 AND order_status=1)) AND create_at >= ' . $startOfSixtyDaysAgoTimestamp . ' AND create_at <= ' . $endOfDayTimestamp . ' THEN 1
ELSE 0 ELSE 0
END) AS refund_60, END) AS tobeused_60,
SUM(CASE SUM(CASE
WHEN ((os = 1 AND status = 5) OR (os = 3 AND status = 4) OR (os = 2 AND status = 1)) AND create_at >= ' . $startOfSixtyDaysAgoTimestamp . ' AND create_at <= ' . $endOfDayTimestamp . ' THEN actual_price WHEN ((os=1 AND order_status=3) OR (os=2 AND order_status=4) OR (os=3 AND order_status=1)) AND create_at >= ' . $startOfSixtyDaysAgoTimestamp . ' AND create_at <= ' . $endOfDayTimestamp . ' THEN actual_price
ELSE 0 ELSE 0
END) AS refund_price_60, END) AS tobeused_price_60,
SUM(CASE SUM(CASE
WHEN ((os = 1 AND status = 5) OR (os = 3 AND status = 4) OR (os = 2 AND status = 1)) AND create_at >= ' . $startOfEightyDaysAgoTimestamp . ' AND create_at <= ' . $endOfDayTimestamp . ' THEN 1 WHEN ((os=1 AND order_status=3) OR (os=2 AND order_status=4) OR (os=3 AND order_status=1)) AND create_at >= ' . $startOfEightyDaysAgoTimestamp . ' AND create_at <= ' . $endOfDayTimestamp . ' THEN 1
ELSE 0 ELSE 0
END) AS refund_80, END) AS tobeused_80,
SUM(CASE SUM(CASE
WHEN ((os = 1 AND status = 5) OR (os = 3 AND status = 4) OR (os = 2 AND status = 1)) AND create_at >= ' . $startOfEightyDaysAgoTimestamp . ' AND create_at <= ' . $endOfDayTimestamp . ' THEN actual_price WHEN ((os=1 AND order_status=3) OR (os=2 AND order_status=4) OR (os=3 AND order_status=1)) AND create_at >= ' . $startOfEightyDaysAgoTimestamp . ' AND create_at <= ' . $endOfDayTimestamp . ' THEN actual_price
ELSE 0 ELSE 0
END) AS refund_price_80 END) AS tobeused_price_80
'); ');
if ($request->admin->id != 1) { if ($request->admin->id != 1) {
@ -186,12 +186,12 @@ class IndexController extends base
'asset_price' => $order->asset_price ?? 0, 'asset_price' => $order->asset_price ?? 0,
'refund' => $order->refund ?? 0, 'refund' => $order->refund ?? 0,
'refund_price' => $order->refund_price ?? 0, 'refund_price' => $order->refund_price ?? 0,
'refund_30' => $order->refund_30 ?? 0, 'tobeused_30' => $order->refund_30 ?? 0,
'refund_price_30' => $order->refund_price_30 ?? 0.00, 'tobeused_price_30' => $order->refund_price_30 ?? 0.00,
'refund_60' => $order->refund_60 ?? 0, 'tobeused_60' => $order->refund_60 ?? 0,
'refund_price_60' => $order->refund_price_60 ?? 0.00, 'tobeused_price_60' => $order->refund_price_60 ?? 0.00,
'refund_80' => $order->refund_80 ?? 0, 'tobeused_80' => $order->refund_80 ?? 0,
'refund_price_80' => $order->refund_price_80 ?? 0.00 'tobeused_price_80' => $order->refund_price_80 ?? 0.00
]); ]);
} }

View File

@ -16,7 +16,9 @@ class QaController extends base
$city_id = $request->get('city_id'); $city_id = $request->get('city_id');
$keyword = $request->get('keyword'); $keyword = $request->get('keyword');
$list = Qas::with('qaQuestions')->order('id decs'); $list = Qas::with(['qaQuestions'=>function ($query) {
$query->order('sort desc');
}])->order('id decs');
if (!empty($city_id)){ if (!empty($city_id)){
$list = $list->where(['status' => 1, 'city_id' => $city_id]); $list = $list->where(['status' => 1, 'city_id' => $city_id]);
@ -40,7 +42,9 @@ class QaController extends base
$title = $request->get('title'); $title = $request->get('title');
$status = $request->get('status'); $status = $request->get('status');
$list = Qas::with(['qaCitys','qaQuestions'])->order('create_time desc'); $list = Qas::with(['qaCitys','qaQuestions'=>function ($query) {
$query->order('sort asc');
}])->order('create_time desc');
if (!empty($title)){ if (!empty($title)){
$list = $list->where('title','like','%'.$title.'%'); $list = $list->where('title','like','%'.$title.'%');
@ -58,7 +62,9 @@ class QaController extends base
$id = $request->get('id'); $id = $request->get('id');
if (empty($id)) return $this->error(2001, 'id data cannot be empty!'); if (empty($id)) return $this->error(2001, 'id data cannot be empty!');
$data = Qas::with(['qaCitys','qaQuestions'])->where('status',1)->find(); $data = Qas::with(['qaCitys','qaQuestions'=>function ($query) {
$query->order('sort asc');
}])->where('status',1)->find();
return $this->success($data); return $this->success($data);
} }

View File

@ -12,7 +12,7 @@ class Qas extends base
public function qaQuestions() public function qaQuestions()
{ {
return $this->hasMany(QaQuestions::class,'qa_id','id')->order('sort desc'); return $this->hasMany(QaQuestions::class,'qa_id','id');
} }
} }