diff --git a/application/admin/controller/statistics/Aftersale.php b/application/admin/controller/statistics/Aftersale.php
new file mode 100644
index 0000000..e643a25
--- /dev/null
+++ b/application/admin/controller/statistics/Aftersale.php
@@ -0,0 +1,87 @@
+fetch('index');
+ }
+
+ public function list()
+ {
+ $build = new Order();
+
+ }
+
+ public function dispatch()
+ {
+ $build = new Admin();
+ $build->alias('a')
+ ->join('order b','a.id = b.admin_id','right')
+ ->join('aftersale c','b.id = c.admin_id','left')
+ ->where('b.status',Order::STATUS_FINISHED);
+
+ $build->group('a.id');
+ $build->field(
+ [
+ 'a.id',
+ 'a.nickname',
+ 'count(b.id) order_total',
+ 'count(c.id) after_total',
+ ]
+ );
+
+ $res = $build->paginate();
+ $total = $res->total();
+ $ress = $res->items();
+// dd(Admin::getLastSql());
+ return [
+ 'rows' => $ress,
+ 'total' => $total
+ ];
+ }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+}
diff --git a/application/admin/view/statistics/aftersale/index.html b/application/admin/view/statistics/aftersale/index.html
new file mode 100644
index 0000000..6ea7e51
--- /dev/null
+++ b/application/admin/view/statistics/aftersale/index.html
@@ -0,0 +1,212 @@
+
+
+
diff --git a/public/assets/js/addons.js b/public/assets/js/addons.js
index aeba863..0f3bdcb 100755
--- a/public/assets/js/addons.js
+++ b/public/assets/js/addons.js
@@ -1,8 +1,6 @@
define([], function () {
require([], function () {
//绑定data-toggle=addresspicker属性点击事件
- console.log('111');
-
$(document).on('click', "[data-toggle='addresspicker']", function () {
var that = this;
var callback = $(that).data('callback');
@@ -22,7 +20,6 @@ define([], function () {
if (city_code){
url += city_code ? "&city_code=" + city_code : "";
}
- console.log(url);
Fast.api.open(url, '位置选择', {
callback: function (res) {
input_id && $("#" + input_id).val(res.address).trigger("change");
diff --git a/public/assets/js/backend/orderplan.js b/public/assets/js/backend/orderplan.js
index a153b6f..c835190 100644
--- a/public/assets/js/backend/orderplan.js
+++ b/public/assets/js/backend/orderplan.js
@@ -24,7 +24,6 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'echarts','echarts-th
var params = {
'daterange': daterange
};
- console.log(params);
Fast.api.ajax({
url: 'orderplan/data',
diff --git a/public/assets/js/backend/statistics/aftersale.js b/public/assets/js/backend/statistics/aftersale.js
new file mode 100644
index 0000000..1d9ccca
--- /dev/null
+++ b/public/assets/js/backend/statistics/aftersale.js
@@ -0,0 +1,149 @@
+define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'echarts', 'echarts-theme', 'template', 'addtabs', 'moment','citypicker'], function ($, undefined, Backend, Table, Form, echarts, undefined, Template, Datatable, Moment) {
+
+ var Controller = {
+
+ index: function () {
+
+ $('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
+ var $targetPanel = $($(this).attr("href"));
+ var tabVal = $(this).data('val');
+ if (tabVal === 'first') {
+ Controller.api.first();
+ }else if (tabVal === 'second') {
+ Controller.api.second();
+ }
+ });
+ Controller.api.first();
+ Controller.api.datepicker();
+ },
+
+ api: {
+ bindevent: function () {
+ Form.api.bindevent($("form[role=form]"));
+ },
+ first: function (){
+ Table.api.init();
+ // 表格2
+ var table = $("#table1");
+ table.bootstrapTable({
+ url: 'statistics/aftersale/dispatch',
+ sortName: 'id',
+ search: false,
+ commonSearch: false,
+ visible: false,
+ showToggle: false,
+ showColumns: false,
+ showExport: true,
+ searchFormVisible: true,
+ columns: [
+ [
+ {field: 'nickname', title: '项目类型', operate: false},
+ {field: 'order_total', title: '订单总数', operate: false},
+ {field: 'after_total', title: '退款订单数', operate: false},
+ {field: 'after_total', title: '退款率', operate: false},
+
+ ]
+ ]
+ });
+ // 为表格2绑定事件
+ Table.api.bindevent(table);
+
+ $('#first-search').on('click', function () {
+
+ const range = $('#daterange-table').val();
+ let data = '';
+ if (range !== ''){
+ data += 'range=' + range;
+ }
+ // data = encodeURIComponent(data);
+ $("#table1").bootstrapTable('refresh',{
+ url:'statistics/aftersale/dispatch?' + data,
+ });
+ });
+
+ },
+ second: function (){
+ Table.api.init();
+ // 表格2
+ var table = $("#table2");
+ table.bootstrapTable({
+ url: 'statistics/aftersale/dispatch',
+ sortName: 'id',
+ search: false,
+ commonSearch: false,
+ visible: false,
+ showToggle: false,
+ showColumns: false,
+ showExport: true,
+ searchFormVisible: true,
+ columns: [
+ [
+ {field: 'nickname', title: '项目类型', operate: false},
+ {field: 'order_total', title: '订单总数', operate: false},
+ {field: 'after_total', title: '退款订单数', operate: false},
+ {field: 'after_total', title: '退款率', operate: false},
+
+ ]
+ ]
+ });
+ // 为表格2绑定事件
+ Table.api.bindevent(table);
+
+ $('#first-search').on('click', function () {
+
+ const range = $('#daterange-table').val();
+ let data = '';
+ if (range !== ''){
+ data += 'range=' + range;
+ }
+ // data = encodeURIComponent(data);
+ $("#table1").bootstrapTable('refresh',{
+ url:'statistics/aftersale/dispatch?' + data,
+ });
+ });
+
+ },
+ datepicker: function () {
+ var ranges = {};
+ ranges[__('Today')] = [Moment().startOf('day'), Moment().endOf('day')];
+ ranges[__('Yesterday')] = [Moment().subtract(1, 'days').startOf('day'), Moment().subtract(1, 'days').endOf('day')];
+ ranges[__('Last 7 Days')] = [Moment().subtract(6, 'days').startOf('day'), Moment().endOf('day')];
+ ranges[__('Last 30 Days')] = [Moment().subtract(29, 'days').startOf('day'), Moment().endOf('day')];
+ ranges[__('This Month')] = [Moment().startOf('month'), Moment().endOf('month')];
+ ranges[__('Last Month')] = [Moment().subtract(1, 'month').startOf('month'), Moment().subtract(1, 'month').endOf('month')];
+ ranges[__('今年')] = [Moment().startOf('year'), Moment().endOf('year')];
+ var options = {
+ timePicker: false,
+ autoUpdateInput: false,
+ timePickerSeconds: true,
+ timePicker24Hour: true,
+ autoApply: true,
+ locale: {
+ format: 'YYYY-MM-DD',
+ customRangeLabel: __("Custom Range"),
+ applyLabel: __("Apply"),
+ cancelLabel: __("Clear"),
+ },
+ ranges: ranges,
+ };
+ var callback = function (start, end) {
+ $(this.element).val(start.format(options.locale.format) + " - " + end.format(options.locale.format));
+ };
+ require(['bootstrap-daterangepicker'], function () {
+ $(".datetimerange").each(function () {
+ $(this).on('apply.daterangepicker', function (ev, picker) {
+ callback.call(picker, picker.startDate, picker.endDate);
+ var label = picker.chosenLabel;
+ $(picker.element).data('label', label).trigger("change");
+ });
+ $(this).on('cancel.daterangepicker', function (ev, picker) {
+ $(this).val('');
+ });
+ $(this).daterangepicker($.extend({}, options), callback);
+ });
+ });
+ },
+ }
+ };
+ return Controller;
+});
diff --git a/public/assets/js/backend/statistics/item.js b/public/assets/js/backend/statistics/item.js
index dbba0ef..f31db4a 100644
--- a/public/assets/js/backend/statistics/item.js
+++ b/public/assets/js/backend/statistics/item.js
@@ -80,7 +80,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'echarts', 'echarts-t
if (area_id !== ''){
data += 'area_id=' + area_id+'&';
}
- if (area_id !== ''){
+ if (range !== ''){
data += 'range=' + range;
}
// data = encodeURIComponent(data);