博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
营销系统--手动补偿
阅读量:5966 次
发布时间:2019-06-19

本文共 14192 字,大约阅读时间需要 47 分钟。

 

{field:'opts',title:'补偿操作',width:250,align:'center',sortable:true,                  formatter:function(value,rowData,rowIndex){                      return "" +                               "";                  }                }
function bcShow(id){    $("#memberIdOrOrderId"+id).val("请输入会员账号/订单号");    $("#memberIdOrOrderId"+id).focus(function(){          $("#memberIdOrOrderId"+id).val("");    });    $("#bcSh"+id).hide();    $("#bcSa"+id).show();}
//补偿,添加function bcSave(id){    //添加补偿    var compensatingLog = new Object();    compensatingLog.compensationtypeId =id;    compensatingLog.memberId = $("#memberIdOrOrderId"+id).val();    doAjax({        url : appPath + '/page/compensatingLogAct/save',        type : 'post',        data : compensatingLog,        success : function(data) {            if(data=='ok'){                $.messager.alert('提示信息', '添加成功', 'info');                $("#bcSh"+id).show();                $("#bcSa"+id).hide();                $("#memberIdOrOrderId"+id).val("请输入会员账号/订单号");            }else{                $.messager.alert('提示信息', data, 'info');            }        }    });}
package com.founder.ec.promote.action;import java.util.*;import javax.servlet.http.*;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.stereotype.Controller;import org.springframework.web.bind.annotation.RequestMapping;import org.springframework.web.bind.annotation.ResponseBody;import com.founder.ec.base.action.BaseClassAction;import com.founder.ec.common.service.MemberCommonService;import com.founder.ec.member.model.Member;import com.founder.ec.order.model.OrderInfo;import com.founder.ec.promote.model.CompensatingLog;import com.founder.ec.promote.model.Compensationtype;import com.founder.ec.promote.model.EcCouponPublish;import com.founder.ec.promote.service.CompensatingLogService;import com.founder.ec.promote.service.CompensationtypeService;import com.founder.ec.promote.service.EcCouponPublishService;import com.j1.base.dto.ServiceMessage;import com.j1.base.order.dto.CouponsAssignParam;import com.j1.base.order.model.EcCoupons;import com.j1.base.type.MsgStatus;import com.j1.member.model.MemberPointsHis;import com.j1.member.model.MemberPointsSetting;import com.j1.soa.resource.member.api.MemberPointHisService;import com.j1.soa.resource.order.api.EcCouponsService;/** * @author liuyuandi 2015年9月15日 下午1:18:42 * @since 1.0.0 */@Controller@RequestMapping(value="/compensatingLogAct")public class CompensatingLogAction extends BaseClassAction
{ @Autowired private CompensatingLogService compensatingLogService; @Autowired private MemberPointHisService memberPointHisService; @Autowired private MemberCommonService memberCommonService; @Autowired private CompensationtypeService compensationtypeService; @Autowired private EcCouponPublishService ecCouponPublishService; @Autowired private EcCouponsService ecCouponsService; /** *@description查询补偿记录 */ @RequestMapping(value="/getPage") @ResponseBody public Map
getPage(HttpServletRequest request,CompensatingLog compensatingLog) { int pageSize=10,pageNo=1; pageNo = Integer.parseInt(request.getParameter("page")); pageSize= Integer.parseInt(request.getParameter("rows")); return compensatingLogService.getPage(compensatingLog, pageNo, pageSize); } /** *@description 保存或者更新 */ @RequestMapping(value="/save") @ResponseBody public String updateOrSave(HttpServletRequest request,HttpServletResponse response,CompensatingLog compensatingLog) { Long memberId=0l; //会员是否存在(由于输入的可能是会员账号(登录名)或是订单ID) String loginName=compensatingLog.getMemberId(); Member mm=memberCommonService.getMemberByLoginname(loginName); OrderInfo o=new OrderInfo(); try { if(mm==null){ o.setOrderId(new Long(loginName)); OrderInfo order=compensatingLogService.getOrderObj(o); if(order==null){ return "不存在此会员或是此订单"; }else{ memberId=order.getMemberId(); } }else{ memberId=mm.getMemberId(); } } catch (NumberFormatException e) { return "不存在此会员或是此订单"; } Compensationtype type=new Compensationtype(); type.setId(new Long(compensatingLog.getCompensationtypeId())); Compensationtype compensationtype=compensationtypeService.getCompensationtype(type); //根据补偿ID查询(积分,优惠券)优惠券类型的所有发放批次取都大于三十天中的有限期最短的可用优惠券进行发放 if(compensationtype.getCompensatingForm().equals("coupon")){ //发放优惠券调用发放优惠券的接口 EcCouponPublish ecCouponPublish=new EcCouponPublish(); ecCouponPublish.setCouponTypeId(new Integer(compensationtype.getCompensatingContent())); List
couponList=ecCouponPublishService.getUnUsedEcCouponPublishTime(ecCouponPublish); int publishId=0; if(couponList.size()>0){ publishId=couponList.get(0).getPublishId(); }else{ return "此类型优惠券没有批次大于30天的可用优惠券"; } CouponsAssignParam param = new CouponsAssignParam(); /*会员id*/ param.setMemberId(memberId); /*批次号*/ param.setPublishId(publishId); /*领取数量*/ param.setAssignCouponsCount(1); /*调用服务 saveCouponsByMemberToPublishId*/ ServiceMessage
> msg = ecCouponsService.saveCouponsByMemberToPublishId(param); if(!msg.getStatus().equals(MsgStatus.NORMAL)){ logger.error("优惠券SOA服务异常"); return msg.getMessage(); } }else if(compensationtype.getCompensatingForm().equals("integral")){ //积分调用积分的接口 MemberPointsHis mem=new MemberPointsHis(); mem.setMemberId(memberId); mem.setPoints(new Integer(compensationtype.getCompensatingContent())); MemberPointsSetting set=new MemberPointsSetting(); set.setPointsType("manual_points"); //member_points_setting表中的人工添加 ServiceMessage
msgRes=memberPointHisService.changePointsNoRankId(mem, set); //添加积分 if(!msgRes.getStatus().equals(MsgStatus.NORMAL)){ logger.error("积分SOA服务异常"); return "补偿积分添加失败"; } } String userId=request.getSession().getAttribute("userId").toString(); super.bindingProperty(compensatingLog, userId); compensatingLog.setMemberId(memberId.toString()); compensatingLogService.save(compensatingLog); return "ok"; }}
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%><%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
补偿理由 补偿形式
补偿类型 查  询
补偿理由
补偿形式 优惠券   积分
选择优惠券
请输入补偿积分
var appPath = getAppPath();    $(function(){  $("#opreateHtml").window("close");  $("#coupon").show();  $("#integral").hide();   $("#addcompensatingContentCoupon").combobox({         url:appPath+"/page/compensationtypeAct/ecCouponTypeSelect",        valueField:"id",          textField:"text",        panelHeight:"auto",        editable:false    });  $("#compensatingContent").combobox({         url:appPath+"/page/compensationtypeAct/ecCouponTypeSelect",        valueField:"id",          textField:"text",        panelHeight:"auto",        editable:false    });  $("#deliveryGrid").datagrid({    url:appPath+"/page/compensationtypeAct/getPage",    height:"full",    striped:true,    remoteSort:false,    pagination:true,    rownumbers:false,    singleSelect:false,    queryParams:getQueryParam(),    columns:[[              {field:"opt",title:"操作",width:60,align:"center",                  formatter:function(value,rowData,rowIndex){                    var html="";                    return html;                  }               },              {field:'giveExcuse',title:'补偿理由',width:100,align:'center',sortable:true},              {field:'compensatingForm',title:'补偿形式',width:100,align:'center',sortable:true,                  formatter:function(value){                      if(value=="coupon"){                          return "优惠券";                      }else if(value=="integral"){                          return "积分";                      }else{                          return value;                      }                  }              },              {field:'compensatingContent',title:'补偿内容',width:100,align:'center',sortable:true},              {field:'opts',title:'补偿操作',width:250,align:'center',sortable:true,                  formatter:function(value,rowData,rowIndex){                      return "" +                               "";                  }                }   ]],   onLoadSuccess: function(data) {       for (var int = 0; int < data.total; int++) {          $("#bcSa"+data.rows[int].id).hide();       }   },   toolbar:[      {          id:'btnadd',          text:'创建补偿类型',          iconCls:'icon-add',          handler:function(){                 showWin(null);          }          }   ] });});function getQueryParam(){  var compensationtype =new Object();      compensationtype.compensatingContent=$("#compensatingContent").combobox("getValue");      compensationtype.giveExcuse=$.trim($("#giveExcuse").val());      compensationtype.compensatingForm=$("#compensatingForm").combobox("getValue");  return compensationtype;}function doQuery(){  $("#deliveryGrid").datagrid('load',getQueryParam());}function deletes(id){    var ids = id+',';    $.messager.confirm('提示',"确定要删除此数据吗?",function(r){       if(r){            $.post(                   appPath+"/page/compensationtypeAct/deleteIdsLogic",                    {
"ids":ids}, function(data){ $.messager.alert('提示','删除成功',''); doQuery(); }); } });}function showWin(){ if(!checkUserButtonRight('compensationtype')){ return ; } $("#idHidden").val(""); $("#addcompensatingContentIntegral").val(""); $("#addcompensatingContentCoupon").combobox("setValue",""); $("#addgiveExcuse").val(""); $("#addcompensatingForm").val(""); var iconStr="icon-add"; var title="添加补偿类型"; $('#opreateHtml').window({ title:title, iconCls:iconStr, width:350, height:220, left:200, modal: true, shadow: true, collapsible:false, minimizable:false, maximizable:false }); $('#opreateHtml').window('move',{top:100}); $('#opreateHtml').window('open');}function closeWin(id){ $('#opreateHtml').window('close');}function save(){ var compensationtype=new Object(); compensationtype.id=$("#idHidden").val(); if($("#addgiveExcuse").val()==null||$("#addgiveExcuse").val()==""){ $.messager.alert('提示','请填写补偿理由','info'); return; } compensationtype.giveExcuse=$("#addgiveExcuse").val(); compensationtype.compensatingForm=$('input:radio[name="addcompensatingForm"]:checked').val(); if($('input:radio[name="addcompensatingForm"]:checked').val()=="coupon"){ if($("#addcompensatingContentCoupon").combobox("getValue")==null||$("#addcompensatingContentCoupon").combobox("getValue")==""){ $.messager.alert('提示','请选择优惠券','info'); return; } compensationtype.compensatingContent=$("#addcompensatingContentCoupon").combobox("getValue"); }else if($('input:radio[name="addcompensatingForm"]:checked').val()=="integral"){ if($("#addcompensatingContentIntegral").val()==null||$("#addcompensatingContentIntegral").val()==""){ $.messager.alert('提示','请填写积分','info'); return; } compensationtype.compensatingContent=$("#addcompensatingContentIntegral").val(); } doAjax({ url:appPath+'/page/compensationtypeAct/saveOrUpdate', type:'post', data:compensationtype, success:function(data){ $.messager.alert('提示','保存成功','info'); $('#opreateHtml').window('close'); doQuery(); } });}function addcompensatingFormShow(type){ switch(type){ case "coupon": $("#coupon").show(); $("#integral").hide(); break; case "integral": $("#integral").show(); $("#coupon").hide(); break; default: $("#coupon").show(); $("#integral").hide(); break; } }//补偿function bcSave(id){ //添加补偿 var compensatingLog = new Object(); compensatingLog.compensationtypeId =id; compensatingLog.memberId = $("#memberIdOrOrderId"+id).val(); doAjax({ url : appPath + '/page/compensatingLogAct/save', type : 'post', data : compensatingLog, success : function(data) { if(data=='ok'){ $.messager.alert('提示信息', '添加成功', 'info'); $("#bcSh"+id).show(); $("#bcSa"+id).hide(); $("#memberIdOrOrderId"+id).val("请输入会员账号/订单号"); }else{ $.messager.alert('提示信息', data, 'info'); } } });}function bcShow(id){ $("#memberIdOrOrderId"+id).val("请输入会员账号/订单号"); $("#memberIdOrOrderId"+id).focus(function(){ $("#memberIdOrOrderId"+id).val(""); }); $("#bcSh"+id).hide(); $("#bcSa"+id).show();}

 

 

 

 

 

=========================知识点================================

 

 

 

 

不同的补偿形式,有着不同的选项.

 

1  2                补偿形式3                4                    优惠券  5                    积分6                7             
               选择优惠券                                                      请输入补偿积分                           
 

 

 
onclick方法的使用:
//展示,隐藏function addcompensatingFormShow(type){    switch(type){    case "coupon":        $("#coupon").show();        $("#integral").hide();         break;    case "integral":        $("#integral").show();         $("#coupon").hide();        break;    default:         $("#coupon").show();         $("#integral").hide();         break;    } }

 

转载地址:http://pamax.baihongyu.com/

你可能感兴趣的文章
开始记录吧
查看>>
windows下用php开发类似百度文库应用需要的工具和问题
查看>>
css模拟select设置高度在ie67下有效(也可作为去除边框)
查看>>
互联网思维
查看>>
ecshop备份数据 ecshop转移数据 ecshop更换主机
查看>>
手机将与瘦客户机争夺办公桌面
查看>>
ubuntu下针对php的thrift 安装折腾记录
查看>>
使用C#客户端访问FTP服务的一个解决方案
查看>>
对软件测试团队“核心价值”的思考
查看>>
深入理解html5系列-文本标签
查看>>
mysql基础知识点
查看>>
Microsoft.System.Center.Operations.Manager.2007 中文版完整光盘下载地址
查看>>
Python快速教程
查看>>
我的友情链接
查看>>
ssh免密码登录
查看>>
Linux下Django环境安装
查看>>
如何在指定的内容中找出指定字符串的个数
查看>>
我的友情链接
查看>>
浅谈如何用We7站群平台打造垂直性政务网站
查看>>
我的友情链接
查看>>