营销系统之单品促销(2)

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<jsp:include page="/jsp/common/header.jsp"></jsp:include>
<script src="${ctx }/js/promote/ec_coupon_type.js"></script>

<table class="queryTable" width="100%" >
    <tr>
        <td class="queryTitle" width="100">优惠券名称</td>
        <td class="queryContent" width="100">
            <input class="inputText" type="text" id="couponTypeName" />
        </td>
        <td class="queryTitle" width="100">优惠券面额</td>
        <td class="queryContent" width="100">
            <input class="inputText" type="text" id="couponFee" />
        </td>
        <td>
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:void(0)" class="easyui-linkbutton" onclick="doQuery()" iconCls="icon-search" >查询</a>
        </td>
    </tr>
</table>
<table id="skuCommentGrid" ></table>

<div id="querySkuCommentDld" class="easyui-window" title="" iconCls="icon-search" style="width:300px; height:300px;text-align:center; background: #fafafa;">
    <table id="addGoodsPromoteGrid" ></table>
</div>

<div id="editSkuCommentDlg" class="easyui-window" title="" iconCls="icon-search" style="width:300px; height:300px;text-align:center; background: #fafafa;">
    <div class="easyui-layout" fit="true">
            <div region="center" border="false" style="background:#fff;border:1px solid #ccc;">
                <form id="queryForm"  method="POST">
                    <table width="95%" class="queryTable" align="center" border="0" style="margin:10,0,0,0;">
                        <tr>
                            <td width="15%"  align="right" class="queryTitle">评价人</td>
                            <td align="left" width="35%" class="queryContent">
                                <label id="realNameLabel"></label>
                            </td>
                            <td width="15%"  align="right" class="queryTitle">评价时间</td>
                            <td align="left" width="35%" class="queryContent">
                                <label id="commentTimeLabel"></label>
                            </td>
                        </tr>
                        <tr>
                            <td  align="right" class="queryTitle">评价商品</td>
                            <td align="left" class="queryContent">
                                <label id="goodsNameLabel"></label>
                            </td>
                            <td  align="right" class="queryTitle">评价等级</td>
                            <td align="left" class="queryContent">
                                <label id="codeValueLLabel"></label>
                            </td>
                        </tr>
                        <tr>
                            <td align="right" class="queryTitle">有用数量</td>
                            <td align="left" class="queryContent" id="usefullAmountLabel">
                            </td>
                            <td  align="right" class="queryTitle">无用数量</td>
                            <td align="left" class="queryContent">
                                <label id="uselessAmountLabel"></label>
                            </td>
                        </tr>
                        <tr>
                            <td align="right" class="queryTitle">评价内容</td>
                            <td align="left" class="queryContent" style="height:80px;">
                                <label id="commentNotesLabel"></label>
                            </td>
                            <td  align="right" class="queryTitle">使用心得</td>
                            <td align="left" class="queryContent">
                                <label id="useExperienceLabel"></label>
                            </td>
                        </tr>
                        <tr>
                            <td align="right" class="queryTitle">优点</td>
                            <td align="left" class="queryContent" style="height:80px;">
                                <label id="advantageLabel"></label>
                            </td>
                            <td  align="right" class="queryTitle">不足</td>
                            <td align="left" class="queryContent">
                                <label id="IsDefaultLabel"></label>
                            </td>
                        </tr>
                        <tr>
                            <td align="right" class="queryTitle">审核人</td>
                            <td align="left" class="queryContent" id="userNameLabel">
                            </td>
                            <td  align="right" class="queryTitle">审核时间</td>
                            <td align="left" class="queryContent">
                                <label id="auditTimeLabel"></label>
                            </td>
                        </tr>
                    </table>
                </form>
            </div>
            <div region="south" border="false" style="text-align:center;height:30px;line-height:30px;">
                <a class="easyui-linkbutton" iconCls="icon-cancel" href="javascript:void(0)" onclick="doCancel()">关闭</a>
            </div>
        </div>
</div>

<!-- 优惠券预览 -->
<div id="previewCouponsDlg" class="easyui-window" title="" iconCls="icon-edit" style="width:600px; height:200px;text-align:center; background: #fafafa;">
    <div class="easyui-layout" fit="true">
        <div region="center" border="false" style="background:#fff;border:1px solid #ccc;">
            <div id="showCoupon"></div>
        </div>
    </div>
</div>

 

 

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

var appPath = getAppPath();    
$(function(){
    $('#querySkuCommentDld').window('close');
    $('#editSkuCommentDlg').window('close');
    $('#previewCouponsDlg').window('close');
    $("#sl").combobox({ 
        url:appPath+"/page/memberService/1/commentStateList",
        valueField:"id",  
        textField:"text",
        panelHeight:"auto",
        editable:false
    });
    $('#beginTime').datebox({  
        showSeconds:false,
        editable:false 
    }); 
    $('#endTime').datebox({  
        showSeconds:false,
        editable:false 
    });
    //定义隐藏域,作为容器,存放frame
    createParentHiddenDom("promoteRuleFrameName");
    promoteGrid();
});

function promoteGrid(){
    $('#skuCommentGrid').datagrid({
        url:appPath+'/page/couponType/list',
        method:'post',
//        queryParams:getQueryParam(),
        height:'full',
        width:'full',
        singleSelect:true,
        striped: true,
        remoteSort:false,
        checkbox:false,
        idField:'promoteRuleId',
        frozenColumns:[[
                      {field:'id',title:'操作',width:'80',align:'left',
                      formatter:function(value,rowData,rowIndex){
                              var dataStr = JSON.stringify(rowData);
                              if(rowData.isLimitGoods!="Y"){
                                  return "<a href='javascript:void(0)'><img width='12px' height='12px' style='border:0px;'  src='"+appPath+"/js/lib/jquery-easyui/themes/icons/pencil.png' title='编辑' onClick='querySearch("+dataStr+")'/></a> &nbsp;" +
                                  "<a href='javascript:void(0)'><img width='12px' height='12px' style='border:0px;'  src='"+appPath+"/js/lib/jquery-easyui/themes/icons/cancel.png' title='删除' onClick='del("+dataStr+")'/></a>";
                              }else{
                                  return "<a href='javascript:void(0)'><img width='12px' height='12px' style='border:0px;'  src='"+appPath+"/js/lib/jquery-easyui/themes/icons/pencil.png' title='编辑' onClick='querySearch("+dataStr+")'/></a> &nbsp;" +
                                  "<a href='javascript:void(0)'><img width='12px' height='12px' style='border:0px;'  src='"+appPath+"/js/lib/jquery-easyui/themes/icons/cancel.png' title='删除' onClick='del("+dataStr+")'/></a> &nbsp;"+
                                  "<a href='javascript:void(0)'><img width='12px' height='12px' style='border:0px;'  src='"+appPath+"/js/lib/jquery-easyui/themes/icons/search.png' title='适用商品' onClick='queryGoods("+dataStr+")'/></a>&nbsp; ";
                              }
                              
                      }
                      }
                  ]],
        columns:[[
                  {field:'couponTypeName',title:'优惠券名称',width:150,align:'center',sortable:true},
                  {field:'couponTypeNotes',title:'优惠券描述',width:150,align:'center',sortable:true},
                  {field:'couponFee',title:'优惠券面额',width:80,align:'center',sortable:true},
                  {field:'discountFee',title:'优惠金额',width:60,align:'center',sortable:true},
                  {field:'convertPoints',title:'可兑换积分',width:90,align:'center',sortable:true},
                  {field:'useType',title:'类型',width:80,align:'center',sortable:true,
                      formatter:function(value,rowData,rowIndex){
                              if(rowData.useType=='0'){
                                  return '优惠券';
                              }else if(rowData.useType=='1'){
                                  return '抵用券';
                              }else if(rowData.useType=='2'){
                                  return '折扣券';
                              }else if(rowData.useType=='3'){
                                  return '补偿券';
                              }
                      }
                  },
                  {field:'couponPicUrl',title:'优惠券图片',width:60,align:'center',sortable:true,
                      formatter:function(value,rowData,rowIndex){
                          var dataStr = JSON.stringify(rowData);
//                          return "<img width='20px' height='20px' style='border:0px;'  src='"+appPath+rowData.couponPicUrl+"'/>";
                          return "<img width='12px' height='12px' style='border:0px;cursor:pointer '  src='"+appPath+"/js/lib/jquery-easyui/themes/icons/search.png' title='查看优惠券' onClick='preview("+dataStr+")'/>";
                          }
                  },
                  {field:'orderFeeLimit',title:'订单限额',width:120,align:'center',sortable:true,
                      formatter:function(value,rowData,rowIndex){
                              if(rowData.orderFeeLimit=='0'){
                                  return '无';
                              }else{
                                  return rowData.orderFeeLimit;
                              }
                      }
                  },        
                  {field:'useAmountLimit',title:'限用张数',width:60,align:'center',sortable:true,
                      formatter:function(value,rowData,rowIndex){
                              if(rowData.useAmountLimit=='0'){
                                  return '无';
                              }else{
                                  return rowData.useAmountLimit;
                              }
                      }
                  },
                  {field:'isLimitGoods',title:'适用商品',width:60,align:'center',sortable:true,
                      formatter:function(value,rowData,rowIndex){
                              if(rowData.isLimitGoods=='N'){
                                  return '全部商品';
                              }else if(rowData.isLimitGoods=='H'){
                                  return '海外购商品';
                              }else{
                                  return '指定商品';
                              }
                      }
                  },{field:'standby1',title:'限制次数标志',width:80,align:'center',sortable:true,
                      formatter:function(value,rowData,rowIndex){
                              if(rowData.standby1=='Y'){
                                  return '限制';
                              }else{
                                  return '不限制';
                              }
                      }
                      
                  },{field:'standby4',title:'限制次数',width:60,align:'center',sortable:true,
                      formatter:function(value,rowData,rowIndex){
                              if(rowData.standby4==null){
                                  return 0;
                              }else{
                                  return rowData.standby4;
                              }
                      }
                  },{field:'standby2',title:'手机校验标志',width:80,align:'center',sortable:true,
                      formatter:function(value,rowData,rowIndex){
                              if(rowData.standby2=='Y'){
                                  return '限制';
                              }else{
                                  return '不限制';
                              }
                      }
                  },{field:'limitMemberRoleIds',title:'是否有会员限制',width:80,align:'center',sortable:true,
                      formatter:function(value,rowData,rowIndex){
                          if(rowData.limitMemberRoleIds!=null && rowData.limitMemberRoleIds.length>0){
                              return '有';
                          }else{
                              return '无';
                          }
                      }
                  }
                 ]],
         pagination:true,
         rownumbers:true,
         toolbar:[{
                 id:'btnadd',
                text:'新增优惠券',
                iconCls:'icon-add',
                handler:function(){
                        $(window.parent.document).find("#promoteRuleFrameName").val($(self).attr("name"));
                        parent.addTab("优惠券类型-新增",appPath+"/jsp/promote/ec_coupon_type_add.jsp","icon icon-add",true,"ruleFrame");    
                }
             }
         ]
    });
}

function toDate(str){
    var sd=str.split("-");
    return new Date(sd[0],sd[1],sd[2]);
}
function doQuery(){
    var param = $('#skuCommentGrid').datagrid('options').queryParams;
    param.couponTypeName = $.trim($('#couponTypeName').val());
    param.couponFee = $.trim($('#couponFee').val());
    $("#skuCommentGrid").datagrid('unselectAll');
    $("#skuCommentGrid").datagrid('load',param);
}

//删除数据
function del(rowData){
    $.messager.confirm('提示信息','您确定要删除这条记录?',function(r){
        if(r){
            doAjax({
                url:appPath+'/page/couponType/delEcCouponType',
                type:'post',
                data:{couponTypeId:rowData.couponTypeId,isDelete:'Y'},
                success:function(data){
                    if(data='ok'){
                        $.messager.alert('提示信息','删除成功!','info');
                    }
                    doReload();
                },
                error:function(XMLHttpRequest, textStatus, errorThrown){
                    $.messager.alert('提示信息','删除失败!','info');
                    doReload();
                }
            });    
        }
    });
    
}

function doReload(){
    $('#skuCommentGrid').datagrid('unselectAll');
    $('#skuCommentGrid').datagrid('reload');
}





function querySearch(rowData){
//    $('#realNameLabel').html(rowData.realName);
//    $('#commentTimeLabel').html(rowData.commentTime);
//    $('#goodsNameLabel').html(rowData.goodsName);
//    $('#codeValueLLabel').html(rowData.codeValueL);
//    $('#usefullAmountLabel').html(rowData.usefullAmount);
//    $('#uselessAmountLabel').html(rowData.uselessAmount);
//    $('#commentNotesLabel').html(rowData.commentNotes);
//    $('#useExperienceLabel').html(rowData.useExperience);
//    $('#advantageLabel').html(rowData.advantage);
//    $('#IsDefaultLabel').html(rowData.IsDefault);
//    $('#userNameLabel').html(rowData.userName);
//    $('#auditTimeLabel').html(rowData.auditTime);
//    $('#querySkuCommentDld').window({
//        title:'优惠券类型--编辑',
//        iconCls:'icon-search',
//        width:570,
//        height:360,
//        left:100,
//        modal: true,
//        shadow: true,
//        collapsible:false,
//        minimizable:false,
//        maximizable:false
//    });
//    $('#"editSkuCommentDlg"').window('move',{top:0});
//    $('#"editSkuCommentDlg"').window('open');
    
    var couponTypeId = rowData.couponTypeId;
    
    var url = appPath+"/page/couponType/toEditEcCouponType?couponTypeId="+couponTypeId;
    
    
    $(window.parent.document).find("#promoteRuleFrameName").val($(self).attr("name"));
    parent.addTab("优惠券类型-编辑",url,"icon icon-add",true,"ruleFrame");    

}

//查看适用商品
function queryGoods(rowData){
    $('#querySkuCommentDld').window({
        title:'适用商品',
        iconCls:'icon-search',
        width:570,
        height:360,
        left:100,
        modal: true,
        shadow: true,
        collapsible:false,
        minimizable:false,
        maximizable:false
    });
    $('#querySkuCommentDld').window('move',{top:0});
    $('#querySkuCommentDld').window('open');
    
    goodsGrid(rowData.couponTypeId);
}

function goodsGrid(id){
    $('#addGoodsPromoteGrid').datagrid({
        url:appPath+'/page/couponType/goodsListByCoupon',
        method:'post',
        queryParams:{couponTypeId:id},
        height:240,
        width:'auto',
        singleSelect:true,
        striped: true,
        remoteSort:false,
        checkbox:false,
        idField:'couponTypeGoodsTempId',
//        frozenColumns:[[
//                        {field:'id',title:'操作',width:60,align:'center',
//                          formatter:function(value,rowData,rowIndex){
//                              var dataStr = JSON.stringify(rowData);
//                              return "<a href='javascript:void(0)'><img width='12px' height='12px' style='border:0px;'  src='"+appPath+"/js/lib/jquery-easyui/themes/icons/cancel.png' title='删除' onClick='delGoods("+dataStr+")'/></a>&nbsp;";
//                          }
//                      }
//                  ]],
        columns:[[   
                  {field:'goodsNo',title:'商品编码',width:80,align:'center',sortable:true},
                  {field:'goodsName',title:'商品名称',width:140,align:'left',sortable:true},
                  {field:'unitName',title:'商品单位',width:140,align:'left',sortable:true},
                  {field:'marketPrice',title:'市场价',width:80,align:'right',sortable:true,formatter:function(value){if(!isNaN(Number(value))){return Number(value).toFixed(2)}}},
                  {field:'ecPrice',title:'售价',width:80,align:'right',sortable:true,formatter:function(value){if(!isNaN(Number(value))){return Number(value).toFixed(2)}}},
                  {field:'availableStock',title:'库存',width:80,align:'right',sortable:true,formatter:function(value){if(!isNaN(Number(value))){return Number(value).toFixed(2)}}}
                 ]],     
         pagination:true,
         rownumbers:true
    });
}

function auditCommont(rowData){
    $('#addForm').form('clear');
    $('#addForm').form('load',rowData);
    $('#memberCommentId').val(rowData.memberCommentId);
    $('#realNameLabels').html(rowData.realName);
    $('#commentTimeLabels').html(rowData.commentTime);
    $('#goodsNameLabels').html(rowData.goodsName);
    $('#codeValueLLabels').html(rowData.codeValueL);
    $('#commentNotesLabels').html(rowData.commentNotes);
    $('#useExperienceLabels').html(rowData.useExperience);
    $('#advantageLabels').html(rowData.advantage);
    $('#IsDefaultLabels').html(rowData.IsDefault);
    $('#editSkuCommentDlg').window({
        title:'评价处理-审核',
        iconCls:'icon-reply',
        width:570,
        height:310,
        left:100,
        modal: true,
        shadow: true,
        collapsible:false,
        minimizable:false,
        maximizable:false
    });
    $('#editSkuCommentDlg').window('move',{top:0});
    $('#editSkuCommentDlg').window('open');
}

function doAddSkuComment(id){
    var memberCommentId = $('#memberCommentId').attr('value');
    
    if(id=='audit'){
        doAjax({
            url:appPath+'/page/memberService/saveCommont',
            type:'post',
            data:{memberCommentId:memberCommentId,type:id},
            success:function(data){
                if(data='ok'){
                    $.messager.alert('提示信息','审核成功!','info');
                    $('#editSkuCommentDlg').window('close');
                }
                doReload();
            },
            error:function(XMLHttpRequest, textStatus, errorThrown){
                $.messager.alert('提示信息','审核成功!','info');
                $('#editSkuCommentDlg').window('close');
                doReload();
            }
        });    
    }else{
        doAjax({
            url:appPath+'/page/memberService/saveCommont',
            type:'post',
            data:{memberCommentId:memberCommentId,type:id},
            success:function(data){
                if(data='ok'){
                    $.messager.alert('提示信息','删除成功!','info');
                    $('#editSkuCommentDlg').window('close');
                }
                doReload();
            },
            error:function(XMLHttpRequest, textStatus, errorThrown){
                $.messager.alert('提示信息','删除成功!','info');
                $('#editSkuCommentDlg').window('close');
                doReload();
            }
        });    
    }
        
}



function doCancel(){
    $('#sendSmsDld').window('close');
    $('#querySkuCommentDld').window('close');
    $('#editSkuCommentDlg').window('close');
}

function delData(rowData){
    doAjax({
        url:appPath+'/page/memberService/saveCommont',
        type:'post',
        data:{memberCommentId:rowData.memberCommentId,type:"del"},
        success:function(data){
            if(data='ok'){
                $.messager.alert('提示信息','删除成功!','info');
                $('#replayDlg').window('close');
            }
            doReload();
        },
        error:function(XMLHttpRequest, textStatus, errorThrown){
            $.messager.alert('提示信息','删除成功!','info');
            $('#replayDlg').window('close');
            doReload();
        }
    });    
}

//优惠券预览
function preview(rowData){
    $('#previewCouponsDlg').window({
        title:'优惠券预览',
        iconCls:'icon-add',
        width:300,
        height:300,
        left:100,
        modal: true,
        shadow: true,
        collapsible:false,
        minimizable:false,
        maximizable:false
    });
    $('#previewCouponsDlg').window('move',{top:0});
    $('#previewCouponsDlg').window('open');
    var picUrl = "<img width='200px' height='200px' style='border:0px;'  src='"+appPath+rowData.couponPicUrl+"'/>";
    document.getElementById('showCoupon').innerHTML=picUrl;
}

 



 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值