12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769 |
- <%@ 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?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}&shopType=${product.shopType}"
- method="post" class="form-horizontal">
- <form:hidden path="id"/>
- <form:hidden path="searchName"/>
- <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>
- <c:if test="${product.shopType == 2}">
- <tr>
- <th><span style="color: red">*</span>供应商:</th>
- <td colspan="3">
- <form:select path="shopID" class="input-small required">
- <form:option value="" label="请选择"/>
- <form:options items="${shopList}" itemLabel="name" itemValue="shopID" htmlEscape="false"/>
- </form:select>
- </td>
- </tr>
- <tr>
- <th>商品图片:</th>
- <td class="controls upload-content" id="secondHandImage">
- <div class="conList">
- <form:hidden value="${product.image1}" id="image1" path="image1" htmlEscape="false"
- maxlength="255" class="input-xlarge required"/>
- <sys:ckfinder input="image1" type="images" uploadPath="/photo" selectMultiple="false"
- maxWidth="100"
- maxHeight="100"/>
- </div>
- <div class="conList hide-pic">
- <form:hidden value="${product.image2}" id="image2" path="image2" htmlEscape="false"
- maxlength="255" class="input-xlarge"/>
- <sys:ckfinder input="image2" type="images" uploadPath="/photo" selectMultiple="false"
- maxWidth="100"
- maxHeight="100"/>
- </div>
- <div class="conList hide-pic">
- <form:hidden value="${product.image3}" id="image3" path="image3" htmlEscape="false"
- maxlength="255" class="input-xlarge"/>
- <sys:ckfinder input="image3" type="images" uploadPath="/photo" selectMultiple="false"
- maxWidth="100"
- maxHeight="100"/>
- </div>
- <div class="conList hide-pic">
- <form:hidden value="${product.image4}" id="image4" path="image4" htmlEscape="false"
- maxlength="255" class="input-xlarge"/>
- <sys:ckfinder input="image4" type="images" uploadPath="/photo" selectMultiple="false"
- maxWidth="100"
- maxHeight="100"/>
- </div>
- <div class="conList hide-pic">
- <form:hidden value="${product.image5}" id="image5" path="image5" htmlEscape="false"
- maxlength="255" class="input-xlarge"/>
- <sys:ckfinder input="image5" type="images" uploadPath="/photo" selectMultiple="false"
- maxWidth="100"
- maxHeight="100"/>
- </div>
- <div class="conList upload-tips" style="margin-left: 205px">
- <font color="red">第一张图作为商品主图必传;最多上传5张商品图片,请尽量全部上传,单张图片不能超过5M</font>
- </div>
- </td>
- </tr>
- </c:if>
- <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 class="training" hidden>
- <th><span class="red">*</span>培训方式:</th>
- <td colspan="3">
- <label><input type="radio" name="trainingMethod"
- value="1" ${empty product.trainingMethod || product.trainingMethod == 1 ? "checked" : ""} />线上培训<b
- class="line">|</b></label>
- <label><input type="radio" name="trainingMethod"
- value="2" ${product.trainingMethod == 2 ? "checked" : ""} />线下培训</label>
- </td>
- </tr>
- <tr class="training" hidden>
- <th><span class="red">*</span>培训费用:</th>
- <td colspan="3">
- <label><input type="radio" name="trainingType"
- value="1" ${empty product.trainingType || product.trainingType == 1 ? "checked" : ""}
- onchange="trainingShow()"/>售价未包含<b class="line">|</b></label>
- <label><input type="radio" name="trainingType" value="2" ${product.trainingType == 2 ? "checked" : ""}
- onchange="trainingShow()"/>售价已包含</label>
- </td>
- </tr>
- <tr id="trainingFee" hidden>
- <th></th>
- <td colspan="3">
- <input type="number" name="trainingFee" value="${product.trainingFee}" style="width: 250px" min="0"
- placeholder="请填写包含食宿,交通等各项费用的总金额"/>
- </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" id="productType" onchange="js()" 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="price" type="number" id="price" 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"||product.includedTax==null ? "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"||product.invoiceType ==null ? "checked" : ""}>不能开票</label>
- </span>
- </td>
- </tr>
- <tr>
- <th>线上分账账号:</th>
- <td colspan="3">
- <form:input path="splitCode" type="text" id="splitCode" maxlength="15"/>
- </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:option value="4" label="仅医美机构可见"/>
- </form:select>
- </td>
- </tr>
- <tr>
- <th><span class="red">*</span>价格可见度:</th>
- <td colspan="3">
- <form:select path="priceFlag" class="input-large required" id="priceFlag">
- <form:option value="0" label="对所有机构公开"/>
- <form:option value="2" label="仅对会员机构公开"/>
- <form:option value="3" label="仅对医美机构公开"/>
- <form:option value="1" label="价格不公开"/>
- </form:select>
- </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>
- <th>商品说明:</th>
- <td colspan="3">
- <form:textarea path="productDescribe" id="wipeRemarks" maxlength="200" placeholder="请输入备注文字,不能超过200字" class="input-xlarge" rows="4"></form:textarea>
- <p style="width:500px;text-align:left;"><span id="remarkLen" style="color:red;">0</span>/200</p>
- </td>
- </tr>
- <tr id="allAreaInput">
- <th></th>
- <td>
- <span>
- <form:checkboxes path="provinceIDs" items="${provinceList}" itemLabel="name" itemValue="id"/>
- </span>
- </td>
- </tr>
- <tr>
- <th>订购方案:</th>
- <td colspan="3">
- <div class="detailInfoEditor" style="width: 620px;">
- <form:textarea path="orderInfo" class="input-xlarge hide"/>
- <!-- 富文本编辑器 -->
- <div id="orderInfoEditor">${product.orderInfo}</div>
- </div>
- </td>
- </tr>
- <tr>
- <th>服务详情:</th>
- <td colspan="3">
- <div class="detailInfoEditor" style="width: 620px;">
- <form:textarea path="serviceInfo" class="input-xlarge hide"/>
- <!-- 富文本编辑器 -->
- <div id="serviceInfoEditor">${product.serviceInfo}</div>
- </div>
- </td>
- </tr>
- <tr>
- <th><span class="red">*</span>资质机构商品详情:</th>
- <td><span style="color: red">(适用于资质机构)</span></td>
- <th><span class="red">*</span>普通机构商品详情:</th>
- <td><span style="color: red">(适用于游客和个人机构,可选择是否和资质机构商品详情相同,不相同的话需要编辑内容)</span>
- <label>
- <input type="radio"
- name="productDetail"
- value="1" ${product.productDetail == "1" ? "checked" : ""} />同资质机构商品详情<b
- class="line">|</b>
- </label>
- <label>
- <input type="radio"
- name="productDetail"
- value="2" ${product.productDetail == "2" || product.productDetail == null ? "checked" : ""} />不同于资质机构商品详情(即使用以下编辑内容)
- </label>
- </td>
- </tr>
- <tr>
- <td colspan="2" style="vertical-align: top;">
- <div class="detailInfoEditor" style="width: 620px;">
- <form:textarea path="detailInfo" htmlEscape="false" class="input-xlarge required hide"/>
- <!-- 富文本编辑器 -->
- <div id="detailInfoEditor">${product.detailInfo}</div>
- </div>
- </td>
- <td colspan="3" style="vertical-align: top;">
- <div class="detailInfoEditor" style="width: 620px;">
- <form:textarea path="commonDetailInfo" htmlEscape="false" class="input-xlarge required hide"/>
- <!-- 富文本编辑器 -->
- <div id="detailInfoEditor2">${product.commonDetailInfo==""||product.commonDetailInfo==null?"若要查看更多产品信息,请注册机构会员,如有疑问请联系客服。":product.commonDetailInfo}</div>
- </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("caimeiCore", Global.getConfig("caimei.core"));%>
- <script type="text/javascript" src="${ctxStatic}/ckeditor5-new/ckeditor.js"></script>
- <script type="text/javascript">
- $(function (){
- var productType= $("#productType").val();
- if (productType=="2"){
- $("#priceFlag").val(3);
- $("#visibility").val(4);
- $("#visibility").prev().find(".select2-chosen").text("仅对医美机构开放");
- $("#priceFlag").prev().find(".select2-chosen").text("仅对医美机构开放");
- $("#priceFlag").prop("disabled",true);
- $("#visibility").prop("disabled",true);
- }
- })
- function js(){
- var val = $("#productType").val();
- if(val == '2'){
- $("#priceFlag").val(3);
- $("#visibility").val(4);
- $("#visibility").prev().find(".select2-chosen").text("仅对医美机构开放");
- $("#priceFlag").prev().find(".select2-chosen").text("仅对医美机构开放");
- $("#priceFlag").prop("disabled",true);
- $("#visibility").prop("disabled",true);
- } else {
- $("#priceFlag").prop("disabled",false);
- $("#visibility").prop("disabled",false);
- }
- }
- $(document).ready(function () {
- $('body').on('keyup', '#wipeRemarks', function () {
- $('#remarkLen').text($(this).val().length);
- });
- //$("#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());--%>
- <%-- }--%>
- <%-- });--%>
- <%--});*/--%>
- <%--// 价格可见度: 1不公开价格,3仅对医美机构公开,2仅对会员机构公开,0公开价格--%>
- <%--// 对应滑块:1->2->3->4--%>
- <%--$(function() {--%>
- <%-- var initValue = ${(product.priceFlag eq 0) ? 2 : ((product.priceFlag eq 2) ? 1 : 0)}--%>
- <%-- var initValue = ${(product.priceFlag eq 1) ? 1 : ((product.priceFlag eq 3) ? 2 : ((product.priceFlag eq 2) ? 3 : 4))}--%>
- <%-- var select = $("#priceFlag");--%>
- <%-- var slider = $("<div id='slider'></div>").insertAfter(select).slider({--%>
- <%-- min: 1,--%>
- <%-- max: 4,--%>
- <%-- range: "min",--%>
- <%-- value: initValue,--%>
- <%-- slide: function(event, ui) {--%>
- <%-- if (ui.value*1 === 4){--%>
- <%-- // 所有可见--%>
- <%-- select.val(0);--%>
- <%-- } else if (ui.value*1 === 3){--%>
- <%-- // 会员可见--%>
- <%-- select.val(2);--%>
- <%-- } else if (ui.value*1 === 2){--%>
- <%-- // 医美可见--%>
- <%-- select.val(3);--%>
- <%-- } else{--%>
- <%-- // 不可见--%>
- <%-- select.val(1);--%>
- <%-- }--%>
- <%-- //select[0].selectedIndex = ui.value;--%>
- <%-- $("#textFlagNote").text(select.find("option:selected").text());--%>
- <%-- }--%>
- <%-- });--%>
- <%--});--%>
- //图片初始化
- if(${product.shopType == 2}){
- $(function () {
- 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个字符!");
- }
- }
- $('.upload-content .conList .btn:nth-of-type(1)').html('<div><span>+</span><h5>选择图片</h5></div>');
- $('.upload-content .conList .btn:nth-of-type(2)').after('<img class="cancel-upload" src="/static/images/close-btn1.png">').remove();
- $('.upload-content .conList').find('.cancel-upload').hide();
- var observeEle = document.getElementsByClassName('upload-content')[0];
- var MutationObserver = window.MutationObserver || window.WebKitMutationObserver;
- var MutationObserverConfig = {
- childList: true,
- subtree: true,
- characterData: true
- };
- var observer = new MutationObserver(function (mutations) {
- $.each(mutations, function (index, item) {
- if (item.type === 'childList') {
- // 在创建新的 element 时调用
- var target = $(item.target),
- thisWrapper = target.closest('.conList'),
- nextEle = thisWrapper.next();
- thisWrapper.find('li').css('z-index', 99);
- thisWrapper.find('.cancel-upload').show();
- if (nextEle.hasClass('hide-pic')) {
- nextEle.removeClass('hide-pic');
- }
- }
- })
- });
- observer.observe(observeEle, MutationObserverConfig);
- $('body').on('click', '.upload-content li', function () {
- var index = $(this).closest('.conList').index() + 1,
- str = 'image' + index + 'FinderOpen';
- eval(str + '()');
- });
- $('body').on('click', '.cancel-upload', function () {
- var wrapper = $(this).closest('.conList');
- wrapper.find('li').css('z-index', '-1');
- wrapper.find('input').val('');
- $(this).hide();
- if ($('.cancel-upload:visible').length < 9) {
- wrapper.addClass("hide-pic");
- } else {
- wrapper.removeClass("hide-pic");
- }
- wrapper.parent().append(wrapper.clone());
- wrapper.remove();
- $(".conList").each(function (i, ele) {
- if ($(ele).find("input.input-xlarge").val()) {
- $(ele).next().removeClass("hide-pic")
- }
- })
- });
- $(window).on("load", function () {
- setTimeout(function () {
- $("#secondHandImage").find("input.input-xlarge").each(function (i, ele) {
- if ($(ele).val()) {
- $(ele).next().find("li").css("z-index", "99");
- $(ele).parents(".conList").find(".cancel-upload").show();
- $(ele).parents(".conList").next().removeClass("hide-pic")
- }
- })
- }, 500);
- });
- $('.upload-content-image .conList .btn:nth-of-type(1)').html('<div><span>+</span><h5>选择图片</h5></div>');
- $('.upload-content-image .conList .btn:nth-of-type(2)').after('<img class="cancel-upload-image" src="/static/images/close-btn1.png">').remove();
- $('.upload-content-image .conList').find('.cancel-upload-image').hide();
- var observeEleImage = document.getElementsByClassName('upload-content-image')[0];
- // var observeEleImage1 = document.getElementsByClassName('upload-content-image')[1];
- var MutationObserverImage = window.MutationObserver || window.WebKitMutationObserver;
- var MutationObserverConfigImage = {
- childList: true,
- subtree: true,
- characterData: true
- };
- var observerImage = new MutationObserverImage(function (mutations) {
- $.each(mutations, function (index, item) {
- if (item.type === 'childList') {
- // 在创建新的 element 时调用
- var target = $(item.target),
- thisWrapper = target.closest('.conList'),
- nextEle = thisWrapper.next();
- thisWrapper.find('li').css('z-index', 99);
- thisWrapper.find('.cancel-upload-image').show();
- if (nextEle.hasClass('hide-pic-image')) {
- nextEle.removeClass('hide-pic-image');
- }
- }
- });
- });
- // observerImage.observe(observeEleImage, MutationObserverConfigImage);
- // observerImage.observe(observeEleImage1, MutationObserverConfigImage);
- $('body').on('click', '.upload-content-image li', function () {
- var index = $(this).closest('.conList').index() + 1,
- str = 'remarkImage' + index + 'FinderOpen';
- eval(str + '()');
- });
- $('body').on('click', '.cancel-upload-image', function () {
- var wrapper = $(this).closest('.conList');
- wrapper.find('li').css('z-index', '-1');
- wrapper.find('input').val('');
- $(this).hide();
- wrapper.removeClass("hide-pic-image");
- wrapper.parent().append(wrapper.clone());
- wrapper.remove();
- $(".conList").each(function (i, ele) {
- if ($(ele).find("input.input-xlarge").val()) {
- $(ele).next().removeClass("hide-pic-image")
- }
- })
- });
- });
- }
- /**
- * @param obj
- * jquery控制input只能输入数字和两位小数
- */
- function num(obj) {
- obj.value = obj.value.replace(/[^\d.]/g, ""); //清除"数字"和"."以外的字符
- obj.value = obj.value.replace(/^\./g, ""); //验证第一个字符是数字
- obj.value = obj.value.replace(/\.{2,}/g, "."); //只保留第一个, 清除多余的
- obj.value = obj.value.replace(".", "$#$").replace(/\./g, "").replace("$#$", ".");
- obj.value = obj.value.replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3'); //只能输入两个小数
- }
- //初始化标签
- $(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.price};
- $(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: '${caimeiCore}/tools/image/upload/ckeditor'
- }
- }).then(function (editor) {
- window.detailInfoEditor = editor;
- }).catch(function (error) {
- console.log(error);
- });
- //富文本框
- ClassicEditor.create(document.querySelector('#detailInfoEditor2'), {
- ckfinder: {
- uploadUrl: '${caimeiCore}/tools/image/upload/ckeditor'
- }
- }).then(function (editor) {
- window.detailInfoEditor2 = editor;
- }).catch(function (error) {
- console.log(error);
- });
- ClassicEditor.create(document.querySelector('#orderInfoEditor'), {
- ckfinder: {
- uploadUrl: '${caimeiCore}/tools/image/upload/ckeditor'
- }
- }).then(function (editor) {
- window.orderInfoEditor = editor;
- }).catch(function (error) {
- console.log(error);
- });
- ClassicEditor.create(document.querySelector('#serviceInfoEditor'), {
- ckfinder: {
- uploadUrl: '${caimeiCore}/tools/image/upload/ckeditor'
- }
- }).then(function (editor) {
- window.serviceInfoEditor = editor;
- }).catch(function (error) {
- console.log(error);
- });
- });
- //富文本框编辑
- function checkInfo() {
- var detailInfo = detailInfoEditor.getData();
- $("#detailInfo").val(detailInfo);
- var commonDetailInfo = detailInfoEditor2.getData();
- $("#commonDetailInfo").val(commonDetailInfo);
- 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 price = $('#price').val();
- if (input.value * 1 > price) {
- $(input).val('');
- alertx("第一个阶梯价格不能大于机构价");
- }
- }
- }
- // 是否使用阶梯价格
- function changeLadderPrice() {
- var ladderPriceFlag = $("input[name='ladderPriceFlag']:checked").val();
- var svipFlag = ${product.svipFlag};
- if (svipFlag == 1) {
- alertx("超级会员优惠商品不能设置阶梯价格,请先取消优惠后再设置");
- $("input[name='ladderPriceFlag']").get(0).checked = true;
- } else {
- 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();
- trainingShow();
- }
- 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)
- }
- //培训相关显示
- function trainingShow() {
- var commodityType = $("input[name='commodityType']:checked").val();
- var trainingType = $("input[name='trainingType']:checked").val();
- if (commodityType == 2) {
- $(".training").show();
- if (trainingType == 1) {
- $("#trainingFee").show();
- } else {
- $("#trainingFee").hide();
- }
- } else {
- $(".training").hide();
- $("#trainingFee").hide();
- }
- }
- </script>
- </body>
- </html>
|