wzy
2021-04-01 d388e2788b7ef088d7cd40f901b0acdcec460bc3
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
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
<!DOCTYPE HTML>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="utf-8">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport"
    content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<!-- 本框架基本脚本和样式 -->
<script type="text/javascript"
    th:src="@{/js/plugin/jquery-2.1.4.min.js}"></script>
<script type="text/javascript"
    th:src="@{/js/systools/MBase.js}"></script>
</head>
<style>
    .senior-content > div{
        margin-right: 12%;
    }
</style>
<body class=" container-fluid">
 
<div class="pd-10">
    <!-- 搜索框部分start -->
            <div class="row form-head">
                <div class="col-md-2 col-xs-12">
                    <!-- 功能按钮部分 -->
                    <div class="">
                        <!--<button onclick="myGrid.delItems('id')" type="button"-->
                            <!--class="btn btn-danger btn-sm">-->
                            <!--<i class="fa fa-trash"></i>批量删除-->
                        <!--</button>-->
                    </div>
                </div>
                <div class="col-md-10 col-xs-12">
                    <div class="row">
                        <div class="col-md-11" style="text-align: right">
                            <form class="form-inline" id="serchform">
                                <div class="input-group">
                                    <div class="btn-group search-list " data-for="search-text">
                                        <button type="button"
                                                class="btn btn-default dropdown-toggle searchlist"
                                                data-toggle="dropdown">
                                            产品名称 <span class="caret "></span>
                                        </button>
                                        <ul class="dropdown-menu" role="menu">
                                            <li data-field="proName"><a>产品名称</a></li>
                                            <li data-field="nickName"><a>客户名称 </a></li>
                                            <li data-field="orderNo"><a>订单编号 </a></li>
                                        </ul>
                                    </div>
                                    <div class="form-group mr-20 ml-20">
                                        <input autocomplete="off"   id="search-text" name="proName" placeholder="输入查询关键词"
                                               type="text" class="form-control">
                                    </div>
                                    <div class="form-group">
                                        <button onclick="myGrid.serchData(1)" type="button"
                                            class="btn btn-info">
                                            <i class="fa fa-search "></i> 搜索
                                        </button>
                                        <!--<button onclick="exportExcel()" type="button"-->
                                                <!--class="btn btn-info">-->
                                            <!--<i class="fa fa-search "></i> 导出EXCEL-->
                                        <!--</button>-->
                                        <button type="reset" class="btn btn-info " onclick="resetSelect()">
                                            <i class="fa fa-refresh "></i> 重置
                                        </button>
                                    </div>
                                </div>
                                <!-- 高级搜索 -->
                                <div class="senior-content">
                                    <!-- <div><a class="serch-close closestyle">×</a></div> -->
                                    <div class="serch-headline">高级搜索</div>
                                    <div>
                                        <div style="margin-bottom: 20px!important;">
                                            <div class="col-sm-5" style="text-align: right!important;">
                                                <label class="col-sm-12 control-label">
                                                    开始日期:
                                                </label>
                                            </div>
                                            <div class="col-sm-7">
                                                <input autocomplete="off"   name="orderBeginTime" readonly="readonly"
                                                       type="text" class="form-control datetimepicker" style="width: 98%">
                                            </div>
                                        </div>
 
                                        <div style="margin-bottom: 20px!important;">
                                            <div class="col-sm-5" style="text-align: right!important;">
                                                <label class="col-sm-12 control-label">
                                                    结束日期:
                                                </label>
                                            </div>
                                            <div class="col-sm-7">
                                                <input autocomplete="off"   name="orderEndTime" readonly="readonly"
                                                       type="text" class="form-control datetimepicker" style="width: 98%">
                                            </div>
                                        </div>
 
                                        <div>
                                            <div class="col-sm-5">
                                                <span class="serch-title" style="width: 79%;">产品分类:</span>
                                            </div>
                                            <div class="col-sm-7">
                                            <select class="form-control  select2" size="1" name="proType" style="width: 100%"
                                                    id="categoryId">
                                            </select>
                                            </div>
                                        </div>
 
                                        <div>
                                            <div class="col-sm-5">
                                                <span class="serch-title" style="width: 79%;">产品属性:</span>
                                            </div>
                                            <div class="col-sm-7">
                                                <select class="form-control  select2" size="1" name="proAttrs" style="width: 100%"
                                                        id="parentId">
                                                </select>
                                            </div>
                                        </div>
 
                                        <div>
                                            <div class="col-sm-5">
                                                <span class="serch-title" style="width: 79%;">订单状态:</span>
                                            </div>
                                            <div class="col-sm-7">
                                                <select class="form-control autoFull select2" dataType="*"
                                                        th:data-url="@{/admin/shopOrder/getOrderStatusSelectValue}" data-value="code"
                                                        data-filed="name" name="orderStatus" style="width: 100%">
                                                    <option value=''>请选择</option>
                                                </select>
                                            </div>
                                        </div>
 
                                    </div>
                                    <div class="button col-sm-12">
                                        <button type="button" class="btn btn-sm btn-info mr20" onclick="myGrid.serchData()">确认</button>
                                        <button type="button" class="btn btn-warning serch-close">取消</button>
                                    </div>
                                </div>
                            </form>
                        </div>
                        <div class="col-md-1 text-r layui-anim" data-anim="layui-anim-up">
                            <a class="senior-serch">高级搜索</a>
                        </div>
                    </div>
                </div>
            </div>
                
    <div class="row" >
        <div class="col-sm-12" >
        <table id="mgrid">
            <thead>
                <tr>
                    <th data-checkbox="true"></th>
                    <th data-formatter="MGrid.indexfn" data-align="center"  data-width="30px" >序号</th>
                    <th data-field="nickName" >客户名称</th>
                    <th data-field="orderNo" >订单编号</th>
                    <th data-field="orderStatus" data-formatter="buildOrderStatus">订单状态</th>
                    <th data-field="proName" >产品名称</th>
                    <th data-field="proType" >产品分类</th>
                    <th data-field="proAttrs"data-align="center" data-formatter="formatAttr" data-width="50px">产品属性</th>
                    <th data-field="proSpecification" >产品规格</th>
                    <th data-field="count" >购买数量</th>
                    <th data-field="orderMoney" >产品支付金额</th>
                    <th data-field="orderTime" data-formatter="MGrid.getTime">购买日期</th>
                </tr>
            </thead>
        </table>
    </div>
</div>
</div>
<script type="text/javascript"
    th:src="@{/js/systools/MJsBase.js}"></script>
    <script type="text/javascript">
        MTools.autoFullSelect();
        $(".select2").select2();
         var myGrid;
        $(function(){
            MTools.ininDatetimepicker(".datetimepicker");
            myGrid=MGrid.initGrid({
                 url:basePath+"/admin/shopOrderSearch/showList",
             });
            initAttrsSeclect("#parentId");
            initCategorySeclect("#categoryId");
        });
 
        //初始化分类下拉选
        function initCategorySeclect(seler,def){
            $.AjaxProxy().invoke(basePath+"/admin/shopProductAttribute/showSonAttribute?attrCode=cpfl&status=1",
                    function(loj) {
                        $(seler).createSelectTree(
                                loj.attr("result").rows,
                                {    id : "attrId",
                                    parent : "parentId",
                                    value : "attrName",
                                    append : false,
                                    defaultValue : def,
                                    defaultHtml : '<option value="" selected="selected">请选择产品分类</option>'
                                });
                    });
        }
 
        //初始化属性下拉选
        function initAttrsSeclect(seler,def){
            $.AjaxProxy().invoke(basePath+"/admin/shopProductAttribute/showSonAttribute?attrCode=cpfl",
                function(loj) {
                    $(seler).createSelectTree(
                        loj.attr("result").rows,
                        {    id : "attrId",
                            parent : "parentId",
                            value : "attrName",
                            append : false,
                            defaultValue : def,
                            defaultHtml : '<option value="" selected="selected">请选择产品属性</option>'
                        });
                });
        }
 
        /**
         * 格式化属性
         */
        function formatAttr(value, row, index) {
            var html = "";
            if(value != ""){
                var values = value.split(",");
                for(var i=0;i<values.length;i++){
                    html += "<span class='label label-warning mr-5'>"+values[i]+"</span>"
                }
            }
            return html;
        }
 
        function exportExcel () {
            var userName = $('input[name=userName]').val();
            if (typeof userName == 'undefined') {
                userName = '';
            }
            var userTel = $('input[name=userTel]').val()
            if (typeof userTel == 'undefined') {
                userTel = '';
            }
            var orderNo = $('input[name=orderNo]').val();
            if (typeof orderNo == 'undefined') {
                orderNo = '';
            }
            var orderBeginTime = $('input[name=orderBeginTime]').val();
            var orderEndTime = $('input[name=orderEndTime]').val();
            var orderStatus = $('select[name=orderStatus]').val();
            var url = basePath + "/admin/shopOrder/exportOrderExcel";
            url += "?userName=" + userName;
            url += "&orderNo=" + orderNo;
            url += "&orderBeginTime=" + orderBeginTime;
            url += "&orderEndTime=" + orderEndTime;
            url += "&orderStatus=" + orderStatus;
            url += "&userTel=" + userTel;
            window.open(url);
        }
 
        /**
         *订单状态
         */
        function  buildOrderStatus(value, row, index) {
            if (value == 1) {
                return "待付款";
            } else if (value == 2) {
                return "待配送";
            } else if (value == 3) {
                return "待收货";
            } else if (value == 4) {
                return "待评价";
            } else if (value == 5) {
                return "已评价";
            } else if (value == 6) {
                return "申请退款";
            } else if (value == 7) {
                return "退款成功";
            } else if (value == 8) {
                return "退款拒绝";
            } else if (value == 9) {
                return "已取消";
            }
            return "";
        }
 
        /**
         * 重置下拉框
         */
        function resetSelect(){
            initAttrsSeclect("#parentId");
            initCategorySeclect("#categoryId");
        }
    </script>
</body>
</html>