From 95f9ea7eb339c36cade6c67d0385c49ec2d81477 Mon Sep 17 00:00:00 2001 From: 935090232@qq.com <ak473600000> Date: Wed, 14 Apr 2021 19:39:45 +0800 Subject: [PATCH] Merge branch 'score_shop' into api_score_meger --- zq-erp/src/main/resources/templates/views/admin/shop/shopProduct-form.html | 204 +++++++++++++++++++++++++++++++++++--------------- 1 files changed, 143 insertions(+), 61 deletions(-) diff --git a/zq-erp/src/main/resources/templates/views/admin/shop/shopProduct-form.html b/zq-erp/src/main/resources/templates/views/admin/shop/shopProduct-form.html index 47957c3..d8ed383 100644 --- a/zq-erp/src/main/resources/templates/views/admin/shop/shopProduct-form.html +++ b/zq-erp/src/main/resources/templates/views/admin/shop/shopProduct-form.html @@ -42,7 +42,7 @@ <div class="panel-heading">基本信息</div> <div class="panel-body"> <div class="form-group"> - <label class="col-sm-2 control-label">分类ID + <label class="col-sm-2 control-label">产品分类 <span class="text-danger">*</span> </label> <div class="col-sm-4"> @@ -69,6 +69,40 @@ maxLength="1000" dataType="*" th:value="${obj.briefIntroduction}" nullmsg="产品简介不能为空"> </div> + <label class="col-sm-2 control-label">是否可分销 + <span class="text-danger">*</span> + </label> + <div class="col-sm-4"> + <select th:field="${obj.ableSales}" class="form-control select2 " size="1" + name="ableSales" + id="ableSales" style="width: 100%"> + <option value="1" th:selected="${obj.ableSales == '1'}">可分销</option> + <option value="2" th:selected="${obj.ableSales == '2'}">不可分销</option> + </option> + </select> + </div> + </div> + <div class="form-group"> + <label class="col-sm-2 control-label">是否积分抵 + <span class="text-danger">*</span> + </label> + <div class="col-sm-4"> + <select th:field="${obj.ableScorePay}" class="form-control select2 " size="1" + name="ableScorePay" + id="ableScorePay" style="width: 100%"> + <option value="2" th:selected="${obj.ableScorePay == '2'}">不可抵扣</option> + <option value="1" th:selected="${obj.ableScorePay == '1'}">可抵扣</option> + </option> + </select> + </div> + <label class="col-sm-2 control-label">积分商城分类 + <span class="text-danger">*</span> + </label> + <div class="col-sm-4"> + <select class="form-control select2 " size="1" name="scoreCategoryId" + id="scoreCategoryId" style="width: 100%"> + </select> + </div> </div> <div class="form-group"> @@ -87,14 +121,7 @@ dataType="n" nullmsg="展示销量不能为空" th:value="${obj.dsVolume}" errormsg="请填写数字"> </div> - <!--<label class="col-sm-2 control-label">运费 - <span class="text-danger">*</span> - </label> - <div class="col-sm-4"> - <input autocomplete="off" type="text" class="form-control" name="carriage" - maxLength="250" datatype="*" - th:value="${obj.carriage}" nullmsg="运费不能为空"> - </div>--> + </div> <div class="form-group"> <label class="col-sm-2 control-label">限购数量 @@ -117,42 +144,7 @@ </div> </div> - <div class="form-group"> - <label class="col-sm-2 control-label">是否为服务项目 - </label> - <div class="col-sm-4"> - <select th:field="${obj.isService}" class="form-control " size="1" - name="isService" - id="isService" style="width: 100%"> - <option value="2" th:selected="${obj.isService == '2'}">否</option> - <option value="1" th:selected="${obj.isService == '1'}">是</option> - </option> - - </select> - </div> - - <label class="col-sm-2 control-label">服务时长 - </label> - <div class="col-sm-4"> - <input autocomplete="off" type="text" class="form-control" name="serviceTime" - maxLength="50" - th:value="${obj.serviceTime}" > - </div> - - - </div> - - <!--<div class="form-group"> - - <label class="col-sm-2 control-label">真实销量 - </label> - <div class="col-sm-4"> - <input autocomplete="off" type="text" class="form-control" name="rsVolume" - - th:value="${obj.rsVolume}" errormsg="请填写数字"> - </div> - </div>--> <div class="form-group"> <label class="col-sm-2 control-label">属性设置 </label> <input autocomplete="off" name="attrs" id="attrs" type="hidden" > @@ -226,9 +218,14 @@ <th>规格图片地址<span class="text-danger">*</span></th> <th>库存<span class="text-danger">*</span></th> <th>价格<span class="text-danger">*</span></th> - <th>积分</th> + <th>消费可得积分</th> <th>关联ERP产品</th> <th>排序</th> + <th>自购返佣</th> + <th>推广提成</th> + <th>邀请提成</th> + <th>兑换所需金额</th> + <th>兑换所需积分</th> <th>操作</th> </tr> </table> @@ -357,6 +354,11 @@ <input autocomplete="off" type="hidden" class="form-control" name="erpGoodsCode"> </div></td> <td><input autocomplete="off" type="text" class="form-control" name=""></td> + <td><input autocomplete="off" type="text" class="form-control" name=""></td> + <td><input autocomplete="off" type="text" class="form-control" name=""></td> + <td><input autocomplete="off" type="text" class="form-control" name=""></td> + <td><input autocomplete="off" type="text" class="form-control" name=""></td> + <td><input autocomplete="off" type="text" class="form-control" name=""></td> <td><i class="fa fa-trash form-control-static" onclick="delThis('trId')"></i></td> </tr> </script> @@ -391,6 +393,9 @@ }); $(function () { initSeclect("#parentId",[[${obj.categoryId}]]); + initScoreSeclect("#scoreCategoryId",[[${obj.scoreCategoryId}]]); + + initAttrSeclect("#attrIds"); $("#mobileDetails").html(obj.mobileDetails); $("#pcDetails").html(obj.pcDetails); @@ -525,6 +530,27 @@ if (goodsName == null || typeof stockCode == 'undefined') { goodsName = ""; } + var selfPrice = shopSkus[c].selfPrice; + if (selfPrice == null || typeof selfPrice == 'undefined') { + selfPrice = ""; + } + var sealesPrice = shopSkus[c].sealesPrice; + if (sealesPrice == null || typeof sealesPrice == 'undefined') { + sealesPrice = ""; + } + var invitationPrice = shopSkus[c].invitationPrice; + if (invitationPrice == null || typeof invitationPrice == 'undefined') { + invitationPrice = ""; + } + var scorePrice = shopSkus[c].scorePrice; + if (scorePrice == null || typeof scorePrice == 'undefined') { + scorePrice = ""; + } + var scoreCount = shopSkus[c].scoreCount; + if (scoreCount == null || typeof scoreCount == 'undefined') { + scoreCount = ""; + } + var html= '<tr id="'+trId+'">' @@ -538,6 +564,11 @@ +'<td><div id="erpNoDiv"><button class="btn btn-info" onclick="selectProduct(\'shopIdValue\',\''+trId+'\')"><i class="fa fa-plus"></i></button>' +'<p class="form-control-static erpGoodsName">'+ goodsName +'</p><input autocomplete="off" class="form-control" type="hidden" value="'+stockCode+'" name="erpGoodsCode"></div></td>' +'<td><input autocomplete="off" type="text" class="form-control" value="'+sort+'" name=""></td>' + +'<td><input autocomplete="off" type="text" class="form-control" value="'+selfPrice+'" name=""></td>' + +'<td><input autocomplete="off" type="text" class="form-control" value="'+sealesPrice+'" name=""></td>' + +'<td><input autocomplete="off" type="text" class="form-control" value="'+invitationPrice+'" name=""></td>' + +'<td><input autocomplete="off" type="text" class="form-control" value="'+scorePrice+'" name=""></td>' + +'<td><input autocomplete="off" type="text" class="form-control" value="'+scoreCount+'" name=""></td>' +'<td><i class="fa fa-trash form-control-static" onclick="delThis(\''+trId+'\')"></i></td>' +'</tr>'; $("#skutable").find("tbody").append(html); @@ -601,10 +632,6 @@ layer.msg(result.info, { icon : 2, time : 1000, - end:function(){ - parent.myGrid.serchData(); - MTools.closeForm() - } }); return null; } @@ -617,7 +644,7 @@ //初始化属性下拉选 function initAttrSeclect(seler, def) { - $.AjaxProxy().invoke(basePath + "/admin/shopProductAttribute/showSonAttribute?attrCode=service", + $.AjaxProxy().invoke(basePath + "/admin/shopProductAttribute/showSonAttribute?attrCode=productColumn", function (loj) { $(seler).createSelectTree( loj.attr("result").rows, @@ -639,6 +666,22 @@ //初始化分类ID function initSeclect(seler, def) { $.AjaxProxy().invoke(basePath + "/admin/shopProductAttribute/showSonAttribute?attrCode=cpfl&status=1", + function (loj) { + $(seler).createSelectTree( + loj.attr("result").rows, + { + id: "attrId", + parent: "parentId", + value: "attrName", + append: false, + defaultValue: def, + defaultHtml: '' + }); + }); + } + //初始化分积分商城分类ID + function initScoreSeclect(seler, def) { + $.AjaxProxy().invoke(basePath + "/admin/shopProductAttribute/showSonAttribute?attrCode=jfsccpfl&status=1", function (loj) { $(seler).createSelectTree( loj.attr("result").rows, @@ -708,61 +751,77 @@ if (i != 0) { var tds = $(this).find("td"); var length = tds.length - 1; - var id = tds.eq(length - 8).find("input").val(); + var id = tds.eq(length - 13).find("input").val(); if(id == null){ id =""; } sku.id = id; //规格名称 - var name = tds.eq(length - 7).find("input").val(); + var name = tds.eq(length - 12).find("input").val(); if(name == null){ name = ""; } sku.name = name; //图片地址 - var path = tds.eq(length - 6).find("img").attr("src"); + var path = tds.eq(length - 11).find("img").attr("src"); if(path == null){ path = ""; } sku.imgPath = path; //库存 - var stock = tds.eq(length - 5).find("input").val(); + var stock = tds.eq(length - 10).find("input").val(); if(stock == ""){ stock = 0; } sku.stock = stock; //价格 - var price = tds.eq(length - 4).find("input").val(); + var price = tds.eq(length -9).find("input").val(); if(price == ""){ price =0; } sku.price = price; //积分 - var score = tds.eq(length - 3).find("input").val(); + var score = tds.eq(length - 8).find("input").val(); if(score == ""){ score = 0; } sku.score = score; //品种编码 - var stockCode = tds.eq(length - 2).find("input").val(); + var stockCode = tds.eq(length - 7).find("input").val(); if(stockCode == null || typeof stockCode == 'undefined'){ stockCode = ''; } sku.stockCode = stockCode; //排序 - var sort = tds.eq(length - 1).find("input").val(); + var sort = tds.eq(length - 6).find("input").val(); if(sort == ""){ sort = 0; } sku.sort = sort; + //推广提成 + var selfPrice = tds.eq(length - 5).find("input").val(); + sku.selfPrice = selfPrice; + //推广提成 + var sealesPrice = tds.eq(length - 4).find("input").val(); + sku.sealesPrice = sealesPrice; + //邀请提成 + var invitationPrice = tds.eq(length - 3).find("input").val(); + sku.invitationPrice = invitationPrice; + + //兑换所需金额 + var scorePrice = tds.eq(length - 2).find("input").val(); + sku.scorePrice = scorePrice; + //兑换所需积分 + var scoreCount = tds.eq(length - 1).find("input").val(); + sku.scoreCount = scoreCount; skus.push(sku); } @@ -771,8 +830,14 @@ return skus; } + /*验证sku表格中的参数*/ function getSkusValues() { + + var ableScorePay=$("#ableScorePay").val(); + var ableSales=$("#ableSales").val(); + + var flag = false; var reg = new RegExp("(^[1-9]([0-9]+)?(\\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\\.[0-9]([0-9])?$)"); $("#skutable tbody").find("tr").each(function(i) { @@ -780,7 +845,24 @@ if (i != 0) { var tds = $(this).find("td"); var length = tds.length - 1; - var name = tds.eq(length - 7).find("input").val(); + + + if(ableScorePay==1){ + //兑换所需金额 + var scorePrice = tds.eq(length - 2).find("input").val(); + //兑换所需积分 + var scoreCount = tds.eq(length - 1).find("input").val(); + if(scorePrice == ""||scoreCount==""){ + layer.msg("请填写兑换所需金额和积分",{ + icon : 2, + time : 2000 + }); + flag = true; + return false; + } + } + + var name = tds.eq(length - 12).find("input").val(); if(name == ""){ layer.msg("请填写规格名称",{ icon : 2, @@ -798,7 +880,7 @@ return false; } - var stock = tds.eq(length - 5).find("input").val(); + var stock = tds.eq(length -10).find("input").val(); if(stock == ""){ layer.msg("请填写库存",{ icon : 2, @@ -807,7 +889,7 @@ flag = true; return false; } - var price = tds.eq(length - 4).find("input").val(); + var price = tds.eq(length - 9 ).find("input").val(); if(price == ""){ layer.msg("请填写价格",{ icon : 2, -- Gitblit v1.9.1