1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806 |
- <%@ 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; pointer-events: none">${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) {
- event.preventDefault()
- 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")
- if (skus.length > 0) {
- 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 .sku")
- if (mallSkus.length > 0) {
- 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 + mallCmPercent*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()
- var costCheckFlag = $("input[name='costCheckFlag']:checked").val();
- $("#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: costCheckFlag,
- ladderPriceFlag: '0'
- }
- setSkuPrototypeValues(current, product, 0);
- skuEventBind(current, product);
- })
- $(".addMallSku").click(function () {
- var skuTemplate = $('#skuTemplate').html()
- var mallCostCheckFlag = $("input[name='mallCostCheckFlag']:checked").val();
- $("#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: mallCostCheckFlag,
- 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>
|