123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799 |
- <%@ 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"/>
- <link type="text/css" rel="stylesheet" href="${ctxStatic}/bootstrap-select/css/bootstrap-select.css"></link>
- <style>
- .sku-item-li{
- width: 100%;
- height: auto;
- float: left;
- margin-bottom: 5px;
- }
- .sku {
- display: flex;
- align-items: center;
- flex-wrap: wrap;
- border: 2px solid #666;
- padding: 10px;
- white-space: nowrap;
- margin-top: 10px;
- width: 1000px;
- }
- .sku-item-delete{
- width: 40%;
- height: auto;
- float: left;
- margin-left: 10px;
- }
- .sku .sku-item {
- float: left;
- margin-right: 12px;
- padding: 4px 0;
- }
- .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}&ladderPriceFlag=${product.ladderPriceFlag}"
- method="post" class="form-horizontal">
- <form:hidden path="id"/>
- <form:hidden path="searchName"/>
- <form:hidden path="shopID" id="shopId" />
- <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 auto-input">
- <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">
- <select class="selectpicker" multiple id="labelSelectBox" style="width: 240px" name="labelIds">
- <c:forEach items="${SearchFrequencyVo}" var="sea">
- <option value="${sea.id}">${sea.keyword}</option>
- </c:forEach>
- </select>
- <c:if test="${!empty product.keywords}">
- <span style="display: inline-block; width: 120px">供应商关联标签:(${product.shopName})</span>
- <span><textarea rows="6" style="width: 700px;">${product.keywords}</textarea></span>
- </c:if>
- </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>
- <input id="caimei" type="checkbox" name="groundMall" value="0" >【采美】平台
- <input id="bcc" type="checkbox" name="groundMall" value="4" >【丽格集采联盟】平台
- </td>
- </tr>
- <tr id="groundSkuCaimei">
- <th><span class="red">*</span>SKU种类:<br><span class="red">【采美】平台</span></th>
- <td>
- <div><span><button class="addSku" onclick="return false">添加SKU</button></span></div>
- <div class="sku-item sku-costCheckFlag" style="margin-top: 15px;">
- <span class="red">*</span>成本类型:
- <label><input type="radio" name="costCheckFlag" class="costCheckFlag" value="1"
- ${empty product.costCheckFlag || product.costCheckFlag == 1 ? "checked" : ""} />固定成本</label>
- <b class="line">|</b>
- <label><input type="radio" name="costCheckFlag" class="costCheckFlag" value="2"
- ${empty product.costCheckFlag || product.costCheckFlag == 2 ? "checked" : ""} />比例成本</label>
- </div>
- <%-- 插入html --%>
- <div id="skus"></div>
- </td>
- </tr>
- <tr id="groundSkuBcc">
- <th><span class="red">*</span>SKU种类:<br><span class="red">【丽格集采联盟】平台</span></th>
- <td>
- <div><span><button class="addMallSku" onclick="return false">添加SKU</button></span></div>
- <div class="sku-item sku-costCheckFlag" style="margin-top: 15px;">
- <span class="red">*</span>成本类型:
- <label><input type="radio" name="mallCostCheckFlag" class="mallCostCheckFlag" value="1"
- ${empty product.mallCostCheckFlag || product.mallCostCheckFlag == 1 ? "checked" : ""} />固定成本</label>
- <b class="line">|</b>
- <label><input type="radio" name="mallCostCheckFlag" class="mallCostCheckFlag" value="2"
- ${empty product.mallCostCheckFlag || product.mallCostCheckFlag == 2 ? "checked" : ""} />比例成本</label>
- </div>
- <%-- 插入html --%>
- <div id="mallSkus"></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>
- <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">
- <form:select path="returnGoodsStutas" class="input-large required" id="goods">
- <%-- ${product.returnGoodsStutas=="1" ? "selected" : ""}--%>
- <form:option value="1" label="能" />
- <form:option value="2" label="不能"/>
- </form:select>
- </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 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>
- </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 style="position: relative ;right: 500px"><span class="red">*</span>普通机构商品详情:</th>
- <td style="position: relative ;right: 500px"><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;position: relative ;right: 500px">
- <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;position: relative ;right: 300px">
- <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>
- <!-- 富文本编辑器 -->
- <script type="text/html" id="skuTemplate">
- <div class="sku">
- <input type="hidden" name="skuId">
- <input type="hidden" name="organizeId">
- <input type="hidden" name="mallProductId">
- <div class="sku-item-li">
- <div class="sku-item sku-unit">
- <span class="red">*</span>包装规格:
- <input name="unit" type="text" maxlength="15" style="width: 40px" class="short required"/>
- </div>
- <div class="sku-item sku-normalPrice">
- <span class="red">*</span>市场价:
- <input style="width: 60px" name="normalPrice" type="number" maxlength="10"
- class="short input-small required"/>元
- </div>
- <div class="sku-item sku-price">
- <span class="red">*</span>机构价:
- <input name="price" type="number" id="price" maxlength="11" style="width: 70px"
- class="short computedPrice required"
- onkeyup="computedPriceLevel(this.value)"/>
- </div>
- <div class="sku-item sku-stock">
- <span>库存:</span>
- <input name="stock" style="width: 50px" type="number" maxlength="11" class="short required"/>
- </div>
- <div class="sku-item sku-minBuyNumber">
- <span class="red">*</span>起订量:
- <input style="width: 40px" type="number" name="minBuyNumber" maxlength="11" class="short required"/>
- </div>
- </div>
- <div class="sku-item-li">
- <%-- <div class="sku-item sku-costCheckFlag">--%>
- <%-- <span class="red">*</span>成本类型:--%>
- <%-- <label><input type="radio" name="costCheckFlag" value="1" checked/>固定成本</label>--%>
- <%-- <b class="line">|</b>--%>
- <%-- <label><input type="radio" name="costCheckFlag" value="2"/>比例成本</label>--%>
- <%-- </div>--%>
- <div class="sku-item sku-costPrice">
- <span class="red">*</span>
- <span class="costFlagText">成本价</span>:
- 供应商:<input style="width: 60px" name="costPrice" type="number" maxlength="11" class="short costPrice"/>
- 集团:<input style="width: 60px" name="organizeCostPrice" type="number" maxlength="11" class="short organizeCostPrice"/>
- 采美:<input style="width: 60px" name="cmCostPrice" type="number" maxlength="11" class="short cmCostPrice"/>
- </div>
- <div class="sku-item sku-shopPercent" style="display: none;">
- <span class="red">*</span>佣金比例:
- 供应商:<input style="width: 50px" name="shopPercent" type="number" maxlength="11" class="short shopPercent"/>%
- 集团:<input style="width: 50px" name="organizePercent" type="number" maxlength="11" class="short organizePercent"/>%
- 采美:<input style="width: 50px" name="cmPercent" type="number" maxlength="11" class="short cmPercent"/>%
- </div>
- </div>
- <div class="sku-item-li sku-item-delete">
- <div class="sku-item sku-ladderPriceFlag">
- <span class="red">*</span>商品展示价格:
- <label> <input type="radio" name="ladderPriceFlag" value="0" checked/> 不使用阶梯价格
- </label>
- <b class="line">|</b>
- <label> <input type="radio" name="ladderPriceFlag" value="1"/>使用阶梯价格</label>
- </div>
- </div>
- <div class="sku-item-delete"><span><button class="deleteSku" onclick="deleteDiv(this)">删除SKU</button></span></div>
- <div class="ladderPriceBox" style="display: none;">
- <div class="ladderPrice">
- 起订量:
- <input name="buyNum" min="1" type="number" maxlength="11" buyNum class="short number"/>(${product.unit})及以上,
- <input name="buyPrice" type="number" maxlength="11" class="short price"/>元/(${product.unit})
- <a class="addBtn" href="javascript:;">添加</a>
- <input type="hidden" name="id"/>
- <input class="delFlag" type="hidden" value="1" name="delFlag"/>
- </span>
- </div>
- <div class="ladderPrice" style="display: none">
- 起订量:
- <input name="buyNum" type="number" maxlength="11" class="short number"/>(${product.unit})及以上,
- <input name="buyPrice" type="number" maxlength="11" class="short price"/>元/(${product.unit})
- <a class="delBtn" href="javascript:;">删除</a>
- <a class="addBtn" href="javascript:;">添加</a>
- <input type="hidden" name="id"/>
- <input class="delFlag" type="hidden" value="1" name="delFlag"/>
- </span>
- </div>
- <div class="ladderPrice" style="display: none">
- 起订量:
- <input name="buyNum" type="number" maxlength="11" class="short number"/>(${product.unit})及以上,
- <input name="buyPrice" type="number" maxlength="11" class="short price"/>元/(${product.unit})
- <a class="delBtn" href="javascript:;">删除</a>
- </span>
- <input type="hidden" name="id"/>
- <input class="delFlag" type="hidden" value="1" name="delFlag"/>
- </div>
- </div>
- </div>
- </script>
- <% request.setAttribute("caimeiCore", Global.getConfig("caimei.core"));%>
- <script type="text/javascript" src="${ctxStatic}/ckeditor5-new/ckeditor.js"></script>
- <script type="text/javascript" src="${ctxStatic}/auto-input.js"></script>
- <script type="text/javascript" src="${ctxStatic}/bootstrap-select/js/bootstrap-select.js"></script>
- <script type="text/javascript">
- $('#caimei').change(function () {
- var item = $('#caimei').val()
- console.log('item---'+item)
- var check = $(this).prop('checked')
- console.log('check---'+check)
- if (check) {
- $("#groundSkuCaimei").show(100)
- } else {
- $("#groundSkuCaimei").hide(100)
- }
- })
- $('#bcc').change(function () {
- var item = $('#bcc').val()
- console.log('item---'+item)
- var checkBcc = $(this).prop('checked')
- console.log('checkBcc---'+checkBcc)
- if (checkBcc) {
- $("#groundSkuBcc").show(100)
- } else {
- $("#groundSkuBcc").hide(100)
- }
- })
- /*$(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 autocomplete(text) {
- // return ['三全鲜食(北新泾店)', 'Hot honey 首尔炸鸡(仙霞路)', '新旺角茶餐厅', '泷千家(天山西路店)', '胖仙女纸杯蛋糕(上海凌空店)', '贡茶', '豪大大香鸡排超级奶爸', '茶芝兰(奶茶,手抓饼)', '十二泷町', '星移浓缩咖啡', '阿姨奶茶/豪大大', '新麦甜四季甜品炸鸡', 'Monica摩托主题咖啡店', '浮生若茶(凌空soho店)', 'NONO JUICE 鲜榨果汁', 'CoCo都可(北新泾店)', '快乐柠檬(神州智慧店)', 'Merci Paul cafe', '猫山王(西郊百联店)', '枪会山', '纵食', '钱记', '壹杯加', '唦哇嘀咖', '爱茜茜里(西郊百联)', '爱茜茜里(近铁广场)', '鲜果榨汁(金沙江路和美广店)', '开心丽果(缤谷店)', '超级鸡车(丰庄路店)', '妙生活果园(北新泾店)', '香宜度麻辣香锅', '凡仔汉堡(老真北路店)', '港式小铺', '蜀香源麻辣香锅(剑河路店)', '北京饺子馆', '饭典*新简餐(凌空SOHO店)', '焦耳·川式快餐(金钟路店)', '动力鸡车', '浏阳蒸菜', '四海游龙(天山西路店)', '樱花食堂(凌空店)', '壹分米客家传统调制米粉(天山店)', '福荣祥烧腊(平溪路店)', '速记黄焖鸡米饭', '红辣椒麻辣烫', '(小杨生煎)西郊百联餐厅', '阳阳麻辣烫', '南拳妈妈龙虾盖浇饭'].filter(function (item) {
- // return text && item.indexOf(text) > -1;
- // });
- var keywordlist=new Array();
- <c:forEach items="${SearchFrequencyVo}" var="search">
- keywordlist.push("${search.keyword}")
- </c:forEach>
- return keywordlist.filter(function (item) {
- return text && item.indexOf(text) > -1;
- });
- }
- new AutoComplete({
- el: '.auto-input',
- callback: autocomplete,
- offsetLeft: -25
- });
- 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);
- }
- }
- $('.costCheckFlag').on('change', function () {
- var skus = $("#skus")
- if ($(this).val() == 1) {
- skus.each(function() {
- skus.find('.sku-shopPercent').hide();
- skus.find('.sku-costPrice').show();
- })
- //shopPercent.parent('.sku-shopPercent').hide();
- //costPrice.parent('.sku-costPrice').show();
- } else {
- skus.each(function() {
- skus.find('.sku-shopPercent').show();
- skus.find('.sku-costPrice').hide();
- })
- // shopPercent.parent('.sku-shopPercent').show();
- // costPrice.parent('.sku-costPrice').hide();
- }
- })
- $('.mallCostCheckFlag').on('change', function () {
- console.log('333333')
- var mallSkus = $("#mallSkus")
- if ($(this).val() == 1) {
- mallSkus.each(function() {
- mallSkus.find('.sku-shopPercent').hide(); // shopPercent.parent('.sku-shopPercent').hide();
- mallSkus.find('.sku-costPrice').show();
- })
- } else {
- mallSkus.each(function() {
- mallSkus.find('.sku-shopPercent').show(); // shopPercent.parent('.sku-shopPercent').hide();
- mallSkus.find('.sku-costPrice').hide();
- })
- // shopPercent.parent('.sku-shopPercent').show();
- // costPrice.parent('.sku-costPrice').hide();
- }
- })
- //富文本框编辑
- 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);
- }
- $(document).ready(function () {
- $('body').on('keyup', '#wipeRemarks', function () {
- $('#remarkLen').text($(this).val().length);
- });
- //$("#name").focus();
- $("#inputForm").validate({
- ignore: "",
- submitHandler: function (form) {
- var flag = true;
- var shopId = $("#shopId").val()*1;
- var commodityType = $("input[name='commodityType']:checked").val();
- if (commodityType == '' || commodityType == null) {
- alertx("请选择商品属性");
- flag = false;
- }
- var groundMall = $("input[name='groundMall']:checked").val();
- if (groundMall.length < 1) {
- alertx("请选中上架平台");
- flag = false;
- }
- var costCheckFlag = $("input[name='costCheckFlag']:checked").val();
- var skus = $("#skus .sku")
- skus.each(function() {
- var cost = $(this)
- if (costCheckFlag * 1 === 1) {
- var costPrice = cost.find(".costPrice").val()
- var organizeCostPrice = cost.find(".organizeCostPrice").val()
- var cmCostPrice = cost.find(".cmCostPrice").val()
- var price = cost.find(".computedPrice").val()*1
- if (costPrice == '') {
- alertx("请输入供应商成本价");
- flag = false;
- }
- if (organizeCostPrice == '') {
- alertx("请输入集团成本价");
- flag = false;
- }
- if (cmCostPrice == '') {
- alertx("请输入采美成本价");
- flag = false;
- }
- const num = costPrice*1 + organizeCostPrice*1 + cmCostPrice*1
- if (shopId != 1161 ) {
- if (num != price) {
- alertx("采美国定成本和需为机构价")
- flag = false;
- }
- }else {
- if (num > price) {
- alertx("采美国定成本和不能大于机构价")
- flag = false;
- }
- }
- } else {
- var shopPercent = cost.find(".shopPercent").val()
- var organizePercent = cost.find(".organizePercent").val()
- var cmPercent = cost.find(".cmPercent").val()
- if (shopPercent == '') {
- alertx("请输入成本比例");
- flag = false;
- }
- if (organizePercent == '') {
- alertx("请输入集团比例");
- flag = false;
- }
- if (cmPercent == '') {
- alertx("请输入供应商比例");
- flag = false;
- }
- const num = shopPercent*1 + organizePercent*1 + cmPercent*1
- if (shopId != 1161 ) {
- if (num != 100) {
- alertx("采美佣金比例和需为100")
- flag = false;
- }
- }else {
- if (num > 100) {
- alertx("采美佣金比例和不能大于100")
- flag = false;
- }
- }
- }
- })
- var mallCostCheckFlag = $("input[name='mallCostCheckFlag']:checked").val();
- var mallSkus = $("#mallSkus")
- mallSkus.each(function() {
- var mallCost = $(this)
- if (mallCostCheckFlag * 1 === 1) {
- var mallCostPrice = mallCost.find(".costPrice").val()
- var mallOrganizeCostPrice = mallCost.find(".organizeCostPrice").val()
- var mallCmCostPrice = mallCost.find(".cmCostPrice").val()
- var mallprice = mallCost.find(".computedPrice").val()*1
- if (mallCostPrice == '') {
- alertx("请输入供应商成本价");
- flag = false;
- }
- if (mallOrganizeCostPrice == '') {
- alertx("请输入集团成本价");
- flag = false;
- }
- if (mallCmCostPrice == '') {
- alertx("请输入采美成本价");
- flag = false;
- }
- const num = mallCostPrice*1 + mallOrganizeCostPrice*1 + mallCmCostPrice*1
- if (shopId != 1161 ) {
- if (num != mallprice) {
- alertx("丽格国定成本和需为机构价");
- flag = false;
- }
- } else {
- if (num > mallprice) {
- alertx("丽格国定成本和不能大于机构价")
- flag = false;
- }
- }
- } else {
- var mallShopPercent = mallCost.find(".shopPercent").val()
- var mallOrganizePercent = mallCost.find(".organizePercent").val()
- var mallCmPercent = mallCost.find(".cmPercent").val()
- if (mallShopPercent == '') {
- alertx("请输入成本比例");
- flag = false;
- }
- if (mallOrganizePercent == '') {
- alertx("请输入集团比例");
- flag = false;
- }
- if (mallCmPercent == '') {
- alertx("请输入供应商比例");
- flag = false;
- }
- const num = mallShopPercent*1 + mallOrganizePercent*1 + cmPercent*1
- if (shopId != 1161 ) {
- if (num != 100) {
- alertx("丽格佣金比例和需为100");
- flag = false;
- }
- } else {
- if (num > 100) {
- alertx("丽格佣金比例和不能大于100")
- flag = false;
- }
- }
- }
- })
- if ($('#minBuyNumber:visible').length > 0) {
- var minBuyNumber = $('#minBuyNumber').val();
- if (minBuyNumber <= 0 || minBuyNumber == '') {
- alertx("请输入起订量");
- flag = 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("请输入正确的阶梯价格");
- flag = 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("请输入正确的阶梯价格");
- flag = 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("请输入正确的阶梯价格");
- flag = false;
- }
- }
- var detailInfo = detailInfoEditor.getData();
- if (detailInfo == '') {
- alertx("请输入商品详细信息");
- flag = false;
- }
- var includedTax = $("input[name='includedTax']:checked").val();
- if (includedTax == '' || includedTax == null) {
- alertx("请选择是否含税");
- flag = 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("请输入机构税率");
- flag = false;
- }
- if (supplierTaxPoint == '' || supplierTaxPoint == null) {
- alertx("请输入供应商税率");
- flag = 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') {
- if(!$('#caimei').prop('checked')){
- $("#groundSkuCaimei").remove()
- }
- if(!$('#bcc').prop('checked')){
- $("#groundSkuBcc").remove()
- }
- // 提交订单
- if (flag) {
- loading('正在提交,请稍等...');
- form.submit();
- }
- }
- }, {
- buttonsFocus: 1, closed: function () {
- if (typeof closed == 'function') {
- closed();
- }
- }
- });
- } else {
- if(!$('#caimei').prop('checked')){
- $("#groundSkuCaimei").remove()
- }
- if(!$('#bcc').prop('checked')){
- $("#groundSkuBcc").remove()
- }
- if (flag) {
- 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);
- }
- }
- });
- // 初始化上平台sku显示
- if (-1 != groundMall.indexOf("0")) {
- $('#caimei').attr('checked',true)
- $('#groundSkuCaimei').show(100)
- } else {
- $('#groundSkuCaimei').hide(100)
- }
- if (-1 != groundMall.indexOf("4")) {
- $('#bcc').attr('checked',true)
- $('#groundSkuBcc').show(100)
- } else {
- $('#groundSkuBcc').hide(100)
- }
- // 初始化sku
- insertDefaultSkuRow();
- // 初始化外部商城sku
- insertDefaultMallSkuRow();
- // 初始化关联标签库
- initLabelSelects();
- });
- function initLabelSelects(){
- var labelSelectBox = $('#labelSelectBox');
- labelSelectBox.selectpicker({
- liveSearch: true,
- noneSelectedText: '请选择标签库',
- maxOptions: 6,
- maxOptionsText: '最多选取6个标签库'
- });
- // 回显操作
- var str = '${product.labelIds}';
- if(!str) return;
- var arr = str.split(',');
- console.log(arr);
- labelSelectBox.selectpicker('val', arr);
- }
- <%--// 商品可见度--%>
- <%--/*$(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);
- });
- });
- // $("#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();
- }
- var conn=0;
- var insertStatus='${product.insertStatus}';
- 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);
- // loadGoods();
- }, 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();
- if(insertStatus==1){
- conn=1;
- loadGoods(conn);
- insertStatus++;
- }else{
- loadGoods(conn);
- }
- }
- 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 loadGoods(id){
- var bigType=null;
- if(id==1){
- if(typeof (bigType) != "undefined" && bigType != ""){
- bigType='${product.returnGoodsStutas}'
- $("#goods").html("");
- $("#goods").prev().find(".select2-chosen").text("请选择");
- $("#goods").append("<option value=''>请选择</option>");
- var not='不能';
- var ye='能';
- if(bigType=='2'){
- $("#goods").append("<option value='1'>" + '能' + "</option>");
- $("#goods").append("<option selected value='2'>" + not + "</option>");
- $("#goods").prev().find(".select2-chosen").text(not);
- }else{
- $("#goods").append("<option selected value='1'>" + ye + "</option>");
- $("#goods").append("<option value='2'>" + '不能' + "</option>");
- $("#goods").prev().find(".select2-chosen").text(ye);
- }
- }
- }else{
- if(typeof (bigType) != "undefined" && bigType != ""){
- bigType = $("#bigType").val();
- $("#goods").html("");
- $("#goods").prev().find(".select2-chosen").text("请选择");
- $("#goods").append("<option value=''>请选择</option>");
- var not='不能';
- var ye='能';
- if(bigType=='1014'||bigType=='1016'||bigType=='1021'||bigType=='1023'){
- $("#goods").append("<option value='1'>" + '能' + "</option>");
- $("#goods").append("<option selected value='2'>" + not + "</option>");
- $("#goods").prev().find(".select2-chosen").text(not);
- }else{
- $("#goods").append("<option selected value='1'>" + ye + "</option>");
- $("#goods").append("<option value='2'>" + '不能' + "</option>");
- $("#goods").prev().find(".select2-chosen").text(ye);
- }
- }
- }
- conn++;
- }
- <%--window.onload=function () {--%>
- <%-- console.log('-----------------------onload')--%>
- <%-- $("#goods").val('${product.returnGoodsStutas}')--%>
- <%--}--%>
- //验证字符串最大长度
- 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 skuIndex = 0;
- var productJson = ${productJson};
- console.log("productJson",productJson);
- var skuList = productJson.skuList;
- var mallSkuList = productJson.mallSkuList;
- var groundMall = productJson.groundMall;
- console.log("groundMall",groundMall)
- if (skuList === undefined) {
- skuList = ""
- }
- if (mallSkuList === undefined) {
- mallSkuList = ""
- }
- $(".addSku").click(function () {
- var skuTemplate = $('#skuTemplate').html()
- $("#skus").append(skuTemplate).show();
- var current = $("#skus").find('.sku').eq(-1);
- if(skuList.length>0 || mallSkuList.length >0){
- skuIndexNum = ++skuIndex;
- }else{
- skuIndexNum = 0;
- }
- var product = {
- skuIndex: ++skuIndex-1,
- costCheckFlag: '1',
- ladderPriceFlag: '0'
- }
- setSkuPrototypeValues(current, product, 0);
- skuEventBind(current, product);
- })
- $(".addMallSku").click(function () {
- var skuTemplate = $('#skuTemplate').html()
- $("#mallSkus").append(skuTemplate).show();
- var current = $("#mallSkus").find('.sku').eq(-1);
- if(skuList.length>0 || mallSkuList.length >0){
- skuIndexNum = ++skuIndex;
- }else{
- skuIndexNum = 0;
- }
- var product = {
- skuIndex: ++skuIndex-1,
- costCheckFlag: '1',
- ladderPriceFlag: '0'
- }
- setSkuPrototypeValues(current, product, 4);
- skuEventBind(current, product);
- })
- function deleteDiv(el){
- el.parentNode.parentNode.parentNode.parentNode.removeChild(el.parentNode.parentNode.parentNode);
- }
- function insertDefaultSkuRow() {
- console.log('skuList', skuList);
- if (skuList) {
- for (var i = 0; i < skuList.length; i++) {
- var skuTemplate = $('#skuTemplate').html();
- $("#skus").append(skuTemplate).show();
- var current = $("#skus").find('.sku').eq(-1);
- var product = skuList[i];
- product.skuIndex = i;
- setSkuPrototypeValues(current, product, product.organizeId);
- skuEventBind(current, product);
- skuIndex = i
- }
- } else {
- $("#skus").hide();
- }
- // else {
- // var product = {};
- // product.skuIndex = 0;
- // setSkuPrototypeValues(current, product);
- // skuEventBind(current, product);
- // }
- }
- function insertDefaultMallSkuRow() {
- console.log('mallSkuList', mallSkuList);
- if (mallSkuList) {
- for (var i = skuList.length; i < mallSkuList.length+skuList.length; i++) {
- var skuTemplate = $('#skuTemplate').html();
- $("#mallSkus").append(skuTemplate).show();
- var current = $("#mallSkus").find('.sku').eq(-1);
- var product = mallSkuList[i-skuList.length];
- product.skuIndex = i;
- setSkuPrototypeValues(current, product, product.organizeId);
- skuEventBind(current, product);
- skuIndex = i
- }
- } else {
- $("#mallSkus").hide();
- }
- // else {
- // var product = {};
- // product.skuIndex = 0;
- // setSkuPrototypeValues(current, product);
- // skuEventBind(current, product);
- // }
- }
- /* 设置新增sku属性值 */
- function setSkuPrototypeValues(el, product, organize) {
- console.log(product);
- if (!product) return;
- var skuIndex = product.skuIndex;
- var organizeId = el.find('input[name$="organizeId"]');
- organizeId.val(organize)
- organizeId.attr('name', 'skuList[' + skuIndex + '].organizeId');
- var mallProductId = el.find('input[name$="mallProductId"]');
- mallProductId.val(product.mallProductId)
- mallProductId.attr('name', 'skuList[' + skuIndex + '].mallProductId');
- var index = el.find('input[name$="index"]');
- index.val(skuIndex);
- if(product.skuId){
- var skuId=el.find('input[name$="skuId"]');
- skuId.val(product.skuId);
- skuId.attr('name', 'skuList[' + skuIndex + '].skuId');
- }
- // 包装规格
- var unit = el.find('input[name$="unit"]');
- unit.val(product.unit)
- unit.attr('name', 'skuList[' + skuIndex + '].unit');
- // 市场价
- var normalPrice = el.find('input[name$="normalPrice"]');
- normalPrice.val(product.normalPrice)
- normalPrice.attr('name', 'skuList[' + skuIndex + '].normalPrice');
- // 库存
- var stock = el.find('input[name$="stock"]');
- stock.val(product.stock)
- stock.attr('name', 'skuList[' + skuIndex + '].stock');
- // 成本
- var costCheckFlag = el.find('input[name$="costCheckFlag"]');
- costCheckFlag.attr('name', 'skuList[' + skuIndex + '].costCheckFlag');
- costCheckFlag.eq(0).attr('checked', product.costCheckFlag == 1);
- costCheckFlag.eq(1).attr('checked', product.costCheckFlag != 1);
- // 成本价
- var costPrice = el.find('input[name$="costPrice"]');
- costPrice.val(product.costPrice)
- costPrice.attr('name', 'skuList[' + skuIndex + '].costPrice');
- // 成本价
- var organizeCostPrice = el.find('input[name$="organizeCostPrice"]');
- organizeCostPrice.val(product.organizeCostPrice)
- organizeCostPrice.attr('name', 'skuList[' + skuIndex + '].organizeCostPrice');
- // 成本价
- var cmCostPrice = el.find('input[name$="cmCostPrice"]');
- cmCostPrice.val(product.cmCostPrice)
- cmCostPrice.attr('name', 'skuList[' + skuIndex + '].cmCostPrice');
- // 比例成本百分比
- var shopPercent = el.find('input[name$="shopPercent"]');
- shopPercent.val(product.shopPercent)
- shopPercent.attr('name', 'skuList[' + skuIndex + '].shopPercent');
- // 组织百分比
- var organizePercent = el.find('input[name$="organizePercent"]');
- organizePercent.val(product.organizePercent)
- organizePercent.attr('name', 'skuList[' + skuIndex + '].organizePercent');
- // 采美百分比
- var cmPercent = el.find('input[name$="cmPercent"]');
- cmPercent.val(product.cmPercent)
- cmPercent.attr('name', 'skuList[' + skuIndex + '].cmPercent');
- if (product.costCheckFlag != 1) {
- shopPercent.parent('.sku-shopPercent').show();
- costPrice.parent('.sku-costPrice').hide();
- } else {
- costPrice.parent('.sku-costPrice').show();
- shopPercent.parent('.sku-shopPercent').hide();
- }
- // 机构价
- var price = el.find('input[name$="price"]');
- price.val(product.price)
- price.attr('name', 'skuList[' + skuIndex + '].price');
- // 商品展示阶梯价格
- var ladderPriceFlag = el.find('input[name$="ladderPriceFlag"]');
- // 起订量
- var ladderPriceBox = el.find('.ladderPriceBox');
- ladderPriceFlag.attr('name', 'skuList[' + skuIndex + '].ladderPriceFlag');
- ladderPriceFlag.eq(0).attr('checked', product.ladderPriceFlag != 1);
- ladderPriceFlag.eq(1).attr('checked', product.ladderPriceFlag == 1);
- // 起订量
- var minBuyNumber = el.find('input[name$="minBuyNumber"]');
- minBuyNumber.val(product.minBuyNumber)
- minBuyNumber.attr('name', 'skuList[' + skuIndex + '].minBuyNumber');
- if (product.ladderPriceFlag == 1) {
- ladderPriceBox.show();
- minBuyNumber.parent('.sku-minBuyNumber').hide();
- }
- // if (organize != 0) {
- // ladderPriceFlag.parent().parent().hide();
- // }
- costCheckFlag.parent().parent().hide();
- ladderPriceBox.find('.ladderPrice').each(function (index, item) {
- var ladderPrice = {}
- if (product.ladderPriceList && product.ladderPriceList.length > 0) {
- ladderPrice = product.ladderPriceList[index] || {};
- }
- console.log('ladderPrice---', ladderPrice)
- // 起订量
- var buyNum = $(item).find('[name$="buyNum"]');
- buyNum.val(ladderPrice.buyNum);
- buyNum.attr('name', 'skuList[' + skuIndex + '].ladderPriceList[' + index + '].buyNum');
- console.log('buyNum---', ladderPrice.buyNum)
- if(ladderPrice.buyNum!=null){
- $(this).show()
- }
- // 价格
- var buyPrice = $(item).find('[name$="buyPrice"]');
- buyPrice.val(ladderPrice.buyPrice);
- buyPrice.attr('name', 'skuList[' + skuIndex + '].ladderPriceList[' + index + '].buyPrice');
- // 阶梯价id
- var id = $(item).find('[name$="id"]');
- id.val(ladderPrice.id);
- id.attr('name', 'skuList[' + skuIndex + '].ladderPriceList[' + index + '].id');
- // 阶梯价delFlag
- var delFlag = $(item).find('[name$="delFlag"]');
- delFlag.val(ladderPrice.delFlag || 1);
- delFlag.attr('name', 'skuList[' + skuIndex + '].ladderPriceList[' + index + '].delFlag');
- });
- skuIndex++;
- }
- function skuEventBind(el, product) {
- var i = product.skuIndex;
- // 商品展示阶梯价格
- var ladderPriceFlag = el.find('input[name$="ladderPriceFlag"]');
- // 起订量
- var ladderPriceBox = el.find('.ladderPriceBox');
- var minBuyNumber = el.find('input[name$="minBuyNumber"]');
- // 成本价 or 百分比
- var costCheckFlag = el.find('input[name$="costCheckFlag"]');
- var costPrice = el.find('input[name$="costPrice"]');
- var shopPercent = el.find('input[name$="shopPercent"]');
- var organizePercent = el.find('input[name$="organizePercent"]');
- var cmPercent = el.find('input[name$="cmPercent"]');
- // 机构价
- var clubPrice = el.find('input[name$="skuList[' + i + '].price"]');
- //阶梯价格
- var ladderPrice = el.find('input[name$="skuList[' + i + '].ladderPriceList[0].buyPrice"]');
- var ladderPrice2 = el.find('input[name$="skuList[' + i + '].ladderPriceList[1].buyPrice"]');
- var ladderPrice3 = el.find('input[name$="skuList[' + i + '].ladderPriceList[2].buyPrice"]');
- //起订量
- var num = el.find('input[name$="skuList[' + i + '].ladderPriceList[0].buyNum"]');
- var num2 = el.find('input[name$="skuList[' + i + '].ladderPriceList[1].buyNum"]');
- var num3 = el.find('input[name$="skuList[' + i + '].ladderPriceList[2].buyNum"]');
- num2.on('change', function () {
- var buyNum = num.val() * 1;
- var buyNum2 = num2.val() * 1;
- if (buyNum2 <= buyNum) {
- alertx('请输入大于上一阶起订量的值');
- num2.val('');
- }
- })
- num3.on('change', function () {
- var buyNum2 = num2.val() * 1;
- var buyNum3 = num3.val() * 1;
- if (buyNum3 <= buyNum2) {
- alertx('请输入大于上一阶起订量的值');
- num3.val('');
- }
- })
- ladderPrice.on('change', function () {
- var ldp = ladderPrice.val() * 1;
- var price = clubPrice.val() * 1;
- if (ldp > price) {
- alertx('第一个阶梯价格不能大于机构价');
- ladderPrice.val('');
- }
- })
- ladderPrice2.on('change', function () {
- var ldp2 = ladderPrice2.val() * 1;
- var ldp = ladderPrice.val() * 1;
- if (ldp2 >= ldp) {
- alertx('第二个阶梯价格不能大于第一个阶梯价格');
- ladderPrice2.val('');
- }
- })
- ladderPrice3.on('change', function () {
- var ldp2 = ladderPrice2.val() * 1;
- var ldp3 = ladderPrice3.val() * 1;
- if (ldp3 >= ldp2) {
- alertx('第三个阶梯价格不能大于第二个阶梯价格');
- ladderPrice3.val('');
- }
- })
- ladderPriceFlag.on('change', function () {
- if (product && product.svipFlag == 1 && $(this).val() == 1) {
- alert("超级会员优惠商品不能设置阶梯价格,请先取消优惠后再设置");
- ladderPriceFlag.eq(0).attr('checked', true);
- ladderPriceFlag.eq(1).attr('checked', false);
- ladderPriceFlag.eq(1).attr('disabled', true);
- return;
- }
- if ($(this).val() == 1) {
- ladderPriceBox.show();
- minBuyNumber.parent('.sku-minBuyNumber').hide();
- el.find('input[name$="skuList[' + i + '].ladderPriceList[0].delFlag"]').val(0);
- } else {
- ladderPriceBox.hide();
- minBuyNumber.parent('.sku-minBuyNumber').show();
- }
- })
- ladderPriceBox.find('.addBtn').on('click', function () {
- $(this).hide();
- $(this).parent('.ladderPrice').find('.delBtn').hide();
- $(this).parent('.ladderPrice').next().show();
- $(this).parent('.ladderPrice').next().find('.delBtn').show();
- $(this).parent('.ladderPrice').next().find('.delFlag').val(0);
- })
- ladderPriceBox.find('.delBtn').on('click', function () {
- $(this).hide();
- $(this).parent('.ladderPrice').hide();
- $(this).parent('.ladderPrice').find('.delFlag').val(1);
- $(this).parent('.ladderPrice').prev().find('.addBtn').show();
- $(this).parent('.ladderPrice').prev().find('.delBtn').show();
- })
- if(product.ladderPriceFlag == 1){
- ladderPriceBox.find('.ladderPrice').each(function (index, item) {
- var ladderPrice = product.ladderPriceList[index]
- var delFlag = 1
- if (ladderPrice) {
- delFlag = ladderPrice.delFlag
- }
- console.log(delFlag)
- if (index != 0) {
- $(item).hide();
- }
- if (delFlag == 0 && product.ladderPriceFlag == 1) {
- $(item).show()
- }
- })
- }
- costCheckFlag.on('change', function () {
- if ($(this).val() == 1) {
- shopPercent.parent('.sku-shopPercent').hide();
- costPrice.parent('.sku-costPrice').show();
- } else {
- shopPercent.parent('.sku-shopPercent').show();
- costPrice.parent('.sku-costPrice').hide();
- }
- })
- }
- // 添加相关参数
- 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>
|