You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
102 lines
3.3 KiB
102 lines
3.3 KiB
<?php
|
|
|
|
|
|
namespace App\Admin\Extensions;
|
|
|
|
use App\Admin\Common\LinkUrl;
|
|
use Dcat\Admin\Admin;
|
|
use Dcat\Admin\Support\LazyRenderable;
|
|
use Illuminate\Support\Facades\DB;
|
|
use App\Models\ImsCjdcOrder as orderModel;
|
|
use App\Models\ImsCjdcOrderMain as orderMainModel;
|
|
use App\Models\v3\Market as MarketModel;
|
|
use App\Models\StoreAccount as StoreAccountModel;
|
|
use App\Models\v3\Store as StoreModel;
|
|
|
|
class OrderReportPage extends LazyRenderable
|
|
{
|
|
|
|
protected static $js = [LinkUrl::VUE_JS, LinkUrl::ELEMENT_UI_JS];
|
|
protected static $css = [LinkUrl::DETAIL_CSS, LinkUrl::ELEMENT_UI_CSS];
|
|
|
|
public function render()
|
|
{
|
|
$orderTable = 'lanzu_order_main';
|
|
$accountTable = 'ims_cjdc_store_account';
|
|
$financialTable = 'lanzu_financial_record';
|
|
|
|
$marketId = request()->input('market_id');
|
|
$startTime = request()->input('start_time');
|
|
$endTime = request()->input('end_time');
|
|
|
|
$storeIds = StoreModel::where('market_id',$marketId)->pluck('id');
|
|
dd($storeIds);
|
|
$orderMain = orderMainModel::select(DB::raw('COUNT(id) AS total_num, SUM(money) AS total_money'))->whereIn('state',[4,5,10]);
|
|
|
|
$newUser = StoreAccountModel::select(DB::raw('SUM(money) AS total_money'))->where('note','新用户下单成功,平台奖励');
|
|
// DB::select('SELECT FROM_UNIXTIME(UNIX_TIMESTAMP(time),'%Y年%m月') AS '月份',SUM(money) AS '店铺新增用户补贴金额' FROM ims_cjdc_store_account ');
|
|
if($marketId){
|
|
$orderMain->where('market_id',$marketId);
|
|
|
|
// 查询这个市场下的店铺id
|
|
$storeIds = StoreModel::where('market_id',$marketId)->pluck('id');
|
|
$newUser->where();
|
|
}
|
|
if($startTime){
|
|
$orderMain->where([['created_at','>=',strtotime($startTime)]]);
|
|
}
|
|
if($endTime){
|
|
$orderMain->where([['created_at','<=',strtotime($endTime)]]);
|
|
}
|
|
// 订单总额
|
|
$orderReport = $orderMain->get();
|
|
// 总补贴金额
|
|
|
|
|
|
|
|
|
|
//订单数据
|
|
$order = ['total_money'=>123];
|
|
if ($orderReport) {
|
|
// $marketList = MarketModel::getMarket();
|
|
$result = [];
|
|
$orderReport = json_encode($orderReport);
|
|
$showRefund = json_encode($result);
|
|
|
|
Admin::script(
|
|
<<<JS
|
|
var order_report = JSON.stringify($orderReport)
|
|
var show_refund = JSON.stringify($showRefund)
|
|
var app = new Vue({
|
|
el:"#order_report",
|
|
data:{
|
|
order_report:$orderReport,
|
|
show_refund: JSON.parse(show_refund),
|
|
|
|
order_total_money:123,
|
|
dialogFormVisible: false,
|
|
// order_total_money:123,
|
|
|
|
refund_2:"退款",
|
|
refund_3:"已同意退款",
|
|
refund_goods_name:"",
|
|
|
|
order_goods_id:null,
|
|
order_child_id:null,
|
|
show_refund_2:true,
|
|
show_refund_3:false,
|
|
|
|
},
|
|
methods: {
|
|
|
|
}
|
|
});
|
|
JS
|
|
);
|
|
|
|
}
|
|
return view('order_report');
|
|
}
|
|
|
|
|
|
}
|