44323
2023-11-14 ddbb38c54db9c3670e5ff53f4bf713525de1099d
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
/**
 * 系统管理--用户管理的单例对象
 */
var ExamineCoursePackage = {
    id: "managerTable",//表格id
    seItem: null,        //选中的条目
    table: null,
    layerIndex: -1
};
 
 
 
 
/**
 * 初始化表格的列
 */
ExamineCoursePackage.initColumn = function () {
    let columns = [
        {field: 'selectItem', radio: true},
        {title: '序号', field: 'id', visible: false, align: 'center', valign: 'middle'},
        {title: '所在省市', field: 'city', align: 'center', valign: 'middle'},
        {title: '所属门店', field: 'store', align: 'center', valign: 'middle'},
        {title: '课包种类', field: 'type', align: 'center', valign: 'middle'},
        {title: '课包类型', field: 'coursePackageType', align: 'center', valign: 'middle'},
        {title: '课包名称', field: 'name', align: 'center', valign: 'middle'},
        {title: '支付方式', field: 'payType', align: 'center', valign: 'middle'},
        {title: '审核状态', field: 'auditStatus', align: 'center', valign: 'middle',
            formatter: function (v) {
                switch (v) {
                    case 1:
                        return '待审核';
                    case 3:
                        return '未通过';
                }
            }
        }
    ];
    return columns;
};
 
/**
 * 检查是否选中
 */
ExamineCoursePackage.check = function () {
    let selected = $('#' + this.id).bootstrapTable('getSelections');
    if (selected.length == 0) {
        Feng.info("请先选中表格中的某一记录!");
        return false;
    } else {
        ExamineCoursePackage.seItem = selected[0];
        return true;
    }
};
 
 
/**
 * 点击修改按钮时
 * @param userId 管理员id
 */
ExamineCoursePackage.examineCoursePackage = function () {
    if (this.check()) {
        if(ExamineCoursePackage.seItem.auditStatus != 1){
            Feng.error("不能重复审核");
            return
        }
        let htmlStr =
            '<div class="form-horizontal">' +
            '   <div class="col-sm-11" style="padding: 10px;">' +
            '       <div class="form-group">\n' +
            '           <label class="col-sm-3 control-label">*审核状态:</label>\n' +
            '           <div class="col-sm-8">\n' +
            '               <input name="auditStatus" type="radio" value="2"/> 通过&nbsp;&nbsp;&nbsp;&nbsp;' +
            '               <input name="auditStatus" type="radio" value="3"/> 拒绝&nbsp;&nbsp;&nbsp;&nbsp;' +
            '           </div>' +
            '       </div>' +
            '       <div class="form-group">\n' +
            '           <label class="col-sm-3 control-label">*拒绝理由:</label>\n' +
            '           <div class="col-sm-8">\n' +
            '               <textarea id="authRemark" style="width: 100%;height: 200px;" placeholder="请输入拒绝理由"></textarea>' +
            '           </div>' +
            '       </div>' +
            '   </div>' +
            '</div>';
        layer.open({
            type: 1
            , title: '课包审核'
            , area: ['800px', '400px']
            , offset: 'auto' //具体配置参考:http://www.layui.com/doc/modules/layer.html#offset
            , id: 'layerDemo' //防止重复弹出cge
            , content: htmlStr
            , btn: ['保存', '关闭']
            , btnAlign: 'c' //按钮居中
            , shade: 0.5 //不显示遮罩
            , yes: function () {
                let auditStatus = $('input[name="auditStatus"]:checked').val();
                if(typeof auditStatus == "undefined"){
                    Feng.error("请选择审核结果");
                    return
                }
 
                let authRemark = $('#authRemark').val();
                console.log("========="+authRemark)
 
 
                if(3 == auditStatus && '' == authRemark){
                    Feng.error("请输入拒绝理由");
                    return
                }
                let ajax = new $ax(Feng.ctxPath + "/coursePackage/setCoursePackageAuditStatus", function (res) {
                    if(res.code == 200){
                        Feng.success("审核成功!");
                        layer.closeAll();
                        ExamineCoursePackage.table.refresh();
                    }else{
                        Feng.error(res.msg);
                    }
                }, function (data) {
                    Feng.error("审核失败!" + data.responseJSON.message + "!");
                });
                ajax.set("id", ExamineCoursePackage.seItem.id);
                ajax.set("auditStatus", auditStatus);
                ajax.set("authRemark", authRemark);
                ajax.start();
            },
        });
    }
};
 
 
ExamineCoursePackage.detailsExamineCoursePackage = function () {
    if (this.check()) {
        let index = layer.open({
            type: 2,
            title: '详情',
            area: ['100%', '100%'], //宽高
            fix: false, //不固定
            maxmin: true,
            content: Feng.ctxPath + '/coursePackage/showExamineCoursePackageDetails?id=' + this.seItem.id
        });
        this.layerIndex = index;
    }
};
 
 
 
ExamineCoursePackage.resetSearch = function () {
    $("#provinceCode").val("");
    $("#cityCode").val("");
    $("#coursePackageTypeId").val("");
    $("#name").val("");
    $("#auditStatus").val("");
    ExamineCoursePackage.search();
}
 
ExamineCoursePackage.search = function () {
    let queryData = {};
    queryData['provinceCode'] = $("#provinceCode").val();
    queryData['cityCode'] = $("#cityCode").val();
    queryData['coursePackageTypeId'] = $("#coursePackageTypeId").val();
    queryData['name'] = $("#name").val();
    queryData['auditStatus'] = $("#auditStatus").val();
    ExamineCoursePackage.table.refresh({query: queryData});
}
 
 
$(function () {
    let defaultColunms = ExamineCoursePackage.initColumn();
    let table = new BSTable(ExamineCoursePackage.id, "/coursePackage/queryExamineCoursePackageLists", defaultColunms);
    // 设置物理分页server(逻辑分页client)
    table.setPaginationType("server");
    ExamineCoursePackage.table = table.init();
 
 
    $('#provinceCode').change(function () {
        let ajax = new $ax(Feng.ctxPath + "/coursePackage/queryCity", function (data) {
            let htmlStr = '';
            for (let i = 0; i < data.length; i++) {
                htmlStr += '<option value="' + data[i].code + '">' + data[i].name + '</option>'
            }
            $('#cityCode').html(htmlStr);
        }, function (data) {
            Feng.error("获取失败!" + data.responseJSON.message + "!");
        });
        ajax.set("code", $(this).val());
        ajax.start();
    })
});