8 changed files with 15028 additions and 7 deletions
			
			
		- 
					37app/AdminAgent/Controllers/ProductStatisticsController.php
 - 
					111app/AdminAgent/Tools/DataReportDate.php
 - 
					26app/Common/LinkUrl.php
 - 
					3public/css/data_report.css
 - 
					70public/css/detail.css
 - 
					1public/js/element.js
 - 
					14765public/js/moment-with-locales.js
 - 
					22resources/views/admin/tools/data_report_date.blade.php
 
@ -0,0 +1,111 @@ | 
				
			|||
<?php | 
				
			|||
 | 
				
			|||
 | 
				
			|||
namespace App\AdminAgent\Tools; | 
				
			|||
 | 
				
			|||
 | 
				
			|||
use App\Common\LinkUrl; | 
				
			|||
use Dcat\Admin\Admin; | 
				
			|||
use Dcat\Admin\Grid\Tools\AbstractTool; | 
				
			|||
 | 
				
			|||
class DataReportDate extends AbstractTool | 
				
			|||
{ | 
				
			|||
 | 
				
			|||
    protected $route; | 
				
			|||
 | 
				
			|||
    public function __construct($route) | 
				
			|||
    { | 
				
			|||
        $this->route = $route; | 
				
			|||
        parent::__construct(); | 
				
			|||
    } | 
				
			|||
 | 
				
			|||
    protected function script() | 
				
			|||
    { | 
				
			|||
        $url = $path =  request()->url(); | 
				
			|||
        $fullUrl = request()->fullUrl(); | 
				
			|||
        $date = request()->input('created_at'); | 
				
			|||
        $start = $date?$date['start']:''; | 
				
			|||
        $end = $date?$date['end']:''; | 
				
			|||
        return <<<JS | 
				
			|||
        var app= new Vue({ | 
				
			|||
            el:"#date_time", | 
				
			|||
            data:{ | 
				
			|||
                start: "$start", | 
				
			|||
                end: "$end", | 
				
			|||
                url:"$url", | 
				
			|||
                full_url:"$fullUrl", | 
				
			|||
                path:"$path", | 
				
			|||
                pickerOptions: { | 
				
			|||
                  disabledDate(time) { | 
				
			|||
                    return time.getTime() > Date.now(); | 
				
			|||
                  }, | 
				
			|||
                  shortcuts: [{ | 
				
			|||
                    text: '今天', | 
				
			|||
                    onClick(picker) { | 
				
			|||
                      picker.\$emit('pick', new Date()); | 
				
			|||
                    } | 
				
			|||
                  }, { | 
				
			|||
                    text: '昨天', | 
				
			|||
                    onClick(picker) { | 
				
			|||
                      const date = new Date(); | 
				
			|||
                      date.setTime(date.getTime() - 3600 * 1000 * 24); | 
				
			|||
                      picker.\$emit('pick', date); | 
				
			|||
                    } | 
				
			|||
                  }, { | 
				
			|||
                    text: '一周前', | 
				
			|||
                    onClick(picker) { | 
				
			|||
                      const date = new Date(); | 
				
			|||
                      date.setTime(date.getTime() - 3600 * 1000 * 24 * 7); | 
				
			|||
                      picker.\$emit('pick', date); | 
				
			|||
                    } | 
				
			|||
                  }] | 
				
			|||
                }, | 
				
			|||
            }, | 
				
			|||
            methods:{ | 
				
			|||
                doSearch(){ | 
				
			|||
 | 
				
			|||
                    var url = this.url; | 
				
			|||
                    if (this.start){ | 
				
			|||
                        url = url+"?type=date&option=0&created_at[start]="+this.start; | 
				
			|||
                    } | 
				
			|||
                    if (this.end){ | 
				
			|||
                        if (!this.start){ | 
				
			|||
                            this.\$message({message:'请选择起始时间',type:"error"}) | 
				
			|||
                            return false; | 
				
			|||
                        } | 
				
			|||
                        url = url+"&created_at[end]="+this.end; | 
				
			|||
                    }else { | 
				
			|||
                        if (this.start){ | 
				
			|||
                             this.\$message({message:'请选择截止时间',type:"error"}) | 
				
			|||
                             return false; | 
				
			|||
                        } | 
				
			|||
                    } | 
				
			|||
 | 
				
			|||
                    if (this.start&&this.end&&(this.start>this.end)){ | 
				
			|||
                          this.\$message({message:'截止时间不能小于起始时间',type:"error"}) | 
				
			|||
                          return false; | 
				
			|||
                    } | 
				
			|||
 | 
				
			|||
                    window.location.href=url; | 
				
			|||
                }, | 
				
			|||
                reset(){ | 
				
			|||
                    window.location.href=this.path; | 
				
			|||
                } | 
				
			|||
            } | 
				
			|||
 | 
				
			|||
        }); | 
				
			|||
 | 
				
			|||
JS; | 
				
			|||
 | 
				
			|||
    } | 
				
			|||
 | 
				
			|||
    public function render() | 
				
			|||
    { | 
				
			|||
        Admin::js(LinkUrl::VUE_JS); | 
				
			|||
        Admin::js(LinkUrl::ELEMENT_UI_JS); | 
				
			|||
        Admin::css(LinkUrl::ELEMENT_UI_CSS); | 
				
			|||
        Admin::css('css/data_report.css'); | 
				
			|||
        Admin::script($this->script()); | 
				
			|||
        return view('admin.tools.data_report_date'); | 
				
			|||
    } | 
				
			|||
} | 
				
			|||
@ -0,0 +1,26 @@ | 
				
			|||
<?php | 
				
			|||
 | 
				
			|||
 | 
				
			|||
namespace App\Common; | 
				
			|||
 | 
				
			|||
 | 
				
			|||
class LinkUrl | 
				
			|||
{ | 
				
			|||
    /** | 
				
			|||
     * js | 
				
			|||
     */ | 
				
			|||
    const VUE_JS = 'https://cdn.jsdelivr.net/npm/vue'; | 
				
			|||
    //const ELEMENT_UI_JS =  'https://unpkg.com/element-ui/lib/index.js';
 | 
				
			|||
    const ELEMENT_UI_JS =  'js/element.js'; | 
				
			|||
 | 
				
			|||
 | 
				
			|||
    const API_GL_JS =  'https://map.qq.com/api/gljs?v=1.exp&key=7NSBZ-ETU3O-CW6WN-S3YM5-KERR5-RQBHS'; | 
				
			|||
 | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * css | 
				
			|||
     */ | 
				
			|||
    const ELEMENT_UI_CSS="https://unpkg.com/element-ui/lib/theme-chalk/index.css"; | 
				
			|||
    //const ELEMENT_UI_CSS="css/element.css";
 | 
				
			|||
    const DETAIL_CSS =  'css/detail.css'; | 
				
			|||
} | 
				
			|||
@ -0,0 +1,3 @@ | 
				
			|||
.el-input__inner { | 
				
			|||
    height: 37px; | 
				
			|||
} | 
				
			|||
@ -0,0 +1,70 @@ | 
				
			|||
#detail .table-bordered td { | 
				
			|||
    width: 50%; | 
				
			|||
    white-space: initial !important; | 
				
			|||
    font-size: 1.4rem; | 
				
			|||
} | 
				
			|||
 | 
				
			|||
.shop-box { | 
				
			|||
    margin-top: 1rem; | 
				
			|||
    font-size: 1.4rem; | 
				
			|||
} | 
				
			|||
 | 
				
			|||
.logo-img { | 
				
			|||
    width: 80px; | 
				
			|||
    height: 80px; | 
				
			|||
    margin-right: 1rem; | 
				
			|||
} | 
				
			|||
 | 
				
			|||
.media { | 
				
			|||
    padding: 1rem 2rem; | 
				
			|||
    background-color: #f8f8f8; | 
				
			|||
} | 
				
			|||
 | 
				
			|||
.shop-logo { | 
				
			|||
    width: 2rem; | 
				
			|||
    height: 2rem; | 
				
			|||
    margin-right: 0.6rem; | 
				
			|||
} | 
				
			|||
 | 
				
			|||
.alert { | 
				
			|||
    margin-bottom: 0; | 
				
			|||
    border-radius: 0; | 
				
			|||
} | 
				
			|||
 | 
				
			|||
.mt-0 { | 
				
			|||
    max-width: 50rem; | 
				
			|||
    font-size: 1.4rem; | 
				
			|||
} | 
				
			|||
 | 
				
			|||
.price { | 
				
			|||
    max-width: 48rem; | 
				
			|||
    display: inline-block; | 
				
			|||
    overflow: hidden; | 
				
			|||
    font-size: 1rem; | 
				
			|||
    color: #27272788; | 
				
			|||
} | 
				
			|||
.money{ | 
				
			|||
    float: right; | 
				
			|||
    font-size: 1.4rem; | 
				
			|||
} | 
				
			|||
.return{ | 
				
			|||
    float: left; | 
				
			|||
    font-size: 1.4rem; | 
				
			|||
} | 
				
			|||
 | 
				
			|||
 | 
				
			|||
#container { | 
				
			|||
    width: 100%; | 
				
			|||
    height: 100%; | 
				
			|||
} | 
				
			|||
input { | 
				
			|||
    position: absolute; | 
				
			|||
    top: 30px; | 
				
			|||
    z-index: 9999; | 
				
			|||
} | 
				
			|||
#btn-2d { | 
				
			|||
    left: 20px; | 
				
			|||
} | 
				
			|||
#btn-3d { | 
				
			|||
    left: 80px; | 
				
			|||
} | 
				
			|||
						
							
						
						
							1
	
						
						public/js/element.js
						
							File diff suppressed because it is too large
							
							
								
									View File
								
							
						
					
				File diff suppressed because it is too large
							
							
								
									View File
								
							
						
						
							
						
						
							14765
	
						
						public/js/moment-with-locales.js
						
							File diff suppressed because it is too large
							
							
								
									View File
								
							
						
					
				File diff suppressed because it is too large
							
							
								
									View File
								
							
						@ -0,0 +1,22 @@ | 
				
			|||
<div id="date_time" style="padding-bottom: 20px;"> | 
				
			|||
    <div class="block"> | 
				
			|||
        <el-date-picker | 
				
			|||
            class="v1" | 
				
			|||
            v-model="start" | 
				
			|||
            type="date" | 
				
			|||
            value-format="yyyy-MM-dd" | 
				
			|||
            placeholder="选择日期"> | 
				
			|||
        </el-date-picker> | 
				
			|||
        - | 
				
			|||
        <el-date-picker | 
				
			|||
            v-model="end" | 
				
			|||
            type="date" | 
				
			|||
            value-format="yyyy-MM-dd" | 
				
			|||
            placeholder="选择日期"> | 
				
			|||
        </el-date-picker> | 
				
			|||
        <button type="button" class="btn btn-primary" @click="doSearch()">查询</button> | 
				
			|||
          | 
				
			|||
        <button type="button" class="btn btn-primary" @click="reset()">重置</button> | 
				
			|||
    </div> | 
				
			|||
</div> | 
				
			|||
 | 
				
			|||
						Write
						Preview
					
					
					Loading…
					
					Cancel
						Save
					
		Reference in new issue