1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222 |
- <%@ page import="com.thinkgem.jeesite.common.config.Global" %>
- <%@ taglib prefix="input" uri="/struts-tags" %>
- <%@ page contentType="text/html;charset=UTF-8" language="java" %>
- <%@ include file="/WEB-INF/views/include/taglib.jsp"%>
- <html>
- <head>
- <title>编辑商品</title>
- <meta name="decorator" content="default"/>
- <style>
- .red{color:red;}
- .blue{color:rgb(0, 100, 180);}
- #inputForm{max-width: 1200px;width: 100%;}
- #inputForm table{width:100%;line-height:18px;margin-bottom:50px;}
- #inputForm th,#inputForm td{ font-weight: normal; text-align: left; padding: 8px 5px; border-bottom: 1px solid rgb(238, 238, 238); }
- #inputForm th{width:15%;text-align:right;white-space:nowrap;font-weight:bold;}
- #inputForm td input[type="text"]{width:320px;height:16px; line-height:16px; }
- #inputForm td input.short{width:110px;}
- #inputForm td b.line{margin:0 15px 0 20px;font-weight:normal}
- #allAreaInput {padding: 10px 0 0 100px;}
- #inputForm .item{line-height:28px;}
- #ladderPriceBox{border-top:1px solid rgb(238, 238, 238);margin-top:8px;padding-top:8px;}
- #ladderPriceBox>div {margin-bottom: 5px;}
- .priceIcon:before{content:'\2729';color: #aaa;font-size: 18px;font-style:normal;}
- .priceIcon.full:before{content:'\272E';color: #ffbd14;}
- #slider{width:335px;}
- .skword input{margin:2px 0;}
- .skword p{margin: 2px 0;}
- .params input{margin:2px 0;}
- .tags input{margin:2px 0;}
- #tagsList{margin: 2px 0;display: none;width:600px;}
- .tags-li{margin:10px;display: inline-block;padding: 5px 10px;line-height: 16px;text-align: center;position: relative;font-size: 12px;border: 1px solid #EBEBEB;border-radius: 4px;}
- .tags-li i{font-style: normal;line-height: 20px;display: block;position: absolute;width: 16px;height: 16px;text-align: center;background: rgba(0,0,0,0.2);border-radius: 50%;top: -8px;right:-7px;cursor: pointer;}
- .tags-li .tags-s{background: #FFF;width: auto !important;outline:none;border:none;}
- </style>
- </head>
- <body>
- <ul class="nav nav-tabs">
- <li><a href="${ctx}/product/new/list">商品信息列表</a></li>
- <li class="active"><a href="${ctx}/product/new/productEdit?id=${product.id}">商品信息编辑</a></li>
- </ul>
- <form:form id="inputForm" modelAttribute="product" action="${ctx}/product/new/productSave?searchName=${product.searchName}&searchShopID=${product.searchShopID}&searchShopName=${product.searchShopName}&searchBigTypeID=${product.searchBigTypeID}&searchSmallTypeID=${product.searchSmallTypeID}&searchTinyTypeID=${product.searchTinyTypeID}&searchValidFlag=${product.searchValidFlag}&searchActStatus=${product.searchActStatus}&searchProductType=${product.searchProductType}&searchBrandID=${product.searchBrandID}&searchPreferredFlag=${product.searchPreferredFlag}&searchProductCategory=${product.searchProductCategory}&editFlag=${product.editFlag}" method="post" class="form-horizontal">
- <form:hidden path="id"/>
- <sys:message content="${message}"/>
- <table border="0" cellspacing="0" cellpadding="0" width="100%">
- <tr><th><b class="blue">商品基本信息:</b></th><td colspan="3"></td></tr>
- <tr>
- <th><span class="red">*</span>商品显示名:</th>
- <td colspan="3">
- <form:input path="name" maxlength="100" onchange="checkmaxlength(this.value)" class="input-small required"/>
- <span>
- <span style="font-weight: bold;">商品编码:</span>
- <span><form:input path="productCode" maxlength="100"/></span>
- </span>
- </td>
- </tr>
- <tr>
- <th><span class="red">*</span>内部商品名:</th>
- <td colspan="3">
- <form:input path="aliasName" maxlength="100" onchange="checkmaxlength(this.value)" class="input-small required"/>
- <span>
- <span style="font-weight: bold;">商品备注:</span>
- <span><form:input path="productRemarks" maxlength="60" onchange="checkmaxlengths(this.value,60)" class="input-small"/></span>
- </span>
- </td>
- </tr>
- <tr>
- <th>搜索关键字:</th>
- <td colspan="3" class="skword">
- <form:input path="searchKeyList[0]" maxlength="32" placeholder="建议输入品牌关键词" onchange="checkmaxlengthsBySearch(this,this.value,32)" class="input-small"/>
- <form:input path="searchKeyList[1]" maxlength="32" placeholder="建议输入商品学名关键词" onchange="checkmaxlengthsBySearch(this,this.value,32)" class="input-small"/>
- <form:input path="searchKeyList[2]" maxlength="32" placeholder="建议输入商品别名/市场称呼关键词" onchange="checkmaxlengthsBySearch(this,this.value,32)" class="input-small"/>
- <form:input path="searchKeyList[3]" maxlength="32" placeholder="建议输入商品大分类关键词" onchange="checkmaxlengthsBySearch(this,this.value,32)" class="input-small"/>
- <form:input path="searchKeyList[4]" maxlength="32" placeholder="建议输入商品小分类关键词" onchange="checkmaxlengthsBySearch(this,this.value,32)" class="input-small"/>
- <p>请务必准确定义关键词,关键词会影响商品的搜索结果,建议从品牌,商品学名,商品别名,商品大类别和商品小类别5个方面考虑,每个关键词不超过16个汉字。</p>
- </td>
- </tr>
- <tr>
- <th>相关参数:</th>
- <td colspan="3" class="params">
- <div id="addParamsItems">
- <%--相关参数层--%>
- <input type="hidden" value="${fn:length(product.productParametersList)}" id="productParametersLength">
- <c:forEach items="${product.productParametersList}" var="item" varStatus="varIndex">
- <div id="paramsItem" class="paramsItem">
- <form:input path="productParametersList[${varIndex.index}].paramsName" id="paramsName" cssStyle="width:142px" maxlength="10" placeholder="参数名称" class="input-small"/>
- <form:input path="productParametersList[${varIndex.index}].paramsContent" id="paramsContent" cssStyle="width:680px" maxlength="50" placeholder="请输入参数信息" class="input-small"/>
- <span type="button" style="cursor: pointer;color: #0B61A4" onclick="deleteParams(this)">删除</span>
- </div>
- </c:forEach>
- </div>
- <button class="addParams" onclick="return false">添加参数</button>
- </td>
- </tr>
- <tr>
- <th>品牌:</th>
- <td colspan="3">
- <form:select path="brandID" class="input-small">
- <form:option value="" label="请选择"/>
- <form:options items="${brandList}" itemLabel="name" itemValue="id" htmlEscape="false"/>
- </form:select>
- </td>
- </tr>
- <tr>
- <th>组合名称:</th>
- <td colspan="3">
- <form:select path="combinationID" class="input-small">
- <form:option value="" label="请选择"/>
- <form:options items="${combinationList}" itemLabel="name" itemValue="id" htmlEscape="false"/>
- </form:select>
- </td>
- </tr>
- <tr>
- <th><span class="red">*</span>商品标签:</th>
- <td colspan="3">
- <input id="inputTags" maxlength="15" style="width:217px;border-radius:5px" placeholder="请输入商品标签" class="input-small"/>
- <button class="addTags" onclick="return false">添加标签</button>
- <p style="margin-top: 5px">简述商品功效和特性,最多可添加6个标签,每个标签字数不超过15个汉字(如:美白祛斑,消除皱纹)</p>
- <div id="tagsList">
- <input type="hidden" name="tagsLists" value="${product.tags}" id="tagsLists">
- <%--标签--%>
- </div>
- </td>
- </tr>
- <tr>
- <th><span class="red">*</span>商品属性:</th>
- <td colspan="3">
- <label><input type="radio" name="commodityType" value="1" onchange="loadBigType()" ${product.commodityType == "1" ? "checked" : ""} />产品<b class="line">|</b></label>
- <label><input type="radio" name="commodityType" value="2" onchange="loadBigType()" ${product.commodityType == "2" ? "checked" : ""} />仪器</label>
- </td>
- </tr>
- <tr>
- <th><span class="red">*</span>分类:</th>
- <td colspan="3">
- <form:select path="bigTypeID" class="input-small required" id="bigType" onchange="loadSmallType()">
- <form:option value="" label="请选择"/>
- <form:options items="${classify.bigTypeList}" itemLabel="name" itemValue="bigTypeID" htmlEscape="false"/>
- </form:select>
- <form:select path="smallTypeID" class="input-small" id="smallType" onchange="loadTinyType()">
- <form:option value="" label="请选择"/>
- <c:forEach items="${classify.smalltypeList}" var="smallType">
- <form:option value="${smallType.smallTypeID}" label="${smallType.name}" bigTypeID="${smallType.bigTypeID}"/>
- </c:forEach>
- </form:select>
- <form:select path="tinyTypeID" class="input-small" id="tinyType">
- <form:option value="" label="请选择"/>
- <c:forEach items="${classify.tinytypeList}" var="tinyType">
- <form:option value="${tinyType.tinyTypeID}" label="${tinyType.name}" bigTypeID="${tinyType.smallTypeID}"/>
- </c:forEach>
- </form:select>
- </td>
- </tr>
- <tr>
- <th><span class="red">*</span>商品类型:</th>
- <td colspan="3">
- <form:select path="productType" class="input-small required" onclick="changeMachine(this)">
- <form:option value="" label="请选择"/>
- <form:option value="1" label="妆字号"/>
- <form:option value="2" label="械字号"/>
- <form:option value="0" label="其它" />
- </form:select>
- <span class="machineType">
- <form:select path="machineType" class="input-small">
- <form:option value="" label="请选择"/>
- <form:option value="1" label="一类"/>
- <form:option value="2" label="二类"/>
- <form:option value="3" label="三类"/>
- </form:select>
- </span>
- </td>
- </tr>
- <tr id="xiezihao" class="machineType">
- <th><span class="red">*</span>资质证书:</th>
- <td colspan="3">
- <%-- 械字号医疗证书--%>
- <form:hidden id="qualificationImg" path="qualificationImg" htmlEscape="false" maxlength="255" class="input-xlarge"/>
- <sys:ckfinder input="qualificationImg" type="images" uploadPath="/photo" selectMultiple="false" maxWidth="100" maxHeight="100"/>
- </td>
- </tr>
- <tr>
- <th><span class="red">*</span>市场价:</th>
- <td colspan="3"><form:input path="normalPrice" type="number" maxlength="11" class="short input-small required" />元</td>
- </tr>
- <tr>
- <th><span class="red">*</span>商品展示价格:</th>
- <td colspan="3">
- <label><input type="radio" name="ladderPriceFlag" value="0" onchange="changeLadderPrice()" ${product.ladderPriceFlag == "0" ? "checked" : ""} />不使用阶梯价格<b class="line">|</b></label>
- <label><input type="radio" name="ladderPriceFlag" value="1" onchange="changeLadderPrice()" ${product.ladderPriceFlag == "1" ? "checked" : ""} />使用阶梯价格</label>
- </td>
- </tr>
- <tr>
- <th style="vertical-align:top;padding-top:15px;"><span class="red">*</span>机构价:</th>
- <td colspan="3">
- <div class="item">
- <div id="normalPriceBox">
- <form:input path="price1" type="number" id="price1" maxlength="11" class="short computedPrice required" onkeyup="computedPriceLevel(this.value)" />
- <b class="line">|</b>游客展示等级:<span>
- <i class="priceIcon"></i>
- <i class="priceIcon"></i>
- <i class="priceIcon"></i>
- <i class="priceIcon"></i>
- <i class="priceIcon"></i>
- </span>
- </div>
- <div id="ladderPriceBox">
- <div id="ladderPrice1">
- 起订量:<form:input path="ladderPriceList[0].buyNum" min="1" type="number" maxlength="11" class="short number" onblur="checkBuyNum(this, 0)"/>(${product.unit})及以上,
- <form:input path="ladderPriceList[0].buyPrice" type="number" maxlength="11" class="short price" onblur="checkBuyPrice(this, 0)" />元/(${product.unit})
- <span class="showBtn ${null != product.ladderPriceList[1] && null != product.ladderPriceList[1].buyNum ? "hide" : ""}">
- <a class="addBtn" href="javascript:;">添加</a>
- <form:hidden path="ladderPriceList[0].id"/>
- <form:hidden path="ladderPriceList[0].delFlag" id="delFlag1"/>
- </span>
- </div>
- <div id="ladderPrice2" ${null == product.ladderPriceList[1] && null == product.ladderPriceList[1].buyNum ? "class='hide'" : ""}>
- 起订量:<form:input path="ladderPriceList[1].buyNum" type="number" maxlength="11" class="short number" onblur="checkBuyNum(this, 1)" />(${product.unit})及以上,
- <form:input path="ladderPriceList[1].buyPrice" type="number" maxlength="11" class="short price" onblur="checkBuyPrice(this, 1)"/>元/(${product.unit})
- <span class="showBtn ${null != product.ladderPriceList[2] && null != product.ladderPriceList[2].buyNum ? "hide" : ""}">
- <a class="delBtn" href="javascript:;">删除</a> / <a class="addBtn" href="javascript:;">添加</a>
- <form:hidden path="ladderPriceList[1].id"/>
- <form:hidden path="ladderPriceList[1].delFlag" id="delFlag2"/>
- </span>
- </div>
- <div id="ladderPrice3" ${null == product.ladderPriceList[2] && null == product.ladderPriceList[2].buyNum ? "class='hide'" : ""}>
- 起订量:<form:input path="ladderPriceList[2].buyNum" type="number" maxlength="11" class="short number" onblur="checkBuyNum(this, 2)" />(${product.unit})及以上,
- <form:input path="ladderPriceList[2].buyPrice" type="number" maxlength="11" class="short price" onblur="checkBuyPrice(this, 2)"/>元/(${product.unit})
- <span class="showBtn"><a class="delBtn" href="javascript:;">删除</a></span>
- <form:hidden path="ladderPriceList[2].id"/>
- <form:hidden path="ladderPriceList[2].delFlag" id="delFlag3"/>
- </div>
- </div>
- </div>
- </td>
- </tr>
- <tr>
- <th><span class="red">*</span>是否含税:</th>
- <td >
- <label><input type="radio" name="includedTax" value="1" onclick="chageIncludedTax(${product.taxPoint})" ${product.includedTax == "1" ? "checked" : ""}>含税<b class="line">|</b></label>
- <label><input type="radio" name="includedTax" value="0" onclick="chageIncludedTax(${product.taxPoint})" ${product.includedTax == "0" ? "checked" : ""}>不含税<b class="line">|</b></label>
- <label><input type="radio" name="includedTax" value="2" onclick="chageIncludedTax(${product.taxPoint})" ${product.includedTax == "2" ? "checked" : ""}>未知</label>
- </td>
- </tr>
- <tr id="invoiceItem">
- <th></th>
- <td>
- <span class="invoice">
- <label><input type="radio" name="invoiceType" value="1" onclick="changeInvoiceType(${product.taxPoint})" ${product.invoiceType == "1" ? "checked" : ""}>开增值税专用发票<b class="line">|</b></label>
- <label><input type="radio" name="invoiceType" value="2" onclick="changeInvoiceType(${product.taxPoint})" ${product.invoiceType == "2" ? "checked" : ""}>开增值税普通发票</label>
- </span>
- <span class="notInvoice">
- <b class="line">|</b>
- <label><input type="radio" name="invoiceType" value="3" onclick="changeInvoiceType(${product.taxPoint})" ${product.invoiceType == "3" ? "checked" : ""}>不能开票</label>
- </span>
- </td>
- </tr>
- <tr id="taxPointDiv">
- <th><span class="red">*</span>机构税率:</th>
- <td>
- <span><form:input path="taxPoint" maxlength="5" cssStyle="width: 35PX" class="number" onchange="setTwoNumberDecimal(this)" />%</span>
- </td>
- </tr>
- <tr id="supplierTaxPointDiv">
- <th><span class="red">*</span>供应商税率:</th>
- <td>
- <span><form:input path="supplierTaxPoint" maxlength="5" cssStyle="width: 35PX" class="number" onchange="setTwoNumberDecimal(this)" />%</span>
- </td>
- </tr>
- <tr id="priceMinNumber">
- <th><span class="red">*</span>起订量:</th>
- <td colspan="3"><form:input path="minBuyNumber" maxlength="11" class="short" /></td>
- </tr>
- <tr>
- <th><span class="red">*</span>商品查看权限:</th>
- <td colspan="3">
- <form:select path="visibility" class="input-large required" id="visibility">
- <form:option value="3" label="所有人可见"/>
- <form:option value="2" label="所有机构可见"/>
- <form:option value="1" label="仅会员机构可见"/>
- </form:select>
- </td>
- </tr>
- <tr>
- <th><span class="red">*</span>价格可见度:</th>
- <td>
- <form:select path="price1TextFlag" class="input-small required hide" id="price1TextFlag">
- <form:option value="1" label="所有机构都不可见"/>
- <form:option value="2" label="仅会员机构可见"/>
- <form:option value="0" label="所有机构都可见"/>
- </form:select>
- </td>
- <td colspan="2">
- <span id="textFlagNote" style="color:#ab1e1e;">
- ${product.price1TextFlag == "1" ? "所有机构都不可见" : ""}
- ${product.price1TextFlag == "2" ? "仅会员机构可见" : ""}
- ${product.price1TextFlag == "0" ? "所有机构都可见" : ""}
- </span>
- <%--<input type="radio" name="price1TextFlag" value="0" ${product.price1TextFlag == "0" ? "checked" : ""} />公开<b class="line">|</b>
- <input type="radio" name="price1TextFlag" value="1" ${product.price1TextFlag == "1" ? "checked" : ""} />不公开--%>
- </td>
- </tr>
- <tr>
- <th><span class="red">*</span>成本:</th>
- <td colspan="3">
- <label><input type="radio" name="costCheckFlag" value="1" onchange="changeCostPriceShow()" ${product.costCheckFlag == "1" ? "checked" : ""} />固定成本<b class="line">|</b></label>
- <label><input type="radio" name="costCheckFlag" value="2" onchange="changeCostPriceShow()" ${product.costCheckFlag == "1" ? "" : "checked"} />比例成本</label>
- </td>
- </tr>
- <tr id="costPriceShow">
- <th><span class="red">*</span><b class="costFlagText">成本价</b>:</th>
- <td colspan="3"><form:input path="costPrice" id="costPrice" type="number" maxlength="11" class="short" /> 元</td>
- </tr>
- <tr id="costPropShow">
- <th><span class="red">*</span>比例成本百分比:</th>
- <td colspan="3"><form:input path="costProportional" id="costProportional" type="number" maxlength="11" class="short" /> %</td>
- </tr>
- <tr>
- <th>库存:</th>
- <td colspan="3"><form:input path="stock" type="number" maxlength="11" class="short" /></td>
- </tr>
- <tr>
- <th><span class="red">*</span>购买数量:</th>
- <td colspan="3">
- <label><input type="radio" name="step" value="1" ${product.step == "1" ? "checked" : ""}>逐步增长<b class="line">|</b></label>
- <label><input type="radio" name="step" value="2" ${product.step == "2" ? "checked" : ""}>以起订量增长</label>
- </td>
- </tr>
- <tr>
- <th><span class="red">*</span>运费:</th>
- <%--<td colspan="3">
- <label><input type="radio" name="byFlag" value="0" ${product.byFlag == "0" ? "checked" : ""}>买家承担<b class="line">|</b></label>
- <label><input type="radio" name="byFlag" value="1" ${product.byFlag == "1" ? "checked" : ""}>卖家承担</label>
- </td>--%>
- <td colspan="3">
- <label><input type="radio" name="freePostFlag" value="2" ${(empty product.freePostFlag || product.freePostFlag eq "2") ? "checked" : ""}>默认(遵循运费规则)<b class="line">|</b></label>
- <label><input type="radio" name="freePostFlag" value="0" ${product.freePostFlag == "0" ? "checked" : ""}>包邮<b class="line">|</b></label>
- <label><input type="radio" name="freePostFlag" value="1" ${product.freePostFlag == "1" ? "checked" : ""}>到付</label>
- </td>
- </tr>
- <tr>
- <th><span class="red">*</span>包装规格:</th>
- <td><form:input path="unit" maxlength="20" class="short required" /></td>
- </tr>
- <tr>
- <th><span class="red">*</span>销售区域:</th>
- <td colspan="3">
- <label><input type="radio" name="allAreaFlag" value="1" onchange="changeAreaFlag()" ${product.allAreaFlag == "1" ? "checked" : ""}>全部区域<b class="line">|</b></label>
- <label><input type="radio" name="allAreaFlag" value="0" onchange="changeAreaFlag()" ${product.allAreaFlag == "1" ? "" : "checked"}>指定区域</label>
- </td>
- </tr>
- <tr id="allAreaInput">
- <th></th>
- <td>
- <span>
- <form:checkboxes path="provinceIDs" items="${provinceList}" itemLabel="name" itemValue="id" />
- </span>
- </td>
- </tr>
- <tr>
- <th><span class="red">*</span>商品详细信息:</th>
- <td colspan="3">
- <form:textarea path="detailInfo" htmlEscape="false" class="input-xlarge required hide" />
- <!-- 富文本编辑器 -->
- <div id="detailInfoEditor">${product.detailInfo}</div>
- </td>
- </tr>
- <tr>
- <th>订购方案:</th>
- <td colspan="3">
- <form:textarea path="orderInfo" class="input-xlarge hide" />
- <!-- 富文本编辑器 -->
- <div id="orderInfoEditor">${product.orderInfo}</div>
- </td>
- </tr>
- <tr>
- <th>服务详情:</th>
- <td colspan="3">
- <form:textarea path="serviceInfo" class="input-xlarge hide" />
- <!-- 富文本编辑器 -->
- <div id="serviceInfoEditor">${product.serviceInfo}</div>
- </td>
- </tr>
- <tr><td colspan="4" style="text-align:center;">
- <shiro:hasPermission name="product:product:edit">
- <input id="btnSave" class="btn btn-primary" type="submit" value="保 存" onclick="checkInfo()"/>
- </shiro:hasPermission>
- <input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
- </td></tr>
- </table>
- </form:form>
- <!-- 富文本编辑器 -->
- <% request.setAttribute("caimeiSpi", Global.getConfig("caimei.spi"));%>
- <% request.setAttribute("caimeiCore", Global.getConfig("caimei.core"));%>
- <script type="text/javascript" src="${ctxStatic}/ckeditor5-new/ckeditor.js"></script>
- <script type="text/javascript">
- $(document).ready(function() {
- //$("#name").focus();
- $("#inputForm").validate({
- ignore:"",
- submitHandler: function(form){
- var commodityType = $("input[name='commodityType']:checked").val();
- if(commodityType == '' || commodityType == null){
- alertx("请选择商品属性");
- return false;
- }
- var costCheckFlag = $("input[name='costCheckFlag']:checked").val();
- if(costCheckFlag*1===1){
- if ($("#costPrice").val() == '') {
- alertx("请输入成本价");
- return false;
- };
- }else{
- if ($("#costProportional").val() == '') {
- alertx("请输入成本比例");
- return false;
- };
- }
- if ($('#minBuyNumber:visible').length>0){
- var minBuyNumber = $('#minBuyNumber').val();
- if(minBuyNumber<=0 || minBuyNumber == ''){
- alertx("请输入起订量");
- return false;
- }
- }
- if ($('input[name="ladderPriceList[0].buyNum"]:visible').length>0){
- var buyNum = $('input[name="ladderPriceList[0].buyNum"]').val();
- var buyPrice = $('input[name="ladderPriceList[0].buyPrice"]').val();
- if(buyNum<=0 || buyNum == '' || buyPrice<=0 || buyPrice == ''){
- alertx("请输入正确的阶梯价格");
- return false;
- }
- }
- if ($('input[name="ladderPriceList[1].buyNum"]:visible').length>0){
- var buyNum1 = $('input[name="ladderPriceList[1].buyNum"]').val();
- var buyPrice1 = $('input[name="ladderPriceList[1].buyPrice"]').val();
- if(buyNum1<=0 || buyNum1 == '' || buyPrice1<=0 || buyPrice1 == ''){
- alertx("请输入正确的阶梯价格");
- return false;
- }
- }
- if ($('input[name="ladderPriceList[2].buyNum"]:visible').length>0){
- var buyNum2 = $('input[name="ladderPriceList[2].buyNum"]').val();
- var buyPrice2 = $('input[name="ladderPriceList[2].buyPrice"]').val();
- if(buyNum2<=0 || buyNum2 == '' || buyPrice2<=0 || buyPrice2 == ''){
- alertx("请输入正确的阶梯价格");
- return false;
- }
- }
- var detailInfo=detailInfoEditor.getData();
- if (detailInfo == ''){
- alertx("请输入商品详细信息");
- return false;
- }
- var includedTax = $("input[name='includedTax']:checked").val();
- if(includedTax == '' || includedTax == null){
- alertx("请选择是否含税");
- return false;
- }
- var invoiceType = $("input[name='invoiceType']:checked").val();
- if ((includedTax == 0 || includedTax == 1) && (invoiceType == 1 || invoiceType == 2)) {
- var taxPoint = $("#taxPoint").val();
- var supplierTaxPoint = $("#supplierTaxPoint").val();
- if (taxPoint == '' || taxPoint == null) {
- alertx("请输入机构税率");
- return false;
- }
- if (supplierTaxPoint == '' || supplierTaxPoint == null) {
- alertx("请输入供应商税率");
- return false;
- }
- }
- if (includedTax != ${product.includedTax} || invoiceType != ${product.invoiceType}) {
- top.$.jBox.confirm("目前含税信息为:${product.includedTax eq 0?'不含税':product.includedTax eq 1?'含税':'未知'}${product.includedTax eq 2?'':product.invoiceType eq 1?'-开增值税专用发票':product.invoiceType eq 2?'-开增值税普通发票':'不开发票'},确定修改为:" + (includedTax == 0 ? '不含税' : includedTax == 1 ? '含税' : '未知') + (includedTax == 2 ? '' : invoiceType == 1 ? '-开增值税专用发票' : invoiceType == 2 ? '-开增值税普通发票' : '-不能开票') + "吗?", '保存商品提示', function (v, h, f) {
- if (v == 'ok') {
- // 提交订单
- loading('正在提交,请稍等...');
- form.submit();
- }
- }, {
- buttonsFocus: 1, closed: function () {
- if (typeof closed == 'function') {
- closed();
- }
- }
- });
- } else {
- loading('正在提交,请稍等...');
- form.submit();
- }
- },
- errorContainer: "#messageBox",
- errorPlacement: function(error, element) {
- $("#messageBox").text("输入有误,请先更正。");
- if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
- error.appendTo(element.parent().parent());
- } else {
- error.insertAfter(element);
- }
- }
- });
- });
- // 商品可见度
- /*$(function() {
- var initValue = ${(product.visibility <= 0) ? 3 : ((product.visibility >= 3) ? 3 : product.visibility)}
- var select = $("#visibility");
- var slider = $("<div id='slider'></div>").insertAfter(select).slider({
- min: 1,
- max: 3,
- range: "min",
- value: initValue,
- slide: function(event, ui) {
- if (ui.value*1 === 1){
- // 所有可见
- select.val(1);
- } else if (ui.value*1 === 2){
- // 会员可见
- select.val(2);
- } else{
- // 不可见
- select.val(3);
- }
- $("#visibilityNote").text(select.find("option:selected").text());
- }
- });
- });*/
- // 价格可见度
- $(function() {
- var initValue = ${(product.price1TextFlag eq 0) ? 2 : ((product.price1TextFlag eq 2) ? 1 : 0)}
- var select = $("#price1TextFlag");
- var slider = $("<div id='slider'></div>").insertAfter(select).slider({
- min: 0,
- max: 2,
- range: "min",
- value: initValue,
- slide: function(event, ui) {
- if (ui.value*1 === 2){
- // 所有可见
- select.val(0);
- } else if (ui.value*1 === 1){
- // 会员可见
- select.val(2);
- } else{
- // 不可见
- select.val(1);
- }
- //select[0].selectedIndex = ui.value;
- $("#textFlagNote").text(select.find("option:selected").text());
- }
- });
- });
- //初始化标签
- $(function () {
- var html = '';
- //解析参数
- var tagsLists = $("#tagsLists").val();
- if(tagsLists != null && tagsLists != ""){
- var tagsArray = tagsLists.split(',');
- for (var j = 0; j < tagsArray.length; j++) {
- html += '<div class="tags-li"><input id="tags" name="tags" value="'+tagsArray[j]+'" class="tags-s" readonly/><i onclick="removerX(this)">X</i></div>';
- }
- $("#tagsList").append(html).show();
- }
- });
- $(window).load(function(){
- loadInitType();
- });
- var step = ${product.step};
- var areaFlag = ${product.allAreaFlag};
- var ladderPriceFlag = ${product.ladderPriceFlag};
- var normalPrice = ${product.price1};
- $(document).ready(function() {
- step*1>1 ? $("#setpInput").show() : $("#setpInput").hide();
- areaFlag*1>0 ? $("#allAreaInput").hide() : $("#allAreaInput").show();
- computedPriceLevel(normalPrice);
- if(ladderPriceFlag*1>0){
- $("#ladderPriceBox").show();
- $("#priceMinNumber").hide();
- }else{
- $("#ladderPriceBox").hide();
- $("#priceMinNumber").show();
- }
- changeCostPriceShow();
- //富文本框
- ClassicEditor.create(document.querySelector('#detailInfoEditor'), {
- ckfinder: {
- uploadUrl: '${caimeiSpi}/formData/ckeditorImage'
- }
- }).then(function(editor) {
- window.detailInfoEditor = editor;
- }).catch(function(error){
- console.log(error);
- });
- ClassicEditor.create(document.querySelector('#orderInfoEditor'), {
- ckfinder: {
- uploadUrl: '${caimeiSpi}/formData/ckeditorImage'
- }
- }).then(function(editor) {
- window.orderInfoEditor = editor;
- }).catch(function(error){
- console.log(error);
- });
- ClassicEditor.create(document.querySelector('#serviceInfoEditor'), {
- ckfinder: {
- uploadUrl: '${caimeiSpi}/formData/ckeditorImage'
- }
- }).then(function(editor) {
- window.serviceInfoEditor = editor;
- }).catch(function(error){
- console.log(error);
- });
- });
- //富文本框编辑
- function checkInfo(){
- var detailInfo=detailInfoEditor.getData();
- $("#detailInfo").val(detailInfo);
- console.log(detailInfo);
- var orderInfo=orderInfoEditor.getData();
- $("#orderInfo").val(orderInfo);
- console.log(orderInfo);
- var serviceInfo=serviceInfoEditor.getData();
- $("#serviceInfo").val(serviceInfo);
- console.log(serviceInfo);
- }
- $("#ladderPrice1").on("click", ".addBtn", function(){
- $("#ladderPrice2").removeClass("hide");
- $("#delFlag2").val("0");
- $("#ladderPrice1").find(".showBtn").addClass("hide");
- });
- $("#ladderPrice2").on("click", ".addBtn", function(){
- $("#ladderPrice3").removeClass("hide");
- $("#delFlag3").val("0");
- $("#ladderPrice2").find(".showBtn").addClass("hide");
- }).on("click", ".delBtn", function(){
- $("#ladderPrice2").addClass("hide");
- $("#ladderPrice1").find(".showBtn").removeClass("hide");
- $("#delFlag2").val("1");
- });
- $("#ladderPrice3").on("click", ".delBtn", function(){
- $("#ladderPrice3").addClass("hide");
- $("#ladderPrice2").find(".showBtn").removeClass("hide");
- $("#delFlag3").val("1");
- });
- //计算游客用户价格等级
- function computedPriceLevel(price){
- var priceLevel = 1;
- $(".priceIcon").removeClass("full");
- $(".priceIcon").eq(0).addClass("full");
- if (price*1>2.5*10000 && price*1<=10*10000) {
- priceLevel = 2;
- $(".priceIcon").addClass("full");
- if($(".priceIcon").eq(2).hasClass("full")){$(".priceIcon").eq(2).removeClass("full");}
- if($(".priceIcon").eq(3).hasClass("full")){$(".priceIcon").eq(3).removeClass("full");}
- if($(".priceIcon").eq(4).hasClass("full")){$(".priceIcon").eq(4).removeClass("full");}
- }
- if (price*1>10*10000 && price*1<=25*10000) {
- priceLevel = 3;
- $(".priceIcon").addClass("full");
- if($(".priceIcon").eq(3).hasClass("full")){$(".priceIcon").eq(3).removeClass("full");}
- if($(".priceIcon").eq(4).hasClass("full")){$(".priceIcon").eq(4).removeClass("full");}
- }
- if (price*1>25*10000 && price*1<=50*10000) {
- priceLevel = 4;
- $(".priceIcon").addClass("full");
- if($(".priceIcon").eq(4).hasClass("full")){$(".priceIcon").eq(4).removeClass("full");}
- }
- if (price*1>50*10000) {
- priceLevel = 5;
- $(".priceIcon").addClass("full");
- }
- }
- // 检查阶梯数量
- function checkBuyNum(input, index) {
- if(index>0){
- var beforeNum = $('input[name="ladderPriceList['+(index-1)+'].buyNum"]').val()*1;
- if(input.value*1 <= beforeNum){
- alertx("请输入大于上一阶起订量的值");
- $(input).val(input.value*1+beforeNum);
- }
- } else {
- var minNum = $('input[name="ladderPriceList[0].buyNum"]').val()*1;
- $('#minBuyNumber').val(minNum);
- }
- }
- // 检查阶梯价格
- function checkBuyPrice(input, index) {
- if (index > 0) {
- var beforePrice = $('input[name="ladderPriceList['+(index-1)+'].buyPrice"]').val()*1;
- if(input.value*1 > beforePrice){
- $(input).val('');
- alertx("请输入小于前一个价格的值");
- }
- } else {
- var price1 = $('#price1').val();
- if(input.value*1 > price1){
- $(input).val('');
- alertx("第一个阶梯价格不能大于机构价");
- }
- }
- }
- // 是否使用阶梯价格
- function changeLadderPrice(){
- var ladderPriceFlag = $("input[name='ladderPriceFlag']:checked").val();
- if(ladderPriceFlag*1>0){
- $("#ladderPriceBox").show();
- $("#priceMinNumber").hide();
- $("#delFlag1").val("0");
- $('input[name="ladderPriceList[0].buyNum"]').val($('#minBuyNumber').val()*1);
- }else{
- $("#ladderPriceBox").hide();
- $("#priceMinNumber").show();
- }
- }
- // 是否固定成本
- function changeCostPriceShow() {
- var costCheckFlag = $("input[name='costCheckFlag']:checked").val();
- if(costCheckFlag*1===1){
- $("#costPriceShow").show();
- $("#costPropShow").hide();
- }else{
- $("#costPriceShow").hide();
- $("#costPropShow").show();
- }
- }
- // 全部区域
- function changeAreaFlag() {
- var areaFlag = $("input[name='allAreaFlag']:checked").val();
- areaFlag*1>0 ? $("#allAreaInput").hide() : $("#allAreaInput").show();
- }
- // 网站分类
- var currentBigtype = ${product.bigTypeID};
- var currentSmalltype = ${product.smallTypeID};
- var currentTinytype = ${product.tinyTypeID};
- var currentCommodityType = ${product.commodityType}; //商品属性
- var bigTypeList = [
- <c:forEach items="${classify.bigTypeList}" var="bigType" varStatus="index">
- <c:if test="${index.index > 0}">,</c:if>
- {
- bigTypeID: ${bigType.bigTypeID},
- name: "${bigType.name}",
- typeSort: ${bigType.typeSort}
- }
- </c:forEach>
- ];
- var smalltypeList = [
- <c:forEach items="${classify.smalltypeList}" var="smalltype" varStatus="index">
- <c:if test="${index.index > 0}">,</c:if>
- {
- smallTypeID: ${smalltype.smallTypeID},
- name: "${smalltype.name}",
- bigTypeID: ${smalltype.bigTypeID},
- }
- </c:forEach>
- ];
- var tinytypeList = [
- <c:forEach items="${classify.tinytypeList}" var="tinytype" varStatus="index">
- <c:if test="${index.index > 0}">,</c:if>
- {
- tinyTypeID: ${tinytype.tinyTypeID},
- name: "${tinytype.name}",
- smallTypeID: ${tinytype.smallTypeID}
- }
- </c:forEach>
- ];
- // 初始分类
- function loadInitType(){
- if (currentCommodityType == null || typeof (currentCommodityType) == "undefined" || currentCommodityType == '0') {
- $("#bigType").html("");
- $("#bigType").prev().find(".select2-chosen").text("请选择");
- $("#bigType").append("<option value=''>请选择</option>");
- $("#smallType").html("");
- $("#smallType").prev().find(".select2-chosen").text("请选择");
- $("#smallType").append("<option value=''>请选择</option>");
- $("#tinyType").html("");
- $("#tinyType").prev().find(".select2-chosen").text("请选择");
- $("#tinyType").append("<option value=''>请选择</option>");
- document.getElementById("s2id_tinyType").style.cssText = "display: none";
- }else if(currentBigtype != null && typeof(currentBigtype) != "undefined"){
- setTimeout(function(){
- loadBigType();
- },0);
- }
- }
- // 分类联动
- function loadBigType(){
- var commodityType = $("input[name='commodityType']:checked").val();
- $("#bigType").html("");
- $("#bigType").prev().find(".select2-chosen").text("请选择");
- $("#bigType").append("<option value=''>请选择</option>");
- $("#smallType").html("");
- $("#smallType").prev().find(".select2-chosen").text("请选择");
- $("#smallType").append("<option value=''>请选择</option>");
- $("#tinyType").html("");
- $("#tinyType").prev().find(".select2-chosen").text("请选择");
- $("#tinyType").append("<option value=''>请选择</option>");
- if(typeof(commodityType) != "undefined") {
- $("#bigType").html("");
- $("#bigType").prev().find(".select2-chosen").text("请选择");
- $("#bigType").append("<option value=''>请选择</option>");
- $("#smallType").html("");
- $("#smallType").prev().find(".select2-chosen").text("请选择");
- $("#smallType").append("<option value=''>请选择</option>");
- $("#tinyType").html("");
- $("#tinyType").prev().find(".select2-chosen").text("请选择");
- $("#tinyType").append("<option value=''>请选择</option>");
- for(var i=0; i<bigTypeList.length; i++){
- if (commodityType == bigTypeList[i].typeSort) {
- if (currentBigtype != null && typeof (currentBigtype) != "undefined" && currentBigtype == bigTypeList[i].bigTypeID) {
- $("#bigType").append("<option selected value='"+bigTypeList[i].bigTypeID+"'>"+bigTypeList[i].name+"</option>");
- $("#bigType").prev().find(".select2-chosen").text(bigTypeList[i].name);
- setTimeout(function(){
- loadSmallType();
- },500);
- }else{
- $("#bigType").append("<option value='"+bigTypeList[i].bigTypeID+"'>"+bigTypeList[i].name+"</option>");
- }
- }
- }
- }
- loadSmallType();
- }
- function loadSmallType(id){
- if(id){
- $("#bigType").val(id);
- $("#bigType").prev().find(".select2-chosen").text($("#bigType option:selected").text());
- }
- var bigType = $("#bigType").val();
- $("#smallType").html("");
- $("#smallType").prev().find(".select2-chosen").text("请选择");
- $("#smallType").append("<option value=''>请选择</option>");
- $("#tinyType").html("");
- $("#tinyType").prev().find(".select2-chosen").text("请选择");
- $("#tinyType").append("<option value=''>请选择</option>");
- if(typeof(bigType) != "undefined" && bigType != "") {
- var smallTypeNum = 0;
- for(var i=0; i<smalltypeList.length; i++){
- if (bigType == smalltypeList[i].bigTypeID) {
- smallTypeNum = smallTypeNum + 1;
- if(currentSmalltype != null && typeof(currentSmalltype) != "undefined" && currentSmalltype == smalltypeList[i].smallTypeID) {
- $("#smallType").append("<option selected value='"+smalltypeList[i].smallTypeID+"'>"+smalltypeList[i].name+"</option>");
- $("#smallType").prev().find(".select2-chosen").text(smalltypeList[i].name);
- setTimeout(function(){
- loadTinyType(currentSmalltype);
- },500);
- }else{
- $("#smallType").append("<option value='"+smalltypeList[i].smallTypeID+"'>"+smalltypeList[i].name+"</option>");
- }
- }
- }
- if (smallTypeNum == 0) {
- $("#smallType").removeClass("required");
- document.getElementById("s2id_smallType").style.cssText = "display: none";
- }else {
- $("#smallType").addClass("required");
- document.getElementById("s2id_smallType").style.cssText = "display: inline-block";
- }
- } else {
- $("#smallType").removeClass("required");
- document.getElementById("s2id_smallType").style.cssText = "display: none";
- }
- loadTinyType();
- }
- function loadTinyType(id) {
- if(id){
- $("#smallType").val(id);
- $("#smallType").prev().find(".select2-chosen").text($("#smallType option:selected").text());
- }
- var smallType = $("#smallType option:selected").val();
- $("#tinyType").html("");
- $("#tinyType").prev().find(".select2-chosen").text("请选择");
- $("#tinyType").append("<option value=''>请选择</option>");
- if(typeof(smallType) != "undefined" && smallType != "") {
- var tinyTypeNum = 0;
- for(var i=0; i<tinytypeList.length; i++){
- if (smallType == tinytypeList[i].smallTypeID) {
- tinyTypeNum = tinyTypeNum + 1;
- if(currentTinytype != null && typeof(currentTinytype) != "undefined" && currentTinytype == tinytypeList[i].tinyTypeID) {
- $("#tinyType").append("<option selected value='"+tinytypeList[i].tinyTypeID+"'>"+tinytypeList[i].name+"</option>");
- $("#tinyType").prev().find(".select2-chosen").text(tinytypeList[i].name);
- }else{
- $("#tinyType").append("<option value='"+tinytypeList[i].tinyTypeID+"'>"+tinytypeList[i].name+"</option>");
- }
- }
- }
- if (tinyTypeNum == 0) {
- $("#tinyType").removeClass("required");
- document.getElementById("s2id_tinyType").style.cssText = "display: none";
- }else {
- $("#tinyType").addClass("required");
- document.getElementById("s2id_tinyType").style.cssText = "display: inline-block";
- }
- } else {
- document.getElementById("s2id_tinyType").style.cssText = "display: none";
- $("#tinyType").removeClass("required");
- }
- }
- //验证字符串最大长度
- function checkmaxlength(str) {
- var realLength = 0;
- for (var i = 0; i < str.length; i++)
- {
- charCode = str.charCodeAt(i);
- if (charCode >= 0 && charCode <= 128)
- realLength += 1;
- else
- realLength += 2;
- }
- if(realLength > 100){
- alertx("商品名称最多50个汉字,即100个字符!当前输入长度为"+realLength);
- }
- }
- //验证字符串最大长度
- function checkmaxlengths(str,maxlength) {
- var realLength = 0;
- for (var i = 0; i < str.length; i++)
- {
- charCode = str.charCodeAt(i);
- if (charCode >= 0 && charCode <= 128)
- realLength += 1;
- else
- realLength += 2;
- }
- if(realLength > maxlength){
- alertx("商品名称最多30个汉字,即60个字符!当前输入长度为"+realLength);
- }
- }
- function checkmaxlengthsBySearch(searckThis,str,maxlength) {
- var realLength = 0;
- var maxChange = "1";
- for (var i = 0; i < str.length; i++)
- {
- charCode = str.charCodeAt(i);
- if (charCode >= 0 && charCode <= 128)
- realLength += 1;
- else{
- realLength += 2;
- maxChange = "2";
- }
- }
- if(maxChange == "2"){
- var s = str.substr(0,16);
- $(searckThis).val(s);
- }
- if(realLength > maxlength){
- alertx("关键字最多16个汉字,即32个字符!");
- }
- }
- function checkPrecisehKeyLength(str) {
- var realLength = 0;
- for (var i = 0; i < str.length; i++)
- {
- charCode = str.charCodeAt(i);
- if (charCode >= 0 && charCode <= 128)
- realLength += 1;
- else
- realLength += 2;
- }
- if(realLength > 160){
- alertx("精确关键词最多80个汉字,即160个字符!当前输入长度为"+realLength);
- }
- }
- // 添加相关参数
- var productParametersIndex = $('#productParametersLength').val() - 1;
- $(".addParams").click(function(){
- var val = $("#paramsName").val();
- // alertx("+++++"+val.length)
- productParametersIndex++;
- var html = '<div id="paramsItem" class="paramsItem">';
- html += '<input name="productParametersList['+[productParametersIndex]+'].paramsName" id="paramsName" style="width:142px" maxlength="10" placeholder="参数名称" type="text" class="input-small"/> ';
- html += '<input name="productParametersList['+[productParametersIndex]+'].paramsContent" id="paramsContent" style="width:680px" maxlength="50" placeholder="请输入参数信息" type="text" class="input-small"/> ';
- html += '<span type="button" style="cursor: pointer;color: #0B61A4" onclick="deleteParams(this)"">删除</span>';
- html += '</div>';
- $("#addParamsItems").append(html).show();
- var paramsItemLength = $('.paramsItem').length;
- if(paramsItemLength === 50){
- $(this).hide();
- return
- }
- });
- //添加标签
- $(".addTags").click(function(){
- // 获取输入新标签
- var val = $("#inputTags").val();
- // 清空输入框输入
- $("#inputTags").val("");
- if(null === val || "" === val){
- alertx("请输入商品标签");
- return;
- }
- // 添加新标签
- $("#tagsList").append('<div class="tags-li"><input id="tags" name="tags" value="'+val+'" class="tags-s" readonly/><i onclick="removerX(this)">X</i></div>').show();
- var tagsLength = $('.tags-li').length;
- if(tagsLength === 6){
- $(this).hide();
- return
- }
- });
- /**
- * 删除对于标签
- */
- function removerX(ithis) {
- $(ithis).parent().remove();
- var tagsLength = $('.tags-li').length;
- if(tagsLength < 6){
- $('.addTags').show();
- }
- }
- //初始化商品类型
- $(function () {
- changeMachine();
- })
- function changeMachine() {
- var val = $("#productType").val();
- // 0其它,1妆字号,2械字号
- if(val == 1 || val == 0){
- //隐藏械字号
- $(".machineType").hide();
- }else if(val == 2){
- // 显示械字号
- $(".machineType").show();
- }
- }
- //初始化含税信息
- $(function () {
- var includedTax = $("input[name='includedTax']:checked").val();
- var invoiceType = $("input[name='invoiceType']:checked").val();
- var taxPoint = $("#taxPoint").val();
- //1含税,0不含税
- if(includedTax == 1){
- $("#invoiceItem").show().find(".invoice").show().siblings(".notInvoice").hide();
- $("#taxPointDiv").show();
- $("#supplierTaxPointDiv").show();
- }
- if(includedTax == 0){
- $("#invoiceItem").show().find(".invoice").show().siblings(".notInvoice").show();
- // 选择增值税且不为不开发票
- if(invoiceType == 3){
- $("#taxPointDiv").hide();
- $("#supplierTaxPointDiv").hide();
- }else{
- $("#taxPointDiv").show();
- $("#supplierTaxPointDiv").show();
- }
- }
- if(includedTax == 2){
- $("#invoiceItem").hide();
- $("#taxPointDiv").hide();
- $("#supplierTaxPointDiv").hide();
- }
- if(includedTax == "" || includedTax == null){
- $("#invoiceItem").hide();
- $("#taxPointDiv").hide();
- $("#supplierTaxPointDiv").hide();
- }
- //发票初始化
- if(includedTax == 0 && (invoiceType == 1 || invoiceType == 2)){
- $("#taxPointDiv").show();
- $("#supplierTaxPointDiv").show();
- }
- if(includedTax == 1){//含税
- // 一个都没选中默认选中增值税
- if(invoiceType != 1 && invoiceType != 2){
- $("input[name='invoiceType']:eq(0)").attr("checked",'checked');
- }
- }else if (includedTax == 0){//不含税
- // 一个都没选中默认选中增值税
- if(invoiceType != 1 && invoiceType != 2 && invoiceType != 3){
- $("input[name='invoiceType']:eq(0)").attr("checked",'checked');
- }
- if(invoiceType == 1){//增值税
- // 如果税点为空,如果选择的是1(增值:默认13%)、2(普通:6%)
- if(taxPoint == null || taxPoint == ""){
- $("#taxPoint").val(13);
- }
- }else if(invoiceType == 2){//普通发票
- // 如果税点为空,如果选择的是1(增值:默认13%)、2(普通:6%)
- if(taxPoint == null || taxPoint == ""){
- $("#taxPoint").val(6);
- }
- }
- }
- });
- /**
- * @param obj
- * jquery控制input只能输入数字
- */
- function onlynum(obj) {
- obj.value = obj.value.replace(/[^\d]/g, ""); //清除"数字"以外的字符
- }
- function chageIncludedTax(taxPointValue) {
- //修改选择项
- var includedTax = $("input[name='includedTax']:checked").val();
- var invoiceType = $("input[name='invoiceType']:checked").val();
- var taxPoint = taxPointValue;
- //1含税,0不含税,2未知
- if(includedTax == 1){
- $("#invoiceItem").show().find(".invoice").show().siblings(".notInvoice").hide();
- $("#taxPointDiv").show();
- $("#supplierTaxPointDiv").show();
- }
- if(includedTax == 0){
- $("#invoiceItem").show().find(".invoice").show().siblings(".notInvoice").show();
- // 选择增值税且不为不开发票
- if(invoiceType == 3){
- $("#taxPointDiv").hide();
- $("#supplierTaxPointDiv").hide();
- }else{
- $("#taxPointDiv").show();
- $("#supplierTaxPointDiv").show();
- }
- }
- if(includedTax == 2){
- $("#invoiceItem").hide();
- $("#taxPointDiv").hide();
- $("#supplierTaxPointDiv").hide();
- }
- if(includedTax == "" || includedTax == null){
- $("#invoiceItem").hide();
- $("#taxPointDiv").hide();
- $("#supplierTaxPointDiv").hide();
- }
- if(includedTax == 1){//含税
- // 一个都没选中默认选中增值税
- if(invoiceType != 1 && invoiceType != 2){
- $("input[name='invoiceType']:eq(0)").attr("checked",'checked');
- }
- }else if (includedTax == 0){//不含税
- // 一个都没选中默认选中增值税
- if(invoiceType != 1 && invoiceType != 2 && invoiceType != 3){
- $("input[name='invoiceType']:eq(0)").attr("checked",'checked');
- }
- }
- invoiceType = $("input[name='invoiceType']:checked").val();
- if(invoiceType == 1){//增值税
- // 如果税点为空,如果选择的是1(增值:默认13%)、2(普通:6%)
- if(taxPoint == null || taxPoint == ""){
- $("#taxPoint").val(13);
- $("#supplierTaxPoint").val(13);
- }
- }else if(invoiceType == 2){//普通发票
- // 如果税点为空,如果选择的是1(增值:默认13%)、2(普通:6%)
- if(taxPoint == null || taxPoint == ""){
- $("#taxPoint").val(6);
- $("#supplierTaxPoint").val(6);
- }
- }
- }
- //选择发票类型
- function changeInvoiceType(taxPointValue) {
- var taxPoint = taxPointValue;
- var includedTax = $("input[name='includedTax']:checked").val();
- //选择发票类型:1增值税票,2普通票, 3不能开票
- var invoiceType = $("input[name='invoiceType']:checked").val();
- //只有在选择了不含税才使用税点,不含税里面的
- if( (includedTax == 0 || includedTax == 1) && (invoiceType == 1 || invoiceType == 2)){
- $("#taxPointDiv").show();
- $("#supplierTaxPointDiv").show();
- }else{
- $("#taxPointDiv").hide();
- $("#supplierTaxPointDiv").hide();
- }
- if(invoiceType == 1){//增值税
- // 如果税点为空,如果选择的是1(增值:默认13%)、2(普通:6%)
- if(taxPoint == null || taxPoint == ""){
- $("#taxPoint").val(13);
- $("#supplierTaxPoint").val(13);
- }
- }else if(invoiceType == 2){//普通发票
- // 如果税点为空,如果选择的是1(增值:默认13%)、2(普通:6%)
- if(taxPoint == null || taxPoint == ""){
- $("#taxPoint").val(6);
- $("#supplierTaxPoint").val(6);
- }
- }
- }
- //删除相关参数
- function deleteParams(paramsThis) {
- $(paramsThis).parent().remove();
- var paramsItemLength = $('.paramsItem').length;
- if(paramsItemLength < 50){
- $('.addParams').show();
- }
- }
- //限制两位小数
- function setTwoNumberDecimal(that) {
- var n = parseFloat(that.value);
- that.value = n.toFixed(2)
- }
- </script>
- </body>
- </html>
|