yanghb
2023-04-10 b2f678ad387ca24e05a11100ea4583f0f2f730f0
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
/**
 * 通知管理初始化
 */
var TimeOutAppeal = {
    id: "TimeOutAppealTable",    //表格id
    seItem: null,        //选中的条目
    table: null,
    layerIndex: -1
};
 
/**
 * 初始化表格的列
 */
TimeOutAppeal.initColumn = function () {
    return [
        {field: 'selectItem', radio: true},
        {title: 'id', field: 'id', visible: false, align: 'center', valign: 'middle'},
        {title: '申请时间', field: 'createTime', align: 'center', valign: 'middle'},
        {title: '订单ID', field: 'orderNum', align: 'center', valign: 'middle'},
        {title: '订单类型', field: 'types', align: 'center', valign: 'middle'},
        {title: '扣款金额', field: 'timeOutMoney', align: 'center', valign: 'middle'},
        {title: '超时时间', field: 'timeOut', align: 'center', valign: 'middle'},
        {title: '司机电话', field: 'driverPhone', align: 'center', valign: 'middle'},
        {title: '司机姓名', field: 'driverName', align: 'center', valign: 'middle'},
        {title: '申诉内容', field: 'content', align: 'center', valign: 'middle'},
        {title: '申诉图片', field: 'imgList', align: 'center', valign: 'middle',
            formatter: function (value, row) {
                if (value == null || value === '') {
                    return '<a class = "view"  href="javascript:void(0)"><img style="width: 50px;height:50px;" src="' + Feng.ctxPath + '/static/img/NoPIC.png" /></a>';
                } else {
                    var arr = value.split(";");
                    var html = '';
                    for (let i = 0; i < arr.length; i++) {
                        html += '<a><img onclick="TimeOutAppeal.openBig(this)" style="width: 50px;height:50px;"  src="'+ arr[i] + '" /></a>&nbsp;';
                    }
                    return html;
                }
            },
            events: 'operateEvents'
        },
        {title: '退回金额', field: 'returnMoney', align: 'center', valign: 'middle'},
        {title: '状态', field: 'state', align: 'center', valign: 'middle',
            formatter: function (value,row) {
                switch (value) {
                    case 1:
                        return "未处理";
                    case 2:
                        return "同意";
                    case 3:
                        return "拒绝";
                }
            }
        }
    ];
};
 
 
///  放大图片
TimeOutAppeal.openBig = function(t){
    layer.open({
            type: 1,
            title: false,
            closeBtn: 0,
            area: 'auto',
            skin: 'layui-layer-nobg', //没有背景色
            shadeClose: true,
            content: '<img src="' + $(t)[0].src + '" height="100%" width="100%" />'
        });
};
 
 
/**
 * 检查是否选中
 */
TimeOutAppeal.check = function () {
    var selected = $('#' + this.id).bootstrapTable('getSelections');
    if (selected.length == 0) {
        Feng.info("请先选中表格中的某一记录!");
        return false;
    } else {
        TimeOutAppeal.seItem = selected[0];
        return true;
    }
};
 
 
/**
 * 同意
 */
TimeOutAppeal.agree = function(){
    if (this.check()){
        if (TimeOutAppeal.seItem.state != 1){
            Feng.error("该条申诉已经处理过,不能重复处理");
            return false;
        }
 
 
        var ajax = new $ax(Feng.ctxPath + '/timeOutAppeal/searchTimeOutMoney', function (data) {
            if('' == data){
                Feng.error("订单数据异常");
                return
            }
 
            var index = layer.open({
                type: 1,
                title: '处理申诉',
                area: ['800px', '400px'], //宽高
                fix: false, //不固定
                maxmin: true,
                content: '<div class="row" style="width: 100%;margin-top: 100px">' +
                    '<div class="form-group">' +
                    '<label class="control-label col-sm-3"></label><label class="control-label col-sm-3">超时扣款金额</label>' +
                    '<div class="col-sm-3" style="margin-left: -80px"><input id="timeOutMoney" class="form-control" value="' + data + '" disabled>' +
                    '</div></div><br/><br/>' +
                    '<div class="form-group">' +
                    '<label class="control-label col-sm-3"></label><label class="control-label col-sm-3">退回金额</label>' +
                    '<div class="col-sm-3" style="margin-left: -80px"><input class="form-control" id="returnMoney">' +
                    '</div></div><br/><br/><br/><br/><br/>' +
                    '<div class="row"><label class="control-label col-sm-5"></label>' +
                    '<div class="col-sm-3"><button type="button" class="btn btn-primary" onclick="TimeOutAppeal.agreeSubmit(' + TimeOutAppeal.seItem.id + ')">' +
                    '    <i class="fa fa-check"></i>&nbsp;确定\n' +
                    '</button></div>' +
                    '</div>'
            });
            this.layerIndex = index;
 
 
        },function (data) {
            Feng.error(data.msg);
        });
        ajax.set("appealId",TimeOutAppeal.seItem.id);
        ajax.start();
 
 
    }
};
 
 
/**
 * 同意提交
 */
TimeOutAppeal.agreeSubmit = function(id){
    if ($("#returnMoney").val() === ""){
        Feng.error("退还金额不能为空");
        return false;
    }
 
    if ($("#returnMoney").val() > $("#timeOutMoney").val()){
        Feng.error("退还金额不能大于超时扣款金额");
        return false;
    }
 
    //提交信息
    var ajax = new $ax(Feng.ctxPath + "/timeOutAppeal/agreeSubmit", function(data){
        Feng.success("操作成功!");
        TimeOutAppeal.table.refresh();
        layer.close(window.TimeOutAppeal.layerIndex);
    },function(data){
        Feng.error("操作失败!" + data.responseJSON.message + "!");
    });
    ajax.set("id",id);
    ajax.set("returnMoney",$('#returnMoney').val());
    ajax.start();
};
 
 
 
///  退回金额数值范围校验
// TimeOutAppeal.compare = function(t){
//     if ($(t).val() > $("#timeOutMoney").val()){
//         Feng.error("退还金额不能大于超时扣款金额");
//         return false;
//     }
// };
 
 
/**
 * 解决
 */
TimeOutAppeal.disagree = function(){
    if (this.check()){
        if (TimeOutAppeal.seItem.state != 1){
            Feng.error("该条申诉已经处理过,不能重复处理");
            return false;
        }
 
        var index = layer.open({
            type: 1,
            title: '处理申诉',
            area: ['800px', '400px'], //宽高
            fix: false, //不固定
            maxmin: true,
            content: '<div class="row" style="width: 100%;margin-top: 80px">' +
                '<div class="form-group">' +
                '<label class="control-label col-sm-2"></label><label class="control-label col-sm-3">拒绝理由</label>' +
                '<div class="col-sm-3" style="margin-left: -80px"><textarea id="remark" style="width: 300px;height: 150px"></textarea></div>' +
                '</div></div><br/><br/><br/>' +
                '<div class="row" style="width: 100%"><label class="control-label col-sm-5"></label>' +
                '<div class="col-sm-3"><button type="button" class="btn btn-primary" onclick="TimeOutAppeal.disagreeSubmit(' + TimeOutAppeal.seItem.id + ')">' +
                '    <i class="fa fa-check"></i>&nbsp;确定\n' +
                '</button></div>' +
                '</div>'
        });
        this.layerIndex = index;
    }
};
 
 
 
/**
 * 拒绝提交
 */
TimeOutAppeal.disagreeSubmit = function(id){
    if ($("#remark").val() === ""){
        Feng.error("拒绝理由不能为空");
        return false;
    }
 
 
    //提交信息
    var ajax = new $ax(Feng.ctxPath + "/timeOutAppeal/disagreeSubmit", function(data){
        Feng.success("操作成功!");
        TimeOutAppeal.table.refresh();
        layer.close(window.TimeOutAppeal.layerIndex);
    },function(data){
        Feng.error("操作失败!" + data.responseJSON.message + "!");
    });
    ajax.set("id",id);
    ajax.set("remark",$('#remark').val());
    ajax.start();
};
 
 
/**
 * 删除
 */
TimeOutAppeal.delete = function() {
    if (this.check()){
 
        if (TimeOutAppeal.seItem.state == 1){
            Feng.error("只有已经被处理过的申诉才能删除");
            return false;
        }
 
        //提交信息
        var ajax = new $ax(Feng.ctxPath + "/timeOutAppeal/delete", function(data){
            Feng.success("删除成功!");
            TimeOutAppeal.table.refresh();
            layer.close(window.TimeOutAppeal.layerIndex);
        },function(data){
            Feng.error("删除失败!" + data.responseJSON.message + "!");
        });
        ajax.set("id",TimeOutAppeal.seItem.id);
        ajax.start();
    }
};
 
 
 
/**
 * 查询通知列表
 */
TimeOutAppeal.search = function () {
    var queryData = {};
    queryData['driverName'] = $("#driverName").val();
    queryData['driverPhone'] = $("#driverPhone").val();
    queryData['orderNum'] = $("#orderNum").val();
    var arr = $("#createTime").val().split(" - ");
    queryData['startTime'] = arr[0];
    queryData['endTime'] = arr[1];
    TimeOutAppeal.table.refresh({query: queryData});
};
 
$(function () {
    var defaultColunms = TimeOutAppeal.initColumn();
    var table = new BSTable(TimeOutAppeal.id, "/timeOutAppeal/list", defaultColunms);
    table.setPaginationType("server");
    TimeOutAppeal.table = table.init();
});