fa3cc89c4527cd346f4d10f10b01112a.php 12.3 KB
<?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;">-->
<!--                关键字搜索 :   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<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>