cy
2022-06-22 6e06bba1c89f8077e29d0fbf0ce12f89f027d8d2
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
<!doctype html>
<html class="no-js">
<head>
    <meta charset="utf-8">
    <title>增加/修改</title>
[#include "/business/pages/include/static.html" /]
[#include "/component/DatePicker.html" /]
    <script type="text/javascript" src="${common_static}/static/script/jquery.ssq.js"></script>
</head>
<body class="edit_txt_body">
 
<script type="text/javascript">
    $(function () {
        $.formValidator.initConfig({
            formID: "myform", onError: function (msg) {
                popupTips(msg)
            }, onSuccess: function () {
                document.getElementById("myform").target = window.top.openDialog("1", "操作",
                        {},
                        {"width": 40, "height": 40}, [{btnId: "tipBtnSure", btnName: "确定", btnStyle: "bluebtn"}]);
                return true;
            }
        });
 
        $("#supplier_name").formValidator({empty: false, onFocus: "请输入供货商名称"}).inputValidator({min: 1, max: 30, onError: "供货商名称不能为空"});
        $("#contacts").formValidator({empty: false, onFocus: "请输入联系人"}).inputValidator({min: 1, max: 30, onError: "联系人不能为空"});
        $("#contacts_tel").formValidator({empty: false, onFocus: "请输入联系电话"}).inputValidator({min: 1, max: 30, onError: "联系电话不能为空"});
        $("#ordernum").formValidator({empty: false, onFocus: "请输入顺序号"}).inputValidator({min: 1, max: 5, onError: "顺序号必须为1到5位数字"})
                .regexValidator({regExp: "intege", dataType: "enum", onError: "顺序号必须为1到5位数字"});
 
    })
</script>
 
<div class="edit_txt">
    <form action="${base}/business/pages/supplier/editSupplier.html" method="post" id="myform" name="myform">
        <input type="hidden" name="id" value="${info.id}"/>
        <input type="hidden" id="province" name="province"/>
         <input type="hidden" name="type" value="${type}"/>
        <input type="hidden" id="city" name="city"/>
        <input type="hidden" id="county" name="county"/>
        <table class="edit_layout" width="99%">
            <tr>
                <th><label class="required">供应商名称:</label></th>
                <td colspan="3"><input class="general" type="text" value="${info.supplier_name}" name="supplier_name" id="supplier_name" style="width:360px"/>
                    <div id="supplier_nameTip" style="display:inline-block;"></div>
                </td>
            </tr>
 
            <tr>
                <th><label>注册时间:</label></th>
                <td>[@datepicker id="gmt_register" value="${info.gmt_register}"/]
                </td>
                <th><label>企业法人:</label></th>
                <td><input class="general" type="text" value="${info.legal_person}" name="legal_person" id="legal_person"/>
                </td>
            </tr>
 
            <tr>
                <th><label>办公电话:</label></th>
                <td><input class="general" type="text" value="${info.office_tel}" name="office_tel" id="office_tel"/>
                </td>
                <th><label> 联系邮箱:</label></th>
                <td><input class="general" type="text" value="${info.email}" name="email" id="email"/>
                </td>
            </tr>
 
            <tr>
                <th><label class="required">联系人:</label></th>
                <td><input class="general" type="text" value="${info.contacts}" name="contacts" id="contacts"/>
                    <div id="contactsTip" style="display:inline-block;"></div>
                </td>
                <th><label class="required">联系电话:</label></th>
                <td><input class="general" type="text" value="${info.contacts_tel}" name="contacts_tel" id="contacts_tel"/>
                    <div id="contacts_telTip" style="display:inline-block;"></div>
                </td>
            </tr>
 
            <tr>
                <th><label class="required">地址:</label></th>
                <td colspan="3" id="area">
                    <select id="province_id" name="province_id" class="sheng" rows="3" def="${info.province_id}" style="width:100px;">
                    </select>
                    <select id="city_id" name="city_id" class="shi" rows="3" def="${info.city_id}" style="width:100px;">
                    </select>
                    <select id="county_id" name="county_id" class="qu" rows="3" def="${info.county_id}" style="width:100px;">
                    </select>
                    <div id="contactsTip" style="display:inline-block;"></div>
                </td>
            </tr>
 
            <tr>
                <th><label>&nbsp;</label></th>
                <td colspan="3"><input class="general" type="text" value="${info.address}" name="address" id="address" style="width:360px"/>
                    <div id="addressTip" style="display:inline-block;"></div>
                </td>
            </tr>
 
            <tr>
                <th><label>说明:</label></th>
                <td colspan="3"><textarea class="general" style="width:360px;" id="note" name="note"/>${info.note}</textarea>
                </td>
            </tr>
        </table>
 
 
        <div class="edit_title"><h3>供应货品清单</h3><a class="add_associated" href="javascript:addCate();">添加</a></div>
        <table class="display_form" id="cateTable">
            <tr class="title">
                <td width="35%" style="text-align: center;">备件分类</td>
                <td width="25%" style="text-align: center;">分类编码</td>
                <td width="20%" style="text-align: center;">报价(元)</td>
                <td width="20%" style="text-align: center;">操作</td>
            </tr>
 
            [#if info.list?? && info.list?size>0]
                [#list info.list as item]
                <tr align="center">
                    <td style="text-align:center;"><input type="hidden" name="cate_id" value="${item.cate_id}">${item.lv1_name}-${item.lv2_name}-${item.lv3_name}</td>
                    <td style="text-align:center;">${item.code1}-${item.code2}-${item.code}</td>
                    <td style="text-align:center;"><input type="text" name="offer_price" value="${item.offer_price}"/></td>
                    <td style="text-align:center;"><a class="blue_txt del">删除</a></td>
                </tr>
                [/#list]
            [#else]
            <tr align="center">
                <td colspan="4">暂无信息</td>
            </tr>
            [/#if]
 
        </table>
    </form>
</div>
 
 
<script type="text/javascript">
    $(function () {
        $("#area").ssq({"pre": '${base}'});//加载省市区
 
        $(".blue_txt.del").live("click",function () {
            $(this).parent().parent().remove();
        })
 
        $("input[name=offer_price]").live('blur',function () {
            if(!/(^[0-9]{1,7}$)|(^[0-9]{1,7}[\.]{1}[0-9]{1,2}$)/.test($.trim($(this).val()))){
                popupTips("请输入正确的报价(整数最多七位,小数最多两位)");
                $(this).focus();
            }
        })
 
    })
 
    function addCate() {
        var cateIds = "";
        $("input[name=cate_id]").each(function () {
            cateIds += (cateIds ? "," : "") + $(this).val();
        })
        var url = "${base}/business/pages/supplier/cateList.html?cateIds="+cateIds;
        window.top.openDialog("1", "添加供货信息",
                {},
                {"width": 60, "height": 80},
                [{btnId: "btnSure", btnName: "确定", btnStyle: "bluebtn"}], url);
    }
    
    function onDialogBtnClick(btnID, dialogID, config) {
        if (btnID == "btnSure") {
            var flag = true;
            if($("#province_id").val()==''|| $("#city_id").val()==''|| $("#county_id").val()==''){
                popupTips("请选择地址");
                return;
            }
 
            $("#province").val($("#province_id option:selected").text());
            $("#city").val($("#city_id option:selected").text());
            $("#county").val($("#county_id option:selected").text());
 
            if($("#cateTable").find("input[name=cate_id]").length==0){
                popupTips("请选择供应货品清单");
                return;
            }
 
            $("input[name=offer_price]").each(function () {
                if(!/(^[0-9]{1,7}$)|(^[0-9]{1,7}[\.]{1}[0-9]{1,2}$)/.test($.trim($(this).val()))){
                    popupTips("请输入正确的报价(整数最多七位,小数最多两位)");
                    flag = false;
                    return false;
                }
            })
 
            if(flag){
                $("#myform").submit();
            }
        }
    }
 
    function selCate(cateAry) {
        var htmlStr = "";
        $.each(cateAry,function (index,item) {
            htmlStr += '<tr>' +
                        '<td style="text-align:center;"><input type="hidden" name="cate_id" value="'+item.cate_id+'">'+item.name+'</td>' +
                        '<td style="text-align:center;">'+item.code+'</td>' +
                        '<td style="text-align:center;"><input type="text" name="offer_price" value="'+item.offer_price+'"/></td>' +
                        '<td style="text-align:center;"><a class="blue_txt del">删除</a></td>' +
                    '</tr>';
        })
 
        if($("#cateTable").find("input[name=cate_id]").length==0){
            $("#cateTable").find("tr:eq(1)").remove();
        }
 
        $("#cateTable").append(htmlStr);
 
    }
 
</script>
 
 
</body>
</html>