index.php
15.2 KB
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
<!DOCTYPE html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">
<html>
<head>
<meta charset="UTF-8">
<title>表单填写</title>
<link rel="stylesheet" type="text/css" href="/assets/common/css/themes/gray/easyui.css" />
<link rel="stylesheet" type="text/css" href="/assets/common/css/themes/gray/menu.css" />
<link rel="stylesheet" type="text/css" href="/assets/common/css/themes/icon.css" />
<link rel="stylesheet" type="text/css" href="/assets/web/css/jitnry.css" />
<link rel="stylesheet" type="text/css" href="/assets/web/css/common_car.css" />
<script type="text/javascript" src="/assets/common/js/jquery.min.1.9.4.js"></script>
<script type="text/javascript" src="/assets/common/js/jquery.easyui.min.1.9.4.js"></script>
<script type="text/javascript" src="/assets/common/js/jquery.cookie.1.4.1.js"></script>
<!-- 插件调用 --->
<script type="text/javascript" src="/assets/common/js/datagrid-detailview.js"></script>
<script type="text/javascript" src="/assets/common/locale/easyui-lang-zh_CN.js"></script>
<!-- 基础 JS 调用 -->
<script type="text/javascript" src="/assets/web/js/src/easyui.base.js"></script>
<script type="text/javascript" src="/assets/web/js/src/allCity.js"></script>
<!--富文本编辑器-->
<link rel="stylesheet" href="/assets/kindeditor/themes/default/default.css" />
<script src="/assets/kindeditor/kindeditor.js"></script>
<script src="/assets/kindeditor/kindeditor-all.js"></script>
<script src="/assets/kindeditor/kindeditor-all-min.js"></script>
<script charset="utf-8" src="/assets/kindeditor/kindeditor-min.js"></script>
<script charset="utf-8" src="/assets/kindeditor/lang/zh_CN.js"></script>
<style>
#fm>div {
width: 100%;
display: flex;
justify-content: space-around;
margin: 10px 0;
}
#fm>div input{
width: 180px;
}
</style>
</head>
<body style="margin-bottom: 54px;">
<div class="easyui-layout" data-options="fit:true">
<div data-options="split:false,region:'west',collapsible:true,footer:'#win_base_org_form_footer'" title="产品列表" id="saveBox" style="width:100%;">
<div class="easyui-panel" style="width:100%;max-width:100%;padding: 5px 5px">
<div style="margin-bottom:5px;">
<a id="name_add_but" href="#" data-options="iconCls:'icon-add'" class="my_but" style="vertical-align: middle;">新增</a>
</div>
</div>
<table id="dg" style="width: 100%; height: 75%"
data-options="rownumbers:true,singleSelect:true,pagination:true,url:'/products/product/goods_list',method:'get',
onDblClickRow :function(rowIndex,rowData){
memnerid = rowData;
showSelectedSurveryDataOnMap(rowData);
}">
<thead>
<tr>
<th data-options="field:'name',width:100,align:'center'">商品名称</th>
<th data-options="field:'title',width:200,align:'center'">说明</th>
<th data-options="field:'category',width:100,align:'center'">分类</th>
<th data-options="field:'issueTime',width:100,align:'center'">发布时间</th>
<th data-options="field:'faceValue',width:100,align:'center'">价值</th>
<th data-options="field:'num',width:50,align:'center'">数量</th>
<th data-options="field:'spec',width:100,align:'center'">规格</th>
<th data-options="field:'issuingUnit',width:250,align:'center'">发行单位</th>
<th data-options="field:'addTime',width:250,align:'center'">添加时间</th>
<th width="50" data-options="field:'id',formatter:formatOper">操作</th>
</tr>
</thead>
</table>
</div>
</div>
<div id="win" class="easyui-dialog" title="提示" style="width: 800px; padding: 5px 5px;" closed="true" buttons="#dlg-buttons">
<form id="fm" name="frm" method="post" cellspacing="10" style="margin-top: -10px; margin-left: 20px; height: 700px;">
<input class="easyui-textbox" id="goods_id" name="goods_id" type="hidden">
<div>
<td>商品名称:</td>
<td><input class="easyui-textbox" type="text" name="name" id="old_name" /></td>
<td>产品说明:</td>
<td><input class="easyui-textbox" type="text" name="title" id="old_title" /></td>
</div>
<div>
<td>藏品类别:</td>
<td><input class="easyui-textbox" type="text" name="category" id="old_category" /></td>
<td>发行时间:</td>
<td><input class="easyui-datebox" id='old_issueTime' name='issueTime'></td>
</div>
<div>
<td>产品价值:</td>
<td><input class="easyui-textbox" type="number" name="faceValue" id="old_faceValue" /></td>
<td>折后价值:</td>
<td><input class="easyui-textbox" type="number" name="discount" id="old_discount" /></td>
</div>
<div>
<td>产品卖点:</td>
<td><input class="easyui-textbox" type="text" name="selling_point" id="old_selling_point" data-options="prompt:'多个卖点用;隔开'"/></td>
<td>发行数量:</td>
<td><input class="easyui-textbox" type="number" name="num" id="old_num" /></td>
</div>
<div>
<td>商品规格:</td>
<td><input class="easyui-textbox" type="text" name="spec" id="old_spec" /></td>
<td>发行单位:</td>
<td><input class="easyui-textbox" type="text" name="issuingUnit" id="old_issuingUnit" /></td>
</div>
<div>
<td>咨询电话:</td>
<td><input class="easyui-textbox" type="text" name="tel" id="old_tel" /></td>
<td>最大数量:</td>
<td><input class="easyui-textbox" type="number" name="maxnum" id="old_maxnum" /></td>
</div>
<div>
<tr id="chooseFile_tr">
<span class="td-marked" id="imgs">图片:</span>
<td>
<div class="input-group row">
<div class="col-sm-9 big-photo">
<div id="preview">
<img id="imghead" border="0" src="img/photo_icon.png" width="90" height="90" onclick="$('#previewImg').click();">
</div>
<input type="file" data-options="required:true" onchange="productPreviewImage(this)" style="display: none;" id="previewImg">
<input class="easyui-textbox" name="img" style="display: none !important;width: 0" id="img111" type="hidden">
<!--<input id="uploaderInput" class="uploader__input" style="display: none;" type="file" accept="" multiple="">-->
</div>
</div>
</td>
<td>
<div class="input-group row">
<div class="col-sm-9 big-photo">
<div id="preview1">
<img id="imghead1" border="0" src="img/photo_icon.png" width="90" height="90" onclick="$('#previewImg1').click();">
</div>
<input type="file" data-options="required:true" onchange="productPreviewImage1(this)" style="display: none;border: none" id="previewImg1">
<input class="easyui-textbox" name="img2" style="display: none !important;width: 0" id="img222" type="hidden">
<!-- <input id="uploaderInput" class="uploader__input" style="display: none;" type="file" accept="" multiple="">-->
</div>
</div>
</td>
<td>
<div class="input-group row">
<div class="col-sm-9 big-photo">
<div id="preview2">
<img id="imghead2" border="0" src="img/photo_icon.png" width="90" height="90" onclick="$('#previewImg2').click();">
</div>
<input type="file" data-options="required:true" onchange="productPreviewImage2(this)" style="display: none;border: none" id="previewImg2">
<input class="easyui-textbox" name="img3" style="display: none !important;width: 0" id="img333" type="hidden">
<!-- <input id="uploaderInput" class="uploader__input" style="display: none;" type="file" accept="" multiple="">-->
</div>
</div>
</td>
</tr>
</div>
<p>商品详情:</p>
<div>
<div>
<textarea rows="3" style="width:400px;" id="content" name="content" class="easyui-validatebox" data-options="required:true,validType:'length[1,1000000]'" invalidMessage="最大长度不能超过1000000""></textarea>
</div>
</div>
<div id="dlg-buttons" style="display: block">
<a id="confirm" href="javascript:void(0)" class="easyui-linkbutton c6" iconcls="icon-ok" onclick="submitForm()" style="width: 90px">提交</a>
<a href="javascript:void(0)" class="easyui-linkbutton" iconcls="icon-cancel" onclick="javascript:$('#win').dialog('close')" style="width: 90px">取消</a>
</div>
</form>
</div>
</body>
<tbody id="html_table"></tbody>
<script type="text/javascript" src="/assets/web/js/src/common_product.js"></script>
<script>
var editor;
$(function() {
editor = KindEditor.create('textarea[name="content"]',{resizeType : 1,width:"100%",height:"200px",afterChange:function(){
this.sync();
},afterBlur:function(){
this.sync();
}});
});
</script>
<script>
function formatOper(val, row, index) {
return '<a href="javascript:void(0)" onclick="showUser(' + val + ')">编辑</a>';
}
//修改
function showUser(row){
$("[switchbuttonName='111']").switchbutton("uncheck");
//var row = $("#dg").datagrid("getSelected");//取得选中行
if(row){
$("#win").dialog("open").dialog("setTitle","修改产品");
var id=row;
var result = {
id
}
//ajax请求数据
$.ajax({
type: "post",
data: result,
async: false,
url: "/products/product/get_one_list",
success: function(data) {
$('#goods_id').textbox('setValue',data.id);
$('#old_name').textbox('setValue',data.name);
$('#old_title').textbox('setValue',data.title);
$('#old_category').textbox('setValue',data.category);
$('#old_faceValue').textbox('setValue',data.faceValue);
$('#old_discount').textbox('setValue',data.discount);
$('#old_issueTime').textbox('setValue',data.issueTime);
$('#old_num').textbox('setValue',data.num);
$('#old_spec').textbox('setValue',data.spec);
$('#old_issuingUnit').textbox('setValue',data.issuingUnit);
$('#old_maxnum').textbox('setValue',data.maxnum);
$('#old_selling_point').textbox('setValue',data.selling_point);
$('#old_tel').textbox('setValue',data.tel);
$('#imghead').attr("src",data.img);
$('#imghead1').attr("src",data.img2);
$('#imghead2').attr("src",data.img3);
$('#img111').textbox('setValue',data.img);
$('#img222').textbox('setValue',data.img2);
$('#img333').textbox('setValue',data.img3);
KindEditor.html('#content',data.content);
},
error:function(data){
console.log(data)
}
});
}
}
//添加
$('#name_add_but').linkbutton({
onClick: function () {
addFile();
}
});
function addFile(){
$('#win').dialog({
title: '新增',
width: 800,
height: "auto",
top:20,
closed: false,//显示对话框
cache: false,
modal: true
});
}
function submitForm(){
$('#fm').form('submit', {
url:'/products/product/goods_add',
onSubmit: function(){
console.log($(this))
// do some check
// return false to prevent submit;
},
success:function(data){
var arr = JSON.parse(data);
$.messager.alert("提示", arr.msg);
$('#dg').datagrid('reload');
console.log(data);
//$.messager.alert('',msg);
//console.log(data);
//alert(data)
}
});
$('#win').dialog({
closed: true, // 隱藏列表
});
}
</script>
</html>