bhq@iemsoft.cn
2018-11-27 e2b48dac099e43f4b3243cdf19a7522e4b5eccbe
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
<!-- $Id: repair_stats.htm 2015-10-25 16:58:21Z langlibin $ -->
{if $full_page}
{include file="pageheader_bd.htm"}
{insert_scripts files="../js/utils.js,listtable.js"}
<script type="text/javascript" src="../js/calendar.php?lang={$cfg_lang}"></script>
 
<div id="tabbar-div">
    <p>
        <span class="tab-back" id="general-tab" onclick="javascript:location.href='refund_stats.php'">{$lang.refund_stats}</span>
        <span class="tab-back" id="area-tab" onclick="javascript:location.href='returned_stats.php'">{$lang.returned_stats}</span>
        <span class="tab-front" id="from-tab"  onclick="javascript:location.href='repair_stats.php'">{$lang.repair_status}</span>
    </p>
</div>
<div class="main-div">
    <p style="margin: 10px">{$lang.notice_repair_stats}</p>
</div>
 
<div class="form-div">
    <form action="repair_stats.php" name="searchForm">
        <select name="stats_type" id="stats_type" onchange="week()">
            <option value="1" {if $stats_type eq '1'}selected{/if}>按周统计</option>
            <option value="2" {if $stats_type neq '1'}selected{/if}>按月统计</option>
        </select>
        <select name="year" id="year" onchange="week()"></select>
        <select name="month" id="month" onchange="week()"></select>
        <select name="dropweek" id="dropweek" {if $stats_type neq '1'}style="display: none"{/if}></select>
        <input name="btn_search" type="submit" value="{$lang.button_search}" class="button" />
        <input type="button" name="export" value="{$lang.batch_export}" class="button" onclick="batch_export()" />
    </form>
</div>
<div class="list-div">
    <div class="order_count">
        <p><span class="tab_front">返修商品统计</span></p>
        <div style='height:400px;width:90%;margin-left:auto;margin-right:auto;' id='repair_option_div'></div>
    </div>
</div>
 
<form method="post" action="" name="listForm" onsubmit="">
    <div class="list-div1" id="listDiv">
        {/if}
        <table cellpadding="3" cellspacing="1">
            <tr>
                <th>{$lang.order_sn}</th>
                <th>{$lang.repair_sn}</th>
                <th>{$lang.goods_name}</th>
                <th>{$lang.user_name}</th>
                <th>{$lang.apply_time}</th>
                <th>{$lang.repair_status}</th>
            </tr>
 
            {foreach from=$repair_info item=item}
            <tr>
                <td>{$item.order_sn}</td>
                <td>{$item.back_id}</td>
                <td>{$item.goods_name}</td>
                <td>{$item.user_name}</td>
                <td>{$item.add_time}</td>
                <td>{$item.status_back_val}</td>
            </tr>
            {foreachelse}
            <tr><td class="no-records" colspan="10">{$lang.no_records}</td></tr>
            {/foreach}
        </table>
 
        <table cellpadding="4" cellspacing="0">
            <tr>
                <td align="right">{include file="page.htm"}</td>
            </tr>
        </table>
 
        {if $full_page}
    </div>
</form>
 
<script type="text/javascript" language="JavaScript">
    var date = new Date();
    var y = date.getFullYear();
    var m = date.getMonth() + 1;
 
    for (i = 0; i < 10; i++) {
        var oP = document.createElement("option");
        var oText = document.createTextNode(y);
        oP.appendChild(oText);
        oP.setAttribute("value", y);
        if(y == '{$year}')
        {
            oP.setAttribute("selected", "selected")
        }
        document.getElementById('year').appendChild(oP);
        y = y - 1;
    };
    var j = 1;
    for (i = 1; i < 13; i++) {
        var month = document.createElement("option");
        var monthText = document.createTextNode(j);
        month.appendChild(monthText);
        month.setAttribute("value", j);
        if (j == {$month})
        {
            month.setAttribute("selected", "selected");
        }
        document.getElementById('month').appendChild(month);
        j = j + 1;
    };
</script>
<script type="text/javascript" language="JavaScript">
    listTable.recordCount = {$record_count};
    listTable.pageCount = {$page_count};
 
    {foreach from=$filter item=item key=key}
    listTable.filter.{$key} = '{$item}';
    {/foreach}
    {literal}
 
    // 批量导出数据
    function batch_export()
    {
        var stats_type = Utils.trim(document.forms['searchForm'].elements['stats_type'].value);
        var year = Utils.trim(document.forms['searchForm'].elements['year'].value);
        var month = Utils.trim(document.forms['searchForm'].elements['month'].value);
        var dropweek = Utils.trim(document.forms['searchForm'].elements['dropweek'].value);
 
        return location.href='repair_stats.php?act=export&stats_type='+stats_type+'&year='+year+'&month='+month+'&dropweek='+dropweek;
    }
 
    var week_num = {$week_num};
    //绑定周
    function week()
    {
        if($("#stats_type").val()==2)
        {
            $("#dropweek").hide();
            return;
        }
        $("#dropweek").show();
        var text = $("#year").val() + '-' + $("#month").val();
        var ymd = text.substring(0, 4) + "-" + text.substring(5, 7) + "-1";
        var week = new Date(Date.parse(ymd.replace(/\-/g, "/")));
        var w = week.toString().substring(0, 3);
        var yymm = new Date(text.substring(0, 4), text.substring(5, 7), 0);
        var day = yymm.getDate();
        var dd = 1;
        switch (w) {
            case "Mon": dd = 0; break;
            case "Tue": dd = 1; break;
            case "Wed": dd = 2; break;
            case "Thu": dd = 3; break;
            case "Fri": dd = 4; break;
            case "Sat": dd = 5; break;
            case "Sun": dd = 6; break;
        }
        var aw = 5;
        if (day == 28 && dd == 0) {
            aw = 4;
        }
        var i = 1;
        $("#dropweek").empty();
        for (var i = 0; i < aw; i++) {
            var start = i * 7 + 1 - dd;
            var end = i * 7 + 7 - dd;
            if (start < 1) {
                start = 1;
            }
            if (end > day) {
                end = day;
            }
            var str = ("第" + (i + 1) + "周 <" + text.substring(5, 7) + "月" + start + "号—" + text.substring(5, 7) + "月" + end + "号>").toString();
            var val = $("#year").val() + '-' + text.substring(5, 7) + '-' + start + ' ' + $("#year").val() + '-' + text.substring(5, 7) + '-' + end + ' ' + i;
            $("#dropweek").append("<option value='" + val + "'>" + str + "</option>");
        }
        $('#dropweek')[0].selectedIndex = week_num;
 
        var itme = $("#dropweek").find("option:selected").text();
        $("#txtweek:text").val(itme.toString());
    }
    // 执行
    week();
    {/literal}
</script>
 
<script src='js/echarts-all.js'></script>
<script>
    var option = {
        title : {
//            text: '',
//            subtext: ''
        },
        tooltip : {
            trigger: 'axis'
        },
        legend: {
            data:[]
        },
        toolbox: {
            show : true,
            feature : {
                mark : {show: false}, // 辅助线开关
                dataView : {show: false, readOnly: false}, // 数据视图
                magicType : {show: true, type: ['line']}, // 显示折线图
                restore : {show: true}, // 还原
                saveAsImage : {show: true} // 保存为图片
            }
        },
        calculable : false,
        xAxis : [
            {
                type : 'category',
                boundaryGap : false,
                data : [{$date}]
            }
        ],
        yAxis : [
            {
                type : 'value',
                axisLabel : {
                    formatter: '{value} 件'
                }
            }
        ],
        series : [
            {
                name:'返修数量',
                type:'line',
                data:[{$repair_count}],
                markPoint : {
                    data : [
                        {type : 'max', name: '最大值'},
                        {type : 'min', name: '最小值'}
                    ]
                },
                markLine : {
                    data : [
//                        {type : 'average', name: '平均值'}
                    ]
                }
            }
        ]
    };
    var order_chart = echarts.init(document.getElementById('repair_option_div'));
    order_chart.setOption(option);
</script>
{include file="pagefooter.htm"}
{/if}