fa3cc89c4527cd346f4d10f10b01112a.php
12.3 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
<?php if (!defined('THINK_PATH')) exit(); /*a:1:{s:62:"E:\WWW\sos\public/../application/web\view\turn_prize\index.php";i:1601281737;}*/ ?>
<!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>
</head>
<body style="margin-bottom: 54px;">
<div class="easyui-layout" data-options="fit:true">
<!-- <div data-options="region:'north',title:'头部',split:true" style="height:100px;"> -->
<!-- </div> -->
<!-- <div data-options="region:'east',title:'确认信息',split:true" style="width:100px;"></div> -->
<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: 20px 10px">-->
<!-- <div style="margin-bottom:5px;">-->
<!-- 关键字搜索 : <input class="easyui-textbox" id='name' name="name" style="width:30%;" charset="utf-8">-->
<!-- <a id="search_btn" href="#" class="easyui-linkbutton" style="height:28px" data-options="iconCls:'icon-search'">搜索</a>-->
<!-- <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: 100%"
data-options="rownumbers:true,singleSelect:true,url:'/products/Turn_prize/prize_list',method:'get',
onDblClickRow :function(rowIndex,rowData){
memnerid = rowData;
showSelectedSurveryDataOnMap(rowData);
}">
<thead>
<tr>
<th data-options="field:'name',width:250,align:'center'">名称</th>
<th data-options="field:'number',width:200,align:'center'">剩余数量</th>
<th data-options="field:'probability',width:250,align:'center'">中奖概率</th>
<!-- <th data-options="field:'display',width:200,align:'center'">是否发布</th>-->
<th data-options="field:'img',width:215, align:'center',formatter:showImg">图片</th>
<!-- <th data-options="field:'img',width:170,align:'center'">图片</th>-->
<!-- <th data-options="field:'addTime',width:300,align:'center'">添加时间</th>-->
<th width="50" data-options="field:'id',formatter:formatOper">操作</th>
</tr>
</thead>
</table>
</div>
<!-- <div data-options="region:'south',title:'South Title',split:true" style="height:100px;"></div> -->
</div>
<div id="win" class="easyui-dialog" title="提示" style="width: 800px; padding: 10px 20px; height: auto" closed="true" buttons="#dlg-buttons">
<form id="fm" name="frm" method="post" style="margin-top: 20px; margin-left: 20px;">
<table style="padding: 10px 20px;" cellspacing="10">
<tr>
<td>名称:</td>
<td><input class="easyui-textbox" type="text" name="name" id="old_name" /></td>
<input class="easyui-textbox" id="prize_id" name="prize_id" type="hidden">
</tr>
<tr>
<td>数量:</td>
<td><input class="easyui-textbox" type="number" name="number" id="old_number" /></td>
</tr>
<tr>
<td>中奖概率:</td>
<td><input class="easyui-textbox" type="number" name="probability" id="old_probability" /></td>
</tr>
<!-- <tr>-->
<!-- <td>是否发布:</td>-->
<!-- <td><input id="statusId" name="display" class="easyui-switchbutton" style="height:30px"></td>-->
<!-- </tr>-->
<tr id="chooseFile_tr">
<td class="td-marked" id="imgs">图片:</td>
<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="previewImage(this)" style="display: none;" id="previewImg">
<input class="easyui-textbox" name="img" data-options="required:true" style="display: none !important;" id="img111" type="hidden">
<!--<input id="uploaderInput" class="uploader__input" style="display: none;" type="file" accept="" multiple="">-->
</div>
</div>
</td>
</tr>
<!-- <tr id="chooseFile_tr">-->
<!-- <td class="td-marked" id="imgs">hr二维码:</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="previewImage1(this)" style="display: none;" id="previewImg1">-->
<!-- <input class="easyui-textbox" name="url" data-options="required:true" style="display: none !important;" id="img222" type="hidden">-->
<!-- <input id="uploaderInput" class="uploader__input" style="display: none;" type="file" accept="" multiple="">-->
<!-- </div>-->
<!-- </div>-->
<!---->
<!-- </td>-->
<!-- </tr>-->
<!-- <div id="html_table"></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>
</table>
</form>
</div>
</body>
<tbody id="html_table"></tbody>
<script type="text/javascript" src="/assets/web/js/src/common_prize.js"></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){
// alert(row);
var id=row;
var result = {
id
}
$("#win").dialog("open").dialog("setTitle","修改奖项");
//ajax请求数据
$.ajax({
type: "post",
data: result,
async: false,
url: "/products/Turn_prize/prize_list",
success: function(data) {
var arr = JSON.parse(data);
$('#prize_id').textbox('setValue',arr.rows[0].id);
$('#old_name').textbox('setValue',arr.rows[0].name);
$('#old_number').textbox('setValue',arr.rows[0].number);
$('#old_probability').textbox('setValue',arr.rows[0].probability);
if(arr.rows[0].display == "已发布") {
$('#statusId').switchbutton('check');
}else {
$('#statusId').switchbutton('uncheck');
}
$('#imghead').attr("src",arr.rows[0].img);
//$('#imghead1').attr("src",arr.rows[0].url);
$('#img111').textbox('setValue',arr.rows[0].img);
// $('#img222').textbox('setValue',arr.rows[0].url);
},
error:function(data){
console.log(data)
}
});
//结束
// $("#am").form("load",row);
// url = '/web/turn_prize/save?id='+row.id;//为update方法准备访问url,注意是全局变量
}
}
//添加
$('#name_add_but').linkbutton({
onClick: function () {
var result='';
$.ajax({
type: "post",
data: result,
async: false,
url: "/products/Turn_prize/prize_list",
success: function(data) {
var arr = JSON.parse(data);
if(arr.total >=8){
$.messager.alert("提示", '奖项最多添加八个,请确认');
}else{
addFile();
}
},
error:function(data){
console.log(data)
}
});
}
});
function addFile(){
$('#win').dialog({
title: '新增',
width: 800,
height: "auto",
top:150,
closed: false,//显示对话框
cache: false,
modal: true
});
}
function submitForm(){
$('#fm').form('submit', {
url:'/products/Turn_prize/prize_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>