自用ajxa 后台管理请求
/**
* 保存或者修改商品信息
* @returns
*/
function saveOrUpdateBaseGoodInfo(){
var json={};
var goodName=$.trim($("#goodName").val());
if(!goodName){
Feng.info("商品名称不能为空!");
return;
}
json["name"]=goodName;
var keyword=$.trim($("#keyword").val());
if(!keyword){
Feng.info("商品关键词不能为空!");
return;
}
json["label"]=keyword;
var price=$.trim($("#price").val());
if(!price){
Feng.info("价格不能为空!");
return;
}
if(isNaN(price)){
Feng.info("价格请输入数字类型!");
return;
}
json["price"]=price;
var unit=$.trim($("#unit").val());
if(!unit){
Feng.info("单位不能为空!");
return;
}
json["unit"]=unit;
var volume=$.trim($("#volume").val());
if(!volume){
Feng.info("销量不能为空!");
return;
}
if(isNaN(volume)){
Feng.info("销量请输入数字类型!");
return;
}
json["volume"]=volume;
var jiFenBili=$.trim($("#jiFenBili").val());
if(!jiFenBili){
Feng.info("积分购买赠送比例不能为空!");
return;
}
if(isNaN(jiFenBili)){
Feng.info("积分购买赠送比例请输入数字类型!");
return;
}
json["receivableIntegrateRate"]=jiFenBili;
var jiFenDkBili=$.trim($("#jiFenDkBili").val());
if(!jiFenDkBili){
Feng.info("积分购买最大抵扣比例不能为空!");
return;
}
if(isNaN(jiFenDkBili)){
Feng.info("积分购买最大抵扣比例请输入数字类型!");
return;
}
json["maxPayIntegrateRate"]=jiFenDkBili;
var trs=$(".table-responsive table tbody tr");
var consumerSalePercentage1=trs[0].cells[1].childNodes[0].value;
var consumerSalePercentage2=trs[0].cells[2].childNodes[0].value;
var consumerSaleMoney1=trs[0].cells[3].childNodes[0].value;
var consumerSaleMoney2=trs[0].cells[4].childNodes[0].value;
var salePercentage1=trs[1].cells[1].childNodes[0].value;
var salePercentage2=trs[1].cells[2].childNodes[0].value;
var saleMoney1=trs[1].cells[3].childNodes[0].value;
var saleMoney2=trs[1].cells[4].childNodes[0].value;
//消费者
if(consumerSalePercentage1==null||consumerSalePercentage1==""||consumerSalePercentage1==undefined){
Feng.info("消费者一级分佣比例不能为空!");
return;
}
if(isNaN(consumerSalePercentage1)){
Feng.info("消费者一级分佣比例请输入数字类型!");
return;
}
if(consumerSalePercentage2==null||consumerSalePercentage2==""||consumerSalePercentage2==undefined){
Feng.info("消费者二级分佣比例不能为空!");
return;
}
if(isNaN(consumerSalePercentage2)){
Feng.info("消费者二级分佣比例请输入数字类型!");
return;
}
if(consumerSaleMoney1==null||consumerSaleMoney1==""||consumerSaleMoney1==undefined){
Feng.info("消费者一级固定分佣不能为空!");
return;
}
if(isNaN(consumerSaleMoney1)){
Feng.info("消费者一级固定分佣请输入数字类型!");
return;
}
if(consumerSaleMoney2==null||consumerSaleMoney2==""||consumerSaleMoney2==undefined){
Feng.info("消费者二级固定分佣不能为空!");
return;
}
if(isNaN(consumerSaleMoney2)){
Feng.info("消费者二级固定分佣请输入数字类型!");
return;
}
//分销员
if(salePercentage1==null||salePercentage1==""||salePercentage1==undefined){
Feng.info("分销员一级分佣比例不能为空!");
return;
}
if(isNaN(salePercentage1)){
Feng.info("分销员一级分佣比例请输入数字类型!");
return;
}
if(salePercentage2==null||salePercentage2==""||salePercentage2==undefined){
Feng.info("分销员二级分佣比例不能为空!");
return;
}
if(isNaN(salePercentage2)){
Feng.info("分销员二级分佣比例请输入数字类型!");
return;
}
if(saleMoney1==null||saleMoney1==""||saleMoney1==undefined){
Feng.info("分销员一级固定分佣不能为空!");
return;
}
if(isNaN(saleMoney1)){
Feng.info("分销员一级固定分佣请输入数字类型!");
return;
}
if(saleMoney2==null||saleMoney2==""||saleMoney2==undefined){
Feng.info("分销员二级固定分佣不能为空!");
return;
}
if(isNaN(saleMoney2)){
Feng.info("分销员二级固定分佣请输入数字类型!");
return;
}
json["salePercentage1"]=salePercentage1;
json["salePercentage2"]=salePercentage2;
json["saleMoney1"]=saleMoney1;
json["saleMoney2"]=saleMoney2;
json["consumerSalePercentage1"]=consumerSalePercentage1;
json["consumerSalePercentage2"]=consumerSalePercentage2;
json["consumerSaleMoney1"]=consumerSaleMoney1;
json["consumerSaleMoney2"]=consumerSaleMoney2;
var commonMoney=$.trim($("#commonMoney").val());
json["commonMoney"]=commonMoney;
if(!commonMoney){
Feng.info("消费者固定佣金不能为空!");
return;
}
if(isNaN(commonMoney)){
Feng.info("消费者固定佣金请输入数字类型!");
return;
}
if(parseFloat(saleMoney1)+parseFloat(saleMoney2)>parseFloat(price)){
Feng.info("分销员固定分佣之和大于销售价,无法提交");
return;
}
if(parseFloat(consumerSaleMoney1)+parseFloat(consumerSaleMoney2)
+parseFloat(commonMoney)>parseFloat(price)){
Feng.info("消费者固定分佣与消费者固定返现金额大于销售价,无法提交");
return;
}
var flag=true;
var $inputDomList=$("#paramList input");
for(var i=0;i<$inputDomList.length;i++){
if(!$inputDomList[i].value){
flag=false;
break;
}
flag=true;
}
if(!flag){
Feng.info("规格参数还有未填写的,请检查一遍!");
return;
}
var parameterArr=new Array();
$("#paramList div").each(function(){
var parameterJson=new Object();
if($(this).find("input").eq(0).val()&&$(this).find("input").eq(1).val()){
parameterJson.name=$(this).find("input").eq(0).val();
parameterJson.value=$(this).find("input").eq(1).val();
parameterArr.push(parameterJson);
}
});
json["parameter"]=JSON.stringify(parameterArr);
var brandPic=$("#brandPic").attr("src");
if(!brandPic){
Feng.info("商品预览图不能为空!");
return;
}
json["preview"]=brandPic;
var detailPic=$("#detailPic").attr("src");
if(!detailPic){
Feng.info("商品详情图不能为空!");
return;
}
json["imageSrc"]=detailPic;
var serviceJsonArr=[];
$("[name=arr2]:checked").each(function(){
var serviceJson={};
serviceJson.name=$(this).next().text();
serviceJson.value=$(this).val();
serviceJsonArr.push(serviceJson);
});
if(!serviceJsonArr.length){
Feng.info("请勾选商品服务!");
return;
}
json["serviceDetails"]=JSON.stringify(serviceJsonArr);
var goodLabelJsonArr=[];
$("#paramList1 div").each(function(){
var selectJson={};
$(this).find("select").each(function(){
var name=$(this).find("option:selected").text();
var value=$(this).find("option:selected").val();
if(this.id=="firstLabelSelect"){
if(name!='请选择'&&name){
selectJson["firstName"]=name;
selectJson["firstValue"]=parseInt(value,10);
}
}
if(this.id=="secondLabelSelect"){
if(name!='请选择'&&name){
selectJson["secondName"]=name;
selectJson["secondValue"]=parseInt(value,10);
} }
if(this.id=="thirdLabelSelect"){
if(name!='请选择'&&name){
selectJson["thirdName"]=name;
selectJson["thirdValue"]=parseInt(value,10);
} }
});
if(JSON.stringify(selectJson)!="{}"){
goodLabelJsonArr.push(selectJson);
} });
var isUniversal=$("[name=isUniversal]:checked").val();
if(isUniversal=="0"){
if(!goodLabelJsonArr.length){
Feng.info("请选择商品筛选标签");
return;
}
}
json["isUniversal"]=isUniversal;
json["goodLabelJson"]=goodLabelJsonArr.length?JSON.stringify(goodLabelJsonArr):"";
json["shoppingMethods"]=$("[name=shoppingMethods]:checked").val()==undefined?0:$("[name=shoppingMethods]:checked").val();
var ue = UE.getEditor('editor');
json["intro"]=ue.getContent();
var relGoodArr=new Array();
$("#z-tre li").each(function(){
if(relGoodArr.indexOf(this.id)==-1){
relGoodArr.push(this.id);
}
});
json["relGoodId"]=relGoodArr.toString();
json["id"]=$("#goodId").val()?$("#goodId").val():null;
$.ajax({
url : Feng.ctxPath + '/goodBase/saveorupdatebasegoodinfo',
type : 'POST',
contentType : 'application/json;charset=UTF-8',
dataType : 'json',
cache : false,
data : JSON.stringify(json),
success : function(result) {
if(result&&result.success){
Feng.info("操作成功!");
window.location.href=Feng.ctxPath + '/goodBase'
}else{
Feng.info(result.error);
}
}
});
}
/**
* 提交商品信息
* @param map
* @return
*/
@SuppressWarnings("unchecked")
@BussinessLog(value = "新增或修改商品信息", key = "saveorupdatebasegoodinfo")
@RequestMapping("/saveorupdatebasegoodinfo")
@ResponseBody
public JSONResponse saveOrUpdateBaseGoodinfo(@RequestBody Map<String,Object>map,HttpServletRequest request) {
JSONResponse jsonResponse=new JSONResponse();
HttpSession session=request.getSession(false);
if(session==null) {
throw new RuntimeException("session已经超时!");
}
Map<String,Object>firstMap=(Map<String, Object>) session.getAttribute("map");
firstMap.putAll(map);
GoodsBaseInfo goodsBaseInfo=new GoodsBaseInfo();
MapUtils.mapToJavaBean(goodsBaseInfo,GoodsBaseInfo.class,firstMap);
GoodsBaseInfoVO goodsBaseInfoVO=new GoodsBaseInfoVO();
BeanUtils.copyProperties(goodsBaseInfo, goodsBaseInfoVO);
goodsBaseInfoVO.setCreator(ShiroKit.getUser().getId());
goodsBaseInfoVO.setModifier(ShiroKit.getUser().getId());
goodsBaseInfoVO.setRelGoodId(map.get("relGoodId")+"");
goodsBaseInfoVO.setCreated(new Date());
goodsBaseInfoVO.setModified(new Date());
goodsBaseInfoVO.setIsDeleted(CommonConst.NO);
goodsBaseInfoVO.setIsEnable(CommonConst.YES);
Integer goodId=goodsBaseInfoVO.getId();
List<GoodsBaseInfo>goodsBaseInfoList=null;
if(goodId==null) {
goodsBaseInfoList=this.iGoodsBaseInfoService.selectList(new EntityWrapper<GoodsBaseInfo>()
.addFilter("name={0}", goodsBaseInfoVO.getName()));
}else {
goodsBaseInfoList=this.iGoodsBaseInfoService.selectList(new EntityWrapper<GoodsBaseInfo>()
.addFilter("name={0}", goodsBaseInfoVO.getName()).ne("id", goodId));
}
if(goodsBaseInfoList.size()>0) {
jsonResponse.setSuccess(Boolean.FALSE);
jsonResponse.setError("商品名称已经存在!");
return jsonResponse;
}
this.iGoodsBaseInfoService.insertGoodBaseInfo(goodsBaseInfoVO);
jsonResponse.setSuccess(Boolean.TRUE);
return jsonResponse;
}
自用ajxa 后台管理请求的更多相关文章
- C#开发微信门户及应用(47) - 整合Web API、微信后台管理及前端微信小程序的应用方案
在微信开发中,我一直强调需要建立一个比较统一的Web API接口体系,以便实现数据的集中化,这样我们在常规的Web业务系统,Winform业务系统.微信应用.微信小程序.APP等方面,都可以直接调用基 ...
- vue,vuex的后台管理项目架子structure-admin,后端服务nodejs
之前写过一篇vue初始化项目,构建vuex的后台管理项目架子,这个structure-admin-web所拥有的功能 接下来,针对structure-admin-web的不足,进行了补充,开发了具有登 ...
- vue初始化项目,构建vuex的后台管理项目架子
构架vuex的后台管理项目源码:https://github.com/saucxs/structure-admin-web 一.node安装 可以参考这篇文章http://www.mwcxs.top/ ...
- Django学习笔记(2)——模型,后台管理和视图的学习
一:Web投票示例 本节我们首先从全局范围再复习一下Django的概念,让自己对Django的设计理念, 功能模块,体系架构,基本用法有初步的印象. Django初始的详细博客内容:请点击我 该应用包 ...
- Asp.NetMVC利用LigerUI搭建一个简单的后台管理详解(函登录验证)
上一篇 Asp.Net 中Grid详解两种方法使用LigerUI加载数据库数据填充数据分页 了解了LigerUI 中Grid的基本用法 现在结合上一篇的内容做一个简单的后台管理,当然也有前台的页面 ...
- 使用vuejs2.0和element-ui 搭建的一个后台管理界面
说明: 这是一个用vuejs2.0和element-ui搭建的后台管理界面. 相关技术: vuejs2.0:一套构建用户界面的渐进式JavaScript框架,易用.灵活.高效. element-ui: ...
- python 全栈开发,Day83(博客系统子评论,后台管理,富文本编辑器kindeditor,bs4模块)
一.子评论 必须点击回复,才是子评论!否则是根评论点击回复之后,定位到输入框,同时加入@评论者的用户名 定位输入框 focus focus:获取对象焦点触发事件 先做样式.点击回复之后,定位到输入框, ...
- JAVAEE——Solr:安装及配置、后台管理索引库、 使用SolrJ管理索引库、仿京东的电商搜索案例实现
1 学习回顾 1. Lucene 是Apache开源的全文检索的工具包 创建索引 查询索引 2. 遇到问题? 文件名 及文件内容 顺序扫描法 全文检索 3. 什么是全文检索? 这种先创建索引 再 ...
- day20 project+查看新闻列表 + 点赞 + 图片验证码 + 评论和多级评论 + 后台管理 + webSocket + kindEditor
Day20回顾: 1. 请求生命周期 2. 中间件 md = [ "file_path.classname" ] process_request[可有可无] process_res ...
随机推荐
- C++ 多态详解及常见面试题
今天,讲一讲多态: 多态就是不同对象对同一行为会有不同的状态.(举例 : 学生和成人都去买票时,学生会打折,成人不会) 实现多态有两个条件: 一是虚函数重写,重写就是用来设置不同状态的 二是对象调 ...
- Android--Facebook Login with LoginButton
1.Layout文件添加Facebook的LoginBurtton <com.facebook.widget.LoginButton android:id="@+id/authButt ...
- golang ---网卡信息
package main import ( "fmt" "log" "net" "strings" ) type Net ...
- Coldfusion Sql查询分组输出
<cfoutput query="myQry" group="date"> #date# <cfoutput> #detail# < ...
- RedisCluster的rename机制失败报错,解决又是数据倾斜问题
需求说明:spring session中的用户session更新是更新key的名字,所以对于key的操作时需要用newkey 替换oldkey value值只允许存在一个,这里用到rename就很合适 ...
- windows的bpython安装方法以及数据库报错--记录
---恢复内容开始--- 安装bpython的时候发现了一个博客讲解如何成功安装bpython,分享一下链接http://www.cnblogs.com/zhaojiedi1992/p/zhaojie ...
- Elasticsearch 7.x - IK分词器插件(ik_smart,ik_max_word)
一.安装IK分词器 Elasticsearch也需要安装IK分析器以实现对中文更好的分词支持. 去Github下载最新版elasticsearch-ik https://github.com/medc ...
- Centos7.4(阿里云环境)挂载数据盘
Centos7.4(阿里云环境)挂载数据盘 2018.08.29 10:19 947浏览 查看数据盘 disk -l 磁盘 /dev/vda:42.9 GB, 42949672960 字节,83886 ...
- 网卡启动安装dell服务器OS
参照视频 需要将boot改成bois启动 https://www.dell.com/support/contents/cn/zh/cndhs1/videos/videoPlayer/k1ajZzdjo ...
- Kotlin构造方法详解与初始化过程分析
在上一次https://www.cnblogs.com/webor2006/p/11192025.html已经初识了Kolin的面向对象,先来回顾一下: 介绍了primary 构造方法,其特点回忆一下 ...