mitao
2024-07-08 022a7ff7abf82cd2546e18071ade5228b4e2339f
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
@layout("/common/_container.html"){
<div class="ibox float-e-margins">
    <div class="ibox-content">
        <div class="form-horizontal" id="formId">
            <input type="hidden" id="id" value="${id}">
             <div class="form-group">
                 <label class="col-sm-3 control-label">
                     <span style="color: red;">*</span>冻结情况
                 </label>
                 <div style="display: inline-block">
                     <div class="" id="state" ></div>
                 </div>
             </div>
 
             <div class="form-group">
                 <label class="col-sm-3 control-label">
                     <span style="color: red;">*</span>冻结原因
                 </label>
                 <div class="col-sm-9">
                     <textarea name="remark" id="remark" class="form-control"></textarea>
                 </div>
             </div>
 
            <div class="row btn-group-m-t">
                <div class="col-sm-10 text-center">
                    <#button btnCss="info" name="确认" id="ensure" icon="fa-check" clickFun="DialogInfo.addSubmit()"/>
                </div>
            </div>
        </div>
    </div>
</div>
<script>
    var DialogInfo = {
        $parent: window.parent.MemMerchant,
 
        validFields: {
            state: Feng.def_valid_info( true), // 不能为空
            days: Feng.def_valid_info( true), // 不能为空
            remark: Feng.def_valid_info( true), // 不能为空
        }
    }
    DialogInfo.get = function( key) {
        return $( "#" + key).val();
    }
    DialogInfo.close = function () {
        this.$parent.search();
        window.parent.layer.close( this.$parent.layerIndex);
    }
 
    DialogInfo.get_submit_data = function() {
        return {
            ids: this.get( "id"),
            state: this.stateRadio.getValue(),
            days: this.get( "days"),
            remark: this.get( "remark")
        }
    }
    // 提交
    DialogInfo.addSubmit = function () {
        if ( !Feng.check_form( "formId")) { return; }
        var submitData = this.get_submit_data();
 
        if ( submitData.state == 2) {
            if (!submitData.days || submitData.days <= 0) {
                return Feng.error( "冻结时间不能为空或小于0!");
            }
        }
 
        Feng.base_ajax( "/memMerchant/lockMemMerchant", submitData, function ( data) {
            Feng.success( "冻结成功");
            DialogInfo.close();
        });
    }
 
    $(function () {
 
        Feng.initValidator( "formId", DialogInfo.validFields);
        DialogInfo.stateRadio = Feng.i_checks_radio_init( $("#state"), "state",
            [
                { checked: true, name: "永久冻结", value: 4,
                    others: function() { return "<span style='font-size: .6em'>永久冻结将扣除现有米粒,并且不能退回</span>"}},
                { checked: false, name: "临时冻结 ", value: 2,
                    others: function() { return "<span>" +
                        "冻结时间 <input type='number' disabled style='width: 120px;display: inline-block' name='days' id='days' class='form-control'>  天" +
                        "</span>"}}
            ], function( val) {
                if ( val.value == 2) {
                    return $('#days').attr("disabled",false);
                } return $( "#days").val( "").attr("disabled",true);
            });
    })
</script>
@}