123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046 |
- <%@ 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;
- }
- .upload-content {
- margin-top: -70px;
- display: inline-block;
- }
- .conList{
- float: left;
- }
- .upload-content .conList .btn:nth-of-type(1) {
- width: 90px;
- height: 113px;
- border: 2px solid #eee;
- background: #fff;
- position: relative;
- }
- .upload-content .conList .btn:nth-of-type(1) > div {
- position: absolute;
- top: 50%;
- left: 50%;
- transform: translate(-50%, -50%);
- color: #666;
- }
- .upload-content .conList .btn:nth-of-type(1) span {
- font-size: 35px;
- }
- .upload-content .conList .btn:nth-of-type(1) h5 {
- color: #666;
- }
- .cancel-upload {
- background: transparent;
- border: none;
- box-shadow: none;
- position: relative;
- top: -53px;
- left: -25px;
- cursor: pointer;
- z-index: 100;
- }
- .upload-content .conList ol{
- list-style-type: none;
- }
- .upload-content .conList ol li {
- width: 114px;
- height: 114px;
- text-align: center;
- background: #fff;
- position: relative;
- top: 130px;
- margin-left: 2px;
- left: -25px;
- overflow: hidden;
- }
- .upload-content-image {
- margin-top: -70px;
- }
- .upload-content-image .conList .btn:nth-of-type(1) {
- width: 90px;
- height: 100px;
- border: 2px solid #eee;
- background: #fff;
- position: relative;
- }
- .upload-content-image .conList .btn:nth-of-type(1) > div {
- position: absolute;
- top: 50%;
- left: 50%;
- transform: translate(-50%, -50%);
- color: #666;
- }
- .upload-content-image .conList .btn:nth-of-type(1) span {
- font-size: 35px;
- }
- .upload-content-image .conList .btn:nth-of-type(1) h5 {
- color: #666;
- }
- .upload-content-image .conList ol li {
- width: 114px;
- min-height: 80px;
- text-align: center;
- background: #fff;
- position: relative;
- top: 136px;
- margin-left: 2px;
- left: -25px;
- }
- .cancel-upload-image {
- background: transparent;
- border: none;
- box-shadow: none;
- position: relative;
- top: -38px;
- left: -25px;
- cursor: pointer;
- z-index: 100;
- }
- .hide-pic {
- display: none !important;
- }
- .hide-pic-image {
- display: none !important;
- }
- .form-horizontal .controls:first-child{
- padding-left: 0 !important;
- margin-left: 0 !important;
- }
- </style>
- </head>
- <body>
- <ul class="nav nav-tabs">
- <li><a href="${ctx}/product/new/list">商品信息列表</a></li>
- <c:if test="${not empty product.id}">
- <li class="active"><a href="${ctx}/product/new/productEdit?id=${product.id}">商品信息编辑</a></li>
- </c:if>
- <c:if test="${empty product.id}">
- <li class="active"><a href="${ctx}/product/new/productEdit?id=${product.id}">发布特殊供应商商品</a></li>
- </c:if>
- </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" onchange="getCodes(this.value)">
- <form:option value="" label="请选择"/>
- <c:forEach items="${shopList}" var="shop" varStatus="index">
- <form:option value="${shop.shopID}" label="${shop.name}"/>
- </c:forEach>
- </form:select>
- </td>
- </tr>
- <tr>
- <th>商品图片:</th>
- <td>
- <div class="controls upload-content" id="secondHandImage" style="width: 800px;">
- <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>
- <div class="conList upload-tips" style="margin-top: 20px;">
- <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" id="machineType" onchange="js()" 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 class="machineType">
- <th><span class="red">*</span>证书编号:</th>
- <td colspan="1">
- <form:input path="qualificationNo" maxlength="50" class="input-small"/>
- </td>
- </tr>
- <tr class="machineType">
- <th><span class="red">*</span>产品名称:</th>
- <td colspan="2">
- <form:input path="productName" maxlength="80" class="input-small"/>
- </td>
- </tr>
- <tr class="machineType">
- <th><span class="red">*</span>证书有效期:</th>
- <td colspan="3">
- <%-- <form:input path="qualificationTime" type="text" maxlength="20" class="input-medium Wdate" value="${product.qualificationTime}" onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false});"/>--%>
- <form:input path="qualificationTime" type="text" maxlength="10" class="input-medium Wdate"
- value="${qualificationTime}"
- onclick="WdatePicker({dateFmt:'yyyy-MM-dd ',isShowClear:false});"/>
- </td>
- </tr>
- <tr class="machineType">
- <th><span class="red">*</span>证书基本信息链接:</th>
- <td colspan="4">
- <form:input path="qualificationLink" maxlength="300"
- class="input-small"/>
- </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">
- <c:if test="${not empty product.productID}">
- <form:select path="splitCode" class="select-ele input-medium">
- <form:option value="" label="请选择"/>
- <c:forEach items="${splitCodeList}" var="splitCodeList" varStatus="index">
- <form:option value="${splitCodeList.splitCode}" label="${splitCodeList.codeRemark}"/>
- </c:forEach>
- </form:select>
- </c:if>
- <c:if test="${empty product.productID}">
- <form:select path="splitCode" class="select-ele input-medium" id="getCode">
- <form:option value="" label="请选择"/>
- </form:select>
- </c:if>
- </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">
- <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">
- <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">
- <form:select path="commodityDetailsFlag" class="input-large required">
- <form:option value="1" label="所有人可见"/>
- <form:option value="2" label="所有机构可见"/>
- <form:option value="3" label="仅会员机构可见"/>
- <form:option value="4" 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><span class="red">*</span>首页新品展示:</th>
- <td colspan="3">
- <c:if test="${product.newProductType==1}">
- <input type="radio" checked="checked" name="newProductType" value="1" class="required" />参与新品展示
- <input type="radio" name="newProductType" value="2" class="required" />不参与新品展示
- </c:if>
- <c:if test="${empty product.newProductType || product.newProductType==2}">
- <input type="radio" name="newProductType" value="1" class="required" />参与新品展示
- <input type="radio" checked="checked" name="newProductType" value="2" class="required" />不参与新品展示
- </c:if>
- </td>
- <%-- <td colspan="3">--%>
- <%-- <label><input type="radio" name="newProductType" value="1"--%>
- <%-- ${product.newProductType == "1" ? "checked" : ""}>参与新品展示<b--%>
- <%-- class="line">|</b></label>--%>
- <%-- <label><input type="radio" name="newProductType" value="2"--%>
- <%-- ${product.newProductType == "2" ? "" : "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="return 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 () {
- // debugger
- var productType= $("#productType").val();
- if (productType=="2"){
- $("#s2id_priceFlag").val(3);
- $("#s2id_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();
- var mac = $("#machineType").val();
- if(val == '2'){
- if (mac == '1') {
- // 械字号一类
- $("#visibility").val(3);
- $("#priceFlag").val(0);
- $("#commodityDetailsFlag").val(1);
- $("#visibility").prev().find(".select2-chosen").text("所有人可见");
- $("#priceFlag").prev().find(".select2-chosen").text("对所有机构公开");
- $("#commodityDetailsFlag").prev().find(".select2-chosen").text("所有人可见");
- } else if (mac == '2') {
- // 械字号二类
- $("#visibility").val(3);
- $("#priceFlag").val(3);
- $("#commodityDetailsFlag").val(4);
- $("#visibility").prev().find(".select2-chosen").text("所有人可见");
- $("#priceFlag").prev().find(".select2-chosen").text("仅医美机构可见");
- $("#commodityDetailsFlag").prev().find(".select2-chosen").text("仅医美机构可见");
- } else if(mac == '3') {
- // 械字号三类
- $("#visibility").val(3);
- $("#priceFlag").val(3);
- $("#commodityDetailsFlag").val(4);
- $("#visibility").prev().find(".select2-chosen").text("所有人可见");
- $("#priceFlag").prev().find(".select2-chosen").text("仅医美机构可见");
- $("#commodityDetailsFlag").prev().find(".select2-chosen").text("仅医美机构可见");
- }
- } else {
- $("#priceFlag").prop("disabled",false);
- $("#visibility").prop("disabled",false);
- $("#commodityDetailsFlag").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());--%>
- <%-- }--%>
- <%-- });--%>
- <%--});--%>
- function getCodes(data){
- var opts = "<option value=''>请选择</option>";
- $.ajax({
- type: "POST",
- url: "${ctx}/product/new/getCodes",
- data: {"shopId": data},
- success: function (res) {
- console.log("data------------------->"+res)
- for (let i = 0; i < res.length; i++) {
- opts += "<option value='" + res[i].splitCode + "'>" + res[i].codeName + "</option>";
- }
- console.log(opts);
- $("#getCode").html('').append(opts);
- },
- error: function (res) {
- }
- });
- }
- //图片初始化
- 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 < 5) {
- 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 () {
- // debugger
- 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() {
- // debugger
- var productType= $("#productType").val();
- var qualificationNo= $('#qualificationNo').val()
- var productName= $("#productName").val();
- var qualificationTime= $('#qualificationTime').val()
- var qualificationLink= $("#qualificationLink").val();
- if (productType=="2") {
- if (qualificationNo == null || qualificationNo == "") {
- alertx("请输入证书编号");
- return false;
- }
- if (productName == null || productName == "") {
- alertx("请输入产品名称");
- return false;
- }
- if (qualificationTime == null || qualificationTime == "") {
- alertx("请输入证书有效时间");
- return false;
- }
- if (qualificationLink == null || qualificationLink == "") {
- alertx("请输入证书有效链接");
- return false;
- }
- }
- 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>
|